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/05/09 10:13:03 UTC
svn commit: r1100912 - in
/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main:
java/org/apache/chemistry/opencmis/workbench/
java/org/apache/chemistry/opencmis/workbench/details/
java/org/apache/chemistry/opencm...
Author: fmui
Date: Mon May 9 08:13:03 2011
New Revision: 1100912
URL: http://svn.apache.org/viewvc?rev=1100912&view=rev
Log:
Workbench improvements:
- added PWC link to object tab
- made object ids in query results clickable
- fixed table sorting issues
- Ui improvements
Added:
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/YesNoLabel.java (with props)
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/no.png (with props)
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/yes.png (with props)
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/FolderPanel.java
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/FolderTable.java
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/QueryFrame.java
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/RepositoryInfoFrame.java
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TckDialog.java
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypeSplitPane.java
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypesFrame.java
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/AbstractDetailsTable.java
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ObjectPanel.java
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/PolicyTable.java
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/RelationshipTable.java
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/RenditionTable.java
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/TypesPanel.java
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/VersionTable.java
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/InfoPanel.java
Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/FolderPanel.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/FolderPanel.java?rev=1100912&r1=1100911&r2=1100912&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/FolderPanel.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/FolderPanel.java Mon May 9 08:13:03 2011
@@ -36,122 +36,135 @@ import org.apache.chemistry.opencmis.cli
import org.apache.chemistry.opencmis.workbench.model.ClientModel;
import org.apache.chemistry.opencmis.workbench.model.ClientModelEvent;
import org.apache.chemistry.opencmis.workbench.model.FolderListener;
+import org.apache.chemistry.opencmis.workbench.model.ObjectListener;
-public class FolderPanel extends JPanel implements FolderListener {
+public class FolderPanel extends JPanel implements FolderListener, ObjectListener {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
- private final ClientModel model;
+ private final ClientModel model;
- private String parentId;
-
- private JButton upButton;
- private JTextField pathField;
- private JButton goButton;
- private FolderTable folderTable;
-
- public FolderPanel(ClientModel model) {
- super();
-
- this.model = model;
- model.addFolderListener(this);
- createGUI();
- }
-
- public void folderLoaded(ClientModelEvent event) {
- Folder currentFolder = event.getClientModel().getCurrentFolder();
-
- if (currentFolder != null) {
- String path = currentFolder.getPath();
- pathField.setText(path);
-
- Folder parent = currentFolder.getFolderParent();
- if (parent == null) {
- parentId = null;
- upButton.setEnabled(false);
- } else {
- parentId = parent.getId();
- upButton.setEnabled(true);
- }
- } else {
- pathField.setText("???");
- parentId = null;
- upButton.setEnabled(false);
- }
- }
-
- private void createGUI() {
- setLayout(new BorderLayout());
-
- JPanel panel = new JPanel();
- panel.setLayout(new BoxLayout(panel, BoxLayout.LINE_AXIS));
- panel.setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0));
-
- upButton = new JButton("up");
- upButton.setEnabled(false);
- upButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- try {
- setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
- model.loadFolder(parentId, false);
- model.loadObject(model.getCurrentFolder().getId());
- } catch (Exception ex) {
- ClientHelper.showError(null, ex);
- return;
- } finally {
- setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
- }
- }
- });
- panel.add(upButton);
-
- pathField = new JTextField("");
- pathField.addKeyListener(new KeyListener() {
- public void keyTyped(KeyEvent e) {
- }
-
- public void keyReleased(KeyEvent e) {
- if (e.getKeyCode() == KeyEvent.VK_ENTER) {
- loadFolder();
- }
- }
-
- public void keyPressed(KeyEvent e) {
- }
- });
- panel.add(pathField);
-
- goButton = new JButton("go");
- goButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- loadFolder();
- }
- });
- panel.add(goButton);
-
- add(panel, BorderLayout.PAGE_START);
-
- folderTable = new FolderTable(model);
- folderTable.setFillsViewportHeight(true);
- model.addFolderListener(folderTable);
-
- add(new JScrollPane(folderTable), BorderLayout.CENTER);
- }
-
- private void loadFolder() {
- try {
- setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
- String id = pathField.getText().trim();
- if (id.length() == 0) {
- id = "/";
- }
- model.loadFolder(id, id.startsWith("/"));
- model.loadObject(model.getCurrentFolder().getId());
- } catch (Exception ex) {
- ClientHelper.showError(null, ex);
- return;
- } finally {
- setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
- }
- }
+ private String parentId;
+
+ private JButton upButton;
+ private JTextField pathField;
+ private JButton goButton;
+ private FolderTable folderTable;
+
+ public FolderPanel(ClientModel model) {
+ super();
+
+ this.model = model;
+ model.addFolderListener(this);
+ model.addObjectListener(this);
+ createGUI();
+ }
+
+ public void folderLoaded(ClientModelEvent event) {
+ Folder currentFolder = event.getClientModel().getCurrentFolder();
+
+ if (currentFolder != null) {
+ String path = currentFolder.getPath();
+ pathField.setText(path);
+
+ Folder parent = currentFolder.getFolderParent();
+ if (parent == null) {
+ parentId = null;
+ upButton.setEnabled(false);
+ } else {
+ parentId = parent.getId();
+ upButton.setEnabled(true);
+ }
+ } else {
+ pathField.setText("???");
+ parentId = null;
+ upButton.setEnabled(false);
+ }
+ }
+
+ public void objectLoaded(ClientModelEvent event) {
+ if ((folderTable.getSelectedRow() > -1) && (event.getClientModel().getCurrentObject() != null)) {
+ String selId = folderTable.getValueAt(folderTable.getSelectedRow(), FolderTable.ID_COLUMN).toString();
+ String curId = event.getClientModel().getCurrentObject().getId();
+
+ if (!curId.equals(selId)) {
+ folderTable.clearSelection();
+ }
+ }
+ }
+
+ private void createGUI() {
+ setLayout(new BorderLayout());
+
+ JPanel panel = new JPanel();
+ panel.setLayout(new BoxLayout(panel, BoxLayout.LINE_AXIS));
+ panel.setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0));
+
+ upButton = new JButton("up");
+ upButton.setEnabled(false);
+ upButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ try {
+ setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+ model.loadFolder(parentId, false);
+ model.loadObject(model.getCurrentFolder().getId());
+ } catch (Exception ex) {
+ ClientHelper.showError(null, ex);
+ return;
+ } finally {
+ setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ }
+ }
+ });
+ panel.add(upButton);
+
+ pathField = new JTextField("");
+ pathField.addKeyListener(new KeyListener() {
+ public void keyTyped(KeyEvent e) {
+ }
+
+ public void keyReleased(KeyEvent e) {
+ if (e.getKeyCode() == KeyEvent.VK_ENTER) {
+ loadFolder();
+ }
+ }
+
+ public void keyPressed(KeyEvent e) {
+ }
+ });
+ panel.add(pathField);
+
+ goButton = new JButton("go");
+ goButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ loadFolder();
+ }
+ });
+ panel.add(goButton);
+
+ add(panel, BorderLayout.PAGE_START);
+
+ folderTable = new FolderTable(model);
+ folderTable.setFillsViewportHeight(true);
+ model.addFolderListener(folderTable);
+
+ add(new JScrollPane(folderTable), BorderLayout.CENTER);
+ }
+
+ private void loadFolder() {
+ try {
+ setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+ String id = pathField.getText().trim();
+ if (id.length() == 0) {
+ id = "/";
+ }
+ model.loadFolder(id, id.startsWith("/"));
+ model.loadObject(model.getCurrentFolder().getId());
+ } catch (Exception ex) {
+ ClientHelper.showError(null, ex);
+ return;
+ } finally {
+ setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ }
+ }
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/FolderTable.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/FolderTable.java?rev=1100912&r1=1100911&r2=1100912&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/FolderTable.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/FolderTable.java Mon May 9 08:13:03 2011
@@ -61,7 +61,7 @@ public class FolderTable extends JTable
private static final String[] COLUMN_NAMES = { "", "Name", "Type", "Content Type", "Size", "Creation Date",
"Created by", "Modification Date", "Modified by", "Id" };
private static final int[] COLUMN_WIDTHS = { 24, 200, 150, 150, 80, 180, 100, 180, 100, 300 };
- private static final int ID_COLUMN = 9;
+ public static final int ID_COLUMN = 9;
private final ClientModel model;
@@ -96,7 +96,7 @@ public class FolderTable extends JTable
int row = getSelectedRow();
if (row > -1) {
- String id = getValueAt(row, ID_COLUMN).toString();
+ String id = getModel().getValueAt(getRowSorter().convertRowIndexToModel(row), ID_COLUMN).toString();
try {
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
@@ -153,7 +153,7 @@ public class FolderTable extends JTable
private void doAction(boolean alternate) {
int row = getSelectedRow();
if ((row > -1) && (row < model.getCurrentChildren().size())) {
- String id = getValueAt(row, ID_COLUMN).toString();
+ String id = getModel().getValueAt(getRowSorter().convertRowIndexToModel(row), ID_COLUMN).toString();
CmisObject object = model.getFromCurrentChildren(id);
if (object instanceof Document) {
Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/QueryFrame.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/QueryFrame.java?rev=1100912&r1=1100911&r2=1100912&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/QueryFrame.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/QueryFrame.java Mon May 9 08:13:03 2011
@@ -30,6 +30,7 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.Map;
@@ -51,14 +52,21 @@ import javax.swing.table.AbstractTableMo
import javax.swing.text.NumberFormatter;
import org.apache.chemistry.opencmis.client.api.ItemIterable;
+import org.apache.chemistry.opencmis.client.api.ObjectId;
import org.apache.chemistry.opencmis.client.api.QueryResult;
+import org.apache.chemistry.opencmis.client.runtime.ObjectIdImpl;
+import org.apache.chemistry.opencmis.commons.PropertyIds;
import org.apache.chemistry.opencmis.commons.data.PropertyData;
import org.apache.chemistry.opencmis.workbench.model.ClientModel;
+import org.apache.chemistry.opencmis.workbench.swing.IdRenderer;
public class QueryFrame extends JFrame {
private static final long serialVersionUID = 1L;
+ private static final Cursor HAND_CURSOR = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);
+ private static final Cursor DEFAULT_CURSOR = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
+
private static final String WINDOW_TITLE = "CMIS Query";
private static final String DEFAULT_QUERY = "SELECT * FROM cmis:document";
@@ -143,6 +151,7 @@ public class QueryFrame extends JFrame {
// table
resultsTable = new JTable();
+ resultsTable.setDefaultRenderer(ObjectIdImpl.class, new IdRenderer());
resultsTable.setFillsViewportHeight(true);
resultsTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
@@ -177,6 +186,15 @@ public class QueryFrame extends JFrame {
}
public void mouseClicked(MouseEvent e) {
+ int row = resultsTable.rowAtPoint(e.getPoint());
+ int column = resultsTable.columnAtPoint(e.getPoint());
+ if (row > -1 && resultsTable.getColumnClass(column) == ObjectIdImpl.class) {
+ try {
+ model.loadObject(((ObjectId) resultsTable.getValueAt(row, column)).getId());
+ } catch (Exception ex) {
+ ClientHelper.showError(QueryFrame.this, ex);
+ }
+ }
}
public void mousePressed(MouseEvent e) {
@@ -194,6 +212,21 @@ public class QueryFrame extends JFrame {
}
});
+ resultsTable.addMouseMotionListener(new MouseMotionListener() {
+ public void mouseMoved(MouseEvent e) {
+ int row = resultsTable.rowAtPoint(e.getPoint());
+ int column = resultsTable.columnAtPoint(e.getPoint());
+ if (row > -1 && resultsTable.getColumnClass(column) == ObjectIdImpl.class) {
+ resultsTable.setCursor(HAND_CURSOR);
+ } else {
+ resultsTable.setCursor(DEFAULT_CURSOR);
+ }
+ }
+
+ public void mouseDragged(MouseEvent e) {
+ }
+ });
+
add(new JSplitPane(JSplitPane.VERTICAL_SPLIT, inputPanel, new JScrollPane(resultsTable)));
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
@@ -230,7 +263,11 @@ public class QueryFrame extends JFrame {
rtm.setColumnCount(Math.max(rtm.getColumnCount(), qr.getProperties().size()));
for (PropertyData<?> prop : qr.getProperties()) {
- rtm.setValue(row, prop.getQueryName(), prop.getFirstValue());
+ if (PropertyIds.OBJECT_ID.equals(prop.getId()) && (prop.getFirstValue() != null)) {
+ rtm.setValue(row, prop.getQueryName(), new ObjectIdImpl(prop.getFirstValue().toString()));
+ } else {
+ rtm.setValue(row, prop.getQueryName(), prop.getFirstValue());
+ }
}
row++;
Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/RepositoryInfoFrame.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/RepositoryInfoFrame.java?rev=1100912&r1=1100911&r2=1100912&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/RepositoryInfoFrame.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/RepositoryInfoFrame.java Mon May 9 08:13:03 2011
@@ -61,7 +61,7 @@ public class RepositoryInfoFrame extends
return;
}
- add(new JScrollPane(new RepositoryInfoPanel(repInfo)));
+ add(new JScrollPane(new RepositoryInfoPanel(model, repInfo)));
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
pack();
@@ -76,8 +76,8 @@ public class RepositoryInfoFrame extends
private final RepositoryInfo repInfo;
- public RepositoryInfoPanel(RepositoryInfo repInfo) {
- super();
+ public RepositoryInfoPanel(ClientModel model, RepositoryInfo repInfo) {
+ super(model);
this.repInfo = repInfo;
createGUI();
@@ -92,12 +92,12 @@ public class RepositoryInfoFrame extends
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());
+ addId("Root folder Id:").setText(repInfo.getRootFolderId());
addLine("Latest change token:").setText(repInfo.getLatestChangeLogToken());
- addLine("Thin client URI:").setText(repInfo.getThinClientUri());
+ addLink("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()));
+ addYesNoLabel("Changes incomplete:").setValue(is(repInfo.getChangesIncomplete()));
addLine("Changes on type:").setText(
repInfo.getChangesOnType() == null ? "" : repInfo.getChangesOnType().toString());
@@ -106,17 +106,16 @@ public class RepositoryInfoFrame extends
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()));
+ addYesNoLabel("Get descendants supported:").setValue(is(cap.isGetDescendantsSupported()));
+ addYesNoLabel("Get folder tree supported:").setValue(is(cap.isGetFolderTreeSupported()));
+ addYesNoLabel("Unfiling supported:").setValue(is(cap.isUnfilingSupported()));
+ addYesNoLabel("Multifiling supported:").setValue(is(cap.isMultifilingSupported()));
+ addYesNoLabel("Version specific filing supported:").setValue(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()));
+ addYesNoLabel("All versions searchable:").setValue(is(cap.isAllVersionsSearchableSupported()));
+ addYesNoLabel("PWC searchable:").setValue(is(cap.isPwcSearchableSupported()));
+ addYesNoLabel("PWC updatable:").setValue(is(cap.isPwcUpdatableSupported()));
addLine("Content stream updates:").setText(str(cap.getContentStreamUpdatesCapability()));
addLine("Renditions:").setText(str(cap.getRenditionsCapability()));
addLine("Changes:").setText(str(cap.getChangesCapability()));
@@ -126,7 +125,7 @@ public class RepositoryInfoFrame extends
if (repInfo.getAclCapabilities() != null) {
AclCapabilities cap = repInfo.getAclCapabilities();
- addLine("ACL Capabilities", true).setText("");
+ addLine("ACL Capabilities:", true).setText("");
addLine("Supported permissions:").setText(str(cap.getSupportedPermissions()));
addLine("ACL propagation:").setText(str(cap.getAclPropagation()));
@@ -143,7 +142,7 @@ public class RepositoryInfoFrame extends
JTable permTable = new JTable(data, new String[] { "Permission", "Description" });
permTable.setFillsViewportHeight(true);
- addComponent("Permissions", new JScrollPane(permTable));
+ addComponent("Permissions:", new JScrollPane(permTable));
}
if (cap.getPermissionMapping() != null) {
@@ -158,7 +157,7 @@ public class RepositoryInfoFrame extends
JTable permMapTable = new JTable(data, new String[] { "Key", "Permissions" });
permMapTable.setFillsViewportHeight(true);
- addComponent("Permission mapping", new JScrollPane(permMapTable));
+ addComponent("Permission mapping:", new JScrollPane(permMapTable));
}
}
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TckDialog.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TckDialog.java?rev=1100912&r1=1100911&r2=1100912&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TckDialog.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TckDialog.java Mon May 9 08:13:03 2011
@@ -73,8 +73,9 @@ public class TckDialog {
return;
}
- JOptionPane.showMessageDialog(owner, "The TCK is brand new and incomplete. Don't trust the results, yet!",
- "TCK Warning", JOptionPane.WARNING_MESSAGE);
+ // JOptionPane.showMessageDialog(owner,
+ // "The TCK is brand new and incomplete. Don't trust the results, yet!",
+ // "TCK Warning", JOptionPane.WARNING_MESSAGE);
new TckSelectDialog();
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypeSplitPane.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypeSplitPane.java?rev=1100912&r1=1100911&r2=1100912&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypeSplitPane.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypeSplitPane.java Mon May 9 08:13:03 2011
@@ -24,7 +24,6 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.List;
-import javax.swing.JCheckBox;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTable;
@@ -36,23 +35,34 @@ import org.apache.chemistry.opencmis.cli
import org.apache.chemistry.opencmis.commons.definitions.DocumentTypeDefinition;
import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
import org.apache.chemistry.opencmis.commons.definitions.RelationshipTypeDefinition;
+import org.apache.chemistry.opencmis.workbench.model.ClientModel;
import org.apache.chemistry.opencmis.workbench.swing.CollectionRenderer;
import org.apache.chemistry.opencmis.workbench.swing.InfoPanel;
+import org.apache.chemistry.opencmis.workbench.swing.YesNoLabel;
public class TypeSplitPane extends JSplitPane {
private static final long serialVersionUID = 1L;
+ private final ClientModel model;
+
private TypeInfoPanel typePanel;
private PropertyDefinitionTable propertyDefinitionTable;
- public TypeSplitPane() {
+ public TypeSplitPane(ClientModel model) {
super(JSplitPane.VERTICAL_SPLIT);
+
+ this.model = model;
+
createGUI();
}
+ protected ClientModel getClientModel() {
+ return model;
+ }
+
private void createGUI() {
- typePanel = new TypeInfoPanel();
+ typePanel = new TypeInfoPanel(model);
propertyDefinitionTable = new PropertyDefinitionTable();
setLeftComponent(new JScrollPane(typePanel));
@@ -77,18 +87,18 @@ public class TypeSplitPane extends JSpli
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 YesNoLabel creatableLabel;
+ private YesNoLabel fileableLabel;
+ private YesNoLabel queryableLabel;
+ private YesNoLabel aclLabel;
+ private YesNoLabel policyLabel;
+ private YesNoLabel versionableLabel;
private JTextField contentStreamAllowedField;
private JTextField allowedSourceTypesField;
private JTextField allowedTargetTypesField;
- public TypeInfoPanel() {
- super();
+ public TypeInfoPanel(ClientModel model) {
+ super(model);
createGUI();
}
@@ -101,21 +111,21 @@ public class TypeSplitPane extends JSpli
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()));
+ creatableLabel.setValue(is(type.isCreatable()));
+ fileableLabel.setValue(is(type.isFileable()));
+ queryableLabel.setValue(is(type.isQueryable()));
+ aclLabel.setValue(is(type.isControllableAcl()));
+ policyLabel.setValue(is(type.isControllablePolicy()));
if (type instanceof DocumentTypeDefinition) {
DocumentTypeDefinition docType = (DocumentTypeDefinition) type;
- versionableBox.setVisible(true);
- versionableBox.setSelected(is(docType.isVersionable()));
+ versionableLabel.setVisible(true);
+ versionableLabel.setValue(is(docType.isVersionable()));
contentStreamAllowedField.setVisible(true);
contentStreamAllowedField.setText(docType.getContentStreamAllowed() == null ? "???" : docType
.getContentStreamAllowed().toString());
} else {
- versionableBox.setVisible(false);
+ versionableLabel.setVisible(false);
contentStreamAllowedField.setVisible(false);
}
@@ -139,12 +149,12 @@ public class TypeSplitPane extends JSpli
localNameField.setText("");
queryNameField.setText("");
baseTypeField.setText("");
- creatableBox.setSelected(false);
- fileableBox.setSelected(false);
- queryableBox.setSelected(false);
- aclBox.setSelected(false);
- policyBox.setSelected(false);
- versionableBox.setVisible(false);
+ creatableLabel.setValue(false);
+ fileableLabel.setValue(false);
+ queryableLabel.setValue(false);
+ aclLabel.setValue(false);
+ policyLabel.setValue(false);
+ versionableLabel.setVisible(false);
contentStreamAllowedField.setVisible(false);
allowedSourceTypesField.setVisible(false);
allowedTargetTypesField.setVisible(false);
@@ -163,12 +173,12 @@ public class TypeSplitPane extends JSpli
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:");
+ creatableLabel = addYesNoLabel("Creatable:");
+ fileableLabel = addYesNoLabel("Fileable:");
+ queryableLabel = addYesNoLabel("Queryable:");
+ aclLabel = addYesNoLabel("ACL controlable:");
+ policyLabel = addYesNoLabel("Policy controlable:");
+ versionableLabel = addYesNoLabel("Versionable:");
contentStreamAllowedField = addLine("Content stream allowed:");
allowedSourceTypesField = addLine("Allowed source types:");
allowedTargetTypesField = addLine("Allowed target types:");
Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypesFrame.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypesFrame.java?rev=1100912&r1=1100911&r2=1100912&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypesFrame.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypesFrame.java Mon May 9 08:13:03 2011
@@ -78,7 +78,7 @@ public class TypesFrame extends JFrame {
}
});
- typePanel = new TypeSplitPane();
+ typePanel = new TypeSplitPane(model);
JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(typesTree), typePanel);
splitPane.setDividerLocation(300);
Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/AbstractDetailsTable.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/AbstractDetailsTable.java?rev=1100912&r1=1100911&r2=1100912&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/AbstractDetailsTable.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/AbstractDetailsTable.java Mon May 9 08:13:03 2011
@@ -139,7 +139,7 @@ public abstract class AbstractDetailsTab
public void mouseMoved(MouseEvent e) {
int row = rowAtPoint(e.getPoint());
int column = columnAtPoint(e.getPoint());
- if (row > -1 && getDetailColumClass(column) == ObjectId.class) {
+ if (row > -1 && getColumnClass(column) == ObjectId.class) {
setCursor(HAND_CURSOR);
} else {
setCursor(DEFAULT_CURSOR);
Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ObjectPanel.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/ObjectPanel.java?rev=1100912&r1=1100911&r2=1100912&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ObjectPanel.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ObjectPanel.java Mon May 9 08:13:03 2011
@@ -44,29 +44,27 @@ public class ObjectPanel extends InfoPan
private static final long serialVersionUID = 1L;
- private final ClientModel model;
-
private JTextField nameField;
private JTextField idField;
private JTextField typeField;
private JTextField basetypeField;
private JTextField versionLabelField;
+ private JTextField pwcField;
private JTextField contentUrlField;
private InfoList paths;
private InfoList allowableActionsList;
private JButton refreshButton;
public ObjectPanel(ClientModel model) {
- super();
+ super(model);
- this.model = model;
model.addObjectListener(this);
createGUI();
}
public void objectLoaded(ClientModelEvent event) {
- CmisObject object = model.getCurrentObject();
+ CmisObject object = getClientModel().getCurrentObject();
if (object == null) {
nameField.setText("");
@@ -74,6 +72,7 @@ public class ObjectPanel extends InfoPan
typeField.setText("");
basetypeField.setText("");
versionLabelField.setText("");
+ pwcField.setText("");
paths.removeAll();
contentUrlField.setText("");
allowableActionsList.removeAll();
@@ -85,12 +84,23 @@ public class ObjectPanel extends InfoPan
typeField.setText(object.getType().getId());
basetypeField.setText(object.getBaseTypeId().toString());
if (object instanceof Document) {
+ Document doc = (Document) object;
+
try {
- versionLabelField.setText(((Document) object).getVersionLabel());
+ versionLabelField.setText(doc.getVersionLabel());
} catch (Exception e) {
versionLabelField.setText("???");
}
+
+ if (doc.isVersionSeriesCheckedOut() == null) {
+ pwcField.setText("");
+ } else if (doc.isVersionSeriesCheckedOut().booleanValue()) {
+ pwcField.setText(doc.getVersionSeriesCheckedOutId());
+ } else {
+ pwcField.setText("(not checked out)");
+ }
} else {
+ pwcField.setText("");
versionLabelField.setText("");
}
@@ -122,7 +132,7 @@ public class ObjectPanel extends InfoPan
paths.setList(Collections.singletonList("(not filable)"));
}
- String docUrl = getDocumentURL(object, model.getClientSession().getSession());
+ String docUrl = getDocumentURL(object, getClientModel().getClientSession().getSession());
if (docUrl != null) {
contentUrlField.setText(docUrl);
} else {
@@ -148,11 +158,12 @@ public class ObjectPanel extends InfoPan
setupGUI();
nameField = addLine("Name:", true);
- idField = addLine("Id:");
+ idField = addId("Id:");
typeField = addLine("Type:");
basetypeField = addLine("Base Type:");
- versionLabelField = addLine("Version Label:");
paths = addComponent("Paths:", new InfoList());
+ versionLabelField = addLine("Version Label:");
+ pwcField = addId("PWC:");
contentUrlField = addLink("Content URL:");
allowableActionsList = addComponent("Allowable Actions:", new InfoList());
refreshButton = addComponent("", new JButton("Refresh"));
@@ -162,7 +173,7 @@ public class ObjectPanel extends InfoPan
public void actionPerformed(ActionEvent e) {
try {
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
- model.reloadObject();
+ getClientModel().reloadObject();
} catch (Exception ex) {
ClientHelper.showError(null, ex);
} finally {
Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/PolicyTable.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/PolicyTable.java?rev=1100912&r1=1100911&r2=1100912&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/PolicyTable.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/PolicyTable.java Mon May 9 08:13:03 2011
@@ -39,12 +39,13 @@ public class PolicyTable extends Abstrac
@Override
public void singleClickAction(MouseEvent e, int rowIndex, int colIndex) {
- if (colIndex != 1) {
+ if (getColumnClass(colIndex) != ObjectId.class) {
return;
}
try {
- getClientModel().loadObject(getObject().getPolicies().get(rowIndex).getId());
+ getClientModel().loadObject(
+ getObject().getPolicies().get(getRowSorter().convertRowIndexToModel(rowIndex)).getId());
setTab(0);
} catch (Exception ex) {
ClientHelper.showError(this, ex);
Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/RelationshipTable.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/RelationshipTable.java?rev=1100912&r1=1100911&r2=1100912&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/RelationshipTable.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/RelationshipTable.java Mon May 9 08:13:03 2011
@@ -39,17 +39,11 @@ public class RelationshipTable extends A
@Override
public void singleClickAction(MouseEvent e, int rowIndex, int colIndex) {
- Relationship relationship = getObject().getRelationships().get(rowIndex);
- ObjectId id = null;
-
- if (colIndex == 2) {
- id = relationship;
- } else if (colIndex == 3) {
- id = relationship.getSourceId();
- } else if (colIndex == 4) {
- id = relationship.getTargetId();
+ if (getColumnClass(colIndex) != ObjectId.class) {
+ return;
}
+ ObjectId id = (ObjectId) getValueAt(rowIndex, colIndex);
if ((id == null) || (id.getId() == null)) {
return;
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/RenditionTable.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/RenditionTable.java?rev=1100912&r1=1100911&r2=1100912&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/RenditionTable.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/RenditionTable.java Mon May 9 08:13:03 2011
@@ -38,7 +38,7 @@ public class RenditionTable extends Abst
@Override
public void doubleClickAction(MouseEvent e, int rowIndex) {
- String streamId = getObject().getRenditions().get(rowIndex).getStreamId();
+ String streamId = getObject().getRenditions().get(getRowSorter().convertRowIndexToModel(rowIndex)).getStreamId();
if (e.isShiftDown()) {
ClientHelper.download(this.getParent(), getObject(), streamId);
Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/TypesPanel.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/TypesPanel.java?rev=1100912&r1=1100911&r2=1100912&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/TypesPanel.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/TypesPanel.java Mon May 9 08:13:03 2011
@@ -28,18 +28,14 @@ public class TypesPanel extends TypeSpli
private static final long serialVersionUID = 1L;
- private final ClientModel model;
-
public TypesPanel(ClientModel model) {
- super();
-
- this.model = model;
+ super(model);
model.addObjectListener(this);
}
@Override
public void objectLoaded(ClientModelEvent event) {
- CmisObject object = model.getCurrentObject();
+ CmisObject object = getClientModel().getCurrentObject();
if (object == null) {
setType(null);
Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/VersionTable.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/VersionTable.java?rev=1100912&r1=1100911&r2=1100912&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/VersionTable.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/VersionTable.java Mon May 9 08:13:03 2011
@@ -94,14 +94,14 @@ public class VersionTable extends Abstra
@Override
public void singleClickAction(MouseEvent e, int rowIndex, int colIndex) {
- if (colIndex != 5) {
+ if (getColumnClass(colIndex) != ObjectId.class) {
return;
}
String versionId = null;
lock.readLock().lock();
try {
- versionId = versions.get(rowIndex).getId();
+ versionId = versions.get(getRowSorter().convertRowIndexToModel(rowIndex)).getId();
} finally {
lock.readLock().unlock();
}
@@ -119,9 +119,11 @@ public class VersionTable extends Abstra
lock.readLock().lock();
try {
if (e.isShiftDown()) {
- ClientHelper.download(this.getParent(), versions.get(rowIndex), null);
+ ClientHelper.download(this.getParent(), versions.get(getRowSorter().convertRowIndexToModel(rowIndex)),
+ null);
} else {
- ClientHelper.open(this.getParent(), versions.get(rowIndex), null);
+ ClientHelper
+ .open(this.getParent(), versions.get(getRowSorter().convertRowIndexToModel(rowIndex)), null);
}
} finally {
lock.readLock().unlock();
Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/InfoPanel.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/InfoPanel.java?rev=1100912&r1=1100911&r2=1100912&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/InfoPanel.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/InfoPanel.java Mon May 9 08:13:03 2011
@@ -33,7 +33,6 @@ import java.util.Collection;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
-import javax.swing.JCheckBox;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
@@ -44,15 +43,26 @@ import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import org.apache.chemistry.opencmis.workbench.ClientHelper;
+import org.apache.chemistry.opencmis.workbench.model.ClientModel;
public abstract class InfoPanel extends JPanel {
private static final long serialVersionUID = 1L;
+ private final ClientModel model;
+
private JPanel gridPanel;
private GridBagConstraints gbc;
private Font boldFont;
+ public InfoPanel(ClientModel model) {
+ this.model = model;
+ }
+
+ protected ClientModel getClientModel() {
+ return model;
+ }
+
protected void setupGUI() {
setLayout(new FlowLayout(FlowLayout.LEFT));
setBackground(Color.WHITE);
@@ -102,6 +112,67 @@ public abstract class InfoPanel extends
return textField;
}
+ protected JTextField addId(final String label) {
+ final JTextField textField = addLine(label, false);
+
+ textField.getDocument().addDocumentListener(new DocumentListener() {
+ @Override
+ public void removeUpdate(DocumentEvent e) {
+
+ }
+
+ @Override
+ public void insertUpdate(DocumentEvent e) {
+ String id = textField.getText();
+ if (id.length() > 0 && !id.startsWith("(")) {
+ textField.setForeground(ClientHelper.LINK_COLOR);
+ textField.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
+ } else {
+ textField.setForeground(UIManager.getColor("textForeground"));
+ textField.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ }
+ }
+
+ @Override
+ public void changedUpdate(DocumentEvent e) {
+ }
+ });
+
+ textField.addMouseListener(new MouseListener() {
+ @Override
+ public void mouseReleased(MouseEvent e) {
+ }
+
+ @Override
+ public void mousePressed(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseExited(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseEntered(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() == 1) {
+ String id = textField.getText();
+ if (id.length() > 0 && !id.startsWith("(")) {
+ try {
+ getClientModel().loadObject(id);
+ } catch (Exception ex) {
+ ClientHelper.showError(InfoPanel.this, ex);
+ }
+ }
+ }
+ }
+ });
+
+ return textField;
+ }
+
protected JTextField addLink(final String label) {
final JTextField textField = addLine(label, false);
@@ -165,12 +236,11 @@ public abstract class InfoPanel extends
return textField;
}
- protected JCheckBox addCheckBox(String label) {
- JCheckBox checkBox = new JCheckBox();
- checkBox.setEnabled(false);
+ protected YesNoLabel addYesNoLabel(String label) {
+ YesNoLabel ynl = new YesNoLabel();
JLabel textLable = new JLabel(label);
- textLable.setLabelFor(checkBox);
+ textLable.setLabelFor(ynl);
gbc.gridy++;
@@ -180,14 +250,20 @@ public abstract class InfoPanel extends
gbc.gridx = 1;
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
- gridPanel.add(checkBox, gbc);
+ gridPanel.add(ynl, gbc);
- return checkBox;
+ return ynl;
}
protected <T extends JComponent> T addComponent(String label, T comp) {
JLabel textLable = new JLabel(label);
- textLable.setLabelFor(comp);
+
+ JPanel panel = new JPanel();
+ panel.setLayout(new BoxLayout(panel, BoxLayout.LINE_AXIS));
+ panel.setBorder(BorderFactory.createEmptyBorder());
+ panel.setOpaque(false);
+ panel.add(comp);
+ textLable.setLabelFor(panel);
gbc.gridy++;
@@ -197,7 +273,7 @@ public abstract class InfoPanel extends
gbc.gridx = 1;
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
- gridPanel.add(comp, gbc);
+ gridPanel.add(panel, gbc);
return comp;
}
Added: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/YesNoLabel.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/YesNoLabel.java?rev=1100912&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/YesNoLabel.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/YesNoLabel.java Mon May 9 08:13:03 2011
@@ -0,0 +1,54 @@
+/*
+ * 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.swing;
+
+import javax.swing.Icon;
+import javax.swing.JLabel;
+
+import org.apache.chemistry.opencmis.workbench.ClientHelper;
+
+public class YesNoLabel extends JLabel {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final Icon TRUE_ICON = ClientHelper.getIcon("yes.png");
+ public static final Icon FALSE_ICON = ClientHelper.getIcon("no.png");
+
+ public static final String YES_TEXT = "Yes";
+ public static final String NO_TEXT = "No";
+
+ private boolean value = true;
+
+ public YesNoLabel() {
+ super(YES_TEXT, TRUE_ICON, LEFT);
+ }
+
+ public boolean getValue() {
+ return value;
+ }
+
+ public void setValue(boolean value) {
+ if (this.value != value) {
+ this.value = value;
+ setIcon(value ? TRUE_ICON : FALSE_ICON);
+ setText(value ? YES_TEXT : NO_TEXT);
+ invalidate();
+ }
+ }
+}
Propchange: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/YesNoLabel.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/no.png
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/no.png?rev=1100912&view=auto
==============================================================================
Binary file - no diff available.
Propchange: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/no.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/yes.png
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/yes.png?rev=1100912&view=auto
==============================================================================
Binary file - no diff available.
Propchange: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/yes.png
------------------------------------------------------------------------------
svn:mime-type = image/png