chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1209708 - in /chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench: actions/ details/
Date Fri, 02 Dec 2011 21:50:59 GMT
Author: fmui
Date: Fri Dec  2 21:50:58 2011
New Revision: 1209708

URL: http://svn.apache.org/viewvc?rev=1209708&view=rev
Log:
Workbench: added AddObjectToFolder and RemoveObjectFromFolder actions

Added:
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/AddObjectToFolderPanel.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/RemoveObjectFromFolderPanel.java
Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ActionsPanel.java

Added: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/AddObjectToFolderPanel.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/AddObjectToFolderPanel.java?rev=1209708&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/AddObjectToFolderPanel.java
(added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/AddObjectToFolderPanel.java
Fri Dec  2 21:50:58 2011
@@ -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.workbench.actions;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+
+import javax.swing.JCheckBox;
+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.commons.enums.Action;
+import org.apache.chemistry.opencmis.workbench.model.ClientModel;
+import org.apache.chemistry.opencmis.workbench.swing.ActionPanel;
+
+public class AddObjectToFolderPanel extends ActionPanel {
+
+    private static final long serialVersionUID = 1L;
+
+    private JTextField folderField;
+    private JCheckBox allVersionsBox;
+
+    public AddObjectToFolderPanel(ClientModel model) {
+        super("Add Object To Folder", "Add", model);
+    }
+
+    @Override
+    protected void createActionComponents() {
+        JPanel folderPanel = new JPanel(new BorderLayout());
+        folderPanel.setBackground(Color.WHITE);
+
+        folderPanel.add(new JLabel("Folder Id:"), BorderLayout.LINE_START);
+
+        folderField = new JTextField(30);
+        folderPanel.add(folderField, BorderLayout.CENTER);
+
+        addActionComponent(folderPanel);
+
+        allVersionsBox = new JCheckBox("add all versions", true);
+        addActionComponent(allVersionsBox);
+    }
+
+    @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_ADD_OBJECT_TO_FOLDER);
+    }
+
+    @Override
+    public void doAction() throws Exception {
+        ObjectId folderId = getClientModel().getClientSession().getSession().createObjectId(folderField.getText());
+        ((FileableCmisObject) getObject()).addToFolder(folderId, allVersionsBox.isSelected());
+    }
+}

Added: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/RemoveObjectFromFolderPanel.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/RemoveObjectFromFolderPanel.java?rev=1209708&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/RemoveObjectFromFolderPanel.java
(added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/RemoveObjectFromFolderPanel.java
Fri Dec  2 21:50:58 2011
@@ -0,0 +1,89 @@
+/*
+ * 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.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.commons.enums.Action;
+import org.apache.chemistry.opencmis.workbench.model.ClientModel;
+import org.apache.chemistry.opencmis.workbench.swing.ActionPanel;
+
+public class RemoveObjectFromFolderPanel extends ActionPanel {
+
+    private static final long serialVersionUID = 1L;
+
+    private JTextField folderField;
+
+    public RemoveObjectFromFolderPanel(ClientModel model) {
+        super("Remove Object From Folder", "Remove", model);
+    }
+
+    @Override
+    public void setVisible(boolean visible) {
+        if (visible) {
+            if (getClientModel().getCurrentFolder() != null) {
+                folderField.setText(getClientModel().getCurrentFolder().getId());
+            } else {
+                folderField.setText("");
+            }
+        }
+        
+        super.setVisible(visible);
+    }
+
+    @Override
+    protected void createActionComponents() {
+        JPanel folderPanel = new JPanel(new BorderLayout());
+        folderPanel.setBackground(Color.WHITE);
+
+        folderPanel.add(new JLabel("Folder Id:"), BorderLayout.LINE_START);
+
+        folderField = new JTextField(30);
+        folderPanel.add(folderField, BorderLayout.CENTER);
+
+        addActionComponent(folderPanel);
+    }
+
+    @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_REMOVE_OBJECT_FROM_FOLDER);
+    }
+
+    @Override
+    public void doAction() throws Exception {
+        ObjectId folderId = getClientModel().getClientSession().getSession().createObjectId(folderField.getText());
+        ((FileableCmisObject) getObject()).removeFromFolder(folderId);
+    }
+}

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ActionsPanel.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ActionsPanel.java?rev=1209708&r1=1209707&r2=1209708&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ActionsPanel.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ActionsPanel.java
Fri Dec  2 21:50:58 2011
@@ -23,6 +23,7 @@ import javax.swing.BoxLayout;
 import javax.swing.JPanel;
 
 import org.apache.chemistry.opencmis.client.api.CmisObject;
+import org.apache.chemistry.opencmis.workbench.actions.AddObjectToFolderPanel;
 import org.apache.chemistry.opencmis.workbench.actions.ApplyPolicyPanel;
 import org.apache.chemistry.opencmis.workbench.actions.CancelCheckOutPanel;
 import org.apache.chemistry.opencmis.workbench.actions.CheckInPanel;
@@ -32,6 +33,7 @@ import org.apache.chemistry.opencmis.wor
 import org.apache.chemistry.opencmis.workbench.actions.DeleteTreePanel;
 import org.apache.chemistry.opencmis.workbench.actions.MovePanel;
 import org.apache.chemistry.opencmis.workbench.actions.PropertyUpdatePanel;
+import org.apache.chemistry.opencmis.workbench.actions.RemoveObjectFromFolderPanel;
 import org.apache.chemistry.opencmis.workbench.actions.RemovePolicyPanel;
 import org.apache.chemistry.opencmis.workbench.actions.SetContentStreamPanel;
 import org.apache.chemistry.opencmis.workbench.model.ClientModel;
@@ -53,6 +55,8 @@ public class ActionsPanel extends JPanel
     private CheckInPanel checkInPanel;
     private SetContentStreamPanel setContentStreamPanel;
     private DeleteContentStreamPanel deleteContentStreamPanel;
+    private AddObjectToFolderPanel addObjectToFolderPanel;
+    private RemoveObjectFromFolderPanel removeObjectFromFolderPanel;
     private ApplyPolicyPanel applyPolicyPanel;
     private RemovePolicyPanel removePolicyPanel;
 
@@ -95,6 +99,12 @@ public class ActionsPanel extends JPanel
         deleteContentStreamPanel.setObject(object);
         deleteContentStreamPanel.setVisible(deleteContentStreamPanel.isAllowed());
 
+        addObjectToFolderPanel.setObject(object);
+        addObjectToFolderPanel.setVisible(addObjectToFolderPanel.isAllowed());
+
+        removeObjectFromFolderPanel.setObject(object);
+        removeObjectFromFolderPanel.setVisible(removeObjectFromFolderPanel.isAllowed());
+
         applyPolicyPanel.setObject(object);
         applyPolicyPanel.setVisible(applyPolicyPanel.isAllowed());
 
@@ -133,6 +143,12 @@ public class ActionsPanel extends JPanel
         deleteContentStreamPanel = new DeleteContentStreamPanel(model);
         add(deleteContentStreamPanel);
 
+        addObjectToFolderPanel = new AddObjectToFolderPanel(model);
+        add(addObjectToFolderPanel);
+
+        removeObjectFromFolderPanel = new RemoveObjectFromFolderPanel(model);
+        add(removeObjectFromFolderPanel);
+
         applyPolicyPanel = new ApplyPolicyPanel(model);
         add(applyPolicyPanel);
 



Mime
View raw message