You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2010/07/29 12:31:36 UTC
svn commit: r980394 - in /incubator/chemistry/opencmis-swingclient/trunk: ./
src/main/java/org/apache/chemistry/opencmis/swingclient/
src/main/java/org/apache/chemistry/opencmis/swingclient/details/
src/main/resources/images/
Author: fmui
Date: Thu Jul 29 10:31:35 2010
New Revision: 980394
URL: http://svn.apache.org/viewvc?rev=980394&view=rev
Log:
- changed OpenCMIS version back to 0.1.0
- a few minor improvements
Added:
incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/icon.png (with props)
Modified:
incubator/chemistry/opencmis-swingclient/trunk/pom.xml
incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/ClientFrame.java
incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/InfoDialog.java
incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/LoginDialog.java
incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/ObjectPanel.java
Modified: incubator/chemistry/opencmis-swingclient/trunk/pom.xml
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/pom.xml?rev=980394&r1=980393&r2=980394&view=diff
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/pom.xml (original)
+++ incubator/chemistry/opencmis-swingclient/trunk/pom.xml Thu Jul 29 10:31:35 2010
@@ -227,7 +227,7 @@
<dependency>
<groupId>org.apache.chemistry.opencmis</groupId>
<artifactId>chemistry-opencmis-client-impl</artifactId>
- <version>0.2.0-incubating-SNAPSHOT</version>
+ <version>0.1.0-incubating-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
Modified: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/ClientFrame.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/ClientFrame.java?rev=980394&r1=980393&r2=980394&view=diff
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/ClientFrame.java (original)
+++ incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/ClientFrame.java Thu Jul 29 10:31:35 2010
@@ -25,6 +25,7 @@ import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
@@ -37,208 +38,197 @@ import org.apache.chemistry.opencmis.swi
public class ClientFrame extends JFrame {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
- private static final String WINDOW_TITLE = "CMIS Swing Client";
+ private static final String WINDOW_TITLE = "OpenCMIS Swing Client";
- private static final int BUTTON_CONNECT = 0;
- private static final int BUTTON_REPOSITORY_INFO = 1;
- private static final int BUTTON_TYPES = 2;
- private static final int BUTTON_QUERY = 3;
- private static final int BUTTON_CREATE_DOCUMENT = 4;
- private static final int BUTTON_CREATE_FOLDER = 5;
- private static final int BUTTON_LOG = 8;
- private static final int BUTTON_INFO = 9;
-
- private LoginDialog loginDialog;
- private LogFrame logFrame;
- private InfoDialog infoDialog;
-
- private JToolBar toolBar;
- private JButton[] toolbarButton;
-
- private FolderPanel folderPanel;
- private DetailsTabs detailsTabs;
-
- private ClientModel model;
-
- public ClientFrame() {
- super();
-
- model = new ClientModel();
- createGUI();
- showLoginForm();
- }
-
- private void createGUI() {
- setTitle(WINDOW_TITLE);
- setPreferredSize(new Dimension(1000, 600));
- setMinimumSize(new Dimension(200, 60));
-
- setLayout(new BorderLayout());
-
- final ClientFrame thisFrame = this;
- loginDialog = new LoginDialog(this);
- logFrame = new LogFrame();
- infoDialog = new InfoDialog(this);
-
- Container pane = getContentPane();
-
- toolBar = new JToolBar("CMIS Toolbar", JToolBar.HORIZONTAL);
-
- toolbarButton = new JButton[10];
-
- toolbarButton[BUTTON_CONNECT] = new JButton("Connection", ClientHelper
- .getIcon("connect.png"));
- toolbarButton[BUTTON_CONNECT].addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- showLoginForm();
- }
- });
-
- toolBar.add(toolbarButton[BUTTON_CONNECT]);
-
- toolBar.addSeparator();
-
- toolbarButton[BUTTON_REPOSITORY_INFO] = new JButton("Repository Info",
- ClientHelper.getIcon("repository-info.png"));
- toolbarButton[BUTTON_REPOSITORY_INFO].setEnabled(false);
- toolbarButton[BUTTON_REPOSITORY_INFO]
- .addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- new RepositoryInfoFrame(model);
- }
- });
-
- toolBar.add(toolbarButton[BUTTON_REPOSITORY_INFO]);
-
- toolbarButton[BUTTON_TYPES] = new JButton("Types", ClientHelper
- .getIcon("types.png"));
- toolbarButton[BUTTON_TYPES].setEnabled(false);
- toolbarButton[BUTTON_TYPES].addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- new TypesFrame(model);
- }
- });
-
- toolBar.add(toolbarButton[BUTTON_TYPES]);
-
- toolbarButton[BUTTON_QUERY] = new JButton("Query", ClientHelper
- .getIcon("query.png"));
- toolbarButton[BUTTON_QUERY].setEnabled(false);
- toolbarButton[BUTTON_QUERY].addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- new QueryFrame(model);
- }
- });
-
- toolBar.add(toolbarButton[BUTTON_QUERY]);
-
- toolBar.addSeparator();
-
- toolbarButton[BUTTON_CREATE_DOCUMENT] = new JButton("Create Document",
- ClientHelper.getIcon("newdocument.png"));
- toolbarButton[BUTTON_CREATE_DOCUMENT].setEnabled(false);
- toolbarButton[BUTTON_CREATE_DOCUMENT]
- .addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- new CreateDocumentDialog(thisFrame, model);
- }
- });
-
- toolBar.add(toolbarButton[BUTTON_CREATE_DOCUMENT]);
-
- toolbarButton[BUTTON_CREATE_FOLDER] = new JButton("Create Folder",
- ClientHelper.getIcon("newfolder.png"));
- toolbarButton[BUTTON_CREATE_FOLDER].setEnabled(false);
- toolbarButton[BUTTON_CREATE_FOLDER]
- .addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- new CreateFolderDialog(thisFrame, model);
- }
- });
-
- toolBar.add(toolbarButton[BUTTON_CREATE_FOLDER]);
-
- toolBar.addSeparator();
-
- toolbarButton[BUTTON_LOG] = new JButton("Log", ClientHelper
- .getIcon("log.png"));
- toolbarButton[BUTTON_LOG].addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- logFrame.showFrame();
- }
- });
-
- toolBar.add(toolbarButton[BUTTON_LOG]);
-
- toolbarButton[BUTTON_INFO] = new JButton("Info", ClientHelper
- .getIcon("info.png"));
- toolbarButton[BUTTON_INFO].addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- infoDialog.showDialog();
- }
- });
-
- toolBar.add(toolbarButton[BUTTON_INFO]);
-
- pane.add(toolBar, BorderLayout.PAGE_START);
-
- folderPanel = new FolderPanel(model);
- detailsTabs = new DetailsTabs(model);
-
- JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
- folderPanel, new JScrollPane(detailsTabs));
-
- pane.add(split, BorderLayout.CENTER);
-
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- pack();
-
- split.setDividerLocation(500);
-
- setLocationRelativeTo(null);
- setVisible(true);
- }
-
- private void showLoginForm() {
- loginDialog.showDialog();
- if (!loginDialog.isCanceled()) {
- ClientSession clientSession = loginDialog.getClientSession();
-
- model.setClientSession(clientSession);
-
- try {
- setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
-
- model.loadFolder(clientSession.getSession().getRepositoryInfo()
- .getRootFolderId(), false);
- model.loadObject(clientSession.getSession().getRepositoryInfo()
- .getRootFolderId());
-
- toolbarButton[BUTTON_REPOSITORY_INFO].setEnabled(true);
- toolbarButton[BUTTON_TYPES].setEnabled(true);
- toolbarButton[BUTTON_QUERY].setEnabled(model.supportsQuery());
- toolbarButton[BUTTON_CREATE_DOCUMENT].setEnabled(true);
- toolbarButton[BUTTON_CREATE_FOLDER].setEnabled(true);
-
- setTitle(WINDOW_TITLE
- + " - "
- + clientSession.getSession().getRepositoryInfo()
- .getName());
- } catch (Exception ex) {
- toolbarButton[BUTTON_REPOSITORY_INFO].setEnabled(false);
- toolbarButton[BUTTON_TYPES].setEnabled(false);
- toolbarButton[BUTTON_QUERY].setEnabled(false);
- toolbarButton[BUTTON_CREATE_DOCUMENT].setEnabled(false);
- toolbarButton[BUTTON_CREATE_FOLDER].setEnabled(false);
-
- ClientHelper.showError(null, ex);
-
- setTitle(WINDOW_TITLE);
- } finally {
- setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
- }
- }
- }
+ private static final int BUTTON_CONNECT = 0;
+ private static final int BUTTON_REPOSITORY_INFO = 1;
+ private static final int BUTTON_TYPES = 2;
+ private static final int BUTTON_QUERY = 3;
+ private static final int BUTTON_CREATE_DOCUMENT = 4;
+ private static final int BUTTON_CREATE_FOLDER = 5;
+ private static final int BUTTON_LOG = 8;
+ private static final int BUTTON_INFO = 9;
+
+ private LoginDialog loginDialog;
+ private LogFrame logFrame;
+ private InfoDialog infoDialog;
+
+ private JToolBar toolBar;
+ private JButton[] toolbarButton;
+
+ private FolderPanel folderPanel;
+ private DetailsTabs detailsTabs;
+
+ private ClientModel model;
+
+ public ClientFrame() {
+ super();
+
+ model = new ClientModel();
+ createGUI();
+ showLoginForm();
+ }
+
+ private void createGUI() {
+ setTitle(WINDOW_TITLE);
+ setPreferredSize(new Dimension(1000, 600));
+ setMinimumSize(new Dimension(200, 60));
+
+ ImageIcon icon = ClientHelper.getIcon("icon.png");
+ if (icon != null) {
+ setIconImage(icon.getImage());
+ }
+
+ setLayout(new BorderLayout());
+
+ final ClientFrame thisFrame = this;
+ loginDialog = new LoginDialog(this);
+ logFrame = new LogFrame();
+ infoDialog = new InfoDialog(this);
+
+ Container pane = getContentPane();
+
+ toolBar = new JToolBar("CMIS Toolbar", JToolBar.HORIZONTAL);
+
+ toolbarButton = new JButton[10];
+
+ toolbarButton[BUTTON_CONNECT] = new JButton("Connection", ClientHelper.getIcon("connect.png"));
+ toolbarButton[BUTTON_CONNECT].addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ showLoginForm();
+ }
+ });
+
+ toolBar.add(toolbarButton[BUTTON_CONNECT]);
+
+ toolBar.addSeparator();
+
+ toolbarButton[BUTTON_REPOSITORY_INFO] = new JButton("Repository Info", ClientHelper
+ .getIcon("repository-info.png"));
+ toolbarButton[BUTTON_REPOSITORY_INFO].setEnabled(false);
+ toolbarButton[BUTTON_REPOSITORY_INFO].addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ new RepositoryInfoFrame(model);
+ }
+ });
+
+ toolBar.add(toolbarButton[BUTTON_REPOSITORY_INFO]);
+
+ toolbarButton[BUTTON_TYPES] = new JButton("Types", ClientHelper.getIcon("types.png"));
+ toolbarButton[BUTTON_TYPES].setEnabled(false);
+ toolbarButton[BUTTON_TYPES].addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ new TypesFrame(model);
+ }
+ });
+
+ toolBar.add(toolbarButton[BUTTON_TYPES]);
+
+ toolbarButton[BUTTON_QUERY] = new JButton("Query", ClientHelper.getIcon("query.png"));
+ toolbarButton[BUTTON_QUERY].setEnabled(false);
+ toolbarButton[BUTTON_QUERY].addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ new QueryFrame(model);
+ }
+ });
+
+ toolBar.add(toolbarButton[BUTTON_QUERY]);
+
+ toolBar.addSeparator();
+
+ toolbarButton[BUTTON_CREATE_DOCUMENT] = new JButton("Create Document", ClientHelper.getIcon("newdocument.png"));
+ toolbarButton[BUTTON_CREATE_DOCUMENT].setEnabled(false);
+ toolbarButton[BUTTON_CREATE_DOCUMENT].addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ new CreateDocumentDialog(thisFrame, model);
+ }
+ });
+
+ toolBar.add(toolbarButton[BUTTON_CREATE_DOCUMENT]);
+
+ toolbarButton[BUTTON_CREATE_FOLDER] = new JButton("Create Folder", ClientHelper.getIcon("newfolder.png"));
+ toolbarButton[BUTTON_CREATE_FOLDER].setEnabled(false);
+ toolbarButton[BUTTON_CREATE_FOLDER].addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ new CreateFolderDialog(thisFrame, model);
+ }
+ });
+
+ toolBar.add(toolbarButton[BUTTON_CREATE_FOLDER]);
+
+ toolBar.addSeparator();
+
+ toolbarButton[BUTTON_LOG] = new JButton("Log", ClientHelper.getIcon("log.png"));
+ toolbarButton[BUTTON_LOG].addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ logFrame.showFrame();
+ }
+ });
+
+ toolBar.add(toolbarButton[BUTTON_LOG]);
+
+ toolbarButton[BUTTON_INFO] = new JButton("Info", ClientHelper.getIcon("info.png"));
+ toolbarButton[BUTTON_INFO].addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ infoDialog.showDialog();
+ }
+ });
+
+ toolBar.add(toolbarButton[BUTTON_INFO]);
+
+ pane.add(toolBar, BorderLayout.PAGE_START);
+
+ folderPanel = new FolderPanel(model);
+ detailsTabs = new DetailsTabs(model);
+
+ JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, folderPanel, new JScrollPane(detailsTabs));
+
+ pane.add(split, BorderLayout.CENTER);
+
+ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ pack();
+
+ split.setDividerLocation(500);
+
+ setLocationRelativeTo(null);
+ setVisible(true);
+ }
+
+ private void showLoginForm() {
+ loginDialog.showDialog();
+ if (!loginDialog.isCanceled()) {
+ ClientSession clientSession = loginDialog.getClientSession();
+
+ model.setClientSession(clientSession);
+
+ try {
+ setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+
+ model.loadFolder(clientSession.getSession().getRepositoryInfo().getRootFolderId(), false);
+ model.loadObject(clientSession.getSession().getRepositoryInfo().getRootFolderId());
+
+ toolbarButton[BUTTON_REPOSITORY_INFO].setEnabled(true);
+ toolbarButton[BUTTON_TYPES].setEnabled(true);
+ toolbarButton[BUTTON_QUERY].setEnabled(model.supportsQuery());
+ toolbarButton[BUTTON_CREATE_DOCUMENT].setEnabled(true);
+ toolbarButton[BUTTON_CREATE_FOLDER].setEnabled(true);
+
+ setTitle(WINDOW_TITLE + " - " + clientSession.getSession().getRepositoryInfo().getName());
+ } catch (Exception ex) {
+ toolbarButton[BUTTON_REPOSITORY_INFO].setEnabled(false);
+ toolbarButton[BUTTON_TYPES].setEnabled(false);
+ toolbarButton[BUTTON_QUERY].setEnabled(false);
+ toolbarButton[BUTTON_CREATE_DOCUMENT].setEnabled(false);
+ toolbarButton[BUTTON_CREATE_FOLDER].setEnabled(false);
+
+ ClientHelper.showError(null, ex);
+
+ setTitle(WINDOW_TITLE);
+ } finally {
+ setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ }
+ }
+ }
}
Modified: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/InfoDialog.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/InfoDialog.java?rev=980394&r1=980393&r2=980394&view=diff
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/InfoDialog.java (original)
+++ incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/InfoDialog.java Thu Jul 29 10:31:35 2010
@@ -19,6 +19,8 @@
package org.apache.chemistry.opencmis.swingclient;
import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Font;
import java.awt.Frame;
import java.awt.TextArea;
import java.io.BufferedReader;
@@ -28,57 +30,74 @@ import java.io.InputStreamReader;
import javax.swing.BoxLayout;
import javax.swing.JDialog;
import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.UIManager;
public class InfoDialog extends JDialog {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
- public InfoDialog(Frame owner) {
- super(owner, "Info", true);
- createGUI();
- }
-
- private void createGUI() {
- setPreferredSize(new Dimension(600, 400));
- setMinimumSize(new Dimension(200, 60));
-
- setLayout(new BoxLayout(getContentPane(), BoxLayout.PAGE_AXIS));
-
- StringBuilder readme = new StringBuilder();
-
- InputStream stream = getClass().getResourceAsStream("/META-INF/README");
- if (stream != null) {
- try {
- BufferedReader br = new BufferedReader(new InputStreamReader(
- stream));
-
- String s = null;
- while ((s = br.readLine()) != null) {
- readme.append(s);
- readme.append('\n');
- }
-
- br.close();
- } catch (Exception e) {
- }
- } else {
- readme.append("CMIS Swing Client");
- }
-
- TextArea ta = new TextArea(readme.toString());
- ta.setEditable(false);
- add(ta);
-
- setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
- pack();
- setLocationRelativeTo(null);
- }
-
- public void showDialog() {
- setVisible(true);
- }
-
- public void hideDialog() {
- setVisible(false);
- }
+ public InfoDialog(Frame owner) {
+ super(owner, "Info", true);
+ createGUI();
+ }
+
+ private void createGUI() {
+ setPreferredSize(new Dimension(600, 400));
+ setMinimumSize(new Dimension(200, 60));
+
+ setLayout(new BoxLayout(getContentPane(), BoxLayout.PAGE_AXIS));
+
+ JPanel topPanel = new JPanel(new FlowLayout());
+ // topPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
+
+ JLabel cmisLogo = new JLabel(ClientHelper.getIcon("icon.png"));
+ topPanel.add(cmisLogo);
+
+ Font labelFont = UIManager.getFont("Label.font");
+ Font titleFont = labelFont.deriveFont(Font.BOLD, labelFont.getSize2D() * 2f);
+
+ JLabel titleLabel = new JLabel("OpenCMIS Swing Client");
+ titleLabel.setFont(titleFont);
+ topPanel.add(titleLabel);
+
+ add(topPanel);
+
+ StringBuilder readme = new StringBuilder();
+
+ InputStream stream = getClass().getResourceAsStream("/META-INF/README");
+ if (stream != null) {
+ try {
+ BufferedReader br = new BufferedReader(new InputStreamReader(stream));
+
+ String s = null;
+ while ((s = br.readLine()) != null) {
+ readme.append(s);
+ readme.append('\n');
+ }
+
+ br.close();
+ } catch (Exception e) {
+ }
+ } else {
+ readme.append("CMIS Swing Client");
+ }
+
+ TextArea ta = new TextArea(readme.toString());
+ ta.setEditable(false);
+ add(ta);
+
+ setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
+ pack();
+ setLocationRelativeTo(null);
+ }
+
+ public void showDialog() {
+ setVisible(true);
+ }
+
+ public void hideDialog() {
+ setVisible(false);
+ }
}
Modified: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/LoginDialog.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/LoginDialog.java?rev=980394&r1=980393&r2=980394&view=diff
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/LoginDialog.java (original)
+++ incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/LoginDialog.java Thu Jul 29 10:31:35 2010
@@ -45,225 +45,222 @@ import org.apache.chemistry.opencmis.swi
public class LoginDialog extends JDialog {
- public static final String SYSPROP_URL = "swingclient.url";
- public static final String SYSPROP_USER = "swingclient.user";
- public static final String SYSPROP_PASSWORD = "swingclient.password";
-
- private static final long serialVersionUID = 1L;
-
- private JTextField urlField;
- private JRadioButton bindingAtomButton;
- private JRadioButton bindingWebServicesButton;
- private JTextField usernameField;
- private JPasswordField passwordField;
- private JButton connectButton;
- private JButton loginButton;
- private JComboBox repositoryBox;
-
- private boolean canceled = true;
-
- private ClientSession clientSession;
-
- public LoginDialog(Frame owner) {
- super(owner, "Login", true);
- createGUI();
- }
-
- private void createGUI() {
- setPreferredSize(new Dimension(500, 250));
-
- Container pane = getContentPane();
-
- pane.setLayout(new GridBagLayout());
-
- urlField = createTextField(pane, "URL:", 1);
- urlField.setText(System.getProperty(SYSPROP_URL, ""));
-
- createBindingButtons(pane, 2);
-
- usernameField = createTextField(pane, "Username:", 3);
- usernameField.setText(System.getProperty(SYSPROP_USER, ""));
-
- passwordField = createPasswordField(pane, "Password:", 4);
- passwordField.setText(System.getProperty(SYSPROP_PASSWORD, ""));
-
- connectButton = createButton(pane, "Connect", 5);
-
- createRepositoryBox(pane, 6);
-
- loginButton = createButton(pane, "Login", 7);
- loginButton.setEnabled(false);
-
- connectButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- repositoryBox.removeAllItems();
-
- try {
- setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
- createClientSession();
-
- List<Repository> repositories = clientSession
- .getRepositories();
- if (repositories.size() > 0) {
-
- for (Repository repository : repositories) {
- repositoryBox.addItem(repository.getName() + " ("
- + repository.getId() + ")");
- }
-
- repositoryBox.setEnabled(true);
- loginButton.setEnabled(true);
- } else {
- repositoryBox.setEnabled(false);
- loginButton.setEnabled(false);
- }
- } catch (Exception ex) {
- repositoryBox.setEnabled(false);
- loginButton.setEnabled(false);
-
- ClientHelper.showError(getOwner(), ex);
- } finally {
- setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
- }
- }
- });
-
- loginButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- try {
- clientSession.createSession(repositoryBox
- .getSelectedIndex());
- canceled = false;
- hideDialog();
- } catch (Exception ex) {
- repositoryBox.setEnabled(false);
- loginButton.setEnabled(false);
-
- ClientHelper.showError(getOwner(), ex);
- }
- }
- });
-
- setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
- pack();
- setLocationRelativeTo(null);
- }
-
- private JTextField createTextField(Container pane, String label, int row) {
- JTextField textField = new JTextField(60);
- JLabel textLabel = new JLabel(label);
- textLabel.setLabelFor(textField);
-
- GridBagConstraints c = new GridBagConstraints();
- c.anchor = GridBagConstraints.LINE_START;
- c.fill = GridBagConstraints.HORIZONTAL;
- c.gridx = 0;
- c.gridy = row;
- pane.add(textLabel, c);
- c.gridx = 1;
- c.ipadx = 400;
- pane.add(textField, c);
-
- return textField;
- }
-
- private JPasswordField createPasswordField(Container pane, String label,
- int row) {
- JPasswordField textField = new JPasswordField(60);
- JLabel textLabel = new JLabel(label);
- textLabel.setLabelFor(textField);
-
- GridBagConstraints c = new GridBagConstraints();
- c.anchor = GridBagConstraints.LINE_START;
- c.fill = GridBagConstraints.HORIZONTAL;
- c.gridx = 0;
- c.gridy = row;
- pane.add(textLabel, c);
- c.gridx = 1;
- pane.add(textField, c);
-
- return textField;
- }
-
- private void createBindingButtons(Container pane, int row) {
- JPanel bindingContainer = new JPanel();
- bindingAtomButton = new JRadioButton("AtomPub", true);
- bindingWebServicesButton = new JRadioButton("Web Services", false);
- ButtonGroup bindingGroup = new ButtonGroup();
- bindingGroup.add(bindingAtomButton);
- bindingGroup.add(bindingWebServicesButton);
- bindingContainer.add(bindingAtomButton);
- bindingContainer.add(bindingWebServicesButton);
- JLabel bindingLabel = new JLabel("Binding:");
-
- GridBagConstraints c = new GridBagConstraints();
- c.anchor = GridBagConstraints.LINE_START;
- c.gridx = 0;
- c.gridy = row;
- pane.add(bindingLabel, c);
- c.gridx = 1;
- pane.add(bindingContainer, c);
- }
-
- private JButton createButton(Container pane, String label, int row) {
- JButton button = new JButton(label);
-
- GridBagConstraints c = new GridBagConstraints();
- c.anchor = GridBagConstraints.CENTER;
- c.fill = GridBagConstraints.HORIZONTAL;
- c.gridx = 1;
- c.gridy = row;
- pane.add(button, c);
-
- return button;
- }
-
- private void createRepositoryBox(Container pane, int row) {
- repositoryBox = new JComboBox();
- repositoryBox.setEnabled(false);
- JLabel boxLabel = new JLabel("Repository:");
- boxLabel.setLabelFor(repositoryBox);
-
- GridBagConstraints c = new GridBagConstraints();
- c.anchor = GridBagConstraints.LINE_START;
- c.fill = GridBagConstraints.HORIZONTAL;
- c.gridx = 0;
- c.gridy = row;
- pane.add(boxLabel, c);
- c.gridx = 1;
- pane.add(repositoryBox, c);
- }
-
- public void createClientSession() {
- String url = urlField.getText();
- BindingType binding = bindingAtomButton.isSelected() ? BindingType.ATOMPUB
- : BindingType.WEBSERVICES;
- String username = usernameField.getText();
- String password = new String(passwordField.getPassword());
-
- clientSession = new ClientSession(url, binding, username, password);
- }
-
- public void showDialog() {
- clientSession = null;
- canceled = true;
-
- repositoryBox.removeAllItems();
- repositoryBox.setEnabled(false);
- loginButton.setEnabled(false);
-
- setVisible(true);
- }
-
- public void hideDialog() {
- setVisible(false);
- }
-
- public ClientSession getClientSession() {
- return clientSession;
- }
-
- public boolean isCanceled() {
- return canceled;
- }
+ public static final String SYSPROP_URL = "swingclient.url";
+ public static final String SYSPROP_BINDING = "swingclient.binding";
+ public static final String SYSPROP_USER = "swingclient.user";
+ public static final String SYSPROP_PASSWORD = "swingclient.password";
+
+ private static final long serialVersionUID = 1L;
+
+ private JTextField urlField;
+ private JRadioButton bindingAtomButton;
+ private JRadioButton bindingWebServicesButton;
+ private JTextField usernameField;
+ private JPasswordField passwordField;
+ private JButton connectButton;
+ private JButton loginButton;
+ private JComboBox repositoryBox;
+
+ private boolean canceled = true;
+
+ private ClientSession clientSession;
+
+ public LoginDialog(Frame owner) {
+ super(owner, "Login", true);
+ createGUI();
+ }
+
+ private void createGUI() {
+ setPreferredSize(new Dimension(500, 250));
+
+ Container pane = getContentPane();
+
+ pane.setLayout(new GridBagLayout());
+
+ urlField = createTextField(pane, "URL:", 1);
+ urlField.setText(System.getProperty(SYSPROP_URL, ""));
+
+ createBindingButtons(pane, 2);
+
+ usernameField = createTextField(pane, "Username:", 3);
+ usernameField.setText(System.getProperty(SYSPROP_USER, ""));
+
+ passwordField = createPasswordField(pane, "Password:", 4);
+ passwordField.setText(System.getProperty(SYSPROP_PASSWORD, ""));
+
+ connectButton = createButton(pane, "Connect", 5);
+
+ createRepositoryBox(pane, 6);
+
+ loginButton = createButton(pane, "Login", 7);
+ loginButton.setEnabled(false);
+
+ connectButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ repositoryBox.removeAllItems();
+
+ try {
+ setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+ createClientSession();
+
+ List<Repository> repositories = clientSession.getRepositories();
+ if (repositories.size() > 0) {
+
+ for (Repository repository : repositories) {
+ repositoryBox.addItem(repository.getName() + " (" + repository.getId() + ")");
+ }
+
+ repositoryBox.setEnabled(true);
+ loginButton.setEnabled(true);
+ } else {
+ repositoryBox.setEnabled(false);
+ loginButton.setEnabled(false);
+ }
+ } catch (Exception ex) {
+ repositoryBox.setEnabled(false);
+ loginButton.setEnabled(false);
+
+ ClientHelper.showError(getOwner(), ex);
+ } finally {
+ setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ }
+ }
+ });
+
+ loginButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ try {
+ clientSession.createSession(repositoryBox.getSelectedIndex());
+ canceled = false;
+ hideDialog();
+ } catch (Exception ex) {
+ repositoryBox.setEnabled(false);
+ loginButton.setEnabled(false);
+
+ ClientHelper.showError(getOwner(), ex);
+ }
+ }
+ });
+
+ setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
+ pack();
+ setLocationRelativeTo(null);
+ }
+
+ private JTextField createTextField(Container pane, String label, int row) {
+ JTextField textField = new JTextField(60);
+ JLabel textLabel = new JLabel(label);
+ textLabel.setLabelFor(textField);
+
+ GridBagConstraints c = new GridBagConstraints();
+ c.anchor = GridBagConstraints.LINE_START;
+ c.fill = GridBagConstraints.HORIZONTAL;
+ c.gridx = 0;
+ c.gridy = row;
+ pane.add(textLabel, c);
+ c.gridx = 1;
+ c.ipadx = 400;
+ pane.add(textField, c);
+
+ return textField;
+ }
+
+ private JPasswordField createPasswordField(Container pane, String label, int row) {
+ JPasswordField textField = new JPasswordField(60);
+ JLabel textLabel = new JLabel(label);
+ textLabel.setLabelFor(textField);
+
+ GridBagConstraints c = new GridBagConstraints();
+ c.anchor = GridBagConstraints.LINE_START;
+ c.fill = GridBagConstraints.HORIZONTAL;
+ c.gridx = 0;
+ c.gridy = row;
+ pane.add(textLabel, c);
+ c.gridx = 1;
+ pane.add(textField, c);
+
+ return textField;
+ }
+
+ private void createBindingButtons(Container pane, int row) {
+ JPanel bindingContainer = new JPanel();
+ boolean atom = (System.getProperty(SYSPROP_BINDING, "atom").toLowerCase().charAt(0) == 'a');
+ bindingAtomButton = new JRadioButton("AtomPub", atom);
+ bindingWebServicesButton = new JRadioButton("Web Services", !atom);
+ ButtonGroup bindingGroup = new ButtonGroup();
+ bindingGroup.add(bindingAtomButton);
+ bindingGroup.add(bindingWebServicesButton);
+ bindingContainer.add(bindingAtomButton);
+ bindingContainer.add(bindingWebServicesButton);
+ JLabel bindingLabel = new JLabel("Binding:");
+
+ GridBagConstraints c = new GridBagConstraints();
+ c.anchor = GridBagConstraints.LINE_START;
+ c.gridx = 0;
+ c.gridy = row;
+ pane.add(bindingLabel, c);
+ c.gridx = 1;
+ pane.add(bindingContainer, c);
+ }
+
+ private JButton createButton(Container pane, String label, int row) {
+ JButton button = new JButton(label);
+
+ GridBagConstraints c = new GridBagConstraints();
+ c.anchor = GridBagConstraints.CENTER;
+ c.fill = GridBagConstraints.HORIZONTAL;
+ c.gridx = 1;
+ c.gridy = row;
+ pane.add(button, c);
+
+ return button;
+ }
+
+ private void createRepositoryBox(Container pane, int row) {
+ repositoryBox = new JComboBox();
+ repositoryBox.setEnabled(false);
+ JLabel boxLabel = new JLabel("Repository:");
+ boxLabel.setLabelFor(repositoryBox);
+
+ GridBagConstraints c = new GridBagConstraints();
+ c.anchor = GridBagConstraints.LINE_START;
+ c.fill = GridBagConstraints.HORIZONTAL;
+ c.gridx = 0;
+ c.gridy = row;
+ pane.add(boxLabel, c);
+ c.gridx = 1;
+ pane.add(repositoryBox, c);
+ }
+
+ public void createClientSession() {
+ String url = urlField.getText();
+ BindingType binding = bindingAtomButton.isSelected() ? BindingType.ATOMPUB : BindingType.WEBSERVICES;
+ String username = usernameField.getText();
+ String password = new String(passwordField.getPassword());
+
+ clientSession = new ClientSession(url, binding, username, password);
+ }
+
+ public void showDialog() {
+ clientSession = null;
+ canceled = true;
+
+ repositoryBox.removeAllItems();
+ repositoryBox.setEnabled(false);
+ loginButton.setEnabled(false);
+
+ setVisible(true);
+ }
+
+ public void hideDialog() {
+ setVisible(false);
+ }
+
+ public ClientSession getClientSession() {
+ return clientSession;
+ }
+
+ public boolean isCanceled() {
+ return canceled;
+ }
}
Modified: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/ObjectPanel.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/ObjectPanel.java?rev=980394&r1=980393&r2=980394&view=diff
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/ObjectPanel.java (original)
+++ incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/details/ObjectPanel.java Thu Jul 29 10:31:35 2010
@@ -44,6 +44,7 @@ public class ObjectPanel extends InfoPan
private JTextField typeField;
private JTextField basetypeField;
private JList allowableActionsList;
+ private JButton refreshButton;
public ObjectPanel(ClientModel model) {
super();
@@ -63,6 +64,7 @@ public class ObjectPanel extends InfoPan
typeField.setText("");
basetypeField.setText("");
allowableActionsList.removeAll();
+ refreshButton.setEnabled(false);
} else {
try {
nameField.setText(object.getName());
@@ -74,6 +76,7 @@ public class ObjectPanel extends InfoPan
} else {
allowableActionsList.setListData(new String[] { "(missing)" });
}
+ refreshButton.setEnabled(true);
} catch (Exception e) {
ClientHelper.showError(this, e);
}
@@ -88,7 +91,8 @@ public class ObjectPanel extends InfoPan
typeField = addLine("Type:");
basetypeField = addLine("Base Type:");
allowableActionsList = addComponent("Allowable Actions:", new JList());
- JButton refreshButton = addComponent("", new JButton("Refresh"));
+ refreshButton = addComponent("", new JButton("Refresh"));
+ refreshButton.setEnabled(false);
refreshButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/icon.png
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/icon.png?rev=980394&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/icon.png
------------------------------------------------------------------------------
svn:mime-type = image/png