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 2011/04/22 18:07:30 UTC
svn commit: r1095956 - in
/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench:
./ actions/ details/ swing/
Author: fmui
Date: Fri Apr 22 16:07:30 2011
New Revision: 1095956
URL: http://svn.apache.org/viewvc?rev=1095956&view=rev
Log:
- added property editor to CMIS Workbench (multi value properties are not supported yet)
Added:
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/PropertyEditorFrame.java (with props)
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/PropertyUpdatePanel.java (with props)
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientFrame.java
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ActionsPanel.java
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/ActionPanel.java
Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientFrame.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientFrame.java?rev=1095956&r1=1095955&r2=1095956&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientFrame.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientFrame.java Fri Apr 22 16:07:30 2011
@@ -337,7 +337,7 @@ public class ClientFrame extends JFrame
addConsoleMenu(cmisMenu, "CMIS 1.0 Specification", new URI(
"http://docs.oasis-open.org/cmis/CMIS/v1.0/os/cmis-spec-v1.0.html"));
addConsoleMenu(cmisMenu, "OpenCMIS Documentation", new URI(
- "http://incubator.apache.org/chemistry/opencmis.html"));
+ "http://chemistry.apache.org/java/opencmis.html"));
addConsoleMenu(
cmisMenu,
"OpenCMIS Client API JavaDoc",
Added: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/PropertyEditorFrame.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/PropertyEditorFrame.java?rev=1095956&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/PropertyEditorFrame.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/PropertyEditorFrame.java Fri Apr 22 16:07:30 2011
@@ -0,0 +1,533 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.workbench;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.text.Format;
+import java.text.NumberFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.swing.BorderFactory;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+import javax.swing.JFormattedTextField;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JSeparator;
+import javax.swing.JSpinner;
+import javax.swing.JTextField;
+import javax.swing.SpinnerListModel;
+import javax.swing.SpinnerNumberModel;
+import javax.swing.SwingConstants;
+import javax.swing.UIManager;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+
+import org.apache.chemistry.opencmis.client.api.CmisObject;
+import org.apache.chemistry.opencmis.client.api.ObjectId;
+import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
+import org.apache.chemistry.opencmis.commons.enums.Action;
+import org.apache.chemistry.opencmis.commons.enums.Cardinality;
+import org.apache.chemistry.opencmis.commons.enums.Updatability;
+import org.apache.chemistry.opencmis.workbench.PropertyEditorFrame.UpdateStatus.StatusFlag;
+import org.apache.chemistry.opencmis.workbench.model.ClientModel;
+
+/**
+ * Simple property editor.
+ */
+public class PropertyEditorFrame extends JFrame {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String WINDOW_TITLE = "Property Editor";
+
+ private final ClientModel model;
+ private final CmisObject object;
+ private List<PropertyInputPanel> propertyPanels;
+
+ public PropertyEditorFrame(ClientModel model, CmisObject object) {
+ super();
+
+ this.model = model;
+ this.object = object;
+
+ createGUI();
+ }
+
+ private void createGUI() {
+ setTitle(WINDOW_TITLE);
+ setPreferredSize(new Dimension(600, 600));
+ setMinimumSize(new Dimension(200, 60));
+
+ setLayout(new BorderLayout());
+
+ JPanel panel = new JPanel();
+ panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
+
+ JScrollPane scrollPane = new JScrollPane(panel);
+ add(scrollPane, BorderLayout.CENTER);
+
+ propertyPanels = new ArrayList<PropertyEditorFrame.PropertyInputPanel>();
+
+ for (PropertyDefinition<?> propDef : object.getType().getPropertyDefinitions().values()) {
+ boolean isUpdatable = (propDef.getUpdatability() == Updatability.READWRITE)
+ || (propDef.getUpdatability() == Updatability.WHENCHECKEDOUT && object.getAllowableActions()
+ .getAllowableActions().contains(Action.CAN_CHECK_IN));
+
+ if (isUpdatable) {
+ PropertyInputPanel propertyPanel = new PropertyInputPanel(propDef, object.getPropertyValue(propDef
+ .getId()));
+
+ propertyPanels.add(propertyPanel);
+ panel.add(propertyPanel);
+ }
+ }
+
+ JButton updateButton = new JButton("Update");
+ updateButton.setDefaultCapable(true);
+ updateButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent event) {
+ if (doUpdate()) {
+ dispose();
+ }
+ }
+ });
+
+ add(updateButton, BorderLayout.PAGE_END);
+
+ setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+ pack();
+ setLocationRelativeTo(null);
+ setVisible(true);
+ }
+
+ /**
+ * Performs the update.
+ */
+ private boolean doUpdate() {
+ try {
+ Map<String, Object> properties = new HashMap<String, Object>();
+ for (PropertyInputPanel propertyPanel : propertyPanels) {
+ if (propertyPanel.includeInUpdate()) {
+ properties.put(propertyPanel.getId(), propertyPanel.getValue());
+ }
+ }
+
+ if (properties.isEmpty()) {
+ return false;
+ }
+
+ ObjectId newId = object.updateProperties(properties, false);
+
+ if (newId != null) {
+ if (newId.getId().equals(model.getCurrentObject().getId())) {
+ try {
+ model.reloadObject();
+ model.reloadFolder();
+ } catch (Exception ex) {
+ ClientHelper.showError(null, ex);
+ }
+ }
+ }
+
+ return true;
+ } catch (Exception ex) {
+ ClientHelper.showError(this, ex);
+ return false;
+ }
+ }
+
+ public interface UpdateStatus {
+ enum StatusFlag {
+ DontChange, Update, Unset
+ }
+
+ void setStatus(StatusFlag status);
+
+ StatusFlag getStatus();
+ }
+
+ /**
+ * Property input panel.
+ */
+ public static class PropertyInputPanel extends JPanel implements UpdateStatus {
+ private static final long serialVersionUID = 1L;
+
+ private final PropertyDefinition<?> propDef;
+ private final Object value;
+ private JComboBox changeBox;
+ private List<JComponent> valueComponents;
+
+ public PropertyInputPanel(PropertyDefinition<?> propDef, Object value) {
+ super();
+ this.propDef = propDef;
+ this.value = value;
+ createGUI();
+ }
+
+ protected void createGUI() {
+ setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
+
+ setBackground(Color.WHITE);
+ setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
+
+ Font labelFont = UIManager.getFont("Label.font");
+ Font boldFont = labelFont.deriveFont(Font.BOLD, labelFont.getSize2D() * 1.2f);
+
+ JPanel titlePanel = new JPanel();
+ titlePanel.setLayout(new BorderLayout());
+ titlePanel.setBackground(Color.WHITE);
+ titlePanel.setToolTipText("<html><b>" + propDef.getPropertyType().value() + "</b> ("
+ + propDef.getCardinality().value() + " value)"
+ + (propDef.getDescription() != null ? "<br>" + propDef.getDescription() : ""));
+ add(titlePanel);
+
+ JLabel label = new JLabel(propDef.getDisplayName() + " (" + propDef.getId() + ")");
+ label.setFont(boldFont);
+ titlePanel.add(label, BorderLayout.LINE_START);
+
+ changeBox = new JComboBox(new Object[] { "Don't change ", "Update ", "Unset " });
+ titlePanel.add(changeBox, BorderLayout.LINE_END);
+
+ valueComponents = new ArrayList<JComponent>();
+ if (propDef.getCardinality() == Cardinality.SINGLE) {
+ JComponent valueField = createInputField(value);
+ valueComponents.add(valueField);
+ add(valueField);
+ } else {
+ if (value instanceof List<?>) {
+ for (Object v : (List<?>) value) {
+ JComponent valueField = createInputField(v);
+ valueComponents.add(valueField);
+ add(valueField);
+ }
+ }
+ }
+
+ add(new JSeparator(SwingConstants.HORIZONTAL));
+
+ setMaximumSize(new Dimension(Short.MAX_VALUE, getPreferredSize().height));
+ }
+
+ protected JComponent createInputField(Object value) {
+ switch (propDef.getPropertyType()) {
+ case INTEGER:
+ return new IntegerPropertyInputField(value, this);
+ case DECIMAL:
+ return new DecimalPropertyInputField(value, this);
+ case DATETIME:
+ return new DateTimePropertyInputField(value, this);
+ case BOOLEAN:
+ return new BooleanPropertyInputField(value, this);
+ default:
+ return new StringPropertyInputField(value, this);
+ }
+ }
+
+ public String getId() {
+ return propDef.getId();
+ }
+
+ public Object getValue() {
+ Object result = null;
+
+ if (getStatus() == StatusFlag.Update) {
+ try {
+ if (propDef.getCardinality() == Cardinality.SINGLE) {
+ result = ((PropertyValue) valueComponents.get(0)).getPropertyValue();
+ } else {
+ List<Object> list = new ArrayList<Object>();
+ for (JComponent comp : valueComponents) {
+ list.add(((PropertyValue) comp).getPropertyValue());
+ }
+ result = list;
+ }
+ } catch (Exception ex) {
+ ClientHelper.showError(this, ex);
+ }
+ }
+
+ return result;
+ }
+
+ public boolean includeInUpdate() {
+ return getStatus() != StatusFlag.DontChange;
+ }
+
+ public void setStatus(StatusFlag status) {
+ switch (status) {
+ case Update:
+ changeBox.setSelectedIndex(1);
+ break;
+ case Unset:
+ changeBox.setSelectedIndex(2);
+ break;
+ default:
+ changeBox.setSelectedIndex(0);
+ }
+ }
+
+ public StatusFlag getStatus() {
+ switch (changeBox.getSelectedIndex()) {
+ case 1:
+ return StatusFlag.Update;
+ case 2:
+ return StatusFlag.Unset;
+ default:
+ return StatusFlag.DontChange;
+ }
+ }
+ }
+
+ /**
+ * Property value interface.
+ */
+ public interface PropertyValue {
+ Object getPropertyValue() throws Exception;
+ }
+
+ /**
+ * String property.
+ */
+ public static class StringPropertyInputField extends JTextField implements PropertyValue {
+ private static final long serialVersionUID = 1L;
+
+ public StringPropertyInputField(final Object value, final UpdateStatus status) {
+ super(value == null ? "" : value.toString());
+
+ addKeyListener(new KeyListener() {
+ @Override
+ public void keyTyped(KeyEvent e) {
+ }
+
+ @Override
+ public void keyReleased(KeyEvent e) {
+ status.setStatus(StatusFlag.Update);
+ }
+
+ @Override
+ public void keyPressed(KeyEvent e) {
+ }
+ });
+ }
+
+ public Object getPropertyValue() {
+ return getText();
+ }
+ }
+
+ /**
+ * Formatted property.
+ */
+ public static class AbstractFormattedPropertyInputField extends JFormattedTextField implements PropertyValue {
+ private static final long serialVersionUID = 1L;
+
+ public AbstractFormattedPropertyInputField(final Object value, final Format format, final UpdateStatus status) {
+ super(format);
+ if (value != null) {
+ setValue(value);
+ }
+
+ addKeyListener(new KeyListener() {
+ @Override
+ public void keyTyped(KeyEvent e) {
+ }
+
+ @Override
+ public void keyReleased(KeyEvent e) {
+ status.setStatus(StatusFlag.Update);
+ }
+
+ @Override
+ public void keyPressed(KeyEvent e) {
+ }
+ });
+ }
+
+ public Object getPropertyValue() throws Exception {
+ commitEdit();
+ return getValue();
+ }
+ }
+
+ /**
+ * Integer property.
+ */
+ public static class IntegerPropertyInputField extends AbstractFormattedPropertyInputField {
+ private static final long serialVersionUID = 1L;
+
+ public IntegerPropertyInputField(final Object value, final UpdateStatus status) {
+ super(value, NumberFormat.getIntegerInstance(), status);
+ setHorizontalAlignment(JTextField.RIGHT);
+ }
+ }
+
+ /**
+ * Decimal property.
+ */
+ public static class DecimalPropertyInputField extends AbstractFormattedPropertyInputField {
+ private static final long serialVersionUID = 1L;
+
+ public DecimalPropertyInputField(final Object value, final UpdateStatus status) {
+ super(value, NumberFormat.getInstance(), status);
+ setHorizontalAlignment(JTextField.RIGHT);
+ }
+ }
+
+ /**
+ * Boolean property.
+ */
+ public static class BooleanPropertyInputField extends JComboBox implements PropertyValue {
+ private static final long serialVersionUID = 1L;
+
+ public BooleanPropertyInputField(final Object value, final UpdateStatus status) {
+ super(new Object[] { true, false });
+ setSelectedItem(value == null ? true : value);
+
+ addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ status.setStatus(StatusFlag.Update);
+ }
+ });
+ }
+
+ public Object getPropertyValue() {
+ return getSelectedItem();
+ }
+ }
+
+ /**
+ * DateTime property.
+ */
+ public static class DateTimePropertyInputField extends JPanel implements PropertyValue {
+ private static final long serialVersionUID = 1L;
+
+ private static final String[] MONTH_STRINGS;
+
+ static {
+ String[] months = new java.text.DateFormatSymbols().getMonths();
+ int lastIndex = months.length - 1;
+
+ if (months[lastIndex] == null || months[lastIndex].length() <= 0) {
+ String[] monthStrings = new String[lastIndex];
+ System.arraycopy(months, 0, monthStrings, 0, lastIndex);
+ MONTH_STRINGS = monthStrings;
+ } else {
+ MONTH_STRINGS = months;
+ }
+ }
+
+ private SpinnerNumberModel day;
+ private SpinnerListModel month;
+ private SpinnerNumberModel year;
+ private SpinnerNumberModel hour;
+ private SpinnerNumberModel min;
+ private SpinnerNumberModel sec;
+
+ public DateTimePropertyInputField(final Object value, final UpdateStatus status) {
+ setBackground(Color.WHITE);
+
+ GregorianCalendar cal = (value == null ? new GregorianCalendar() : (GregorianCalendar) value);
+
+ day = new SpinnerNumberModel(cal.get(Calendar.DATE), 1, 31, 1);
+ addSpinner(new JSpinner(day), status);
+
+ month = new SpinnerListModel(MONTH_STRINGS);
+ month.setValue(MONTH_STRINGS[cal.get(Calendar.MONTH)]);
+ JSpinner monthSpinner = new JSpinner(month);
+ JComponent editor = monthSpinner.getEditor();
+ if (editor instanceof JSpinner.DefaultEditor) {
+ JFormattedTextField tf = ((JSpinner.DefaultEditor) editor).getTextField();
+ tf.setColumns(6);
+ tf.setHorizontalAlignment(JTextField.RIGHT);
+ }
+ addSpinner(monthSpinner, status);
+
+ year = new SpinnerNumberModel(cal.get(Calendar.YEAR), 0, 9999, 1);
+ JSpinner yearSpinner = new JSpinner(year);
+ yearSpinner.setEditor(new JSpinner.NumberEditor(yearSpinner, "#"));
+ editor = yearSpinner.getEditor();
+ addSpinner(yearSpinner, status);
+
+ add(new JLabel(" "));
+
+ hour = new SpinnerNumberModel(cal.get(Calendar.HOUR_OF_DAY), 0, 23, 1);
+ addSpinner(new JSpinner(hour), status);
+
+ add(new JLabel(":"));
+
+ min = new SpinnerNumberModel(cal.get(Calendar.MINUTE), 0, 59, 1);
+ addSpinner(new JSpinner(min), status);
+
+ add(new JLabel(":"));
+
+ sec = new SpinnerNumberModel(cal.get(Calendar.SECOND), 0, 59, 1);
+ addSpinner(new JSpinner(sec), status);
+ }
+
+ private void addSpinner(final JSpinner spinner, final UpdateStatus status) {
+ spinner.addChangeListener(new ChangeListener() {
+ @Override
+ public void stateChanged(ChangeEvent e) {
+ status.setStatus(StatusFlag.Update);
+ }
+ });
+
+ add(spinner);
+ }
+
+ public Object getPropertyValue() {
+ GregorianCalendar result = new GregorianCalendar();
+
+ result.set(Calendar.YEAR, year.getNumber().intValue());
+ int mi = 0;
+ String ms = month.getValue().toString();
+ for (int i = 0; i < MONTH_STRINGS.length; i++) {
+ if (MONTH_STRINGS[i].equals(ms)) {
+ mi = i;
+ break;
+ }
+ }
+ result.set(Calendar.MONTH, mi);
+ result.set(Calendar.DATE, day.getNumber().intValue());
+ result.set(Calendar.HOUR_OF_DAY, hour.getNumber().intValue());
+ result.set(Calendar.MINUTE, min.getNumber().intValue());
+ result.set(Calendar.SECOND, sec.getNumber().intValue());
+
+ return result;
+ }
+ }
+}
Propchange: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/PropertyEditorFrame.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/PropertyUpdatePanel.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/PropertyUpdatePanel.java?rev=1095956&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/PropertyUpdatePanel.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/PropertyUpdatePanel.java Fri Apr 22 16:07:30 2011
@@ -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.workbench.actions;
+
+import org.apache.chemistry.opencmis.commons.enums.Action;
+import org.apache.chemistry.opencmis.workbench.PropertyEditorFrame;
+import org.apache.chemistry.opencmis.workbench.model.ClientModel;
+import org.apache.chemistry.opencmis.workbench.swing.ActionPanel;
+
+public class PropertyUpdatePanel extends ActionPanel {
+
+ private static final long serialVersionUID = 1L;
+
+ public PropertyUpdatePanel(ClientModel model) {
+ super("Update Properties", "Open Property Editor", model);
+ }
+
+ @Override
+ protected void createActionComponents() {
+ }
+
+ @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_UPDATE_PROPERTIES);
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ new PropertyEditorFrame(getClientModel(), getObject());
+ }
+}
Propchange: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/PropertyUpdatePanel.java
------------------------------------------------------------------------------
svn:eol-style = native
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=1095956&r1=1095955&r2=1095956&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 Apr 22 16:07:30 2011
@@ -30,6 +30,7 @@ import org.apache.chemistry.opencmis.wor
import org.apache.chemistry.opencmis.workbench.actions.DeletePanel;
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.SetContentStreamPanel;
import org.apache.chemistry.opencmis.workbench.model.ClientModel;
import org.apache.chemistry.opencmis.workbench.model.ClientModelEvent;
@@ -37,83 +38,89 @@ import org.apache.chemistry.opencmis.wor
public class ActionsPanel extends JPanel implements ObjectListener {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
- private final ClientModel model;
+ private final 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;
+ private PropertyUpdatePanel propertyUpdatePanel;
+ 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();
+ public ActionsPanel(ClientModel model) {
+ super();
- this.model = model;
- model.addObjectListener(this);
+ this.model = model;
+ model.addObjectListener(this);
- createGUI();
- }
+ createGUI();
+ }
- public void objectLoaded(ClientModelEvent event) {
- CmisObject object = model.getCurrentObject();
+ public void objectLoaded(ClientModelEvent event) {
+ CmisObject object = model.getCurrentObject();
- deletePanel.setObject(object);
- deletePanel.setVisible(deletePanel.isAllowed());
+ propertyUpdatePanel.setObject(object);
+ propertyUpdatePanel.setVisible(propertyUpdatePanel.isAllowed());
- deleteTreePanel.setObject(object);
- deleteTreePanel.setVisible(deleteTreePanel.isAllowed());
+ deletePanel.setObject(object);
+ deletePanel.setVisible(deletePanel.isAllowed());
- movePanel.setObject(object);
- movePanel.setVisible(movePanel.isAllowed());
+ deleteTreePanel.setObject(object);
+ deleteTreePanel.setVisible(deleteTreePanel.isAllowed());
- checkOutPanel.setObject(object);
- checkOutPanel.setVisible(checkOutPanel.isAllowed());
+ movePanel.setObject(object);
+ movePanel.setVisible(movePanel.isAllowed());
- cancelCheckOutPanel.setObject(object);
- cancelCheckOutPanel.setVisible(cancelCheckOutPanel.isAllowed());
+ checkOutPanel.setObject(object);
+ checkOutPanel.setVisible(checkOutPanel.isAllowed());
- checkInPanel.setObject(object);
- checkInPanel.setVisible(checkInPanel.isAllowed());
+ cancelCheckOutPanel.setObject(object);
+ cancelCheckOutPanel.setVisible(cancelCheckOutPanel.isAllowed());
- setContentStreamPanel.setObject(object);
- setContentStreamPanel.setVisible(setContentStreamPanel.isAllowed());
+ checkInPanel.setObject(object);
+ checkInPanel.setVisible(checkInPanel.isAllowed());
- deleteContentStreamPanel.setObject(object);
- deleteContentStreamPanel.setVisible(deleteContentStreamPanel
- .isAllowed());
- }
+ setContentStreamPanel.setObject(object);
+ setContentStreamPanel.setVisible(setContentStreamPanel.isAllowed());
- private void createGUI() {
- setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
- setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
+ deleteContentStreamPanel.setObject(object);
+ deleteContentStreamPanel.setVisible(deleteContentStreamPanel.isAllowed());
+ }
- deletePanel = new DeletePanel(model);
- add(deletePanel);
+ private void createGUI() {
+ setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
+ setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
- deleteTreePanel = new DeleteTreePanel(model);
- add(deleteTreePanel);
+ propertyUpdatePanel = new PropertyUpdatePanel(model);
+ add(propertyUpdatePanel);
- movePanel = new MovePanel(model);
- add(movePanel);
+ deletePanel = new DeletePanel(model);
+ add(deletePanel);
- checkOutPanel = new CheckOutPanel(model);
- add(checkOutPanel);
+ deleteTreePanel = new DeleteTreePanel(model);
+ add(deleteTreePanel);
- cancelCheckOutPanel = new CancelCheckOutPanel(model);
- add(cancelCheckOutPanel);
+ movePanel = new MovePanel(model);
+ add(movePanel);
- checkInPanel = new CheckInPanel(model);
- add(checkInPanel);
+ checkOutPanel = new CheckOutPanel(model);
+ add(checkOutPanel);
- setContentStreamPanel = new SetContentStreamPanel(model);
- add(setContentStreamPanel);
+ cancelCheckOutPanel = new CancelCheckOutPanel(model);
+ add(cancelCheckOutPanel);
- deleteContentStreamPanel = new DeleteContentStreamPanel(model);
- add(deleteContentStreamPanel);
- }
+ checkInPanel = new CheckInPanel(model);
+ add(checkInPanel);
+
+ setContentStreamPanel = new SetContentStreamPanel(model);
+ add(setContentStreamPanel);
+
+ deleteContentStreamPanel = new DeleteContentStreamPanel(model);
+ add(deleteContentStreamPanel);
+ }
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/ActionPanel.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/ActionPanel.java?rev=1095956&r1=1095955&r2=1095956&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/ActionPanel.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/ActionPanel.java Fri Apr 22 16:07:30 2011
@@ -73,11 +73,10 @@ public abstract class ActionPanel extend
setLayout(borderLayout);
setBackground(Color.WHITE);
- setBorder(BorderFactory.createCompoundBorder(BorderFactory
- .createEmptyBorder(5, 5, 5, 5), BorderFactory
- .createCompoundBorder(BorderFactory.createLineBorder(
- Color.GRAY, 2), BorderFactory.createEmptyBorder(5, 5,
- 5, 5))));
+ setBorder(BorderFactory.createCompoundBorder(
+ BorderFactory.createEmptyBorder(5, 5, 5, 5),
+ BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.GRAY, 2),
+ BorderFactory.createEmptyBorder(5, 5, 5, 5))));
Font labelFont = UIManager.getFont("Label.font");
Font boldFont = labelFont.deriveFont(Font.BOLD,