chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1424054 - in /chemistry/opencmis/trunk: chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/ chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/...
Date Wed, 19 Dec 2012 19:31:49 GMT
Author: fmui
Date: Wed Dec 19 19:31:49 2012
New Revision: 1424054

URL: http://svn.apache.org/viewvc?rev=1424054&view=rev
Log:
Workbench: added types toolbar (save, update, delete, create type)

Added:
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/deletetype.png
  (with props)
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/newtype.png
  (with props)
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/savetype.png
  (with props)
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/updatetype.png
  (with props)
Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/RepositoryInfoImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DocumentTypeCreationHelper.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypeSplitPane.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypesFrame.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/RepositoryInfoImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/RepositoryInfoImpl.java?rev=1424054&r1=1424053&r2=1424054&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/RepositoryInfoImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/RepositoryInfoImpl.java
Wed Dec 19 19:31:49 2012
@@ -117,7 +117,7 @@ public class RepositoryInfoImpl extends 
         }
 
         try {
-            return CmisVersion.valueOf(versionSupported);
+            return CmisVersion.fromValue(versionSupported);
         } catch (IllegalArgumentException e) {
             return CmisVersion.CMIS_1_0;
         }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DocumentTypeCreationHelper.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DocumentTypeCreationHelper.java?rev=1424054&r1=1424053&r2=1424054&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DocumentTypeCreationHelper.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DocumentTypeCreationHelper.java
Wed Dec 19 19:31:49 2012
@@ -128,7 +128,7 @@ public class DocumentTypeCreationHelper 
         propS = PropertyCreationHelper.createStringDefinition(PropertyIds.DESCRIPTION, "Description",
Updatability.READWRITE);
         propertyDefinitions.put(propS.getId(), propS);
 
-        propId = PropertyCreationHelper.createIdDefinition(PropertyIds.SECONDARY_OBJECT_TYPE_IDS,
"Secondary Type Ids",
+        propId = PropertyCreationHelper.createIdMultiDefinition(PropertyIds.SECONDARY_OBJECT_TYPE_IDS,
"Secondary Type Ids",
                 Updatability.READWRITE);
         propertyDefinitions.put(propId.getId(), propId);
     }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypeSplitPane.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypeSplitPane.java?rev=1424054&r1=1424053&r2=1424054&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypeSplitPane.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypeSplitPane.java
Wed Dec 19 19:31:49 2012
@@ -18,27 +18,17 @@
  */
 package org.apache.chemistry.opencmis.workbench;
 
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.GridLayout;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.OutputStream;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
 
-import javax.swing.JButton;
-import javax.swing.JFileChooser;
 import javax.swing.JMenuItem;
-import javax.swing.JPanel;
 import javax.swing.JPopupMenu;
 import javax.swing.JScrollPane;
 import javax.swing.JSplitPane;
@@ -48,7 +38,6 @@ import javax.swing.table.AbstractTableMo
 import javax.swing.table.TableColumn;
 
 import org.apache.chemistry.opencmis.client.api.ObjectType;
-import org.apache.chemistry.opencmis.client.util.TypeUtils;
 import org.apache.chemistry.opencmis.commons.definitions.DocumentTypeDefinition;
 import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
 import org.apache.chemistry.opencmis.commons.definitions.RelationshipTypeDefinition;
@@ -64,7 +53,7 @@ public class TypeSplitPane extends JSpli
     private final ClientModel model;
 
     private TypeInfoPanel typePanel;
-    private TypeButtonPanel typeButtonPanel;
+
     private PropertyDefinitionTable propertyDefinitionTable;
 
     public TypeSplitPane(ClientModel model) {
@@ -81,14 +70,12 @@ public class TypeSplitPane extends JSpli
 
     private void createGUI() {
         typePanel = new TypeInfoPanel(model);
-        typeButtonPanel = new TypeButtonPanel();
+
         propertyDefinitionTable = new PropertyDefinitionTable();
 
-        JPanel typeBorderPanel = new JPanel(new BorderLayout());
-        typeBorderPanel.add(typePanel, BorderLayout.CENTER);
-        typeBorderPanel.add(typeButtonPanel, BorderLayout.LINE_END);
+        add(typePanel);
 
-        setLeftComponent(new JScrollPane(typeBorderPanel));
+        setLeftComponent(new JScrollPane(typePanel));
         setRightComponent(new JScrollPane(propertyDefinitionTable));
 
         setDividerLocation(300);
@@ -96,7 +83,6 @@ public class TypeSplitPane extends JSpli
 
     public void setType(ObjectType type) {
         typePanel.setType(type);
-        typeButtonPanel.setType(type);
         propertyDefinitionTable.setType(type);
     }
 
@@ -253,106 +239,6 @@ public class TypeSplitPane extends JSpli
         }
     }
 
-    static class TypeButtonPanel extends JPanel {
-
-        private static final long serialVersionUID = 1L;
-
-        private JButton saveToXMLButton;
-        private JButton saveToJSONButton;
-
-        private ObjectType type;
-
-        public TypeButtonPanel() {
-            super();
-            createGUI();
-        }
-
-        private void createGUI() {
-            setBackground(Color.WHITE);
-
-            saveToXMLButton = new JButton("Save type to XML");
-            saveToJSONButton = new JButton("Save type to JSON");
-
-            saveToXMLButton.setEnabled(false);
-            saveToJSONButton.setEnabled(false);
-
-            JPanel buttonPanel = new JPanel(new GridLayout(4, 1));
-            buttonPanel.setBackground(Color.WHITE);
-
-            buttonPanel.add(saveToXMLButton);
-            buttonPanel.add(saveToJSONButton);
-
-            add(buttonPanel);
-
-            saveToXMLButton.addActionListener(new ActionListener() {
-                @Override
-                public void actionPerformed(ActionEvent event) {
-                    JFileChooser fileChooser = new JFileChooser();
-                    fileChooser.setSelectedFile(new File(getFilename() + ".xml"));
-
-                    int chooseResult = fileChooser.showDialog(TypeButtonPanel.this.getParent(),
"Save XML");
-                    if (chooseResult == JFileChooser.APPROVE_OPTION) {
-                        try {
-                            OutputStream out = new BufferedOutputStream(new FileOutputStream(fileChooser
-                                    .getSelectedFile()));
-                            TypeUtils.writeToXML(type, out);
-                            out.flush();
-                            out.close();
-                        } catch (Exception e) {
-                            ClientHelper.showError(TypeButtonPanel.this.getParent(), e);
-                        }
-                    }
-                }
-            });
-
-            saveToJSONButton.addActionListener(new ActionListener() {
-                @Override
-                public void actionPerformed(ActionEvent event) {
-                    JFileChooser fileChooser = new JFileChooser();
-                    fileChooser.setSelectedFile(new File(getFilename() + ".json"));
-
-                    int chooseResult = fileChooser.showDialog(TypeButtonPanel.this.getParent(),
"Save JSON");
-                    if (chooseResult == JFileChooser.APPROVE_OPTION) {
-                        try {
-                            OutputStream out = new BufferedOutputStream(new FileOutputStream(fileChooser
-                                    .getSelectedFile()));
-                            TypeUtils.writeToJSON(type, out);
-                            out.flush();
-                            out.close();
-                        } catch (Exception e) {
-                            ClientHelper.showError(TypeButtonPanel.this.getParent(), e);
-                        }
-                    }
-                }
-            });
-        }
-
-        private String getFilename() {
-            if (type != null) {
-                String filename = type.getId();
-                filename = filename.replace(':', '_');
-                filename = filename.replace('/', '_');
-                filename = filename.replace('\\', '_');
-
-                return filename;
-            }
-
-            return "type";
-        }
-
-        public void setType(ObjectType type) {
-            this.type = type;
-
-            if (type != null) {
-                saveToXMLButton.setEnabled(true);
-                saveToJSONButton.setEnabled(true);
-            } else {
-                saveToXMLButton.setEnabled(false);
-                saveToJSONButton.setEnabled(false);
-            }
-        }
-    }
-
     static class PropertyDefinitionTable extends JTable {
 
         private static final long serialVersionUID = 1L;

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypesFrame.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypesFrame.java?rev=1424054&r1=1424053&r2=1424054&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypesFrame.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypesFrame.java
Wed Dec 19 19:31:49 2012
@@ -18,22 +18,42 @@
  */
 package org.apache.chemistry.opencmis.workbench;
 
+import java.awt.BorderLayout;
 import java.awt.Cursor;
 import java.awt.Dimension;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
 import java.util.List;
 
+import javax.swing.JButton;
+import javax.swing.JFileChooser;
 import javax.swing.JFrame;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+import javax.swing.JPopupMenu;
 import javax.swing.JScrollPane;
 import javax.swing.JSplitPane;
+import javax.swing.JToolBar;
 import javax.swing.JTree;
 import javax.swing.event.TreeSelectionEvent;
 import javax.swing.event.TreeSelectionListener;
+import javax.swing.filechooser.FileFilter;
 import javax.swing.tree.DefaultMutableTreeNode;
 import javax.swing.tree.DefaultTreeModel;
 import javax.swing.tree.TreeSelectionModel;
 
 import org.apache.chemistry.opencmis.client.api.ObjectType;
 import org.apache.chemistry.opencmis.client.api.Tree;
+import org.apache.chemistry.opencmis.client.util.TypeUtils;
+import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
+import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
 import org.apache.chemistry.opencmis.workbench.model.ClientModel;
 
 public class TypesFrame extends JFrame {
@@ -42,8 +62,17 @@ public class TypesFrame extends JFrame {
 
     private static final String WINDOW_TITLE = "CMIS Types";
 
+    private static final int BUTTON_SAVE = 0;
+    private static final int BUTTON_UPDATE = 1;
+    private static final int BUTTON_DELETE = 2;
+    private static final int BUTTON_CREATE = 3;
+
     private final ClientModel model;
+    private RepositoryInfo repInfo;
+    private ObjectType currentType;
 
+    private JToolBar toolBar;
+    private JButton[] toolbarButton;
     private JTree typesTree;
     private TypeSplitPane typePanel;
 
@@ -51,6 +80,14 @@ public class TypesFrame extends JFrame {
         super();
 
         this.model = model;
+
+        try {
+            repInfo = model.getRepositoryInfo();
+        } catch (Exception e) {
+            e.printStackTrace();
+            return;
+        }
+
         createGUI();
         loadData();
     }
@@ -59,6 +96,206 @@ public class TypesFrame extends JFrame {
         setTitle(WINDOW_TITLE + " - " + model.getRepositoryName());
         setPreferredSize(new Dimension(1000, 700));
         setMinimumSize(new Dimension(200, 60));
+        setLayout(new BorderLayout());
+
+        toolBar = new JToolBar("CMIS Types Toolbar", JToolBar.HORIZONTAL);
+
+        toolbarButton = new JButton[4];
+
+        JMenuItem menuItem;
+
+        // -- save ---
+        final JPopupMenu savePopup = new JPopupMenu();
+
+        menuItem = new JMenuItem("Save Type Definition to XML");
+        savePopup.add(menuItem);
+        menuItem.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent event) {
+                JFileChooser fileChooser = createXmlFileChooser();
+                fileChooser.setSelectedFile(new File(getFilename() + ".xml"));
+
+                int chooseResult = fileChooser.showDialog(getRootPane(), "Save XML");
+                if (chooseResult == JFileChooser.APPROVE_OPTION) {
+                    try {
+                        OutputStream out = new BufferedOutputStream(new FileOutputStream(fileChooser.getSelectedFile()));
+                        TypeUtils.writeToXML(currentType, out);
+                        out.flush();
+                        out.close();
+                    } catch (Exception e) {
+                        ClientHelper.showError(getRootPane(), e);
+                    }
+                }
+            }
+        });
+
+        menuItem = new JMenuItem("Save Type Definition to JSON");
+        savePopup.add(menuItem);
+        menuItem.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent event) {
+                JFileChooser fileChooser = createJsonFileChooser();
+                fileChooser.setSelectedFile(new File(getFilename() + ".json"));
+
+                int chooseResult = fileChooser.showDialog(getRootPane(), "Save JSON");
+                if (chooseResult == JFileChooser.APPROVE_OPTION) {
+                    try {
+                        OutputStream out = new BufferedOutputStream(new FileOutputStream(fileChooser.getSelectedFile()));
+                        TypeUtils.writeToJSON(currentType, out);
+                        out.flush();
+                        out.close();
+                    } catch (Exception e) {
+                        ClientHelper.showError(getRootPane(), e);
+                    }
+                }
+            }
+        });
+
+        toolbarButton[BUTTON_SAVE] = new JButton("Save Type Definition", ClientHelper.getIcon("savetype.png"));
+        toolbarButton[BUTTON_SAVE].addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent event) {
+                savePopup.show(toolbarButton[BUTTON_SAVE], 0, toolbarButton[BUTTON_SAVE].getHeight());
+            }
+        });
+        toolBar.add(toolbarButton[BUTTON_SAVE]);
+
+        toolBar.addSeparator();
+
+        // -- update --
+        final JPopupMenu updatePopup = new JPopupMenu();
+        menuItem = new JMenuItem("Load Type Definition from XML");
+        updatePopup.add(menuItem);
+        menuItem.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent event) {
+                JFileChooser fileChooser = createXmlFileChooser();
+
+                int chooseResult = fileChooser.showDialog(getRootPane(), "Load XML");
+                if (chooseResult == JFileChooser.APPROVE_OPTION) {
+                    try {
+                        InputStream in = new BufferedInputStream(new FileInputStream(fileChooser.getSelectedFile()));
+                        ObjectType type = TypeUtils.readFromXML(in);
+                        in.close();
+                        model.getClientSession().getSession().updateType(type);
+                    } catch (Exception e) {
+                        ClientHelper.showError(getRootPane(), e);
+                    }
+                }
+            }
+        });
+
+        menuItem = new JMenuItem("Load Type Definition from JSON");
+        updatePopup.add(menuItem);
+        menuItem.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent event) {
+                JFileChooser fileChooser = createJsonFileChooser();
+
+                int chooseResult = fileChooser.showDialog(getRootPane(), "Load JSON");
+                if (chooseResult == JFileChooser.APPROVE_OPTION) {
+                    try {
+                        InputStream in = new BufferedInputStream(new FileInputStream(fileChooser.getSelectedFile()));
+                        ObjectType type = TypeUtils.readFromJSON(in);
+                        in.close();
+                        model.getClientSession().getSession().updateType(type);
+                    } catch (Exception e) {
+                        ClientHelper.showError(getRootPane(), e);
+                    }
+                }
+            }
+        });
+
+        toolbarButton[BUTTON_UPDATE] = new JButton("Update Type", ClientHelper.getIcon("updatetype.png"));
+        toolbarButton[BUTTON_UPDATE].setEnabled(repInfo.getCmisVersion() != CmisVersion.CMIS_1_0);
+        toolbarButton[BUTTON_UPDATE].addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent event) {
+                updatePopup.show(toolbarButton[BUTTON_UPDATE], 0, toolbarButton[BUTTON_UPDATE].getHeight());
+            }
+        });
+        toolBar.add(toolbarButton[BUTTON_UPDATE]);
+
+        // -- delete --
+        toolbarButton[BUTTON_DELETE] = new JButton("Delete Type", ClientHelper.getIcon("deletetype.png"));
+        toolbarButton[BUTTON_DELETE].setEnabled(repInfo.getCmisVersion() != CmisVersion.CMIS_1_0);
+        toolbarButton[BUTTON_DELETE].addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent event) {
+                int answer = JOptionPane.showConfirmDialog(getOwner(), "Do you really want
to delete the type "
+                        + currentType.getId() + "?", "Delete Type", JOptionPane.YES_NO_OPTION,
+                        JOptionPane.WARNING_MESSAGE);
+
+                if (answer == JOptionPane.YES_OPTION) {
+                    try {
+                        model.getClientSession().getSession().deleteType(currentType.getId());
+                    } catch (Exception e) {
+                        ClientHelper.showError(getRootPane(), e);
+                    }
+
+                    loadData();
+                }
+            }
+        });
+        toolBar.add(toolbarButton[BUTTON_DELETE]);
+
+        toolBar.addSeparator();
+
+        // -- create --
+        final JPopupMenu createPopup = new JPopupMenu();
+        menuItem = new JMenuItem("Load Type Definition from XML");
+        createPopup.add(menuItem);
+        menuItem.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent event) {
+                JFileChooser fileChooser = createXmlFileChooser();
+
+                int chooseResult = fileChooser.showDialog(getRootPane(), "Load XML");
+                if (chooseResult == JFileChooser.APPROVE_OPTION) {
+                    try {
+                        InputStream in = new BufferedInputStream(new FileInputStream(fileChooser.getSelectedFile()));
+                        ObjectType type = TypeUtils.readFromXML(in);
+                        in.close();
+                        model.getClientSession().getSession().createType(type);
+                    } catch (Exception e) {
+                        ClientHelper.showError(getRootPane(), e);
+                    }
+                }
+            }
+        });
+
+        menuItem = new JMenuItem("Load Type Definition from JSON");
+        createPopup.add(menuItem);
+        menuItem.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent event) {
+                JFileChooser fileChooser = createJsonFileChooser();
+
+                int chooseResult = fileChooser.showDialog(getRootPane(), "Load JSON");
+                if (chooseResult == JFileChooser.APPROVE_OPTION) {
+                    try {
+                        InputStream in = new BufferedInputStream(new FileInputStream(fileChooser.getSelectedFile()));
+                        ObjectType type = TypeUtils.readFromJSON(in);
+                        in.close();
+                        model.getClientSession().getSession().createType(type);
+                    } catch (Exception e) {
+                        ClientHelper.showError(getRootPane(), e);
+                    }
+                }
+            }
+        });
+
+        toolbarButton[BUTTON_CREATE] = new JButton("Create Type", ClientHelper.getIcon("newtype.png"));
+        toolbarButton[BUTTON_CREATE].setEnabled(repInfo.getCmisVersion() != CmisVersion.CMIS_1_0);
+        toolbarButton[BUTTON_CREATE].addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent event) {
+                createPopup.show(toolbarButton[BUTTON_CREATE], 0, toolbarButton[BUTTON_CREATE].getHeight());
+            }
+        });
+        toolBar.add(toolbarButton[BUTTON_CREATE]);
+
+        add(toolBar, BorderLayout.PAGE_START);
 
         typesTree = new JTree();
         typesTree.setRootVisible(false);
@@ -73,8 +310,16 @@ public class TypesFrame extends JFrame {
                     return;
                 }
 
-                ObjectType type = ((TypeNode) node.getUserObject()).getType();
-                typePanel.setType(type);
+                currentType = ((TypeNode) node.getUserObject()).getType();
+
+                if (repInfo.getCmisVersion() != CmisVersion.CMIS_1_0) {
+                    toolbarButton[BUTTON_UPDATE].setEnabled(currentType.getTypeMutability()
!= null
+                            && Boolean.TRUE.equals(currentType.getTypeMutability().canUpdate()));
+                    toolbarButton[BUTTON_DELETE].setEnabled(currentType.getTypeMutability()
!= null
+                            && Boolean.TRUE.equals(currentType.getTypeMutability().canDelete()));
+                }
+
+                typePanel.setType(currentType);
             }
         });
 
@@ -83,7 +328,7 @@ public class TypesFrame extends JFrame {
         JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(typesTree),
typePanel);
         splitPane.setDividerLocation(300);
 
-        add(splitPane);
+        add(splitPane, BorderLayout.CENTER);
 
         ClientHelper.installEscapeBinding(this, getRootPane(), true);
 
@@ -94,6 +339,55 @@ public class TypesFrame extends JFrame {
         setVisible(true);
     }
 
+    private JFileChooser createXmlFileChooser() {
+        JFileChooser fileChooser = new JFileChooser();
+        fileChooser.addChoosableFileFilter(new FileFilter() {
+
+            @Override
+            public String getDescription() {
+                return "XML CMIS Type Definition File";
+            }
+
+            @Override
+            public boolean accept(File f) {
+                return f.isDirectory() || f.getName().endsWith(".xml");
+            }
+        });
+
+        return fileChooser;
+    }
+
+    private JFileChooser createJsonFileChooser() {
+        JFileChooser fileChooser = new JFileChooser();
+        fileChooser.addChoosableFileFilter(new FileFilter() {
+
+            @Override
+            public String getDescription() {
+                return "JSON CMIS Type Definition File";
+            }
+
+            @Override
+            public boolean accept(File f) {
+                return f.isDirectory() || f.getName().endsWith(".json");
+            }
+        });
+
+        return fileChooser;
+    }
+
+    private String getFilename() {
+        if (currentType != null) {
+            String filename = currentType.getId();
+            filename = filename.replace(':', '_');
+            filename = filename.replace('/', '_');
+            filename = filename.replace('\\', '_');
+
+            return filename;
+        }
+
+        return "type";
+    }
+
     private void loadData() {
         try {
             setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
@@ -107,6 +401,8 @@ public class TypesFrame extends JFrame {
 
             DefaultTreeModel treeModel = new DefaultTreeModel(rootNode);
             typesTree.setModel(treeModel);
+
+            typesTree.setSelectionRow(0);
         } catch (Exception ex) {
             ClientHelper.showError(null, ex);
             return;

Added: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/deletetype.png
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/deletetype.png?rev=1424054&view=auto
==============================================================================
Binary file - no diff available.

Propchange: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/deletetype.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/newtype.png
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/newtype.png?rev=1424054&view=auto
==============================================================================
Binary file - no diff available.

Propchange: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/newtype.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/savetype.png
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/savetype.png?rev=1424054&view=auto
==============================================================================
Binary file - no diff available.

Propchange: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/savetype.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/updatetype.png
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/updatetype.png?rev=1424054&view=auto
==============================================================================
Binary file - no diff available.

Propchange: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/updatetype.png
------------------------------------------------------------------------------
    svn:mime-type = image/png



Mime
View raw message