chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1022605 - in /incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench: ./ details/
Date Thu, 14 Oct 2010 16:36:17 GMT
Author: fmui
Date: Thu Oct 14 16:36:17 2010
New Revision: 1022605

URL: http://svn.apache.org/viewvc?rev=1022605&view=rev
Log:
- added type tab to workbench

Added:
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypeSplitPane.java
  (with props)
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/TypesPanel.java
  (with props)
Modified:
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ChangeLogFrame.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypesFrame.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/DetailsTabs.java

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ChangeLogFrame.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ChangeLogFrame.java?rev=1022605&r1=1022604&r2=1022605&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ChangeLogFrame.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ChangeLogFrame.java
Thu Oct 14 16:36:17 2010
@@ -73,6 +73,10 @@ public class ChangeLogFrame extends JFra
         inputPanel.add(new JLabel("Change Log Token:"), BorderLayout.LINE_START);
 
         changeLogTokenField = new JTextField();
+        try {
+            changeLogTokenField.setText(model.getRepositoryInfo().getLatestChangeLogToken());
+        } catch (Exception e1) {
+        }
         inputPanel.add(changeLogTokenField, BorderLayout.CENTER);
 
         JButton loadButton = new JButton("Load");

Added: incubator/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/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypeSplitPane.java?rev=1022605&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypeSplitPane.java
(added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypeSplitPane.java
Thu Oct 14 16:36:17 2010
@@ -0,0 +1,314 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.workbench;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import javax.swing.JCheckBox;
+import javax.swing.JScrollPane;
+import javax.swing.JSplitPane;
+import javax.swing.JTable;
+import javax.swing.JTextField;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableColumn;
+
+import org.apache.chemistry.opencmis.client.api.ObjectType;
+import org.apache.chemistry.opencmis.commons.definitions.DocumentTypeDefinition;
+import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
+import org.apache.chemistry.opencmis.commons.definitions.RelationshipTypeDefinition;
+import org.apache.chemistry.opencmis.workbench.swing.CollectionRenderer;
+import org.apache.chemistry.opencmis.workbench.swing.InfoPanel;
+
+public class TypeSplitPane extends JSplitPane {
+
+    private static final long serialVersionUID = 1L;
+
+    private TypeInfoPanel typePanel;
+    private PropertyDefinitionTable propertyDefinitionTable;
+
+    public TypeSplitPane() {
+        super(JSplitPane.VERTICAL_SPLIT);
+        createGUI();
+    }
+
+    private void createGUI() {
+        typePanel = new TypeInfoPanel();
+        propertyDefinitionTable = new PropertyDefinitionTable();
+
+        setLeftComponent(new JScrollPane(typePanel));
+        setRightComponent(new JScrollPane(propertyDefinitionTable));
+
+        setDividerLocation(300);
+    }
+
+    public void setType(ObjectType type) {
+        typePanel.setType(type);
+        propertyDefinitionTable.setType(type);
+    }
+
+    static class TypeInfoPanel extends InfoPanel {
+
+        private static final long serialVersionUID = 1L;
+
+        private JTextField nameField;
+        private JTextField descriptionField;
+        private JTextField idField;
+        private JTextField localNamespaceField;
+        private JTextField localNameField;
+        private JTextField queryNameField;
+        private JTextField baseTypeField;
+        private JCheckBox creatableBox;
+        private JCheckBox fileableBox;
+        private JCheckBox queryableBox;
+        private JCheckBox aclBox;
+        private JCheckBox policyBox;
+        private JCheckBox versionableBox;
+        private JTextField contentStreamAllowedField;
+        private JTextField allowedSourceTypesField;
+        private JTextField allowedTargetTypesField;
+
+        public TypeInfoPanel() {
+            super();
+            createGUI();
+        }
+
+        public void setType(ObjectType type) {
+            if (type != null) {
+                nameField.setText(type.getDisplayName());
+                descriptionField.setText(type.getDescription());
+                idField.setText(type.getId());
+                localNamespaceField.setText(type.getLocalNamespace());
+                localNameField.setText(type.getLocalName());
+                queryNameField.setText(type.getQueryName());
+                baseTypeField.setText(type.getBaseTypeId().value());
+                creatableBox.setSelected(is(type.isCreatable()));
+                fileableBox.setSelected(is(type.isFileable()));
+                queryableBox.setSelected(is(type.isQueryable()));
+                aclBox.setSelected(is(type.isControllableAcl()));
+                policyBox.setSelected(is(type.isControllablePolicy()));
+
+                if (type instanceof DocumentTypeDefinition) {
+                    DocumentTypeDefinition docType = (DocumentTypeDefinition) type;
+                    versionableBox.setVisible(true);
+                    versionableBox.setSelected(is(docType.isVersionable()));
+                    contentStreamAllowedField.setVisible(true);
+                    contentStreamAllowedField.setText(docType.getContentStreamAllowed() ==
null ? "???" : docType
+                            .getContentStreamAllowed().toString());
+                } else {
+                    versionableBox.setVisible(false);
+                    contentStreamAllowedField.setVisible(false);
+                }
+
+                if (type instanceof RelationshipTypeDefinition) {
+                    RelationshipTypeDefinition relationshipType = (RelationshipTypeDefinition)
type;
+                    allowedSourceTypesField.setVisible(true);
+                    allowedSourceTypesField.setText(relationshipType.getAllowedSourceTypeIds()
== null ? "???"
+                            : relationshipType.getAllowedSourceTypeIds().toString());
+                    allowedTargetTypesField.setVisible(true);
+                    allowedTargetTypesField.setText(relationshipType.getAllowedTargetTypeIds()
== null ? "???"
+                            : relationshipType.getAllowedTargetTypeIds().toString());
+                } else {
+                    allowedSourceTypesField.setVisible(false);
+                    allowedTargetTypesField.setVisible(false);
+                }
+            } else {
+                nameField.setText("");
+                descriptionField.setText("");
+                idField.setText("");
+                localNamespaceField.setText("");
+                localNameField.setText("");
+                queryNameField.setText("");
+                baseTypeField.setText("");
+                creatableBox.setSelected(false);
+                fileableBox.setSelected(false);
+                queryableBox.setSelected(false);
+                aclBox.setSelected(false);
+                policyBox.setSelected(false);
+                versionableBox.setVisible(false);
+                contentStreamAllowedField.setVisible(false);
+                allowedSourceTypesField.setVisible(false);
+                allowedTargetTypesField.setVisible(false);
+            }
+
+            revalidate();
+        }
+
+        private void createGUI() {
+            setupGUI();
+
+            nameField = addLine("Name:", true);
+            descriptionField = addLine("Description:");
+            idField = addLine("Id:");
+            localNamespaceField = addLine("Local Namespace:");
+            localNameField = addLine("Local Name:");
+            queryNameField = addLine("Query Name:");
+            baseTypeField = addLine("Base Type:");
+            creatableBox = addCheckBox("Creatable:");
+            fileableBox = addCheckBox("Fileable:");
+            queryableBox = addCheckBox("Queryable:");
+            aclBox = addCheckBox("ACL controlable:");
+            policyBox = addCheckBox("Policy controlable:");
+            versionableBox = addCheckBox("Versionable:");
+            contentStreamAllowedField = addLine("Content stream allowed:");
+            allowedSourceTypesField = addLine("Allowed source types:");
+            allowedTargetTypesField = addLine("Allowed target types:");
+        }
+
+        private boolean is(Boolean b) {
+            if (b == null) {
+                return false;
+            }
+
+            return b.booleanValue();
+        }
+    }
+
+    static class PropertyDefinitionTable extends JTable {
+
+        private static final long serialVersionUID = 1L;
+
+        private static final String[] COLUMN_NAMES = { "Name", "Id", "Description", "Local
Namespace", "Local Name",
+                "Query Name", "Type", "Cardinality", "Updatability", "Queryable", "Required",
"Inherited",
+                "Default Value", "Choices" };
+        private static final int[] COLUMN_WIDTHS = { 200, 200, 200, 200, 200, 200, 80, 80,
80, 50, 50, 50, 200, 200 };
+
+        private ObjectType type;
+        private List<PropertyDefinition<?>> propertyDefintions;
+
+        public PropertyDefinitionTable() {
+            setDefaultRenderer(Collection.class, new CollectionRenderer());
+            setModel(new PropertyDefinitionTableModel(this));
+
+            setAutoResizeMode(AUTO_RESIZE_OFF);
+
+            for (int i = 0; i < COLUMN_WIDTHS.length; i++) {
+                TableColumn column = getColumnModel().getColumn(i);
+                column.setPreferredWidth(COLUMN_WIDTHS[i]);
+            }
+
+            setFillsViewportHeight(true);
+        }
+
+        public void setType(ObjectType type) {
+            this.type = type;
+
+            if ((type != null) && (type.getPropertyDefinitions() != null)) {
+                propertyDefintions = new ArrayList<PropertyDefinition<?>>();
+                for (PropertyDefinition<?> propDef : type.getPropertyDefinitions().values())
{
+                    propertyDefintions.add(propDef);
+                }
+
+                Collections.sort(propertyDefintions, new Comparator<PropertyDefinition<?>>()
{
+                    public int compare(PropertyDefinition<?> pd1, PropertyDefinition<?>
pd2) {
+                        return pd1.getId().compareTo(pd2.getId());
+                    }
+                });
+            } else {
+                propertyDefintions = null;
+            }
+
+            ((AbstractTableModel) getModel()).fireTableDataChanged();
+        }
+
+        public ObjectType getType() {
+            return type;
+        }
+
+        public List<PropertyDefinition<?>> getPropertyDefinitions() {
+            return propertyDefintions;
+        }
+
+        static class PropertyDefinitionTableModel extends AbstractTableModel {
+
+            private static final long serialVersionUID = 1L;
+
+            private PropertyDefinitionTable table;
+
+            public PropertyDefinitionTableModel(PropertyDefinitionTable table) {
+                this.table = table;
+            }
+
+            public String getColumnName(int columnIndex) {
+                return COLUMN_NAMES[columnIndex];
+            }
+
+            public int getColumnCount() {
+                return COLUMN_NAMES.length;
+            }
+
+            public int getRowCount() {
+                if (table.getPropertyDefinitions() == null) {
+                    return 0;
+                }
+
+                return table.getPropertyDefinitions().size();
+            }
+
+            public Object getValueAt(int rowIndex, int columnIndex) {
+                PropertyDefinition<?> propDef = table.getPropertyDefinitions().get(rowIndex);
+
+                switch (columnIndex) {
+                case 0:
+                    return propDef.getDisplayName();
+                case 1:
+                    return propDef.getId();
+                case 2:
+                    return propDef.getDescription();
+                case 3:
+                    return propDef.getLocalNamespace();
+                case 4:
+                    return propDef.getLocalName();
+                case 5:
+                    return propDef.getQueryName();
+                case 6:
+                    return propDef.getPropertyType();
+                case 7:
+                    return propDef.getCardinality();
+                case 8:
+                    return propDef.getUpdatability();
+                case 9:
+                    return propDef.isQueryable();
+                case 10:
+                    return propDef.isRequired();
+                case 11:
+                    return propDef.isInherited();
+                case 12:
+                    return propDef.getDefaultValue();
+                case 13:
+                    return propDef.getChoices();
+                }
+
+                return null;
+            }
+
+            @Override
+            public Class<?> getColumnClass(int columnIndex) {
+                if ((columnIndex == 12) || (columnIndex == 13)) {
+                    return Collection.class;
+                }
+
+                return super.getColumnClass(columnIndex);
+            }
+        }
+    }
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypeSplitPane.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/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/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypesFrame.java?rev=1022605&r1=1022604&r2=1022605&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypesFrame.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypesFrame.java
Thu Oct 14 16:36:17 2010
@@ -20,35 +20,21 @@ package org.apache.chemistry.opencmis.wo
 
 import java.awt.Cursor;
 import java.awt.Dimension;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
 import java.util.List;
 
-import javax.swing.JCheckBox;
 import javax.swing.JFrame;
 import javax.swing.JScrollPane;
 import javax.swing.JSplitPane;
-import javax.swing.JTable;
-import javax.swing.JTextField;
 import javax.swing.JTree;
 import javax.swing.event.TreeSelectionEvent;
 import javax.swing.event.TreeSelectionListener;
-import javax.swing.table.AbstractTableModel;
-import javax.swing.table.TableColumn;
 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.commons.definitions.DocumentTypeDefinition;
-import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
-import org.apache.chemistry.opencmis.commons.definitions.RelationshipTypeDefinition;
 import org.apache.chemistry.opencmis.workbench.model.ClientModel;
-import org.apache.chemistry.opencmis.workbench.swing.CollectionRenderer;
-import org.apache.chemistry.opencmis.workbench.swing.InfoPanel;
 
 public class TypesFrame extends JFrame {
 
@@ -59,8 +45,7 @@ public class TypesFrame extends JFrame {
     private ClientModel model;
 
     private JTree typesTree;
-    private TypeInfoPanel typePanel;
-    private PropertyDefinitionTable propertyDefinitionTable;
+    private TypeSplitPane typePanel;
 
     public TypesFrame(ClientModel model) {
         super();
@@ -90,18 +75,12 @@ public class TypesFrame extends JFrame {
 
                 ObjectType type = ((TypeNode) node.getUserObject()).getType();
                 typePanel.setType(type);
-                propertyDefinitionTable.setType(type);
             }
         });
 
-        typePanel = new TypeInfoPanel();
-        propertyDefinitionTable = new PropertyDefinitionTable();
+        typePanel = new TypeSplitPane();
 
-        JSplitPane typeSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, new JScrollPane(typePanel),
-                new JScrollPane(propertyDefinitionTable));
-        typeSplitPane.setDividerLocation(300);
-
-        JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(typesTree),
typeSplitPane);
+        JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(typesTree),
typePanel);
         splitPane.setDividerLocation(300);
 
         add(splitPane);
@@ -161,250 +140,4 @@ public class TypesFrame extends JFrame {
             return type.getDisplayName() + " (" + type.getId() + ")";
         }
     }
-
-    static class TypeInfoPanel extends InfoPanel {
-
-        private static final long serialVersionUID = 1L;
-
-        private JTextField nameField;
-        private JTextField descriptionField;
-        private JTextField idField;
-        private JTextField localNamespaceField;
-        private JTextField localNameField;
-        private JTextField queryNameField;
-        private JTextField baseTypeField;
-        private JCheckBox creatableBox;
-        private JCheckBox fileableBox;
-        private JCheckBox queryableBox;
-        private JCheckBox aclBox;
-        private JCheckBox policyBox;
-        private JCheckBox versionableBox;
-        private JTextField contentStreamAllowedField;
-        private JTextField allowedSourceTypesField;
-        private JTextField allowedTargetTypesField;
-
-        public TypeInfoPanel() {
-            super();
-            createGUI();
-        }
-
-        public void setType(ObjectType type) {
-            if (type != null) {
-                nameField.setText(type.getDisplayName());
-                descriptionField.setText(type.getDescription());
-                idField.setText(type.getId());
-                localNamespaceField.setText(type.getLocalNamespace());
-                localNameField.setText(type.getLocalName());
-                queryNameField.setText(type.getQueryName());
-                baseTypeField.setText(type.getBaseTypeId().value());
-                creatableBox.setSelected(is(type.isCreatable()));
-                fileableBox.setSelected(is(type.isFileable()));
-                queryableBox.setSelected(is(type.isQueryable()));
-                aclBox.setSelected(is(type.isControllableAcl()));
-                policyBox.setSelected(is(type.isControllablePolicy()));
-
-                if (type instanceof DocumentTypeDefinition) {
-                    DocumentTypeDefinition docType = (DocumentTypeDefinition) type;
-                    versionableBox.setVisible(true);
-                    versionableBox.setSelected(is(docType.isVersionable()));
-                    contentStreamAllowedField.setVisible(true);
-                    contentStreamAllowedField.setText(docType.getContentStreamAllowed() ==
null ? "???" : docType
-                            .getContentStreamAllowed().toString());
-                } else {
-                    versionableBox.setVisible(false);
-                    contentStreamAllowedField.setVisible(false);
-                }
-
-                if (type instanceof RelationshipTypeDefinition) {
-                    RelationshipTypeDefinition relationshipType = (RelationshipTypeDefinition)
type;
-                    allowedSourceTypesField.setVisible(true);
-                    allowedSourceTypesField.setText(relationshipType.getAllowedSourceTypeIds()
== null ? "???"
-                            : relationshipType.getAllowedSourceTypeIds().toString());
-                    allowedTargetTypesField.setVisible(true);
-                    allowedTargetTypesField.setText(relationshipType.getAllowedTargetTypeIds()
== null ? "???"
-                            : relationshipType.getAllowedTargetTypeIds().toString());
-                } else {
-                    allowedSourceTypesField.setVisible(false);
-                    allowedTargetTypesField.setVisible(false);
-                }
-            } else {
-                nameField.setText("");
-                descriptionField.setText("");
-                idField.setText("");
-                localNamespaceField.setText("");
-                localNameField.setText("");
-                queryNameField.setText("");
-                baseTypeField.setText("");
-                creatableBox.setSelected(false);
-                fileableBox.setSelected(false);
-                queryableBox.setSelected(false);
-                aclBox.setSelected(false);
-                policyBox.setSelected(false);
-                versionableBox.setVisible(false);
-                contentStreamAllowedField.setVisible(false);
-                allowedSourceTypesField.setVisible(false);
-                allowedTargetTypesField.setVisible(false);
-            }
-
-            revalidate();
-        }
-
-        private void createGUI() {
-            setupGUI();
-
-            nameField = addLine("Name:", true);
-            descriptionField = addLine("Description:");
-            idField = addLine("Id:");
-            localNamespaceField = addLine("Local Namespace:");
-            localNameField = addLine("Local Name:");
-            queryNameField = addLine("Query Name:");
-            baseTypeField = addLine("Base Type:");
-            creatableBox = addCheckBox("Creatable:");
-            fileableBox = addCheckBox("Fileable:");
-            queryableBox = addCheckBox("Queryable:");
-            aclBox = addCheckBox("ACL controlable:");
-            policyBox = addCheckBox("Policy controlable:");
-            versionableBox = addCheckBox("Versionable:");
-            contentStreamAllowedField = addLine("Content stream allowed:");
-            allowedSourceTypesField = addLine("Allowed source types:");
-            allowedTargetTypesField = addLine("Allowed target types:");
-        }
-
-        private boolean is(Boolean b) {
-            if (b == null) {
-                return false;
-            }
-
-            return b.booleanValue();
-        }
-    }
-
-    static class PropertyDefinitionTable extends JTable {
-
-        private static final long serialVersionUID = 1L;
-
-        private static final String[] COLUMN_NAMES = { "Name", "Id", "Description", "Local
Namespace", "Local Name",
-                "Query Name", "Type", "Cardinality", "Updatability", "Queryable", "Required",
"Inherited",
-                "Default Value", "Choices" };
-        private static final int[] COLUMN_WIDTHS = { 200, 200, 200, 200, 200, 200, 80, 80,
80, 50, 50, 50, 200, 200 };
-
-        private ObjectType type;
-        private List<PropertyDefinition<?>> propertyDefintions;
-
-        public PropertyDefinitionTable() {
-            setDefaultRenderer(Collection.class, new CollectionRenderer());
-            setModel(new PropertyDefinitionTableModel(this));
-
-            setAutoResizeMode(AUTO_RESIZE_OFF);
-
-            for (int i = 0; i < COLUMN_WIDTHS.length; i++) {
-                TableColumn column = getColumnModel().getColumn(i);
-                column.setPreferredWidth(COLUMN_WIDTHS[i]);
-            }
-
-            setFillsViewportHeight(true);
-        }
-
-        public void setType(ObjectType type) {
-            this.type = type;
-
-            if ((type != null) && (type.getPropertyDefinitions() != null)) {
-                propertyDefintions = new ArrayList<PropertyDefinition<?>>();
-                for (PropertyDefinition<?> propDef : type.getPropertyDefinitions().values())
{
-                    propertyDefintions.add(propDef);
-                }
-
-                Collections.sort(propertyDefintions, new Comparator<PropertyDefinition<?>>()
{
-                    public int compare(PropertyDefinition<?> pd1, PropertyDefinition<?>
pd2) {
-                        return pd1.getId().compareTo(pd2.getId());
-                    }
-                });
-            } else {
-                propertyDefintions = null;
-            }
-
-            ((AbstractTableModel) getModel()).fireTableDataChanged();
-        }
-
-        public ObjectType getType() {
-            return type;
-        }
-
-        public List<PropertyDefinition<?>> getPropertyDefinitions() {
-            return propertyDefintions;
-        }
-
-        static class PropertyDefinitionTableModel extends AbstractTableModel {
-
-            private static final long serialVersionUID = 1L;
-
-            private PropertyDefinitionTable table;
-
-            public PropertyDefinitionTableModel(PropertyDefinitionTable table) {
-                this.table = table;
-            }
-
-            public String getColumnName(int columnIndex) {
-                return COLUMN_NAMES[columnIndex];
-            }
-
-            public int getColumnCount() {
-                return COLUMN_NAMES.length;
-            }
-
-            public int getRowCount() {
-                if (table.getPropertyDefinitions() == null) {
-                    return 0;
-                }
-
-                return table.getPropertyDefinitions().size();
-            }
-
-            public Object getValueAt(int rowIndex, int columnIndex) {
-                PropertyDefinition<?> propDef = table.getPropertyDefinitions().get(rowIndex);
-
-                switch (columnIndex) {
-                case 0:
-                    return propDef.getDisplayName();
-                case 1:
-                    return propDef.getId();
-                case 2:
-                    return propDef.getDescription();
-                case 3:
-                    return propDef.getLocalNamespace();
-                case 4:
-                    return propDef.getLocalName();
-                case 5:
-                    return propDef.getQueryName();
-                case 6:
-                    return propDef.getPropertyType();
-                case 7:
-                    return propDef.getCardinality();
-                case 8:
-                    return propDef.getUpdatability();
-                case 9:
-                    return propDef.isQueryable();
-                case 10:
-                    return propDef.isRequired();
-                case 11:
-                    return propDef.isInherited();
-                case 12:
-                    return propDef.getDefaultValue();
-                case 13:
-                    return propDef.getChoices();
-                }
-
-                return null;
-            }
-
-            @Override
-            public Class<?> getColumnClass(int columnIndex) {
-                if ((columnIndex == 12) || (columnIndex == 13)) {
-                    return Collection.class;
-                }
-
-                return super.getColumnClass(columnIndex);
-            }
-        }
-    }
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/DetailsTabs.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/DetailsTabs.java?rev=1022605&r1=1022604&r2=1022605&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/DetailsTabs.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/DetailsTabs.java
Thu Oct 14 16:36:17 2010
@@ -37,6 +37,7 @@ public class DetailsTabs extends JTabbed
     private ACLTable aclTable;
     private PolicyTable policyTable;
     private VersionTable versionTable;
+    private TypesPanel typesPanel;
     private ExtensionsPanel extensionsPanel;
 
     public DetailsTabs(ClientModel model) {
@@ -55,6 +56,7 @@ public class DetailsTabs extends JTabbed
         aclTable = new ACLTable(model);
         policyTable = new PolicyTable(model);
         versionTable = new VersionTable(model);
+        typesPanel = new TypesPanel(model);
         extensionsPanel = new ExtensionsPanel(model);
 
         addTab("Object", objectPanel);
@@ -65,6 +67,7 @@ public class DetailsTabs extends JTabbed
         addTab("ACL", new JScrollPane(aclTable));
         addTab("Policies", new JScrollPane(policyTable));
         addTab("Versions", new JScrollPane(versionTable));
+        addTab("Type", new JScrollPane(typesPanel));
         addTab("Extensions", new JScrollPane(extensionsPanel));
     }
 }

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/TypesPanel.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/TypesPanel.java?rev=1022605&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/TypesPanel.java
(added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/TypesPanel.java
Thu Oct 14 16:36:17 2010
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.workbench.details;
+
+import org.apache.chemistry.opencmis.client.api.CmisObject;
+import org.apache.chemistry.opencmis.workbench.TypeSplitPane;
+import org.apache.chemistry.opencmis.workbench.model.ClientModel;
+import org.apache.chemistry.opencmis.workbench.model.ClientModelEvent;
+import org.apache.chemistry.opencmis.workbench.model.ObjectListener;
+
+public class TypesPanel extends TypeSplitPane implements ObjectListener {
+
+    private static final long serialVersionUID = 1L;
+
+    private ClientModel model;
+
+    public TypesPanel(ClientModel model) {
+        super();
+
+        this.model = model;
+        model.addObjectListener(this);
+    }
+
+    @Override
+    public void objectLoaded(ClientModelEvent event) {
+        CmisObject object = model.getCurrentObject();
+
+        if (object == null) {
+            setType(null);
+        } else {
+            setType(object.getType());
+        }
+    }
+}

Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/TypesPanel.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message