You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2010/07/22 13:19:11 UTC
svn commit: r966582 [2/3] - in
/incubator/chemistry/opencmis-swingclient/trunk: ./ src/ src/main/
src/main/assembly/ src/main/java/ src/main/java/org/
src/main/java/org/apache/ src/main/java/org/apache/chemistry/
src/main/java/org/apache/chemistry/open...
Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/RepositoryInfoFrame.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/RepositoryInfoFrame.java?rev=966582&view=auto
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/RepositoryInfoFrame.java (added)
+++ incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/RepositoryInfoFrame.java Thu Jul 22 11:19:09 2010
@@ -0,0 +1,205 @@
+/*
+ * 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.swingclient;
+
+import java.awt.Dimension;
+
+import javax.swing.JFrame;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+
+import org.apache.chemistry.opencmis.commons.data.AclCapabilities;
+import org.apache.chemistry.opencmis.commons.data.PermissionMapping;
+import org.apache.chemistry.opencmis.commons.data.RepositoryCapabilities;
+import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
+import org.apache.chemistry.opencmis.commons.definitions.PermissionDefinition;
+import org.apache.chemistry.opencmis.swingclient.model.ClientModel;
+import org.apache.chemistry.opencmis.swingclient.swing.InfoPanel;
+
+public class RepositoryInfoFrame extends JFrame {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String WINDOW_TITLE = "CMIS Repository Info";
+
+ private ClientModel model;
+
+ public RepositoryInfoFrame(ClientModel model) {
+ super();
+
+ this.model = model;
+ createGUI();
+ }
+
+ private void createGUI() {
+ setTitle(WINDOW_TITLE + " - " + model.getRepositoryName());
+ setPreferredSize(new Dimension(700, 700));
+ setMinimumSize(new Dimension(200, 60));
+
+ RepositoryInfo repInfo = null;
+ try {
+ repInfo = model.getRepositoryInfo();
+ } catch (Exception e) {
+ ClientHelper.showError(this, e);
+ dispose();
+ }
+
+ add(new JScrollPane(new RepositoryInfoPanel(repInfo)));
+
+ setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+ pack();
+
+ setLocationRelativeTo(null);
+ setVisible(true);
+ }
+
+ static class RepositoryInfoPanel extends InfoPanel {
+
+ private static final long serialVersionUID = 1L;
+
+ private RepositoryInfo repInfo;
+
+ public RepositoryInfoPanel(RepositoryInfo repInfo) {
+ super();
+
+ this.repInfo = repInfo;
+ createGUI();
+ }
+
+ private void createGUI() {
+ setupGUI();
+
+ addLine("Name:", true).setText(repInfo.getName());
+ addLine("Id:").setText(repInfo.getId());
+ addLine("Description:").setText(repInfo.getDescription());
+ addLine("Vendor:").setText(repInfo.getVendorName());
+ addLine("Product:").setText(
+ repInfo.getProductName() + " "
+ + repInfo.getProductVersion());
+ addLine("CMIS Version:").setText(repInfo.getCmisVersionSupported());
+ addLine("Root folder Id:").setText(repInfo.getRootFolderId());
+ addLine("Latest change token:").setText(
+ repInfo.getLatestChangeLogToken());
+ addLine("Thin client URI:").setText(repInfo.getThinClientUri());
+ addLine("Principal id anonymous:").setText(
+ repInfo.getPrincipalIdAnonymous());
+ addLine("Principal id anyone:").setText(
+ repInfo.getPrincipalIdAnyone());
+ addCheckBox("Changes incomplete:").setSelected(
+ is(repInfo.getChangesIncomplete()));
+ addLine("Changes on type:").setText(
+ repInfo.getChangesOnType() == null ? "" : repInfo
+ .getChangesOnType().toString());
+
+ if (repInfo.getCapabilities() != null) {
+ RepositoryCapabilities cap = repInfo.getCapabilities();
+
+ addLine("Capabilities", true).setText("");
+
+ addCheckBox("Get descendants supported:").setSelected(
+ is(cap.isGetDescendantsSupported()));
+ addCheckBox("Get folder tree supported:").setSelected(
+ is(cap.isGetFolderTreeSupported()));
+ addCheckBox("Unfiling supported:").setSelected(
+ is(cap.isUnfilingSupported()));
+ addCheckBox("Multifiling supported:").setSelected(
+ is(cap.isMultifilingSupported()));
+ addCheckBox("Version specific filing supported:").setSelected(
+ is(cap.isVersionSpecificFilingSupported()));
+ addLine("Query:").setText(str(cap.getQueryCapability()));
+ addLine("Joins:").setText(str(cap.getJoinCapability()));
+ addCheckBox("All versions searchable:").setSelected(
+ is(cap.isAllVersionsSearchableSupported()));
+ addCheckBox("PWC searchable:").setSelected(
+ is(cap.isPwcSearchableSupported()));
+ addCheckBox("PWC updatable:").setSelected(
+ is(cap.isPwcUpdatableSupported()));
+ addLine("Content stream updates:").setText(
+ str(cap.getContentStreamUpdatesCapability()));
+ addLine("Renditions:").setText(
+ str(cap.getRenditionsCapability()));
+ addLine("Changes:").setText(str(cap.getChangesCapability()));
+ addLine("ACLs:").setText(str(cap.getAclCapability()));
+ }
+
+ if (repInfo.getAclCapabilities() != null) {
+ AclCapabilities cap = repInfo.getAclCapabilities();
+
+ addLine("ACL Capabilities", true).setText("");
+
+ addLine("Supported permissions:").setText(
+ str(cap.getSupportedPermissions()));
+ addLine("ACL propagation:").setText(
+ str(cap.getAclPropagation()));
+
+ if (cap.getPermissions() != null) {
+ String[][] data = new String[cap.getPermissions().size()][2];
+
+ int i = 0;
+ for (PermissionDefinition pd : cap.getPermissions()) {
+ data[i][0] = pd.getId();
+ data[i][1] = pd.getDescription();
+ i++;
+ }
+
+ JTable permTable = new JTable(data, new String[] {
+ "Permission", "Description" });
+ permTable.setFillsViewportHeight(true);
+ addComponent("Permissions", new JScrollPane(permTable));
+ }
+
+ if (cap.getPermissionMapping() != null) {
+ String[][] data = new String[cap.getPermissionMapping()
+ .size()][2];
+
+ int i = 0;
+ for (PermissionMapping pm : cap.getPermissionMapping()
+ .values()) {
+ data[i][0] = pm.getKey();
+ data[i][1] = (pm.getPermissions() == null ? "" : pm
+ .getPermissions().toString());
+ i++;
+ }
+
+ JTable permMapTable = new JTable(data, new String[] {
+ "Key", "Permissions" });
+ permMapTable.setFillsViewportHeight(true);
+ addComponent("Permission mapping", new JScrollPane(
+ permMapTable));
+ }
+ }
+ }
+
+ private boolean is(Boolean b) {
+ if (b == null) {
+ return false;
+ }
+
+ return b.booleanValue();
+ }
+
+ private String str(Object o) {
+ if (o == null) {
+ return "?";
+ }
+
+ return o.toString();
+ }
+ }
+}
Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/RepositoryInfoFrame.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/SwingClient.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/SwingClient.java?rev=966582&view=auto
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/SwingClient.java (added)
+++ incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/SwingClient.java Thu Jul 22 11:19:09 2010
@@ -0,0 +1,65 @@
+/*
+ * 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.swingclient;
+
+import java.lang.reflect.InvocationTargetException;
+
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.swing.UIManager;
+import javax.swing.UIManager.LookAndFeelInfo;
+
+public class SwingClient {
+
+ public SwingClient() throws InterruptedException, InvocationTargetException {
+
+ // set up Swing
+ try {
+ boolean nimbus = false;
+
+ for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
+ if ("Nimbus".equals(info.getName())) {
+ UIManager.setLookAndFeel(info.getClassName());
+ nimbus = true;
+ break;
+ }
+ }
+
+ if (!nimbus) {
+ UIManager.setLookAndFeel(UIManager
+ .getSystemLookAndFeelClassName());
+ }
+ } catch (Exception e) {
+ }
+
+ JFrame.setDefaultLookAndFeelDecorated(true);
+ JDialog.setDefaultLookAndFeelDecorated(true);
+
+ // show client frame
+ javax.swing.SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ new ClientFrame();
+ }
+ });
+ }
+
+ public static void main(String[] args) throws Exception {
+ new SwingClient();
+ }
+}
Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/SwingClient.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/TypesFrame.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/TypesFrame.java?rev=966582&view=auto
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/TypesFrame.java (added)
+++ incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/TypesFrame.java Thu Jul 22 11:19:09 2010
@@ -0,0 +1,409 @@
+/*
+ * 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.swingclient;
+
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.util.ArrayList;
+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.swingclient.model.ClientModel;
+import org.apache.chemistry.opencmis.swingclient.swing.InfoPanel;
+
+public class TypesFrame extends JFrame {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String WINDOW_TITLE = "CMIS Types";
+
+ private ClientModel model;
+
+ private JTree typesTree;
+ private TypeInfoPanel typePanel;
+ private PropertyDefinitionTable propertyDefinitionTable;
+
+ public TypesFrame(ClientModel model) {
+ super();
+
+ this.model = model;
+ createGUI();
+ loadData();
+ }
+
+ private void createGUI() {
+ setTitle(WINDOW_TITLE + " - " + model.getRepositoryName());
+ setPreferredSize(new Dimension(800, 600));
+ setMinimumSize(new Dimension(200, 60));
+
+ typesTree = new JTree();
+ typesTree.setRootVisible(false);
+ typesTree.getSelectionModel().setSelectionMode(
+ TreeSelectionModel.SINGLE_TREE_SELECTION);
+
+ typesTree.addTreeSelectionListener(new TreeSelectionListener() {
+ public void valueChanged(TreeSelectionEvent e) {
+ DefaultMutableTreeNode node = (DefaultMutableTreeNode) ((JTree) e
+ .getSource()).getLastSelectedPathComponent();
+
+ if (node == null) {
+ return;
+ }
+
+ ObjectType type = ((TypeNode) node.getUserObject()).getType();
+ typePanel.setType(type);
+ propertyDefinitionTable.setType(type);
+ }
+ });
+
+ typePanel = new TypeInfoPanel();
+ propertyDefinitionTable = new PropertyDefinitionTable();
+
+ 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);
+ splitPane.setDividerLocation(300);
+
+ add(splitPane);
+
+ setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+ pack();
+
+ setLocationRelativeTo(null);
+ setVisible(true);
+ }
+
+ private void loadData() {
+ try {
+ setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+
+ DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode();
+
+ List<Tree<ObjectType>> types = model.getTypeDescendants();
+ for (Tree<ObjectType> tt : types) {
+ addLevel(rootNode, tt);
+ }
+
+ DefaultTreeModel treeModel = new DefaultTreeModel(rootNode);
+ typesTree.setModel(treeModel);
+ } catch (Exception ex) {
+ ClientHelper.showError(null, ex);
+ return;
+ } finally {
+ setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ }
+ }
+
+ private void addLevel(DefaultMutableTreeNode parent, Tree<ObjectType> tree) {
+ DefaultMutableTreeNode node = new DefaultMutableTreeNode(new TypeNode(
+ tree.getItem()));
+ parent.add(node);
+
+ if (tree.getChildren() != null) {
+ for (Tree<ObjectType> tt : tree.getChildren()) {
+ addLevel(node, tt);
+ }
+ }
+ }
+
+ static class TypeNode {
+ private ObjectType type;
+
+ public TypeNode(ObjectType type) {
+ this.type = type;
+ }
+
+ public ObjectType getType() {
+ return type;
+ }
+
+ @Override
+ public String toString() {
+ 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" };
+ private static final int[] COLUMN_WIDTHS = { 200, 200, 200, 200, 200,
+ 200, 80, 80, 80, 50, 50, 50 };
+
+ private ObjectType type;
+ private List<PropertyDefinition<?>> propertyDefintions;
+
+ public PropertyDefinitionTable() {
+ 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 PropertyDefinitionTable table;
+
+ public PropertyDefinitionTableModel(PropertyDefinitionTable table) {
+ this.table = table;
+ }
+
+ private static final long serialVersionUID = 1L;
+
+ 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();
+ }
+
+ return null;
+ }
+ }
+ }
+}
Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/TypesFrame.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/CancelCheckOutPanel.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/CancelCheckOutPanel.java?rev=966582&view=auto
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/CancelCheckOutPanel.java (added)
+++ incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/CancelCheckOutPanel.java Thu Jul 22 11:19:09 2010
@@ -0,0 +1,57 @@
+/*
+ * 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.swingclient.actions;
+
+import org.apache.chemistry.opencmis.client.api.Document;
+import org.apache.chemistry.opencmis.commons.enums.Action;
+import org.apache.chemistry.opencmis.swingclient.model.ClientModel;
+import org.apache.chemistry.opencmis.swingclient.swing.ActionPanel;
+
+public class CancelCheckOutPanel extends ActionPanel {
+
+ private static final long serialVersionUID = 1L;
+
+ public CancelCheckOutPanel(ClientModel model) {
+ super("Cancel Check-out Object", "Cancel Check-out", model);
+ }
+
+ @Override
+ protected void createActionComponents() {
+ }
+
+ @Override
+ public boolean isAllowed() {
+ if ((getObject() == null) || !(getObject() instanceof Document)) {
+ return false;
+ }
+
+ if ((getObject().getAllowableActions() == null)
+ || (getObject().getAllowableActions().getAllowableActions() == null)) {
+ return true;
+ }
+
+ return getObject().getAllowableActions().getAllowableActions()
+ .contains(Action.CAN_CANCEL_CHECK_OUT);
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ ((Document) getObject()).cancelCheckOut();
+ }
+}
Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/CancelCheckOutPanel.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/CheckInPanel.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/CheckInPanel.java?rev=966582&view=auto
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/CheckInPanel.java (added)
+++ incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/CheckInPanel.java Thu Jul 22 11:19:09 2010
@@ -0,0 +1,72 @@
+/*
+ * 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.swingclient.actions;
+
+import javax.swing.JCheckBox;
+import javax.swing.JTextField;
+
+import org.apache.chemistry.opencmis.client.api.Document;
+import org.apache.chemistry.opencmis.commons.data.ContentStream;
+import org.apache.chemistry.opencmis.commons.enums.Action;
+import org.apache.chemistry.opencmis.swingclient.model.ClientModel;
+import org.apache.chemistry.opencmis.swingclient.swing.ActionPanel;
+
+public class CheckInPanel extends ActionPanel {
+
+ private static final long serialVersionUID = 1L;
+
+ private JCheckBox majorBox;
+ private JTextField filenameField;
+
+ public CheckInPanel(ClientModel model) {
+ super("Check-in Object", "Check-in", model);
+ }
+
+ @Override
+ protected void createActionComponents() {
+ majorBox = new JCheckBox("major version", true);
+ addActionComponent(majorBox);
+
+ filenameField = new JTextField(30);
+ addActionComponent(createFilenamePanel(filenameField));
+ }
+
+ @Override
+ public boolean isAllowed() {
+ if ((getObject() == null) || !(getObject() instanceof Document)) {
+ return false;
+ }
+
+ if ((getObject().getAllowableActions() == null)
+ || (getObject().getAllowableActions().getAllowableActions() == null)) {
+ return true;
+ }
+
+ return getObject().getAllowableActions().getAllowableActions()
+ .contains(Action.CAN_CHECK_IN);
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ ContentStream content = getClientModel().createContentStream(
+ filenameField.getText());
+ ((Document) getObject()).checkIn(majorBox.isSelected(), null, content,
+ null, null, null, null);
+ }
+}
\ No newline at end of file
Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/CheckInPanel.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/CheckOutPanel.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/CheckOutPanel.java?rev=966582&view=auto
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/CheckOutPanel.java (added)
+++ incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/CheckOutPanel.java Thu Jul 22 11:19:09 2010
@@ -0,0 +1,57 @@
+/*
+ * 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.swingclient.actions;
+
+import org.apache.chemistry.opencmis.client.api.Document;
+import org.apache.chemistry.opencmis.commons.enums.Action;
+import org.apache.chemistry.opencmis.swingclient.model.ClientModel;
+import org.apache.chemistry.opencmis.swingclient.swing.ActionPanel;
+
+public class CheckOutPanel extends ActionPanel {
+
+ private static final long serialVersionUID = 1L;
+
+ public CheckOutPanel(ClientModel model) {
+ super("Check-out Object", "Check-out", model);
+ }
+
+ @Override
+ protected void createActionComponents() {
+ }
+
+ @Override
+ public boolean isAllowed() {
+ if ((getObject() == null) || !(getObject() instanceof Document)) {
+ return false;
+ }
+
+ if ((getObject().getAllowableActions() == null)
+ || (getObject().getAllowableActions().getAllowableActions() == null)) {
+ return true;
+ }
+
+ return getObject().getAllowableActions().getAllowableActions()
+ .contains(Action.CAN_CHECK_OUT);
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ ((Document) getObject()).checkOut();
+ }
+}
Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/CheckOutPanel.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/DeleteContentStreamPanel.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/DeleteContentStreamPanel.java?rev=966582&view=auto
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/DeleteContentStreamPanel.java (added)
+++ incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/DeleteContentStreamPanel.java Thu Jul 22 11:19:09 2010
@@ -0,0 +1,57 @@
+/*
+ * 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.swingclient.actions;
+
+import org.apache.chemistry.opencmis.client.api.Document;
+import org.apache.chemistry.opencmis.commons.enums.Action;
+import org.apache.chemistry.opencmis.swingclient.model.ClientModel;
+import org.apache.chemistry.opencmis.swingclient.swing.ActionPanel;
+
+public class DeleteContentStreamPanel extends ActionPanel {
+
+ private static final long serialVersionUID = 1L;
+
+ public DeleteContentStreamPanel(ClientModel model) {
+ super("Delete Content Stream", "Delete Content Stream", model);
+ }
+
+ @Override
+ protected void createActionComponents() {
+ }
+
+ @Override
+ public boolean isAllowed() {
+ if ((getObject() == null) || !(getObject() instanceof Document)) {
+ return false;
+ }
+
+ if ((getObject().getAllowableActions() == null)
+ || (getObject().getAllowableActions().getAllowableActions() == null)) {
+ return true;
+ }
+
+ return getObject().getAllowableActions().getAllowableActions()
+ .contains(Action.CAN_DELETE_CONTENT_STREAM);
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ ((Document) getObject()).deleteContentStream();
+ }
+}
\ No newline at end of file
Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/DeleteContentStreamPanel.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/DeletePanel.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/DeletePanel.java?rev=966582&view=auto
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/DeletePanel.java (added)
+++ incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/DeletePanel.java Thu Jul 22 11:19:09 2010
@@ -0,0 +1,62 @@
+/*
+ * 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.swingclient.actions;
+
+import javax.swing.JCheckBox;
+
+import org.apache.chemistry.opencmis.commons.enums.Action;
+import org.apache.chemistry.opencmis.swingclient.model.ClientModel;
+import org.apache.chemistry.opencmis.swingclient.swing.ActionPanel;
+
+public class DeletePanel extends ActionPanel {
+
+ private static final long serialVersionUID = 1L;
+
+ private JCheckBox allVersionsBox;
+
+ public DeletePanel(ClientModel model) {
+ super("Delete Object", "Delete", model);
+ }
+
+ @Override
+ protected void createActionComponents() {
+ allVersionsBox = new JCheckBox("delete all versions", true);
+ addActionComponent(allVersionsBox);
+ }
+
+ @Override
+ public boolean isAllowed() {
+ if (getObject() == null) {
+ return false;
+ }
+
+ if ((getObject().getAllowableActions() == null)
+ || (getObject().getAllowableActions().getAllowableActions() == null)) {
+ return true;
+ }
+
+ return getObject().getAllowableActions().getAllowableActions()
+ .contains(Action.CAN_DELETE_OBJECT);
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ getObject().delete(allVersionsBox.isSelected());
+ }
+}
Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/DeletePanel.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/DeleteTreePanel.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/DeleteTreePanel.java?rev=966582&view=auto
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/DeleteTreePanel.java (added)
+++ incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/DeleteTreePanel.java Thu Jul 22 11:19:09 2010
@@ -0,0 +1,77 @@
+/*
+ * 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.swingclient.actions;
+
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+
+import org.apache.chemistry.opencmis.client.api.Folder;
+import org.apache.chemistry.opencmis.commons.enums.Action;
+import org.apache.chemistry.opencmis.commons.enums.UnfileObject;
+import org.apache.chemistry.opencmis.swingclient.model.ClientModel;
+import org.apache.chemistry.opencmis.swingclient.swing.ActionPanel;
+
+public class DeleteTreePanel extends ActionPanel {
+
+ private static final long serialVersionUID = 1L;
+
+ private JCheckBox allVersionsBox;
+ private JComboBox unfileObjectsBox;
+ private JCheckBox continueOnFailureBox;
+
+ public DeleteTreePanel(ClientModel model) {
+ super("Delete Tree", "Delete", model);
+ }
+
+ @Override
+ protected void createActionComponents() {
+ allVersionsBox = new JCheckBox("delete all versions", true);
+ addActionComponent(allVersionsBox);
+
+ unfileObjectsBox = new JComboBox(new Object[] { UnfileObject.DELETE,
+ UnfileObject.DELETESINGLEFILED, UnfileObject.UNFILE });
+ unfileObjectsBox.setSelectedIndex(0);
+ addActionComponent(unfileObjectsBox);
+
+ continueOnFailureBox = new JCheckBox("continue on failure", true);
+ addActionComponent(allVersionsBox);
+ }
+
+ @Override
+ public boolean isAllowed() {
+ if ((getObject() == null) || !(getObject() instanceof Folder)) {
+ return false;
+ }
+
+ if ((getObject().getAllowableActions() == null)
+ || (getObject().getAllowableActions().getAllowableActions() == null)) {
+ return true;
+ }
+
+ return getObject().getAllowableActions().getAllowableActions()
+ .contains(Action.CAN_DELETE_TREE);
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ ((Folder) getObject()).deleteTree(allVersionsBox.isSelected(),
+ (UnfileObject) unfileObjectsBox.getSelectedItem(),
+ continueOnFailureBox.isSelected());
+ }
+}
Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/DeleteTreePanel.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/MovePanel.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/MovePanel.java?rev=966582&view=auto
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/MovePanel.java (added)
+++ incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/MovePanel.java Thu Jul 22 11:19:09 2010
@@ -0,0 +1,81 @@
+/*
+ * 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.swingclient.actions;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+
+import org.apache.chemistry.opencmis.client.api.FileableCmisObject;
+import org.apache.chemistry.opencmis.client.api.ObjectId;
+import org.apache.chemistry.opencmis.client.runtime.ObjectIdImpl;
+import org.apache.chemistry.opencmis.commons.enums.Action;
+import org.apache.chemistry.opencmis.swingclient.model.ClientModel;
+import org.apache.chemistry.opencmis.swingclient.swing.ActionPanel;
+
+public class MovePanel extends ActionPanel {
+
+ private static final long serialVersionUID = 1L;
+
+ private JTextField targetFolderField;
+
+ public MovePanel(ClientModel model) {
+ super("Move Object", "Move", model);
+ }
+
+ @Override
+ protected void createActionComponents() {
+ JPanel targetFolderPanel = new JPanel(new BorderLayout());
+ targetFolderPanel.setBackground(Color.WHITE);
+
+ targetFolderPanel.add(new JLabel("Target Folder Id:"),
+ BorderLayout.LINE_START);
+
+ targetFolderField = new JTextField(30);
+ targetFolderPanel.add(targetFolderField, BorderLayout.CENTER);
+
+ addActionComponent(targetFolderPanel);
+ }
+
+ @Override
+ public boolean isAllowed() {
+ if ((getObject() == null)
+ || !(getObject() instanceof FileableCmisObject)) {
+ return false;
+ }
+
+ if ((getObject().getAllowableActions() == null)
+ || (getObject().getAllowableActions().getAllowableActions() == null)) {
+ return true;
+ }
+
+ return getObject().getAllowableActions().getAllowableActions()
+ .contains(Action.CAN_MOVE_OBJECT);
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ ObjectId targetFolderId = new ObjectIdImpl(targetFolderField.getText());
+ ((FileableCmisObject) getObject()).move(getClientModel()
+ .getCurrentFolder(), targetFolderId);
+ }
+}
Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/MovePanel.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/SetContentStreamPanel.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/SetContentStreamPanel.java?rev=966582&view=auto
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/SetContentStreamPanel.java (added)
+++ incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/SetContentStreamPanel.java Thu Jul 22 11:19:09 2010
@@ -0,0 +1,72 @@
+/*
+ * 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.swingclient.actions;
+
+import javax.swing.JCheckBox;
+import javax.swing.JTextField;
+
+import org.apache.chemistry.opencmis.client.api.Document;
+import org.apache.chemistry.opencmis.commons.data.ContentStream;
+import org.apache.chemistry.opencmis.commons.enums.Action;
+import org.apache.chemistry.opencmis.swingclient.model.ClientModel;
+import org.apache.chemistry.opencmis.swingclient.swing.ActionPanel;
+
+public class SetContentStreamPanel extends ActionPanel {
+
+ private static final long serialVersionUID = 1L;
+
+ private JTextField filenameField;
+ private JCheckBox overwriteBox;
+
+ public SetContentStreamPanel(ClientModel model) {
+ super("Set Content Stream", "Set Content Stream", model);
+ }
+
+ @Override
+ protected void createActionComponents() {
+ filenameField = new JTextField(30);
+ addActionComponent(createFilenamePanel(filenameField));
+
+ overwriteBox = new JCheckBox("overwrite", true);
+ addActionComponent(overwriteBox);
+ }
+
+ @Override
+ public boolean isAllowed() {
+ if ((getObject() == null) || !(getObject() instanceof Document)) {
+ return false;
+ }
+
+ if ((getObject().getAllowableActions() == null)
+ || (getObject().getAllowableActions().getAllowableActions() == null)) {
+ return true;
+ }
+
+ return getObject().getAllowableActions().getAllowableActions()
+ .contains(Action.CAN_SET_CONTENT_STREAM);
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ ContentStream content = getClientModel().createContentStream(
+ filenameField.getText());
+ ((Document) getObject()).setContentStream(content, overwriteBox
+ .isSelected());
+ }
+}
\ No newline at end of file
Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/actions/SetContentStreamPanel.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/ACLTable.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/ACLTable.java?rev=966582&view=auto
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/ACLTable.java (added)
+++ incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/ACLTable.java Thu Jul 22 11:19:09 2010
@@ -0,0 +1,57 @@
+/*
+ * 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.swingclient.details;
+
+import org.apache.chemistry.opencmis.commons.data.Ace;
+import org.apache.chemistry.opencmis.swingclient.model.ClientModel;
+
+public class ACLTable extends AbstractDetailsTable {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String[] COLUMN_NAMES = { "Principal", "Permissions" };
+ private static final int[] COLUMN_WIDTHS = { 200, 400 };
+
+ public ACLTable(ClientModel model) {
+ super();
+ init(model, COLUMN_NAMES, COLUMN_WIDTHS);
+ }
+
+ public int getDetailRowCount() {
+ if ((getObject().getAcl() == null)
+ || (getObject().getAcl().getAces() == null)) {
+ return 0;
+ }
+
+ return getObject().getAcl().getAces().size();
+ }
+
+ public Object getDetailValueAt(int rowIndex, int columnIndex) {
+ Ace ace = getObject().getAcl().getAces().get(rowIndex);
+
+ switch (columnIndex) {
+ case 0:
+ return ace.getPrincipalId();
+ case 1:
+ return ace.getPermissions().toString();
+ }
+
+ return null;
+ }
+}
Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/ACLTable.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/AbstractDetailsTable.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/AbstractDetailsTable.java?rev=966582&view=auto
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/AbstractDetailsTable.java (added)
+++ incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/AbstractDetailsTable.java Thu Jul 22 11:19:09 2010
@@ -0,0 +1,177 @@
+/*
+ * 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.swingclient.details;
+
+import java.awt.Toolkit;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.StringSelection;
+import java.awt.datatransfer.Transferable;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+
+import javax.swing.JMenuItem;
+import javax.swing.JPopupMenu;
+import javax.swing.JTable;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableColumn;
+
+import org.apache.chemistry.opencmis.client.api.CmisObject;
+import org.apache.chemistry.opencmis.swingclient.model.ClientModel;
+import org.apache.chemistry.opencmis.swingclient.model.ClientModelEvent;
+import org.apache.chemistry.opencmis.swingclient.model.ObjectListener;
+
+public abstract class AbstractDetailsTable extends JTable implements
+ ObjectListener {
+
+ private static final long serialVersionUID = 1L;
+
+ private ClientModel model;
+ private String[] columnNames;
+
+ public void init(ClientModel model, String[] columnNames,
+ int[] colummnWidths) {
+ this.model = model;
+ model.addObjectListener(this);
+
+ this.columnNames = columnNames;
+
+ setModel(new DetailsTableModel(this));
+
+ setAutoResizeMode(AUTO_RESIZE_OFF);
+ setAutoCreateRowSorter(true);
+
+ for (int i = 0; i < colummnWidths.length; i++) {
+ TableColumn column = getColumnModel().getColumn(i);
+ column.setPreferredWidth(colummnWidths[i]);
+ }
+
+ setFillsViewportHeight(true);
+
+ final JPopupMenu popup = new JPopupMenu();
+ JMenuItem menuItem = new JMenuItem("Copy to clipboard");
+ popup.add(menuItem);
+
+ menuItem.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ StringBuilder sb = new StringBuilder();
+ int rows = getDetailRowCount();
+ for (int row = 0; row < rows; row++) {
+ int cols = getColumnNames().length;
+ for (int col = 0; col < cols; col++) {
+ sb.append(getDetailValueAt(row, col));
+ sb.append("|");
+ }
+ sb.append("\n");
+ }
+
+ Clipboard clipboard = Toolkit.getDefaultToolkit()
+ .getSystemClipboard();
+ Transferable transferable = new StringSelection(sb.toString());
+ clipboard.setContents(transferable, null);
+ }
+ });
+
+ addMouseListener(new MouseListener() {
+ public void mouseExited(MouseEvent e) {
+ }
+
+ public void mouseEntered(MouseEvent e) {
+ }
+
+ public void mouseClicked(MouseEvent e) {
+ if (e.getClickCount() == 2) {
+ int row = getSelectedRow();
+ if ((row > -1) && (row < getModel().getColumnCount())) {
+ doubleClickAction(row);
+ }
+ }
+ }
+
+ public void mousePressed(MouseEvent e) {
+ maybeShowPopup(e);
+ }
+
+ public void mouseReleased(MouseEvent e) {
+ maybeShowPopup(e);
+ }
+
+ private void maybeShowPopup(MouseEvent e) {
+ if (e.isPopupTrigger()) {
+ popup.show(e.getComponent(), e.getX(), e.getY());
+ }
+ }
+ });
+ }
+
+ public void objectLoaded(ClientModelEvent event) {
+ ((DetailsTableModel) getModel()).fireTableDataChanged();
+ }
+
+ public CmisObject getObject() {
+ return model.getCurrentObject();
+ }
+
+ public String[] getColumnNames() {
+ return columnNames;
+ }
+
+ public abstract int getDetailRowCount();
+
+ public abstract Object getDetailValueAt(int rowIndex, int columnIndex);
+
+ public void doubleClickAction(int rowIndex) {
+ }
+
+ static class DetailsTableModel extends AbstractTableModel {
+
+ private AbstractDetailsTable table;
+
+ public DetailsTableModel(AbstractDetailsTable table) {
+ this.table = table;
+ }
+
+ private static final long serialVersionUID = 1L;
+
+ public String getColumnName(int columnIndex) {
+ return table.getColumnNames()[columnIndex];
+ }
+
+ public int getColumnCount() {
+ return table.getColumnNames().length;
+ }
+
+ public int getRowCount() {
+ if (table.getObject() == null) {
+ return 0;
+ }
+
+ return table.getDetailRowCount();
+ }
+
+ public Object getValueAt(int rowIndex, int columnIndex) {
+ if (table.getObject() == null) {
+ return null;
+ }
+
+ return table.getDetailValueAt(rowIndex, columnIndex);
+ }
+ }
+}
Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/AbstractDetailsTable.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/ActionsPanel.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/ActionsPanel.java?rev=966582&view=auto
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/ActionsPanel.java (added)
+++ incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/ActionsPanel.java Thu Jul 22 11:19:09 2010
@@ -0,0 +1,119 @@
+/*
+ * 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.swingclient.details;
+
+import javax.swing.BorderFactory;
+import javax.swing.BoxLayout;
+import javax.swing.JPanel;
+
+import org.apache.chemistry.opencmis.client.api.CmisObject;
+import org.apache.chemistry.opencmis.swingclient.actions.CancelCheckOutPanel;
+import org.apache.chemistry.opencmis.swingclient.actions.CheckInPanel;
+import org.apache.chemistry.opencmis.swingclient.actions.CheckOutPanel;
+import org.apache.chemistry.opencmis.swingclient.actions.DeleteContentStreamPanel;
+import org.apache.chemistry.opencmis.swingclient.actions.DeletePanel;
+import org.apache.chemistry.opencmis.swingclient.actions.DeleteTreePanel;
+import org.apache.chemistry.opencmis.swingclient.actions.MovePanel;
+import org.apache.chemistry.opencmis.swingclient.actions.SetContentStreamPanel;
+import org.apache.chemistry.opencmis.swingclient.model.ClientModel;
+import org.apache.chemistry.opencmis.swingclient.model.ClientModelEvent;
+import org.apache.chemistry.opencmis.swingclient.model.ObjectListener;
+
+public class ActionsPanel extends JPanel implements ObjectListener {
+
+ private static final long serialVersionUID = 1L;
+
+ private ClientModel model;
+
+ private DeletePanel deletePanel;
+ private DeleteTreePanel deleteTreePanel;
+ private MovePanel movePanel;
+ private CheckOutPanel checkOutPanel;
+ private CancelCheckOutPanel cancelCheckOutPanel;
+ private CheckInPanel checkInPanel;
+ private SetContentStreamPanel setContentStreamPanel;
+ private DeleteContentStreamPanel deleteContentStreamPanel;
+
+ public ActionsPanel(ClientModel model) {
+ super();
+
+ this.model = model;
+ model.addObjectListener(this);
+
+ createGUI();
+ }
+
+ public void objectLoaded(ClientModelEvent event) {
+ CmisObject object = model.getCurrentObject();
+
+ deletePanel.setObject(object);
+ deletePanel.setVisible(deletePanel.isAllowed());
+
+ deleteTreePanel.setObject(object);
+ deleteTreePanel.setVisible(deleteTreePanel.isAllowed());
+
+ movePanel.setObject(object);
+ movePanel.setVisible(movePanel.isAllowed());
+
+ checkOutPanel.setObject(object);
+ checkOutPanel.setVisible(checkOutPanel.isAllowed());
+
+ cancelCheckOutPanel.setObject(object);
+ cancelCheckOutPanel.setVisible(cancelCheckOutPanel.isAllowed());
+
+ checkInPanel.setObject(object);
+ checkInPanel.setVisible(checkInPanel.isAllowed());
+
+ setContentStreamPanel.setObject(object);
+ setContentStreamPanel.setVisible(setContentStreamPanel.isAllowed());
+
+ deleteContentStreamPanel.setObject(object);
+ deleteContentStreamPanel.setVisible(deleteContentStreamPanel
+ .isAllowed());
+ }
+
+ private void createGUI() {
+ setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
+ setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
+
+ deletePanel = new DeletePanel(model);
+ add(deletePanel);
+
+ deleteTreePanel = new DeleteTreePanel(model);
+ add(deleteTreePanel);
+
+ movePanel = new MovePanel(model);
+ add(movePanel);
+
+ checkOutPanel = new CheckOutPanel(model);
+ add(checkOutPanel);
+
+ cancelCheckOutPanel = new CancelCheckOutPanel(model);
+ add(cancelCheckOutPanel);
+
+ checkInPanel = new CheckInPanel(model);
+ add(checkInPanel);
+
+ setContentStreamPanel = new SetContentStreamPanel(model);
+ add(setContentStreamPanel);
+
+ deleteContentStreamPanel = new DeleteContentStreamPanel(model);
+ add(deleteContentStreamPanel);
+ }
+}
Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/ActionsPanel.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/DetailsTabs.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/DetailsTabs.java?rev=966582&view=auto
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/DetailsTabs.java (added)
+++ incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/DetailsTabs.java Thu Jul 22 11:19:09 2010
@@ -0,0 +1,67 @@
+/*
+ * 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.swingclient.details;
+
+import javax.swing.JScrollPane;
+import javax.swing.JTabbedPane;
+
+import org.apache.chemistry.opencmis.swingclient.model.ClientModel;
+
+public class DetailsTabs extends JTabbedPane {
+
+ private static final long serialVersionUID = 1L;
+
+ private ClientModel model;
+
+ private ObjectPanel objectPanel;
+ private ActionsPanel actionsPanel;
+ private PropertyTable propertyTable;
+ private RelationshipTable relationshipTable;
+ private RenditionTable renditionTable;
+ private ACLTable aclTable;
+ private PolicyTable policyTable;
+ private VersionTable versionTable;
+
+ public DetailsTabs(ClientModel model) {
+ super(JTabbedPane.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);
+
+ this.model = model;
+ createGUI();
+ }
+
+ private void createGUI() {
+ objectPanel = new ObjectPanel(model);
+ actionsPanel = new ActionsPanel(model);
+ propertyTable = new PropertyTable(model);
+ relationshipTable = new RelationshipTable(model);
+ renditionTable = new RenditionTable(model);
+ aclTable = new ACLTable(model);
+ policyTable = new PolicyTable(model);
+ versionTable = new VersionTable(model);
+
+ addTab("Object", objectPanel);
+ addTab("Actions", new JScrollPane(actionsPanel));
+ addTab("Properties", new JScrollPane(propertyTable));
+ addTab("Relationships", new JScrollPane(relationshipTable));
+ addTab("Renditions", new JScrollPane(renditionTable));
+ addTab("ACL", new JScrollPane(aclTable));
+ addTab("Policies", new JScrollPane(policyTable));
+ addTab("Versions", new JScrollPane(versionTable));
+ }
+}
Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/DetailsTabs.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/ObjectPanel.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/ObjectPanel.java?rev=966582&view=auto
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/ObjectPanel.java (added)
+++ incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/ObjectPanel.java Thu Jul 22 11:19:09 2010
@@ -0,0 +1,90 @@
+/*
+ * 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.swingclient.details;
+
+import javax.swing.JList;
+import javax.swing.JTextField;
+
+import org.apache.chemistry.opencmis.client.api.CmisObject;
+import org.apache.chemistry.opencmis.swingclient.ClientHelper;
+import org.apache.chemistry.opencmis.swingclient.model.ClientModel;
+import org.apache.chemistry.opencmis.swingclient.model.ClientModelEvent;
+import org.apache.chemistry.opencmis.swingclient.model.ObjectListener;
+import org.apache.chemistry.opencmis.swingclient.swing.InfoPanel;
+
+public class ObjectPanel extends InfoPanel implements ObjectListener {
+
+ private static final long serialVersionUID = 1L;
+
+ private ClientModel model;
+
+ private JTextField nameField;
+ private JTextField idField;
+ private JTextField typeField;
+ private JTextField basetypeField;
+ private JList allowableActionsList;
+
+ public ObjectPanel(ClientModel model) {
+ super();
+
+ this.model = model;
+ model.addObjectListener(this);
+
+ createGUI();
+ }
+
+ public void objectLoaded(ClientModelEvent event) {
+ CmisObject object = model.getCurrentObject();
+
+ if (object == null) {
+ nameField.setText("");
+ idField.setText("");
+ typeField.setText("");
+ basetypeField.setText("");
+ allowableActionsList.removeAll();
+ } else {
+ try {
+ nameField.setText(object.getName());
+ idField.setText(object.getId());
+ typeField.setText(object.getType().getId());
+ basetypeField.setText(object.getBaseTypeId().toString());
+ if (object.getAllowableActions() != null) {
+ allowableActionsList.setListData(object
+ .getAllowableActions().getAllowableActions()
+ .toArray());
+ } else {
+ allowableActionsList
+ .setListData(new String[] { "(missing)" });
+ }
+ } catch (Exception e) {
+ ClientHelper.showError(this, e);
+ }
+ }
+ }
+
+ private void createGUI() {
+ setupGUI();
+
+ nameField = addLine("Name:", true);
+ idField = addLine("Id:");
+ typeField = addLine("Type:");
+ basetypeField = addLine("Base Type:");
+ allowableActionsList = addComponent("Allowable Actions:", new JList());
+ }
+}
Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/ObjectPanel.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/PolicyTable.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/PolicyTable.java?rev=966582&view=auto
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/PolicyTable.java (added)
+++ incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/PolicyTable.java Thu Jul 22 11:19:09 2010
@@ -0,0 +1,56 @@
+/*
+ * 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.swingclient.details;
+
+import org.apache.chemistry.opencmis.client.api.Policy;
+import org.apache.chemistry.opencmis.swingclient.model.ClientModel;
+
+public class PolicyTable extends AbstractDetailsTable {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String[] COLUMN_NAMES = { "Name", "Id" };
+ private static final int[] COLUMN_WIDTHS = { 200, 400 };
+
+ public PolicyTable(ClientModel model) {
+ super();
+ init(model, COLUMN_NAMES, COLUMN_WIDTHS);
+ }
+
+ public int getDetailRowCount() {
+ if (getObject().getPolicies() == null) {
+ return 0;
+ }
+
+ return getObject().getPolicies().size();
+ }
+
+ public Object getDetailValueAt(int rowIndex, int columnIndex) {
+ Policy policy = getObject().getPolicies().get(rowIndex);
+
+ switch (columnIndex) {
+ case 0:
+ return policy.getName();
+ case 1:
+ return policy.getId();
+ }
+
+ return null;
+ }
+}
Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/PolicyTable.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/PropertyTable.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/PropertyTable.java?rev=966582&view=auto
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/PropertyTable.java (added)
+++ incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/PropertyTable.java Thu Jul 22 11:19:09 2010
@@ -0,0 +1,57 @@
+/*
+ * 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.swingclient.details;
+
+import org.apache.chemistry.opencmis.client.api.Property;
+import org.apache.chemistry.opencmis.swingclient.model.ClientModel;
+
+public class PropertyTable extends AbstractDetailsTable {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String[] COLUMN_NAMES = { "Name", "Id", "Type",
+ "Value" };
+ private static final int[] COLUMN_WIDTHS = { 200, 200, 80, 300 };
+
+ public PropertyTable(ClientModel model) {
+ super();
+ init(model, COLUMN_NAMES, COLUMN_WIDTHS);
+ }
+
+ public int getDetailRowCount() {
+ return getObject().getProperties().size();
+ }
+
+ public Object getDetailValueAt(int rowIndex, int columnIndex) {
+ Property<?> property = getObject().getProperties().get(rowIndex);
+
+ switch (columnIndex) {
+ case 0:
+ return property.getDefinition().getDisplayName();
+ case 1:
+ return property.getId();
+ case 2:
+ return property.getDefinition().getPropertyType().value();
+ case 3:
+ return property.getValuesAsString();
+ }
+
+ return null;
+ }
+}
Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/PropertyTable.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/RelationshipTable.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/RelationshipTable.java?rev=966582&view=auto
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/RelationshipTable.java (added)
+++ incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/RelationshipTable.java Thu Jul 22 11:19:09 2010
@@ -0,0 +1,64 @@
+/*
+ * 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.swingclient.details;
+
+import org.apache.chemistry.opencmis.client.api.Relationship;
+import org.apache.chemistry.opencmis.swingclient.model.ClientModel;
+
+public class RelationshipTable extends AbstractDetailsTable {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String[] COLUMN_NAMES = { "Name", "Type", "Source",
+ "Target" };
+ private static final int[] COLUMN_WIDTHS = { 200, 200, 200, 200 };
+
+ public RelationshipTable(ClientModel model) {
+ super();
+ init(model, COLUMN_NAMES, COLUMN_WIDTHS);
+ }
+
+ @Override
+ public int getDetailRowCount() {
+ if (getObject().getRelationships() == null) {
+ return 0;
+ }
+
+ return getObject().getRelationships().size();
+ }
+
+ @Override
+ public Object getDetailValueAt(int rowIndex, int columnIndex) {
+ Relationship relationship = getObject().getRelationships()
+ .get(rowIndex);
+
+ switch (columnIndex) {
+ case 0:
+ return relationship.getName();
+ case 1:
+ return relationship.getType().getId();
+ case 2:
+ return relationship.getSource().getId();
+ case 3:
+ return relationship.getTarget().getId();
+ }
+
+ return null;
+ }
+}
Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/RelationshipTable.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/RenditionTable.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/RenditionTable.java?rev=966582&view=auto
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/RenditionTable.java (added)
+++ incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/RenditionTable.java Thu Jul 22 11:19:09 2010
@@ -0,0 +1,75 @@
+/*
+ * 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.swingclient.details;
+
+import org.apache.chemistry.opencmis.client.api.Document;
+import org.apache.chemistry.opencmis.client.api.Rendition;
+import org.apache.chemistry.opencmis.swingclient.ClientHelper;
+import org.apache.chemistry.opencmis.swingclient.model.ClientModel;
+
+public class RenditionTable extends AbstractDetailsTable {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String[] COLUMN_NAMES = { "Title", "Kind",
+ "MIME Type", "Size", "Stream Id" };
+ private static final int[] COLUMN_WIDTHS = { 200, 200, 80, 80, 200 };
+
+ public RenditionTable(ClientModel model) {
+ super();
+ init(model, COLUMN_NAMES, COLUMN_WIDTHS);
+ }
+
+ @Override
+ public void doubleClickAction(int rowIndex) {
+ String streamId = getObject().getRenditions().get(rowIndex)
+ .getStreamId();
+ ClientHelper.download(this.getParent(), (Document) getObject(),
+ streamId);
+ }
+
+ @Override
+ public int getDetailRowCount() {
+ if (getObject().getRenditions() == null) {
+ return 0;
+ }
+
+ return getObject().getRenditions().size();
+ }
+
+ @Override
+ public Object getDetailValueAt(int rowIndex, int columnIndex) {
+ Rendition rendition = getObject().getRenditions().get(rowIndex);
+
+ switch (columnIndex) {
+ case 0:
+ return rendition.getTitle();
+ case 1:
+ return rendition.getKind();
+ case 2:
+ return rendition.getMimeType();
+ case 3:
+ return rendition.getLength();
+ case 4:
+ return rendition.getStreamId();
+ }
+
+ return null;
+ }
+}
Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/RenditionTable.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/VersionTable.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/VersionTable.java?rev=966582&view=auto
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/VersionTable.java (added)
+++ incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/VersionTable.java Thu Jul 22 11:19:09 2010
@@ -0,0 +1,122 @@
+/*
+ * 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.swingclient.details;
+
+import java.awt.Cursor;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.chemistry.opencmis.client.api.Document;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisNotSupportedException;
+import org.apache.chemistry.opencmis.swingclient.ClientHelper;
+import org.apache.chemistry.opencmis.swingclient.model.ClientModel;
+
+public class VersionTable extends AbstractDetailsTable {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String[] COLUMN_NAMES = { "Name", "Label", "Major",
+ "Id" };
+ private static final int[] COLUMN_WIDTHS = { 200, 200, 80, 400 };
+
+ private static final int OLD = 60 * 1000;
+
+ private List<Document> versions;
+ private String lastId;
+ private long lastTimestamp;
+
+ public VersionTable(ClientModel model) {
+ super();
+
+ versions = Collections.emptyList();
+ lastId = null;
+ lastTimestamp = System.currentTimeMillis();
+ init(model, COLUMN_NAMES, COLUMN_WIDTHS);
+ }
+
+ @Override
+ public void doubleClickAction(int rowIndex) {
+ ClientHelper.download(this.getParent(), getVersions().get(rowIndex),
+ null);
+ }
+
+ @Override
+ public int getDetailRowCount() {
+ if (!(getObject() instanceof Document)) {
+ return 0;
+ }
+
+ return getVersions().size();
+ }
+
+ @Override
+ public Object getDetailValueAt(int rowIndex, int columnIndex) {
+ Document version = getVersions().get(rowIndex);
+
+ switch (columnIndex) {
+ case 0:
+ return version.getName();
+ case 1:
+ return version.getVersionLabel();
+ case 2:
+ return version.isMajorVersion();
+ case 3:
+ return version.getId();
+ }
+
+ return null;
+ }
+
+ private List<Document> getVersions() {
+ // not a document -> no versions
+ if (!(getObject() instanceof Document)) {
+ versions = Collections.emptyList();
+ lastId = null;
+
+ return versions;
+ }
+
+ // if the versions have been fetched recently, don't reload
+ Document doc = (Document) getObject();
+ if (doc.getId().equals(lastId)) {
+ if (lastTimestamp + OLD > System.currentTimeMillis()) {
+ return versions;
+ }
+ }
+
+ // reset everything
+ lastId = doc.getId();
+ lastTimestamp = System.currentTimeMillis();
+ versions = Collections.emptyList();
+
+ // get versions
+ try {
+ setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+ versions = doc.getAllVersions();
+ } catch (Exception ex) {
+ if (!(ex instanceof CmisNotSupportedException)) {
+ ClientHelper.showError(null, ex);
+ }
+ } finally {
+ setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ }
+
+ return versions;
+ }
+}
Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/VersionTable.java
------------------------------------------------------------------------------
svn:eol-style = native