diff options
author | mconway <michael_conway@unc.edu> | 2013-05-28 12:33:27 (GMT) |
---|---|---|
committer | mconway <michael_conway@unc.edu> | 2013-05-28 12:33:27 (GMT) |
commit | ff876c7fa81fa11e8e1ddb2e37913ab32f614961 (patch) | |
tree | 9f0144826b2a2c7636b2b8a549d5bfd3cbf6f69b | |
parent | 4567c26d8d86c3d9c3511bf302916848fabb3fa4 (diff) | |
download | QCG-Data-ff876c7fa81fa11e8e1ddb2e37913ab32f614961.zip QCG-Data-ff876c7fa81fa11e8e1ddb2e37913ab32f614961.tar.gz QCG-Data-ff876c7fa81fa11e8e1ddb2e37913ab32f614961.tar.bz2 |
[#1439] iDrop 2.0.1 release small cleanups and fixes
86 files changed, 22409 insertions, 19871 deletions
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/AboutDialog.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/AboutDialog.java index f83709c..28098ce 100644 --- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/AboutDialog.java +++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/AboutDialog.java @@ -4,10 +4,12 @@ package org.irods.jargon.idrop.desktop.systraygui; import java.awt.event.ActionEvent; + import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.JComponent; import javax.swing.KeyStroke; + import org.irods.jargon.core.utils.JargonVersion; import org.irods.jargon.idrop.desktop.systraygui.utils.Version; @@ -17,137 +19,141 @@ import org.irods.jargon.idrop.desktop.systraygui.utils.Version; */ public class AboutDialog extends javax.swing.JDialog { - /** + /** * */ private static final long serialVersionUID = 2532724831957628628L; /** Creates new form AboutDialog */ - public AboutDialog(final java.awt.Frame parent, final boolean modal) { - super(parent, modal); - initComponents(); - lblIdropVersion.setText(Version.VERSION + " - " + Version.BUILD_TIME); - lblJargonVersion.setText(JargonVersion.VERSION + "-" + JargonVersion.BUILD_TIME); - registerKeystrokeListener(); - } - - /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. - */ - - // <editor-fold defaultstate="collapsed" - // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents - private void initComponents() { - java.awt.GridBagConstraints gridBagConstraints; - - jLabel1 = new javax.swing.JLabel(); - lblJargonVersionLabel = new javax.swing.JLabel(); - lblJargonVersion = new javax.swing.JLabel(); - btnOK = new javax.swing.JButton(); - lblIdropVersionLabel = new javax.swing.JLabel(); - lblIdropVersion = new javax.swing.JLabel(); - - setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - setTitle("iDROP - About"); - setMinimumSize(new java.awt.Dimension(600, 400)); - getContentPane().setLayout(new java.awt.GridBagLayout()); - - jLabel1.setFont(new java.awt.Font("SansSerif", 1, 18)); // NOI18N - jLabel1.setText("iDROP - the iRODS Cloud Browser"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 0; - gridBagConstraints.gridwidth = 4; - gridBagConstraints.insets = new java.awt.Insets(0, 0, 14, 0); - getContentPane().add(jLabel1, gridBagConstraints); - - lblJargonVersionLabel.setText("Jargon Version:"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 4; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - gridBagConstraints.insets = new java.awt.Insets(0, 7, 0, 0); - getContentPane().add(lblJargonVersionLabel, gridBagConstraints); - - lblJargonVersion.setText("jLabel2"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 4; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(0, 7, 0, 0); - getContentPane().add(lblJargonVersion, gridBagConstraints); - - btnOK.setMnemonic('O'); - btnOK.setText("OK"); - btnOK.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnOKPressed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 3; - gridBagConstraints.gridy = 6; - gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0); - getContentPane().add(btnOK, gridBagConstraints); - - lblIdropVersionLabel.setText("iDrop Version:"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 5; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - gridBagConstraints.insets = new java.awt.Insets(0, 7, 0, 0); - getContentPane().add(lblIdropVersionLabel, gridBagConstraints); - - lblIdropVersion.setText("jLabel2"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 5; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(0, 7, 0, 0); - getContentPane().add(lblIdropVersion, gridBagConstraints); - - pack(); - }// </editor-fold>//GEN-END:initComponents - - private void btnOKPressed(final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnOKPressed - disposeOfAbout(); - }// GEN-LAST:event_btnOKPressed - - private void disposeOfAbout() { - this.dispose(); - } - - /** - * Register a listener for the enter event, so login can occur. - */ - private void registerKeystrokeListener() { - - KeyStroke enter = KeyStroke.getKeyStroke( - java.awt.event.KeyEvent.VK_ENTER, 0); - Action enterAction = new AbstractAction() { - - /** + public AboutDialog(final java.awt.Frame parent, final boolean modal) { + super(parent, modal); + initComponents(); + lblIdropVersion.setText(Version.VERSION + " - " + Version.BUILD_TIME); + lblJargonVersion.setText(JargonVersion.VERSION + "-" + + JargonVersion.BUILD_TIME); + registerKeystrokeListener(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + + // <editor-fold defaultstate="collapsed" + // <editor-fold defaultstate="collapsed" + // desc="Generated Code">//GEN-BEGIN:initComponents + private void initComponents() { + java.awt.GridBagConstraints gridBagConstraints; + + jLabel1 = new javax.swing.JLabel(); + lblJargonVersionLabel = new javax.swing.JLabel(); + lblJargonVersion = new javax.swing.JLabel(); + btnOK = new javax.swing.JButton(); + lblIdropVersionLabel = new javax.swing.JLabel(); + lblIdropVersion = new javax.swing.JLabel(); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setTitle("iDROP - About"); + setMinimumSize(new java.awt.Dimension(600, 400)); + getContentPane().setLayout(new java.awt.GridBagLayout()); + + jLabel1.setFont(new java.awt.Font("SansSerif", 1, 18)); // NOI18N + jLabel1.setText("iDROP - the iRODS Cloud Browser"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 0; + gridBagConstraints.gridwidth = 4; + gridBagConstraints.insets = new java.awt.Insets(0, 0, 14, 0); + getContentPane().add(jLabel1, gridBagConstraints); + + lblJargonVersionLabel.setText("Jargon Version:"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 4; + gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.insets = new java.awt.Insets(0, 7, 0, 0); + getContentPane().add(lblJargonVersionLabel, gridBagConstraints); + + lblJargonVersion.setText("jLabel2"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 4; + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.insets = new java.awt.Insets(0, 7, 0, 0); + getContentPane().add(lblJargonVersion, gridBagConstraints); + + btnOK.setMnemonic('O'); + btnOK.setText("OK"); + btnOK.addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed(final java.awt.event.ActionEvent evt) { + btnOKPressed(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 3; + gridBagConstraints.gridy = 6; + gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0); + getContentPane().add(btnOK, gridBagConstraints); + + lblIdropVersionLabel.setText("iDrop Version:"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 5; + gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.insets = new java.awt.Insets(0, 7, 0, 0); + getContentPane().add(lblIdropVersionLabel, gridBagConstraints); + + lblIdropVersion.setText("jLabel2"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 5; + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.insets = new java.awt.Insets(0, 7, 0, 0); + getContentPane().add(lblIdropVersion, gridBagConstraints); + + pack(); + }// </editor-fold>//GEN-END:initComponents + + private void btnOKPressed(final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnOKPressed + disposeOfAbout(); + }// GEN-LAST:event_btnOKPressed + + private void disposeOfAbout() { + dispose(); + } + + /** + * Register a listener for the enter event, so login can occur. + */ + private void registerKeystrokeListener() { + + KeyStroke enter = KeyStroke.getKeyStroke( + java.awt.event.KeyEvent.VK_ENTER, 0); + Action enterAction = new AbstractAction() { + + /** * */ private static final long serialVersionUID = -2548141664399058996L; @Override - public void actionPerformed(final ActionEvent e) { - disposeOfAbout(); - } - }; - btnOK.registerKeyboardAction(enterAction, enter, - JComponent.WHEN_IN_FOCUSED_WINDOW); - - } - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JButton btnOK; - private javax.swing.JLabel jLabel1; - private javax.swing.JLabel lblIdropVersion; - private javax.swing.JLabel lblIdropVersionLabel; - private javax.swing.JLabel lblJargonVersion; - private javax.swing.JLabel lblJargonVersionLabel; - // End of variables declaration//GEN-END:variables + public void actionPerformed(final ActionEvent e) { + disposeOfAbout(); + } + }; + btnOK.registerKeyboardAction(enterAction, enter, + JComponent.WHEN_IN_FOCUSED_WINDOW); + + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton btnOK; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel lblIdropVersion; + private javax.swing.JLabel lblIdropVersionLabel; + private javax.swing.JLabel lblJargonVersion; + private javax.swing.JLabel lblJargonVersionLabel; + // End of variables declaration//GEN-END:variables } diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/AddPermissionsDialog.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/AddPermissionsDialog.java index 306da4a..b5c4b76 100644 --- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/AddPermissionsDialog.java +++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/AddPermissionsDialog.java @@ -9,6 +9,7 @@ import java.awt.event.ActionListener; import java.util.Collections; import java.util.Comparator; import java.util.List; + import org.irods.jargon.core.connection.IRODSAccount; import org.irods.jargon.core.exception.JargonException; import org.irods.jargon.core.protovalues.FilePermissionEnum; @@ -19,209 +20,237 @@ import org.irods.jargon.core.pub.domain.UserFilePermission; import org.openide.util.Exceptions; /** - * + * * @author lisa */ -public class AddPermissionsDialog extends javax.swing.JDialog implements ActionListener { - - IRODSFileSystem irodsFileSystem; - IRODSAccount irodsAccount; - boolean isCollection; - UserFilePermission permissionToAdd = null; - - /** - * Creates new form AddPermissionsDialog - */ - public AddPermissionsDialog(javax.swing.JDialog parent, - boolean modal, - IRODSFileSystem irodsFileSystem, - IRODSAccount irodsAccount) { - super(parent, modal); - initComponents(); - - this.irodsFileSystem = irodsFileSystem; - this.irodsAccount = irodsAccount; - - - cbPermissionsPermission.addItem("READ"); - cbPermissionsPermission.addItem("WRITE"); - cbPermissionsPermission.addItem("OWN"); - - List<User> users = null; - try { - UserAO userAO = irodsFileSystem.getIRODSAccessObjectFactory().getUserAO(irodsAccount); - users = userAO.findAll(); - Collections.sort(users, new Comparator<User>() { - @Override - public int compare(final User object1, final User object2) { - return object1.getName().compareTo(object2.getName()); - } - } ); - - for (User user: users) { - cbPermissionsUserName.addItem(user.getNameWithZone()); - } - } catch (JargonException ex) { - Exceptions.printStackTrace(ex); - } - cbPermissionsPermission.addActionListener(this); - cbPermissionsUserName.addActionListener(this); - - updateAddButtonStatus(); - } - - private void updateAddButtonStatus() { - btnPermissionsAdd.setEnabled((cbPermissionsUserName.getSelectedIndex() >= 0) && - (cbPermissionsPermission.getSelectedIndex() >= 0)); - } - - public UserFilePermission getPermissionToAdd() { - return this.permissionToAdd; - } - - @Override - public void actionPerformed(ActionEvent ae) { - updateAddButtonStatus(); - } - - /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. - */ - @SuppressWarnings("unchecked") - // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents - private void initComponents() { - - pnlMain = new javax.swing.JPanel(); - pnlPermissionEdit = new javax.swing.JPanel(); - jPanel3 = new javax.swing.JPanel(); - jLabel31 = new javax.swing.JLabel(); - cbPermissionsUserName = new javax.swing.JComboBox(); - jPanel4 = new javax.swing.JPanel(); - jLabel32 = new javax.swing.JLabel(); - cbPermissionsPermission = new javax.swing.JComboBox(); - jPanel1 = new javax.swing.JPanel(); - jPanel2 = new javax.swing.JPanel(); - btnPermissionsCancel = new javax.swing.JButton(); - btnPermissionsAdd = new javax.swing.JButton(); - - setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - setTitle(org.openide.util.NbBundle.getMessage(AddPermissionsDialog.class, "AddPermissionsDialog.title")); // NOI18N - setBackground(java.awt.Color.white); - setPreferredSize(new java.awt.Dimension(460, 180)); - - pnlMain.setLayout(new java.awt.BorderLayout()); - - pnlPermissionEdit.setBorder(javax.swing.BorderFactory.createEmptyBorder(16, 8, 20, 8)); - pnlPermissionEdit.setPreferredSize(new java.awt.Dimension(527, 200)); - pnlPermissionEdit.setLayout(new java.awt.BorderLayout()); - - jLabel31.setText(org.openide.util.NbBundle.getMessage(AddPermissionsDialog.class, "AddPermissionsDialog.jLabel31.text")); // NOI18N - jLabel31.setPreferredSize(new java.awt.Dimension(120, 16)); - jPanel3.add(jLabel31); - - cbPermissionsUserName.setMinimumSize(new java.awt.Dimension(60, 27)); - cbPermissionsUserName.setPreferredSize(new java.awt.Dimension(260, 27)); - jPanel3.add(cbPermissionsUserName); - - pnlPermissionEdit.add(jPanel3, java.awt.BorderLayout.NORTH); - - jLabel32.setText(org.openide.util.NbBundle.getMessage(AddPermissionsDialog.class, "AddPermissionsDialog.jLabel32.text")); // NOI18N - jLabel32.setPreferredSize(new java.awt.Dimension(120, 16)); - jPanel4.add(jLabel32); - - cbPermissionsPermission.setPreferredSize(new java.awt.Dimension(260, 27)); - jPanel4.add(cbPermissionsPermission); - - pnlPermissionEdit.add(jPanel4, java.awt.BorderLayout.SOUTH); - - pnlMain.add(pnlPermissionEdit, java.awt.BorderLayout.CENTER); - - jPanel1.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 6, 1)); - jPanel1.setPreferredSize(new java.awt.Dimension(525, 40)); - jPanel1.setLayout(new java.awt.BorderLayout()); - - jPanel2.setPreferredSize(new java.awt.Dimension(200, 34)); - jPanel2.setRequestFocusEnabled(false); - - btnPermissionsCancel.setText(org.openide.util.NbBundle.getMessage(AddPermissionsDialog.class, "AddPermissionsDialog.btnPermissionsCancel.text")); // NOI18N - btnPermissionsCancel.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnPermissionsCancelActionPerformed(evt); - } - }); - jPanel2.add(btnPermissionsCancel); - - btnPermissionsAdd.setText(org.openide.util.NbBundle.getMessage(AddPermissionsDialog.class, "AddPermissionsDialog.btnPermissionsAdd.text")); // NOI18N - btnPermissionsAdd.setActionCommand(org.openide.util.NbBundle.getMessage(AddPermissionsDialog.class, "AddPermissionsDialog.btnPermissionsAdd.actionCommand")); // NOI18N - btnPermissionsAdd.setEnabled(false); - btnPermissionsAdd.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnPermissionsAddActionPerformed(evt); - } - }); - jPanel2.add(btnPermissionsAdd); - - jPanel1.add(jPanel2, java.awt.BorderLayout.EAST); - - pnlMain.add(jPanel1, java.awt.BorderLayout.SOUTH); - - getContentPane().add(pnlMain, java.awt.BorderLayout.CENTER); - - pack(); - }// </editor-fold>//GEN-END:initComponents - - private void btnPermissionsAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPermissionsAddActionPerformed - - String selectedPermission = (String)cbPermissionsPermission.getSelectedItem(); - String tmpSelectedUser = (String)cbPermissionsUserName.getSelectedItem(); - String selectedUser = null; - - // probably have to remve #zone from user name - int idx = tmpSelectedUser.indexOf("#"); - if (idx >= 0) { - selectedUser = tmpSelectedUser.substring(0, idx); - } - else { - selectedUser = tmpSelectedUser; - } - - try { - UserAO userAO = irodsFileSystem.getIRODSAccessObjectFactory().getUserAO(irodsAccount); - User user = userAO.findByName(tmpSelectedUser); - - permissionToAdd = new UserFilePermission( - selectedUser, - user.getId(), - FilePermissionEnum.valueOf(selectedPermission), - user.getUserType(), - user.getZone()); - } catch (JargonException ex) { - Exceptions.printStackTrace(ex); - } - - this.setVisible(false); - }//GEN-LAST:event_btnPermissionsAddActionPerformed - - private void btnPermissionsCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPermissionsCancelActionPerformed - this.dispose(); - }//GEN-LAST:event_btnPermissionsCancelActionPerformed - - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JButton btnPermissionsAdd; - private javax.swing.JButton btnPermissionsCancel; - private javax.swing.JComboBox cbPermissionsPermission; - private javax.swing.JComboBox cbPermissionsUserName; - private javax.swing.JLabel jLabel31; - private javax.swing.JLabel jLabel32; - private javax.swing.JPanel jPanel1; - private javax.swing.JPanel jPanel2; - private javax.swing.JPanel jPanel3; - private javax.swing.JPanel jPanel4; - private javax.swing.JPanel pnlMain; - private javax.swing.JPanel pnlPermissionEdit; - // End of variables declaration//GEN-END:variables +public class AddPermissionsDialog extends javax.swing.JDialog implements + ActionListener { + + /** + * + */ + private static final long serialVersionUID = 764249725877953976L; + IRODSFileSystem irodsFileSystem; + IRODSAccount irodsAccount; + boolean isCollection; + UserFilePermission permissionToAdd = null; + + /** + * Creates new form AddPermissionsDialog + */ + public AddPermissionsDialog(final javax.swing.JDialog parent, + final boolean modal, final IRODSFileSystem irodsFileSystem, + final IRODSAccount irodsAccount) { + super(parent, modal); + initComponents(); + + this.irodsFileSystem = irodsFileSystem; + this.irodsAccount = irodsAccount; + + cbPermissionsPermission.addItem("READ"); + cbPermissionsPermission.addItem("WRITE"); + cbPermissionsPermission.addItem("OWN"); + + List<User> users = null; + try { + UserAO userAO = irodsFileSystem.getIRODSAccessObjectFactory() + .getUserAO(irodsAccount); + users = userAO.findAll(); + Collections.sort(users, new Comparator<User>() { + @Override + public int compare(final User object1, final User object2) { + return object1.getName().compareTo(object2.getName()); + } + }); + + for (User user : users) { + cbPermissionsUserName.addItem(user.getNameWithZone()); + } + } catch (JargonException ex) { + Exceptions.printStackTrace(ex); + } + cbPermissionsPermission.addActionListener(this); + cbPermissionsUserName.addActionListener(this); + + updateAddButtonStatus(); + } + + private void updateAddButtonStatus() { + btnPermissionsAdd + .setEnabled((cbPermissionsUserName.getSelectedIndex() >= 0) + && (cbPermissionsPermission.getSelectedIndex() >= 0)); + } + + public UserFilePermission getPermissionToAdd() { + return permissionToAdd; + } + + @Override + public void actionPerformed(final ActionEvent ae) { + updateAddButtonStatus(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // <editor-fold defaultstate="collapsed" + // desc="Generated Code">//GEN-BEGIN:initComponents + private void initComponents() { + + pnlMain = new javax.swing.JPanel(); + pnlPermissionEdit = new javax.swing.JPanel(); + jPanel3 = new javax.swing.JPanel(); + jLabel31 = new javax.swing.JLabel(); + cbPermissionsUserName = new javax.swing.JComboBox(); + jPanel4 = new javax.swing.JPanel(); + jLabel32 = new javax.swing.JLabel(); + cbPermissionsPermission = new javax.swing.JComboBox(); + jPanel1 = new javax.swing.JPanel(); + jPanel2 = new javax.swing.JPanel(); + btnPermissionsCancel = new javax.swing.JButton(); + btnPermissionsAdd = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setTitle(org.openide.util.NbBundle.getMessage( + AddPermissionsDialog.class, "AddPermissionsDialog.title")); // NOI18N + setBackground(java.awt.Color.white); + setPreferredSize(new java.awt.Dimension(460, 180)); + + pnlMain.setLayout(new java.awt.BorderLayout()); + + pnlPermissionEdit.setBorder(javax.swing.BorderFactory + .createEmptyBorder(16, 8, 20, 8)); + pnlPermissionEdit.setPreferredSize(new java.awt.Dimension(527, 200)); + pnlPermissionEdit.setLayout(new java.awt.BorderLayout()); + + jLabel31.setText(org.openide.util.NbBundle.getMessage( + AddPermissionsDialog.class, + "AddPermissionsDialog.jLabel31.text")); // NOI18N + jLabel31.setPreferredSize(new java.awt.Dimension(120, 16)); + jPanel3.add(jLabel31); + + cbPermissionsUserName.setMinimumSize(new java.awt.Dimension(60, 27)); + cbPermissionsUserName.setPreferredSize(new java.awt.Dimension(260, 27)); + jPanel3.add(cbPermissionsUserName); + + pnlPermissionEdit.add(jPanel3, java.awt.BorderLayout.NORTH); + + jLabel32.setText(org.openide.util.NbBundle.getMessage( + AddPermissionsDialog.class, + "AddPermissionsDialog.jLabel32.text")); // NOI18N + jLabel32.setPreferredSize(new java.awt.Dimension(120, 16)); + jPanel4.add(jLabel32); + + cbPermissionsPermission + .setPreferredSize(new java.awt.Dimension(260, 27)); + jPanel4.add(cbPermissionsPermission); + + pnlPermissionEdit.add(jPanel4, java.awt.BorderLayout.SOUTH); + + pnlMain.add(pnlPermissionEdit, java.awt.BorderLayout.CENTER); + + jPanel1.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 6, + 1)); + jPanel1.setPreferredSize(new java.awt.Dimension(525, 40)); + jPanel1.setLayout(new java.awt.BorderLayout()); + + jPanel2.setPreferredSize(new java.awt.Dimension(200, 34)); + jPanel2.setRequestFocusEnabled(false); + + btnPermissionsCancel.setText(org.openide.util.NbBundle.getMessage( + AddPermissionsDialog.class, + "AddPermissionsDialog.btnPermissionsCancel.text")); // NOI18N + btnPermissionsCancel + .addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed( + final java.awt.event.ActionEvent evt) { + btnPermissionsCancelActionPerformed(evt); + } + }); + jPanel2.add(btnPermissionsCancel); + + btnPermissionsAdd.setText(org.openide.util.NbBundle.getMessage( + AddPermissionsDialog.class, + "AddPermissionsDialog.btnPermissionsAdd.text")); // NOI18N + btnPermissionsAdd + .setActionCommand(org.openide.util.NbBundle.getMessage( + AddPermissionsDialog.class, + "AddPermissionsDialog.btnPermissionsAdd.actionCommand")); // NOI18N + btnPermissionsAdd.setEnabled(false); + btnPermissionsAdd + .addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed( + final java.awt.event.ActionEvent evt) { + btnPermissionsAddActionPerformed(evt); + } + }); + jPanel2.add(btnPermissionsAdd); + + jPanel1.add(jPanel2, java.awt.BorderLayout.EAST); + + pnlMain.add(jPanel1, java.awt.BorderLayout.SOUTH); + + getContentPane().add(pnlMain, java.awt.BorderLayout.CENTER); + + pack(); + }// </editor-fold>//GEN-END:initComponents + + private void btnPermissionsAddActionPerformed( + final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnPermissionsAddActionPerformed + + String selectedPermission = (String) cbPermissionsPermission + .getSelectedItem(); + String tmpSelectedUser = (String) cbPermissionsUserName + .getSelectedItem(); + String selectedUser = null; + + // probably have to remve #zone from user name + int idx = tmpSelectedUser.indexOf("#"); + if (idx >= 0) { + selectedUser = tmpSelectedUser.substring(0, idx); + } else { + selectedUser = tmpSelectedUser; + } + + try { + UserAO userAO = irodsFileSystem.getIRODSAccessObjectFactory() + .getUserAO(irodsAccount); + User user = userAO.findByName(tmpSelectedUser); + + permissionToAdd = new UserFilePermission(selectedUser, + user.getId(), + FilePermissionEnum.valueOf(selectedPermission), + user.getUserType(), user.getZone()); + } catch (JargonException ex) { + Exceptions.printStackTrace(ex); + } + + setVisible(false); + }// GEN-LAST:event_btnPermissionsAddActionPerformed + + private void btnPermissionsCancelActionPerformed( + final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnPermissionsCancelActionPerformed + dispose(); + }// GEN-LAST:event_btnPermissionsCancelActionPerformed + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton btnPermissionsAdd; + private javax.swing.JButton btnPermissionsCancel; + private javax.swing.JComboBox cbPermissionsPermission; + private javax.swing.JComboBox cbPermissionsUserName; + private javax.swing.JLabel jLabel31; + private javax.swing.JLabel jLabel32; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel2; + private javax.swing.JPanel jPanel3; + private javax.swing.JPanel jPanel4; + private javax.swing.JPanel pnlMain; + private javax.swing.JPanel pnlPermissionEdit; + // End of variables declaration//GEN-END:variables } diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/ChangePasswordDialog.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/ChangePasswordDialog.java index 01f9af3..2d2e4b8 100644 --- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/ChangePasswordDialog.java +++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/ChangePasswordDialog.java @@ -8,8 +8,10 @@ package org.irods.jargon.idrop.desktop.systraygui; import java.awt.Color; import java.util.logging.Level; import java.util.logging.Logger; + import javax.swing.JDialog; import javax.swing.JOptionPane; + import org.irods.jargon.core.connection.IRODSAccount; import org.irods.jargon.core.exception.JargonException; import org.irods.jargon.core.pub.UserAO; @@ -23,303 +25,340 @@ import org.slf4j.LoggerFactory; */ public class ChangePasswordDialog extends javax.swing.JDialog { - private final iDrop idrop; - public static org.slf4j.Logger log = LoggerFactory.getLogger(ChangePasswordDialog.class); - - /** Creates new form PreferencesDialog */ - public ChangePasswordDialog(final iDrop idrop, final JDialog parent, final boolean modal) { - super(parent, modal); - this.idrop = idrop; - initComponents(); - setUpPasswordPanel(); - } - - /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. - */ - @SuppressWarnings("unchecked") - // <editor-fold defaultstate="collapsed" - // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents - private void initComponents() { - java.awt.GridBagConstraints gridBagConstraints; - - pnlCurrentGrid = new javax.swing.JPanel(); - lblHostLabel = new javax.swing.JLabel(); - lblHost = new javax.swing.JLabel(); - lblPortLabel = new javax.swing.JLabel(); - lblPort = new javax.swing.JLabel(); - lblZoneLabel = new javax.swing.JLabel(); - lblZone = new javax.swing.JLabel(); - lblResourceLabel = new javax.swing.JLabel(); - lblResource = new javax.swing.JLabel(); - lblUserNameLabel = new javax.swing.JLabel(); - lblUserName = new javax.swing.JLabel(); - pnlPasswords = new javax.swing.JPanel(); - lblNewPassword = new javax.swing.JLabel(); - passwdNewPassword = new javax.swing.JPasswordField(); - lblConfirmPassword = new javax.swing.JLabel(); - passwdConfirmPassword = new javax.swing.JPasswordField(); - pnlPasswordButtons = new javax.swing.JPanel(); - btnUpdatePassword = new javax.swing.JButton(); - btnCancel = new javax.swing.JButton(); - - setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - setTitle("iDrop - Change Password"); - setAlwaysOnTop(true); - setMinimumSize(new java.awt.Dimension(551, 400)); - - pnlCurrentGrid.setLayout(new java.awt.GridBagLayout()); - - lblHostLabel.setText(org.openide.util.NbBundle.getMessage(ChangePasswordDialog.class, "IDROPConfigurationPanel.lblHostLabel.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; - pnlCurrentGrid.add(lblHostLabel, gridBagConstraints); - - lblHost.setText(org.openide.util.NbBundle.getMessage(ChangePasswordDialog.class, "IDROPConfigurationPanel.lblHost.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - pnlCurrentGrid.add(lblHost, gridBagConstraints); - - lblPortLabel.setText(org.openide.util.NbBundle.getMessage(ChangePasswordDialog.class, "IDROPConfigurationPanel.lblPortLabel.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; - pnlCurrentGrid.add(lblPortLabel, gridBagConstraints); - - lblPort.setText(org.openide.util.NbBundle.getMessage(ChangePasswordDialog.class, "IDROPConfigurationPanel.lblPort.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 1; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - pnlCurrentGrid.add(lblPort, gridBagConstraints); - - lblZoneLabel.setText(org.openide.util.NbBundle.getMessage(ChangePasswordDialog.class, "IDROPConfigurationPanel.lblZoneLabel.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; - pnlCurrentGrid.add(lblZoneLabel, gridBagConstraints); - - lblZone.setText(org.openide.util.NbBundle.getMessage(ChangePasswordDialog.class, "IDROPConfigurationPanel.lblZone.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - pnlCurrentGrid.add(lblZone, gridBagConstraints); - - lblResourceLabel.setText(org.openide.util.NbBundle.getMessage(ChangePasswordDialog.class, "IDROPConfigurationPanel.lblResourceLabel.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 3; - gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; - pnlCurrentGrid.add(lblResourceLabel, gridBagConstraints); - - lblResource.setText(org.openide.util.NbBundle.getMessage(ChangePasswordDialog.class, "IDROPConfigurationPanel.lblResource.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 3; - gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - pnlCurrentGrid.add(lblResource, gridBagConstraints); - - lblUserNameLabel.setText(org.openide.util.NbBundle.getMessage(ChangePasswordDialog.class, "IDROPConfigurationPanel.lblUserNameLabel.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 4; - gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; - pnlCurrentGrid.add(lblUserNameLabel, gridBagConstraints); - - lblUserName.setText(org.openide.util.NbBundle.getMessage(ChangePasswordDialog.class, "IDROPConfigurationPanel.lblUserName.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 4; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - pnlCurrentGrid.add(lblUserName, gridBagConstraints); - - pnlPasswords.setLayout(new java.awt.GridBagLayout()); - - lblNewPassword.setText("New password:"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - pnlPasswords.add(lblNewPassword, gridBagConstraints); - - passwdNewPassword.setColumns(15); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 1; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - pnlPasswords.add(passwdNewPassword, gridBagConstraints); - - lblConfirmPassword.setText("Confirm password:"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - pnlPasswords.add(lblConfirmPassword, gridBagConstraints); - - passwdConfirmPassword.setColumns(15); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - pnlPasswords.add(passwdConfirmPassword, gridBagConstraints); - - btnUpdatePassword.setMnemonic('P'); - btnUpdatePassword.setText("Update Password"); - btnUpdatePassword.setToolTipText("Change the current password to the new values"); - btnUpdatePassword.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnUpdatePasswordActionPerformed(evt); - } - }); - pnlPasswordButtons.add(btnUpdatePassword); - - btnCancel.setMnemonic('c'); - btnCancel.setText("Cancel"); - btnCancel.setToolTipText("Cancel the password change"); - btnCancel.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnCancelActionPerformed(evt); - } - }); - pnlPasswordButtons.add(btnCancel); - - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 3; - gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; - pnlPasswords.add(pnlPasswordButtons, gridBagConstraints); - - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 5; - gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; - gridBagConstraints.insets = new java.awt.Insets(20, 0, 0, 0); - pnlCurrentGrid.add(pnlPasswords, gridBagConstraints); - - getContentPane().add(pnlCurrentGrid, java.awt.BorderLayout.CENTER); - - pack(); - }// </editor-fold>//GEN-END:initComponents - - private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelActionPerformed - this.dispose(); - }//GEN-LAST:event_btnCancelActionPerformed - - private void btnUpdatePasswordActionPerformed( - final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnUpdatePasswordActionPerformed - - log.info("changing password, doing edits first"); - initializePasswordColors(); - - if (passwdNewPassword.getPassword().length == 0) { - passwdNewPassword.setBackground(Color.red); - } - - if (passwdConfirmPassword.getPassword().length == 0) { - passwdConfirmPassword.setBackground(Color.red); - } - - if (passwdNewPassword.getPassword().length == 0 - || passwdConfirmPassword.getPassword().length == 0) { - JOptionPane.showMessageDialog(idrop, - "New or confirm password is missing"); - return; - } - - String newPassword = new String(passwdNewPassword.getPassword()); - String confirmPassword = new String(passwdConfirmPassword.getPassword()); - - if (newPassword.equals(confirmPassword)) { - // passwords match - } else { - passwdNewPassword.setBackground(Color.red); - passwdConfirmPassword.setBackground(Color.red); - JOptionPane.showMessageDialog(this, - "New and confirm password do not match"); - return; - } - - log.info("edits pass, updating password"); - try { - log.info("check queue for any jobs for the account, these have the old password."); - IRODSAccount irodsAccount = idrop.getIrodsAccount(); - - idrop.getiDropCore().getTransferManager().updatePassword(irodsAccount, newPassword); - UserAO userAO = idrop.getiDropCore().getIrodsFileSystem().getIRODSAccessObjectFactory().getUserAO(idrop.getIrodsAccount()); - userAO.changeAUserPasswordByThatUser(irodsAccount.getUserName(), - irodsAccount.getPassword(), newPassword); - log.info("password changed, resetting iRODS Account"); - IRODSAccount newAccount = new IRODSAccount(irodsAccount.getHost(), - irodsAccount.getPort(), irodsAccount.getUserName(), - newPassword, irodsAccount.getHomeDirectory(), - irodsAccount.getZone(), - irodsAccount.getDefaultStorageResource()); - idrop.setIrodsAccount(newAccount); - idrop.reinitializeForChangedIRODSAccount(); - JOptionPane.showMessageDialog(this, "Password was changed"); - - } catch (CannotUpdateTransferInProgressException ex) { - JOptionPane.showMessageDialog( - this, - "Transfers for this account are pending, this account can not be changed until completed and purged"); - return; - } catch (JargonException ex) { - Logger.getLogger(ChangePasswordDialog.class.getName()).log( - Level.SEVERE, null, ex); - } finally { - idrop.getiDropCore().closeIRODSConnection( - idrop.getiDropCore().getIrodsAccount()); - this.dispose(); - } - }// GEN-LAST:event_btnUpdatePasswordActionPerformed - - private void setUpPasswordPanel() { - IRODSAccount account = idrop.getIrodsAccount(); - lblHost.setText(account.getHost()); - lblPort.setText(String.valueOf(account.getPort())); - lblZone.setText(account.getZone()); - lblResource.setText(account.getZone()); - lblUserName.setText(account.getUserName()); - initializePasswordColors(); - } - - private void initializePasswordColors() { - passwdNewPassword.setBackground(Color.white); - passwdConfirmPassword.setBackground(Color.white); - } - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JButton btnCancel; - private javax.swing.JButton btnUpdatePassword; - private javax.swing.JLabel lblConfirmPassword; - private javax.swing.JLabel lblHost; - private javax.swing.JLabel lblHostLabel; - private javax.swing.JLabel lblNewPassword; - private javax.swing.JLabel lblPort; - private javax.swing.JLabel lblPortLabel; - private javax.swing.JLabel lblResource; - private javax.swing.JLabel lblResourceLabel; - private javax.swing.JLabel lblUserName; - private javax.swing.JLabel lblUserNameLabel; - private javax.swing.JLabel lblZone; - private javax.swing.JLabel lblZoneLabel; - private javax.swing.JPasswordField passwdConfirmPassword; - private javax.swing.JPasswordField passwdNewPassword; - private javax.swing.JPanel pnlCurrentGrid; - private javax.swing.JPanel pnlPasswordButtons; - private javax.swing.JPanel pnlPasswords; - // End of variables declaration//GEN-END:variables + /** + * + */ + private static final long serialVersionUID = -7844926246702788428L; + private final iDrop idrop; + public static org.slf4j.Logger log = LoggerFactory + .getLogger(ChangePasswordDialog.class); + + /** Creates new form PreferencesDialog */ + public ChangePasswordDialog(final iDrop idrop, final JDialog parent, + final boolean modal) { + super(parent, modal); + this.idrop = idrop; + initComponents(); + setUpPasswordPanel(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // <editor-fold defaultstate="collapsed" + // <editor-fold defaultstate="collapsed" + // desc="Generated Code">//GEN-BEGIN:initComponents + private void initComponents() { + java.awt.GridBagConstraints gridBagConstraints; + + pnlCurrentGrid = new javax.swing.JPanel(); + lblHostLabel = new javax.swing.JLabel(); + lblHost = new javax.swing.JLabel(); + lblPortLabel = new javax.swing.JLabel(); + lblPort = new javax.swing.JLabel(); + lblZoneLabel = new javax.swing.JLabel(); + lblZone = new javax.swing.JLabel(); + lblResourceLabel = new javax.swing.JLabel(); + lblResource = new javax.swing.JLabel(); + lblUserNameLabel = new javax.swing.JLabel(); + lblUserName = new javax.swing.JLabel(); + pnlPasswords = new javax.swing.JPanel(); + lblNewPassword = new javax.swing.JLabel(); + passwdNewPassword = new javax.swing.JPasswordField(); + lblConfirmPassword = new javax.swing.JLabel(); + passwdConfirmPassword = new javax.swing.JPasswordField(); + pnlPasswordButtons = new javax.swing.JPanel(); + btnUpdatePassword = new javax.swing.JButton(); + btnCancel = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setTitle("iDrop - Change Password"); + setAlwaysOnTop(true); + setMinimumSize(new java.awt.Dimension(551, 400)); + + pnlCurrentGrid.setLayout(new java.awt.GridBagLayout()); + + lblHostLabel.setText(org.openide.util.NbBundle.getMessage( + ChangePasswordDialog.class, + "IDROPConfigurationPanel.lblHostLabel.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; + pnlCurrentGrid.add(lblHostLabel, gridBagConstraints); + + lblHost.setText(org.openide.util.NbBundle.getMessage( + ChangePasswordDialog.class, + "IDROPConfigurationPanel.lblHost.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + pnlCurrentGrid.add(lblHost, gridBagConstraints); + + lblPortLabel.setText(org.openide.util.NbBundle.getMessage( + ChangePasswordDialog.class, + "IDROPConfigurationPanel.lblPortLabel.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 1; + gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; + pnlCurrentGrid.add(lblPortLabel, gridBagConstraints); + + lblPort.setText(org.openide.util.NbBundle.getMessage( + ChangePasswordDialog.class, + "IDROPConfigurationPanel.lblPort.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 1; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + pnlCurrentGrid.add(lblPort, gridBagConstraints); + + lblZoneLabel.setText(org.openide.util.NbBundle.getMessage( + ChangePasswordDialog.class, + "IDROPConfigurationPanel.lblZoneLabel.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 2; + gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; + pnlCurrentGrid.add(lblZoneLabel, gridBagConstraints); + + lblZone.setText(org.openide.util.NbBundle.getMessage( + ChangePasswordDialog.class, + "IDROPConfigurationPanel.lblZone.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 2; + gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + pnlCurrentGrid.add(lblZone, gridBagConstraints); + + lblResourceLabel.setText(org.openide.util.NbBundle.getMessage( + ChangePasswordDialog.class, + "IDROPConfigurationPanel.lblResourceLabel.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 3; + gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; + pnlCurrentGrid.add(lblResourceLabel, gridBagConstraints); + + lblResource.setText(org.openide.util.NbBundle.getMessage( + ChangePasswordDialog.class, + "IDROPConfigurationPanel.lblResource.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 3; + gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + pnlCurrentGrid.add(lblResource, gridBagConstraints); + + lblUserNameLabel.setText(org.openide.util.NbBundle.getMessage( + ChangePasswordDialog.class, + "IDROPConfigurationPanel.lblUserNameLabel.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 4; + gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; + pnlCurrentGrid.add(lblUserNameLabel, gridBagConstraints); + + lblUserName.setText(org.openide.util.NbBundle.getMessage( + ChangePasswordDialog.class, + "IDROPConfigurationPanel.lblUserName.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 4; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + pnlCurrentGrid.add(lblUserName, gridBagConstraints); + + pnlPasswords.setLayout(new java.awt.GridBagLayout()); + + lblNewPassword.setText("New password:"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 1; + gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + pnlPasswords.add(lblNewPassword, gridBagConstraints); + + passwdNewPassword.setColumns(15); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 1; + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + pnlPasswords.add(passwdNewPassword, gridBagConstraints); + + lblConfirmPassword.setText("Confirm password:"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 2; + gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + pnlPasswords.add(lblConfirmPassword, gridBagConstraints); + + passwdConfirmPassword.setColumns(15); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 2; + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + pnlPasswords.add(passwdConfirmPassword, gridBagConstraints); + + btnUpdatePassword.setMnemonic('P'); + btnUpdatePassword.setText("Update Password"); + btnUpdatePassword + .setToolTipText("Change the current password to the new values"); + btnUpdatePassword + .addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed( + final java.awt.event.ActionEvent evt) { + btnUpdatePasswordActionPerformed(evt); + } + }); + pnlPasswordButtons.add(btnUpdatePassword); + + btnCancel.setMnemonic('c'); + btnCancel.setText("Cancel"); + btnCancel.setToolTipText("Cancel the password change"); + btnCancel.addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed(final java.awt.event.ActionEvent evt) { + btnCancelActionPerformed(evt); + } + }); + pnlPasswordButtons.add(btnCancel); + + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 3; + gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; + pnlPasswords.add(pnlPasswordButtons, gridBagConstraints); + + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 5; + gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; + gridBagConstraints.insets = new java.awt.Insets(20, 0, 0, 0); + pnlCurrentGrid.add(pnlPasswords, gridBagConstraints); + + getContentPane().add(pnlCurrentGrid, java.awt.BorderLayout.CENTER); + + pack(); + }// </editor-fold>//GEN-END:initComponents + + private void btnCancelActionPerformed(final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnCancelActionPerformed + dispose(); + }// GEN-LAST:event_btnCancelActionPerformed + + private void btnUpdatePasswordActionPerformed( + final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnUpdatePasswordActionPerformed + + log.info("changing password, doing edits first"); + initializePasswordColors(); + + if (passwdNewPassword.getPassword().length == 0) { + passwdNewPassword.setBackground(Color.red); + } + + if (passwdConfirmPassword.getPassword().length == 0) { + passwdConfirmPassword.setBackground(Color.red); + } + + if (passwdNewPassword.getPassword().length == 0 + || passwdConfirmPassword.getPassword().length == 0) { + JOptionPane.showMessageDialog(idrop, + "New or confirm password is missing"); + return; + } + + String newPassword = new String(passwdNewPassword.getPassword()); + String confirmPassword = new String(passwdConfirmPassword.getPassword()); + + if (newPassword.equals(confirmPassword)) { + // passwords match + } else { + passwdNewPassword.setBackground(Color.red); + passwdConfirmPassword.setBackground(Color.red); + JOptionPane.showMessageDialog(this, + "New and confirm password do not match"); + return; + } + + log.info("edits pass, updating password"); + try { + log.info("check queue for any jobs for the account, these have the old password."); + IRODSAccount irodsAccount = idrop.getIrodsAccount(); + + idrop.getiDropCore().getTransferManager() + .updatePassword(irodsAccount, newPassword); + UserAO userAO = idrop.getiDropCore().getIrodsFileSystem() + .getIRODSAccessObjectFactory() + .getUserAO(idrop.getIrodsAccount()); + userAO.changeAUserPasswordByThatUser(irodsAccount.getUserName(), + irodsAccount.getPassword(), newPassword); + log.info("password changed, resetting iRODS Account"); + IRODSAccount newAccount = new IRODSAccount(irodsAccount.getHost(), + irodsAccount.getPort(), irodsAccount.getUserName(), + newPassword, irodsAccount.getHomeDirectory(), + irodsAccount.getZone(), + irodsAccount.getDefaultStorageResource()); + idrop.setIrodsAccount(newAccount); + idrop.reinitializeForChangedIRODSAccount(); + JOptionPane.showMessageDialog(this, "Password was changed"); + + } catch (CannotUpdateTransferInProgressException ex) { + JOptionPane + .showMessageDialog( + this, + "Transfers for this account are pending, this account can not be changed until completed and purged"); + return; + } catch (JargonException ex) { + Logger.getLogger(ChangePasswordDialog.class.getName()).log( + Level.SEVERE, null, ex); + } finally { + idrop.getiDropCore().closeIRODSConnection( + idrop.getiDropCore().getIrodsAccount()); + dispose(); + } + }// GEN-LAST:event_btnUpdatePasswordActionPerformed + + private void setUpPasswordPanel() { + IRODSAccount account = idrop.getIrodsAccount(); + lblHost.setText(account.getHost()); + lblPort.setText(String.valueOf(account.getPort())); + lblZone.setText(account.getZone()); + lblResource.setText(account.getZone()); + lblUserName.setText(account.getUserName()); + initializePasswordColors(); + } + + private void initializePasswordColors() { + passwdNewPassword.setBackground(Color.white); + passwdConfirmPassword.setBackground(Color.white); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton btnCancel; + private javax.swing.JButton btnUpdatePassword; + private javax.swing.JLabel lblConfirmPassword; + private javax.swing.JLabel lblHost; + private javax.swing.JLabel lblHostLabel; + private javax.swing.JLabel lblNewPassword; + private javax.swing.JLabel lblPort; + private javax.swing.JLabel lblPortLabel; + private javax.swing.JLabel lblResource; + private javax.swing.JLabel lblResourceLabel; + private javax.swing.JLabel lblUserName; + private javax.swing.JLabel lblUserNameLabel; + private javax.swing.JLabel lblZone; + private javax.swing.JLabel lblZoneLabel; + private javax.swing.JPasswordField passwdConfirmPassword; + private javax.swing.JPasswordField passwdNewPassword; + private javax.swing.JPanel pnlCurrentGrid; + private javax.swing.JPanel pnlPasswordButtons; + private javax.swing.JPanel pnlPasswords; + // End of variables declaration//GEN-END:variables } diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/CopyMoveDialog.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/CopyMoveDialog.java index aa26e6e..8ed8acc 100644 --- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/CopyMoveDialog.java +++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/CopyMoveDialog.java @@ -9,8 +9,10 @@ import java.util.ArrayList; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; + import javax.swing.ListSelectionModel; import javax.swing.tree.TreePath; + import org.irods.jargon.core.exception.JargonException; import org.irods.jargon.core.exception.JargonFileOrCollAlreadyExistsException; import org.irods.jargon.core.pub.DataTransferOperations; @@ -27,488 +29,572 @@ import org.openide.util.Exceptions; import org.slf4j.LoggerFactory; /** - * + * * @author lisa */ public class CopyMoveDialog extends javax.swing.JDialog { - - - private iDrop idropGUI; - private IRODSTree irodsTree; - private IRODSOutlineModel irodsFileSystemModel; - public static org.slf4j.Logger log = LoggerFactory.getLogger(IRODSTree.class); - - /** - * Creates new form CopyMoveDialog - */ - public CopyMoveDialog(java.awt.Frame parent, boolean modal) { - super(parent, modal); - initComponents(); - } - - public CopyMoveDialog(final iDrop parent, final boolean modal, - final IRODSTree irodsTree) { - super(parent, modal); - initComponents(); - - this.idropGUI = parent; - this.irodsTree = irodsTree; - this.irodsFileSystemModel = (IRODSOutlineModel) irodsTree.getModel(); - - initSourcesFiles(); - setCopyMoveButtonsState(); - } - - - private void initSourcesFiles() { - //check for selected objects and/or collections to download - // get iRODS File Service - IRODSFileService irodsFS = null; - try { - irodsFS = new IRODSFileService(idropGUI.getiDropCore().getIrodsAccount(), - idropGUI.getiDropCore().getIrodsFileSystem()); - } catch (Exception ex) { - //JOptionPane.showMessageDialog(this, "Cannot access iRODS file system for get."); - log.error("cannot create irods file service"); - return; - } - - IRODSOutlineModel irodsFileSystemModel = (IRODSOutlineModel) irodsTree.getModel(); - ListSelectionModel selectionModel = irodsTree.getSelectionModel(); - int idxStart = selectionModel.getMinSelectionIndex(); - int idxEnd = selectionModel.getMaxSelectionIndex(); - - // now collect all selected nodes - IRODSFile ifile = null; - //final List<File> sourceFiles = new ArrayList<File>(); - for (int idx = idxStart; idx <= idxEnd; idx++) { - if (selectionModel.isSelectedIndex(idx)) { - try { - IRODSNode selectedNode = (IRODSNode) irodsFileSystemModel.getValueAt(idx, 0); - ifile = irodsFS.getIRODSFileForPath(selectedNode.getFullPath()); - // rule out "/" - String path = ifile.getAbsolutePath(); - if ((path != null) && (!path.equals("/"))) { - txtCurrentParent.append(path + "\n"); - } - } catch (IdropException ex) { - Exceptions.printStackTrace(ex); - } - } - } - } - - private void setCopyMoveButtonsState() { - boolean state = ((txtNewLocation.getText().length() > 0) && - (txtCurrentParent.getText().length() > 0)); - btnCopy.setEnabled(state); - btnMove.setEnabled(state); - } - - private void processMoveOrCopy(final boolean isCopy) { - // add the new folder to irods, add to the tree, and scroll the tree - // into view - final CopyMoveDialog thisDialog = this; - final String targetAbsolutePath = txtNewLocation.getText(); - final String sourceFiles[] = txtCurrentParent.getText().split("\n"); - - log.info("processing move or copy"); - java.awt.EventQueue.invokeLater(new Runnable() { - - @Override - public void run() { - IRODSFile irodsFile = null; - try { - log.info("processing move of a file in iRODS tree"); - thisDialog.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - - DataTransferOperations dataTransferOperations; - try { - dataTransferOperations = idropGUI.getiDropCore().getIRODSAccessObjectFactory().getDataTransferOperations( - idropGUI.getIrodsAccount()); - } catch (Exception e) { - idropGUI.getiDropCore().closeIRODSConnection( - idropGUI.getIrodsAccount()); - thisDialog.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); - throw new IdropRuntimeException(e); - } - - List<IRODSFile> filesThatHadOverwriteError = new ArrayList<IRODSFile>(); - - if (sourceFiles.length == 1) { - //IRODSFile irodsFile = null; - log.info("processing the move/copy for one file:{}", - sourceFiles[0]); - try { - irodsFile = - idropGUI.getiDropCore().getIRODSFileFactoryForLoggedInAccount().instanceIRODSFile(sourceFiles[0]); - if (isCopy) { - processACopyOfAnIndividualFile( - dataTransferOperations, irodsFile, - targetAbsolutePath); - } else { - processAMoveOfAnIndividualFile( - dataTransferOperations, irodsFile, - targetAbsolutePath); - } - } catch (JargonFileOrCollAlreadyExistsException ex) { - Logger.getLogger( - MoveOrCopyiRODSDialog.class.getName()).log( - Level.SEVERE, null, ex); - filesThatHadOverwriteError.add(irodsFile); - } catch (JargonException je) { - if (je.getMessage().indexOf("-834000") > -1 - || je.getMessage().indexOf("-833000") > -1) { - filesThatHadOverwriteError.add(irodsFile); - } else { - throw new IdropException(je); - } - } - } else if (sourceFiles.length > 1) { - log.info("processing move/copy of multiple files"); - for (String sourceFileEntry : sourceFiles) { - - try { - irodsFile = - idropGUI.getiDropCore().getIRODSFileFactoryForLoggedInAccount().instanceIRODSFile(sourceFileEntry); - if (isCopy) { - processACopyOfAnIndividualFile( - dataTransferOperations, - irodsFile, targetAbsolutePath); - } else { - processAMoveOfAnIndividualFile( - dataTransferOperations, - irodsFile, targetAbsolutePath); - } - } catch (JargonFileOrCollAlreadyExistsException ex) { - // FIXME: fix in jargon core to differentiate! - Logger.getLogger( - MoveOrCopyiRODSDialog.class.getName()).log(Level.SEVERE, null, ex); - filesThatHadOverwriteError.add(irodsFile); - } catch (JargonException je) { - if (je.getMessage().indexOf("-834000") > -1 - || je.getMessage().indexOf("-833000") > -1) { - filesThatHadOverwriteError.add(irodsFile); - } else { - throw new IdropException(je); - } - } - } - } - - log.debug("move done"); - if (!isCopy) { - if (filesThatHadOverwriteError.isEmpty()) { - idropGUI.showMessageFromOperation("irods move processed"); - } else { - idropGUI.showMessageFromOperation("irods move processed, some files were not moved as files of the same name already existed"); - } - } else { - idropGUI.showMessageFromOperation("The file copy operation has been placed on the work queue"); - } - thisDialog.dispose(); - - } catch (IdropException ex) { - Logger.getLogger(IRODSTree.class.getName()).log( - Level.SEVERE, null, ex); - idropGUI.showIdropException(ex); - return; - } finally { - thisDialog.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); - idropGUI.getiDropCore().closeIRODSConnection( - idropGUI.getIrodsAccount()); - } - } - }); - } - - private void processAMoveOfAnIndividualFile( - final DataTransferOperations dataTransferOperations, - final IRODSFile sourceFile, final String targetAbsolutePath) - throws JargonFileOrCollAlreadyExistsException, IdropException { - - try { - - boolean isFile = sourceFile.isFile(); - IRODSFile targetFile = idropGUI.getiDropCore().getIRODSFileFactoryForLoggedInAccount().instanceIRODSFile(targetAbsolutePath); - - dataTransferOperations.move(sourceFile.getAbsolutePath(), - targetAbsolutePath); - - String targetPathForNotify = null; - if (isFile) { - log.debug("source file is a file, do a move"); - - if (targetFile.isDirectory()) { - targetPathForNotify = targetFile.getAbsolutePath() + "/" - + sourceFile.getName(); - } else { - targetPathForNotify = targetFile.getAbsolutePath(); - } - - irodsFileSystemModel.notifyFileShouldBeAdded(irodsTree, - targetPathForNotify); - - } else { - log.debug("source file is a collection, reparent it"); - targetPathForNotify = targetFile.getAbsolutePath() + "/" - + sourceFile.getName(); - - irodsFileSystemModel.notifyFileShouldBeAdded(irodsTree, - targetPathForNotify); - } - } catch (JargonFileOrCollAlreadyExistsException fcae) { - throw fcae; - } catch (JargonException je) { - throw new IdropException(je); - } - - TreePath sourceNodePath = TreeUtils.buildTreePathForIrodsAbsolutePath( - irodsTree, sourceFile.getAbsolutePath()); - if (sourceNodePath == null) { - log.info("could not find tree path for source node, ignore"); - return; - } - IRODSNode sourceNode = (IRODSNode) sourceNodePath.getLastPathComponent(); - irodsFileSystemModel.notifyFileShouldBeRemoved(sourceNode); - } - - private void processACopyOfAnIndividualFile( - final DataTransferOperations dataTransferOperations, - final IRODSFile sourceFile, final String targetAbsolutePath) - throws IdropException { - try { - dataTransferOperations.copy(sourceFile.getAbsolutePath(), - idropGUI.getiDropCore().getIrodsAccount().getDefaultStorageResource(), - targetAbsolutePath, - null, - null); - //idropGUI.getiDropCore().getTransferManager().enqueueACopy(sourceFile.getAbsolutePath(), - //sourceFile.getResource(), targetAbsolutePath, - //idropGUI.getiDropCore().getIrodsAccount()); - - } catch (JargonException ex) { - Logger.getLogger(MoveOrCopyiRODSDialog.class.getName()).log( - Level.SEVERE, null, ex); - throw new IdropException( - "unable to copy file due to JargonException", ex); - } - - // notifications are done at completion of transfer using status - // callbacks - } - - /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. - */ - @SuppressWarnings("unchecked") - // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents - private void initComponents() { - - pnlFolderData = new javax.swing.JPanel(); - pnlCurrentParent = new javax.swing.JPanel(); - jPanel1 = new javax.swing.JPanel(); - lblCurrentParent = new java.awt.Label(); - scrollCurrentParent = new javax.swing.JScrollPane(); - txtCurrentParent = new javax.swing.JTextArea(); - jPanel2 = new javax.swing.JPanel(); - lblNewDiretoryName = new java.awt.Label(); - txtNewLocation = new javax.swing.JTextField(); - btnBrowse = new javax.swing.JButton(); - pnlBottom = new javax.swing.JPanel(); - btnCancel = new javax.swing.JButton(); - btnMove = new javax.swing.JButton(); - btnCopy = new javax.swing.JButton(); - - setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - setTitle(org.openide.util.NbBundle.getMessage(CopyMoveDialog.class, "CopyMoveDialog.title")); // NOI18N - setPreferredSize(new java.awt.Dimension(590, 260)); - - pnlFolderData.setPreferredSize(new java.awt.Dimension(540, 240)); - pnlFolderData.setLayout(new java.awt.BorderLayout()); - - pnlCurrentParent.setBorder(javax.swing.BorderFactory.createEmptyBorder(10, 4, 10, 4)); - pnlCurrentParent.setPreferredSize(new java.awt.Dimension(500, 190)); - pnlCurrentParent.setLayout(new java.awt.BorderLayout()); - - jPanel1.setPreferredSize(new java.awt.Dimension(500, 125)); - - lblCurrentParent.setText(org.openide.util.NbBundle.getMessage(CopyMoveDialog.class, "CopyMoveDialog.lblCurrentParent.text")); // NOI18N - - scrollCurrentParent.setPreferredSize(new java.awt.Dimension(360, 100)); - - txtCurrentParent.setEditable(false); - txtCurrentParent.setColumns(20); - txtCurrentParent.setRows(5); - txtCurrentParent.setWrapStyleWord(true); - txtCurrentParent.setFocusable(false); - txtCurrentParent.setPreferredSize(new java.awt.Dimension(290, 90)); - scrollCurrentParent.setViewportView(txtCurrentParent); - - org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1); - jPanel1.setLayout(jPanel1Layout); - jPanel1Layout.setHorizontalGroup( - jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(jPanel1Layout.createSequentialGroup() - .addContainerGap() - .add(lblCurrentParent, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(scrollCurrentParent, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 426, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .addContainerGap(31, Short.MAX_VALUE)) - ); - jPanel1Layout.setVerticalGroup( - jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(jPanel1Layout.createSequentialGroup() - .add(45, 45, 45) - .add(lblCurrentParent, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) - .add(jPanel1Layout.createSequentialGroup() - .add(5, 5, 5) - .add(scrollCurrentParent, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) - ); - - pnlCurrentParent.add(jPanel1, java.awt.BorderLayout.NORTH); - - jPanel2.setPreferredSize(new java.awt.Dimension(500, 60)); - jPanel2.setRequestFocusEnabled(false); - - lblNewDiretoryName.setText(org.openide.util.NbBundle.getMessage(CopyMoveDialog.class, "CopyMoveDialog.lblNewDiretoryName.text")); // NOI18N - - txtNewLocation.setText(org.openide.util.NbBundle.getMessage(CopyMoveDialog.class, "CopyMoveDialog.txtNewLocation.text")); // NOI18N - txtNewLocation.setPreferredSize(new java.awt.Dimension(360, 28)); - - btnBrowse.setLabel(org.openide.util.NbBundle.getMessage(CopyMoveDialog.class, "CopyMoveDialog.btnBrowse.label")); // NOI18N - btnBrowse.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnBrowseActionPerformed(evt); - } - }); - - org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2); - jPanel2.setLayout(jPanel2Layout); - jPanel2Layout.setHorizontalGroup( - jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(jPanel2Layout.createSequentialGroup() - .addContainerGap() - .add(lblNewDiretoryName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 111, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .add(txtNewLocation, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 320, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(btnBrowse, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 100, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add(30, 30, 30)) - ); - jPanel2Layout.setVerticalGroup( - jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(jPanel2Layout.createSequentialGroup() - .add(9, 9, 9) - .add(lblNewDiretoryName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) - .add(jPanel2Layout.createSequentialGroup() - .add(5, 5, 5) - .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(txtNewLocation, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add(btnBrowse))) - ); - - pnlCurrentParent.add(jPanel2, java.awt.BorderLayout.SOUTH); - - pnlFolderData.add(pnlCurrentParent, java.awt.BorderLayout.CENTER); - - pnlBottom.setPreferredSize(new java.awt.Dimension(708, 40)); - - btnCancel.setText(org.openide.util.NbBundle.getMessage(CopyMoveDialog.class, "CopyMoveDialog.btnCancel.text")); // NOI18N - btnCancel.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnCancelActionPerformed(evt); - } - }); - - btnMove.setText(org.openide.util.NbBundle.getMessage(CopyMoveDialog.class, "CopyMoveDialog.btnMove.text")); // NOI18N - btnMove.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnMoveActionPerformed(evt); - } - }); - - btnCopy.setText(org.openide.util.NbBundle.getMessage(CopyMoveDialog.class, "CopyMoveDialog.btnCopy.text")); // NOI18N - btnCopy.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnCopyActionPerformed(evt); - } - }); - - org.jdesktop.layout.GroupLayout pnlBottomLayout = new org.jdesktop.layout.GroupLayout(pnlBottom); - pnlBottom.setLayout(pnlBottomLayout); - pnlBottomLayout.setHorizontalGroup( - pnlBottomLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(pnlBottomLayout.createSequentialGroup() - .add(338, 338, 451) - .add(btnCancel) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(btnMove) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(btnCopy) - .addContainerGap()) - ); - pnlBottomLayout.setVerticalGroup( - pnlBottomLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(pnlBottomLayout.createSequentialGroup() - .add(5, 5, 5) - .add(pnlBottomLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(btnCancel) - .add(btnMove) - .add(btnCopy))) - ); - - pnlFolderData.add(pnlBottom, java.awt.BorderLayout.SOUTH); - - getContentPane().add(pnlFolderData, java.awt.BorderLayout.CENTER); - - pack(); - }// </editor-fold>//GEN-END:initComponents - - private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelActionPerformed - this.dispose(); - }//GEN-LAST:event_btnCancelActionPerformed - - private void btnMoveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMoveActionPerformed - processMoveOrCopy(false); - }//GEN-LAST:event_btnMoveActionPerformed - - private void btnBrowseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBrowseActionPerformed - IRODSFinderDialog irodsFinder = new IRODSFinderDialog( - idropGUI, false, idropGUI.getiDropCore()); - irodsFinder.setTitle("Select iRODS Collection Upload Target"); - irodsFinder.setSelectionType(IRODSFinderDialog.SelectionType.COLLS_ONLY_SELECTION_MODE); - irodsFinder.setLocation( - (int)this.getLocation().getX(), (int)this.getLocation().getY()); - irodsFinder.setVisible(true); - - String selectedPath = irodsFinder.getSelectedAbsolutePath(); - if (selectedPath != null) { - txtNewLocation.setText(selectedPath); - } - setCopyMoveButtonsState(); - }//GEN-LAST:event_btnBrowseActionPerformed - - private void btnCopyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCopyActionPerformed - processMoveOrCopy(true); - }//GEN-LAST:event_btnCopyActionPerformed - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JButton btnBrowse; - private javax.swing.JButton btnCancel; - private javax.swing.JButton btnCopy; - private javax.swing.JButton btnMove; - private javax.swing.JPanel jPanel1; - private javax.swing.JPanel jPanel2; - private java.awt.Label lblCurrentParent; - private java.awt.Label lblNewDiretoryName; - private javax.swing.JPanel pnlBottom; - private javax.swing.JPanel pnlCurrentParent; - private javax.swing.JPanel pnlFolderData; - private javax.swing.JScrollPane scrollCurrentParent; - private javax.swing.JTextArea txtCurrentParent; - private javax.swing.JTextField txtNewLocation; - // End of variables declaration//GEN-END:variables + + /** + * + */ + private static final long serialVersionUID = 1773323142549578964L; + private iDrop idropGUI; + private IRODSTree irodsTree; + private IRODSOutlineModel irodsFileSystemModel; + public static org.slf4j.Logger log = LoggerFactory + .getLogger(IRODSTree.class); + + /** + * Creates new form CopyMoveDialog + */ + public CopyMoveDialog(final java.awt.Frame parent, final boolean modal) { + super(parent, modal); + initComponents(); + } + + public CopyMoveDialog(final iDrop parent, final boolean modal, + final IRODSTree irodsTree) { + super(parent, modal); + initComponents(); + + idropGUI = parent; + this.irodsTree = irodsTree; + irodsFileSystemModel = (IRODSOutlineModel) irodsTree.getModel(); + + initSourcesFiles(); + setCopyMoveButtonsState(); + } + + private void initSourcesFiles() { + // check for selected objects and/or collections to download + // get iRODS File Service + IRODSFileService irodsFS = null; + try { + irodsFS = new IRODSFileService(idropGUI.getiDropCore() + .getIrodsAccount(), idropGUI.getiDropCore() + .getIrodsFileSystem()); + } catch (Exception ex) { + // JOptionPane.showMessageDialog(this, + // "Cannot access iRODS file system for get."); + log.error("cannot create irods file service"); + return; + } + + IRODSOutlineModel irodsFileSystemModel = (IRODSOutlineModel) irodsTree + .getModel(); + ListSelectionModel selectionModel = irodsTree.getSelectionModel(); + int idxStart = selectionModel.getMinSelectionIndex(); + int idxEnd = selectionModel.getMaxSelectionIndex(); + + // now collect all selected nodes + IRODSFile ifile = null; + // final List<File> sourceFiles = new ArrayList<File>(); + for (int idx = idxStart; idx <= idxEnd; idx++) { + if (selectionModel.isSelectedIndex(idx)) { + try { + IRODSNode selectedNode = (IRODSNode) irodsFileSystemModel + .getValueAt(idx, 0); + ifile = irodsFS.getIRODSFileForPath(selectedNode + .getFullPath()); + // rule out "/" + String path = ifile.getAbsolutePath(); + if ((path != null) && (!path.equals("/"))) { + txtCurrentParent.append(path + "\n"); + } + } catch (IdropException ex) { + Exceptions.printStackTrace(ex); + } + } + } + } + + private void setCopyMoveButtonsState() { + boolean state = ((txtNewLocation.getText().length() > 0) && (txtCurrentParent + .getText().length() > 0)); + btnCopy.setEnabled(state); + btnMove.setEnabled(state); + } + + private void processMoveOrCopy(final boolean isCopy) { + // add the new folder to irods, add to the tree, and scroll the tree + // into view + final CopyMoveDialog thisDialog = this; + final String targetAbsolutePath = txtNewLocation.getText(); + final String sourceFiles[] = txtCurrentParent.getText().split("\n"); + + log.info("processing move or copy"); + java.awt.EventQueue.invokeLater(new Runnable() { + + @Override + public void run() { + IRODSFile irodsFile = null; + try { + log.info("processing move of a file in iRODS tree"); + thisDialog.setCursor(Cursor + .getPredefinedCursor(Cursor.WAIT_CURSOR)); + + DataTransferOperations dataTransferOperations; + try { + dataTransferOperations = idropGUI + .getiDropCore() + .getIRODSAccessObjectFactory() + .getDataTransferOperations( + idropGUI.getIrodsAccount()); + } catch (Exception e) { + idropGUI.getiDropCore().closeIRODSConnection( + idropGUI.getIrodsAccount()); + thisDialog.setCursor(Cursor + .getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + throw new IdropRuntimeException(e); + } + + List<IRODSFile> filesThatHadOverwriteError = new ArrayList<IRODSFile>(); + + if (sourceFiles.length == 1) { + // IRODSFile irodsFile = null; + log.info("processing the move/copy for one file:{}", + sourceFiles[0]); + try { + irodsFile = idropGUI.getiDropCore() + .getIRODSFileFactoryForLoggedInAccount() + .instanceIRODSFile(sourceFiles[0]); + if (isCopy) { + processACopyOfAnIndividualFile( + dataTransferOperations, irodsFile, + targetAbsolutePath); + } else { + processAMoveOfAnIndividualFile( + dataTransferOperations, irodsFile, + targetAbsolutePath); + } + } catch (JargonFileOrCollAlreadyExistsException ex) { + Logger.getLogger( + MoveOrCopyiRODSDialog.class.getName()).log( + Level.SEVERE, null, ex); + filesThatHadOverwriteError.add(irodsFile); + } catch (JargonException je) { + if (je.getMessage().indexOf("-834000") > -1 + || je.getMessage().indexOf("-833000") > -1) { + filesThatHadOverwriteError.add(irodsFile); + } else { + throw new IdropException(je); + } + } + } else if (sourceFiles.length > 1) { + log.info("processing move/copy of multiple files"); + for (String sourceFileEntry : sourceFiles) { + + try { + irodsFile = idropGUI + .getiDropCore() + .getIRODSFileFactoryForLoggedInAccount() + .instanceIRODSFile(sourceFileEntry); + if (isCopy) { + processACopyOfAnIndividualFile( + dataTransferOperations, irodsFile, + targetAbsolutePath); + } else { + processAMoveOfAnIndividualFile( + dataTransferOperations, irodsFile, + targetAbsolutePath); + } + } catch (JargonFileOrCollAlreadyExistsException ex) { + // FIXME: fix in jargon core to differentiate! + Logger.getLogger( + MoveOrCopyiRODSDialog.class.getName()) + .log(Level.SEVERE, null, ex); + filesThatHadOverwriteError.add(irodsFile); + } catch (JargonException je) { + if (je.getMessage().indexOf("-834000") > -1 + || je.getMessage().indexOf("-833000") > -1) { + filesThatHadOverwriteError.add(irodsFile); + } else { + throw new IdropException(je); + } + } + } + } + + log.debug("move done"); + if (!isCopy) { + if (filesThatHadOverwriteError.isEmpty()) { + idropGUI.showMessageFromOperation("irods move processed"); + } else { + idropGUI.showMessageFromOperation("irods move processed, some files were not moved as files of the same name already existed"); + } + } else { + idropGUI.showMessageFromOperation("The file copy operation has been placed on the work queue"); + } + thisDialog.dispose(); + + } catch (IdropException ex) { + Logger.getLogger(IRODSTree.class.getName()).log( + Level.SEVERE, null, ex); + idropGUI.showIdropException(ex); + return; + } finally { + thisDialog.setCursor(Cursor + .getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + idropGUI.getiDropCore().closeIRODSConnection( + idropGUI.getIrodsAccount()); + } + } + }); + } + + private void processAMoveOfAnIndividualFile( + final DataTransferOperations dataTransferOperations, + final IRODSFile sourceFile, final String targetAbsolutePath) + throws JargonFileOrCollAlreadyExistsException, IdropException { + + try { + + boolean isFile = sourceFile.isFile(); + IRODSFile targetFile = idropGUI.getiDropCore() + .getIRODSFileFactoryForLoggedInAccount() + .instanceIRODSFile(targetAbsolutePath); + + dataTransferOperations.move(sourceFile.getAbsolutePath(), + targetAbsolutePath); + + String targetPathForNotify = null; + if (isFile) { + log.debug("source file is a file, do a move"); + + if (targetFile.isDirectory()) { + targetPathForNotify = targetFile.getAbsolutePath() + "/" + + sourceFile.getName(); + } else { + targetPathForNotify = targetFile.getAbsolutePath(); + } + + irodsFileSystemModel.notifyFileShouldBeAdded(irodsTree, + targetPathForNotify); + + } else { + log.debug("source file is a collection, reparent it"); + targetPathForNotify = targetFile.getAbsolutePath() + "/" + + sourceFile.getName(); + + irodsFileSystemModel.notifyFileShouldBeAdded(irodsTree, + targetPathForNotify); + } + } catch (JargonFileOrCollAlreadyExistsException fcae) { + throw fcae; + } catch (JargonException je) { + throw new IdropException(je); + } + + TreePath sourceNodePath = TreeUtils.buildTreePathForIrodsAbsolutePath( + irodsTree, sourceFile.getAbsolutePath()); + if (sourceNodePath == null) { + log.info("could not find tree path for source node, ignore"); + return; + } + IRODSNode sourceNode = (IRODSNode) sourceNodePath + .getLastPathComponent(); + irodsFileSystemModel.notifyFileShouldBeRemoved(sourceNode); + } + + private void processACopyOfAnIndividualFile( + final DataTransferOperations dataTransferOperations, + final IRODSFile sourceFile, final String targetAbsolutePath) + throws IdropException { + try { + dataTransferOperations.copy(sourceFile.getAbsolutePath(), idropGUI + .getiDropCore().getIrodsAccount() + .getDefaultStorageResource(), targetAbsolutePath, null, + null); + // idropGUI.getiDropCore().getTransferManager().enqueueACopy(sourceFile.getAbsolutePath(), + // sourceFile.getResource(), targetAbsolutePath, + // idropGUI.getiDropCore().getIrodsAccount()); + + } catch (JargonException ex) { + Logger.getLogger(MoveOrCopyiRODSDialog.class.getName()).log( + Level.SEVERE, null, ex); + throw new IdropException( + "unable to copy file due to JargonException", ex); + } + + // notifications are done at completion of transfer using status + // callbacks + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // <editor-fold defaultstate="collapsed" + // desc="Generated Code">//GEN-BEGIN:initComponents + private void initComponents() { + + pnlFolderData = new javax.swing.JPanel(); + pnlCurrentParent = new javax.swing.JPanel(); + jPanel1 = new javax.swing.JPanel(); + lblCurrentParent = new java.awt.Label(); + scrollCurrentParent = new javax.swing.JScrollPane(); + txtCurrentParent = new javax.swing.JTextArea(); + jPanel2 = new javax.swing.JPanel(); + lblNewDiretoryName = new java.awt.Label(); + txtNewLocation = new javax.swing.JTextField(); + btnBrowse = new javax.swing.JButton(); + pnlBottom = new javax.swing.JPanel(); + btnCancel = new javax.swing.JButton(); + btnMove = new javax.swing.JButton(); + btnCopy = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setTitle(org.openide.util.NbBundle.getMessage(CopyMoveDialog.class, + "CopyMoveDialog.title")); // NOI18N + setPreferredSize(new java.awt.Dimension(590, 260)); + + pnlFolderData.setPreferredSize(new java.awt.Dimension(540, 240)); + pnlFolderData.setLayout(new java.awt.BorderLayout()); + + pnlCurrentParent.setBorder(javax.swing.BorderFactory.createEmptyBorder( + 10, 4, 10, 4)); + pnlCurrentParent.setPreferredSize(new java.awt.Dimension(500, 190)); + pnlCurrentParent.setLayout(new java.awt.BorderLayout()); + + jPanel1.setPreferredSize(new java.awt.Dimension(500, 125)); + + lblCurrentParent.setText(org.openide.util.NbBundle.getMessage( + CopyMoveDialog.class, "CopyMoveDialog.lblCurrentParent.text")); // NOI18N + + scrollCurrentParent.setPreferredSize(new java.awt.Dimension(360, 100)); + + txtCurrentParent.setEditable(false); + txtCurrentParent.setColumns(20); + txtCurrentParent.setRows(5); + txtCurrentParent.setWrapStyleWord(true); + txtCurrentParent.setFocusable(false); + txtCurrentParent.setPreferredSize(new java.awt.Dimension(290, 90)); + scrollCurrentParent.setViewportView(txtCurrentParent); + + org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout( + jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING).add( + jPanel1Layout + .createSequentialGroup() + .addContainerGap() + .add(lblCurrentParent, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.RELATED) + .add(scrollCurrentParent, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, + 426, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .addContainerGap(31, Short.MAX_VALUE))); + jPanel1Layout + .setVerticalGroup(jPanel1Layout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add(jPanel1Layout + .createSequentialGroup() + .add(45, 45, 45) + .add(lblCurrentParent, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .add(jPanel1Layout + .createSequentialGroup() + .add(5, 5, 5) + .add(scrollCurrentParent, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))); + + pnlCurrentParent.add(jPanel1, java.awt.BorderLayout.NORTH); + + jPanel2.setPreferredSize(new java.awt.Dimension(500, 60)); + jPanel2.setRequestFocusEnabled(false); + + lblNewDiretoryName + .setText(org.openide.util.NbBundle.getMessage( + CopyMoveDialog.class, + "CopyMoveDialog.lblNewDiretoryName.text")); // NOI18N + + txtNewLocation.setText(org.openide.util.NbBundle.getMessage( + CopyMoveDialog.class, "CopyMoveDialog.txtNewLocation.text")); // NOI18N + txtNewLocation.setPreferredSize(new java.awt.Dimension(360, 28)); + + btnBrowse.setLabel(org.openide.util.NbBundle.getMessage( + CopyMoveDialog.class, "CopyMoveDialog.btnBrowse.label")); // NOI18N + btnBrowse.addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed(final java.awt.event.ActionEvent evt) { + btnBrowseActionPerformed(evt); + } + }); + + org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout( + jPanel2); + jPanel2.setLayout(jPanel2Layout); + jPanel2Layout.setHorizontalGroup(jPanel2Layout.createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING).add( + jPanel2Layout + .createSequentialGroup() + .addContainerGap() + .add(lblNewDiretoryName, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, + 111, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.RELATED, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .add(txtNewLocation, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, + 320, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.RELATED) + .add(btnBrowse, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, + 100, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(30, 30, 30))); + jPanel2Layout + .setVerticalGroup(jPanel2Layout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add(jPanel2Layout + .createSequentialGroup() + .add(9, 9, 9) + .add(lblNewDiretoryName, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .add(jPanel2Layout + .createSequentialGroup() + .add(5, 5, 5) + .add(jPanel2Layout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.BASELINE) + .add(txtNewLocation, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(btnBrowse)))); + + pnlCurrentParent.add(jPanel2, java.awt.BorderLayout.SOUTH); + + pnlFolderData.add(pnlCurrentParent, java.awt.BorderLayout.CENTER); + + pnlBottom.setPreferredSize(new java.awt.Dimension(708, 40)); + + btnCancel.setText(org.openide.util.NbBundle.getMessage( + CopyMoveDialog.class, "CopyMoveDialog.btnCancel.text")); // NOI18N + btnCancel.addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed(final java.awt.event.ActionEvent evt) { + btnCancelActionPerformed(evt); + } + }); + + btnMove.setText(org.openide.util.NbBundle.getMessage( + CopyMoveDialog.class, "CopyMoveDialog.btnMove.text")); // NOI18N + btnMove.addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed(final java.awt.event.ActionEvent evt) { + btnMoveActionPerformed(evt); + } + }); + + btnCopy.setText(org.openide.util.NbBundle.getMessage( + CopyMoveDialog.class, "CopyMoveDialog.btnCopy.text")); // NOI18N + btnCopy.addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed(final java.awt.event.ActionEvent evt) { + btnCopyActionPerformed(evt); + } + }); + + org.jdesktop.layout.GroupLayout pnlBottomLayout = new org.jdesktop.layout.GroupLayout( + pnlBottom); + pnlBottom.setLayout(pnlBottomLayout); + pnlBottomLayout.setHorizontalGroup(pnlBottomLayout.createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING).add( + pnlBottomLayout + .createSequentialGroup() + .add(338, 338, 451) + .add(btnCancel) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.RELATED) + .add(btnMove) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.RELATED) + .add(btnCopy).addContainerGap())); + pnlBottomLayout + .setVerticalGroup(pnlBottomLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add(pnlBottomLayout + .createSequentialGroup() + .add(5, 5, 5) + .add(pnlBottomLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.BASELINE) + .add(btnCancel).add(btnMove) + .add(btnCopy)))); + + pnlFolderData.add(pnlBottom, java.awt.BorderLayout.SOUTH); + + getContentPane().add(pnlFolderData, java.awt.BorderLayout.CENTER); + + pack(); + }// </editor-fold>//GEN-END:initComponents + + private void btnCancelActionPerformed(final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnCancelActionPerformed + dispose(); + }// GEN-LAST:event_btnCancelActionPerformed + + private void btnMoveActionPerformed(final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnMoveActionPerformed + processMoveOrCopy(false); + }// GEN-LAST:event_btnMoveActionPerformed + + private void btnBrowseActionPerformed(final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnBrowseActionPerformed + IRODSFinderDialog irodsFinder = new IRODSFinderDialog(idropGUI, false, + idropGUI.getiDropCore()); + irodsFinder.setTitle("Select iRODS Collection Upload Target"); + irodsFinder + .setSelectionType(IRODSFinderDialog.SelectionType.COLLS_ONLY_SELECTION_MODE); + irodsFinder.setLocation((int) this.getLocation().getX(), (int) this + .getLocation().getY()); + irodsFinder.setVisible(true); + + String selectedPath = irodsFinder.getSelectedAbsolutePath(); + if (selectedPath != null) { + txtNewLocation.setText(selectedPath); + } + setCopyMoveButtonsState(); + }// GEN-LAST:event_btnBrowseActionPerformed + + private void btnCopyActionPerformed(final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnCopyActionPerformed + processMoveOrCopy(true); + }// GEN-LAST:event_btnCopyActionPerformed + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton btnBrowse; + private javax.swing.JButton btnCancel; + private javax.swing.JButton btnCopy; + private javax.swing.JButton btnMove; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel2; + private java.awt.Label lblCurrentParent; + private java.awt.Label lblNewDiretoryName; + private javax.swing.JPanel pnlBottom; + private javax.swing.JPanel pnlCurrentParent; + private javax.swing.JPanel pnlFolderData; + private javax.swing.JScrollPane scrollCurrentParent; + private javax.swing.JTextArea txtCurrentParent; + private javax.swing.JTextField txtNewLocation; + // End of variables declaration//GEN-END:variables } diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/DeleteIRODSDialog.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/DeleteIRODSDialog.java index 51ab48f..5ffd32a 100644 --- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/DeleteIRODSDialog.java +++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/DeleteIRODSDialog.java @@ -34,99 +34,110 @@ import org.slf4j.LoggerFactory; */ public class DeleteIRODSDialog extends javax.swing.JDialog { - private final iDrop idrop; - private final IRODSTree irodsTree; - private final IRODSNode deletedNode; - private final List<IRODSNode> deletedNodes; - public static org.slf4j.Logger log = LoggerFactory.getLogger(DeleteIRODSDialog.class); - - /** Creates new form NewIRODSDirectoryDialog */ - public DeleteIRODSDialog(final iDrop parent, final boolean modal, - final IRODSTree irodsTree, final IRODSNode deletedNode) { - super(parent, modal); - this.idrop = parent; - this.irodsTree = irodsTree; - this.deletedNode = deletedNode; - this.deletedNodes = null; - StringBuilder sb = new StringBuilder(); - CollectionAndDataObjectListingEntry entry = (CollectionAndDataObjectListingEntry) deletedNode.getUserObject(); - if (entry.getObjectType() == CollectionAndDataObjectListingEntry.ObjectType.COLLECTION) { - sb.append(entry.getPathOrName()); - } else { - sb.append(entry.getParentPath()); - sb.append('/'); - sb.append(entry.getPathOrName()); - } - - initialize(); - txtAreaFileToDelete.setText(sb.toString()); - } - - /** Creates new form NewIRODSDirectoryDialog */ - public DeleteIRODSDialog(final iDrop parent, final boolean modal, - final IRODSTree irodsTree, final List<IRODSNode> deletedNodes) { - super(parent, modal); - this.idrop = parent; - this.irodsTree = irodsTree; - this.deletedNodes = deletedNodes; - this.deletedNode = null; - initialize(); - int deletedNodesCount = deletedNodes.size(); - for(int idx=0; idx<deletedNodesCount; idx++) { - CollectionAndDataObjectListingEntry entry = - (CollectionAndDataObjectListingEntry) deletedNodes.get(idx).getUserObject(); - if (entry.getObjectType() == CollectionAndDataObjectListingEntry.ObjectType.COLLECTION) { - txtAreaFileToDelete.append(entry.getPathOrName()); - } else { - txtAreaFileToDelete.append(entry.getParentPath()); - txtAreaFileToDelete.append("/"); - txtAreaFileToDelete.append(entry.getPathOrName()); - } - if (idx < deletedNodesCount-1 ) { - txtAreaFileToDelete.append("\n"); - } - } - //txtAreaFileToDelete.setText("multiple selections"); - } - - private void initialize() { - initComponents(); - registerKeystrokeListener(); - } - - /** - * Register a listener for the enter event, so login can occur. - */ - private void registerKeystrokeListener() { - - KeyStroke enter = KeyStroke.getKeyStroke( - java.awt.event.KeyEvent.VK_ENTER, 0); - Action enterAction = new AbstractAction() { - - @Override - public void actionPerformed(final ActionEvent e) { - try { - processDelete(); - } catch (IdropException ex) { - Logger.getLogger(DeleteIRODSDialog.class.getName()).log( - Level.SEVERE, null, ex); - throw new IdropRuntimeException(ex); - } - } - }; - - btnOK.registerKeyboardAction(enterAction, enter, - JComponent.WHEN_IN_FOCUSED_WINDOW); - - } - - /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. - */ - @SuppressWarnings("unchecked") - // <editor-fold defaultstate="collapsed" + /** + * + */ + private static final long serialVersionUID = -6220824710589755273L; + private final iDrop idrop; + private final IRODSTree irodsTree; + private final IRODSNode deletedNode; + private final List<IRODSNode> deletedNodes; + public static org.slf4j.Logger log = LoggerFactory + .getLogger(DeleteIRODSDialog.class); + + /** Creates new form NewIRODSDirectoryDialog */ + public DeleteIRODSDialog(final iDrop parent, final boolean modal, + final IRODSTree irodsTree, final IRODSNode deletedNode) { + super(parent, modal); + idrop = parent; + this.irodsTree = irodsTree; + this.deletedNode = deletedNode; + deletedNodes = null; + StringBuilder sb = new StringBuilder(); + CollectionAndDataObjectListingEntry entry = (CollectionAndDataObjectListingEntry) deletedNode + .getUserObject(); + if (entry.getObjectType() == CollectionAndDataObjectListingEntry.ObjectType.COLLECTION) { + sb.append(entry.getPathOrName()); + } else { + sb.append(entry.getParentPath()); + sb.append('/'); + sb.append(entry.getPathOrName()); + } + + initialize(); + txtAreaFileToDelete.setText(sb.toString()); + } + + /** Creates new form NewIRODSDirectoryDialog */ + public DeleteIRODSDialog(final iDrop parent, final boolean modal, + final IRODSTree irodsTree, final List<IRODSNode> deletedNodes) { + super(parent, modal); + idrop = parent; + this.irodsTree = irodsTree; + this.deletedNodes = deletedNodes; + deletedNode = null; + initialize(); + int deletedNodesCount = deletedNodes.size(); + for (int idx = 0; idx < deletedNodesCount; idx++) { + CollectionAndDataObjectListingEntry entry = (CollectionAndDataObjectListingEntry) deletedNodes + .get(idx).getUserObject(); + if (entry.getObjectType() == CollectionAndDataObjectListingEntry.ObjectType.COLLECTION) { + txtAreaFileToDelete.append(entry.getPathOrName()); + } else { + txtAreaFileToDelete.append(entry.getParentPath()); + txtAreaFileToDelete.append("/"); + txtAreaFileToDelete.append(entry.getPathOrName()); + } + if (idx < deletedNodesCount - 1) { + txtAreaFileToDelete.append("\n"); + } + } + // txtAreaFileToDelete.setText("multiple selections"); + } + + private void initialize() { + initComponents(); + registerKeystrokeListener(); + } + + /** + * Register a listener for the enter event, so login can occur. + */ + private void registerKeystrokeListener() { + + KeyStroke enter = KeyStroke.getKeyStroke( + java.awt.event.KeyEvent.VK_ENTER, 0); + Action enterAction = new AbstractAction() { + + /** + * + */ + private static final long serialVersionUID = 4415243930794682644L; + + @Override + public void actionPerformed(final ActionEvent e) { + try { + processDelete(); + } catch (IdropException ex) { + Logger.getLogger(DeleteIRODSDialog.class.getName()).log( + Level.SEVERE, null, ex); + throw new IdropRuntimeException(ex); + } + } + }; + + btnOK.registerKeyboardAction(enterAction, enter, + JComponent.WHEN_IN_FOCUSED_WINDOW); + + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // <editor-fold defaultstate="collapsed" // desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { @@ -233,20 +244,20 @@ public class DeleteIRODSDialog extends javax.swing.JDialog { pack(); }// </editor-fold>//GEN-END:initComponents - private void btnCancelActionPerformed(final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnCancelActionPerformed - this.dispose(); - }// GEN-LAST:event_btnCancelActionPerformed + private void btnCancelActionPerformed(final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnCancelActionPerformed + dispose(); + }// GEN-LAST:event_btnCancelActionPerformed - private void btnOKActionPerformed(final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnOKActionPerformed - try { - processDelete(); - } catch (IdropException ex) { - Logger.getLogger(DeleteIRODSDialog.class.getName()).log( - Level.SEVERE, null, ex); - throw new IdropRuntimeException(ex); - } + private void btnOKActionPerformed(final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnOKActionPerformed + try { + processDelete(); + } catch (IdropException ex) { + Logger.getLogger(DeleteIRODSDialog.class.getName()).log( + Level.SEVERE, null, ex); + throw new IdropRuntimeException(ex); + } - }// GEN-LAST:event_btnOKActionPerformed + }// GEN-LAST:event_btnOKActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnCancel; @@ -268,114 +279,119 @@ public class DeleteIRODSDialog extends javax.swing.JDialog { private javax.swing.JTextArea txtAreaFileToDelete; // End of variables declaration//GEN-END:variables - private void processDelete() throws IdropException { - log.info("delete folder named:{}", txtAreaFileToDelete.getText()); - final DeleteIRODSDialog thisDialog = this; - - java.awt.EventQueue.invokeLater(new Runnable() { - - @Override - public void run() { - thisDialog.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - (new DeleteWorker(thisDialog)).execute(); - } - }); - } - - private void deleteASingleFile(final IRODSFileFactory irodsFileFactory, - final IRODSNode deletedNode) throws IdropException { - - log.info("node to delete is: {}", deletedNode); - CollectionAndDataObjectListingEntry dataEntry = (CollectionAndDataObjectListingEntry) deletedNode.getUserObject(); - - // dialog uses absolute path, so munge it for files - StringBuilder sb = new StringBuilder(); - if (dataEntry.getObjectType() == CollectionAndDataObjectListingEntry.ObjectType.COLLECTION) { - sb.append(dataEntry.getPathOrName()); - } else { - sb.append(dataEntry.getParentPath()); - sb.append('/'); - sb.append(dataEntry.getPathOrName()); - } - - IRODSFile fileToDelete; - try { - fileToDelete = irodsFileFactory.instanceIRODSFile(sb.toString()); - fileToDelete.delete(); - - } catch (JargonException ex) { - Logger.getLogger(DeleteIRODSDialog.class.getName()).log( - Level.SEVERE, null, ex); - throw new IdropException(ex); - } finally { - idrop.getiDropCore().closeIRODSConnectionForLoggedInAccount(); - } - - } - - class DeleteWorker extends SwingWorker<String, Object> { - - public static final String DELETE_SUCCESSFUL = "Deletion complete"; - public static final String DELETE_ERRORS = "The deletion was not successful"; - private DeleteIRODSDialog dialog; - private String message = ""; - - DeleteWorker(final DeleteIRODSDialog dialog) { - if (dialog == null) { - throw new IllegalArgumentException("null dialog"); - } - - this.dialog = dialog; - - } - - @Override - public String doInBackground() { - - try { - - IRODSFileFactory irodsFileFactory = idrop.getiDropCore().getIRODSFileFactoryForLoggedInAccount(); - if (deletedNode != null) { - log.info("deleting a single node"); - deleteASingleFile(irodsFileFactory, deletedNode); - } else if (deletedNodes != null) { - log.info("deleting multiple nodes"); - for (IRODSNode deletedNodeEntry : deletedNodes) { - deleteASingleFile(irodsFileFactory, deletedNodeEntry); - } - } - message = DELETE_SUCCESSFUL; - } catch (Exception ex) { - Logger.getLogger(NewIRODSDirectoryDialog.class.getName()).log( - Level.SEVERE, null, ex); - idrop.showIdropException(ex); - message = DELETE_ERRORS; - } finally { - idrop.getiDropCore().closeAllIRODSConnections(); - } - - return null; - } - - @Override - protected void done() { - dialog.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); - final IRODSOutlineModel irodsFileSystemModel = (IRODSOutlineModel) irodsTree.getModel(); - try { - if (deletedNode != null) { - irodsFileSystemModel.notifyFileShouldBeRemoved(deletedNode); - } else if (deletedNodes != null) { - for (IRODSNode deletedNode : deletedNodes) { - irodsFileSystemModel.notifyFileShouldBeRemoved(deletedNode); - } - } - } catch (IdropException ex) { - Logger.getLogger(DeleteIRODSDialog.class.getName()).log( - Level.SEVERE, null, ex); - throw new IdropRuntimeException(ex); - } - dialog.dispose(); - - } - } + private void processDelete() throws IdropException { + log.info("delete folder named:{}", txtAreaFileToDelete.getText()); + final DeleteIRODSDialog thisDialog = this; + + java.awt.EventQueue.invokeLater(new Runnable() { + + @Override + public void run() { + thisDialog.setCursor(Cursor + .getPredefinedCursor(Cursor.WAIT_CURSOR)); + (new DeleteWorker(thisDialog)).execute(); + } + }); + } + + private void deleteASingleFile(final IRODSFileFactory irodsFileFactory, + final IRODSNode deletedNode) throws IdropException { + + log.info("node to delete is: {}", deletedNode); + CollectionAndDataObjectListingEntry dataEntry = (CollectionAndDataObjectListingEntry) deletedNode + .getUserObject(); + + // dialog uses absolute path, so munge it for files + StringBuilder sb = new StringBuilder(); + if (dataEntry.getObjectType() == CollectionAndDataObjectListingEntry.ObjectType.COLLECTION) { + sb.append(dataEntry.getPathOrName()); + } else { + sb.append(dataEntry.getParentPath()); + sb.append('/'); + sb.append(dataEntry.getPathOrName()); + } + + IRODSFile fileToDelete; + try { + fileToDelete = irodsFileFactory.instanceIRODSFile(sb.toString()); + fileToDelete.delete(); + + } catch (JargonException ex) { + Logger.getLogger(DeleteIRODSDialog.class.getName()).log( + Level.SEVERE, null, ex); + throw new IdropException(ex); + } finally { + idrop.getiDropCore().closeIRODSConnectionForLoggedInAccount(); + } + + } + + class DeleteWorker extends SwingWorker<String, Object> { + + public static final String DELETE_SUCCESSFUL = "Deletion complete"; + public static final String DELETE_ERRORS = "The deletion was not successful"; + private DeleteIRODSDialog dialog; + private String message = ""; + + DeleteWorker(final DeleteIRODSDialog dialog) { + if (dialog == null) { + throw new IllegalArgumentException("null dialog"); + } + + this.dialog = dialog; + + } + + @Override + public String doInBackground() { + + try { + + IRODSFileFactory irodsFileFactory = idrop.getiDropCore() + .getIRODSFileFactoryForLoggedInAccount(); + if (deletedNode != null) { + log.info("deleting a single node"); + deleteASingleFile(irodsFileFactory, deletedNode); + } else if (deletedNodes != null) { + log.info("deleting multiple nodes"); + for (IRODSNode deletedNodeEntry : deletedNodes) { + deleteASingleFile(irodsFileFactory, deletedNodeEntry); + } + } + message = DELETE_SUCCESSFUL; + } catch (Exception ex) { + Logger.getLogger(NewIRODSDirectoryDialog.class.getName()).log( + Level.SEVERE, null, ex); + idrop.showIdropException(ex); + message = DELETE_ERRORS; + } finally { + idrop.getiDropCore().closeAllIRODSConnections(); + } + + return null; + } + + @Override + protected void done() { + dialog.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + final IRODSOutlineModel irodsFileSystemModel = (IRODSOutlineModel) irodsTree + .getModel(); + try { + if (deletedNode != null) { + irodsFileSystemModel.notifyFileShouldBeRemoved(deletedNode); + } else if (deletedNodes != null) { + for (IRODSNode deletedNode : deletedNodes) { + irodsFileSystemModel + .notifyFileShouldBeRemoved(deletedNode); + } + } + } catch (IdropException ex) { + Logger.getLogger(DeleteIRODSDialog.class.getName()).log( + Level.SEVERE, null, ex); + throw new IdropRuntimeException(ex); + } + dialog.dispose(); + + } + } } diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/DeleteLocalFileDialog.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/DeleteLocalFileDialog.java index 5c74758..6f1f9c3 100644 --- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/DeleteLocalFileDialog.java +++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/DeleteLocalFileDialog.java @@ -36,64 +36,69 @@ import org.slf4j.LoggerFactory; */ public class DeleteLocalFileDialog extends javax.swing.JDialog { - private final iDrop idrop; - private String directoryToDelete = ""; - private final LocalFileTree localFileTree; - private final LocalFileNode deletedNode; - private final List<LocalFileNode> deletedNodes; - public static org.slf4j.Logger log = LoggerFactory.getLogger(DeleteLocalFileDialog.class); - - /** Creates new form to delete a local file */ - public DeleteLocalFileDialog(final iDrop parent, final boolean modal, - final String directoryToDelete, final LocalFileTree localFileTree, - final LocalFileNode deletedNode) { - super(parent, modal); - this.idrop = parent; - this.directoryToDelete = directoryToDelete; - this.localFileTree = localFileTree; - this.deletedNode = deletedNode; - this.deletedNodes = null; - initComponents(); - txtAreaFileToDelete.setText(this.directoryToDelete); - registerKeystrokeListener(); - - } - - /** Creates new form to delete a local file */ - public DeleteLocalFileDialog(final iDrop parent, final boolean modal, - final LocalFileTree localFileTree, - final List<LocalFileNode> deletedNodes) { - super(parent, modal); - this.idrop = parent; - this.directoryToDelete = null; - this.localFileTree = localFileTree; - this.deletedNode = null; - this.deletedNodes = deletedNodes; - initComponents(); - txtAreaFileToDelete.setText("Multiple selections"); - registerKeystrokeListener(); - - } - - private void recursiveDelete(final File fileToDelete) throws IOException { - if (fileToDelete.isDirectory()) { - for (File c : fileToDelete.listFiles()) { - recursiveDelete(c); - } - } - if (!fileToDelete.delete()) { - throw new FileNotFoundException("Failed to delete file: " - + fileToDelete); - } - } - - /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. - */ - @SuppressWarnings("unchecked") - // <editor-fold defaultstate="collapsed" + /** + * + */ + private static final long serialVersionUID = -1982422243958895850L; + private final iDrop idrop; + private String directoryToDelete = ""; + private final LocalFileTree localFileTree; + private final LocalFileNode deletedNode; + private final List<LocalFileNode> deletedNodes; + public static org.slf4j.Logger log = LoggerFactory + .getLogger(DeleteLocalFileDialog.class); + + /** Creates new form to delete a local file */ + public DeleteLocalFileDialog(final iDrop parent, final boolean modal, + final String directoryToDelete, final LocalFileTree localFileTree, + final LocalFileNode deletedNode) { + super(parent, modal); + idrop = parent; + this.directoryToDelete = directoryToDelete; + this.localFileTree = localFileTree; + this.deletedNode = deletedNode; + deletedNodes = null; + initComponents(); + txtAreaFileToDelete.setText(this.directoryToDelete); + registerKeystrokeListener(); + + } + + /** Creates new form to delete a local file */ + public DeleteLocalFileDialog(final iDrop parent, final boolean modal, + final LocalFileTree localFileTree, + final List<LocalFileNode> deletedNodes) { + super(parent, modal); + idrop = parent; + directoryToDelete = null; + this.localFileTree = localFileTree; + deletedNode = null; + this.deletedNodes = deletedNodes; + initComponents(); + txtAreaFileToDelete.setText("Multiple selections"); + registerKeystrokeListener(); + + } + + private void recursiveDelete(final File fileToDelete) throws IOException { + if (fileToDelete.isDirectory()) { + for (File c : fileToDelete.listFiles()) { + recursiveDelete(c); + } + } + if (!fileToDelete.delete()) { + throw new FileNotFoundException("Failed to delete file: " + + fileToDelete); + } + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // <editor-fold defaultstate="collapsed" // desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { @@ -201,14 +206,14 @@ public class DeleteLocalFileDialog extends javax.swing.JDialog { pack(); }// </editor-fold>//GEN-END:initComponents - private void btnCancelActionPerformed(final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnCancelActionPerformed - this.dispose(); - }// GEN-LAST:event_btnCancelActionPerformed + private void btnCancelActionPerformed(final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnCancelActionPerformed + dispose(); + }// GEN-LAST:event_btnCancelActionPerformed - private void btnOKActionPerformed(final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnOKActionPerformed - processDelete(); + private void btnOKActionPerformed(final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnOKActionPerformed + processDelete(); - }// GEN-LAST:event_btnOKActionPerformed + }// GEN-LAST:event_btnOKActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnCancel; @@ -230,73 +235,82 @@ public class DeleteLocalFileDialog extends javax.swing.JDialog { private javax.swing.JTextArea txtAreaFileToDelete; // End of variables declaration//GEN-END:variables - private void processDelete() { - - log.info("delete folder named:{}", txtAreaFileToDelete.getText()); - final DeleteLocalFileDialog thisDialog = this; - - java.awt.EventQueue.invokeLater(new Runnable() { - - @Override - public void run() { - try { - thisDialog.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - - if (deletedNode != null) { - log.info("delete single node:{}", deletedNode); - deleteSingleNodeOperation(deletedNode); - - } else if (deletedNodes != null) { - log.info("deleting multiple nodes"); - for (LocalFileNode theLocalNode : deletedNodes) { - deleteSingleNodeOperation(theLocalNode); - - } - } - - idrop.showMessageFromOperation("delete successful"); - - } catch (Exception ex) { - Logger.getLogger(NewIRODSDirectoryDialog.class.getName()).log(Level.SEVERE, null, ex); - idrop.showIdropException(ex); - } finally { - thisDialog.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); - } - - thisDialog.dispose(); - } - - private void deleteSingleNodeOperation(final LocalFileNode localNode) - throws IOException { - new TreePath(localNode); - localNode.getParent(); - File fileToDelete = (File) localNode.getUserObject(); - log.debug("deleting local file:{}", - fileToDelete.getAbsolutePath()); - - recursiveDelete(fileToDelete); - LocalFileSystemModel localFileTreeModel = (LocalFileSystemModel) localFileTree.getModel(); - localFileTreeModel.removeNodeFromParent(localNode); - } - }); - } - - /** - * Register a listener for the enter event, so login can occur. - */ - private void registerKeystrokeListener() { - - KeyStroke enter = KeyStroke.getKeyStroke( - java.awt.event.KeyEvent.VK_ENTER, 0); - Action enterAction = new AbstractAction() { - - @Override - public void actionPerformed(final ActionEvent e) { - processDelete(); - } - }; - btnOK.registerKeyboardAction(enterAction, enter, - JComponent.WHEN_IN_FOCUSED_WINDOW); - - } + private void processDelete() { + + log.info("delete folder named:{}", txtAreaFileToDelete.getText()); + final DeleteLocalFileDialog thisDialog = this; + + java.awt.EventQueue.invokeLater(new Runnable() { + + @Override + public void run() { + try { + thisDialog.setCursor(Cursor + .getPredefinedCursor(Cursor.WAIT_CURSOR)); + + if (deletedNode != null) { + log.info("delete single node:{}", deletedNode); + deleteSingleNodeOperation(deletedNode); + + } else if (deletedNodes != null) { + log.info("deleting multiple nodes"); + for (LocalFileNode theLocalNode : deletedNodes) { + deleteSingleNodeOperation(theLocalNode); + + } + } + + idrop.showMessageFromOperation("delete successful"); + + } catch (Exception ex) { + Logger.getLogger(NewIRODSDirectoryDialog.class.getName()) + .log(Level.SEVERE, null, ex); + idrop.showIdropException(ex); + } finally { + thisDialog.setCursor(Cursor + .getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + } + + thisDialog.dispose(); + } + + private void deleteSingleNodeOperation(final LocalFileNode localNode) + throws IOException { + new TreePath(localNode); + localNode.getParent(); + File fileToDelete = (File) localNode.getUserObject(); + log.debug("deleting local file:{}", + fileToDelete.getAbsolutePath()); + + recursiveDelete(fileToDelete); + LocalFileSystemModel localFileTreeModel = (LocalFileSystemModel) localFileTree + .getModel(); + localFileTreeModel.removeNodeFromParent(localNode); + } + }); + } + + /** + * Register a listener for the enter event, so login can occur. + */ + private void registerKeystrokeListener() { + + KeyStroke enter = KeyStroke.getKeyStroke( + java.awt.event.KeyEvent.VK_ENTER, 0); + Action enterAction = new AbstractAction() { + + /** + * + */ + private static final long serialVersionUID = 5740774823149951406L; + + @Override + public void actionPerformed(final ActionEvent e) { + processDelete(); + } + }; + btnOK.registerKeyboardAction(enterAction, enter, + JComponent.WHEN_IN_FOCUSED_WINDOW); + + } } diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/DownloadDialog.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/DownloadDialog.java index 6855be3..f65b605 100644 --- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/DownloadDialog.java +++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/DownloadDialog.java @@ -8,12 +8,14 @@ import java.awt.Cursor; import java.io.File; import java.util.ArrayList; import java.util.List; + import javax.swing.JFileChooser; import javax.swing.ListSelectionModel; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.table.DefaultTableModel; import javax.swing.tree.TreePath; + import org.irods.jargon.core.exception.JargonException; import org.irods.jargon.core.pub.io.IRODSFile; import org.irods.jargon.idrop.desktop.systraygui.services.IRODSFileService; @@ -30,458 +32,525 @@ import org.openide.util.Exceptions; import org.slf4j.LoggerFactory; /** - * + * * @author lisa */ -public class DownloadDialog extends javax.swing.JDialog implements ListSelectionListener { - - iDrop idropGUI; - IRODSTree irodsTree; - LocalFileTree localFileTree; - public static org.slf4j.Logger log = LoggerFactory.getLogger(IRODSTree.class); - - /** - * Creates new form DownloadDialog - */ - public DownloadDialog(java.awt.Frame parent, boolean modal) { - super(parent, modal); - initComponents(); - } - - public DownloadDialog(final iDrop parent, final boolean modal, - final IRODSTree irodsTree, - final LocalFileTree localFileTree) { - super(parent, modal); - initComponents(); - - this.idropGUI = parent; - this.irodsTree = irodsTree; - this.localFileTree = localFileTree; - this.btnDeleteDownloadFile.setEnabled(false); - tblFilesToDownload.getSelectionModel().addListSelectionListener(this); - - initDownloadTarget(); - initSourcesFiles(); - setDownloadButtonState(); - } - - private void initDownloadTarget() { - - String target = ""; - - //first check to see if a download target is selected in the local file tree - TreePath treePath = localFileTree.getSelectionPath(); - if(treePath != null) { - LocalFileNode selectedFileNode = (LocalFileNode) localFileTree.getSelectionPath().getLastPathComponent(); - File targetPath = (File) selectedFileNode.getUserObject(); - if (targetPath.isDirectory()) { - target = targetPath.getAbsolutePath(); - } - } - - txtDownloadTarget.setText(target); - } - - private void initSourcesFiles() { - //check for selected objects and/or collections to download - // get iRODS File Service - IRODSFileService irodsFS = null; - try { - irodsFS = new IRODSFileService(idropGUI.getiDropCore().getIrodsAccount(), - idropGUI.getiDropCore().getIrodsFileSystem()); - } catch (Exception ex) { - //JOptionPane.showMessageDialog(this, "Cannot access iRODS file system for get."); - log.error("cannot create irods file service"); - return; - } - - IRODSOutlineModel irodsFileSystemModel = (IRODSOutlineModel) irodsTree.getModel(); - ListSelectionModel selectionModel = irodsTree.getSelectionModel(); - int idxStart = selectionModel.getMinSelectionIndex(); - int idxEnd = selectionModel.getMaxSelectionIndex(); - - // now collect all selected nodes - List<IRODSFile> ifiles = new ArrayList<IRODSFile>(); - - for (int idx = idxStart; idx <= idxEnd; idx++) { - if (selectionModel.isSelectedIndex(idx)) { - try { - IRODSNode selectedNode = (IRODSNode) irodsFileSystemModel.getValueAt(idx, 0); - ifiles.add(irodsFS.getIRODSFileForPath(selectedNode.getFullPath())); - } catch (IdropException ex) { - Exceptions.printStackTrace(ex); - } - } - } - - setFilesToDownload(ifiles); - } - - private void executeDownload() { - - idropGUI.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - - final String targetPath = txtDownloadTarget.getText(); - final String sourceFiles[] = getFilesToDownload(); - - - // process as a get - java.awt.EventQueue.invokeLater(new Runnable() { - @Override - public void run() { - for (String transferFile : sourceFiles) { - log.info("initiating a transfer of iRODS file:{}", - transferFile); - log.info("transfer to local file:{}", - targetPath); - try { - idropGUI.getiDropCore().getTransferManager().enqueueAGet( - transferFile, - targetPath, - "", idropGUI.getIrodsAccount()); - } catch (JargonException ex) { - java.util.logging.Logger.getLogger( - LocalFileTree.class.getName()).log( - java.util.logging.Level.SEVERE, null, ex); - idropGUI.showIdropException(ex); - } - } - } - }); - idropGUI.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); - } - - private void setDownloadButtonState() { - btnDownloadNow.setEnabled(((txtDownloadTarget.getText().length() > 0) && - (tblFilesToDownload.getModel().getRowCount() > 0))); - } - - private void setFilesToDownload(List<IRODSFile> ifiles) { - - DefaultTableModel model = (DefaultTableModel) tblFilesToDownload.getModel(); - - for(int i=0; i<ifiles.size(); i++) { - String filePath = ifiles.get(i).getAbsolutePath(); - model.addRow(new Object[] {filePath}); - } - } - - private String[] getFilesToDownload() { - - int numFiles = 0; - DefaultTableModel model = (DefaultTableModel) tblFilesToDownload.getModel(); - numFiles = model.getRowCount(); - String[] filesToDownload = new String[numFiles]; - - for (int i=0; i<numFiles; i++) { - filesToDownload[i] = (String) model.getValueAt(i, 0); - } - - return filesToDownload; - } - - - @Override - public void valueChanged(ListSelectionEvent lse) { - if (lse.getValueIsAdjusting() == false) { - btnDeleteDownloadFile.setEnabled(tblFilesToDownload.getSelectedRow() >= 0); - } - } - - /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. - */ - @SuppressWarnings("unchecked") - // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents - private void initComponents() { - java.awt.GridBagConstraints gridBagConstraints; - - jPanel1 = new javax.swing.JPanel(); - pnlDownloadFileContainer = new javax.swing.JPanel(); - lblFilesHeader = new javax.swing.JLabel(); - scrollPanelFilesToDownload = new javax.swing.JScrollPane(); - tblFilesToDownload = new javax.swing.JTable(); - pnlAddDelete = new javax.swing.JPanel(); - btnAddDownloadFile = new javax.swing.JButton(); - btnDeleteDownloadFile = new javax.swing.JButton(); - jPanel4 = new javax.swing.JPanel(); - jLabel1 = new javax.swing.JLabel(); - txtDownloadTarget = new javax.swing.JTextField(); - btnBrowseDownloadTarget = new javax.swing.JButton(); - btnUseLocaLHome = new javax.swing.JButton(); - btnUseLastDownload = new javax.swing.JButton(); - pnlUploadDownloadButtons = new javax.swing.JPanel(); - btnDownloadNow = new javax.swing.JButton(); - btnCancel = new javax.swing.JButton(); - - setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - setTitle(org.openide.util.NbBundle.getMessage(DownloadDialog.class, "DownloadDialog.title")); // NOI18N - setPreferredSize(new java.awt.Dimension(600, 420)); - - jPanel1.setBorder(javax.swing.BorderFactory.createEmptyBorder(6, 6, 6, 6)); - jPanel1.setPreferredSize(new java.awt.Dimension(600, 350)); - jPanel1.setLayout(new java.awt.BorderLayout()); - - pnlDownloadFileContainer.setBorder(javax.swing.BorderFactory.createEmptyBorder(14, 4, 1, 4)); - pnlDownloadFileContainer.setPreferredSize(new java.awt.Dimension(303, 250)); - pnlDownloadFileContainer.setLayout(new java.awt.BorderLayout()); - - lblFilesHeader.setText(org.openide.util.NbBundle.getMessage(DownloadDialog.class, "DownloadDialog.lblFilesHeader.text")); // NOI18N - pnlDownloadFileContainer.add(lblFilesHeader, java.awt.BorderLayout.NORTH); - - tblFilesToDownload.setModel(new javax.swing.table.DefaultTableModel( - new Object [][] { - - }, - new String [] { - "File" - } - ) { - Class[] types = new Class [] { - java.lang.String.class - }; - boolean[] canEdit = new boolean [] { - false - }; - - public Class getColumnClass(int columnIndex) { - return types [columnIndex]; - } - - public boolean isCellEditable(int rowIndex, int columnIndex) { - return canEdit [columnIndex]; - } - }); - scrollPanelFilesToDownload.setViewportView(tblFilesToDownload); - - pnlDownloadFileContainer.add(scrollPanelFilesToDownload, java.awt.BorderLayout.CENTER); - - pnlAddDelete.setPreferredSize(new java.awt.Dimension(100, 25)); - pnlAddDelete.setLayout(new java.awt.GridBagLayout()); - - btnAddDownloadFile.setText(org.openide.util.NbBundle.getMessage(DownloadDialog.class, "DownloadDialog.btnAddDownloadFile.text")); // NOI18N - btnAddDownloadFile.setMaximumSize(null); - btnAddDownloadFile.setMinimumSize(null); - btnAddDownloadFile.setPreferredSize(null); - btnAddDownloadFile.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnAddDownloadFileActionPerformed(evt); - } - }); - pnlAddDelete.add(btnAddDownloadFile, new java.awt.GridBagConstraints()); - - btnDeleteDownloadFile.setText(org.openide.util.NbBundle.getMessage(DownloadDialog.class, "DownloadDialog.btnDeleteDownloadFile.text")); // NOI18N - btnDeleteDownloadFile.setMaximumSize(null); - btnDeleteDownloadFile.setMinimumSize(null); - btnDeleteDownloadFile.setPreferredSize(null); - btnDeleteDownloadFile.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnDeleteDownloadFileActionPerformed(evt); - } - }); - pnlAddDelete.add(btnDeleteDownloadFile, new java.awt.GridBagConstraints()); - - pnlDownloadFileContainer.add(pnlAddDelete, java.awt.BorderLayout.SOUTH); - - jPanel1.add(pnlDownloadFileContainer, java.awt.BorderLayout.NORTH); - - jPanel4.setBorder(javax.swing.BorderFactory.createEtchedBorder()); - jPanel4.setPreferredSize(new java.awt.Dimension(240, 76)); - jPanel4.setLayout(new java.awt.GridBagLayout()); - - jLabel1.setText(org.openide.util.NbBundle.getMessage(DownloadDialog.class, "DownloadDialog.jLabel1.text")); // NOI18N - jPanel4.add(jLabel1, new java.awt.GridBagConstraints()); - - txtDownloadTarget.setEditable(false); - txtDownloadTarget.setColumns(200); - txtDownloadTarget.setText(org.openide.util.NbBundle.getMessage(DownloadDialog.class, "DownloadDialog.txtDownloadTarget.text")); // NOI18N - txtDownloadTarget.setMaximumSize(new java.awt.Dimension(200, 20)); - txtDownloadTarget.setMinimumSize(null); - txtDownloadTarget.setPreferredSize(new java.awt.Dimension(200, 20)); - txtDownloadTarget.setRequestFocusEnabled(false); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - jPanel4.add(txtDownloadTarget, gridBagConstraints); - - btnBrowseDownloadTarget.setText(org.openide.util.NbBundle.getMessage(DownloadDialog.class, "DownloadDialog.btnBrowseDownloadTarget.text")); // NOI18N - btnBrowseDownloadTarget.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnBrowseDownloadTargetActionPerformed(evt); - } - }); - jPanel4.add(btnBrowseDownloadTarget, new java.awt.GridBagConstraints()); - - btnUseLocaLHome.setText(org.openide.util.NbBundle.getMessage(DownloadDialog.class, "DownloadDialog.btnUseLocaLHome.text")); // NOI18N - btnUseLocaLHome.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnUseLocaLHomeActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - jPanel4.add(btnUseLocaLHome, gridBagConstraints); - - btnUseLastDownload.setText(org.openide.util.NbBundle.getMessage(DownloadDialog.class, "DownloadDialog.btnUseLastDownload.text")); // NOI18N - btnUseLastDownload.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnUseLastDownloadActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - jPanel4.add(btnUseLastDownload, gridBagConstraints); - - jPanel1.add(jPanel4, java.awt.BorderLayout.SOUTH); - - getContentPane().add(jPanel1, java.awt.BorderLayout.NORTH); - - pnlUploadDownloadButtons.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT)); - - btnDownloadNow.setText(org.openide.util.NbBundle.getMessage(DownloadDialog.class, "DownloadDialog.btnDownloadNow.text")); // NOI18N - btnDownloadNow.setEnabled(false); - btnDownloadNow.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnDownloadNowActionPerformed(evt); - } - }); - pnlUploadDownloadButtons.add(btnDownloadNow); - - btnCancel.setText(org.openide.util.NbBundle.getMessage(DownloadDialog.class, "DownloadDialog.btnCancel.text")); // NOI18N - btnCancel.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnCancelActionPerformed(evt); - } - }); - pnlUploadDownloadButtons.add(btnCancel); - - getContentPane().add(pnlUploadDownloadButtons, java.awt.BorderLayout.SOUTH); - - getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(DownloadDialog.class, "DownloadDialog.AccessibleContext.accessibleName")); // NOI18N - - pack(); - }// </editor-fold>//GEN-END:initComponents - - private void btnBrowseDownloadTargetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBrowseDownloadTargetActionPerformed - - JFileChooser localFileChooser = new JFileChooser(); - localFileChooser.setMultiSelectionEnabled(false); - localFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - localFileChooser.setDialogTitle("Select Download Target"); - localFileChooser.setLocation( - (int)this.getLocation().getX(), (int)this.getLocation().getY()); - int returnVal = localFileChooser.showOpenDialog(this); - - if (returnVal == JFileChooser.APPROVE_OPTION) { - String downloadPath = localFileChooser.getSelectedFile().getAbsolutePath(); - txtDownloadTarget.setText(downloadPath); - setDownloadButtonState(); - } - }//GEN-LAST:event_btnBrowseDownloadTargetActionPerformed - - private void btnUseLocaLHomeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUseLocaLHomeActionPerformed - String target = System.getProperty("user.home"); - - if (target != null) { - txtDownloadTarget.setText(target); - } - setDownloadButtonState(); - }//GEN-LAST:event_btnUseLocaLHomeActionPerformed - - private void btnUseLastDownloadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUseLastDownloadActionPerformed - String target = ""; - // see if can find some get history in the transfer queue - try { - List<LocalIRODSTransfer> transfers = idropGUI.getiDropCore().getTransferManager().getRecentQueue(); - - // assuming most recent first - for (LocalIRODSTransfer transfer: transfers) { - // must check to match type, user, host, zone, & resource - if ((transfer.getTransferType() == TransferType.GET) && - (transfer.getTransferUserName().equals(idropGUI.getiDropCore().getIrodsAccount().getUserName())) && - (transfer.getTransferZone().equals(idropGUI.getiDropCore().getIrodsAccount().getZone())) && - (transfer.getTransferPort() == idropGUI.getiDropCore().getIrodsAccount().getPort()) && - (transfer.getTransferHost().equals(idropGUI.getiDropCore().getIrodsAccount().getHost()))) { - target = transfer.getLocalAbsolutePath(); - break; - } - } - } catch (JargonException ex) { - Exceptions.printStackTrace(ex); - } - if (target != null) { - txtDownloadTarget.setText(target); - } - setDownloadButtonState(); - }//GEN-LAST:event_btnUseLastDownloadActionPerformed - - private void btnAddDownloadFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddDownloadFileActionPerformed - IRODSFinderDialog irodsFinder = new IRODSFinderDialog( - idropGUI, false, idropGUI.getiDropCore()); - irodsFinder.setTitle("Select iRODS Files and Collections for download"); - irodsFinder.setSelectionType(IRODSFinderDialog.SelectionType.OBJS_AND_COLLS_SELECTION_MODE); - irodsFinder.setLocation( - (int)this.getLocation().getX(), (int)this.getLocation().getY()); - irodsFinder.setVisible(true); - - List<String> selectedPaths = irodsFinder.getSelectedAbsolutePaths(); - for (String selectedPath: selectedPaths) { - if (selectedPath != null) { - DefaultTableModel model = (DefaultTableModel) tblFilesToDownload.getModel(); - model.addRow(new Object[] {selectedPath}); - } - } - setDownloadButtonState(); - }//GEN-LAST:event_btnAddDownloadFileActionPerformed - - private void btnDeleteDownloadFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDeleteDownloadFileActionPerformed - - int[] selectedRows = tblFilesToDownload.getSelectedRows(); - int numRowsSelected = selectedRows.length; - - // have to remove rows in reverse - for(int i=numRowsSelected-1; i>=0; i--) { - //for (int selectedRow: selectedRows) { - int selectedRow = selectedRows[i]; - if (selectedRow >= 0) { - DefaultTableModel model = (DefaultTableModel) tblFilesToDownload.getModel(); - model.removeRow(selectedRow); - } - } - }//GEN-LAST:event_btnDeleteDownloadFileActionPerformed - - private void btnDownloadNowActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDownloadNowActionPerformed - executeDownload(); - this.dispose(); - }//GEN-LAST:event_btnDownloadNowActionPerformed - - private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelActionPerformed - this.dispose(); - }//GEN-LAST:event_btnCancelActionPerformed - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JButton btnAddDownloadFile; - private javax.swing.JButton btnBrowseDownloadTarget; - private javax.swing.JButton btnCancel; - private javax.swing.JButton btnDeleteDownloadFile; - private javax.swing.JButton btnDownloadNow; - private javax.swing.JButton btnUseLastDownload; - private javax.swing.JButton btnUseLocaLHome; - private javax.swing.JLabel jLabel1; - private javax.swing.JPanel jPanel1; - private javax.swing.JPanel jPanel4; - private javax.swing.JLabel lblFilesHeader; - private javax.swing.JPanel pnlAddDelete; - private javax.swing.JPanel pnlDownloadFileContainer; - private javax.swing.JPanel pnlUploadDownloadButtons; - private javax.swing.JScrollPane scrollPanelFilesToDownload; - private javax.swing.JTable tblFilesToDownload; - private javax.swing.JTextField txtDownloadTarget; - // End of variables declaration//GEN-END:variables +public class DownloadDialog extends javax.swing.JDialog implements + ListSelectionListener { + + /** + * + */ + private static final long serialVersionUID = -204997338708996297L; + iDrop idropGUI; + IRODSTree irodsTree; + LocalFileTree localFileTree; + public static org.slf4j.Logger log = LoggerFactory + .getLogger(IRODSTree.class); + + /** + * Creates new form DownloadDialog + */ + public DownloadDialog(final java.awt.Frame parent, final boolean modal) { + super(parent, modal); + initComponents(); + } + + public DownloadDialog(final iDrop parent, final boolean modal, + final IRODSTree irodsTree, final LocalFileTree localFileTree) { + super(parent, modal); + initComponents(); + + idropGUI = parent; + this.irodsTree = irodsTree; + this.localFileTree = localFileTree; + btnDeleteDownloadFile.setEnabled(false); + tblFilesToDownload.getSelectionModel().addListSelectionListener(this); + + initDownloadTarget(); + initSourcesFiles(); + setDownloadButtonState(); + } + + private void initDownloadTarget() { + + String target = ""; + + // first check to see if a download target is selected in the local file + // tree + TreePath treePath = localFileTree.getSelectionPath(); + if (treePath != null) { + LocalFileNode selectedFileNode = (LocalFileNode) localFileTree + .getSelectionPath().getLastPathComponent(); + File targetPath = (File) selectedFileNode.getUserObject(); + if (targetPath.isDirectory()) { + target = targetPath.getAbsolutePath(); + } + } + + txtDownloadTarget.setText(target); + } + + private void initSourcesFiles() { + // check for selected objects and/or collections to download + // get iRODS File Service + IRODSFileService irodsFS = null; + try { + irodsFS = new IRODSFileService(idropGUI.getiDropCore() + .getIrodsAccount(), idropGUI.getiDropCore() + .getIrodsFileSystem()); + } catch (Exception ex) { + // JOptionPane.showMessageDialog(this, + // "Cannot access iRODS file system for get."); + log.error("cannot create irods file service"); + return; + } + + IRODSOutlineModel irodsFileSystemModel = (IRODSOutlineModel) irodsTree + .getModel(); + ListSelectionModel selectionModel = irodsTree.getSelectionModel(); + int idxStart = selectionModel.getMinSelectionIndex(); + int idxEnd = selectionModel.getMaxSelectionIndex(); + + // now collect all selected nodes + List<IRODSFile> ifiles = new ArrayList<IRODSFile>(); + + for (int idx = idxStart; idx <= idxEnd; idx++) { + if (selectionModel.isSelectedIndex(idx)) { + try { + IRODSNode selectedNode = (IRODSNode) irodsFileSystemModel + .getValueAt(idx, 0); + ifiles.add(irodsFS.getIRODSFileForPath(selectedNode + .getFullPath())); + } catch (IdropException ex) { + Exceptions.printStackTrace(ex); + } + } + } + + setFilesToDownload(ifiles); + } + + private void executeDownload() { + + idropGUI.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + + final String targetPath = txtDownloadTarget.getText(); + final String sourceFiles[] = getFilesToDownload(); + + // process as a get + java.awt.EventQueue.invokeLater(new Runnable() { + @Override + public void run() { + for (String transferFile : sourceFiles) { + log.info("initiating a transfer of iRODS file:{}", + transferFile); + log.info("transfer to local file:{}", targetPath); + try { + idropGUI.getiDropCore() + .getTransferManager() + .enqueueAGet(transferFile, targetPath, "", + idropGUI.getIrodsAccount()); + } catch (JargonException ex) { + java.util.logging.Logger.getLogger( + LocalFileTree.class.getName()).log( + java.util.logging.Level.SEVERE, null, ex); + idropGUI.showIdropException(ex); + } + } + } + }); + idropGUI.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + } + + private void setDownloadButtonState() { + btnDownloadNow + .setEnabled(((txtDownloadTarget.getText().length() > 0) && (tblFilesToDownload + .getModel().getRowCount() > 0))); + } + + private void setFilesToDownload(final List<IRODSFile> ifiles) { + + DefaultTableModel model = (DefaultTableModel) tblFilesToDownload + .getModel(); + + for (int i = 0; i < ifiles.size(); i++) { + String filePath = ifiles.get(i).getAbsolutePath(); + model.addRow(new Object[] { filePath }); + } + } + + private String[] getFilesToDownload() { + + int numFiles = 0; + DefaultTableModel model = (DefaultTableModel) tblFilesToDownload + .getModel(); + numFiles = model.getRowCount(); + String[] filesToDownload = new String[numFiles]; + + for (int i = 0; i < numFiles; i++) { + filesToDownload[i] = (String) model.getValueAt(i, 0); + } + + return filesToDownload; + } + + @Override + public void valueChanged(final ListSelectionEvent lse) { + if (lse.getValueIsAdjusting() == false) { + btnDeleteDownloadFile.setEnabled(tblFilesToDownload + .getSelectedRow() >= 0); + } + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // <editor-fold defaultstate="collapsed" + // desc="Generated Code">//GEN-BEGIN:initComponents + private void initComponents() { + java.awt.GridBagConstraints gridBagConstraints; + + jPanel1 = new javax.swing.JPanel(); + pnlDownloadFileContainer = new javax.swing.JPanel(); + lblFilesHeader = new javax.swing.JLabel(); + scrollPanelFilesToDownload = new javax.swing.JScrollPane(); + tblFilesToDownload = new javax.swing.JTable(); + pnlAddDelete = new javax.swing.JPanel(); + btnAddDownloadFile = new javax.swing.JButton(); + btnDeleteDownloadFile = new javax.swing.JButton(); + jPanel4 = new javax.swing.JPanel(); + jLabel1 = new javax.swing.JLabel(); + txtDownloadTarget = new javax.swing.JTextField(); + btnBrowseDownloadTarget = new javax.swing.JButton(); + btnUseLocaLHome = new javax.swing.JButton(); + btnUseLastDownload = new javax.swing.JButton(); + pnlUploadDownloadButtons = new javax.swing.JPanel(); + btnDownloadNow = new javax.swing.JButton(); + btnCancel = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setTitle(org.openide.util.NbBundle.getMessage(DownloadDialog.class, + "DownloadDialog.title")); // NOI18N + setPreferredSize(new java.awt.Dimension(600, 420)); + + jPanel1.setBorder(javax.swing.BorderFactory.createEmptyBorder(6, 6, 6, + 6)); + jPanel1.setPreferredSize(new java.awt.Dimension(600, 350)); + jPanel1.setLayout(new java.awt.BorderLayout()); + + pnlDownloadFileContainer.setBorder(javax.swing.BorderFactory + .createEmptyBorder(14, 4, 1, 4)); + pnlDownloadFileContainer.setPreferredSize(new java.awt.Dimension(303, + 250)); + pnlDownloadFileContainer.setLayout(new java.awt.BorderLayout()); + + lblFilesHeader.setText(org.openide.util.NbBundle.getMessage( + DownloadDialog.class, "DownloadDialog.lblFilesHeader.text")); // NOI18N + pnlDownloadFileContainer.add(lblFilesHeader, + java.awt.BorderLayout.NORTH); + + tblFilesToDownload.setModel(new javax.swing.table.DefaultTableModel( + new Object[][] { + + }, new String[] { "File" }) { + Class[] types = new Class[] { java.lang.String.class }; + boolean[] canEdit = new boolean[] { false }; + + @Override + public Class getColumnClass(final int columnIndex) { + return types[columnIndex]; + } + + @Override + public boolean isCellEditable(final int rowIndex, + final int columnIndex) { + return canEdit[columnIndex]; + } + }); + scrollPanelFilesToDownload.setViewportView(tblFilesToDownload); + + pnlDownloadFileContainer.add(scrollPanelFilesToDownload, + java.awt.BorderLayout.CENTER); + + pnlAddDelete.setPreferredSize(new java.awt.Dimension(100, 25)); + pnlAddDelete.setLayout(new java.awt.GridBagLayout()); + + btnAddDownloadFile + .setText(org.openide.util.NbBundle.getMessage( + DownloadDialog.class, + "DownloadDialog.btnAddDownloadFile.text")); // NOI18N + btnAddDownloadFile.setMaximumSize(null); + btnAddDownloadFile.setMinimumSize(null); + btnAddDownloadFile.setPreferredSize(null); + btnAddDownloadFile + .addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed( + final java.awt.event.ActionEvent evt) { + btnAddDownloadFileActionPerformed(evt); + } + }); + pnlAddDelete.add(btnAddDownloadFile, new java.awt.GridBagConstraints()); + + btnDeleteDownloadFile.setText(org.openide.util.NbBundle.getMessage( + DownloadDialog.class, + "DownloadDialog.btnDeleteDownloadFile.text")); // NOI18N + btnDeleteDownloadFile.setMaximumSize(null); + btnDeleteDownloadFile.setMinimumSize(null); + btnDeleteDownloadFile.setPreferredSize(null); + btnDeleteDownloadFile + .addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed( + final java.awt.event.ActionEvent evt) { + btnDeleteDownloadFileActionPerformed(evt); + } + }); + pnlAddDelete.add(btnDeleteDownloadFile, + new java.awt.GridBagConstraints()); + + pnlDownloadFileContainer.add(pnlAddDelete, java.awt.BorderLayout.SOUTH); + + jPanel1.add(pnlDownloadFileContainer, java.awt.BorderLayout.NORTH); + + jPanel4.setBorder(javax.swing.BorderFactory.createEtchedBorder()); + jPanel4.setPreferredSize(new java.awt.Dimension(240, 76)); + jPanel4.setLayout(new java.awt.GridBagLayout()); + + jLabel1.setText(org.openide.util.NbBundle.getMessage( + DownloadDialog.class, "DownloadDialog.jLabel1.text")); // NOI18N + jPanel4.add(jLabel1, new java.awt.GridBagConstraints()); + + txtDownloadTarget.setEditable(false); + txtDownloadTarget.setColumns(200); + txtDownloadTarget.setText(org.openide.util.NbBundle.getMessage( + DownloadDialog.class, "DownloadDialog.txtDownloadTarget.text")); // NOI18N + txtDownloadTarget.setMaximumSize(new java.awt.Dimension(200, 20)); + txtDownloadTarget.setMinimumSize(null); + txtDownloadTarget.setPreferredSize(new java.awt.Dimension(200, 20)); + txtDownloadTarget.setRequestFocusEnabled(false); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + jPanel4.add(txtDownloadTarget, gridBagConstraints); + + btnBrowseDownloadTarget.setText(org.openide.util.NbBundle.getMessage( + DownloadDialog.class, + "DownloadDialog.btnBrowseDownloadTarget.text")); // NOI18N + btnBrowseDownloadTarget + .addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed( + final java.awt.event.ActionEvent evt) { + btnBrowseDownloadTargetActionPerformed(evt); + } + }); + jPanel4.add(btnBrowseDownloadTarget, new java.awt.GridBagConstraints()); + + btnUseLocaLHome.setText(org.openide.util.NbBundle.getMessage( + DownloadDialog.class, "DownloadDialog.btnUseLocaLHome.text")); // NOI18N + btnUseLocaLHome.addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed(final java.awt.event.ActionEvent evt) { + btnUseLocaLHomeActionPerformed(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 1; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + jPanel4.add(btnUseLocaLHome, gridBagConstraints); + + btnUseLastDownload + .setText(org.openide.util.NbBundle.getMessage( + DownloadDialog.class, + "DownloadDialog.btnUseLastDownload.text")); // NOI18N + btnUseLastDownload + .addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed( + final java.awt.event.ActionEvent evt) { + btnUseLastDownloadActionPerformed(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 2; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + jPanel4.add(btnUseLastDownload, gridBagConstraints); + + jPanel1.add(jPanel4, java.awt.BorderLayout.SOUTH); + + getContentPane().add(jPanel1, java.awt.BorderLayout.NORTH); + + pnlUploadDownloadButtons.setLayout(new java.awt.FlowLayout( + java.awt.FlowLayout.RIGHT)); + + btnDownloadNow.setText(org.openide.util.NbBundle.getMessage( + DownloadDialog.class, "DownloadDialog.btnDownloadNow.text")); // NOI18N + btnDownloadNow.setEnabled(false); + btnDownloadNow.addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed(final java.awt.event.ActionEvent evt) { + btnDownloadNowActionPerformed(evt); + } + }); + pnlUploadDownloadButtons.add(btnDownloadNow); + + btnCancel.setText(org.openide.util.NbBundle.getMessage( + DownloadDialog.class, "DownloadDialog.btnCancel.text")); // NOI18N + btnCancel.addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed(final java.awt.event.ActionEvent evt) { + btnCancelActionPerformed(evt); + } + }); + pnlUploadDownloadButtons.add(btnCancel); + + getContentPane().add(pnlUploadDownloadButtons, + java.awt.BorderLayout.SOUTH); + + getAccessibleContext().setAccessibleName( + org.openide.util.NbBundle.getMessage(DownloadDialog.class, + "DownloadDialog.AccessibleContext.accessibleName")); // NOI18N + + pack(); + }// </editor-fold>//GEN-END:initComponents + + private void btnBrowseDownloadTargetActionPerformed( + final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnBrowseDownloadTargetActionPerformed + + JFileChooser localFileChooser = new JFileChooser(); + localFileChooser.setMultiSelectionEnabled(false); + localFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + localFileChooser.setDialogTitle("Select Download Target"); + localFileChooser.setLocation((int) this.getLocation().getX(), + (int) this.getLocation().getY()); + int returnVal = localFileChooser.showOpenDialog(this); + + if (returnVal == JFileChooser.APPROVE_OPTION) { + String downloadPath = localFileChooser.getSelectedFile() + .getAbsolutePath(); + txtDownloadTarget.setText(downloadPath); + setDownloadButtonState(); + } + }// GEN-LAST:event_btnBrowseDownloadTargetActionPerformed + + private void btnUseLocaLHomeActionPerformed( + final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnUseLocaLHomeActionPerformed + String target = System.getProperty("user.home"); + + if (target != null) { + txtDownloadTarget.setText(target); + } + setDownloadButtonState(); + }// GEN-LAST:event_btnUseLocaLHomeActionPerformed + + private void btnUseLastDownloadActionPerformed( + final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnUseLastDownloadActionPerformed + String target = ""; + // see if can find some get history in the transfer queue + try { + List<LocalIRODSTransfer> transfers = idropGUI.getiDropCore() + .getTransferManager().getRecentQueue(); + + // assuming most recent first + for (LocalIRODSTransfer transfer : transfers) { + // must check to match type, user, host, zone, & resource + if ((transfer.getTransferType() == TransferType.GET) + && (transfer.getTransferUserName() + .equals(idropGUI.getiDropCore() + .getIrodsAccount().getUserName())) + && (transfer.getTransferZone().equals(idropGUI + .getiDropCore().getIrodsAccount().getZone())) + && (transfer.getTransferPort() == idropGUI + .getiDropCore().getIrodsAccount().getPort()) + && (transfer.getTransferHost().equals(idropGUI + .getiDropCore().getIrodsAccount().getHost()))) { + target = transfer.getLocalAbsolutePath(); + break; + } + } + } catch (JargonException ex) { + Exceptions.printStackTrace(ex); + } + if (target != null) { + txtDownloadTarget.setText(target); + } + setDownloadButtonState(); + }// GEN-LAST:event_btnUseLastDownloadActionPerformed + + private void btnAddDownloadFileActionPerformed( + final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnAddDownloadFileActionPerformed + IRODSFinderDialog irodsFinder = new IRODSFinderDialog(idropGUI, false, + idropGUI.getiDropCore()); + irodsFinder.setTitle("Select iRODS Files and Collections for download"); + irodsFinder + .setSelectionType(IRODSFinderDialog.SelectionType.OBJS_AND_COLLS_SELECTION_MODE); + irodsFinder.setLocation((int) this.getLocation().getX(), (int) this + .getLocation().getY()); + irodsFinder.setVisible(true); + + List<String> selectedPaths = irodsFinder.getSelectedAbsolutePaths(); + for (String selectedPath : selectedPaths) { + if (selectedPath != null) { + DefaultTableModel model = (DefaultTableModel) tblFilesToDownload + .getModel(); + model.addRow(new Object[] { selectedPath }); + } + } + setDownloadButtonState(); + }// GEN-LAST:event_btnAddDownloadFileActionPerformed + + private void btnDeleteDownloadFileActionPerformed( + final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnDeleteDownloadFileActionPerformed + + int[] selectedRows = tblFilesToDownload.getSelectedRows(); + int numRowsSelected = selectedRows.length; + + // have to remove rows in reverse + for (int i = numRowsSelected - 1; i >= 0; i--) { + // for (int selectedRow: selectedRows) { + int selectedRow = selectedRows[i]; + if (selectedRow >= 0) { + DefaultTableModel model = (DefaultTableModel) tblFilesToDownload + .getModel(); + model.removeRow(selectedRow); + } + } + }// GEN-LAST:event_btnDeleteDownloadFileActionPerformed + + private void btnDownloadNowActionPerformed( + final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnDownloadNowActionPerformed + executeDownload(); + dispose(); + }// GEN-LAST:event_btnDownloadNowActionPerformed + + private void btnCancelActionPerformed(final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnCancelActionPerformed + dispose(); + }// GEN-LAST:event_btnCancelActionPerformed + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton btnAddDownloadFile; + private javax.swing.JButton btnBrowseDownloadTarget; + private javax.swing.JButton btnCancel; + private javax.swing.JButton btnDeleteDownloadFile; + private javax.swing.JButton btnDownloadNow; + private javax.swing.JButton btnUseLastDownload; + private javax.swing.JButton btnUseLocaLHome; + private javax.swing.JLabel jLabel1; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel4; + private javax.swing.JLabel lblFilesHeader; + private javax.swing.JPanel pnlAddDelete; + private javax.swing.JPanel pnlDownloadFileContainer; + private javax.swing.JPanel pnlUploadDownloadButtons; + private javax.swing.JScrollPane scrollPanelFilesToDownload; + private javax.swing.JTable tblFilesToDownload; + private javax.swing.JTextField txtDownloadTarget; + // End of variables declaration//GEN-END:variables } diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/FileInfoDialog.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/FileInfoDialog.java index e752a4b..f017858 100644 --- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/FileInfoDialog.java +++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/FileInfoDialog.java @@ -13,60 +13,70 @@ package org.irods.jargon.idrop.desktop.systraygui; import org.irods.jargon.idrop.desktop.systraygui.viscomponents.FileInfoPanel; /** - * + * * @author mikeconway */ public class FileInfoDialog extends javax.swing.JDialog { - /** Creates new form FileInfoDialog */ - public FileInfoDialog(java.awt.Frame parent, FileInfoPanel fileInfoPanel, boolean modal) { - super(parent, modal); - initComponents(); - fileInfoArea.add(fileInfoPanel); - } + /** + * + */ + private static final long serialVersionUID = -923560133655126470L; + + /** Creates new form FileInfoDialog */ + public FileInfoDialog(final java.awt.Frame parent, + final FileInfoPanel fileInfoPanel, final boolean modal) { + super(parent, modal); + initComponents(); + fileInfoArea.add(fileInfoPanel); + } - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. - */ - @SuppressWarnings("unchecked") - // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents - private void initComponents() { + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // <editor-fold defaultstate="collapsed" + // desc="Generated Code">//GEN-BEGIN:initComponents + private void initComponents() { - fileInfoArea = new javax.swing.JPanel(); - fileInfoButtons = new javax.swing.JPanel(); - btnOK = new javax.swing.JButton(); + fileInfoArea = new javax.swing.JPanel(); + fileInfoButtons = new javax.swing.JPanel(); + btnOK = new javax.swing.JButton(); - setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - setSize(new java.awt.Dimension(400, 300)); + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setSize(new java.awt.Dimension(400, 300)); - fileInfoArea.setLayout(new javax.swing.BoxLayout(fileInfoArea, javax.swing.BoxLayout.LINE_AXIS)); - getContentPane().add(fileInfoArea, java.awt.BorderLayout.CENTER); + fileInfoArea.setLayout(new javax.swing.BoxLayout(fileInfoArea, + javax.swing.BoxLayout.LINE_AXIS)); + getContentPane().add(fileInfoArea, java.awt.BorderLayout.CENTER); - fileInfoButtons.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT)); + fileInfoButtons.setLayout(new java.awt.FlowLayout( + java.awt.FlowLayout.RIGHT)); - btnOK.setText(org.openide.util.NbBundle.getMessage(FileInfoDialog.class, "FileInfoDialog.btnOK.text")); // NOI18N - btnOK.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnOKActionPerformed(evt); - } - }); - fileInfoButtons.add(btnOK); + btnOK.setText(org.openide.util.NbBundle.getMessage( + FileInfoDialog.class, "FileInfoDialog.btnOK.text")); // NOI18N + btnOK.addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed(final java.awt.event.ActionEvent evt) { + btnOKActionPerformed(evt); + } + }); + fileInfoButtons.add(btnOK); - getContentPane().add(fileInfoButtons, java.awt.BorderLayout.SOUTH); + getContentPane().add(fileInfoButtons, java.awt.BorderLayout.SOUTH); - pack(); - }// </editor-fold>//GEN-END:initComponents + pack(); + }// </editor-fold>//GEN-END:initComponents - private void btnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOKActionPerformed - this.dispose(); - }//GEN-LAST:event_btnOKActionPerformed + private void btnOKActionPerformed(final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnOKActionPerformed + dispose(); + }// GEN-LAST:event_btnOKActionPerformed - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JButton btnOK; - private javax.swing.JPanel fileInfoArea; - private javax.swing.JPanel fileInfoButtons; - // End of variables declaration//GEN-END:variables + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton btnOK; + private javax.swing.JPanel fileInfoArea; + private javax.swing.JPanel fileInfoButtons; + // End of variables declaration//GEN-END:variables } diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IDROPConfigurationPanel.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IDROPConfigurationPanel.java index 9d910a4..9a32abe 100644 --- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IDROPConfigurationPanel.java +++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IDROPConfigurationPanel.java @@ -1,4 +1,3 @@ - /* * IDROPConfigurationPanel.java * @@ -9,18 +8,22 @@ package org.irods.jargon.idrop.desktop.systraygui; import java.awt.Color; import java.awt.Cursor; import java.awt.Dimension; -import java.awt.Image; import java.awt.Toolkit; import java.awt.event.ItemEvent; -import java.net.URL; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; -import java.util.Set; -import javax.swing.*; + +import javax.swing.DefaultComboBoxModel; +import javax.swing.JFileChooser; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JTable; +import javax.swing.ListSelectionModel; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; + import org.irods.jargon.core.connection.DefaultPropertiesJargonConfig; import org.irods.jargon.core.connection.IRODSAccount; import org.irods.jargon.core.connection.JargonProperties; @@ -34,1997 +37,2571 @@ import org.irods.jargon.idrop.exceptions.IdropException; import org.irods.jargon.idrop.exceptions.IdropRuntimeException; import org.irods.jargon.idrop.finder.IRODSFinderDialog; import org.irods.jargon.transfer.dao.domain.FrequencyType; -import org.irods.jargon.transfer.dao.domain.LocalIRODSTransfer; import org.irods.jargon.transfer.dao.domain.Synchronization; import org.irods.jargon.transfer.dao.domain.SynchronizationType; import org.irods.jargon.transfer.dao.domain.TransferStatus; -import org.irods.jargon.transfer.engine.synch.ConflictingSynchException; import org.irods.jargon.transfer.engine.synch.SynchException; import org.irods.jargon.transfer.engine.synch.SynchManagerService; import org.irods.jargon.transfer.util.HibernateUtil; -import org.openide.util.Exceptions; import org.slf4j.LoggerFactory; /** * Tools/Preferences dialog to set preferences - * + * * @author mikeconway */ public class IDROPConfigurationPanel extends javax.swing.JDialog { - private final IDROPCore idropCore; - private static final org.slf4j.Logger log = LoggerFactory.getLogger(IDROPConfigurationPanel.class); - private JTable jTableSynch = null; - private Synchronization selectedSynchronization = null; - private DateFormat dateFormat = SimpleDateFormat.getDateTimeInstance(); - private final iDrop idropGui; - private boolean initializing = true; - - /** - * Creates new form IDROPConfigurationPanel - */ - public IDROPConfigurationPanel(java.awt.Frame parent, boolean modal, IDROPCore idropCore) { - super(parent, modal); - this.idropCore = idropCore; - this.idropGui = (iDrop) parent; - initComponents(); - initWithConfigData(); - } - - private boolean checkIfSynchChanged() throws IdropRuntimeException { - // compare data and update synch first if necessary - - boolean areEqual = true; - - if (!selectedSynchronization.getLocalSynchDirectory().equals(txtLocalPath.getText())) { - areEqual = false; - } - - if (!selectedSynchronization.getName().equals(txtSynchName.getText())) { - areEqual = false; - } - - if (!selectedSynchronization.getIrodsSynchDirectory().equals(txtIrodsPath.getText())) { - areEqual = false; - } - - SynchronizationType currentSynchronizationType = getSynchTypeFromGUI(); - - if (currentSynchronizationType != selectedSynchronization.getSynchronizationMode()) { - areEqual = false; - } - - FrequencyType currentFrequencyType = null; - currentFrequencyType = getSynchFrequencyFromGUI(); - - if (selectedSynchronization.getFrequencyType() != currentFrequencyType) { - areEqual = false; - } - - return areEqual; - } - - private FrequencyType getSynchFrequencyFromGUI() { - FrequencyType currentFrequencyType = null; - if (jcomboSynchFrequency.getSelectedIndex() == 0) { - currentFrequencyType = FrequencyType.EVERY_HOUR; - } else if (jcomboSynchFrequency.getSelectedIndex() == 1) { - currentFrequencyType = FrequencyType.EVERY_WEEK; - } else if (jcomboSynchFrequency.getSelectedIndex() == 2) { - currentFrequencyType = FrequencyType.EVERY_DAY; - } else if (jcomboSynchFrequency.getSelectedIndex() == 3) { - currentFrequencyType = FrequencyType.EVERY_TWO_MINUTES; - } - return currentFrequencyType; - } - - private SynchronizationType getSynchTypeFromGUI() throws IdropRuntimeException { - SynchronizationType currentSynchronizationType; - if (radioBackup.isSelected()) { - currentSynchronizationType = SynchronizationType.ONE_WAY_LOCAL_TO_IRODS; - } else if (radioFeed.isSelected()) { - currentSynchronizationType = SynchronizationType.ONE_WAY_IRODS_TO_LOCAL; - } else if (radioSynch.isSelected()) { - currentSynchronizationType = SynchronizationType.BI_DIRECTIONAL; - } else { - log.error("unknown synchronization type in GUI"); - throw new IdropRuntimeException("unknown synchroization type in GUI"); - } - return currentSynchronizationType; - } - - /** - * This method is called from within the constructor to initialize the form. WARNING: Do NOT - * modify this code. The content of this method is always regenerated by the Form Editor. - */ - @SuppressWarnings("unchecked") - // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents - private void initComponents() { - java.awt.GridBagConstraints gridBagConstraints; - - buttonGroupSynchMode = new javax.swing.ButtonGroup(); - pnlTop = new javax.swing.JPanel(); - pnlCenter = new javax.swing.JPanel(); - tabConfig = new javax.swing.JTabbedPane(); - pnlConfigIdrop = new javax.swing.JPanel(); - checkShowGUI = new javax.swing.JCheckBox(); - checkShowFileProgress = new javax.swing.JCheckBox(); - pnlConfigGrids = new javax.swing.JPanel(); - pnlCurrentGrid = new javax.swing.JPanel(); - lblHostLabel = new javax.swing.JLabel(); - lblHost = new javax.swing.JLabel(); - lblPortLabel = new javax.swing.JLabel(); - lblPort = new javax.swing.JLabel(); - lblZoneLabel = new javax.swing.JLabel(); - lblZone = new javax.swing.JLabel(); - lblResourceLabel = new javax.swing.JLabel(); - lblUserNameLabel = new javax.swing.JLabel(); - lblUserName = new javax.swing.JLabel(); - pnlCurrentGridToolbar = new javax.swing.JPanel(); - btnLogout = new javax.swing.JButton(); - btnChangePassword = new javax.swing.JButton(); - comboPrefsDefaultResource = new javax.swing.JComboBox(); - pnlConfigTransfers = new javax.swing.JPanel(); - pnlTransferManagement = new javax.swing.JPanel(); - checkLogSuccessfulTransfer = new javax.swing.JCheckBox(); - checkVerifyChecksumOnTransfer = new javax.swing.JCheckBox(); - checkAllowRerouting = new javax.swing.JCheckBox(); - checkConnectionRestart = new javax.swing.JCheckBox(); - plnPipelineConfiguration = new javax.swing.JPanel(); - lblIrodsSocketTimeout = new javax.swing.JLabel(); - spinnerIrodsSocketTimeout = new javax.swing.JSpinner(); - pnlParallelTransferOptions = new javax.swing.JPanel(); - checkAllowParallelTransfers = new javax.swing.JCheckBox(); - checkUseNIOForParallelTransfers = new javax.swing.JCheckBox(); - checkUseExecutorPool = new javax.swing.JCheckBox(); - lblIrodsParallelSocketTimeout = new javax.swing.JLabel(); - spinnerIrodsParallelSocketTimeout = new javax.swing.JSpinner(); - lblMaximumParallelTransferThreads = new javax.swing.JLabel(); - spinnerIrodsMaxParallelThreads = new javax.swing.JSpinner(); - pnlBuffers = new javax.swing.JPanel(); - lblInternalInputBufferSize = new javax.swing.JLabel(); - txtInternalInputBufferSize = new javax.swing.JTextField(); - lblInternalOutputBufferSize = new javax.swing.JLabel(); - txtInternalOutputBufferSize = new javax.swing.JTextField(); - lblLocalFileInputBufferSize = new javax.swing.JLabel(); - txtLocalFileInputBufferSize = new javax.swing.JTextField(); - lblLocalFileOutputBufferSize = new javax.swing.JLabel(); - txtLocalFileOutputBufferSize = new javax.swing.JTextField(); - lblPutBufferSize = new javax.swing.JLabel(); - txtPutBufferSize = new javax.swing.JTextField(); - lblGetBufferSize = new javax.swing.JLabel(); - txtGetBufferSize = new javax.swing.JTextField(); - lblIputToOutputCopyBufferSize = new javax.swing.JLabel(); - txtInputToOutputCopyBufferSize = new javax.swing.JTextField(); - lblInternalCacheBufferSize = new javax.swing.JLabel(); - txtInternalCacheBufferSize = new javax.swing.JTextField(); - btnRestoreDefaults = new javax.swing.JButton(); - btnApplyPipelineConfig = new javax.swing.JButton(); - pnlConfigSynch = new javax.swing.JPanel(); - pnlConfigSynchListing = new javax.swing.JPanel(); - pnlSynchRefresh = new javax.swing.JPanel(); - btnRefreshSynch = new javax.swing.JButton(); - scrollSynchTable = new javax.swing.JScrollPane(); - pnlConfigSynchDetails = new javax.swing.JPanel(); - pnlSynchData = new javax.swing.JPanel(); - pnlSynchName = new javax.swing.JPanel(); - lblSynchName = new javax.swing.JLabel(); - txtSynchName = new javax.swing.JTextField(); - lblSynchDateLabel = new javax.swing.JLabel(); - lblSynchDate = new javax.swing.JLabel(); - pnlSynchIcon = new javax.swing.JPanel(); - lblSynchStatus = new javax.swing.JLabel(); - pnlLocalSynch = new javax.swing.JPanel(); - txtLocalPath = new javax.swing.JTextField(); - btnChooseLocalSynch = new javax.swing.JButton(); - pnlSynchMode = new javax.swing.JPanel(); - jLabel1 = new javax.swing.JLabel(); - radioBackup = new javax.swing.JRadioButton(); - radioFeed = new javax.swing.JRadioButton(); - radioSynch = new javax.swing.JRadioButton(); - pnlSynchFrequency = new javax.swing.JPanel(); - jLabel5 = new javax.swing.JLabel(); - jcomboSynchFrequency = new javax.swing.JComboBox(); - pnlIrodsSynch = new javax.swing.JPanel(); - txtIrodsPath = new javax.swing.JTextField(); - btnChooseIrodsSynch = new javax.swing.JButton(); - panelSynchToolbar = new javax.swing.JPanel(); - btnDeleteSynch = new javax.swing.JButton(); - btnNewSynch = new javax.swing.JButton(); - btnUpdateSynch = new javax.swing.JButton(); - btnSynchNow = new javax.swing.JButton(); - pnlBottom = new javax.swing.JPanel(); - btnOK = new javax.swing.JButton(); - - setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - setTitle(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.title")); // NOI18N - - org.jdesktop.layout.GroupLayout pnlTopLayout = new org.jdesktop.layout.GroupLayout(pnlTop); - pnlTop.setLayout(pnlTopLayout); - pnlTopLayout.setHorizontalGroup( - pnlTopLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(0, 1067, Short.MAX_VALUE) - ); - pnlTopLayout.setVerticalGroup( - pnlTopLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(0, 0, Short.MAX_VALUE) - ); - - getContentPane().add(pnlTop, java.awt.BorderLayout.NORTH); - - pnlConfigIdrop.setLayout(new java.awt.GridBagLayout()); - - checkShowGUI.setMnemonic('s'); - checkShowGUI.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.checkShowGUI.text")); // NOI18N - checkShowGUI.setToolTipText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.checkShowGUI.toolTipText")); // NOI18N - checkShowGUI.addItemListener(new java.awt.event.ItemListener() { - public void itemStateChanged(java.awt.event.ItemEvent evt) { - checkShowGUIItemStateChanged(evt); - } - }); - checkShowGUI.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - checkShowGUIActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 0; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - pnlConfigIdrop.add(checkShowGUI, gridBagConstraints); - - checkShowFileProgress.setMnemonic('w'); - checkShowFileProgress.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.checkShowFileProgress.text")); // NOI18N - checkShowFileProgress.setToolTipText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.checkShowFileProgress.toolTipText")); // NOI18N - checkShowFileProgress.addItemListener(new java.awt.event.ItemListener() { - public void itemStateChanged(java.awt.event.ItemEvent evt) { - checkShowFileProgressItemStateChanged(evt); - } - }); - checkShowFileProgress.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - checkShowFileProgressActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - pnlConfigIdrop.add(checkShowFileProgress, gridBagConstraints); - - tabConfig.addTab(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.pnlConfigIdrop.TabConstraints.tabTitle"), pnlConfigIdrop); // NOI18N - - pnlConfigGrids.setLayout(new java.awt.BorderLayout()); - - pnlCurrentGrid.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.pnlCurrentGrid.border.title"))); // NOI18N - pnlCurrentGrid.setLayout(new java.awt.GridBagLayout()); - - lblHostLabel.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N - lblHostLabel.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.lblHostLabel.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; - pnlCurrentGrid.add(lblHostLabel, gridBagConstraints); - - lblHost.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.lblHost.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - pnlCurrentGrid.add(lblHost, gridBagConstraints); - lblHost.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.lblHost.AccessibleContext.accessibleDescription")); // NOI18N - - lblPortLabel.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N - lblPortLabel.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.lblPortLabel.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; - pnlCurrentGrid.add(lblPortLabel, gridBagConstraints); - - lblPort.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.lblPort.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 1; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - pnlCurrentGrid.add(lblPort, gridBagConstraints); - lblPort.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.lblPort.AccessibleContext.accessibleDescription")); // NOI18N - - lblZoneLabel.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N - lblZoneLabel.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.lblZoneLabel.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; - pnlCurrentGrid.add(lblZoneLabel, gridBagConstraints); - - lblZone.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.lblZone.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - pnlCurrentGrid.add(lblZone, gridBagConstraints); - lblZone.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.lblZone.AccessibleContext.accessibleDescription")); // NOI18N - - lblResourceLabel.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N - lblResourceLabel.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.lblResourceLabel.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 4; - gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; - pnlCurrentGrid.add(lblResourceLabel, gridBagConstraints); - - lblUserNameLabel.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N - lblUserNameLabel.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.lblUserNameLabel.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 3; - gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; - pnlCurrentGrid.add(lblUserNameLabel, gridBagConstraints); - - lblUserName.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.lblUserName.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 3; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - pnlCurrentGrid.add(lblUserName, gridBagConstraints); - lblUserName.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.lblUserName.AccessibleContext.accessibleName")); // NOI18N - - btnLogout.setMnemonic('l'); - btnLogout.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.btnLogout.text")); // NOI18N - btnLogout.setToolTipText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.btnLogout.toolTipText")); // NOI18N - btnLogout.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnLogoutActionPerformed(evt); - } - }); - pnlCurrentGridToolbar.add(btnLogout); - - btnChangePassword.setMnemonic('c'); - btnChangePassword.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.btnChangePassword.text")); // NOI18N - btnChangePassword.setToolTipText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.btnChangePassword.toolTipText")); // NOI18N - btnChangePassword.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnChangePasswordActionPerformed(evt); - } - }); - pnlCurrentGridToolbar.add(btnChangePassword); - - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 5; - gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; - gridBagConstraints.insets = new java.awt.Insets(20, 0, 0, 0); - pnlCurrentGrid.add(pnlCurrentGridToolbar, gridBagConstraints); - - comboPrefsDefaultResource.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); - comboPrefsDefaultResource.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - comboPrefsDefaultResourceActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 4; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - pnlCurrentGrid.add(comboPrefsDefaultResource, gridBagConstraints); - - pnlConfigGrids.add(pnlCurrentGrid, java.awt.BorderLayout.CENTER); - - tabConfig.addTab(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.pnlConfigGrids.TabConstraints.tabTitle"), pnlConfigGrids); // NOI18N - - pnlConfigTransfers.setLayout(new java.awt.GridBagLayout()); - - pnlTransferManagement.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.pnlTransferManagement.border.title"))); // NOI18N - pnlTransferManagement.setLayout(new javax.swing.BoxLayout(pnlTransferManagement, javax.swing.BoxLayout.PAGE_AXIS)); - - checkLogSuccessfulTransfer.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.checkLogSuccessfulTransfer.text")); // NOI18N - checkLogSuccessfulTransfer.setToolTipText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.checkLogSuccessfulTransfer.toolTipText")); // NOI18N - checkLogSuccessfulTransfer.addItemListener(new java.awt.event.ItemListener() { - public void itemStateChanged(java.awt.event.ItemEvent evt) { - checkLogSuccessfulTransferItemStateChanged(evt); - } - }); - checkLogSuccessfulTransfer.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - checkLogSuccessfulTransferActionPerformed(evt); - } - }); - pnlTransferManagement.add(checkLogSuccessfulTransfer); - - checkVerifyChecksumOnTransfer.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.checkVerifyChecksumOnTransfer.text")); // NOI18N - checkVerifyChecksumOnTransfer.addItemListener(new java.awt.event.ItemListener() { - public void itemStateChanged(java.awt.event.ItemEvent evt) { - checkVerifyChecksumOnTransferItemStateChanged(evt); - } - }); - checkVerifyChecksumOnTransfer.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - checkVerifyChecksumOnTransferActionPerformed(evt); - } - }); - pnlTransferManagement.add(checkVerifyChecksumOnTransfer); - - checkAllowRerouting.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.checkAllowRerouting.text")); // NOI18N - checkAllowRerouting.setToolTipText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.checkAllowRerouting.toolTipText")); // NOI18N - checkAllowRerouting.addItemListener(new java.awt.event.ItemListener() { - public void itemStateChanged(java.awt.event.ItemEvent evt) { - checkAllowReroutingItemStateChanged(evt); - } - }); - pnlTransferManagement.add(checkAllowRerouting); - - checkConnectionRestart.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.checkConnectionRestart.text")); // NOI18N - checkConnectionRestart.setToolTipText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.checkConnectionRestart.toolTipText")); // NOI18N - checkConnectionRestart.addItemListener(new java.awt.event.ItemListener() { - public void itemStateChanged(java.awt.event.ItemEvent evt) { - checkConnectionRestartItemStateChanged(evt); - } - }); - checkConnectionRestart.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - checkConnectionRestartActionPerformed(evt); - } - }); - pnlTransferManagement.add(checkConnectionRestart); - - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 0; - gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; - gridBagConstraints.gridheight = java.awt.GridBagConstraints.RELATIVE; - gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; - pnlConfigTransfers.add(pnlTransferManagement, gridBagConstraints); - - plnPipelineConfiguration.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.plnPipelineConfiguration.border.title"))); // NOI18N - plnPipelineConfiguration.setLayout(new java.awt.GridBagLayout()); - - lblIrodsSocketTimeout.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.lblIrodsSocketTimeout.text")); // NOI18N - lblIrodsSocketTimeout.setPreferredSize(null); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; - plnPipelineConfiguration.add(lblIrodsSocketTimeout, gridBagConstraints); - - spinnerIrodsSocketTimeout.setModel(new javax.swing.SpinnerNumberModel(0, 0, 600, 10)); - spinnerIrodsSocketTimeout.setToolTipText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.spinnerIrodsSocketTimeout.toolTipText")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - plnPipelineConfiguration.add(spinnerIrodsSocketTimeout, gridBagConstraints); - - pnlParallelTransferOptions.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.pnlParallelTransferOptions.border.title"))); // NOI18N - pnlParallelTransferOptions.setLayout(new java.awt.GridBagLayout()); - - checkAllowParallelTransfers.setMnemonic('p'); - checkAllowParallelTransfers.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.checkAllowParallelTransfers.text")); // NOI18N - checkAllowParallelTransfers.setToolTipText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.checkAllowParallelTransfers.toolTipText")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 0; - gridBagConstraints.gridwidth = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - pnlParallelTransferOptions.add(checkAllowParallelTransfers, gridBagConstraints); - - checkUseNIOForParallelTransfers.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.checkUseNIOForParallelTransfers.text")); // NOI18N - checkUseNIOForParallelTransfers.setToolTipText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.checkUseNIOForParallelTransfers.toolTipText")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - gridBagConstraints.gridwidth = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - pnlParallelTransferOptions.add(checkUseNIOForParallelTransfers, gridBagConstraints); - - checkUseExecutorPool.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.checkUseExecutorPool.text")); // NOI18N - checkUseExecutorPool.addItemListener(new java.awt.event.ItemListener() { - public void itemStateChanged(java.awt.event.ItemEvent evt) { - checkUseExecutorPoolItemStateChanged(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - pnlParallelTransferOptions.add(checkUseExecutorPool, gridBagConstraints); - - lblIrodsParallelSocketTimeout.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.lblIrodsParallelSocketTimeout.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 6; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - gridBagConstraints.insets = new java.awt.Insets(28, 0, 0, 0); - pnlParallelTransferOptions.add(lblIrodsParallelSocketTimeout, gridBagConstraints); - - spinnerIrodsParallelSocketTimeout.setModel(new javax.swing.SpinnerNumberModel(0, 0, 600, 10)); - spinnerIrodsParallelSocketTimeout.setToolTipText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.spinnerIrodsParallelSocketTimeout.toolTipText")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 6; - gridBagConstraints.ipadx = 159; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; - gridBagConstraints.insets = new java.awt.Insets(22, 0, 0, 0); - pnlParallelTransferOptions.add(spinnerIrodsParallelSocketTimeout, gridBagConstraints); - - lblMaximumParallelTransferThreads.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.lblMaximumParallelTransferThreads.text")); // NOI18N - lblMaximumParallelTransferThreads.setToolTipText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.lblMaximumParallelTransferThreads.toolTipText")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 7; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; - gridBagConstraints.insets = new java.awt.Insets(6, 180, 0, 0); - pnlParallelTransferOptions.add(lblMaximumParallelTransferThreads, gridBagConstraints); - - spinnerIrodsMaxParallelThreads.setModel(new javax.swing.SpinnerNumberModel(4, 0, 16, 1)); - spinnerIrodsMaxParallelThreads.setToolTipText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.spinnerIrodsMaxParallelThreads.toolTipText")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 7; - gridBagConstraints.gridheight = 2; - gridBagConstraints.ipadx = 171; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; - gridBagConstraints.insets = new java.awt.Insets(0, 0, 22, 0); - pnlParallelTransferOptions.add(spinnerIrodsMaxParallelThreads, gridBagConstraints); - - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - plnPipelineConfiguration.add(pnlParallelTransferOptions, gridBagConstraints); - - pnlBuffers.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.pnlBuffers.border.title"))); // NOI18N - pnlBuffers.setToolTipText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.pnlBuffers.toolTipText")); // NOI18N - pnlBuffers.setLayout(new java.awt.GridBagLayout()); - - lblInternalInputBufferSize.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.lblInternalInputBufferSize.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 0; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - pnlBuffers.add(lblInternalInputBufferSize, gridBagConstraints); - - txtInternalInputBufferSize.setColumns(20); - txtInternalInputBufferSize.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.txtInternalInputBufferSize.text")); // NOI18N - txtInternalInputBufferSize.setToolTipText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.txtInternalInputBufferSize.toolTipText")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 2; - gridBagConstraints.gridy = 0; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - pnlBuffers.add(txtInternalInputBufferSize, gridBagConstraints); - - lblInternalOutputBufferSize.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.lblInternalOutputBufferSize.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - pnlBuffers.add(lblInternalOutputBufferSize, gridBagConstraints); - - txtInternalOutputBufferSize.setColumns(20); - txtInternalOutputBufferSize.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.txtInternalOutputBufferSize.text")); // NOI18N - txtInternalOutputBufferSize.setToolTipText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.txtInternalOutputBufferSize.toolTipText")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 2; - gridBagConstraints.gridy = 1; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - pnlBuffers.add(txtInternalOutputBufferSize, gridBagConstraints); - - lblLocalFileInputBufferSize.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.lblLocalFileInputBufferSize.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; - pnlBuffers.add(lblLocalFileInputBufferSize, gridBagConstraints); - - txtLocalFileInputBufferSize.setColumns(20); - txtLocalFileInputBufferSize.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.txtLocalFileInputBufferSize.text")); // NOI18N - txtLocalFileInputBufferSize.setToolTipText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.txtLocalFileInputBufferSize.toolTipText")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 2; - gridBagConstraints.gridy = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - pnlBuffers.add(txtLocalFileInputBufferSize, gridBagConstraints); - - lblLocalFileOutputBufferSize.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.lblLocalFileOutputBufferSize.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 3; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; - pnlBuffers.add(lblLocalFileOutputBufferSize, gridBagConstraints); - - txtLocalFileOutputBufferSize.setColumns(20); - txtLocalFileOutputBufferSize.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.txtLocalFileOutputBufferSize.text")); // NOI18N - txtLocalFileOutputBufferSize.setToolTipText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.txtLocalFileOutputBufferSize.toolTipText")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 2; - gridBagConstraints.gridy = 3; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - pnlBuffers.add(txtLocalFileOutputBufferSize, gridBagConstraints); - - lblPutBufferSize.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.lblPutBufferSize.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 5; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; - pnlBuffers.add(lblPutBufferSize, gridBagConstraints); - - txtPutBufferSize.setColumns(20); - txtPutBufferSize.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.txtPutBufferSize.text")); // NOI18N - txtPutBufferSize.setToolTipText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.txtPutBufferSize.toolTipText")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 2; - gridBagConstraints.gridy = 5; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - pnlBuffers.add(txtPutBufferSize, gridBagConstraints); - - lblGetBufferSize.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.lblGetBufferSize.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 4; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; - pnlBuffers.add(lblGetBufferSize, gridBagConstraints); - - txtGetBufferSize.setColumns(20); - txtGetBufferSize.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.txtGetBufferSize.text")); // NOI18N - txtGetBufferSize.setToolTipText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.txtGetBufferSize.toolTipText")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 2; - gridBagConstraints.gridy = 4; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - pnlBuffers.add(txtGetBufferSize, gridBagConstraints); - - lblIputToOutputCopyBufferSize.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.lblIputToOutputCopyBufferSize.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 6; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; - pnlBuffers.add(lblIputToOutputCopyBufferSize, gridBagConstraints); - - txtInputToOutputCopyBufferSize.setColumns(20); - txtInputToOutputCopyBufferSize.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.txtInputToOutputCopyBufferSize.text")); // NOI18N - txtInputToOutputCopyBufferSize.setToolTipText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.txtInputToOutputCopyBufferSize.toolTipText")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 2; - gridBagConstraints.gridy = 6; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - pnlBuffers.add(txtInputToOutputCopyBufferSize, gridBagConstraints); - - lblInternalCacheBufferSize.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.lblInternalCacheBufferSize.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 7; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; - pnlBuffers.add(lblInternalCacheBufferSize, gridBagConstraints); - - txtInternalCacheBufferSize.setColumns(20); - txtInternalCacheBufferSize.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.txtInternalCacheBufferSize.text")); // NOI18N - txtInternalCacheBufferSize.setToolTipText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.txtInternalCacheBufferSize.toolTipText")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 2; - gridBagConstraints.gridy = 7; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - pnlBuffers.add(txtInternalCacheBufferSize, gridBagConstraints); - - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 1; - gridBagConstraints.gridwidth = 3; - gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; - plnPipelineConfiguration.add(pnlBuffers, gridBagConstraints); - - btnRestoreDefaults.setMnemonic('a'); - btnRestoreDefaults.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.btnRestoreDefaults.text")); // NOI18N - btnRestoreDefaults.setToolTipText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.btnRestoreDefaults.toolTipText")); // NOI18N - btnRestoreDefaults.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnRestoreDefaultsActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 2; - gridBagConstraints.gridy = 3; - plnPipelineConfiguration.add(btnRestoreDefaults, gridBagConstraints); - - btnApplyPipelineConfig.setMnemonic('a'); - btnApplyPipelineConfig.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.btnApplyPipelineConfig.text")); // NOI18N - btnApplyPipelineConfig.setToolTipText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.btnApplyPipelineConfig.toolTipText")); // NOI18N - btnApplyPipelineConfig.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnApplyPipelineConfigActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 3; - gridBagConstraints.gridy = 3; - plnPipelineConfiguration.add(btnApplyPipelineConfig, gridBagConstraints); - - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 2; - gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; - gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; - pnlConfigTransfers.add(plnPipelineConfiguration, gridBagConstraints); - - tabConfig.addTab(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.pnlConfigTransfers.TabConstraints.tabTitle"), pnlConfigTransfers); // NOI18N - - pnlConfigSynch.addComponentListener(new java.awt.event.ComponentAdapter() { - public void componentShown(java.awt.event.ComponentEvent evt) { - pnlConfigSynchComponentShown(evt); - } - }); - pnlConfigSynch.setLayout(new java.awt.BorderLayout()); - - pnlConfigSynchListing.setMinimumSize(new java.awt.Dimension(23, 100)); - pnlConfigSynchListing.setLayout(new java.awt.BorderLayout()); - - btnRefreshSynch.setMnemonic('r'); - btnRefreshSynch.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.btnRefreshSynch.text")); // NOI18N - btnRefreshSynch.setToolTipText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.btnRefreshSynch.toolTipText")); // NOI18N - btnRefreshSynch.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnRefreshSynchActionPerformed(evt); - } - }); - pnlSynchRefresh.add(btnRefreshSynch); - - pnlConfigSynchListing.add(pnlSynchRefresh, java.awt.BorderLayout.NORTH); - - scrollSynchTable.setMinimumSize(new java.awt.Dimension(23, 100)); - scrollSynchTable.setPreferredSize(new java.awt.Dimension(100, 100)); - pnlConfigSynchListing.add(scrollSynchTable, java.awt.BorderLayout.CENTER); - - pnlConfigSynch.add(pnlConfigSynchListing, java.awt.BorderLayout.CENTER); - - pnlConfigSynchDetails.setLayout(new java.awt.BorderLayout()); - - pnlSynchData.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)); - pnlSynchData.setLayout(new java.awt.GridBagLayout()); - - pnlSynchName.setLayout(new java.awt.GridBagLayout()); - - lblSynchName.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.lblSynchName.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; - pnlSynchName.add(lblSynchName, gridBagConstraints); - - txtSynchName.setColumns(40); - txtSynchName.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.txtSynchName.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 1; - gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - pnlSynchName.add(txtSynchName, gridBagConstraints); - - lblSynchDateLabel.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.lblSynchDateLabel.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; - pnlSynchName.add(lblSynchDateLabel, gridBagConstraints); - - lblSynchDate.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.lblSynchDate.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - pnlSynchName.add(lblSynchDate, gridBagConstraints); - - lblSynchStatus.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.lblSynchStatus.text")); // NOI18N - lblSynchStatus.setMaximumSize(null); - lblSynchStatus.setMinimumSize(new java.awt.Dimension(10, 10)); - lblSynchStatus.setPreferredSize(new java.awt.Dimension(10, 10)); - pnlSynchIcon.add(lblSynchStatus); - - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 2; - gridBagConstraints.gridy = 2; - gridBagConstraints.gridwidth = 3; - gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; - pnlSynchName.add(pnlSynchIcon, gridBagConstraints); - - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 0; - gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(20, 20, 30, 20); - pnlSynchData.add(pnlSynchName, gridBagConstraints); - - txtLocalPath.setColumns(80); - txtLocalPath.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.txtLocalPath.text")); // NOI18N - txtLocalPath.setToolTipText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.txtLocalPath.toolTipText")); // NOI18N - txtLocalPath.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - txtLocalPathActionPerformed(evt); - } - }); - pnlLocalSynch.add(txtLocalPath); - - btnChooseLocalSynch.setMnemonic('c'); - btnChooseLocalSynch.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.btnChooseLocalSynch.text")); // NOI18N - btnChooseLocalSynch.setToolTipText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.btnChooseLocalSynch.toolTipText")); // NOI18N - btnChooseLocalSynch.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnChooseLocalSynchActionPerformed(evt); - } - }); - pnlLocalSynch.add(btnChooseLocalSynch); - - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - gridBagConstraints.gridwidth = 9; - gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 10); - pnlSynchData.add(pnlLocalSynch, gridBagConstraints); - - pnlSynchMode.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); - pnlSynchMode.setLayout(new java.awt.GridLayout(0, 1)); - - jLabel1.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.jLabel1.text")); // NOI18N - pnlSynchMode.add(jLabel1); - - buttonGroupSynchMode.add(radioBackup); - radioBackup.setSelected(true); - radioBackup.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.radioBackup.text")); // NOI18N - pnlSynchMode.add(radioBackup); - - buttonGroupSynchMode.add(radioFeed); - radioFeed.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.radioFeed.text")); // NOI18N - radioFeed.setEnabled(false); - pnlSynchMode.add(radioFeed); - - buttonGroupSynchMode.add(radioSynch); - radioSynch.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.radioSynch.text")); // NOI18N - radioSynch.setEnabled(false); - pnlSynchMode.add(radioSynch); - - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 2; - gridBagConstraints.gridwidth = 9; - gridBagConstraints.gridheight = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; - gridBagConstraints.insets = new java.awt.Insets(20, 20, 20, 20); - pnlSynchData.add(pnlSynchMode, gridBagConstraints); - - pnlSynchFrequency.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); - pnlSynchFrequency.setLayout(new java.awt.GridLayout(0, 1)); - - jLabel5.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.jLabel5.text")); // NOI18N - pnlSynchFrequency.add(jLabel5); - - jcomboSynchFrequency.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Hourly", "Weekly", "Daily", "Every 2 Minutes (testing)", "", "" })); - jcomboSynchFrequency.setToolTipText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.jcomboSynchFrequency.toolTipText")); // NOI18N - pnlSynchFrequency.add(jcomboSynchFrequency); - - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 4; - gridBagConstraints.gridwidth = 9; - gridBagConstraints.gridheight = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; - gridBagConstraints.insets = new java.awt.Insets(20, 20, 20, 20); - pnlSynchData.add(pnlSynchFrequency, gridBagConstraints); - - txtIrodsPath.setColumns(80); - txtIrodsPath.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.txtIrodsPath.text")); // NOI18N - txtIrodsPath.setToolTipText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.txtIrodsPath.toolTipText")); // NOI18N - txtIrodsPath.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - txtIrodsPathActionPerformed(evt); - } - }); - pnlIrodsSynch.add(txtIrodsPath); - - btnChooseIrodsSynch.setMnemonic('i'); - btnChooseIrodsSynch.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.btnChooseIrodsSynch.text")); // NOI18N - btnChooseIrodsSynch.setToolTipText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.btnChooseIrodsSynch.toolTipText")); // NOI18N - btnChooseIrodsSynch.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnChooseIrodsSynchActionPerformed(evt); - } - }); - pnlIrodsSynch.add(btnChooseIrodsSynch); - - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 6; - gridBagConstraints.gridwidth = 9; - gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 10); - pnlSynchData.add(pnlIrodsSynch, gridBagConstraints); - - pnlConfigSynchDetails.add(pnlSynchData, java.awt.BorderLayout.CENTER); - - btnDeleteSynch.setMnemonic('d'); - btnDeleteSynch.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.btnDeleteSynch.text")); // NOI18N - btnDeleteSynch.setToolTipText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.btnDeleteSynch.toolTipText")); // NOI18N - btnDeleteSynch.setEnabled(false); - btnDeleteSynch.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnDeleteSynchActionPerformed(evt); - } - }); - panelSynchToolbar.add(btnDeleteSynch); - - btnNewSynch.setMnemonic('n'); - btnNewSynch.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.btnNewSynch.text")); // NOI18N - btnNewSynch.setToolTipText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.btnNewSynch.toolTipText")); // NOI18N - btnNewSynch.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnNewSynchActionPerformed(evt); - } - }); - panelSynchToolbar.add(btnNewSynch); - - btnUpdateSynch.setMnemonic('u'); - btnUpdateSynch.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.btnUpdateSynch.text")); // NOI18N - btnUpdateSynch.setToolTipText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.btnUpdateSynch.toolTipText")); // NOI18N - btnUpdateSynch.setEnabled(false); - btnUpdateSynch.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnUpdateSynchActionPerformed(evt); - } - }); - panelSynchToolbar.add(btnUpdateSynch); - - btnSynchNow.setMnemonic('s'); - btnSynchNow.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.btnSynchNow.text")); // NOI18N - btnSynchNow.setToolTipText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.btnSynchNow.toolTipText")); // NOI18N - btnSynchNow.setEnabled(false); - btnSynchNow.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnSynchNowActionPerformed(evt); - } - }); - panelSynchToolbar.add(btnSynchNow); - - pnlConfigSynchDetails.add(panelSynchToolbar, java.awt.BorderLayout.SOUTH); - - pnlConfigSynch.add(pnlConfigSynchDetails, java.awt.BorderLayout.SOUTH); - - tabConfig.addTab(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.pnlConfigSynch.TabConstraints.tabTitle"), pnlConfigSynch); // NOI18N - - pnlCenter.add(tabConfig); - - getContentPane().add(pnlCenter, java.awt.BorderLayout.CENTER); - - pnlBottom.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT)); - - btnOK.setMnemonic('O'); - btnOK.setText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.btnOK.text")); // NOI18N - btnOK.setToolTipText(org.openide.util.NbBundle.getMessage(IDROPConfigurationPanel.class, "IDROPConfigurationPanel.btnOK.toolTipText")); // NOI18N - btnOK.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnOKActionPerformed(evt); - } - }); - pnlBottom.add(btnOK); - - getContentPane().add(pnlBottom, java.awt.BorderLayout.SOUTH); - - pack(); - }// </editor-fold>//GEN-END:initComponents - - /** - * Refresh the displayed synch - * - * @param evt - */ - private void btnRefreshSynchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRefreshSynchActionPerformed - refreshSynchConfigPanel(); - }//GEN-LAST:event_btnRefreshSynchActionPerformed - - private void checkShowFileProgressActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkShowFileProgressActionPerformed - // - }//GEN-LAST:event_checkShowFileProgressActionPerformed - - private void checkShowGUIItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_checkShowGUIItemStateChanged - - boolean isSelected = false; - if (evt.getStateChange() == ItemEvent.SELECTED) { - isSelected = true; - } - log.info("updating show gui at startup to:{}", isSelected); - try { - idropCore.getIdropConfigurationService().updateConfig(IdropConfigurationService.SHOW_GUI, Boolean.toString(isSelected)); - } catch (IdropException ex) { - log.error("error setting show gui property", ex); - throw new IdropRuntimeException(ex); - } - }//GEN-LAST:event_checkShowGUIItemStateChanged - - private void checkShowFileProgressItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_checkShowFileProgressItemStateChanged - boolean isSelected = false; - if (evt.getStateChange() == ItemEvent.SELECTED) { - isSelected = true; - } - log.info("updating show intra-file progress to:{}", isSelected); - try { - idropCore.getIdropConfigurationService().updateConfig(IdropConfigurationService.INTRA_FILE_STATUS_CALLBACKS, Boolean.toString(isSelected)); - idropCore.getIdropConfigurationService().updateJargonPropertiesBasedOnIDROPConfig(); - } catch (Exception ex) { - log.error("error setting property", ex); - throw new IdropRuntimeException(ex); - } - }//GEN-LAST:event_checkShowFileProgressItemStateChanged - - private void checkVerifyChecksumOnTransferItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_checkVerifyChecksumOnTransferItemStateChanged - updateConfigForGivenPropertyBasedOnCheckboxStateChange(evt, IdropConfigurationService.VERIFY_CHECKSUM_ON_TRANSFER); - } - - private void updateConfigForGivenPropertyBasedOnCheckboxStateChange(ItemEvent evt, String propertyName) throws IdropRuntimeException { - boolean isSelected = false; - if (evt.getStateChange() == ItemEvent.SELECTED) { - isSelected = true; - } - log.info("updating verify checksum to:{}", isSelected); - try { - idropCore.getIdropConfigurationService().updateConfig(propertyName, Boolean.toString(isSelected)); - idropCore.getIdropConfigurationService().updateJargonPropertiesBasedOnIDROPConfig(); - } catch (Exception ex) { - log.error("error setting property", ex); - throw new IdropRuntimeException(ex); - } - }//GEN-LAST:event_checkVerifyChecksumOnTransferItemStateChanged - - private void checkLogSuccessfulTransferItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_checkLogSuccessfulTransferItemStateChanged - - updateConfigForGivenPropertyBasedOnCheckboxStateChange(evt, IdropConfigurationService.TRANSFER_ENGINE_RECORD_SUCCESSFUL_FILES); - }//GEN-LAST:event_checkLogSuccessfulTransferItemStateChanged - - private void checkUseExecutorPoolItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_checkUseExecutorPoolItemStateChanged - updateConfigForGivenPropertyBasedOnCheckboxStateChange(evt, IdropConfigurationService.IRODS_PARALLEL_USE_POOL); - }//GEN-LAST:event_checkUseExecutorPoolItemStateChanged - - private void checkAllowReroutingItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_checkAllowReroutingItemStateChanged - boolean isSelected = false; - if (evt.getStateChange() == ItemEvent.SELECTED) { - isSelected = true; - } - log.info("updating allow rerouting to:{}", isSelected); - try { - idropCore.getIdropConfigurationService().updateConfig(IdropConfigurationService.ALLOW_CONNECTION_REROUTING, Boolean.toString(isSelected)); - idropCore.getIdropConfigurationService().updateJargonPropertiesBasedOnIDROPConfig(); - } catch (Exception ex) { - log.error("error setting property", ex); - throw new IdropRuntimeException(ex); - } - }//GEN-LAST:event_checkAllowReroutingItemStateChanged - - private void resetTransferPipelineEditColors() { - txtInternalInputBufferSize.setBackground(Color.white); - txtInternalOutputBufferSize.setBackground(Color.white); - txtLocalFileInputBufferSize.setBackground(Color.white); - txtLocalFileOutputBufferSize.setBackground(Color.white); - txtGetBufferSize.setBackground(Color.white); - txtPutBufferSize.setBackground(Color.white); - txtInputToOutputCopyBufferSize.setBackground(Color.white); - txtInternalCacheBufferSize.setBackground(Color.white); - } - - /** - * Update the pipeline configuration information properties based on the screen data - * - * @param evt - */ - private void btnApplyPipelineConfigActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnApplyPipelineConfigActionPerformed - try { - - resetTransferPipelineEditColors(); - // edit and set - - // internal input buffer size - String actual = txtInternalInputBufferSize.getText(); - int actualAsInt = 0; - if (actual.isEmpty()) { - actualAsInt = 0; - } else { - try { - actualAsInt = Integer.parseInt(actual); - idropCore.getIdropConfigurationService().updateConfig(IdropConfigurationService.IRODS_IO_INTERNAL_INPUT_STREAM_BUFFER_SIZE, actual); - } catch (NumberFormatException nfe) { - txtInternalInputBufferSize.setBackground(Color.red); - MessageManager.showWarning(this, "Invalid internal input buffer size", MessageManager.TITLE_MESSAGE); - return; - } - } - - // internal output buffer size - actual = txtInternalOutputBufferSize.getText(); - actualAsInt = 0; - if (actual.isEmpty()) { - actualAsInt = 0; - } else { - try { - actualAsInt = Integer.parseInt(actual); - idropCore.getIdropConfigurationService().updateConfig(IdropConfigurationService.IRODS_IO_INTERNAL_OUTPUT_STREAM_BUFFER_SIZE, actual); - } catch (NumberFormatException nfe) { - txtInternalOutputBufferSize.setBackground(Color.red); - MessageManager.showWarning(this, "Invalid internal output buffer size", MessageManager.TITLE_MESSAGE); - return; - } - } - - // local file input buffer size - actual = txtLocalFileInputBufferSize.getText(); - actualAsInt = 0; - if (actual.isEmpty()) { - actualAsInt = 0; - } else { - try { - actualAsInt = Integer.parseInt(actual); - idropCore.getIdropConfigurationService().updateConfig(IdropConfigurationService.IRODS_IO_LOCAL_INPUT_STREAM_BUFFER_SIZE, actual); - } catch (NumberFormatException nfe) { - txtLocalFileInputBufferSize.setBackground(Color.red); - MessageManager.showWarning(this, "Invalid local file input buffer size", MessageManager.TITLE_MESSAGE); - return; - } - } - - // local file output buffer size - actual = txtLocalFileOutputBufferSize.getText(); - actualAsInt = 0; - if (actual.isEmpty()) { - actualAsInt = 0; - } else { - try { - actualAsInt = Integer.parseInt(actual); - idropCore.getIdropConfigurationService().updateConfig(IdropConfigurationService.IRODS_IO_LOCAL_OUTPUT_STREAM_BUFFER_SIZE, actual); - } catch (NumberFormatException nfe) { - txtLocalFileOutputBufferSize.setBackground(Color.red); - MessageManager.showWarning(this, "Invalid local file output buffer size", MessageManager.TITLE_MESSAGE); - return; - } - } - - // get buffer size - actual = txtGetBufferSize.getText(); - actualAsInt = 0; - if (actual.isEmpty()) { - actualAsInt = 0; - } else { - try { - actualAsInt = Integer.parseInt(actual); - idropCore.getIdropConfigurationService().updateConfig(IdropConfigurationService.IRODS_IO_GET_BUFFER_SIZE, actual); - } catch (NumberFormatException nfe) { - txtGetBufferSize.setBackground(Color.red); - MessageManager.showWarning(this, "Invalid get buffer size", MessageManager.TITLE_MESSAGE); - return; - } - } - - // put buffer size - actual = txtPutBufferSize.getText(); - actualAsInt = 0; - if (actual.isEmpty()) { - actualAsInt = 0; - } else { - try { - actualAsInt = Integer.parseInt(actual); - idropCore.getIdropConfigurationService().updateConfig(IdropConfigurationService.IRODS_IO_PUT_BUFFER_SIZE, actual); - } catch (NumberFormatException nfe) { - txtPutBufferSize.setBackground(Color.red); - MessageManager.showWarning(this, "Invalid put buffer size", MessageManager.TITLE_MESSAGE); - return; - } - } - - // input to output copy buffer size - actual = txtInputToOutputCopyBufferSize.getText(); - actualAsInt = 0; - if (actual.isEmpty()) { - actualAsInt = 0; - } else { - try { - actualAsInt = Integer.parseInt(actual); - idropCore.getIdropConfigurationService().updateConfig(IdropConfigurationService.IRODS_IO_INPUT_TO_OUTPUT_COPY_BUFFER_SIZE, actual); - } catch (NumberFormatException nfe) { - txtInputToOutputCopyBufferSize.setBackground(Color.red); - MessageManager.showWarning(this, "Invalid input to output copy buffer size", MessageManager.TITLE_MESSAGE); - return; - } - } - - // internal cache buffer size - actual = txtInternalCacheBufferSize.getText(); - actualAsInt = 0; - if (actual.isEmpty()) { - actualAsInt = 0; - } else { - try { - actualAsInt = Integer.parseInt(actual); - idropCore.getIdropConfigurationService().updateConfig(IdropConfigurationService.IRODS_IO_INTERNAL_CACHE_BUFFER_SIZE, actual); - } catch (NumberFormatException nfe) { - txtInternalCacheBufferSize.setBackground(Color.red); - MessageManager.showWarning(this, "Invalid internal cache buffer size", MessageManager.TITLE_MESSAGE); - return; - } - } - - idropCore.getIdropConfigurationService().updateConfig(IdropConfigurationService.IRODS_PARALLEL_USE_PARALLEL, Boolean.toString(checkAllowParallelTransfers.isSelected())); - idropCore.getIdropConfigurationService().updateConfig(IdropConfigurationService.IRODS_PARALLEL_USE_NIO, Boolean.toString(checkUseNIOForParallelTransfers.isSelected())); - idropCore.getIdropConfigurationService().updateConfig(IdropConfigurationService.IRODS_PARALLEL_CONNECTION_MAX_THREADS, spinnerIrodsMaxParallelThreads.getValue().toString()); - idropCore.getIdropConfigurationService().updateConfig(IdropConfigurationService.IRODS_PARALLEL_CONNECTION_TIMEOUT, spinnerIrodsParallelSocketTimeout.getValue().toString()); - idropCore.getIdropConfigurationService().updateConfig(IdropConfigurationService.IRODS_CONNECTION_TIMEOUT, spinnerIrodsSocketTimeout.getValue().toString()); - - idropCore.getIdropConfigurationService().updateJargonPropertiesBasedOnIDROPConfig(); - } catch (Exception ex) { - log.error("error setting property", ex); - throw new IdropRuntimeException(ex); - } - }//GEN-LAST:event_btnApplyPipelineConfigActionPerformed - - private void btnRestoreDefaultsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRestoreDefaultsActionPerformed - log.info("restoring pipeline config to jargon properties settings"); - try { - JargonProperties defaultJargonProperties = new DefaultPropertiesJargonConfig(); - IdropConfigurationService configService = idropCore.getIdropConfigurationService(); - configService.restoreIDROPConfigFromJargonProperties(defaultJargonProperties); - initWithConfigData(); - MessageManager.showMessage(this, "Values restored to defaults, hit apply to update", MessageManager.TITLE_MESSAGE); - } catch (JargonException ex) { - log.error("unable to restore jargon properties", ex); - throw new IdropRuntimeException("unable to restore jargon properties", ex); - } - - }//GEN-LAST:event_btnRestoreDefaultsActionPerformed - - private void comboPrefsDefaultResourceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboPrefsDefaultResourceActionPerformed - String newResource = (String)comboPrefsDefaultResource.getSelectedItem(); - idropCore.getIrodsAccount().setDefaultStorageResource(newResource); - if (! initializing) { - idropGui.reinitializeForChangedIRODSAccount(); - } - else { - initializing = false; - } - }//GEN-LAST:event_comboPrefsDefaultResourceActionPerformed - - private void checkConnectionRestartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkConnectionRestartActionPerformed - - - - - - }//GEN-LAST:event_checkConnectionRestartActionPerformed - - private void checkConnectionRestartItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_checkConnectionRestartItemStateChanged - boolean isSelected = false; - if (evt.getStateChange() == ItemEvent.SELECTED) { - isSelected = true; - } - log.info("updating connection restart to:{}", isSelected); - try { - idropCore.getIdropConfigurationService().updateConfig(IdropConfigurationService.IRODS_CONNECTION_RESTART, Boolean.toString(isSelected)); - idropCore.getIdropConfigurationService().updateJargonPropertiesBasedOnIDROPConfig(); - } catch (Exception ex) { - log.error("error setting property", ex); - throw new IdropRuntimeException(ex); - } - }//GEN-LAST:event_checkConnectionRestartItemStateChanged - - private void btnOKActionPerformed(java.awt.event.ActionEvent evt) { - this.dispose(); - } - - private void checkShowGUIActionPerformed(java.awt.event.ActionEvent evt) { - // - } - - private void checkLogSuccessfulTransferActionPerformed(java.awt.event.ActionEvent evt) { - // - } - - private void pnlConfigSynchComponentShown(java.awt.event.ComponentEvent evt) { - - refreshSynchConfigPanel(); - - } - - private void refreshSynchConfigPanel() { - log.info("lazily loading synch data"); - - final IDROPConfigurationPanel thisPanel = this; - - java.awt.EventQueue.invokeLater(new Runnable() { - - @Override - public void run() { - - - SynchManagerService synchConfigurationService = idropCore.getTransferManager().getTransferServiceFactory().instanceSynchManagerService(); - - try { - thisPanel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - List<Synchronization> synchronizations = synchConfigurationService.listAllSynchronizations(); - SynchConfigTableModel synchConfigTableModel = null; - if (jTableSynch == null) { - synchConfigTableModel = new SynchConfigTableModel(idropCore, synchronizations); - jTableSynch = new JTable(synchConfigTableModel); - jTableSynch.getSelectionModel().addListSelectionListener(new SynchListSelectionHandler(thisPanel)); - scrollSynchTable.setViewportView(jTableSynch); - scrollSynchTable.validate(); - pnlConfigSynchListing.validate(); - } else { - synchConfigTableModel = (SynchConfigTableModel) jTableSynch.getModel(); - synchConfigTableModel.setSynchronizations(synchronizations); - synchConfigTableModel.fireTableDataChanged(); - } - - if (synchConfigTableModel.getRowCount() > 0) { - jTableSynch.setRowSelectionInterval(0, 0); - } else { - lockSynchPanelForNewOnly(); - } - } catch (SynchException ex) { - log.error("error setting up synchs table", ex); - throw new IdropRuntimeException(ex); - } finally { - thisPanel.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); - } - } - - private void lockSynchPanelForNewOnly() { - clearAndResetSynchPanel(); - setLockStatusSynchPanel(false); - } - }); - } - - private void txtLocalPathActionPerformed(java.awt.event.ActionEvent evt) { - // TODO add your handling code here: - } - - private void btnChooseLocalSynchActionPerformed(java.awt.event.ActionEvent evt) { - // TODO add your handling code here: - JFileChooser localFileChooser = new JFileChooser(); - localFileChooser.setMultiSelectionEnabled(false); - localFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - int returnVal = localFileChooser.showOpenDialog(this); - txtLocalPath.setText(localFileChooser.getSelectedFile().getAbsolutePath()); - } - - private void txtIrodsPathActionPerformed(java.awt.event.ActionEvent evt) { - // TODO add your handling code here: - } - - private void btnChooseIrodsSynchActionPerformed(java.awt.event.ActionEvent evt) { - try { - IRODSFinderDialog irodsFileSystemChooserView = new IRODSFinderDialog(null, true, idropCore); - final Toolkit toolkit = Toolkit.getDefaultToolkit(); - final Dimension screenSize = toolkit.getScreenSize(); - final int x = (screenSize.width - irodsFileSystemChooserView.getWidth()) / 2; - final int y = (screenSize.height - irodsFileSystemChooserView.getHeight()) / 2; - irodsFileSystemChooserView.setLocation(x, y); - irodsFileSystemChooserView.setVisible(true); - String absPath = irodsFileSystemChooserView.getSelectedAbsolutePath(); - irodsFileSystemChooserView.dispose(); - if (absPath != null) { - txtIrodsPath.setText(irodsFileSystemChooserView.getSelectedAbsolutePath()); - } - - // int returnVal = irodsFileChooser.showSaveDialog(this); - } catch (Exception e) { - log.error("exception choosings iRODS file"); - throw new IdropRuntimeException("exception choosing irods fie", e); - } finally { - idropCore.getIrodsFileSystem().closeAndEatExceptions(); - } - } - - /** - * Delete the selected synchronization - * - * @param evt - */ - private void btnDeleteSynchActionPerformed(java.awt.event.ActionEvent evt) { - - final IDROPConfigurationPanel thisPanel = this; - - java.awt.EventQueue.invokeLater(new Runnable() { - - @Override - public void run() { - - if (selectedSynchronization == null) { - MessageManager.showError(thisPanel, "Please select a synchronization from the table", MessageManager.TITLE_MESSAGE); - return; - } - Synchronization synchronization = selectedSynchronization; - - int result = JOptionPane.showConfirmDialog(thisPanel, - "Do you wish to delete this synchronization?", - MessageManager.TITLE_MESSAGE, - JOptionPane.OK_CANCEL_OPTION); - if (result == JOptionPane.CANCEL_OPTION) { - return; - } - try { - thisPanel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - SynchManagerService synchConfigurationService = idropCore.getTransferManager().getTransferServiceFactory().instanceSynchManagerService(); - log.info("deleting synchronization:{}", synchronization); - - if (synchConfigurationService.isSynchRunning(synchronization)) { - MessageManager.showMessage(thisPanel, "Cannot delete the synchronization, a synch is currently running", MessageManager.TITLE_MESSAGE); - return; - } - - ListSelectionModel lsm = (ListSelectionModel) thisPanel.getSynchTable().getSelectionModel(); - SynchConfigTableModel model = (SynchConfigTableModel) thisPanel.getSynchTable().getModel(); - - synchConfigurationService.deleteSynchronization(synchronization); - log.info("synch deleted, refreshing model"); - List<Synchronization> synchronizations = synchConfigurationService.listAllSynchronizations(); - - model.setSynchronizations(synchronizations); - model.fireTableDataChanged(); - - MessageManager.showMessage(thisPanel, "Configuration deleted", MessageManager.TITLE_MESSAGE); - btnDeleteSynch.setEnabled(false); - btnUpdateSynch.setEnabled(false); - btnSynchNow.setEnabled(false); - refreshSynchConfigPanel(); - } catch (Exception ex) { - MessageManager.showError(thisPanel, ex.getMessage(), MessageManager.TITLE_MESSAGE); - } finally { - thisPanel.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); - idropCore.closeIRODSConnection( - idropCore.getIrodsAccount()); - } - } - }); - } - - /** - * Called to clear and prepare for adding a new synchronization - * - * @param evt - */ - private void btnNewSynchActionPerformed(java.awt.event.ActionEvent evt) { - clearAndResetSynchPanel(); - if (jTableSynch.getModel().getRowCount() > 0) { - jTableSynch.getSelectionModel().removeIndexInterval(0, jTableSynch.getModel().getRowCount() - 1); - } - selectedSynchronization = new Synchronization(); - btnDeleteSynch.setEnabled(false); - btnUpdateSynch.setEnabled(true); - btnSynchNow.setEnabled(false); - MessageManager.showMessage(this, "Enter the data for the new Synchronization and press Update to save", MessageManager.TITLE_MESSAGE); - setLockStatusSynchPanel(true); - btnSynchNow.setEnabled(false); - btnDeleteSynch.setEnabled(false); - } - - /** - * User signals that the displayed synchronization should be updated - * - * @param evt - */ - private void btnUpdateSynchActionPerformed(java.awt.event.ActionEvent evt) { - updateSynch(); - } - - private void updateSynch() { - final IDROPConfigurationPanel thisPanel = this; - - java.awt.EventQueue.invokeLater(new Runnable() { - - @Override - public void run() { - - resetSynchPanel(); - if (selectedSynchronization == null) { - MessageManager.showError(thisPanel, "Please select a synchronization from the table", MessageManager.TITLE_MESSAGE); - return; - } - - if (txtLocalPath.getText().trim().isEmpty()) { - txtLocalPath.setBackground(Color.RED); - MessageManager.showError(thisPanel, "Please select a local path", MessageManager.TITLE_MESSAGE); - return; - } - - if (txtIrodsPath.getText().trim().isEmpty()) { - txtIrodsPath.setBackground(Color.RED); - MessageManager.showError(thisPanel, "Please select an iRODS path", MessageManager.TITLE_MESSAGE); - return; - } - - if (txtSynchName.getText().trim().isEmpty()) { - txtSynchName.setBackground(Color.RED); - MessageManager.showError(thisPanel, "Please enter a unique name for this synchronization", MessageManager.TITLE_MESSAGE); - return; - } - - boolean isNew = (selectedSynchronization.getId() == null); - if (isNew) { - log.info("adding new synch"); - } - - SynchManagerService synchConfigurationService = idropCore.getTransferManager().getTransferServiceFactory().instanceSynchManagerService(); - - // edits pass, do update - log.info("saving synch data"); - Synchronization synchronization = selectedSynchronization; - synchronization.setUpdatedAt(new Date()); - synchronization.setFrequencyType(getSynchFrequencyFromGUI()); - - synchronization.setName(txtSynchName.getText().trim()); - synchronization.setSynchronizationMode(getSynchTypeFromGUI()); - synchronization.setLocalSynchDirectory(txtLocalPath.getText().trim()); - synchronization.setIrodsSynchDirectory(txtIrodsPath.getText().trim()); - IRODSAccount irodsAccount = idropCore.getIrodsAccount(); - synchronization.setIrodsHostName(irodsAccount.getHost()); - - try { - synchronization.setIrodsPassword(HibernateUtil.obfuscate(irodsAccount.getPassword())); - } catch (JargonException ex) { - log.error("exception obfuscating password", ex); - MessageManager.showError(thisPanel, ex.getMessage(), MessageManager.TITLE_MESSAGE); - throw new IdropRuntimeException(ex); - } - - synchronization.setIrodsPort(irodsAccount.getPort()); - synchronization.setIrodsUserName(irodsAccount.getUserName()); - synchronization.setIrodsZone(irodsAccount.getZone()); - synchronization.setDefaultResourceName(irodsAccount.getDefaultStorageResource()); - synchronization.setCreatedAt(new Date()); - selectedSynchronization = synchronization; - - try { - thisPanel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - if (synchConfigurationService.isSynchRunning(selectedSynchronization)) { - MessageManager.showMessage(thisPanel, "Cannot update the synchronization, a synch is currently running", MessageManager.TITLE_MESSAGE); - return; - } - - idropCore.getIdropConfigurationService().updateSynchronization(synchronization); - MessageManager.showMessage(thisPanel, "Configuration updated", MessageManager.TITLE_MESSAGE); - ListSelectionModel lsm = (ListSelectionModel) thisPanel.getSynchTable().getSelectionModel(); - SynchConfigTableModel model = (SynchConfigTableModel) thisPanel.getSynchTable().getModel(); - - if (isNew) { - - List<Synchronization> synchronizations = synchConfigurationService.listAllSynchronizations(); - - model.setSynchronizations(synchronizations); - model.fireTableDataChanged(); - } else { - if (lsm.isSelectionEmpty()) { - return; - } else { - // Find out which indexes are selected. - int minIndex = lsm.getMinSelectionIndex(); - int maxIndex = lsm.getMaxSelectionIndex(); - for (int i = minIndex; i <= maxIndex; i++) { - if (lsm.isSelectedIndex(i)) { - int modelIdx = thisPanel.getSynchTable().convertRowIndexToModel(i); - - model.getSynchronizations().set(modelIdx, synchronization); - model.fireTableDataChanged(); - break; - } - } - } - } - - btnDeleteSynch.setEnabled(true); - btnUpdateSynch.setEnabled(true); - btnSynchNow.setEnabled(true); - - } catch (IdropException ex) { - MessageManager.showError(thisPanel, ex.getMessage(), MessageManager.TITLE_MESSAGE); - } catch (SynchException ex) { - MessageManager.showError(thisPanel, ex.getMessage(), MessageManager.TITLE_MESSAGE); - } finally { - thisPanel.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); - idropCore.closeIRODSConnection( - idropCore.getIrodsAccount()); - } - } - }); - } - - /** - * Force a synchronization process on the selected synchronization - * - * @param evt - */ - private void btnSynchNowActionPerformed(java.awt.event.ActionEvent evt) { - log.info("synch now button pressed"); - if (selectedSynchronization == null) { - MessageManager.showWarning(this, "Please select a synhronization", MessageManager.TITLE_MESSAGE); - return; - } - - log.info("selected synchronization is:{}", selectedSynchronization); - boolean synchIsUnchanged = checkIfSynchChanged(); - - if (!synchIsUnchanged) { - log.info("synch had been changed, update first"); - updateSynch(); - } - - int result = JOptionPane.showConfirmDialog(this, - "Synchronize?", - "Do you want to synchronize now?", - JOptionPane.OK_CANCEL_OPTION); - if (result == JOptionPane.OK_OPTION) { - try { - SynchManagerService synchConfigurationService = idropCore.getTransferManager().getTransferServiceFactory().instanceSynchManagerService(); - - if (synchConfigurationService.isSynchRunning(selectedSynchronization)) { - MessageManager.showMessage(this, "Cannot schedule the synchronization, a synch is currently running", MessageManager.TITLE_MESSAGE); - return; - } - idropCore.getTransferManager().enqueueASynch(selectedSynchronization, selectedSynchronization.buildIRODSAccountFromSynchronizationData()); - } catch (Exception ex) { - log.error("error starting synch", ex); - MessageManager.showError(this, ex.getMessage(), MessageManager.TITLE_MESSAGE); - throw new IdropRuntimeException(ex); - } - } - } - - private void checkVerifyChecksumOnTransferActionPerformed(java.awt.event.ActionEvent evt) { - // - } - - private void btnLogoutActionPerformed(java.awt.event.ActionEvent evt) { - log.info("logging out to log in to a new grid"); - - final IDROPConfigurationPanel thisPanel = this; - - java.awt.EventQueue.invokeLater(new Runnable() { - - @Override - public void run() { - - IRODSAccount savedAccount = idropCore.getIrodsAccount(); - idropCore.setIrodsAccount(null); - iDrop idrop = (iDrop) thisPanel.getParent(); - LoginDialog loginDialog = new LoginDialog(thisPanel, idropCore); - loginDialog.setVisible(true); - - if (idropCore.getIrodsAccount() == null) { - log.warn("no account, reverting"); - idropCore.setIrodsAccount(savedAccount); - } else { - idrop.reinitializeForChangedIRODSAccount(); - } - refreshAccountData(); - } - }); - - } - - private void btnChangePasswordActionPerformed(java.awt.event.ActionEvent evt) { - ChangePasswordDialog changePasswordDialog = new ChangePasswordDialog((iDrop) this.getParent(), this, true); - changePasswordDialog.setLocationRelativeTo(this); - changePasswordDialog.setVisible(true); - } - - protected JTable getSynchTable() { - return jTableSynch; - } - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JButton btnApplyPipelineConfig; - private javax.swing.JButton btnChangePassword; - private javax.swing.JButton btnChooseIrodsSynch; - private javax.swing.JButton btnChooseLocalSynch; - private javax.swing.JButton btnDeleteSynch; - private javax.swing.JButton btnLogout; - private javax.swing.JButton btnNewSynch; - private javax.swing.JButton btnOK; - private javax.swing.JButton btnRefreshSynch; - private javax.swing.JButton btnRestoreDefaults; - private javax.swing.JButton btnSynchNow; - private javax.swing.JButton btnUpdateSynch; - private javax.swing.ButtonGroup buttonGroupSynchMode; - private javax.swing.JCheckBox checkAllowParallelTransfers; - private javax.swing.JCheckBox checkAllowRerouting; - private javax.swing.JCheckBox checkConnectionRestart; - private javax.swing.JCheckBox checkLogSuccessfulTransfer; - private javax.swing.JCheckBox checkShowFileProgress; - private javax.swing.JCheckBox checkShowGUI; - private javax.swing.JCheckBox checkUseExecutorPool; - private javax.swing.JCheckBox checkUseNIOForParallelTransfers; - private javax.swing.JCheckBox checkVerifyChecksumOnTransfer; - private javax.swing.JComboBox comboPrefsDefaultResource; - private javax.swing.JLabel jLabel1; - private javax.swing.JLabel jLabel5; - private javax.swing.JComboBox jcomboSynchFrequency; - private javax.swing.JLabel lblGetBufferSize; - private javax.swing.JLabel lblHost; - private javax.swing.JLabel lblHostLabel; - private javax.swing.JLabel lblInternalCacheBufferSize; - private javax.swing.JLabel lblInternalInputBufferSize; - private javax.swing.JLabel lblInternalOutputBufferSize; - private javax.swing.JLabel lblIputToOutputCopyBufferSize; - private javax.swing.JLabel lblIrodsParallelSocketTimeout; - private javax.swing.JLabel lblIrodsSocketTimeout; - private javax.swing.JLabel lblLocalFileInputBufferSize; - private javax.swing.JLabel lblLocalFileOutputBufferSize; - private javax.swing.JLabel lblMaximumParallelTransferThreads; - private javax.swing.JLabel lblPort; - private javax.swing.JLabel lblPortLabel; - private javax.swing.JLabel lblPutBufferSize; - private javax.swing.JLabel lblResourceLabel; - private javax.swing.JLabel lblSynchDate; - private javax.swing.JLabel lblSynchDateLabel; - private javax.swing.JLabel lblSynchName; - private javax.swing.JLabel lblSynchStatus; - private javax.swing.JLabel lblUserName; - private javax.swing.JLabel lblUserNameLabel; - private javax.swing.JLabel lblZone; - private javax.swing.JLabel lblZoneLabel; - private javax.swing.JPanel panelSynchToolbar; - private javax.swing.JPanel plnPipelineConfiguration; - private javax.swing.JPanel pnlBottom; - private javax.swing.JPanel pnlBuffers; - private javax.swing.JPanel pnlCenter; - private javax.swing.JPanel pnlConfigGrids; - private javax.swing.JPanel pnlConfigIdrop; - private javax.swing.JPanel pnlConfigSynch; - private javax.swing.JPanel pnlConfigSynchDetails; - private javax.swing.JPanel pnlConfigSynchListing; - private javax.swing.JPanel pnlConfigTransfers; - private javax.swing.JPanel pnlCurrentGrid; - private javax.swing.JPanel pnlCurrentGridToolbar; - private javax.swing.JPanel pnlIrodsSynch; - private javax.swing.JPanel pnlLocalSynch; - private javax.swing.JPanel pnlParallelTransferOptions; - private javax.swing.JPanel pnlSynchData; - private javax.swing.JPanel pnlSynchFrequency; - private javax.swing.JPanel pnlSynchIcon; - private javax.swing.JPanel pnlSynchMode; - private javax.swing.JPanel pnlSynchName; - private javax.swing.JPanel pnlSynchRefresh; - private javax.swing.JPanel pnlTop; - private javax.swing.JPanel pnlTransferManagement; - private javax.swing.JRadioButton radioBackup; - private javax.swing.JRadioButton radioFeed; - private javax.swing.JRadioButton radioSynch; - private javax.swing.JScrollPane scrollSynchTable; - private javax.swing.JSpinner spinnerIrodsMaxParallelThreads; - private javax.swing.JSpinner spinnerIrodsParallelSocketTimeout; - private javax.swing.JSpinner spinnerIrodsSocketTimeout; - private javax.swing.JTabbedPane tabConfig; - private javax.swing.JTextField txtGetBufferSize; - private javax.swing.JTextField txtInputToOutputCopyBufferSize; - private javax.swing.JTextField txtInternalCacheBufferSize; - private javax.swing.JTextField txtInternalInputBufferSize; - private javax.swing.JTextField txtInternalOutputBufferSize; - private javax.swing.JTextField txtIrodsPath; - private javax.swing.JTextField txtLocalFileInputBufferSize; - private javax.swing.JTextField txtLocalFileOutputBufferSize; - private javax.swing.JTextField txtLocalPath; - private javax.swing.JTextField txtPutBufferSize; - private javax.swing.JTextField txtSynchName; - // End of variables declaration//GEN-END:variables - - private void initWithConfigData() { - resetTransferPipelineEditColors(); - IdropConfig idropConfig = idropCore.getIdropConfig(); - checkShowGUI.setSelected(idropConfig.isShowGuiAtStartup()); - checkLogSuccessfulTransfer.setSelected(idropConfig.isLogSuccessfulTransfers()); - checkUseExecutorPool.setSelected(idropConfig.isParallelUsePool()); - checkVerifyChecksumOnTransfer.setSelected(idropConfig.isVerifyChecksum()); - checkShowFileProgress.setSelected(idropConfig.isIntraFileStatusCallbacks()); - checkAllowRerouting.setSelected(idropConfig.isAllowConnectionRerouting()); - checkUseExecutorPool.setSelected(idropConfig.isParallelUsePool()); - spinnerIrodsSocketTimeout.setValue(idropConfig.getIrodsConnectionTimeout()); - spinnerIrodsParallelSocketTimeout.setValue(idropConfig.getIrodsParallelConnectionTimeout()); - spinnerIrodsMaxParallelThreads.setValue(idropConfig.getIrodsParallelTransferMaxThreads()); - checkAllowParallelTransfers.setSelected(idropConfig.isUseParallelTransfers()); - checkConnectionRestart.setSelected(idropConfig.isConnectionRestart()); - checkUseNIOForParallelTransfers.setSelected(idropConfig.isUseNIOForParallelTransfers()); - txtInternalInputBufferSize.setText(String.valueOf(idropConfig.getInternalInputStreamBufferSize())); - txtInternalOutputBufferSize.setText(String.valueOf(idropConfig.getInternalOutputStreamBufferSize())); - txtLocalFileInputBufferSize.setText(String.valueOf(idropConfig.getLocalFileInputStreamBufferSize())); - txtLocalFileOutputBufferSize.setText(String.valueOf(idropConfig.getLocalFileOutputStreamBufferSize())); - txtGetBufferSize.setText(String.valueOf(idropConfig.getGetBufferSize())); - txtPutBufferSize.setText(String.valueOf(idropConfig.getPutBufferSize())); - txtInputToOutputCopyBufferSize.setText(String.valueOf(idropConfig.getInputToOutputCopyBufferByteSize())); - txtInternalCacheBufferSize.setText(String.valueOf(idropConfig.getInternalCacheBufferSize())); - refreshAccountData(); - } - - /** - * Reset colors in synch panel when re-validating - */ - private void resetSynchPanel() { - txtLocalPath.setBackground(Color.WHITE); - txtIrodsPath.setBackground(Color.WHITE); - txtSynchName.setBackground(Color.WHITE); - } - - /** - * Clear synch panel values and colors - */ - private void clearAndResetSynchPanel() { - resetSynchPanel(); - txtLocalPath.setText(""); - txtIrodsPath.setText(""); - txtSynchName.setText(""); - radioBackup.setSelected(true); - lblSynchDate.setText(""); - pnlSynchIcon.removeAll(); - pnlSynchIcon.validate(); - jcomboSynchFrequency.setSelectedIndex(0); - } - - private void refreshAccountData() { - - if (idropCore.getIrodsAccount() == null) { - lblHost.setText(""); - lblPort.setText(""); - lblZone.setText(""); - comboPrefsDefaultResource.setModel(new DefaultComboBoxModel()); - lblUserName.setText(""); - } else { - lblHost.setText(idropCore.getIrodsAccount().getHost()); - lblPort.setText(String.valueOf(idropCore.getIrodsAccount().getPort())); - lblZone.setText(idropCore.getIrodsAccount().getZone()); - lblUserName.setText(idropCore.getIrodsAccount().getUserName()); - try { - ResourceAO resourceAO = idropCore.getIRODSAccessObjectFactory().getResourceAO(idropCore.getIrodsAccount()); - log.info("getting a list of all resources in the zone"); - List<String> resources = resourceAO.listResourceNames(); - comboPrefsDefaultResource.setModel(new DefaultComboBoxModel(resources.toArray())); - comboPrefsDefaultResource.setSelectedItem(idropCore.getIrodsAccount().getDefaultStorageResource()); - } catch (JargonException ex) { - log.error("error getting resource list", ex); - throw new IdropRuntimeException("error getting resource list", ex); - } - } - // check to see if default resource editing is allowed - String allowEdit = idropCore.getIdropConfig().getPropertyForKey(IdropConfigurationService.IDROP_ENABLE_RESC_EDIT); - if (allowEdit != null && allowEdit.equals("false")) { - comboPrefsDefaultResource.setEnabled(false); - } - } - - protected void updateDetailsForSelectedSynch(int i) { - // make sure the most up-to-date information is displayed - int modelIdx = getSynchTable().convertRowIndexToModel(i); - SynchConfigTableModel model = (SynchConfigTableModel) getSynchTable().getModel(); - - selectedSynchronization = model.getSynchronizationAt(modelIdx); - - if (selectedSynchronization == null) { - model.removeRow(modelIdx); - return; - } - - // initialize data - txtLocalPath.setText(selectedSynchronization.getLocalSynchDirectory()); - txtIrodsPath.setText(selectedSynchronization.getIrodsSynchDirectory()); - txtSynchName.setText(selectedSynchronization.getName()); - - if (selectedSynchronization.getFrequencyType() == FrequencyType.EVERY_HOUR) { - jcomboSynchFrequency.setSelectedIndex(0); - } else if (selectedSynchronization.getFrequencyType() == FrequencyType.EVERY_WEEK) { - jcomboSynchFrequency.setSelectedIndex(1); - } else if (selectedSynchronization.getFrequencyType() == FrequencyType.EVERY_DAY) { - jcomboSynchFrequency.setSelectedIndex(2); - } else if (selectedSynchronization.getFrequencyType() == FrequencyType.EVERY_TWO_MINUTES) { - jcomboSynchFrequency.setSelectedIndex(3); - } else { - // default to hourly to avoid errors - log.error("unknown frequency type for synch:{}", selectedSynchronization.getFrequencyType()); - jcomboSynchFrequency.setSelectedIndex(0); - } - - if (selectedSynchronization.getSynchronizationMode() == SynchronizationType.BI_DIRECTIONAL) { - radioSynch.setSelected(true); - } else if (selectedSynchronization.getSynchronizationMode() == SynchronizationType.ONE_WAY_IRODS_TO_LOCAL) { - radioFeed.setSelected(true); - } else if (selectedSynchronization.getSynchronizationMode() == SynchronizationType.ONE_WAY_LOCAL_TO_IRODS) { - radioBackup.setSelected(true); - } else { - log.error("unknown synchronization mode for synch:{}", selectedSynchronization.getSynchronizationMode()); - throw new IdropRuntimeException("unknown synchronization mode"); - } - - btnDeleteSynch.setEnabled(true); - btnUpdateSynch.setEnabled(true); - btnSynchNow.setEnabled(true); - - setSynchIcon(selectedSynchronization); - if (selectedSynchronization.getLastSynchronized() == null) { - lblSynchDate.setText("None"); - } else { - lblSynchDate.setText(dateFormat.format(selectedSynchronization.getLastSynchronized())); - } - - } - - protected void setLockStatusSynchPanel(boolean lockStatus) { - txtSynchName.setEnabled(lockStatus); - txtLocalPath.setEnabled(lockStatus); - btnChooseLocalSynch.setEnabled(lockStatus); - radioBackup.setEnabled(lockStatus); - //radioFeed.setEnabled(lockStatus); - //radioSynch.setEnabled(lockStatus); - jcomboSynchFrequency.setEnabled(lockStatus); - txtIrodsPath.setEnabled(lockStatus); - btnChooseIrodsSynch.setEnabled(lockStatus); - btnDeleteSynch.setEnabled(lockStatus); - btnUpdateSynch.setEnabled(lockStatus); - btnSynchNow.setEnabled(lockStatus); - //btnSynchDetails.setEnabled(lockStatus); - } - - private void setSynchIcon(Synchronization synchronization) { - - JLabel labelToUse = null; - - SynchManagerService synchManagerService = idropCore.getTransferManager().getTransferServiceFactory().instanceSynchManagerService(); - try { - boolean isRunning = synchManagerService.isSynchRunning(synchronization); - if (isRunning) { - labelToUse = IconHelper.getRunningIcon(); - } else if (synchronization.getLastSynchronizationStatus() == null) { - labelToUse = IconHelper.getOkIcon(); - } else if (synchronization.getLastSynchronizationStatus() == TransferStatus.ERROR) { - labelToUse = IconHelper.getErrorIcon(); - } else { - labelToUse = IconHelper.getOkIcon(); - } - } catch (SynchException ex) { - log.error("error checking if synch is already running:{}", synchronization, ex); - throw new IdropRuntimeException("exception checking if synch is already running", ex); - } - - pnlSynchIcon.removeAll(); - lblSynchStatus = labelToUse; - pnlSynchIcon.add(lblSynchStatus); - pnlSynchIcon.validate(); - - } + /** + * + */ + private static final long serialVersionUID = 6853489664356886078L; + private final IDROPCore idropCore; + private static final org.slf4j.Logger log = LoggerFactory + .getLogger(IDROPConfigurationPanel.class); + private JTable jTableSynch = null; + private Synchronization selectedSynchronization = null; + private DateFormat dateFormat = SimpleDateFormat.getDateTimeInstance(); + private final iDrop idropGui; + private boolean initializing = true; + + /** + * Creates new form IDROPConfigurationPanel + */ + public IDROPConfigurationPanel(final java.awt.Frame parent, + final boolean modal, final IDROPCore idropCore) { + super(parent, modal); + this.idropCore = idropCore; + idropGui = (iDrop) parent; + initComponents(); + initWithConfigData(); + } + + private boolean checkIfSynchChanged() throws IdropRuntimeException { + // compare data and update synch first if necessary + + boolean areEqual = true; + + if (!selectedSynchronization.getLocalSynchDirectory().equals( + txtLocalPath.getText())) { + areEqual = false; + } + + if (!selectedSynchronization.getName().equals(txtSynchName.getText())) { + areEqual = false; + } + + if (!selectedSynchronization.getIrodsSynchDirectory().equals( + txtIrodsPath.getText())) { + areEqual = false; + } + + SynchronizationType currentSynchronizationType = getSynchTypeFromGUI(); + + if (currentSynchronizationType != selectedSynchronization + .getSynchronizationMode()) { + areEqual = false; + } + + FrequencyType currentFrequencyType = null; + currentFrequencyType = getSynchFrequencyFromGUI(); + + if (selectedSynchronization.getFrequencyType() != currentFrequencyType) { + areEqual = false; + } + + return areEqual; + } + + private FrequencyType getSynchFrequencyFromGUI() { + FrequencyType currentFrequencyType = null; + if (jcomboSynchFrequency.getSelectedIndex() == 0) { + currentFrequencyType = FrequencyType.EVERY_HOUR; + } else if (jcomboSynchFrequency.getSelectedIndex() == 1) { + currentFrequencyType = FrequencyType.EVERY_WEEK; + } else if (jcomboSynchFrequency.getSelectedIndex() == 2) { + currentFrequencyType = FrequencyType.EVERY_DAY; + } else if (jcomboSynchFrequency.getSelectedIndex() == 3) { + currentFrequencyType = FrequencyType.EVERY_TWO_MINUTES; + } + return currentFrequencyType; + } + + private SynchronizationType getSynchTypeFromGUI() + throws IdropRuntimeException { + SynchronizationType currentSynchronizationType; + if (radioBackup.isSelected()) { + currentSynchronizationType = SynchronizationType.ONE_WAY_LOCAL_TO_IRODS; + } else if (radioFeed.isSelected()) { + currentSynchronizationType = SynchronizationType.ONE_WAY_IRODS_TO_LOCAL; + } else if (radioSynch.isSelected()) { + currentSynchronizationType = SynchronizationType.BI_DIRECTIONAL; + } else { + log.error("unknown synchronization type in GUI"); + throw new IdropRuntimeException( + "unknown synchroization type in GUI"); + } + return currentSynchronizationType; + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // <editor-fold defaultstate="collapsed" + // desc="Generated Code">//GEN-BEGIN:initComponents + private void initComponents() { + java.awt.GridBagConstraints gridBagConstraints; + + buttonGroupSynchMode = new javax.swing.ButtonGroup(); + pnlTop = new javax.swing.JPanel(); + pnlCenter = new javax.swing.JPanel(); + tabConfig = new javax.swing.JTabbedPane(); + pnlConfigIdrop = new javax.swing.JPanel(); + checkShowGUI = new javax.swing.JCheckBox(); + checkShowFileProgress = new javax.swing.JCheckBox(); + pnlConfigGrids = new javax.swing.JPanel(); + pnlCurrentGrid = new javax.swing.JPanel(); + lblHostLabel = new javax.swing.JLabel(); + lblHost = new javax.swing.JLabel(); + lblPortLabel = new javax.swing.JLabel(); + lblPort = new javax.swing.JLabel(); + lblZoneLabel = new javax.swing.JLabel(); + lblZone = new javax.swing.JLabel(); + lblResourceLabel = new javax.swing.JLabel(); + lblUserNameLabel = new javax.swing.JLabel(); + lblUserName = new javax.swing.JLabel(); + pnlCurrentGridToolbar = new javax.swing.JPanel(); + btnLogout = new javax.swing.JButton(); + btnChangePassword = new javax.swing.JButton(); + comboPrefsDefaultResource = new javax.swing.JComboBox(); + pnlConfigTransfers = new javax.swing.JPanel(); + pnlTransferManagement = new javax.swing.JPanel(); + checkLogSuccessfulTransfer = new javax.swing.JCheckBox(); + checkVerifyChecksumOnTransfer = new javax.swing.JCheckBox(); + checkAllowRerouting = new javax.swing.JCheckBox(); + checkConnectionRestart = new javax.swing.JCheckBox(); + plnPipelineConfiguration = new javax.swing.JPanel(); + lblIrodsSocketTimeout = new javax.swing.JLabel(); + spinnerIrodsSocketTimeout = new javax.swing.JSpinner(); + pnlParallelTransferOptions = new javax.swing.JPanel(); + checkAllowParallelTransfers = new javax.swing.JCheckBox(); + checkUseNIOForParallelTransfers = new javax.swing.JCheckBox(); + checkUseExecutorPool = new javax.swing.JCheckBox(); + lblIrodsParallelSocketTimeout = new javax.swing.JLabel(); + spinnerIrodsParallelSocketTimeout = new javax.swing.JSpinner(); + lblMaximumParallelTransferThreads = new javax.swing.JLabel(); + spinnerIrodsMaxParallelThreads = new javax.swing.JSpinner(); + pnlBuffers = new javax.swing.JPanel(); + lblInternalInputBufferSize = new javax.swing.JLabel(); + txtInternalInputBufferSize = new javax.swing.JTextField(); + lblInternalOutputBufferSize = new javax.swing.JLabel(); + txtInternalOutputBufferSize = new javax.swing.JTextField(); + lblLocalFileInputBufferSize = new javax.swing.JLabel(); + txtLocalFileInputBufferSize = new javax.swing.JTextField(); + lblLocalFileOutputBufferSize = new javax.swing.JLabel(); + txtLocalFileOutputBufferSize = new javax.swing.JTextField(); + lblPutBufferSize = new javax.swing.JLabel(); + txtPutBufferSize = new javax.swing.JTextField(); + lblGetBufferSize = new javax.swing.JLabel(); + txtGetBufferSize = new javax.swing.JTextField(); + lblIputToOutputCopyBufferSize = new javax.swing.JLabel(); + txtInputToOutputCopyBufferSize = new javax.swing.JTextField(); + lblInternalCacheBufferSize = new javax.swing.JLabel(); + txtInternalCacheBufferSize = new javax.swing.JTextField(); + btnRestoreDefaults = new javax.swing.JButton(); + btnApplyPipelineConfig = new javax.swing.JButton(); + pnlConfigSynch = new javax.swing.JPanel(); + pnlConfigSynchListing = new javax.swing.JPanel(); + pnlSynchRefresh = new javax.swing.JPanel(); + btnRefreshSynch = new javax.swing.JButton(); + scrollSynchTable = new javax.swing.JScrollPane(); + pnlConfigSynchDetails = new javax.swing.JPanel(); + pnlSynchData = new javax.swing.JPanel(); + pnlSynchName = new javax.swing.JPanel(); + lblSynchName = new javax.swing.JLabel(); + txtSynchName = new javax.swing.JTextField(); + lblSynchDateLabel = new javax.swing.JLabel(); + lblSynchDate = new javax.swing.JLabel(); + pnlSynchIcon = new javax.swing.JPanel(); + lblSynchStatus = new javax.swing.JLabel(); + pnlLocalSynch = new javax.swing.JPanel(); + txtLocalPath = new javax.swing.JTextField(); + btnChooseLocalSynch = new javax.swing.JButton(); + pnlSynchMode = new javax.swing.JPanel(); + jLabel1 = new javax.swing.JLabel(); + radioBackup = new javax.swing.JRadioButton(); + radioFeed = new javax.swing.JRadioButton(); + radioSynch = new javax.swing.JRadioButton(); + pnlSynchFrequency = new javax.swing.JPanel(); + jLabel5 = new javax.swing.JLabel(); + jcomboSynchFrequency = new javax.swing.JComboBox(); + pnlIrodsSynch = new javax.swing.JPanel(); + txtIrodsPath = new javax.swing.JTextField(); + btnChooseIrodsSynch = new javax.swing.JButton(); + panelSynchToolbar = new javax.swing.JPanel(); + btnDeleteSynch = new javax.swing.JButton(); + btnNewSynch = new javax.swing.JButton(); + btnUpdateSynch = new javax.swing.JButton(); + btnSynchNow = new javax.swing.JButton(); + pnlBottom = new javax.swing.JPanel(); + btnOK = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setTitle(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, "IDROPConfigurationPanel.title")); // NOI18N + + org.jdesktop.layout.GroupLayout pnlTopLayout = new org.jdesktop.layout.GroupLayout( + pnlTop); + pnlTop.setLayout(pnlTopLayout); + pnlTopLayout.setHorizontalGroup(pnlTopLayout.createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING).add(0, 1067, + Short.MAX_VALUE)); + pnlTopLayout.setVerticalGroup(pnlTopLayout.createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING).add(0, 0, + Short.MAX_VALUE)); + + getContentPane().add(pnlTop, java.awt.BorderLayout.NORTH); + + pnlConfigIdrop.setLayout(new java.awt.GridBagLayout()); + + checkShowGUI.setMnemonic('s'); + checkShowGUI.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.checkShowGUI.text")); // NOI18N + checkShowGUI.setToolTipText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.checkShowGUI.toolTipText")); // NOI18N + checkShowGUI.addItemListener(new java.awt.event.ItemListener() { + @Override + public void itemStateChanged(final java.awt.event.ItemEvent evt) { + checkShowGUIItemStateChanged(evt); + } + }); + checkShowGUI.addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed(final java.awt.event.ActionEvent evt) { + checkShowGUIActionPerformed(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 0; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + pnlConfigIdrop.add(checkShowGUI, gridBagConstraints); + + checkShowFileProgress.setMnemonic('w'); + checkShowFileProgress.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.checkShowFileProgress.text")); // NOI18N + checkShowFileProgress + .setToolTipText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.checkShowFileProgress.toolTipText")); // NOI18N + checkShowFileProgress + .addItemListener(new java.awt.event.ItemListener() { + @Override + public void itemStateChanged( + final java.awt.event.ItemEvent evt) { + checkShowFileProgressItemStateChanged(evt); + } + }); + checkShowFileProgress + .addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed( + final java.awt.event.ActionEvent evt) { + checkShowFileProgressActionPerformed(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 1; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + pnlConfigIdrop.add(checkShowFileProgress, gridBagConstraints); + + tabConfig + .addTab(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.pnlConfigIdrop.TabConstraints.tabTitle"), + pnlConfigIdrop); // NOI18N + + pnlConfigGrids.setLayout(new java.awt.BorderLayout()); + + pnlCurrentGrid + .setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.pnlCurrentGrid.border.title"))); // NOI18N + pnlCurrentGrid.setLayout(new java.awt.GridBagLayout()); + + lblHostLabel.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N + lblHostLabel.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.lblHostLabel.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; + pnlCurrentGrid.add(lblHostLabel, gridBagConstraints); + + lblHost.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.lblHost.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + pnlCurrentGrid.add(lblHost, gridBagConstraints); + lblHost.getAccessibleContext() + .setAccessibleDescription( + org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.lblHost.AccessibleContext.accessibleDescription")); // NOI18N + + lblPortLabel.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N + lblPortLabel.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.lblPortLabel.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 1; + gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; + pnlCurrentGrid.add(lblPortLabel, gridBagConstraints); + + lblPort.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.lblPort.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 1; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + pnlCurrentGrid.add(lblPort, gridBagConstraints); + lblPort.getAccessibleContext() + .setAccessibleDescription( + org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.lblPort.AccessibleContext.accessibleDescription")); // NOI18N + + lblZoneLabel.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N + lblZoneLabel.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.lblZoneLabel.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 2; + gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; + pnlCurrentGrid.add(lblZoneLabel, gridBagConstraints); + + lblZone.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.lblZone.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 2; + gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + pnlCurrentGrid.add(lblZone, gridBagConstraints); + lblZone.getAccessibleContext() + .setAccessibleDescription( + org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.lblZone.AccessibleContext.accessibleDescription")); // NOI18N + + lblResourceLabel.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N + lblResourceLabel.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.lblResourceLabel.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 4; + gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; + pnlCurrentGrid.add(lblResourceLabel, gridBagConstraints); + + lblUserNameLabel.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N + lblUserNameLabel.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.lblUserNameLabel.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 3; + gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; + pnlCurrentGrid.add(lblUserNameLabel, gridBagConstraints); + + lblUserName.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.lblUserName.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 3; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + pnlCurrentGrid.add(lblUserName, gridBagConstraints); + lblUserName + .getAccessibleContext() + .setAccessibleName( + org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.lblUserName.AccessibleContext.accessibleName")); // NOI18N + + btnLogout.setMnemonic('l'); + btnLogout.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.btnLogout.text")); // NOI18N + btnLogout.setToolTipText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.btnLogout.toolTipText")); // NOI18N + btnLogout.addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed(final java.awt.event.ActionEvent evt) { + btnLogoutActionPerformed(evt); + } + }); + pnlCurrentGridToolbar.add(btnLogout); + + btnChangePassword.setMnemonic('c'); + btnChangePassword.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.btnChangePassword.text")); // NOI18N + btnChangePassword.setToolTipText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.btnChangePassword.toolTipText")); // NOI18N + btnChangePassword + .addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed( + final java.awt.event.ActionEvent evt) { + btnChangePasswordActionPerformed(evt); + } + }); + pnlCurrentGridToolbar.add(btnChangePassword); + + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 5; + gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; + gridBagConstraints.insets = new java.awt.Insets(20, 0, 0, 0); + pnlCurrentGrid.add(pnlCurrentGridToolbar, gridBagConstraints); + + comboPrefsDefaultResource + .setModel(new javax.swing.DefaultComboBoxModel(new String[] { + "Item 1", "Item 2", "Item 3", "Item 4" })); + comboPrefsDefaultResource + .addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed( + final java.awt.event.ActionEvent evt) { + comboPrefsDefaultResourceActionPerformed(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 4; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + pnlCurrentGrid.add(comboPrefsDefaultResource, gridBagConstraints); + + pnlConfigGrids.add(pnlCurrentGrid, java.awt.BorderLayout.CENTER); + + tabConfig + .addTab(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.pnlConfigGrids.TabConstraints.tabTitle"), + pnlConfigGrids); // NOI18N + + pnlConfigTransfers.setLayout(new java.awt.GridBagLayout()); + + pnlTransferManagement + .setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.pnlTransferManagement.border.title"))); // NOI18N + pnlTransferManagement.setLayout(new javax.swing.BoxLayout( + pnlTransferManagement, javax.swing.BoxLayout.PAGE_AXIS)); + + checkLogSuccessfulTransfer + .setText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.checkLogSuccessfulTransfer.text")); // NOI18N + checkLogSuccessfulTransfer + .setToolTipText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.checkLogSuccessfulTransfer.toolTipText")); // NOI18N + checkLogSuccessfulTransfer + .addItemListener(new java.awt.event.ItemListener() { + @Override + public void itemStateChanged( + final java.awt.event.ItemEvent evt) { + checkLogSuccessfulTransferItemStateChanged(evt); + } + }); + checkLogSuccessfulTransfer + .addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed( + final java.awt.event.ActionEvent evt) { + checkLogSuccessfulTransferActionPerformed(evt); + } + }); + pnlTransferManagement.add(checkLogSuccessfulTransfer); + + checkVerifyChecksumOnTransfer + .setText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.checkVerifyChecksumOnTransfer.text")); // NOI18N + checkVerifyChecksumOnTransfer + .addItemListener(new java.awt.event.ItemListener() { + @Override + public void itemStateChanged( + final java.awt.event.ItemEvent evt) { + checkVerifyChecksumOnTransferItemStateChanged(evt); + } + }); + checkVerifyChecksumOnTransfer + .addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed( + final java.awt.event.ActionEvent evt) { + checkVerifyChecksumOnTransferActionPerformed(evt); + } + }); + pnlTransferManagement.add(checkVerifyChecksumOnTransfer); + + checkAllowRerouting.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.checkAllowRerouting.text")); // NOI18N + checkAllowRerouting + .setToolTipText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.checkAllowRerouting.toolTipText")); // NOI18N + checkAllowRerouting.addItemListener(new java.awt.event.ItemListener() { + @Override + public void itemStateChanged(final java.awt.event.ItemEvent evt) { + checkAllowReroutingItemStateChanged(evt); + } + }); + pnlTransferManagement.add(checkAllowRerouting); + + checkConnectionRestart.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.checkConnectionRestart.text")); // NOI18N + checkConnectionRestart + .setToolTipText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.checkConnectionRestart.toolTipText")); // NOI18N + checkConnectionRestart + .addItemListener(new java.awt.event.ItemListener() { + @Override + public void itemStateChanged( + final java.awt.event.ItemEvent evt) { + checkConnectionRestartItemStateChanged(evt); + } + }); + checkConnectionRestart + .addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed( + final java.awt.event.ActionEvent evt) { + checkConnectionRestartActionPerformed(evt); + } + }); + pnlTransferManagement.add(checkConnectionRestart); + + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 0; + gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; + gridBagConstraints.gridheight = java.awt.GridBagConstraints.RELATIVE; + gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; + pnlConfigTransfers.add(pnlTransferManagement, gridBagConstraints); + + plnPipelineConfiguration + .setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.plnPipelineConfiguration.border.title"))); // NOI18N + plnPipelineConfiguration.setLayout(new java.awt.GridBagLayout()); + + lblIrodsSocketTimeout.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.lblIrodsSocketTimeout.text")); // NOI18N + lblIrodsSocketTimeout.setPreferredSize(null); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; + plnPipelineConfiguration.add(lblIrodsSocketTimeout, gridBagConstraints); + + spinnerIrodsSocketTimeout.setModel(new javax.swing.SpinnerNumberModel( + 0, 0, 600, 10)); + spinnerIrodsSocketTimeout + .setToolTipText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.spinnerIrodsSocketTimeout.toolTipText")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + plnPipelineConfiguration.add(spinnerIrodsSocketTimeout, + gridBagConstraints); + + pnlParallelTransferOptions + .setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.pnlParallelTransferOptions.border.title"))); // NOI18N + pnlParallelTransferOptions.setLayout(new java.awt.GridBagLayout()); + + checkAllowParallelTransfers.setMnemonic('p'); + checkAllowParallelTransfers + .setText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.checkAllowParallelTransfers.text")); // NOI18N + checkAllowParallelTransfers + .setToolTipText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.checkAllowParallelTransfers.toolTipText")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 0; + gridBagConstraints.gridwidth = 2; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + pnlParallelTransferOptions.add(checkAllowParallelTransfers, + gridBagConstraints); + + checkUseNIOForParallelTransfers + .setText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.checkUseNIOForParallelTransfers.text")); // NOI18N + checkUseNIOForParallelTransfers + .setToolTipText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.checkUseNIOForParallelTransfers.toolTipText")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 1; + gridBagConstraints.gridwidth = 2; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + pnlParallelTransferOptions.add(checkUseNIOForParallelTransfers, + gridBagConstraints); + + checkUseExecutorPool.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.checkUseExecutorPool.text")); // NOI18N + checkUseExecutorPool.addItemListener(new java.awt.event.ItemListener() { + @Override + public void itemStateChanged(final java.awt.event.ItemEvent evt) { + checkUseExecutorPoolItemStateChanged(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 2; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + pnlParallelTransferOptions + .add(checkUseExecutorPool, gridBagConstraints); + + lblIrodsParallelSocketTimeout + .setText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.lblIrodsParallelSocketTimeout.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 6; + gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.insets = new java.awt.Insets(28, 0, 0, 0); + pnlParallelTransferOptions.add(lblIrodsParallelSocketTimeout, + gridBagConstraints); + + spinnerIrodsParallelSocketTimeout + .setModel(new javax.swing.SpinnerNumberModel(0, 0, 600, 10)); + spinnerIrodsParallelSocketTimeout + .setToolTipText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.spinnerIrodsParallelSocketTimeout.toolTipText")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 6; + gridBagConstraints.ipadx = 159; + gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; + gridBagConstraints.insets = new java.awt.Insets(22, 0, 0, 0); + pnlParallelTransferOptions.add(spinnerIrodsParallelSocketTimeout, + gridBagConstraints); + + lblMaximumParallelTransferThreads + .setText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.lblMaximumParallelTransferThreads.text")); // NOI18N + lblMaximumParallelTransferThreads + .setToolTipText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.lblMaximumParallelTransferThreads.toolTipText")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 7; + gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; + gridBagConstraints.insets = new java.awt.Insets(6, 180, 0, 0); + pnlParallelTransferOptions.add(lblMaximumParallelTransferThreads, + gridBagConstraints); + + spinnerIrodsMaxParallelThreads + .setModel(new javax.swing.SpinnerNumberModel(4, 0, 16, 1)); + spinnerIrodsMaxParallelThreads + .setToolTipText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.spinnerIrodsMaxParallelThreads.toolTipText")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 7; + gridBagConstraints.gridheight = 2; + gridBagConstraints.ipadx = 171; + gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; + gridBagConstraints.insets = new java.awt.Insets(0, 0, 22, 0); + pnlParallelTransferOptions.add(spinnerIrodsMaxParallelThreads, + gridBagConstraints); + + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 1; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + plnPipelineConfiguration.add(pnlParallelTransferOptions, + gridBagConstraints); + + pnlBuffers.setBorder(javax.swing.BorderFactory + .createTitledBorder(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.pnlBuffers.border.title"))); // NOI18N + pnlBuffers.setToolTipText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.pnlBuffers.toolTipText")); // NOI18N + pnlBuffers.setLayout(new java.awt.GridBagLayout()); + + lblInternalInputBufferSize + .setText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.lblInternalInputBufferSize.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 0; + gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + pnlBuffers.add(lblInternalInputBufferSize, gridBagConstraints); + + txtInternalInputBufferSize.setColumns(20); + txtInternalInputBufferSize + .setText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.txtInternalInputBufferSize.text")); // NOI18N + txtInternalInputBufferSize + .setToolTipText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.txtInternalInputBufferSize.toolTipText")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 2; + gridBagConstraints.gridy = 0; + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + pnlBuffers.add(txtInternalInputBufferSize, gridBagConstraints); + + lblInternalOutputBufferSize + .setText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.lblInternalOutputBufferSize.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 1; + gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + pnlBuffers.add(lblInternalOutputBufferSize, gridBagConstraints); + + txtInternalOutputBufferSize.setColumns(20); + txtInternalOutputBufferSize + .setText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.txtInternalOutputBufferSize.text")); // NOI18N + txtInternalOutputBufferSize + .setToolTipText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.txtInternalOutputBufferSize.toolTipText")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 2; + gridBagConstraints.gridy = 1; + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + pnlBuffers.add(txtInternalOutputBufferSize, gridBagConstraints); + + lblLocalFileInputBufferSize + .setText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.lblLocalFileInputBufferSize.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 2; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; + pnlBuffers.add(lblLocalFileInputBufferSize, gridBagConstraints); + + txtLocalFileInputBufferSize.setColumns(20); + txtLocalFileInputBufferSize + .setText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.txtLocalFileInputBufferSize.text")); // NOI18N + txtLocalFileInputBufferSize + .setToolTipText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.txtLocalFileInputBufferSize.toolTipText")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 2; + gridBagConstraints.gridy = 2; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + pnlBuffers.add(txtLocalFileInputBufferSize, gridBagConstraints); + + lblLocalFileOutputBufferSize + .setText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.lblLocalFileOutputBufferSize.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 3; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; + pnlBuffers.add(lblLocalFileOutputBufferSize, gridBagConstraints); + + txtLocalFileOutputBufferSize.setColumns(20); + txtLocalFileOutputBufferSize + .setText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.txtLocalFileOutputBufferSize.text")); // NOI18N + txtLocalFileOutputBufferSize + .setToolTipText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.txtLocalFileOutputBufferSize.toolTipText")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 2; + gridBagConstraints.gridy = 3; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + pnlBuffers.add(txtLocalFileOutputBufferSize, gridBagConstraints); + + lblPutBufferSize.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.lblPutBufferSize.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 5; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; + pnlBuffers.add(lblPutBufferSize, gridBagConstraints); + + txtPutBufferSize.setColumns(20); + txtPutBufferSize.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.txtPutBufferSize.text")); // NOI18N + txtPutBufferSize.setToolTipText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.txtPutBufferSize.toolTipText")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 2; + gridBagConstraints.gridy = 5; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + pnlBuffers.add(txtPutBufferSize, gridBagConstraints); + + lblGetBufferSize.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.lblGetBufferSize.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 4; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; + pnlBuffers.add(lblGetBufferSize, gridBagConstraints); + + txtGetBufferSize.setColumns(20); + txtGetBufferSize.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.txtGetBufferSize.text")); // NOI18N + txtGetBufferSize.setToolTipText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.txtGetBufferSize.toolTipText")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 2; + gridBagConstraints.gridy = 4; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + pnlBuffers.add(txtGetBufferSize, gridBagConstraints); + + lblIputToOutputCopyBufferSize + .setText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.lblIputToOutputCopyBufferSize.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 6; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; + pnlBuffers.add(lblIputToOutputCopyBufferSize, gridBagConstraints); + + txtInputToOutputCopyBufferSize.setColumns(20); + txtInputToOutputCopyBufferSize + .setText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.txtInputToOutputCopyBufferSize.text")); // NOI18N + txtInputToOutputCopyBufferSize + .setToolTipText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.txtInputToOutputCopyBufferSize.toolTipText")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 2; + gridBagConstraints.gridy = 6; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + pnlBuffers.add(txtInputToOutputCopyBufferSize, gridBagConstraints); + + lblInternalCacheBufferSize + .setText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.lblInternalCacheBufferSize.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 7; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; + pnlBuffers.add(lblInternalCacheBufferSize, gridBagConstraints); + + txtInternalCacheBufferSize.setColumns(20); + txtInternalCacheBufferSize + .setText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.txtInternalCacheBufferSize.text")); // NOI18N + txtInternalCacheBufferSize + .setToolTipText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.txtInternalCacheBufferSize.toolTipText")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 2; + gridBagConstraints.gridy = 7; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + pnlBuffers.add(txtInternalCacheBufferSize, gridBagConstraints); + + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 1; + gridBagConstraints.gridwidth = 3; + gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; + plnPipelineConfiguration.add(pnlBuffers, gridBagConstraints); + + btnRestoreDefaults.setMnemonic('a'); + btnRestoreDefaults.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.btnRestoreDefaults.text")); // NOI18N + btnRestoreDefaults.setToolTipText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.btnRestoreDefaults.toolTipText")); // NOI18N + btnRestoreDefaults + .addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed( + final java.awt.event.ActionEvent evt) { + btnRestoreDefaultsActionPerformed(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 2; + gridBagConstraints.gridy = 3; + plnPipelineConfiguration.add(btnRestoreDefaults, gridBagConstraints); + + btnApplyPipelineConfig.setMnemonic('a'); + btnApplyPipelineConfig.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.btnApplyPipelineConfig.text")); // NOI18N + btnApplyPipelineConfig + .setToolTipText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.btnApplyPipelineConfig.toolTipText")); // NOI18N + btnApplyPipelineConfig + .addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed( + final java.awt.event.ActionEvent evt) { + btnApplyPipelineConfigActionPerformed(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 3; + gridBagConstraints.gridy = 3; + plnPipelineConfiguration + .add(btnApplyPipelineConfig, gridBagConstraints); + + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 2; + gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; + gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; + pnlConfigTransfers.add(plnPipelineConfiguration, gridBagConstraints); + + tabConfig + .addTab(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.pnlConfigTransfers.TabConstraints.tabTitle"), + pnlConfigTransfers); // NOI18N + + pnlConfigSynch + .addComponentListener(new java.awt.event.ComponentAdapter() { + @Override + public void componentShown( + final java.awt.event.ComponentEvent evt) { + pnlConfigSynchComponentShown(evt); + } + }); + pnlConfigSynch.setLayout(new java.awt.BorderLayout()); + + pnlConfigSynchListing.setMinimumSize(new java.awt.Dimension(23, 100)); + pnlConfigSynchListing.setLayout(new java.awt.BorderLayout()); + + btnRefreshSynch.setMnemonic('r'); + btnRefreshSynch.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.btnRefreshSynch.text")); // NOI18N + btnRefreshSynch.setToolTipText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.btnRefreshSynch.toolTipText")); // NOI18N + btnRefreshSynch.addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed(final java.awt.event.ActionEvent evt) { + btnRefreshSynchActionPerformed(evt); + } + }); + pnlSynchRefresh.add(btnRefreshSynch); + + pnlConfigSynchListing.add(pnlSynchRefresh, java.awt.BorderLayout.NORTH); + + scrollSynchTable.setMinimumSize(new java.awt.Dimension(23, 100)); + scrollSynchTable.setPreferredSize(new java.awt.Dimension(100, 100)); + pnlConfigSynchListing.add(scrollSynchTable, + java.awt.BorderLayout.CENTER); + + pnlConfigSynch.add(pnlConfigSynchListing, java.awt.BorderLayout.CENTER); + + pnlConfigSynchDetails.setLayout(new java.awt.BorderLayout()); + + pnlSynchData.setBorder(javax.swing.BorderFactory + .createBevelBorder(javax.swing.border.BevelBorder.RAISED)); + pnlSynchData.setLayout(new java.awt.GridBagLayout()); + + pnlSynchName.setLayout(new java.awt.GridBagLayout()); + + lblSynchName.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.lblSynchName.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 1; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; + pnlSynchName.add(lblSynchName, gridBagConstraints); + + txtSynchName.setColumns(40); + txtSynchName.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.txtSynchName.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 1; + gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + pnlSynchName.add(txtSynchName, gridBagConstraints); + + lblSynchDateLabel.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.lblSynchDateLabel.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 2; + gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; + pnlSynchName.add(lblSynchDateLabel, gridBagConstraints); + + lblSynchDate.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.lblSynchDate.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 2; + gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + pnlSynchName.add(lblSynchDate, gridBagConstraints); + + lblSynchStatus.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.lblSynchStatus.text")); // NOI18N + lblSynchStatus.setMaximumSize(null); + lblSynchStatus.setMinimumSize(new java.awt.Dimension(10, 10)); + lblSynchStatus.setPreferredSize(new java.awt.Dimension(10, 10)); + pnlSynchIcon.add(lblSynchStatus); + + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 2; + gridBagConstraints.gridy = 2; + gridBagConstraints.gridwidth = 3; + gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; + pnlSynchName.add(pnlSynchIcon, gridBagConstraints); + + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 0; + gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.insets = new java.awt.Insets(20, 20, 30, 20); + pnlSynchData.add(pnlSynchName, gridBagConstraints); + + txtLocalPath.setColumns(80); + txtLocalPath.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.txtLocalPath.text")); // NOI18N + txtLocalPath.setToolTipText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.txtLocalPath.toolTipText")); // NOI18N + txtLocalPath.addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed(final java.awt.event.ActionEvent evt) { + txtLocalPathActionPerformed(evt); + } + }); + pnlLocalSynch.add(txtLocalPath); + + btnChooseLocalSynch.setMnemonic('c'); + btnChooseLocalSynch.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.btnChooseLocalSynch.text")); // NOI18N + btnChooseLocalSynch + .setToolTipText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.btnChooseLocalSynch.toolTipText")); // NOI18N + btnChooseLocalSynch + .addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed( + final java.awt.event.ActionEvent evt) { + btnChooseLocalSynchActionPerformed(evt); + } + }); + pnlLocalSynch.add(btnChooseLocalSynch); + + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 1; + gridBagConstraints.gridwidth = 9; + gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 10); + pnlSynchData.add(pnlLocalSynch, gridBagConstraints); + + pnlSynchMode.setBorder(javax.swing.BorderFactory + .createLineBorder(new java.awt.Color(0, 0, 0))); + pnlSynchMode.setLayout(new java.awt.GridLayout(0, 1)); + + jLabel1.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.jLabel1.text")); // NOI18N + pnlSynchMode.add(jLabel1); + + buttonGroupSynchMode.add(radioBackup); + radioBackup.setSelected(true); + radioBackup.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.radioBackup.text")); // NOI18N + pnlSynchMode.add(radioBackup); + + buttonGroupSynchMode.add(radioFeed); + radioFeed.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.radioFeed.text")); // NOI18N + radioFeed.setEnabled(false); + pnlSynchMode.add(radioFeed); + + buttonGroupSynchMode.add(radioSynch); + radioSynch.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.radioSynch.text")); // NOI18N + radioSynch.setEnabled(false); + pnlSynchMode.add(radioSynch); + + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 2; + gridBagConstraints.gridwidth = 9; + gridBagConstraints.gridheight = 2; + gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; + gridBagConstraints.insets = new java.awt.Insets(20, 20, 20, 20); + pnlSynchData.add(pnlSynchMode, gridBagConstraints); + + pnlSynchFrequency.setBorder(javax.swing.BorderFactory + .createLineBorder(new java.awt.Color(0, 0, 0))); + pnlSynchFrequency.setLayout(new java.awt.GridLayout(0, 1)); + + jLabel5.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.jLabel5.text")); // NOI18N + pnlSynchFrequency.add(jLabel5); + + jcomboSynchFrequency.setModel(new javax.swing.DefaultComboBoxModel( + new String[] { "Hourly", "Weekly", "Daily", + "Every 2 Minutes (testing)", "", "" })); + jcomboSynchFrequency + .setToolTipText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.jcomboSynchFrequency.toolTipText")); // NOI18N + pnlSynchFrequency.add(jcomboSynchFrequency); + + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 4; + gridBagConstraints.gridwidth = 9; + gridBagConstraints.gridheight = 2; + gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; + gridBagConstraints.insets = new java.awt.Insets(20, 20, 20, 20); + pnlSynchData.add(pnlSynchFrequency, gridBagConstraints); + + txtIrodsPath.setColumns(80); + txtIrodsPath.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.txtIrodsPath.text")); // NOI18N + txtIrodsPath.setToolTipText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.txtIrodsPath.toolTipText")); // NOI18N + txtIrodsPath.addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed(final java.awt.event.ActionEvent evt) { + txtIrodsPathActionPerformed(evt); + } + }); + pnlIrodsSynch.add(txtIrodsPath); + + btnChooseIrodsSynch.setMnemonic('i'); + btnChooseIrodsSynch.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.btnChooseIrodsSynch.text")); // NOI18N + btnChooseIrodsSynch + .setToolTipText(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.btnChooseIrodsSynch.toolTipText")); // NOI18N + btnChooseIrodsSynch + .addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed( + final java.awt.event.ActionEvent evt) { + btnChooseIrodsSynchActionPerformed(evt); + } + }); + pnlIrodsSynch.add(btnChooseIrodsSynch); + + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 6; + gridBagConstraints.gridwidth = 9; + gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 10); + pnlSynchData.add(pnlIrodsSynch, gridBagConstraints); + + pnlConfigSynchDetails.add(pnlSynchData, java.awt.BorderLayout.CENTER); + + btnDeleteSynch.setMnemonic('d'); + btnDeleteSynch.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.btnDeleteSynch.text")); // NOI18N + btnDeleteSynch.setToolTipText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.btnDeleteSynch.toolTipText")); // NOI18N + btnDeleteSynch.setEnabled(false); + btnDeleteSynch.addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed(final java.awt.event.ActionEvent evt) { + btnDeleteSynchActionPerformed(evt); + } + }); + panelSynchToolbar.add(btnDeleteSynch); + + btnNewSynch.setMnemonic('n'); + btnNewSynch.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.btnNewSynch.text")); // NOI18N + btnNewSynch.setToolTipText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.btnNewSynch.toolTipText")); // NOI18N + btnNewSynch.addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed(final java.awt.event.ActionEvent evt) { + btnNewSynchActionPerformed(evt); + } + }); + panelSynchToolbar.add(btnNewSynch); + + btnUpdateSynch.setMnemonic('u'); + btnUpdateSynch.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.btnUpdateSynch.text")); // NOI18N + btnUpdateSynch.setToolTipText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.btnUpdateSynch.toolTipText")); // NOI18N + btnUpdateSynch.setEnabled(false); + btnUpdateSynch.addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed(final java.awt.event.ActionEvent evt) { + btnUpdateSynchActionPerformed(evt); + } + }); + panelSynchToolbar.add(btnUpdateSynch); + + btnSynchNow.setMnemonic('s'); + btnSynchNow.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.btnSynchNow.text")); // NOI18N + btnSynchNow.setToolTipText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.btnSynchNow.toolTipText")); // NOI18N + btnSynchNow.setEnabled(false); + btnSynchNow.addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed(final java.awt.event.ActionEvent evt) { + btnSynchNowActionPerformed(evt); + } + }); + panelSynchToolbar.add(btnSynchNow); + + pnlConfigSynchDetails.add(panelSynchToolbar, + java.awt.BorderLayout.SOUTH); + + pnlConfigSynch.add(pnlConfigSynchDetails, java.awt.BorderLayout.SOUTH); + + tabConfig + .addTab(org.openide.util.NbBundle + .getMessage(IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.pnlConfigSynch.TabConstraints.tabTitle"), + pnlConfigSynch); // NOI18N + + pnlCenter.add(tabConfig); + + getContentPane().add(pnlCenter, java.awt.BorderLayout.CENTER); + + pnlBottom.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT)); + + btnOK.setMnemonic('O'); + btnOK.setText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.btnOK.text")); // NOI18N + btnOK.setToolTipText(org.openide.util.NbBundle.getMessage( + IDROPConfigurationPanel.class, + "IDROPConfigurationPanel.btnOK.toolTipText")); // NOI18N + btnOK.addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed(final java.awt.event.ActionEvent evt) { + btnOKActionPerformed(evt); + } + }); + pnlBottom.add(btnOK); + + getContentPane().add(pnlBottom, java.awt.BorderLayout.SOUTH); + + pack(); + }// </editor-fold>//GEN-END:initComponents + + /** + * Refresh the displayed synch + * + * @param evt + */ + private void btnRefreshSynchActionPerformed( + final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnRefreshSynchActionPerformed + refreshSynchConfigPanel(); + }// GEN-LAST:event_btnRefreshSynchActionPerformed + + private void checkShowFileProgressActionPerformed( + final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_checkShowFileProgressActionPerformed + // + }// GEN-LAST:event_checkShowFileProgressActionPerformed + + private void checkShowGUIItemStateChanged(final java.awt.event.ItemEvent evt) {// GEN-FIRST:event_checkShowGUIItemStateChanged + + boolean isSelected = false; + if (evt.getStateChange() == ItemEvent.SELECTED) { + isSelected = true; + } + log.info("updating show gui at startup to:{}", isSelected); + try { + idropCore.getIdropConfigurationService().updateConfig( + IdropConfigurationService.SHOW_GUI, + Boolean.toString(isSelected)); + } catch (IdropException ex) { + log.error("error setting show gui property", ex); + throw new IdropRuntimeException(ex); + } + }// GEN-LAST:event_checkShowGUIItemStateChanged + + private void checkShowFileProgressItemStateChanged( + final java.awt.event.ItemEvent evt) {// GEN-FIRST:event_checkShowFileProgressItemStateChanged + boolean isSelected = false; + if (evt.getStateChange() == ItemEvent.SELECTED) { + isSelected = true; + } + log.info("updating show intra-file progress to:{}", isSelected); + try { + idropCore.getIdropConfigurationService().updateConfig( + IdropConfigurationService.INTRA_FILE_STATUS_CALLBACKS, + Boolean.toString(isSelected)); + idropCore.getIdropConfigurationService() + .updateJargonPropertiesBasedOnIDROPConfig(); + } catch (Exception ex) { + log.error("error setting property", ex); + throw new IdropRuntimeException(ex); + } + }// GEN-LAST:event_checkShowFileProgressItemStateChanged + + private void checkVerifyChecksumOnTransferItemStateChanged( + final java.awt.event.ItemEvent evt) {// GEN-FIRST:event_checkVerifyChecksumOnTransferItemStateChanged + updateConfigForGivenPropertyBasedOnCheckboxStateChange(evt, + IdropConfigurationService.VERIFY_CHECKSUM_ON_TRANSFER); + } + + private void updateConfigForGivenPropertyBasedOnCheckboxStateChange( + final ItemEvent evt, final String propertyName) + throws IdropRuntimeException { + boolean isSelected = false; + if (evt.getStateChange() == ItemEvent.SELECTED) { + isSelected = true; + } + log.info("updating verify checksum to:{}", isSelected); + try { + idropCore.getIdropConfigurationService().updateConfig(propertyName, + Boolean.toString(isSelected)); + idropCore.getIdropConfigurationService() + .updateJargonPropertiesBasedOnIDROPConfig(); + } catch (Exception ex) { + log.error("error setting property", ex); + throw new IdropRuntimeException(ex); + } + }// GEN-LAST:event_checkVerifyChecksumOnTransferItemStateChanged + + private void checkLogSuccessfulTransferItemStateChanged( + final java.awt.event.ItemEvent evt) {// GEN-FIRST:event_checkLogSuccessfulTransferItemStateChanged + + updateConfigForGivenPropertyBasedOnCheckboxStateChange( + evt, + IdropConfigurationService.TRANSFER_ENGINE_RECORD_SUCCESSFUL_FILES); + }// GEN-LAST:event_checkLogSuccessfulTransferItemStateChanged + + private void checkUseExecutorPoolItemStateChanged( + final java.awt.event.ItemEvent evt) {// GEN-FIRST:event_checkUseExecutorPoolItemStateChanged + updateConfigForGivenPropertyBasedOnCheckboxStateChange(evt, + IdropConfigurationService.IRODS_PARALLEL_USE_POOL); + }// GEN-LAST:event_checkUseExecutorPoolItemStateChanged + + private void checkAllowReroutingItemStateChanged( + final java.awt.event.ItemEvent evt) {// GEN-FIRST:event_checkAllowReroutingItemStateChanged + boolean isSelected = false; + if (evt.getStateChange() == ItemEvent.SELECTED) { + isSelected = true; + } + log.info("updating allow rerouting to:{}", isSelected); + try { + idropCore.getIdropConfigurationService().updateConfig( + IdropConfigurationService.ALLOW_CONNECTION_REROUTING, + Boolean.toString(isSelected)); + idropCore.getIdropConfigurationService() + .updateJargonPropertiesBasedOnIDROPConfig(); + } catch (Exception ex) { + log.error("error setting property", ex); + throw new IdropRuntimeException(ex); + } + }// GEN-LAST:event_checkAllowReroutingItemStateChanged + + private void resetTransferPipelineEditColors() { + txtInternalInputBufferSize.setBackground(Color.white); + txtInternalOutputBufferSize.setBackground(Color.white); + txtLocalFileInputBufferSize.setBackground(Color.white); + txtLocalFileOutputBufferSize.setBackground(Color.white); + txtGetBufferSize.setBackground(Color.white); + txtPutBufferSize.setBackground(Color.white); + txtInputToOutputCopyBufferSize.setBackground(Color.white); + txtInternalCacheBufferSize.setBackground(Color.white); + } + + /** + * Update the pipeline configuration information properties based on the + * screen data + * + * @param evt + */ + private void btnApplyPipelineConfigActionPerformed( + final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnApplyPipelineConfigActionPerformed + try { + + resetTransferPipelineEditColors(); + // edit and set + + // internal input buffer size + String actual = txtInternalInputBufferSize.getText(); + if (actual.isEmpty()) { + } else { + try { + Integer.parseInt(actual); + idropCore + .getIdropConfigurationService() + .updateConfig( + IdropConfigurationService.IRODS_IO_INTERNAL_INPUT_STREAM_BUFFER_SIZE, + actual); + } catch (NumberFormatException nfe) { + txtInternalInputBufferSize.setBackground(Color.red); + MessageManager.showWarning(this, + "Invalid internal input buffer size", + MessageManager.TITLE_MESSAGE); + return; + } + } + + // internal output buffer size + actual = txtInternalOutputBufferSize.getText(); + if (actual.isEmpty()) { + } else { + try { + Integer.parseInt(actual); + idropCore + .getIdropConfigurationService() + .updateConfig( + IdropConfigurationService.IRODS_IO_INTERNAL_OUTPUT_STREAM_BUFFER_SIZE, + actual); + } catch (NumberFormatException nfe) { + txtInternalOutputBufferSize.setBackground(Color.red); + MessageManager.showWarning(this, + "Invalid internal output buffer size", + MessageManager.TITLE_MESSAGE); + return; + } + } + + // local file input buffer size + actual = txtLocalFileInputBufferSize.getText(); + if (actual.isEmpty()) { + } else { + try { + Integer.parseInt(actual); + idropCore + .getIdropConfigurationService() + .updateConfig( + IdropConfigurationService.IRODS_IO_LOCAL_INPUT_STREAM_BUFFER_SIZE, + actual); + } catch (NumberFormatException nfe) { + txtLocalFileInputBufferSize.setBackground(Color.red); + MessageManager.showWarning(this, + "Invalid local file input buffer size", + MessageManager.TITLE_MESSAGE); + return; + } + } + + // local file output buffer size + actual = txtLocalFileOutputBufferSize.getText(); + if (actual.isEmpty()) { + } else { + try { + Integer.parseInt(actual); + idropCore + .getIdropConfigurationService() + .updateConfig( + IdropConfigurationService.IRODS_IO_LOCAL_OUTPUT_STREAM_BUFFER_SIZE, + actual); + } catch (NumberFormatException nfe) { + txtLocalFileOutputBufferSize.setBackground(Color.red); + MessageManager.showWarning(this, + "Invalid local file output buffer size", + MessageManager.TITLE_MESSAGE); + return; + } + } + + // get buffer size + actual = txtGetBufferSize.getText(); + if (actual.isEmpty()) { + } else { + try { + Integer.parseInt(actual); + idropCore.getIdropConfigurationService().updateConfig( + IdropConfigurationService.IRODS_IO_GET_BUFFER_SIZE, + actual); + } catch (NumberFormatException nfe) { + txtGetBufferSize.setBackground(Color.red); + MessageManager.showWarning(this, "Invalid get buffer size", + MessageManager.TITLE_MESSAGE); + return; + } + } + + // put buffer size + actual = txtPutBufferSize.getText(); + if (actual.isEmpty()) { + } else { + try { + Integer.parseInt(actual); + idropCore.getIdropConfigurationService().updateConfig( + IdropConfigurationService.IRODS_IO_PUT_BUFFER_SIZE, + actual); + } catch (NumberFormatException nfe) { + txtPutBufferSize.setBackground(Color.red); + MessageManager.showWarning(this, "Invalid put buffer size", + MessageManager.TITLE_MESSAGE); + return; + } + } + + // input to output copy buffer size + actual = txtInputToOutputCopyBufferSize.getText(); + if (actual.isEmpty()) { + } else { + try { + Integer.parseInt(actual); + idropCore + .getIdropConfigurationService() + .updateConfig( + IdropConfigurationService.IRODS_IO_INPUT_TO_OUTPUT_COPY_BUFFER_SIZE, + actual); + } catch (NumberFormatException nfe) { + txtInputToOutputCopyBufferSize.setBackground(Color.red); + MessageManager.showWarning(this, + "Invalid input to output copy buffer size", + MessageManager.TITLE_MESSAGE); + return; + } + } + + // internal cache buffer size + actual = txtInternalCacheBufferSize.getText(); + if (actual.isEmpty()) { + } else { + try { + Integer.parseInt(actual); + idropCore + .getIdropConfigurationService() + .updateConfig( + IdropConfigurationService.IRODS_IO_INTERNAL_CACHE_BUFFER_SIZE, + actual); + } catch (NumberFormatException nfe) { + txtInternalCacheBufferSize.setBackground(Color.red); + MessageManager.showWarning(this, + "Invalid internal cache buffer size", + MessageManager.TITLE_MESSAGE); + return; + } + } + + idropCore.getIdropConfigurationService().updateConfig( + IdropConfigurationService.IRODS_PARALLEL_USE_PARALLEL, + Boolean.toString(checkAllowParallelTransfers.isSelected())); + idropCore.getIdropConfigurationService().updateConfig( + IdropConfigurationService.IRODS_PARALLEL_USE_NIO, + Boolean.toString(checkUseNIOForParallelTransfers + .isSelected())); + idropCore + .getIdropConfigurationService() + .updateConfig( + IdropConfigurationService.IRODS_PARALLEL_CONNECTION_MAX_THREADS, + spinnerIrodsMaxParallelThreads.getValue() + .toString()); + idropCore + .getIdropConfigurationService() + .updateConfig( + IdropConfigurationService.IRODS_PARALLEL_CONNECTION_TIMEOUT, + spinnerIrodsParallelSocketTimeout.getValue() + .toString()); + idropCore.getIdropConfigurationService().updateConfig( + IdropConfigurationService.IRODS_CONNECTION_TIMEOUT, + spinnerIrodsSocketTimeout.getValue().toString()); + + idropCore.getIdropConfigurationService() + .updateJargonPropertiesBasedOnIDROPConfig(); + } catch (Exception ex) { + log.error("error setting property", ex); + throw new IdropRuntimeException(ex); + } + }// GEN-LAST:event_btnApplyPipelineConfigActionPerformed + + private void btnRestoreDefaultsActionPerformed( + final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnRestoreDefaultsActionPerformed + log.info("restoring pipeline config to jargon properties settings"); + try { + JargonProperties defaultJargonProperties = new DefaultPropertiesJargonConfig(); + IdropConfigurationService configService = idropCore + .getIdropConfigurationService(); + configService + .restoreIDROPConfigFromJargonProperties(defaultJargonProperties); + initWithConfigData(); + MessageManager.showMessage(this, + "Values restored to defaults, hit apply to update", + MessageManager.TITLE_MESSAGE); + } catch (JargonException ex) { + log.error("unable to restore jargon properties", ex); + throw new IdropRuntimeException( + "unable to restore jargon properties", ex); + } + + }// GEN-LAST:event_btnRestoreDefaultsActionPerformed + + private void comboPrefsDefaultResourceActionPerformed( + final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_comboPrefsDefaultResourceActionPerformed + String newResource = (String) comboPrefsDefaultResource + .getSelectedItem(); + idropCore.getIrodsAccount().setDefaultStorageResource(newResource); + if (!initializing) { + idropGui.reinitializeForChangedIRODSAccount(); + } else { + initializing = false; + } + }// GEN-LAST:event_comboPrefsDefaultResourceActionPerformed + + private void checkConnectionRestartActionPerformed( + final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_checkConnectionRestartActionPerformed + + }// GEN-LAST:event_checkConnectionRestartActionPerformed + + private void checkConnectionRestartItemStateChanged( + final java.awt.event.ItemEvent evt) {// GEN-FIRST:event_checkConnectionRestartItemStateChanged + boolean isSelected = false; + if (evt.getStateChange() == ItemEvent.SELECTED) { + isSelected = true; + } + log.info("updating connection restart to:{}", isSelected); + try { + idropCore.getIdropConfigurationService().updateConfig( + IdropConfigurationService.IRODS_CONNECTION_RESTART, + Boolean.toString(isSelected)); + idropCore.getIdropConfigurationService() + .updateJargonPropertiesBasedOnIDROPConfig(); + } catch (Exception ex) { + log.error("error setting property", ex); + throw new IdropRuntimeException(ex); + } + }// GEN-LAST:event_checkConnectionRestartItemStateChanged + + private void btnOKActionPerformed(final java.awt.event.ActionEvent evt) { + dispose(); + } + + private void checkShowGUIActionPerformed( + final java.awt.event.ActionEvent evt) { + // + } + + private void checkLogSuccessfulTransferActionPerformed( + final java.awt.event.ActionEvent evt) { + // + } + + private void pnlConfigSynchComponentShown( + final java.awt.event.ComponentEvent evt) { + + refreshSynchConfigPanel(); + + } + + private void refreshSynchConfigPanel() { + log.info("lazily loading synch data"); + + final IDROPConfigurationPanel thisPanel = this; + + java.awt.EventQueue.invokeLater(new Runnable() { + + @Override + public void run() { + + SynchManagerService synchConfigurationService = idropCore + .getTransferManager().getTransferServiceFactory() + .instanceSynchManagerService(); + + try { + thisPanel.setCursor(Cursor + .getPredefinedCursor(Cursor.WAIT_CURSOR)); + List<Synchronization> synchronizations = synchConfigurationService + .listAllSynchronizations(); + SynchConfigTableModel synchConfigTableModel = null; + if (jTableSynch == null) { + synchConfigTableModel = new SynchConfigTableModel( + idropCore, synchronizations); + jTableSynch = new JTable(synchConfigTableModel); + jTableSynch + .getSelectionModel() + .addListSelectionListener( + new SynchListSelectionHandler(thisPanel)); + scrollSynchTable.setViewportView(jTableSynch); + scrollSynchTable.validate(); + pnlConfigSynchListing.validate(); + } else { + synchConfigTableModel = (SynchConfigTableModel) jTableSynch + .getModel(); + synchConfigTableModel + .setSynchronizations(synchronizations); + synchConfigTableModel.fireTableDataChanged(); + } + + if (synchConfigTableModel.getRowCount() > 0) { + jTableSynch.setRowSelectionInterval(0, 0); + } else { + lockSynchPanelForNewOnly(); + } + } catch (SynchException ex) { + log.error("error setting up synchs table", ex); + throw new IdropRuntimeException(ex); + } finally { + thisPanel.setCursor(Cursor + .getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + } + } + + private void lockSynchPanelForNewOnly() { + clearAndResetSynchPanel(); + setLockStatusSynchPanel(false); + } + }); + } + + private void txtLocalPathActionPerformed( + final java.awt.event.ActionEvent evt) { + // TODO add your handling code here: + } + + private void btnChooseLocalSynchActionPerformed( + final java.awt.event.ActionEvent evt) { + // TODO add your handling code here: + JFileChooser localFileChooser = new JFileChooser(); + localFileChooser.setMultiSelectionEnabled(false); + localFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + localFileChooser.showOpenDialog(this); + txtLocalPath.setText(localFileChooser.getSelectedFile() + .getAbsolutePath()); + } + + private void txtIrodsPathActionPerformed( + final java.awt.event.ActionEvent evt) { + // TODO add your handling code here: + } + + private void btnChooseIrodsSynchActionPerformed( + final java.awt.event.ActionEvent evt) { + try { + IRODSFinderDialog irodsFileSystemChooserView = new IRODSFinderDialog( + null, true, idropCore); + final Toolkit toolkit = Toolkit.getDefaultToolkit(); + final Dimension screenSize = toolkit.getScreenSize(); + final int x = (screenSize.width - irodsFileSystemChooserView + .getWidth()) / 2; + final int y = (screenSize.height - irodsFileSystemChooserView + .getHeight()) / 2; + irodsFileSystemChooserView.setLocation(x, y); + irodsFileSystemChooserView.setVisible(true); + String absPath = irodsFileSystemChooserView + .getSelectedAbsolutePath(); + irodsFileSystemChooserView.dispose(); + if (absPath != null) { + txtIrodsPath.setText(irodsFileSystemChooserView + .getSelectedAbsolutePath()); + } + + // int returnVal = irodsFileChooser.showSaveDialog(this); + } catch (Exception e) { + log.error("exception choosings iRODS file"); + throw new IdropRuntimeException("exception choosing irods fie", e); + } finally { + idropCore.getIrodsFileSystem().closeAndEatExceptions(); + } + } + + /** + * Delete the selected synchronization + * + * @param evt + */ + private void btnDeleteSynchActionPerformed( + final java.awt.event.ActionEvent evt) { + + final IDROPConfigurationPanel thisPanel = this; + + java.awt.EventQueue.invokeLater(new Runnable() { + + @Override + public void run() { + + if (selectedSynchronization == null) { + MessageManager.showError(thisPanel, + "Please select a synchronization from the table", + MessageManager.TITLE_MESSAGE); + return; + } + Synchronization synchronization = selectedSynchronization; + + int result = JOptionPane.showConfirmDialog(thisPanel, + "Do you wish to delete this synchronization?", + MessageManager.TITLE_MESSAGE, + JOptionPane.OK_CANCEL_OPTION); + if (result == JOptionPane.CANCEL_OPTION) { + return; + } + try { + thisPanel.setCursor(Cursor + .getPredefinedCursor(Cursor.WAIT_CURSOR)); + SynchManagerService synchConfigurationService = idropCore + .getTransferManager().getTransferServiceFactory() + .instanceSynchManagerService(); + log.info("deleting synchronization:{}", synchronization); + + if (synchConfigurationService + .isSynchRunning(synchronization)) { + MessageManager + .showMessage( + thisPanel, + "Cannot delete the synchronization, a synch is currently running", + MessageManager.TITLE_MESSAGE); + return; + } + + thisPanel.getSynchTable().getSelectionModel(); + SynchConfigTableModel model = (SynchConfigTableModel) thisPanel + .getSynchTable().getModel(); + + synchConfigurationService + .deleteSynchronization(synchronization); + log.info("synch deleted, refreshing model"); + List<Synchronization> synchronizations = synchConfigurationService + .listAllSynchronizations(); + + model.setSynchronizations(synchronizations); + model.fireTableDataChanged(); + + MessageManager.showMessage(thisPanel, + "Configuration deleted", + MessageManager.TITLE_MESSAGE); + btnDeleteSynch.setEnabled(false); + btnUpdateSynch.setEnabled(false); + btnSynchNow.setEnabled(false); + refreshSynchConfigPanel(); + } catch (Exception ex) { + MessageManager.showError(thisPanel, ex.getMessage(), + MessageManager.TITLE_MESSAGE); + } finally { + thisPanel.setCursor(Cursor + .getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + idropCore.closeIRODSConnection(idropCore.getIrodsAccount()); + } + } + }); + } + + /** + * Called to clear and prepare for adding a new synchronization + * + * @param evt + */ + private void btnNewSynchActionPerformed(final java.awt.event.ActionEvent evt) { + clearAndResetSynchPanel(); + if (jTableSynch.getModel().getRowCount() > 0) { + jTableSynch.getSelectionModel().removeIndexInterval(0, + jTableSynch.getModel().getRowCount() - 1); + } + selectedSynchronization = new Synchronization(); + btnDeleteSynch.setEnabled(false); + btnUpdateSynch.setEnabled(true); + btnSynchNow.setEnabled(false); + MessageManager + .showMessage( + this, + "Enter the data for the new Synchronization and press Update to save", + MessageManager.TITLE_MESSAGE); + setLockStatusSynchPanel(true); + btnSynchNow.setEnabled(false); + btnDeleteSynch.setEnabled(false); + } + + /** + * User signals that the displayed synchronization should be updated + * + * @param evt + */ + private void btnUpdateSynchActionPerformed( + final java.awt.event.ActionEvent evt) { + updateSynch(); + } + + private void updateSynch() { + final IDROPConfigurationPanel thisPanel = this; + + java.awt.EventQueue.invokeLater(new Runnable() { + + @Override + public void run() { + + resetSynchPanel(); + if (selectedSynchronization == null) { + MessageManager.showError(thisPanel, + "Please select a synchronization from the table", + MessageManager.TITLE_MESSAGE); + return; + } + + if (txtLocalPath.getText().trim().isEmpty()) { + txtLocalPath.setBackground(Color.RED); + MessageManager.showError(thisPanel, + "Please select a local path", + MessageManager.TITLE_MESSAGE); + return; + } + + if (txtIrodsPath.getText().trim().isEmpty()) { + txtIrodsPath.setBackground(Color.RED); + MessageManager.showError(thisPanel, + "Please select an iRODS path", + MessageManager.TITLE_MESSAGE); + return; + } + + if (txtSynchName.getText().trim().isEmpty()) { + txtSynchName.setBackground(Color.RED); + MessageManager + .showError( + thisPanel, + "Please enter a unique name for this synchronization", + MessageManager.TITLE_MESSAGE); + return; + } + + boolean isNew = (selectedSynchronization.getId() == null); + if (isNew) { + log.info("adding new synch"); + } + + SynchManagerService synchConfigurationService = idropCore + .getTransferManager().getTransferServiceFactory() + .instanceSynchManagerService(); + + // edits pass, do update + log.info("saving synch data"); + Synchronization synchronization = selectedSynchronization; + synchronization.setUpdatedAt(new Date()); + synchronization.setFrequencyType(getSynchFrequencyFromGUI()); + + synchronization.setName(txtSynchName.getText().trim()); + synchronization.setSynchronizationMode(getSynchTypeFromGUI()); + synchronization.setLocalSynchDirectory(txtLocalPath.getText() + .trim()); + synchronization.setIrodsSynchDirectory(txtIrodsPath.getText() + .trim()); + IRODSAccount irodsAccount = idropCore.getIrodsAccount(); + synchronization.setIrodsHostName(irodsAccount.getHost()); + + try { + synchronization.setIrodsPassword(HibernateUtil + .obfuscate(irodsAccount.getPassword())); + } catch (JargonException ex) { + log.error("exception obfuscating password", ex); + MessageManager.showError(thisPanel, ex.getMessage(), + MessageManager.TITLE_MESSAGE); + throw new IdropRuntimeException(ex); + } + + synchronization.setIrodsPort(irodsAccount.getPort()); + synchronization.setIrodsUserName(irodsAccount.getUserName()); + synchronization.setIrodsZone(irodsAccount.getZone()); + synchronization.setDefaultResourceName(irodsAccount + .getDefaultStorageResource()); + synchronization.setCreatedAt(new Date()); + selectedSynchronization = synchronization; + + try { + thisPanel.setCursor(Cursor + .getPredefinedCursor(Cursor.WAIT_CURSOR)); + if (synchConfigurationService + .isSynchRunning(selectedSynchronization)) { + MessageManager + .showMessage( + thisPanel, + "Cannot update the synchronization, a synch is currently running", + MessageManager.TITLE_MESSAGE); + return; + } + + idropCore.getIdropConfigurationService() + .updateSynchronization(synchronization); + MessageManager.showMessage(thisPanel, + "Configuration updated", + MessageManager.TITLE_MESSAGE); + ListSelectionModel lsm = thisPanel.getSynchTable() + .getSelectionModel(); + SynchConfigTableModel model = (SynchConfigTableModel) thisPanel + .getSynchTable().getModel(); + + if (isNew) { + + List<Synchronization> synchronizations = synchConfigurationService + .listAllSynchronizations(); + + model.setSynchronizations(synchronizations); + model.fireTableDataChanged(); + } else { + if (lsm.isSelectionEmpty()) { + return; + } else { + // Find out which indexes are selected. + int minIndex = lsm.getMinSelectionIndex(); + int maxIndex = lsm.getMaxSelectionIndex(); + for (int i = minIndex; i <= maxIndex; i++) { + if (lsm.isSelectedIndex(i)) { + int modelIdx = thisPanel.getSynchTable() + .convertRowIndexToModel(i); + + model.getSynchronizations().set(modelIdx, + synchronization); + model.fireTableDataChanged(); + break; + } + } + } + } + + btnDeleteSynch.setEnabled(true); + btnUpdateSynch.setEnabled(true); + btnSynchNow.setEnabled(true); + + } catch (IdropException ex) { + MessageManager.showError(thisPanel, ex.getMessage(), + MessageManager.TITLE_MESSAGE); + } catch (SynchException ex) { + MessageManager.showError(thisPanel, ex.getMessage(), + MessageManager.TITLE_MESSAGE); + } finally { + thisPanel.setCursor(Cursor + .getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + idropCore.closeIRODSConnection(idropCore.getIrodsAccount()); + } + } + }); + } + + /** + * Force a synchronization process on the selected synchronization + * + * @param evt + */ + private void btnSynchNowActionPerformed(final java.awt.event.ActionEvent evt) { + log.info("synch now button pressed"); + if (selectedSynchronization == null) { + MessageManager.showWarning(this, "Please select a synhronization", + MessageManager.TITLE_MESSAGE); + return; + } + + log.info("selected synchronization is:{}", selectedSynchronization); + boolean synchIsUnchanged = checkIfSynchChanged(); + + if (!synchIsUnchanged) { + log.info("synch had been changed, update first"); + updateSynch(); + } + + int result = JOptionPane + .showConfirmDialog(this, "Synchronize?", + "Do you want to synchronize now?", + JOptionPane.OK_CANCEL_OPTION); + if (result == JOptionPane.OK_OPTION) { + try { + SynchManagerService synchConfigurationService = idropCore + .getTransferManager().getTransferServiceFactory() + .instanceSynchManagerService(); + + if (synchConfigurationService + .isSynchRunning(selectedSynchronization)) { + MessageManager + .showMessage( + this, + "Cannot schedule the synchronization, a synch is currently running", + MessageManager.TITLE_MESSAGE); + return; + } + idropCore.getTransferManager().enqueueASynch( + selectedSynchronization, + selectedSynchronization + .buildIRODSAccountFromSynchronizationData()); + } catch (Exception ex) { + log.error("error starting synch", ex); + MessageManager.showError(this, ex.getMessage(), + MessageManager.TITLE_MESSAGE); + throw new IdropRuntimeException(ex); + } + } + } + + private void checkVerifyChecksumOnTransferActionPerformed( + final java.awt.event.ActionEvent evt) { + // + } + + private void btnLogoutActionPerformed(final java.awt.event.ActionEvent evt) { + log.info("logging out to log in to a new grid"); + + final IDROPConfigurationPanel thisPanel = this; + + java.awt.EventQueue.invokeLater(new Runnable() { + + @Override + public void run() { + + IRODSAccount savedAccount = idropCore.getIrodsAccount(); + idropCore.setIrodsAccount(null); + iDrop idrop = (iDrop) thisPanel.getParent(); + LoginDialog loginDialog = new LoginDialog(thisPanel, idropCore); + loginDialog.setVisible(true); + + if (idropCore.getIrodsAccount() == null) { + log.warn("no account, reverting"); + idropCore.setIrodsAccount(savedAccount); + } else { + idrop.reinitializeForChangedIRODSAccount(); + } + refreshAccountData(); + } + }); + + } + + private void btnChangePasswordActionPerformed( + final java.awt.event.ActionEvent evt) { + ChangePasswordDialog changePasswordDialog = new ChangePasswordDialog( + (iDrop) getParent(), this, true); + changePasswordDialog.setLocationRelativeTo(this); + changePasswordDialog.setVisible(true); + } + + protected JTable getSynchTable() { + return jTableSynch; + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton btnApplyPipelineConfig; + private javax.swing.JButton btnChangePassword; + private javax.swing.JButton btnChooseIrodsSynch; + private javax.swing.JButton btnChooseLocalSynch; + private javax.swing.JButton btnDeleteSynch; + private javax.swing.JButton btnLogout; + private javax.swing.JButton btnNewSynch; + private javax.swing.JButton btnOK; + private javax.swing.JButton btnRefreshSynch; + private javax.swing.JButton btnRestoreDefaults; + private javax.swing.JButton btnSynchNow; + private javax.swing.JButton btnUpdateSynch; + private javax.swing.ButtonGroup buttonGroupSynchMode; + private javax.swing.JCheckBox checkAllowParallelTransfers; + private javax.swing.JCheckBox checkAllowRerouting; + private javax.swing.JCheckBox checkConnectionRestart; + private javax.swing.JCheckBox checkLogSuccessfulTransfer; + private javax.swing.JCheckBox checkShowFileProgress; + private javax.swing.JCheckBox checkShowGUI; + private javax.swing.JCheckBox checkUseExecutorPool; + private javax.swing.JCheckBox checkUseNIOForParallelTransfers; + private javax.swing.JCheckBox checkVerifyChecksumOnTransfer; + private javax.swing.JComboBox comboPrefsDefaultResource; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel5; + private javax.swing.JComboBox jcomboSynchFrequency; + private javax.swing.JLabel lblGetBufferSize; + private javax.swing.JLabel lblHost; + private javax.swing.JLabel lblHostLabel; + private javax.swing.JLabel lblInternalCacheBufferSize; + private javax.swing.JLabel lblInternalInputBufferSize; + private javax.swing.JLabel lblInternalOutputBufferSize; + private javax.swing.JLabel lblIputToOutputCopyBufferSize; + private javax.swing.JLabel lblIrodsParallelSocketTimeout; + private javax.swing.JLabel lblIrodsSocketTimeout; + private javax.swing.JLabel lblLocalFileInputBufferSize; + private javax.swing.JLabel lblLocalFileOutputBufferSize; + private javax.swing.JLabel lblMaximumParallelTransferThreads; + private javax.swing.JLabel lblPort; + private javax.swing.JLabel lblPortLabel; + private javax.swing.JLabel lblPutBufferSize; + private javax.swing.JLabel lblResourceLabel; + private javax.swing.JLabel lblSynchDate; + private javax.swing.JLabel lblSynchDateLabel; + private javax.swing.JLabel lblSynchName; + private javax.swing.JLabel lblSynchStatus; + private javax.swing.JLabel lblUserName; + private javax.swing.JLabel lblUserNameLabel; + private javax.swing.JLabel lblZone; + private javax.swing.JLabel lblZoneLabel; + private javax.swing.JPanel panelSynchToolbar; + private javax.swing.JPanel plnPipelineConfiguration; + private javax.swing.JPanel pnlBottom; + private javax.swing.JPanel pnlBuffers; + private javax.swing.JPanel pnlCenter; + private javax.swing.JPanel pnlConfigGrids; + private javax.swing.JPanel pnlConfigIdrop; + private javax.swing.JPanel pnlConfigSynch; + private javax.swing.JPanel pnlConfigSynchDetails; + private javax.swing.JPanel pnlConfigSynchListing; + private javax.swing.JPanel pnlConfigTransfers; + private javax.swing.JPanel pnlCurrentGrid; + private javax.swing.JPanel pnlCurrentGridToolbar; + private javax.swing.JPanel pnlIrodsSynch; + private javax.swing.JPanel pnlLocalSynch; + private javax.swing.JPanel pnlParallelTransferOptions; + private javax.swing.JPanel pnlSynchData; + private javax.swing.JPanel pnlSynchFrequency; + private javax.swing.JPanel pnlSynchIcon; + private javax.swing.JPanel pnlSynchMode; + private javax.swing.JPanel pnlSynchName; + private javax.swing.JPanel pnlSynchRefresh; + private javax.swing.JPanel pnlTop; + private javax.swing.JPanel pnlTransferManagement; + private javax.swing.JRadioButton radioBackup; + private javax.swing.JRadioButton radioFeed; + private javax.swing.JRadioButton radioSynch; + private javax.swing.JScrollPane scrollSynchTable; + private javax.swing.JSpinner spinnerIrodsMaxParallelThreads; + private javax.swing.JSpinner spinnerIrodsParallelSocketTimeout; + private javax.swing.JSpinner spinnerIrodsSocketTimeout; + private javax.swing.JTabbedPane tabConfig; + private javax.swing.JTextField txtGetBufferSize; + private javax.swing.JTextField txtInputToOutputCopyBufferSize; + private javax.swing.JTextField txtInternalCacheBufferSize; + private javax.swing.JTextField txtInternalInputBufferSize; + private javax.swing.JTextField txtInternalOutputBufferSize; + private javax.swing.JTextField txtIrodsPath; + private javax.swing.JTextField txtLocalFileInputBufferSize; + private javax.swing.JTextField txtLocalFileOutputBufferSize; + private javax.swing.JTextField txtLocalPath; + private javax.swing.JTextField txtPutBufferSize; + private javax.swing.JTextField txtSynchName; + + // End of variables declaration//GEN-END:variables + + private void initWithConfigData() { + resetTransferPipelineEditColors(); + IdropConfig idropConfig = idropCore.getIdropConfig(); + checkShowGUI.setSelected(idropConfig.isShowGuiAtStartup()); + checkLogSuccessfulTransfer.setSelected(idropConfig + .isLogSuccessfulTransfers()); + checkUseExecutorPool.setSelected(idropConfig.isParallelUsePool()); + checkVerifyChecksumOnTransfer.setSelected(idropConfig + .isVerifyChecksum()); + checkShowFileProgress.setSelected(idropConfig + .isIntraFileStatusCallbacks()); + checkAllowRerouting.setSelected(idropConfig + .isAllowConnectionRerouting()); + checkUseExecutorPool.setSelected(idropConfig.isParallelUsePool()); + spinnerIrodsSocketTimeout.setValue(idropConfig + .getIrodsConnectionTimeout()); + spinnerIrodsParallelSocketTimeout.setValue(idropConfig + .getIrodsParallelConnectionTimeout()); + spinnerIrodsMaxParallelThreads.setValue(idropConfig + .getIrodsParallelTransferMaxThreads()); + checkAllowParallelTransfers.setSelected(idropConfig + .isUseParallelTransfers()); + checkConnectionRestart.setSelected(idropConfig.isConnectionRestart()); + checkUseNIOForParallelTransfers.setSelected(idropConfig + .isUseNIOForParallelTransfers()); + txtInternalInputBufferSize.setText(String.valueOf(idropConfig + .getInternalInputStreamBufferSize())); + txtInternalOutputBufferSize.setText(String.valueOf(idropConfig + .getInternalOutputStreamBufferSize())); + txtLocalFileInputBufferSize.setText(String.valueOf(idropConfig + .getLocalFileInputStreamBufferSize())); + txtLocalFileOutputBufferSize.setText(String.valueOf(idropConfig + .getLocalFileOutputStreamBufferSize())); + txtGetBufferSize + .setText(String.valueOf(idropConfig.getGetBufferSize())); + txtPutBufferSize + .setText(String.valueOf(idropConfig.getPutBufferSize())); + txtInputToOutputCopyBufferSize.setText(String.valueOf(idropConfig + .getInputToOutputCopyBufferByteSize())); + txtInternalCacheBufferSize.setText(String.valueOf(idropConfig + .getInternalCacheBufferSize())); + refreshAccountData(); + } + + /** + * Reset colors in synch panel when re-validating + */ + private void resetSynchPanel() { + txtLocalPath.setBackground(Color.WHITE); + txtIrodsPath.setBackground(Color.WHITE); + txtSynchName.setBackground(Color.WHITE); + } + + /** + * Clear synch panel values and colors + */ + private void clearAndResetSynchPanel() { + resetSynchPanel(); + txtLocalPath.setText(""); + txtIrodsPath.setText(""); + txtSynchName.setText(""); + radioBackup.setSelected(true); + lblSynchDate.setText(""); + pnlSynchIcon.removeAll(); + pnlSynchIcon.validate(); + jcomboSynchFrequency.setSelectedIndex(0); + } + + private void refreshAccountData() { + + if (idropCore.getIrodsAccount() == null) { + lblHost.setText(""); + lblPort.setText(""); + lblZone.setText(""); + comboPrefsDefaultResource.setModel(new DefaultComboBoxModel()); + lblUserName.setText(""); + } else { + lblHost.setText(idropCore.getIrodsAccount().getHost()); + lblPort.setText(String.valueOf(idropCore.getIrodsAccount() + .getPort())); + lblZone.setText(idropCore.getIrodsAccount().getZone()); + lblUserName.setText(idropCore.getIrodsAccount().getUserName()); + try { + ResourceAO resourceAO = idropCore.getIRODSAccessObjectFactory() + .getResourceAO(idropCore.getIrodsAccount()); + log.info("getting a list of all resources in the zone"); + List<String> resources = resourceAO.listResourceNames(); + comboPrefsDefaultResource.setModel(new DefaultComboBoxModel( + resources.toArray())); + comboPrefsDefaultResource.setSelectedItem(idropCore + .getIrodsAccount().getDefaultStorageResource()); + } catch (JargonException ex) { + log.error("error getting resource list", ex); + throw new IdropRuntimeException("error getting resource list", + ex); + } + } + // check to see if default resource editing is allowed + String allowEdit = idropCore.getIdropConfig().getPropertyForKey( + IdropConfigurationService.IDROP_ENABLE_RESC_EDIT); + if (allowEdit != null && allowEdit.equals("false")) { + comboPrefsDefaultResource.setEnabled(false); + } + } + + protected void updateDetailsForSelectedSynch(final int i) { + // make sure the most up-to-date information is displayed + int modelIdx = getSynchTable().convertRowIndexToModel(i); + SynchConfigTableModel model = (SynchConfigTableModel) getSynchTable() + .getModel(); + + selectedSynchronization = model.getSynchronizationAt(modelIdx); + + if (selectedSynchronization == null) { + model.removeRow(modelIdx); + return; + } + + // initialize data + txtLocalPath.setText(selectedSynchronization.getLocalSynchDirectory()); + txtIrodsPath.setText(selectedSynchronization.getIrodsSynchDirectory()); + txtSynchName.setText(selectedSynchronization.getName()); + + if (selectedSynchronization.getFrequencyType() == FrequencyType.EVERY_HOUR) { + jcomboSynchFrequency.setSelectedIndex(0); + } else if (selectedSynchronization.getFrequencyType() == FrequencyType.EVERY_WEEK) { + jcomboSynchFrequency.setSelectedIndex(1); + } else if (selectedSynchronization.getFrequencyType() == FrequencyType.EVERY_DAY) { + jcomboSynchFrequency.setSelectedIndex(2); + } else if (selectedSynchronization.getFrequencyType() == FrequencyType.EVERY_TWO_MINUTES) { + jcomboSynchFrequency.setSelectedIndex(3); + } else { + // default to hourly to avoid errors + log.error("unknown frequency type for synch:{}", + selectedSynchronization.getFrequencyType()); + jcomboSynchFrequency.setSelectedIndex(0); + } + + if (selectedSynchronization.getSynchronizationMode() == SynchronizationType.BI_DIRECTIONAL) { + radioSynch.setSelected(true); + } else if (selectedSynchronization.getSynchronizationMode() == SynchronizationType.ONE_WAY_IRODS_TO_LOCAL) { + radioFeed.setSelected(true); + } else if (selectedSynchronization.getSynchronizationMode() == SynchronizationType.ONE_WAY_LOCAL_TO_IRODS) { + radioBackup.setSelected(true); + } else { + log.error("unknown synchronization mode for synch:{}", + selectedSynchronization.getSynchronizationMode()); + throw new IdropRuntimeException("unknown synchronization mode"); + } + + btnDeleteSynch.setEnabled(true); + btnUpdateSynch.setEnabled(true); + btnSynchNow.setEnabled(true); + + setSynchIcon(selectedSynchronization); + if (selectedSynchronization.getLastSynchronized() == null) { + lblSynchDate.setText("None"); + } else { + lblSynchDate.setText(dateFormat.format(selectedSynchronization + .getLastSynchronized())); + } + + } + + protected void setLockStatusSynchPanel(final boolean lockStatus) { + txtSynchName.setEnabled(lockStatus); + txtLocalPath.setEnabled(lockStatus); + btnChooseLocalSynch.setEnabled(lockStatus); + radioBackup.setEnabled(lockStatus); + // radioFeed.setEnabled(lockStatus); + // radioSynch.setEnabled(lockStatus); + jcomboSynchFrequency.setEnabled(lockStatus); + txtIrodsPath.setEnabled(lockStatus); + btnChooseIrodsSynch.setEnabled(lockStatus); + btnDeleteSynch.setEnabled(lockStatus); + btnUpdateSynch.setEnabled(lockStatus); + btnSynchNow.setEnabled(lockStatus); + // btnSynchDetails.setEnabled(lockStatus); + } + + private void setSynchIcon(final Synchronization synchronization) { + + JLabel labelToUse = null; + + SynchManagerService synchManagerService = idropCore + .getTransferManager().getTransferServiceFactory() + .instanceSynchManagerService(); + try { + boolean isRunning = synchManagerService + .isSynchRunning(synchronization); + if (isRunning) { + labelToUse = IconHelper.getRunningIcon(); + } else if (synchronization.getLastSynchronizationStatus() == null) { + labelToUse = IconHelper.getOkIcon(); + } else if (synchronization.getLastSynchronizationStatus() == TransferStatus.ERROR) { + labelToUse = IconHelper.getErrorIcon(); + } else { + labelToUse = IconHelper.getOkIcon(); + } + } catch (SynchException ex) { + log.error("error checking if synch is already running:{}", + synchronization, ex); + throw new IdropRuntimeException( + "exception checking if synch is already running", ex); + } + + pnlSynchIcon.removeAll(); + lblSynchStatus = labelToUse; + pnlSynchIcon.add(lblSynchStatus); + pnlSynchIcon.validate(); + + } } class SynchListSelectionHandler implements ListSelectionListener { - private final IDROPConfigurationPanel idropConfigurationPanel; + private final IDROPConfigurationPanel idropConfigurationPanel; - SynchListSelectionHandler(IDROPConfigurationPanel configurationPanel) { - this.idropConfigurationPanel = configurationPanel; - } + SynchListSelectionHandler(final IDROPConfigurationPanel configurationPanel) { + idropConfigurationPanel = configurationPanel; + } - @Override - public void valueChanged(ListSelectionEvent e) { + @Override + public void valueChanged(final ListSelectionEvent e) { - if (e.getValueIsAdjusting() == true) { - return; - } + if (e.getValueIsAdjusting() == true) { + return; + } - ListSelectionModel lsm = (ListSelectionModel) e.getSource(); + ListSelectionModel lsm = (ListSelectionModel) e.getSource(); - if (lsm.isSelectionEmpty()) { - return; - } else { - // Find out which indexes are selected. - int minIndex = lsm.getMinSelectionIndex(); - int maxIndex = lsm.getMaxSelectionIndex(); - for (int i = minIndex; i <= maxIndex; i++) { - if (lsm.isSelectedIndex(i)) { - idropConfigurationPanel.updateDetailsForSelectedSynch(i); - } - } - } + if (lsm.isSelectionEmpty()) { + return; + } else { + // Find out which indexes are selected. + int minIndex = lsm.getMinSelectionIndex(); + int maxIndex = lsm.getMaxSelectionIndex(); + for (int i = minIndex; i <= maxIndex; i++) { + if (lsm.isSelectedIndex(i)) { + idropConfigurationPanel.updateDetailsForSelectedSynch(i); + } + } + } - } + } }
\ No newline at end of file diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IDROPCore.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IDROPCore.java index 9816df3..ef46e27 100644 --- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IDROPCore.java +++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IDROPCore.java @@ -4,7 +4,6 @@ import java.text.DateFormat; import java.util.Timer; import java.util.logging.Level; import java.util.logging.Logger; -import java.util.prefs.Preferences; import org.irods.jargon.core.connection.IRODSAccount; import org.irods.jargon.core.exception.JargonException; @@ -21,227 +20,233 @@ import org.slf4j.LoggerFactory; public class IDROPCore { - private IRODSAccount irodsAccount = null; - private IRODSFileSystem irodsFileSystem = null; - private static final org.slf4j.Logger log = LoggerFactory.getLogger(IDROPCore.class); - - public IRODSFileSystem getIrodsFileSystem() { - return irodsFileSystem; - } - - public void setIrodsFileSystem(final IRODSFileSystem irodsFileSystem) { - this.irodsFileSystem = irodsFileSystem; - } - private IdropConfig idropConfig = null; - private TransferManager transferManager = null; - private IconManager iconManager = null; - private Timer queueTimer = new Timer(); - private IdropConfigurationService idropConfigurationService = null; - private final DateFormat dateFormat = DateFormat.getDateTimeInstance(); - private String basePath = null; - - public synchronized String getBasePath() { - return basePath; - } - - public synchronized void setBasePath(String basePath) { - this.basePath = basePath; - } - - public DateFormat getDateFormat() { - return dateFormat; - } - - public IdropConfigurationService getIdropConfigurationService() { - return idropConfigurationService; - } - - public void setIdropConfigurationService(IdropConfigurationService idropConfigurationService) { - this.idropConfigurationService = idropConfigurationService; - } - - public IDROPCore() { - super(); - } - - public IRODSAccount getIrodsAccount() { - return irodsAccount; - } - - public void setIrodsAccount(final IRODSAccount irodsAccount) { - this.irodsAccount = irodsAccount; - } - - public IdropConfig getIdropConfig() { - return idropConfig; - } - - public void setIdropConfig(final IdropConfig idropConfig) { - this.idropConfig = idropConfig; - } - - public TransferManager getTransferManager() { - return transferManager; - } - - public void setTransferManager(final TransferManager transferManager) { - this.transferManager = transferManager; - } - - public IconManager getIconManager() { - return iconManager; - } - - public void setIconManager(final IconManager iconManager) { - this.iconManager = iconManager; - } - - public Timer getQueueTimer() { - return queueTimer; - } - - public void setQueueTimer(final Timer queueTimer) { - this.queueTimer = queueTimer; - } - - /** - * Handy method that delegates the process of getting an - * <code>IRODSAccessObjectFactory</code>. - * - * @return {@link IRODSAccessObjectFactory} - */ - public IRODSAccessObjectFactory getIRODSAccessObjectFactory() { - if (irodsFileSystem == null) { - throw new IdropRuntimeException( - "No IRODSFileSystem set, cannot obtain the IRODSAccessObjectFactory"); - } - try { - return irodsFileSystem.getIRODSAccessObjectFactory(); - } catch (JargonException ex) { - Logger.getLogger(IDROPCore.class.getName()).log(Level.SEVERE, null, - ex); - throw new IdropRuntimeException( - "exception getting IRODSAccessObjectFactory"); - } - } - - /** - * Method to close any iRODS connections in the current thread. This - * delegates to the <code>IRODSFileSystem</code>. - */ - public void closeAllIRODSConnections() { - if (irodsFileSystem == null) { - throw new IdropRuntimeException( - "No IRODSFileSystem set, cannot obtain the IRODSAccessObjectFactory"); - } - irodsFileSystem.closeAndEatExceptions(); - } - - /** - * Method to close iRODS connection denoted by the logged in - * <code>IRODSAccount</code>. - */ - public void closeIRODSConnectionForLoggedInAccount() { - if (irodsFileSystem == null) { - throw new IdropRuntimeException( - "No IRODSFileSystem set, cannot obtain the IRODSAccessObjectFactory"); - } - irodsFileSystem.closeAndEatExceptions(irodsAccount); - } - - /** - * Method to close iRODS connection denoted by the given - * <code>IRODSAccount</code> in the current thread. This delegates to the - * <code>IRODSFileSystem</code>. - */ - public void closeIRODSConnection(final IRODSAccount irodsAccount) { - if (irodsFileSystem == null) { - throw new IdropRuntimeException( - "No IRODSFileSystem set, cannot obtain the IRODSAccessObjectFactory"); - } - irodsFileSystem.closeAndEatExceptions(irodsAccount); - } - - /** - * Get the <code>IRODSFileFactory</code> for the given account - * - * @return {@link IRODSFileFactory} associated with the account currently - * logged in - */ - public IRODSFileFactory getIRODSFileFactory(final IRODSAccount irodsAccount) { - if (irodsFileSystem == null) { - throw new IdropRuntimeException( - "No IRODSFileSystem set, cannot obtain the IRODSAccessObjectFactory"); - } - if (irodsAccount == null) { - throw new IdropRuntimeException( - "No IRODSAccount set, cannot obtain the IRODSAccessObjectFactory"); - } - try { - return irodsFileSystem.getIRODSFileFactory(irodsAccount); - } catch (JargonException ex) { - Logger.getLogger(IDROPCore.class.getName()).log(Level.SEVERE, null, - ex); - throw new IdropRuntimeException( - "Exception getting iRODS file factory", ex); - } - - } - - /** - * Get the <code>IRODSFileFactory</code> for the current logged-in account. - * - * @return {@link IRODSFileFactory} associated with the account currently - * logged in - */ - public IRODSFileFactory getIRODSFileFactoryForLoggedInAccount() { - if (irodsFileSystem == null) { - throw new IdropRuntimeException( - "No IRODSFileSystem set, cannot obtain the IRODSAccessObjectFactory"); - } - if (irodsAccount == null) { - throw new IdropRuntimeException( - "No IRODSAccount set, cannot obtain the IRODSAccessObjectFactory"); - } - try { - return irodsFileSystem.getIRODSFileFactory(irodsAccount); - } catch (JargonException ex) { - Logger.getLogger(IDROPCore.class.getName()).log(Level.SEVERE, null, - ex); - throw new IdropRuntimeException( - "Exception getting iRODS file factory", ex); - } - - } - - /** - * Based on the configuration, get the default directory used in iDrop based on the current login - * @return - */ - public IRODSFile getDefaultDirectory() { - String root = null; - if (getIdropConfig().isLoginPreset()) { - log.info("using policy preset home directory"); - StringBuilder sb = new StringBuilder(); - sb.append("/"); - sb.append(getIrodsAccount().getZone()); - sb.append("/"); - sb.append("home"); - root = sb.toString(); - } else { - log.info("using root path, no login preset"); - root = "/"; - } - IRODSFile newFile; - try { - newFile = getIRODSFileFactoryForLoggedInAccount().instanceIRODSFile(root); - return newFile; - } catch (Exception ex) { - log.error("error creating file", ex); - throw new IdropRuntimeException("error creating file", ex); - } finally { - this.closeIRODSConnectionForLoggedInAccount(); - } - - } + private IRODSAccount irodsAccount = null; + private IRODSFileSystem irodsFileSystem = null; + private static final org.slf4j.Logger log = LoggerFactory + .getLogger(IDROPCore.class); + + public IRODSFileSystem getIrodsFileSystem() { + return irodsFileSystem; + } + + public void setIrodsFileSystem(final IRODSFileSystem irodsFileSystem) { + this.irodsFileSystem = irodsFileSystem; + } + + private IdropConfig idropConfig = null; + private TransferManager transferManager = null; + private IconManager iconManager = null; + private Timer queueTimer = new Timer(); + private IdropConfigurationService idropConfigurationService = null; + private final DateFormat dateFormat = DateFormat.getDateTimeInstance(); + private String basePath = null; + + public synchronized String getBasePath() { + return basePath; + } + + public synchronized void setBasePath(final String basePath) { + this.basePath = basePath; + } + + public DateFormat getDateFormat() { + return dateFormat; + } + + public IdropConfigurationService getIdropConfigurationService() { + return idropConfigurationService; + } + + public void setIdropConfigurationService( + final IdropConfigurationService idropConfigurationService) { + this.idropConfigurationService = idropConfigurationService; + } + + public IDROPCore() { + super(); + } + + public IRODSAccount getIrodsAccount() { + return irodsAccount; + } + + public void setIrodsAccount(final IRODSAccount irodsAccount) { + this.irodsAccount = irodsAccount; + } + + public IdropConfig getIdropConfig() { + return idropConfig; + } + + public void setIdropConfig(final IdropConfig idropConfig) { + this.idropConfig = idropConfig; + } + + public TransferManager getTransferManager() { + return transferManager; + } + + public void setTransferManager(final TransferManager transferManager) { + this.transferManager = transferManager; + } + + public IconManager getIconManager() { + return iconManager; + } + + public void setIconManager(final IconManager iconManager) { + this.iconManager = iconManager; + } + + public Timer getQueueTimer() { + return queueTimer; + } + + public void setQueueTimer(final Timer queueTimer) { + this.queueTimer = queueTimer; + } + + /** + * Handy method that delegates the process of getting an + * <code>IRODSAccessObjectFactory</code>. + * + * @return {@link IRODSAccessObjectFactory} + */ + public IRODSAccessObjectFactory getIRODSAccessObjectFactory() { + if (irodsFileSystem == null) { + throw new IdropRuntimeException( + "No IRODSFileSystem set, cannot obtain the IRODSAccessObjectFactory"); + } + try { + return irodsFileSystem.getIRODSAccessObjectFactory(); + } catch (JargonException ex) { + Logger.getLogger(IDROPCore.class.getName()).log(Level.SEVERE, null, + ex); + throw new IdropRuntimeException( + "exception getting IRODSAccessObjectFactory"); + } + } + + /** + * Method to close any iRODS connections in the current thread. This + * delegates to the <code>IRODSFileSystem</code>. + */ + public void closeAllIRODSConnections() { + if (irodsFileSystem == null) { + throw new IdropRuntimeException( + "No IRODSFileSystem set, cannot obtain the IRODSAccessObjectFactory"); + } + irodsFileSystem.closeAndEatExceptions(); + } + + /** + * Method to close iRODS connection denoted by the logged in + * <code>IRODSAccount</code>. + */ + public void closeIRODSConnectionForLoggedInAccount() { + if (irodsFileSystem == null) { + throw new IdropRuntimeException( + "No IRODSFileSystem set, cannot obtain the IRODSAccessObjectFactory"); + } + irodsFileSystem.closeAndEatExceptions(irodsAccount); + } + + /** + * Method to close iRODS connection denoted by the given + * <code>IRODSAccount</code> in the current thread. This delegates to the + * <code>IRODSFileSystem</code>. + */ + public void closeIRODSConnection(final IRODSAccount irodsAccount) { + if (irodsFileSystem == null) { + throw new IdropRuntimeException( + "No IRODSFileSystem set, cannot obtain the IRODSAccessObjectFactory"); + } + irodsFileSystem.closeAndEatExceptions(irodsAccount); + } + + /** + * Get the <code>IRODSFileFactory</code> for the given account + * + * @return {@link IRODSFileFactory} associated with the account currently + * logged in + */ + public IRODSFileFactory getIRODSFileFactory(final IRODSAccount irodsAccount) { + if (irodsFileSystem == null) { + throw new IdropRuntimeException( + "No IRODSFileSystem set, cannot obtain the IRODSAccessObjectFactory"); + } + if (irodsAccount == null) { + throw new IdropRuntimeException( + "No IRODSAccount set, cannot obtain the IRODSAccessObjectFactory"); + } + try { + return irodsFileSystem.getIRODSFileFactory(irodsAccount); + } catch (JargonException ex) { + Logger.getLogger(IDROPCore.class.getName()).log(Level.SEVERE, null, + ex); + throw new IdropRuntimeException( + "Exception getting iRODS file factory", ex); + } + + } + + /** + * Get the <code>IRODSFileFactory</code> for the current logged-in account. + * + * @return {@link IRODSFileFactory} associated with the account currently + * logged in + */ + public IRODSFileFactory getIRODSFileFactoryForLoggedInAccount() { + if (irodsFileSystem == null) { + throw new IdropRuntimeException( + "No IRODSFileSystem set, cannot obtain the IRODSAccessObjectFactory"); + } + if (irodsAccount == null) { + throw new IdropRuntimeException( + "No IRODSAccount set, cannot obtain the IRODSAccessObjectFactory"); + } + try { + return irodsFileSystem.getIRODSFileFactory(irodsAccount); + } catch (JargonException ex) { + Logger.getLogger(IDROPCore.class.getName()).log(Level.SEVERE, null, + ex); + throw new IdropRuntimeException( + "Exception getting iRODS file factory", ex); + } + + } + + /** + * Based on the configuration, get the default directory used in iDrop based + * on the current login + * + * @return + */ + public IRODSFile getDefaultDirectory() { + String root = null; + if (getIdropConfig().isLoginPreset()) { + log.info("using policy preset home directory"); + StringBuilder sb = new StringBuilder(); + sb.append("/"); + sb.append(getIrodsAccount().getZone()); + sb.append("/"); + sb.append("home"); + root = sb.toString(); + } else { + log.info("using root path, no login preset"); + root = "/"; + } + IRODSFile newFile; + try { + newFile = getIRODSFileFactoryForLoggedInAccount() + .instanceIRODSFile(root); + return newFile; + } catch (Exception ex) { + log.error("error creating file", ex); + throw new IdropRuntimeException("error creating file", ex); + } finally { + closeIRODSConnectionForLoggedInAccount(); + } + + } } diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IDROPDesktop.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IDROPDesktop.java index 72feca9..dac2fce 100644 --- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IDROPDesktop.java +++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IDROPDesktop.java @@ -7,10 +7,17 @@ import java.util.Properties; import java.util.Timer; import java.util.logging.Level; import java.util.logging.Logger; + import javax.swing.JOptionPane; + import org.irods.jargon.core.exception.JargonException; import org.irods.jargon.core.pub.IRODSFileSystem; -import org.irods.jargon.idrop.desktop.systraygui.services.*; +import org.irods.jargon.idrop.desktop.systraygui.services.IconManager; +import org.irods.jargon.idrop.desktop.systraygui.services.IdropConfigurationService; +import org.irods.jargon.idrop.desktop.systraygui.services.IdropConfigurationServiceImpl; +import org.irods.jargon.idrop.desktop.systraygui.services.IdropPreDatabaseBootstrapperService; +import org.irods.jargon.idrop.desktop.systraygui.services.IdropPreDatabaseBootstrapperServiceImpl; +import org.irods.jargon.idrop.desktop.systraygui.services.QueueSchedulerTimerTask; import org.irods.jargon.idrop.desktop.systraygui.utils.IdropConfig; import org.irods.jargon.idrop.desktop.systraygui.utils.IdropPropertiesHelper; import org.irods.jargon.idrop.desktop.systraygui.utils.LookAndFeelManager; @@ -23,326 +30,349 @@ import org.irods.jargon.transfer.synch.SynchPeriodicScheduler; import org.slf4j.LoggerFactory; /** - * Bootstrapping class for iDrop, load config, create necessary services, and start the appropriate - * GUI components - * + * Bootstrapping class for iDrop, load config, create necessary services, and + * start the appropriate GUI components + * * @author Mike Conway - DICE (www.irods.org) */ public class IDROPDesktop { - /** - * NOTE this class is in transition!!!!!! - */ - private iDrop idrop; - private IDROPCore idropCore; - private static final org.slf4j.Logger log = LoggerFactory.getLogger(IDROPDesktop.class); - public static final int STARTUP_SEQUENCE_PAUSE_INTERVAL = 1000; - - public void doStartupSequence() { - - boolean guiShown = false; - - log.info("initiating startup sequence..."); - - System.setProperty("apple.laf.useScreenMenuBar", "true"); - System.setProperty("com.apple.mrj.application.apple.menu.about.name", - "iDrop Client for iRODS"); - - int count = 0; - log.info("creating idropCore..."); - idropCore = new IDROPCore(); - - try { - idropCore.setIrodsFileSystem(IRODSFileSystem.instance()); - } catch (JargonException ex) { - Logger.getLogger(IDROPDesktop.class.getName()).log( - Level.SEVERE, null, ex); - } - - log.info("creating idrop GUI app..."); - idrop = new iDrop(idropCore); - - IDROPSplashWindow idropSplashWindow = new IDROPSplashWindow(idrop); - sleepABit(); - - idropSplashWindow.setStatus("Initializing...", ++count); - - idropCore.setIconManager(new IconManager(idrop)); - sleepABit(); - - String derivedConfigHomeDirectory = deriveConfigHomeDirectory(); - - /* - * Is this newer version that what the database and data represent? Look for a version file - * and trigger any migration needed. This is the first step where the database has not been - * started yet. There may be additinal steps added later to do migrations of data after the - * database has started. This will happen later.... - */ - - doAnyPreDatabaseLoadMigrationProcessing(derivedConfigHomeDirectory); - - /* - * Try and load the database, look at database info and prefer over any configuration in the - * deployed package. Merge the pre-configured data with any existing database info, - * preferring what is in the database - */ - - idropSplashWindow.setStatus("Looking for configuration information...", - ++count); - - Properties derivedProperties; - IdropConfigurationService idropConfigurationService; - - try { - - /* - * Here is where I first try and start the database to get the configuration. A database - * error indicates that iDrop is already running - */ - log.info("statup will now start up the existing database, a new one may be created...."); - idropConfigurationService = startUpTheDatabaseAndSetConfigurationServiceInIdropCore(derivedConfigHomeDirectory); - - log.info("checking for any necessary migrations, this may back up database data and return a value that indicates that iDrop will need to restart"); - - /** - * Code stub here. Think of using a backup dir/file to detect whether the pre migration - * service needs to run. boolean restart = - * idropDatabaseMigrationService.backupExistingDataForAnyMigration(previousVersion, - * currentVersion, blah) if (restart) { display restart dialog exit } // now - * idropDatabaseMigrationService.migrateBackedUpDataToNewDatabase(); - * - */ - /* - * Based on existing data in the database, and incoming data from the classpath - * properties, come up with a merged set of properties - */ - derivedProperties = idropConfigurationService.bootstrapConfigurationAndMergePropertiesFromLocalAndClasspath(); - sleepABit(); - - idropSplashWindow.setStatus( - "Configuration information gathered, logging in...", ++count); - - log.info("config properties derived..."); - idropCore.setIdropConfig(new IdropConfig(derivedProperties)); - idropCore.getIdropConfig().setUpLogging(); - - } catch (IdropAlreadyRunningException are) { - log.error("idrop is already running, shutting down"); - JOptionPane.showMessageDialog((Component) null, - "iDrop is already running, cannot start", "iDrop Error", - JOptionPane.OK_OPTION); - System.exit(1); - } catch (IdropException ex) { - Logger.getLogger(IDROPDesktop.class.getName()).log( - Level.SEVERE, null, ex); - throw new IdropRuntimeException(ex); - } - - log.info("setting jargon properties based on configurations in iDrop"); - try { - idropCore.getIdropConfigurationService().pushIDROPConfigToJargonAndTransfer(); - } catch (Exception ex) { - Logger.getLogger(IDROPDesktop.class.getName()).log( - Level.SEVERE, null, ex); - throw new IdropRuntimeException(ex); - } - - log.info("setting initial look and feel"); - LookAndFeelManager laf = new LookAndFeelManager(idropCore); - laf.setLookAndFeel(idropCore.getIdropConfig().getPropertyForKey(IdropConfigurationService.LOOK_AND_FEEL)); - - log.info("logging in in splash background thread"); - idropSplashWindow.setStatus("Logging in...", ++count); - - final LoginDialog loginDialog = new LoginDialog(null, idropCore); - Toolkit tk = idrop.getToolkit(); - int x = (tk.getScreenSize().width - loginDialog.getWidth()) / 2; - int y = (tk.getScreenSize().height - loginDialog.getHeight()) / 2; - loginDialog.setLocation(x, y); - idropSplashWindow.toBack(); - loginDialog.toFront(); - loginDialog.setVisible(true); - - if (idropCore.getIrodsAccount() == null) { - log.warn("no login account, exiting"); - System.exit(0); - } - - idropSplashWindow.toFront(); - sleepABit(); - - idropSplashWindow.setStatus("Building transfer engine...", ++count); - - log.info("building transfer manager..."); - - try { - idropCore.setTransferManager(new TransferManagerImpl(idropCore.getIrodsFileSystem(), idrop)); - idropCore.getIdropConfigurationService().updateTransferOptions(); - } catch (JargonException ex) { - Logger.getLogger(IDROPDesktop.class.getName()).log( - Level.SEVERE, null, ex); - throw new IdropRuntimeException("error creating transferManager", - ex); - } - - try { - List<LocalIRODSTransfer> currentQueue = idropCore.getTransferManager().getCurrentQueue(); - - if (!currentQueue.isEmpty()) { - idropSplashWindow.toBack(); - int result = JOptionPane.showConfirmDialog((Component) null, - "Transfers are waiting to process, restart transfer?", - "iDrop Transfers in Progress", - JOptionPane.OK_CANCEL_OPTION); - if (result == JOptionPane.CANCEL_OPTION) { - idropCore.getTransferManager().pause(); - } - idropSplashWindow.toFront(); - } - } catch (JargonException ex) { - Logger.getLogger(IDROPDesktop.class.getName()).log( - Level.SEVERE, null, ex); - throw new IdropRuntimeException("error evaluating current queue", - ex); - } - sleepABit(); - - log.info("logged in, now checking for first run..."); - sleepABit(); - - idropSplashWindow.setStatus( - "Checking if this is the first time run to set up synch...", - ++count); - - String synchDeviceName = idropCore.getIdropConfig().getSynchDeviceName(); - idrop.signalIdropCoreReadyAndSplashComplete(); - - // see if I show the gui at startup or show a message - if (idropCore.getIdropConfig().isShowGuiAtStartup()) { - idrop.showIdropGui(); - } else { - Object[] options = {"Do not show GUI at startup", - "Show GUI at startup"}; - - int n = JOptionPane.showOptionDialog(idrop, - "iDrop has started.\nCheck your system tray to access the iDrop user interface. ", - "iDrop - Startup Complete", - JOptionPane.YES_NO_OPTION, - JOptionPane.QUESTION_MESSAGE, - null, - options, - options[0]); - log.info("response was:{}", n); - if (n == 1) { - log.info("switching to show GUI at startup"); - try { - idropCore.getIdropConfigurationService().updateConfig(IdropConfigurationService.SHOW_GUI, "true"); - idrop.showIdropGui(); - } catch (IdropException ex) { - log.error("error setting show GUI at startup", ex); - throw new IdropRuntimeException(ex); - } - } - } - - idropSplashWindow.setStatus("Starting work queue...", ++count); - try { - QueueSchedulerTimerTask queueSchedulerTimerTask = new QueueSchedulerTimerTask( - idropCore.getTransferManager(), idrop); - SynchPeriodicScheduler synchPeriodicScheduler = new SynchPeriodicScheduler(idropCore.getTransferManager(), idropCore.getIRODSAccessObjectFactory()); - Timer timer = new Timer(); - timer.scheduleAtFixedRate(queueSchedulerTimerTask, 10000, 120000); - timer.scheduleAtFixedRate(synchPeriodicScheduler, 10000, 30000); - - idropCore.setQueueTimer(timer); - - } catch (IdropException ex) { - Logger.getLogger(IDROPDesktop.class.getName()).log( - Level.SEVERE, null, ex); - } - - log.info("signal that the startup sequence is complete"); - try { - try { - Thread.sleep(STARTUP_SEQUENCE_PAUSE_INTERVAL * 2); - } catch (InterruptedException e) { - throw new IdropRuntimeException(e); - } - idropSplashWindow.setVisible(false); - idropSplashWindow = null; - } catch (Exception e) { - Logger.getLogger(IDROPDesktop.class.getName()).log( - Level.SEVERE, null, e); - - throw new IdropRuntimeException("error starting idrop gui", e); - } - - } - - private IdropConfigurationService startUpTheDatabaseAndSetConfigurationServiceInIdropCore(String derivedConfigHomeDirectory) throws IdropException { - IdropConfigurationService idropConfigurationService; - idropConfigurationService = new IdropConfigurationServiceImpl( - derivedConfigHomeDirectory, idropCore); - idropCore.setIdropConfigurationService(idropConfigurationService); - return idropConfigurationService; - } - - private void sleepABit() throws IdropRuntimeException { - try { - Thread.sleep(STARTUP_SEQUENCE_PAUSE_INTERVAL); - } catch (InterruptedException e) { - throw new IdropRuntimeException(e); - } - } - - private void doAnyPreDatabaseLoadMigrationProcessing(String derivedConfigHomeDirectory) throws IdropRuntimeException { - Properties propertiesLoadedFromIdropApplicationClasspath; - try { - - IdropPropertiesHelper helper = new IdropPropertiesHelper(); - propertiesLoadedFromIdropApplicationClasspath = helper.loadIdropProperties(); - String currentVersion = propertiesLoadedFromIdropApplicationClasspath.getProperty(IdropConfigurationService.VERSION_NUMBER); - - if (currentVersion == null || currentVersion.isEmpty()) { - throw new IdropRuntimeException("unknown version number, not present in idrop.config"); - } - - IdropPreDatabaseBootstrapperService idropPreBootstrapperService = new IdropPreDatabaseBootstrapperServiceImpl(); - String cachedVersion = idropPreBootstrapperService.detectPriorVersion(derivedConfigHomeDirectory); - idropPreBootstrapperService.triggerMigrations(derivedConfigHomeDirectory, cachedVersion, currentVersion); - idropPreBootstrapperService.storePriorVersion(derivedConfigHomeDirectory, currentVersion); - - } catch (IdropException ex) { - Logger.getLogger(IDROPDesktop.class.getName()).log( - Level.SEVERE, null, ex); - throw new IdropRuntimeException(ex); - } - } - - private String deriveConfigHomeDirectory() { - log.info("determine config root directory"); - String userHomeDirectory = System.getProperty("user.home"); - userHomeDirectory = userHomeDirectory.replaceAll("\\\\", "/"); - StringBuilder sb = new StringBuilder(); - sb.append(userHomeDirectory); - sb.append("/.idrop"); - String derivedConfigHomeDirectory = sb.toString(); - log.info("set config home directory as: {}", derivedConfigHomeDirectory); - return derivedConfigHomeDirectory; - } - - /** - * Start up iDrop as a system tray application. This is the main entry point for iDrop - * - * @param args the command line arguments - */ - public static void main(final String args[]) throws InterruptedException { - IDROPDesktop startupSequencer = new IDROPDesktop(); - try { - startupSequencer.doStartupSequence(); - } catch (Exception e) { - log.error("unable to start application due to error", e); - System.exit(1); - } - } + /** + * NOTE this class is in transition!!!!!! + */ + private iDrop idrop; + private IDROPCore idropCore; + private static final org.slf4j.Logger log = LoggerFactory + .getLogger(IDROPDesktop.class); + public static final int STARTUP_SEQUENCE_PAUSE_INTERVAL = 1000; + + public void doStartupSequence() { + + log.info("initiating startup sequence..."); + + System.setProperty("apple.laf.useScreenMenuBar", "true"); + System.setProperty("com.apple.mrj.application.apple.menu.about.name", + "iDrop Client for iRODS"); + + int count = 0; + log.info("creating idropCore..."); + idropCore = new IDROPCore(); + + try { + idropCore.setIrodsFileSystem(IRODSFileSystem.instance()); + } catch (JargonException ex) { + Logger.getLogger(IDROPDesktop.class.getName()).log(Level.SEVERE, + null, ex); + } + + log.info("creating idrop GUI app..."); + idrop = new iDrop(idropCore); + + IDROPSplashWindow idropSplashWindow = new IDROPSplashWindow(idrop); + sleepABit(); + + idropSplashWindow.setStatus("Initializing...", ++count); + + idropCore.setIconManager(new IconManager(idrop)); + sleepABit(); + + String derivedConfigHomeDirectory = deriveConfigHomeDirectory(); + + /* + * Is this newer version that what the database and data represent? Look + * for a version file and trigger any migration needed. This is the + * first step where the database has not been started yet. There may be + * additinal steps added later to do migrations of data after the + * database has started. This will happen later.... + */ + + doAnyPreDatabaseLoadMigrationProcessing(derivedConfigHomeDirectory); + + /* + * Try and load the database, look at database info and prefer over any + * configuration in the deployed package. Merge the pre-configured data + * with any existing database info, preferring what is in the database + */ + + idropSplashWindow.setStatus("Looking for configuration information...", + ++count); + + Properties derivedProperties; + IdropConfigurationService idropConfigurationService; + + try { + + /* + * Here is where I first try and start the database to get the + * configuration. A database error indicates that iDrop is already + * running + */ + log.info("statup will now start up the existing database, a new one may be created...."); + idropConfigurationService = startUpTheDatabaseAndSetConfigurationServiceInIdropCore(derivedConfigHomeDirectory); + + log.info("checking for any necessary migrations, this may back up database data and return a value that indicates that iDrop will need to restart"); + + /** + * Code stub here. Think of using a backup dir/file to detect + * whether the pre migration service needs to run. boolean restart = + * idropDatabaseMigrationService + * .backupExistingDataForAnyMigration(previousVersion, + * currentVersion, blah) if (restart) { display restart dialog exit + * } // now + * idropDatabaseMigrationService.migrateBackedUpDataToNewDatabase(); + * + */ + /* + * Based on existing data in the database, and incoming data from + * the classpath properties, come up with a merged set of properties + */ + derivedProperties = idropConfigurationService + .bootstrapConfigurationAndMergePropertiesFromLocalAndClasspath(); + sleepABit(); + + idropSplashWindow.setStatus( + "Configuration information gathered, logging in...", + ++count); + + log.info("config properties derived..."); + idropCore.setIdropConfig(new IdropConfig(derivedProperties)); + idropCore.getIdropConfig().setUpLogging(); + + } catch (IdropAlreadyRunningException are) { + log.error("idrop is already running, shutting down"); + JOptionPane.showMessageDialog((Component) null, + "iDrop is already running, cannot start", "iDrop Error", + JOptionPane.OK_OPTION); + System.exit(1); + } catch (IdropException ex) { + Logger.getLogger(IDROPDesktop.class.getName()).log(Level.SEVERE, + null, ex); + throw new IdropRuntimeException(ex); + } + + log.info("setting jargon properties based on configurations in iDrop"); + try { + idropCore.getIdropConfigurationService() + .pushIDROPConfigToJargonAndTransfer(); + } catch (Exception ex) { + Logger.getLogger(IDROPDesktop.class.getName()).log(Level.SEVERE, + null, ex); + throw new IdropRuntimeException(ex); + } + + log.info("setting initial look and feel"); + LookAndFeelManager laf = new LookAndFeelManager(idropCore); + laf.setLookAndFeel(idropCore.getIdropConfig().getPropertyForKey( + IdropConfigurationService.LOOK_AND_FEEL)); + + log.info("logging in in splash background thread"); + idropSplashWindow.setStatus("Logging in...", ++count); + + final LoginDialog loginDialog = new LoginDialog(null, idropCore); + Toolkit tk = idrop.getToolkit(); + int x = (tk.getScreenSize().width - loginDialog.getWidth()) / 2; + int y = (tk.getScreenSize().height - loginDialog.getHeight()) / 2; + loginDialog.setLocation(x, y); + idropSplashWindow.toBack(); + loginDialog.toFront(); + loginDialog.setVisible(true); + + if (idropCore.getIrodsAccount() == null) { + log.warn("no login account, exiting"); + System.exit(0); + } + + idropSplashWindow.toFront(); + sleepABit(); + + idropSplashWindow.setStatus("Building transfer engine...", ++count); + + log.info("building transfer manager..."); + + try { + idropCore.setTransferManager(new TransferManagerImpl(idropCore + .getIrodsFileSystem(), idrop)); + idropCore.getIdropConfigurationService().updateTransferOptions(); + } catch (JargonException ex) { + Logger.getLogger(IDROPDesktop.class.getName()).log(Level.SEVERE, + null, ex); + throw new IdropRuntimeException("error creating transferManager", + ex); + } + + try { + List<LocalIRODSTransfer> currentQueue = idropCore + .getTransferManager().getCurrentQueue(); + + if (!currentQueue.isEmpty()) { + idropSplashWindow.toBack(); + int result = JOptionPane.showConfirmDialog((Component) null, + "Transfers are waiting to process, restart transfer?", + "iDrop Transfers in Progress", + JOptionPane.OK_CANCEL_OPTION); + if (result == JOptionPane.CANCEL_OPTION) { + idropCore.getTransferManager().pause(); + } + idropSplashWindow.toFront(); + } + } catch (JargonException ex) { + Logger.getLogger(IDROPDesktop.class.getName()).log(Level.SEVERE, + null, ex); + throw new IdropRuntimeException("error evaluating current queue", + ex); + } + sleepABit(); + + log.info("logged in, now checking for first run..."); + sleepABit(); + + idropSplashWindow.setStatus( + "Checking if this is the first time run to set up synch...", + ++count); + + idropCore.getIdropConfig().getSynchDeviceName(); + idrop.signalIdropCoreReadyAndSplashComplete(); + + // see if I show the gui at startup or show a message + if (idropCore.getIdropConfig().isShowGuiAtStartup()) { + idrop.showIdropGui(); + } else { + Object[] options = { "Do not show GUI at startup", + "Show GUI at startup" }; + + int n = JOptionPane + .showOptionDialog( + idrop, + "iDrop has started.\nCheck your system tray to access the iDrop user interface. ", + "iDrop - Startup Complete", + JOptionPane.YES_NO_OPTION, + JOptionPane.QUESTION_MESSAGE, null, options, + options[0]); + log.info("response was:{}", n); + if (n == 1) { + log.info("switching to show GUI at startup"); + try { + idropCore.getIdropConfigurationService().updateConfig( + IdropConfigurationService.SHOW_GUI, "true"); + idrop.showIdropGui(); + } catch (IdropException ex) { + log.error("error setting show GUI at startup", ex); + throw new IdropRuntimeException(ex); + } + } + } + + idropSplashWindow.setStatus("Starting work queue...", ++count); + try { + QueueSchedulerTimerTask queueSchedulerTimerTask = new QueueSchedulerTimerTask( + idropCore.getTransferManager(), idrop); + SynchPeriodicScheduler synchPeriodicScheduler = new SynchPeriodicScheduler( + idropCore.getTransferManager(), + idropCore.getIRODSAccessObjectFactory()); + Timer timer = new Timer(); + timer.scheduleAtFixedRate(queueSchedulerTimerTask, 10000, 120000); + timer.scheduleAtFixedRate(synchPeriodicScheduler, 10000, 30000); + + idropCore.setQueueTimer(timer); + + } catch (IdropException ex) { + Logger.getLogger(IDROPDesktop.class.getName()).log(Level.SEVERE, + null, ex); + } + + log.info("signal that the startup sequence is complete"); + try { + try { + Thread.sleep(STARTUP_SEQUENCE_PAUSE_INTERVAL * 2); + } catch (InterruptedException e) { + throw new IdropRuntimeException(e); + } + idropSplashWindow.setVisible(false); + idropSplashWindow = null; + } catch (Exception e) { + Logger.getLogger(IDROPDesktop.class.getName()).log(Level.SEVERE, + null, e); + + throw new IdropRuntimeException("error starting idrop gui", e); + } + + } + + private IdropConfigurationService startUpTheDatabaseAndSetConfigurationServiceInIdropCore( + final String derivedConfigHomeDirectory) throws IdropException { + IdropConfigurationService idropConfigurationService; + idropConfigurationService = new IdropConfigurationServiceImpl( + derivedConfigHomeDirectory, idropCore); + idropCore.setIdropConfigurationService(idropConfigurationService); + return idropConfigurationService; + } + + private void sleepABit() throws IdropRuntimeException { + try { + Thread.sleep(STARTUP_SEQUENCE_PAUSE_INTERVAL); + } catch (InterruptedException e) { + throw new IdropRuntimeException(e); + } + } + + private void doAnyPreDatabaseLoadMigrationProcessing( + final String derivedConfigHomeDirectory) + throws IdropRuntimeException { + Properties propertiesLoadedFromIdropApplicationClasspath; + try { + + IdropPropertiesHelper helper = new IdropPropertiesHelper(); + propertiesLoadedFromIdropApplicationClasspath = helper + .loadIdropProperties(); + String currentVersion = propertiesLoadedFromIdropApplicationClasspath + .getProperty(IdropConfigurationService.VERSION_NUMBER); + + if (currentVersion == null || currentVersion.isEmpty()) { + throw new IdropRuntimeException( + "unknown version number, not present in idrop.config"); + } + + IdropPreDatabaseBootstrapperService idropPreBootstrapperService = new IdropPreDatabaseBootstrapperServiceImpl(); + String cachedVersion = idropPreBootstrapperService + .detectPriorVersion(derivedConfigHomeDirectory); + idropPreBootstrapperService.triggerMigrations( + derivedConfigHomeDirectory, cachedVersion, currentVersion); + idropPreBootstrapperService.storePriorVersion( + derivedConfigHomeDirectory, currentVersion); + + } catch (IdropException ex) { + Logger.getLogger(IDROPDesktop.class.getName()).log(Level.SEVERE, + null, ex); + throw new IdropRuntimeException(ex); + } + } + + private String deriveConfigHomeDirectory() { + log.info("determine config root directory"); + String userHomeDirectory = System.getProperty("user.home"); + userHomeDirectory = userHomeDirectory.replaceAll("\\\\", "/"); + StringBuilder sb = new StringBuilder(); + sb.append(userHomeDirectory); + sb.append("/.idrop"); + String derivedConfigHomeDirectory = sb.toString(); + log.info("set config home directory as: {}", derivedConfigHomeDirectory); + return derivedConfigHomeDirectory; + } + + /** + * Start up iDrop as a system tray application. This is the main entry point + * for iDrop + * + * @param args + * the command line arguments + */ + public static void main(final String args[]) throws InterruptedException { + IDROPDesktop startupSequencer = new IDROPDesktop(); + try { + startupSequencer.doStartupSequence(); + } catch (Exception e) { + log.error("unable to start application due to error", e); + System.exit(1); + } + } } diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IDROPGui.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IDROPGui.java index c9be74c..84504e8 100644 --- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IDROPGui.java +++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IDROPGui.java @@ -5,9 +5,9 @@ package org.irods.jargon.idrop.desktop.systraygui; /** - * + * * @author mikeconway */ public interface IDROPGui { - IDROPCore getiDropCore(); + IDROPCore getiDropCore(); } diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IDROPSplashWindow.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IDROPSplashWindow.java index a42ebc5..95c47e0 100644 --- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IDROPSplashWindow.java +++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IDROPSplashWindow.java @@ -17,71 +17,73 @@ import org.slf4j.LoggerFactory; */ public class IDROPSplashWindow extends JWindow { - /** + /** * */ - private static final long serialVersionUID = 1L; - private final org.slf4j.Logger log = LoggerFactory.getLogger(IDROPSplashWindow.class); - private ImageIcon splashImage = new ImageIcon(IDROPSplashWindow.class.getClassLoader().getResource( - "org/irods/jargon/idrop/desktop/images/iDrop.png")); - private JLabel jlblImage = new JLabel(); - private JProgressBar jProgressBar1 = new JProgressBar(); - private iDrop iDrop; + private static final long serialVersionUID = 1L; + private final org.slf4j.Logger log = LoggerFactory + .getLogger(IDROPSplashWindow.class); + private ImageIcon splashImage = new ImageIcon(IDROPSplashWindow.class + .getClassLoader().getResource( + "org/irods/jargon/idrop/desktop/images/iDrop.png")); + private JLabel jlblImage = new JLabel(); + private JProgressBar jProgressBar1 = new JProgressBar(); + private iDrop iDrop; - public IDROPSplashWindow(final iDrop iDrop) { - super(iDrop); - this.iDrop = iDrop; - try { - init(); - } catch (Exception e) { - log.error("error initializing iDrop splash window", e); - throw new IdropRuntimeException(e); - } - } + public IDROPSplashWindow(final iDrop iDrop) { + super(iDrop); + this.iDrop = iDrop; + try { + init(); + } catch (Exception e) { + log.error("error initializing iDrop splash window", e); + throw new IdropRuntimeException(e); + } + } - /** - * This method stores all initialization commands for the window. - */ - private void init() throws Exception { - // jlblImage.setText("jLabel1"); - jlblImage.setIcon(splashImage); - jProgressBar1.setMinimum(1); - jProgressBar1.setMaximum(7); - jProgressBar1.setStringPainted(true); - this.getContentPane().add(jlblImage, BorderLayout.CENTER); - this.getContentPane().add(jProgressBar1, BorderLayout.SOUTH); + /** + * This method stores all initialization commands for the window. + */ + private void init() throws Exception { + // jlblImage.setText("jLabel1"); + jlblImage.setIcon(splashImage); + jProgressBar1.setMinimum(1); + jProgressBar1.setMaximum(7); + jProgressBar1.setStringPainted(true); + getContentPane().add(jlblImage, BorderLayout.CENTER); + getContentPane().add(jProgressBar1, BorderLayout.SOUTH); - Toolkit tk = this.getToolkit(); - int width = 420; - int height = 315; - int x = (tk.getScreenSize().width - width) / 2; - int y = (tk.getScreenSize().height - height) / 2; - this.setLocation(x, y); - this.setSize(width, height); - this.setAlwaysOnTop(false); - this.setVisible(true); - this.pack(); - } + Toolkit tk = getToolkit(); + int width = 420; + int height = 315; + int x = (tk.getScreenSize().width - width) / 2; + int y = (tk.getScreenSize().height - height) / 2; + this.setLocation(x, y); + this.setSize(width, height); + setAlwaysOnTop(false); + setVisible(true); + pack(); + } - /** - * Sets the text of the progress bar and its value - * - * @param msg - * The message to be displayed in the progress bar - * @param theVal - * An integer value from 0 to 100 - */ - public void setStatus(final String msg, final int value) { + /** + * Sets the text of the progress bar and its value + * + * @param msg + * The message to be displayed in the progress bar + * @param theVal + * An integer value from 0 to 100 + */ + public void setStatus(final String msg, final int value) { - java.awt.EventQueue.invokeLater(new Runnable() { + java.awt.EventQueue.invokeLater(new Runnable() { - @Override - public void run() { - jProgressBar1.setString(msg); - jProgressBar1.setValue(value); + @Override + public void run() { + jProgressBar1.setString(msg); + jProgressBar1.setValue(value); - } - }); + } + }); - } + } } diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IRODSInfoDialog.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IRODSInfoDialog.java index f7afdeb..ffe41ef 100644 --- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IRODSInfoDialog.java +++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IRODSInfoDialog.java @@ -15,6 +15,7 @@ import java.util.List; import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; + import javax.swing.DefaultCellEditor; import javax.swing.JOptionPane; import javax.swing.ListSelectionModel; @@ -23,6 +24,7 @@ import javax.swing.event.DocumentListener; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.table.TableColumn; + import org.irods.jargon.core.connection.IRODSAccount; import org.irods.jargon.core.exception.CatNoAccessException; import org.irods.jargon.core.exception.JargonException; @@ -35,7 +37,6 @@ import org.irods.jargon.core.pub.UserAO; import org.irods.jargon.core.pub.domain.AvuData; import org.irods.jargon.core.pub.domain.Collection; import org.irods.jargon.core.pub.domain.DataObject; -import org.irods.jargon.core.pub.domain.User; import org.irods.jargon.core.pub.domain.UserFilePermission; import org.irods.jargon.core.query.CollectionAndDataObjectListingEntry; import org.irods.jargon.idrop.desktop.systraygui.services.IRODSFileService; @@ -55,1758 +56,2329 @@ import org.openide.util.Exceptions; import org.slf4j.LoggerFactory; /** - * + * * @author lisa */ public class IRODSInfoDialog extends javax.swing.JDialog implements - ListSelectionListener, DocumentListener, ActionListener { - - private final iDrop idropGUI; - private final IRODSAccount irodsAccount; - private String selectedObjectFullPath; - private String selectedObjectName; - private String selectedObjectParent; - private final IRODSFileSystem irodsFileSystem; - private final IRODSTree irodsTree; - private IRODSInfoDialog dialog; - public static org.slf4j.Logger log = LoggerFactory.getLogger(IRODSTree.class); - //private final String fileName; - - /** - * Creates new form IRODSInfoDialog - */ -// public IRODSInfoDialog(java.awt.Frame parent, boolean modal) { -// super(parent, modal); -// initComponents(); -// } - public IRODSInfoDialog(final iDrop parent, final boolean modal, - final IRODSTree irodsTree) { - - super(parent, modal); - this.idropGUI = parent; - this.irodsAccount = idropGUI.getiDropCore().getIrodsAccount(); - this.irodsFileSystem = idropGUI.getiDropCore().getIrodsFileSystem(); - this.irodsTree = irodsTree; - initSelectedObjectName(); - initComponents(); - - selectInfoCard(); - - initializeFileInfo(); - initMetadataInfo(); - initPermissionInfo(); - - // for now hide clear button - btnMetadataClear.setVisible(false); - } - - private void initSelectedObjectName() { - - IRODSFileService irodsFS = null; - - try { - irodsFS = new IRODSFileService(idropGUI.getiDropCore().getIrodsAccount(), - idropGUI.getiDropCore().getIrodsFileSystem()); - } catch (Exception ex) { - log.error("cannot create irods file service"); - return; - } - - IRODSOutlineModel irodsFileSystemModel = (IRODSOutlineModel) irodsTree.getModel(); - ListSelectionModel selectionModel = irodsTree.getSelectionModel(); - int idxStart = selectionModel.getMinSelectionIndex(); - - IRODSNode selectedNode = (IRODSNode) irodsFileSystemModel.getValueAt(idxStart, 0); - selectedObjectFullPath = selectedNode.getFullPath(); - String objectPath[] = selectedObjectFullPath.split("/"); - selectedObjectName = objectPath[objectPath.length - 1]; - IRODSNode pNode = (IRODSNode) selectedNode.getParent(); - selectedObjectParent = pNode.getFullPath(); - } - - private void selectInfoCard() { - - CardLayout cl = (CardLayout) (pnlInfoCards.getLayout()); - if (isCollection()) { - lblObjectCollection.setText("Collection:"); - cl.show(pnlInfoCards, "cardCollectionInfo"); - } else { - lblObjectCollection.setText("Object:"); - cl.show(pnlInfoCards, "cardObjectInfo"); - } - - // also populate header - if (selectedObjectName != null) { - lblInfoObjectName.setText(selectedObjectName); - } - if (selectedObjectParent != null) { - lblInfoObjectParent.setText(selectedObjectParent); - } - } - - private void initializeFileInfo() { - this.dialog = this; - java.awt.EventQueue.invokeLater(new Runnable() { - @Override - public void run() { - dialog.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - try { - - TaggingServiceFactory taggingServiceFactory = new TaggingServiceFactoryImpl(irodsFileSystem.getIRODSAccessObjectFactory()); - FreeTaggingService freeTaggingService = taggingServiceFactory.instanceFreeTaggingService(irodsAccount); - IRODSTaggingService irodsTaggingService = taggingServiceFactory.instanceIrodsTaggingService(irodsAccount); - - if (isCollection()) { - - CollectionAO collectionAO = irodsFileSystem.getIRODSAccessObjectFactory().getCollectionAO(irodsAccount); - Collection collection = collectionAO.findByAbsolutePath(selectedObjectFullPath); - - if (collection.getCreatedAt().toString() != null) { - lblInfoCollectionCreatedDate.setText(collection.getCreatedAt().toString()); - } else { - lblInfoCollectionCreatedDate.setText(""); - } - - if (collection.getModifiedAt().toString() != null) { - lblInfoCollectionModifiedDate.setText(collection.getModifiedAt().toString()); - } else { - lblInfoCollectionModifiedDate.setText(""); - } - - if (collection.getCollectionOwnerName() != null) { - lblInfoCollectionOwner.setText(collection.getCollectionOwnerName()); - } else { - lblInfoCollectionOwner.setText(""); - } - - if (collection.getComments() != null) { - lblInfoCollectionDescription.setText(collection.getComments()); - } else { - lblInfoCollectionDescription.setText(""); - } - - if (collection.getSpecColType() != null) { - lblInfoCollectionType.setText(collection.getSpecColType().name()); - } else { - lblInfoCollectionType.setText(""); - } - - if (collection.getCollectionOwnerZone() != null) { - lblInfoCollectionOwnerZone.setText(collection.getCollectionOwnerZone()); - } else { - lblInfoCollectionOwnerZone.setText(""); - } - - if (collection.getObjectPath() != null) { - lblInfoCollectionObjectPath.setText(collection.getObjectPath()); - } else { - lblInfoCollectionObjectPath.setText(""); - } - - if (collection.getInfo1() != null) { - lblInfoCollectionInfo1.setText(collection.getInfo1()); - } else { - lblInfoCollectionInfo1.setText(""); - } - - if (collection.getInfo2() != null) { - lblInfoCollectionInfo2.setText(collection.getInfo2()); - } else { - lblInfoCollectionInfo2.setText(""); - } - - // now populate tags and comments for collection - txtInfoTags.setText(freeTaggingService.getTagsForCollectionInFreeTagForm( - selectedObjectFullPath).getSpaceDelimitedTagsForDomain()); - IRODSTagValue irodsTagValue = irodsTaggingService.getDescriptionOnCollectionForLoggedInUser( - selectedObjectFullPath); - if (irodsTagValue != null) { - textareaInfoComments.setText(irodsTagValue.getTagData()); - } - - } else { - - DataObjectAO dataObjectAO = irodsFileSystem.getIRODSAccessObjectFactory().getDataObjectAO(irodsAccount); - DataObject dataObject = dataObjectAO.findByAbsolutePath(selectedObjectFullPath); - - if (dataObject.getDataSize() >= 0) { - lblInfoObjectSize.setText(FieldFormatHelper.formatFileLength(dataObject.getDataSize())); - } else { - lblInfoObjectSize.setText(""); - } - - if (dataObject.getCreatedAt().toString() != null) { - lblInfoObjectCreatedDate.setText(dataObject.getCreatedAt().toString()); - } else { - lblInfoObjectCreatedDate.setText(""); - } - - if (dataObject.getUpdatedAt().toString() != null) { - lblInfoObjectModifiedDate.setText(dataObject.getUpdatedAt().toString()); - } else { - lblInfoObjectCreatedDate.setText(""); - } - - if (dataObject.getDataOwnerName() != null) { - lblInfoObjectOwner.setText(dataObject.getDataOwnerName()); - } else { - lblInfoObjectOwner.setText(""); - } - - if (dataObject.getDataOwnerZone() != null) { - lblInfoObjectOwnerZone.setText(dataObject.getDataOwnerZone()); - } else { - lblInfoObjectOwnerZone.setText(""); - } - - if (dataObject.getDataPath() != null) { - lblInfoObjectDataPath.setText(dataObject.getDataPath()); - } else { - lblInfoObjectDataPath.setText(""); - } - - if (dataObject.getResourceGroupName() != null) { - lblInfoObjectResourceGroup.setText(dataObject.getResourceGroupName()); - } else { - lblInfoObjectResourceGroup.setText(""); - } - - if (dataObject.getChecksum() != null) { - lblInfoObjectChecksum.setText(dataObject.getChecksum()); - } else { - lblInfoObjectChecksum.setText(""); - } - - if (dataObject.getResourceName() != null) { - lblInfoObjectResource.setText(dataObject.getResourceName()); - } else { - lblInfoObjectResource.setText(""); - } - - if (dataObject.getDataReplicationNumber() >= 0) { - lblInfoObjectReplicaNumber.setText(Integer.toString(dataObject.getDataReplicationNumber())); - } else { - lblInfoObjectReplicaNumber.setText(""); - } - - if (dataObject.getReplicationStatus() != null) { - lblInfoObjectReplicationStatus.setText(dataObject.getReplicationStatus()); - } else { - lblInfoObjectReplicationStatus.setText(""); - } - - if (dataObject.getDataStatus() != null) { - lblInfoObjectStatus.setText(dataObject.getDataStatus()); - } else { - lblInfoObjectStatus.setText(""); - } - - if (dataObject.getDataTypeName() != null) { - lblInfoObjectType.setText(dataObject.getDataTypeName()); - } else { - lblInfoObjectType.setText(""); - } - - if (dataObject.getDataVersion() >= 0) { - lblInfoObjectVersion.setText(Integer.toString(dataObject.getDataVersion())); - } else { - lblInfoObjectVersion.setText(""); - } - - // now populate tags and comments for data object - txtInfoTags.setText(freeTaggingService.getTagsForDataObjectInFreeTagForm( - selectedObjectFullPath).getSpaceDelimitedTagsForDomain()); - IRODSTagValue irodsTagValue = irodsTaggingService.getDescriptionOnDataObjectForLoggedInUser( - selectedObjectFullPath); - if (irodsTagValue != null) { - textareaInfoComments.setText(irodsTagValue.getTagData()); - } - - } - - } catch (FileNotFoundException ex) { - Exceptions.printStackTrace(ex); - } catch (JargonException ex) { - Exceptions.printStackTrace(ex); - } - - dialog.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); - } - }); - } - - private void initMetadataInfo() { - this.dialog = this; - java.awt.EventQueue.invokeLater(new Runnable() { - @Override - public void run() { - dialog.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - try { - // set up metadata table and table model - IRODSFileService irodsFileService = new IRODSFileService( - irodsAccount, irodsFileSystem); - MetadataTableModel metadataTableModel; - - if (isCollection()) { - metadataTableModel = new MetadataTableModel( - irodsFileService.getMetadataForCollection(selectedObjectFullPath)); - } else { - metadataTableModel = new MetadataTableModel( - irodsFileService.getMetadataForDataObject( - selectedObjectParent, selectedObjectName)); - } - tableMetadata.setModel(metadataTableModel); - tableMetadata.getSelectionModel().addListSelectionListener(dialog); - tableMetadata.validate(); - - // add document listener to metadata text fields - txtMetadataAttribute.getDocument().addDocumentListener(dialog); - txtMetadataValue.getDocument().addDocumentListener(dialog); - txtMetadataUnit.getDocument().addDocumentListener(dialog); - } catch (IdropException ex) { - Logger.getLogger(MetadataViewDialog.class.getName()).log( - Level.SEVERE, null, ex); - idropGUI.showIdropException(ex); - } - - dialog.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); - } - }); - } - - private void initPermissionInfo() { - this.dialog = this; - java.awt.EventQueue.invokeLater(new Runnable() { - @Override - public void run() { - - // set up combobox lists - List<User> users = null; - dialog.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - - // this list of ACLs contains permission that are not suppoted? - //List<FilePermissionEnum> permissions = FilePermissionEnum.listAllValues(); - //for (FilePermissionEnum permission: permissions) { - //cbPermissionsPermission.addItem(permission.name()); - //} - // will just do my own for now - //cbPermissionsPermission.addItem("NONE"); - javax.swing.JComboBox tableCombo = new javax.swing.JComboBox(); - tableCombo.addItem("READ"); - tableCombo.addItem("WRITE"); - tableCombo.addItem("OWN"); - - // set up permission table and table model - PermissionsTableModel permissionsTableModel = null; - try { - if (isCollection()) { - CollectionAO collectionAO = irodsFileSystem.getIRODSAccessObjectFactory().getCollectionAO(irodsAccount); - permissionsTableModel = new PermissionsTableModel( - collectionAO.listPermissionsForCollection(selectedObjectFullPath)); - } else { - DataObjectAO dataObjectAO = irodsFileSystem.getIRODSAccessObjectFactory().getDataObjectAO(irodsAccount); - permissionsTableModel = new PermissionsTableModel( - dataObjectAO.listPermissionsForDataObject(selectedObjectFullPath)); - } - } catch (JargonException ex) { - Exceptions.printStackTrace(ex); - } - - tablePermissions.setModel(permissionsTableModel); - tablePermissions.getSelectionModel().addListSelectionListener(dialog); - TableColumn permissionColumn = tablePermissions.getColumnModel().getColumn(1); - permissionColumn.setCellEditor(new DefaultCellEditor(tableCombo)); - permissionsTableModel.resetOriginalPermissionList(); - tablePermissions.validate(); - - dialog.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); - } - }); - } - - private boolean isCollection() { - - boolean state = false; - CollectionAndDataObjectListingEntry entry = null; - - //perhaps should throw exception if these vital member variables are null - if ((selectedObjectFullPath != null) - && (irodsFileSystem != null) - && (irodsAccount != null)) { - CollectionAndDataObjectListAndSearchAOImpl collectionAndDataObjectListAndSearchAOImpl; - try { - collectionAndDataObjectListAndSearchAOImpl = (CollectionAndDataObjectListAndSearchAOImpl) irodsFileSystem.getIRODSAccessObjectFactory().getCollectionAndDataObjectListAndSearchAO(irodsAccount); - entry = - collectionAndDataObjectListAndSearchAOImpl.getCollectionAndDataObjectListingEntryAtGivenAbsolutePath(selectedObjectFullPath); - } catch (JargonException ex) { - // TODO: respond correctly here - Exceptions.printStackTrace(ex); - } - - state = entry.isCollection(); - } - - return state; - } - - private void updateMetadataCreateBtnStatus() { - // create button should only be enabled when there is no tableMetadata - // selection and all text fields are populated - btnMetadataCreate.setEnabled( - txtMetadataAttribute.getText().length() > 0 - && txtMetadataValue.getText().length() > 0 - && txtMetadataUnit.getText().length() > 0); - } - - private void updateMetadataDeleteBtnStatus(int selectedRowCount) { - // delete button should only be enabled when there is a tableMetadata selection - // add all text fields are populated - btnMetadataDelete.setEnabled(selectedRowCount > 0); - } - - private void updatePermissionsDeleteBtnStatus(int selectedRowCount) { - // delete button should only be enabled when there is a tableMetadata or - // tablePermissions selection - btnDeleteSharePermissions.setEnabled(selectedRowCount > 0); - } - - // ListSelectionListener methods - @Override - public void valueChanged(ListSelectionEvent lse) { - int selectedRowCount = 0; - - if (!lse.getValueIsAdjusting()) { - // determine which table is selected - // Metadata Table? - if (lse.getSource() == tableMetadata.getSelectionModel()) { - selectedRowCount = tableMetadata.getSelectedRowCount(); - updateMetadataDeleteBtnStatus(selectedRowCount); - } else { // Permissions Table - selectedRowCount = tablePermissions.getSelectedRowCount(); - updatePermissionsDeleteBtnStatus(selectedRowCount); - } - } - } - // end ListSelectionListener methods - - // DocumentListener Methods - @Override - public void insertUpdate(DocumentEvent de) { - updateMetadataCreateBtnStatus(); - } - - @Override - public void removeUpdate(DocumentEvent de) { - updateMetadataCreateBtnStatus(); - } - - @Override - public void changedUpdate(DocumentEvent de) { - updateMetadataCreateBtnStatus(); - } - // end DocumentListener Methods - - // ActionListener Methods - @Override - public void actionPerformed(ActionEvent ae) { -// if (ae.getSource() == cbPermissionsPermission || -// ae.getSource() == cbPermissionsUserName) { -// updatePermissonsCreateBtnStatus(); -// } - } - // end ActionListener Methods - - /** - * This method is called from within the constructor to initialize the form. WARNING: Do NOT - * modify this code. The content of this method is always regenerated by the Form Editor. - */ - @SuppressWarnings("unchecked") - // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents - private void initComponents() { - - jPanel2 = new javax.swing.JPanel(); - jPanel1 = new javax.swing.JPanel(); - pnlSelectedObject = new javax.swing.JPanel(); - lblObjectCollection = new javax.swing.JLabel(); - jLabel2 = new javax.swing.JLabel(); - lblInfoObjectName = new javax.swing.JLabel(); - lblInfoObjectParent = new javax.swing.JLabel(); - tabbedpanelMain = new javax.swing.JTabbedPane(); - pnlInfoTab = new javax.swing.JPanel(); - pnlInfoCards = new javax.swing.JPanel(); - pnlCollectionInfo = new javax.swing.JPanel(); - jLabel19 = new javax.swing.JLabel(); - jLabel20 = new javax.swing.JLabel(); - jLabel21 = new javax.swing.JLabel(); - jLabel22 = new javax.swing.JLabel(); - jLabel23 = new javax.swing.JLabel(); - jLabel24 = new javax.swing.JLabel(); - jLabel25 = new javax.swing.JLabel(); - jLabel26 = new javax.swing.JLabel(); - jLabel27 = new javax.swing.JLabel(); - lblInfoCollectionCreatedDate = new javax.swing.JLabel(); - lblInfoCollectionModifiedDate = new javax.swing.JLabel(); - lblInfoCollectionOwner = new javax.swing.JLabel(); - lblInfoCollectionOwnerZone = new javax.swing.JLabel(); - lblInfoCollectionType = new javax.swing.JLabel(); - lblInfoCollectionObjectPath = new javax.swing.JLabel(); - lblInfoCollectionDescription = new javax.swing.JLabel(); - lblInfoCollectionInfo1 = new javax.swing.JLabel(); - lblInfoCollectionInfo2 = new javax.swing.JLabel(); - pnlObjectInfo = new javax.swing.JPanel(); - jLabel3 = new javax.swing.JLabel(); - jLabel4 = new javax.swing.JLabel(); - jLabel5 = new javax.swing.JLabel(); - jLabel6 = new javax.swing.JLabel(); - jLabel7 = new javax.swing.JLabel(); - jLabel8 = new javax.swing.JLabel(); - jLabel9 = new javax.swing.JLabel(); - jLabel10 = new javax.swing.JLabel(); - jLabel11 = new javax.swing.JLabel(); - jLabel12 = new javax.swing.JLabel(); - jLabel13 = new javax.swing.JLabel(); - jLabel14 = new javax.swing.JLabel(); - jLabel15 = new javax.swing.JLabel(); - jLabel16 = new javax.swing.JLabel(); - lblInfoObjectSize = new javax.swing.JLabel(); - lblInfoObjectCreatedDate = new javax.swing.JLabel(); - lblInfoObjectModifiedDate = new javax.swing.JLabel(); - lblInfoObjectOwner = new javax.swing.JLabel(); - lblInfoObjectOwnerZone = new javax.swing.JLabel(); - lblInfoObjectDataPath = new javax.swing.JLabel(); - lblInfoObjectResourceGroup = new javax.swing.JLabel(); - lblInfoObjectChecksum = new javax.swing.JLabel(); - lblInfoObjectResource = new javax.swing.JLabel(); - lblInfoObjectReplicaNumber = new javax.swing.JLabel(); - lblInfoObjectReplicationStatus = new javax.swing.JLabel(); - lblInfoObjectStatus = new javax.swing.JLabel(); - lblInfoObjectType = new javax.swing.JLabel(); - lblInfoObjectVersion = new javax.swing.JLabel(); - pnlTagsComments = new javax.swing.JPanel(); - jLabel17 = new javax.swing.JLabel(); - txtInfoTags = new javax.swing.JTextField(); - jLabel18 = new javax.swing.JLabel(); - jScrollPane1 = new javax.swing.JScrollPane(); - textareaInfoComments = new javax.swing.JTextArea(); - btnUpdateTagsComments = new javax.swing.JButton(); - pnlMetadataTab = new javax.swing.JPanel(); - pnlMetadataTable = new javax.swing.JPanel(); - jScrollPane2 = new javax.swing.JScrollPane(); - tableMetadata = new javax.swing.JTable(); - jPanel5 = new javax.swing.JPanel(); - jPanel6 = new javax.swing.JPanel(); - btnMetadataDelete = new javax.swing.JButton(); - pnlMetaDataEdit = new javax.swing.JPanel(); - jLabel28 = new javax.swing.JLabel(); - jLabel29 = new javax.swing.JLabel(); - jLabel30 = new javax.swing.JLabel(); - btnMetadataClear = new javax.swing.JButton(); - btnMetadataCreate = new javax.swing.JButton(); - txtMetadataAttribute = new javax.swing.JTextField(); - txtMetadataValue = new javax.swing.JTextField(); - txtMetadataUnit = new javax.swing.JTextField(); - pnlPermissionsTab = new javax.swing.JPanel(); - pnlPermissionsTable = new javax.swing.JPanel(); - jScrollPane3 = new javax.swing.JScrollPane(); - tablePermissions = new javax.swing.JTable(); - jPanel7 = new javax.swing.JPanel(); - jPanel8 = new javax.swing.JPanel(); - btnPermissionsSave = new javax.swing.JButton(); - jPanel9 = new javax.swing.JPanel(); - jPanel16 = new javax.swing.JPanel(); - btnAddSharePermissions = new javax.swing.JButton(); - btnDeleteSharePermissions = new javax.swing.JButton(); - pnlCloseBtn = new javax.swing.JPanel(); - jPanel3 = new javax.swing.JPanel(); - jPanel4 = new javax.swing.JPanel(); - btnClose = new javax.swing.JButton(); - btnRefresh = new javax.swing.JButton(); - - org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2); - jPanel2.setLayout(jPanel2Layout); - jPanel2Layout.setHorizontalGroup( - jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(0, 100, Short.MAX_VALUE) - ); - jPanel2Layout.setVerticalGroup( - jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(0, 100, Short.MAX_VALUE) - ); - - setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - setPreferredSize(new java.awt.Dimension(560, 720)); - - jPanel1.setBorder(javax.swing.BorderFactory.createEmptyBorder(14, 10, 10, 10)); - jPanel1.setPreferredSize(new java.awt.Dimension(600, 750)); - jPanel1.setLayout(new java.awt.BorderLayout()); - - pnlSelectedObject.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 4, 1, 4)); - pnlSelectedObject.setPreferredSize(new java.awt.Dimension(528, 70)); - - lblObjectCollection.setFont(new java.awt.Font("Lucida Grande", 0, 14)); // NOI18N - lblObjectCollection.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.lblObjectCollection.text")); // NOI18N - - jLabel2.setFont(new java.awt.Font("Lucida Grande", 0, 14)); // NOI18N - jLabel2.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.jLabel2.text")); // NOI18N - - lblInfoObjectName.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.lblInfoObjectName.text")); // NOI18N - - lblInfoObjectParent.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.lblInfoObjectParent.text")); // NOI18N - - org.jdesktop.layout.GroupLayout pnlSelectedObjectLayout = new org.jdesktop.layout.GroupLayout(pnlSelectedObject); - pnlSelectedObject.setLayout(pnlSelectedObjectLayout); - pnlSelectedObjectLayout.setHorizontalGroup( - pnlSelectedObjectLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(pnlSelectedObjectLayout.createSequentialGroup() - .addContainerGap() - .add(pnlSelectedObjectLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) - .add(lblObjectCollection, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 140, Short.MAX_VALUE) - .add(jLabel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(pnlSelectedObjectLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) - .add(lblInfoObjectName, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 362, Short.MAX_VALUE) - .add(lblInfoObjectParent, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addContainerGap(67, Short.MAX_VALUE)) - ); - pnlSelectedObjectLayout.setVerticalGroup( - pnlSelectedObjectLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(pnlSelectedObjectLayout.createSequentialGroup() - .addContainerGap() - .add(pnlSelectedObjectLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(lblObjectCollection) - .add(lblInfoObjectName)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(pnlSelectedObjectLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(jLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 20, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add(lblInfoObjectParent)) - .addContainerGap(19, Short.MAX_VALUE)) - ); - - jPanel1.add(pnlSelectedObject, java.awt.BorderLayout.PAGE_START); - - tabbedpanelMain.setPreferredSize(new java.awt.Dimension(600, 867)); - - pnlInfoTab.setLayout(new java.awt.BorderLayout()); - - pnlInfoCards.setBorder(javax.swing.BorderFactory.createEtchedBorder()); - pnlInfoCards.setPreferredSize(new java.awt.Dimension(555, 640)); - pnlInfoCards.setLayout(new java.awt.CardLayout()); - - pnlCollectionInfo.setPreferredSize(new java.awt.Dimension(515, 500)); - - jLabel19.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.jLabel19.text")); // NOI18N - - jLabel20.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.jLabel20.text")); // NOI18N - - jLabel21.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.jLabel21.text")); // NOI18N - - jLabel22.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.jLabel22.text")); // NOI18N - - jLabel23.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.jLabel23.text")); // NOI18N - - jLabel24.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.jLabel24.text")); // NOI18N - - jLabel25.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.jLabel25.text")); // NOI18N - - jLabel26.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.jLabel26.text")); // NOI18N - - jLabel27.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.jLabel27.text")); // NOI18N - - lblInfoCollectionCreatedDate.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.lblInfoCollectionCreatedDate.text")); // NOI18N - - lblInfoCollectionModifiedDate.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.lblInfoCollectionModifiedDate.text")); // NOI18N - - lblInfoCollectionOwner.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.lblInfoCollectionOwner.text")); // NOI18N - - lblInfoCollectionOwnerZone.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.lblInfoCollectionOwnerZone.text")); // NOI18N - - lblInfoCollectionType.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.lblInfoCollectionType.text")); // NOI18N - - lblInfoCollectionObjectPath.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.lblInfoCollectionObjectPath.text")); // NOI18N - - lblInfoCollectionDescription.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.lblInfoCollectionDescription.text")); // NOI18N - - lblInfoCollectionInfo1.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.lblInfoCollectionInfo1.text")); // NOI18N - - lblInfoCollectionInfo2.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.lblInfoCollectionInfo2.text")); // NOI18N - - org.jdesktop.layout.GroupLayout pnlCollectionInfoLayout = new org.jdesktop.layout.GroupLayout(pnlCollectionInfo); - pnlCollectionInfo.setLayout(pnlCollectionInfoLayout); - pnlCollectionInfoLayout.setHorizontalGroup( - pnlCollectionInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(pnlCollectionInfoLayout.createSequentialGroup() - .addContainerGap() - .add(pnlCollectionInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false) - .add(org.jdesktop.layout.GroupLayout.LEADING, pnlCollectionInfoLayout.createSequentialGroup() - .add(pnlCollectionInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(jLabel22) - .add(jLabel23) - .add(jLabel24) - .add(jLabel25) - .add(jLabel26) - .add(jLabel27)) - .add(24, 24, 24) - .add(pnlCollectionInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(lblInfoCollectionOwnerZone, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE) - .add(lblInfoCollectionType, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .add(lblInfoCollectionObjectPath, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .add(lblInfoCollectionDescription, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .add(lblInfoCollectionInfo1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .add(lblInfoCollectionInfo2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) - .add(org.jdesktop.layout.GroupLayout.LEADING, pnlCollectionInfoLayout.createSequentialGroup() - .add(pnlCollectionInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(jLabel19) - .add(jLabel20) - .add(jLabel21)) - .add(47, 47, 47) - .add(pnlCollectionInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) - .add(lblInfoCollectionCreatedDate, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE) - .add(lblInfoCollectionModifiedDate, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .add(lblInfoCollectionOwner, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) - .addContainerGap()) - ); - pnlCollectionInfoLayout.setVerticalGroup( - pnlCollectionInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(pnlCollectionInfoLayout.createSequentialGroup() - .add(24, 24, 24) - .add(pnlCollectionInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(jLabel19) - .add(lblInfoCollectionCreatedDate)) - .add(18, 18, 18) - .add(pnlCollectionInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(jLabel20) - .add(lblInfoCollectionModifiedDate)) - .add(18, 18, 18) - .add(pnlCollectionInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(jLabel21) - .add(lblInfoCollectionOwner)) - .add(18, 18, 18) - .add(pnlCollectionInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(jLabel22) - .add(lblInfoCollectionOwnerZone)) - .add(18, 18, 18) - .add(pnlCollectionInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(jLabel23) - .add(lblInfoCollectionType)) - .add(18, 18, 18) - .add(pnlCollectionInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(jLabel24) - .add(lblInfoCollectionObjectPath)) - .add(18, 18, 18) - .add(pnlCollectionInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(jLabel25) - .add(lblInfoCollectionDescription)) - .add(18, 18, 18) - .add(pnlCollectionInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(jLabel26) - .add(lblInfoCollectionInfo1)) - .add(18, 18, 18) - .add(pnlCollectionInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(jLabel27) - .add(lblInfoCollectionInfo2)) - .addContainerGap(289, Short.MAX_VALUE)) - ); - - pnlInfoCards.add(pnlCollectionInfo, "cardCollectionInfo"); - - pnlObjectInfo.setPreferredSize(new java.awt.Dimension(550, 530)); - - jLabel3.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.jLabel3.text")); // NOI18N - - jLabel4.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.jLabel4.text")); // NOI18N - - jLabel5.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.jLabel5.text")); // NOI18N - - jLabel6.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.jLabel6.text")); // NOI18N - - jLabel7.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.jLabel7.text")); // NOI18N - - jLabel8.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.jLabel8.text")); // NOI18N - - jLabel9.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.jLabel9.text")); // NOI18N - - jLabel10.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.jLabel10.text")); // NOI18N - - jLabel11.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.jLabel11.text")); // NOI18N - - jLabel12.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.jLabel12.text")); // NOI18N - - jLabel13.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.jLabel13.text")); // NOI18N - - jLabel14.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.jLabel14.text")); // NOI18N - - jLabel15.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.jLabel15.text")); // NOI18N - - jLabel16.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.jLabel16.text")); // NOI18N - - lblInfoObjectSize.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.lblInfoObjectSize.text")); // NOI18N - - lblInfoObjectCreatedDate.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.lblInfoObjectCreatedDate.text")); // NOI18N - - lblInfoObjectModifiedDate.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.lblInfoObjectModifiedDate.text")); // NOI18N - - lblInfoObjectOwner.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.lblInfoObjectOwner.text")); // NOI18N - - lblInfoObjectOwnerZone.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.lblInfoObjectOwnerZone.text")); // NOI18N - - lblInfoObjectDataPath.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.lblInfoObjectDataPath.text")); // NOI18N - - lblInfoObjectResourceGroup.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.lblInfoObjectResourceGroup.text")); // NOI18N - - lblInfoObjectChecksum.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.lblInfoObjectChecksum.text")); // NOI18N - - lblInfoObjectResource.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.lblInfoObjectResource.text")); // NOI18N - - lblInfoObjectReplicaNumber.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.lblInfoObjectReplicaNumber.text")); // NOI18N - - lblInfoObjectReplicationStatus.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.lblInfoObjectReplicationStatus.text")); // NOI18N - - lblInfoObjectStatus.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.lblInfoObjectStatus.text")); // NOI18N - - lblInfoObjectType.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.lblInfoObjectType.text")); // NOI18N - - lblInfoObjectVersion.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.lblInfoObjectVersion.text")); // NOI18N - - org.jdesktop.layout.GroupLayout pnlObjectInfoLayout = new org.jdesktop.layout.GroupLayout(pnlObjectInfo); - pnlObjectInfo.setLayout(pnlObjectInfoLayout); - pnlObjectInfoLayout.setHorizontalGroup( - pnlObjectInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(pnlObjectInfoLayout.createSequentialGroup() - .addContainerGap() - .add(pnlObjectInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) - .add(pnlObjectInfoLayout.createSequentialGroup() - .add(pnlObjectInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(jLabel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 70, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add(jLabel4) - .add(jLabel5) - .add(jLabel6) - .add(jLabel7, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 90, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add(jLabel8, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 90, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add(jLabel9, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 115, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add(jLabel10, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 80, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add(jLabel11, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 70, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add(jLabel12)) - .add(22, 22, 22) - .add(pnlObjectInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) - .add(lblInfoObjectResource, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .add(lblInfoObjectReplicaNumber, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .add(lblInfoObjectSize, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 370, Short.MAX_VALUE) - .add(lblInfoObjectCreatedDate, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .add(lblInfoObjectModifiedDate, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .add(lblInfoObjectOwner, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .add(lblInfoObjectOwnerZone, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .add(lblInfoObjectDataPath, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .add(lblInfoObjectResourceGroup, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .add(lblInfoObjectChecksum, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) - .add(pnlObjectInfoLayout.createSequentialGroup() - .add(pnlObjectInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(jLabel13, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 125, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add(jLabel14) - .add(jLabel15) - .add(jLabel16)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) - .add(pnlObjectInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(lblInfoObjectReplicationStatus, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .add(lblInfoObjectStatus, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .add(lblInfoObjectType, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .add(lblInfoObjectVersion, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) - .addContainerGap(51, Short.MAX_VALUE)) - ); - pnlObjectInfoLayout.setVerticalGroup( - pnlObjectInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(pnlObjectInfoLayout.createSequentialGroup() - .add(pnlObjectInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(pnlObjectInfoLayout.createSequentialGroup() - .add(18, 18, 18) - .add(lblInfoObjectSize)) - .add(org.jdesktop.layout.GroupLayout.TRAILING, pnlObjectInfoLayout.createSequentialGroup() - .addContainerGap() - .add(jLabel3))) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(pnlObjectInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(lblInfoObjectCreatedDate) - .add(jLabel4)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(pnlObjectInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(jLabel5) - .add(lblInfoObjectModifiedDate)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(pnlObjectInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(lblInfoObjectOwner) - .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel6)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(pnlObjectInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(jLabel7) - .add(lblInfoObjectOwnerZone)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(pnlObjectInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(lblInfoObjectDataPath) - .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel8)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(pnlObjectInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(jLabel9) - .add(org.jdesktop.layout.GroupLayout.TRAILING, lblInfoObjectResourceGroup)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(pnlObjectInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(lblInfoObjectChecksum) - .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel10)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(pnlObjectInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(jLabel11) - .add(lblInfoObjectResource)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(pnlObjectInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(jLabel12) - .add(lblInfoObjectReplicaNumber)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(pnlObjectInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(jLabel13) - .add(lblInfoObjectReplicationStatus)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(pnlObjectInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(jLabel14) - .add(lblInfoObjectStatus)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(pnlObjectInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(jLabel15) - .add(lblInfoObjectType)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(pnlObjectInfoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(jLabel16) - .add(lblInfoObjectVersion)) - .addContainerGap(281, Short.MAX_VALUE)) - ); - - pnlInfoCards.add(pnlObjectInfo, "cardObjectInfo"); - - pnlInfoTab.add(pnlInfoCards, java.awt.BorderLayout.CENTER); - - pnlTagsComments.setBorder(javax.swing.BorderFactory.createEtchedBorder()); - - jLabel17.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.jLabel17.text")); // NOI18N - - txtInfoTags.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.txtInfoTags.text")); // NOI18N - - jLabel18.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.jLabel18.text")); // NOI18N - - textareaInfoComments.setColumns(20); - textareaInfoComments.setRows(5); - jScrollPane1.setViewportView(textareaInfoComments); - - btnUpdateTagsComments.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.btnUpdateTagsComments.text")); // NOI18N - btnUpdateTagsComments.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnUpdateTagsCommentsActionPerformed(evt); - } - }); - - org.jdesktop.layout.GroupLayout pnlTagsCommentsLayout = new org.jdesktop.layout.GroupLayout(pnlTagsComments); - pnlTagsComments.setLayout(pnlTagsCommentsLayout); - pnlTagsCommentsLayout.setHorizontalGroup( - pnlTagsCommentsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(pnlTagsCommentsLayout.createSequentialGroup() - .add(pnlTagsCommentsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(org.jdesktop.layout.GroupLayout.TRAILING, pnlTagsCommentsLayout.createSequentialGroup() - .addContainerGap() - .add(pnlTagsCommentsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(jLabel17) - .add(jLabel18)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 66, Short.MAX_VALUE) - .add(pnlTagsCommentsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) - .add(txtInfoTags) - .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 408, Short.MAX_VALUE)) - .add(6, 6, 6)) - .add(org.jdesktop.layout.GroupLayout.TRAILING, pnlTagsCommentsLayout.createSequentialGroup() - .add(0, 0, Short.MAX_VALUE) - .add(btnUpdateTagsComments))) - .addContainerGap()) - ); - pnlTagsCommentsLayout.setVerticalGroup( - pnlTagsCommentsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(pnlTagsCommentsLayout.createSequentialGroup() - .add(6, 6, 6) - .add(pnlTagsCommentsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(jLabel17) - .add(txtInfoTags, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 28, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) - .add(pnlTagsCommentsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(jLabel18) - .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) - .add(btnUpdateTagsComments) - .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - ); - - pnlInfoTab.add(pnlTagsComments, java.awt.BorderLayout.SOUTH); - - tabbedpanelMain.addTab(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.pnlInfoTab.TabConstraints.tabTitle"), pnlInfoTab); // NOI18N - - pnlMetadataTab.setLayout(new java.awt.BorderLayout()); - - pnlMetadataTable.setLayout(new java.awt.BorderLayout()); - - tableMetadata.setModel(new javax.swing.table.DefaultTableModel( - new Object [][] { - {null, null, null}, - {null, null, null}, - {null, null, null}, - {null, null, null} - }, - new String [] { - "Attribute", "Value", "Unit" - } - ) { - Class[] types = new Class [] { - java.lang.String.class, java.lang.String.class, java.lang.String.class - }; - boolean[] canEdit = new boolean [] { - false, false, false - }; - - public Class getColumnClass(int columnIndex) { - return types [columnIndex]; - } - - public boolean isCellEditable(int rowIndex, int columnIndex) { - return canEdit [columnIndex]; - } - }); - tableMetadata.setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); - jScrollPane2.setViewportView(tableMetadata); - - pnlMetadataTable.add(jScrollPane2, java.awt.BorderLayout.CENTER); - - jPanel5.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2)); - jPanel5.setPreferredSize(new java.awt.Dimension(568, 44)); - jPanel5.setLayout(new java.awt.BorderLayout()); - - jPanel6.setPreferredSize(new java.awt.Dimension(100, 40)); - - btnMetadataDelete.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.btnMetadataDelete.text")); // NOI18N - btnMetadataDelete.setActionCommand(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.btnMetadataDelete.actionCommand")); // NOI18N - btnMetadataDelete.setEnabled(false); - btnMetadataDelete.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnMetadataDeleteActionPerformed(evt); - } - }); - - org.jdesktop.layout.GroupLayout jPanel6Layout = new org.jdesktop.layout.GroupLayout(jPanel6); - jPanel6.setLayout(jPanel6Layout); - jPanel6Layout.setHorizontalGroup( - jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(0, 100, Short.MAX_VALUE) - .add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(jPanel6Layout.createSequentialGroup() - .add(8, 8, 8) - .add(btnMetadataDelete) - .addContainerGap(8, Short.MAX_VALUE))) - ); - jPanel6Layout.setVerticalGroup( - jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(0, 40, Short.MAX_VALUE) - .add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(jPanel6Layout.createSequentialGroup() - .add(5, 5, 5) - .add(btnMetadataDelete) - .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) - ); - - jPanel5.add(jPanel6, java.awt.BorderLayout.EAST); - - pnlMetadataTable.add(jPanel5, java.awt.BorderLayout.SOUTH); - - pnlMetadataTab.add(pnlMetadataTable, java.awt.BorderLayout.CENTER); - - pnlMetaDataEdit.setBorder(javax.swing.BorderFactory.createEtchedBorder()); - pnlMetaDataEdit.setPreferredSize(new java.awt.Dimension(527, 200)); - - jLabel28.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.jLabel28.text")); // NOI18N - - jLabel29.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.jLabel29.text")); // NOI18N - - jLabel30.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.jLabel30.text")); // NOI18N - - btnMetadataClear.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.btnMetadataClear.text")); // NOI18N - btnMetadataClear.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnMetadataClearActionPerformed(evt); - } - }); - - btnMetadataCreate.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.btnMetadataCreate.text")); // NOI18N - btnMetadataCreate.setEnabled(false); - btnMetadataCreate.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnMetadataCreateActionPerformed(evt); - } - }); - - txtMetadataAttribute.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.txtMetadataAttribute.text")); // NOI18N - - txtMetadataValue.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.txtMetadataValue.text")); // NOI18N - - txtMetadataUnit.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.txtMetadataUnit.text")); // NOI18N - - org.jdesktop.layout.GroupLayout pnlMetaDataEditLayout = new org.jdesktop.layout.GroupLayout(pnlMetaDataEdit); - pnlMetaDataEdit.setLayout(pnlMetaDataEditLayout); - pnlMetaDataEditLayout.setHorizontalGroup( - pnlMetaDataEditLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(pnlMetaDataEditLayout.createSequentialGroup() - .addContainerGap() - .add(pnlMetaDataEditLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(pnlMetaDataEditLayout.createSequentialGroup() - .add(pnlMetaDataEditLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(jLabel28) - .add(jLabel29) - .add(jLabel30)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) - .add(pnlMetaDataEditLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(txtMetadataValue, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 480, Short.MAX_VALUE) - .add(org.jdesktop.layout.GroupLayout.TRAILING, txtMetadataAttribute) - .add(txtMetadataUnit))) - .add(org.jdesktop.layout.GroupLayout.TRAILING, pnlMetaDataEditLayout.createSequentialGroup() - .add(0, 0, Short.MAX_VALUE) - .add(btnMetadataClear) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(btnMetadataCreate))) - .addContainerGap()) - ); - pnlMetaDataEditLayout.setVerticalGroup( - pnlMetaDataEditLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(pnlMetaDataEditLayout.createSequentialGroup() - .addContainerGap(18, Short.MAX_VALUE) - .add(pnlMetaDataEditLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(jLabel28) - .add(txtMetadataAttribute, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) - .add(18, 18, 18) - .add(pnlMetaDataEditLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(jLabel29) - .add(txtMetadataValue, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) - .add(18, 18, 18) - .add(pnlMetaDataEditLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(jLabel30) - .add(txtMetadataUnit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) - .add(23, 23, 23) - .add(pnlMetaDataEditLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(btnMetadataClear) - .add(btnMetadataCreate)) - .addContainerGap()) - ); - - pnlMetadataTab.add(pnlMetaDataEdit, java.awt.BorderLayout.SOUTH); - - tabbedpanelMain.addTab(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.pnlMetadataTab.TabConstraints.tabTitle"), pnlMetadataTab); // NOI18N - - pnlPermissionsTab.setLayout(new java.awt.BorderLayout()); - - pnlPermissionsTable.setLayout(new java.awt.BorderLayout()); - - tablePermissions.setModel(new javax.swing.table.DefaultTableModel( - new Object [][] { - {"", null}, - {null, null}, - {null, null}, - {null, null} - }, - new String [] { - "User Name", "Share Permission" - } - ) { - Class[] types = new Class [] { - java.lang.String.class, java.lang.Object.class - }; - boolean[] canEdit = new boolean [] { - false, true - }; - - public Class getColumnClass(int columnIndex) { - return types [columnIndex]; - } - - public boolean isCellEditable(int rowIndex, int columnIndex) { - return canEdit [columnIndex]; - } - }); - tablePermissions.setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); - jScrollPane3.setViewportView(tablePermissions); - - pnlPermissionsTable.add(jScrollPane3, java.awt.BorderLayout.CENTER); - - jPanel7.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2)); - jPanel7.setPreferredSize(new java.awt.Dimension(568, 44)); - jPanel7.setLayout(new java.awt.BorderLayout()); - - jPanel8.setPreferredSize(new java.awt.Dimension(100, 44)); - - btnPermissionsSave.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.btnPermissionsSave.text")); // NOI18N - btnPermissionsSave.setActionCommand(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.btnPermissionsSave.actionCommand")); // NOI18N - btnPermissionsSave.setEnabled(false); - btnPermissionsSave.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnPermissionsSaveActionPerformed(evt); - } - }); - - org.jdesktop.layout.GroupLayout jPanel8Layout = new org.jdesktop.layout.GroupLayout(jPanel8); - jPanel8.setLayout(jPanel8Layout); - jPanel8Layout.setHorizontalGroup( - jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel8Layout.createSequentialGroup() - .addContainerGap(19, Short.MAX_VALUE) - .add(btnPermissionsSave) - .addContainerGap()) - ); - jPanel8Layout.setVerticalGroup( - jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel8Layout.createSequentialGroup() - .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .add(btnPermissionsSave) - .addContainerGap()) - ); - - jPanel7.add(jPanel8, java.awt.BorderLayout.EAST); - - jPanel9.setPreferredSize(new java.awt.Dimension(100, 25)); - jPanel9.setLayout(new java.awt.BorderLayout()); - - jPanel16.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 1, 1)); - - btnAddSharePermissions.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.btnAddSharePermissions.text")); // NOI18N - btnAddSharePermissions.setPreferredSize(new java.awt.Dimension(22, 24)); - btnAddSharePermissions.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnAddSharePermissionsActionPerformed(evt); - } - }); - jPanel16.add(btnAddSharePermissions); - - btnDeleteSharePermissions.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.btnDeleteSharePermissions.text")); // NOI18N - btnDeleteSharePermissions.setEnabled(false); - btnDeleteSharePermissions.setPreferredSize(new java.awt.Dimension(22, 24)); - btnDeleteSharePermissions.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnDeleteSharePermissionsActionPerformed(evt); - } - }); - jPanel16.add(btnDeleteSharePermissions); - - jPanel9.add(jPanel16, java.awt.BorderLayout.WEST); - - jPanel7.add(jPanel9, java.awt.BorderLayout.WEST); - - pnlPermissionsTable.add(jPanel7, java.awt.BorderLayout.SOUTH); - - pnlPermissionsTab.add(pnlPermissionsTable, java.awt.BorderLayout.CENTER); - - tabbedpanelMain.addTab(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.pnlPermissionsTab.TabConstraints.tabTitle"), pnlPermissionsTab); // NOI18N - - jPanel1.add(tabbedpanelMain, java.awt.BorderLayout.CENTER); - - pnlCloseBtn.setPreferredSize(new java.awt.Dimension(589, 35)); - pnlCloseBtn.setLayout(new java.awt.BorderLayout()); - - jPanel3.setPreferredSize(new java.awt.Dimension(100, 40)); - jPanel3.setSize(new java.awt.Dimension(200, 100)); - - org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3); - jPanel3.setLayout(jPanel3Layout); - jPanel3Layout.setHorizontalGroup( - jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(0, 100, Short.MAX_VALUE) - ); - jPanel3Layout.setVerticalGroup( - jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(0, 35, Short.MAX_VALUE) - ); - - pnlCloseBtn.add(jPanel3, java.awt.BorderLayout.WEST); - - btnClose.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.btnClose.text")); // NOI18N - btnClose.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnCloseActionPerformed(evt); - } - }); - - btnRefresh.setText(org.openide.util.NbBundle.getMessage(IRODSInfoDialog.class, "IRODSInfoDialog.btnRefresh.text")); // NOI18N - btnRefresh.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnRefreshActionPerformed(evt); - } - }); - - org.jdesktop.layout.GroupLayout jPanel4Layout = new org.jdesktop.layout.GroupLayout(jPanel4); - jPanel4.setLayout(jPanel4Layout); - jPanel4Layout.setHorizontalGroup( - jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel4Layout.createSequentialGroup() - .addContainerGap(417, Short.MAX_VALUE) - .add(btnRefresh) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(btnClose) - .addContainerGap()) - ); - jPanel4Layout.setVerticalGroup( - jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel4Layout.createSequentialGroup() - .add(0, 6, Short.MAX_VALUE) - .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(btnClose) - .add(btnRefresh))) - ); - - pnlCloseBtn.add(jPanel4, java.awt.BorderLayout.EAST); - - jPanel1.add(pnlCloseBtn, java.awt.BorderLayout.PAGE_END); - - getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER); - - pack(); - }// </editor-fold>//GEN-END:initComponents - - private void btnMetadataCreateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMetadataCreateActionPerformed - AvuData avuData; - CollectionAO collectionAO; - DataObjectAO dataObjectAO; - try { - // create AVU data object from text fields - String attr = txtMetadataAttribute.getText(); - String value = txtMetadataValue.getText(); - String unit = txtMetadataUnit.getText(); - avuData = new AvuData(attr, value, unit); - if (isCollection()) { - collectionAO = irodsFileSystem.getIRODSAccessObjectFactory().getCollectionAO(irodsAccount); - collectionAO.addAVUMetadata(selectedObjectFullPath, avuData); - } else { - dataObjectAO = irodsFileSystem.getIRODSAccessObjectFactory().getDataObjectAO(irodsAccount); - dataObjectAO.addAVUMetadata(selectedObjectFullPath, avuData); - } - - // add to table - MetadataTableModel tm = (MetadataTableModel) tableMetadata.getModel(); - tm.addRow(selectedObjectFullPath, attr, value, unit); - - // clear text fields - txtMetadataAttribute.setText(""); - txtMetadataValue.setText(""); - txtMetadataUnit.setText(""); - - JOptionPane.showMessageDialog( - this, "Metadata Sucessfully Created", "Create Metadata", JOptionPane.PLAIN_MESSAGE); - - } catch (CatNoAccessException cna) { - - log.error("no access to collection for tagging", cna); - JOptionPane.showMessageDialog( - this, "Insufficient privilages to update this data"); - } catch (JargonException ex) { - Exceptions.printStackTrace(ex); - JOptionPane.showMessageDialog( - this, "Metadata Creation Failed", "Create Metadata", JOptionPane.PLAIN_MESSAGE); - } - }//GEN-LAST:event_btnMetadataCreateActionPerformed - - private void btnUpdateTagsCommentsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUpdateTagsCommentsActionPerformed - - TaggingServiceFactory taggingServiceFactory = null;; - IRODSTagValue irodsTagValue = null; - - try { - taggingServiceFactory = new TaggingServiceFactoryImpl(irodsFileSystem.getIRODSAccessObjectFactory()); - FreeTaggingService freeTaggingService = taggingServiceFactory.instanceFreeTaggingService(irodsAccount); - IRODSTaggingService irodsTaggingService = taggingServiceFactory.instanceIrodsTaggingService(irodsAccount); - - // first update the tags - String newTagStr = txtInfoTags.getText(); - if (newTagStr != null) { //&& !newTagStr.isEmpty()) { - - // now need to diff against existing tags to see what to add and what to delete - String existingTags = null; - if (isCollection()) { - existingTags = freeTaggingService.getTagsForCollectionInFreeTagForm( - selectedObjectFullPath).getSpaceDelimitedTagsForDomain(); - } else { - existingTags = freeTaggingService.getTagsForDataObjectInFreeTagForm( - selectedObjectFullPath).getSpaceDelimitedTagsForDomain(); - } - - List<String> existingTagList = Arrays.asList(existingTags.split(" ")); - List<String> newTagsList = Arrays.asList(newTagStr.split(" +")); - - // find tags to delete and remove them - Set<String> tagsToDeleteSet = new HashSet<String>(existingTagList); - tagsToDeleteSet.removeAll(newTagsList); - String[] tagsToDelete = tagsToDeleteSet.toArray(new String[0]); - for (String tag : tagsToDelete) { - if (tag.length() > 0) { - irodsTagValue = new IRODSTagValue(tag, irodsAccount.getUserName()); - if (isCollection()) { - irodsTaggingService.deleteTagFromCollection(selectedObjectFullPath, irodsTagValue); - } else { - irodsTaggingService.deleteTagFromDataObject(selectedObjectFullPath, irodsTagValue); - } - } - } - - // find tags to add - Set<String> tagsToAddSet = new HashSet<String>(newTagsList); - tagsToAddSet.removeAll(existingTagList); - String[] tagsToAdd = tagsToAddSet.toArray(new String[0]); - - for (String tag : tagsToAdd) { - if (tag.length() > 0) { - irodsTagValue = new IRODSTagValue(tag, irodsAccount.getUserName()); - if (isCollection()) { - irodsTaggingService.addTagToCollection(selectedObjectFullPath, irodsTagValue); - } else { - irodsTaggingService.addTagToDataObject(selectedObjectFullPath, irodsTagValue); - } - } - } - } - - - // now update comments - String commentStr = textareaInfoComments.getText(); - if (commentStr != null && !commentStr.isEmpty()) { - - // update comments - irodsTagValue = new IRODSTagValue(commentStr, irodsAccount.getUserName()); - if (isCollection()) { - irodsTaggingService.checkAndUpdateDescriptionOnCollection(selectedObjectFullPath, irodsTagValue); - } else { - irodsTaggingService.checkAndUpdateDescriptionOnDataObject(selectedObjectFullPath, irodsTagValue); - } - } else { - // remove all comments - if (isCollection()) { - irodsTagValue = irodsTaggingService.getDescriptionOnCollectionForLoggedInUser(selectedObjectFullPath); - if (irodsTagValue != null) { - irodsTaggingService.deleteDescriptionFromCollection(selectedObjectFullPath, irodsTagValue); - } - } else { - irodsTagValue = irodsTaggingService.getDescriptionOnDataObjectForLoggedInUser(selectedObjectFullPath); - if (irodsTagValue != null) { - irodsTaggingService.deleteDescriptionFromDataObject(selectedObjectFullPath, irodsTagValue); - } - } - } - - JOptionPane.showMessageDialog( - this, "Tags and Comments Sucessfully Updated", "Update Tags and Comments", JOptionPane.PLAIN_MESSAGE); - - } catch (CatNoAccessException cna) { - log.error("no access to collection for tagging", cna); - JOptionPane.showMessageDialog( - this, "Insufficient privilages to update this data"); - - } catch (JargonException ex) { - Exceptions.printStackTrace(ex); - JOptionPane.showMessageDialog( - this, "Update of Tags and Comments Failed"); - } - }//GEN-LAST:event_btnUpdateTagsCommentsActionPerformed - - private void btnCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCloseActionPerformed - this.dispose(); - }//GEN-LAST:event_btnCloseActionPerformed - - private void btnMetadataClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMetadataClearActionPerformed - // clear table selection -// tableMetadata.clearSelection(); - // clear all text fields -// txtMetadataAttribute.setText(""); -// txtMetadataValue.setText(""); -// txtMetadataUnit.setText(""); - }//GEN-LAST:event_btnMetadataClearActionPerformed - - private void btnMetadataDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMetadataDeleteActionPerformed - AvuData avuData; - CollectionAO collectionAO; - DataObjectAO dataObjectAO; - - try { - String attr = null; - String value = null; - String unit = null; - - // get selected rows to delete in metadata table - int[] selectedRows = tableMetadata.getSelectedRows(); - for (int i = 0; i < selectedRows.length; i++) { - // create AVU data object to delete - attr = (String) tableMetadata.getValueAt(selectedRows[i], 0); - value = (String) tableMetadata.getValueAt(selectedRows[i], 1); - unit = (String) tableMetadata.getValueAt(selectedRows[i], 2); - avuData = new AvuData(attr, value, unit); - if (isCollection()) { - collectionAO = irodsFileSystem.getIRODSAccessObjectFactory().getCollectionAO(irodsAccount); - collectionAO.deleteAVUMetadata(selectedObjectFullPath, avuData); - } else { - dataObjectAO = irodsFileSystem.getIRODSAccessObjectFactory().getDataObjectAO(irodsAccount); - dataObjectAO.deleteAVUMetadata(selectedObjectFullPath, avuData); - } - // remove from table - MetadataTableModel tm = (MetadataTableModel) tableMetadata.getModel(); - tm.deleteRow(selectedObjectFullPath, attr, value, unit, selectedRows[i]); - } - - JOptionPane.showMessageDialog( - this, "Metadata Sucessfully Deleted", "Delete Metadata", JOptionPane.PLAIN_MESSAGE); - } catch (CatNoAccessException cna) { - - log.error("no access to collection for tagging", cna); - JOptionPane.showMessageDialog( - this, "Insufficient privilages to update this data"); - } catch (JargonException ex) { - Exceptions.printStackTrace(ex); - JOptionPane.showMessageDialog( - this, "Metadata Delete Failed", "Delete Metadata", JOptionPane.PLAIN_MESSAGE); - } - }//GEN-LAST:event_btnMetadataDeleteActionPerformed - - private void btnRefreshActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRefreshActionPerformed - - if (tabbedpanelMain.getSelectedComponent() == pnlInfoTab) { - initializeFileInfo(); - } else if (tabbedpanelMain.getSelectedComponent() == pnlMetadataTab) { - initMetadataInfo(); - } else { // permissions tab - initPermissionInfo(); - } - }//GEN-LAST:event_btnRefreshActionPerformed - - private void btnPermissionsSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPermissionsSaveActionPerformed - - PermissionsTableModel tm = (PermissionsTableModel) tablePermissions.getModel(); - - try { - // first get any permissions that were removed - UserFilePermission[] permissionsToDelete = tm.getPermissionsToDelete(); - - for (UserFilePermission permission : permissionsToDelete) { - - if (isCollection()) { - CollectionAO collectionAO = irodsFileSystem.getIRODSAccessObjectFactory().getCollectionAO(irodsAccount); - collectionAO.removeAccessPermissionForUser( - permission.getUserZone(), - selectedObjectFullPath, - permission.getUserName(), - true); - } else { - DataObjectAO dataObjectAO = irodsFileSystem.getIRODSAccessObjectFactory().getDataObjectAO(irodsAccount); - dataObjectAO.removeAccessPermissionsForUser( - permission.getUserZone(), - selectedObjectFullPath, - permission.getUserName()); - } - } - - // now add any permissions that were added - UserFilePermission[] permissionsToAdd = tm.getPermissionsToAdd(); - - for (UserFilePermission permission : permissionsToAdd) { - CollectionAO collectionAO = irodsFileSystem.getIRODSAccessObjectFactory().getCollectionAO(irodsAccount); - DataObjectAO dataObjectAO = irodsFileSystem.getIRODSAccessObjectFactory().getDataObjectAO(irodsAccount); - - if (permission.getFilePermissionEnum() == FilePermissionEnum.READ) { - if (isCollection()) { - collectionAO.setAccessPermissionRead( - permission.getUserZone(), - selectedObjectFullPath, - permission.getUserName(), - true); - } else { - dataObjectAO.setAccessPermissionRead( - permission.getUserZone(), - selectedObjectFullPath, - permission.getUserName()); - } - } else if (permission.getFilePermissionEnum() == FilePermissionEnum.WRITE) { - if (isCollection()) { - collectionAO.setAccessPermissionWrite( - permission.getUserZone(), - selectedObjectFullPath, - permission.getUserName(), - true); - } else { - dataObjectAO.setAccessPermissionWrite( - permission.getUserZone(), - selectedObjectFullPath, - permission.getUserName()); - } - } else if (permission.getFilePermissionEnum() == FilePermissionEnum.OWN) { - if (isCollection()) { - collectionAO.setAccessPermissionOwn( - permission.getUserZone(), - selectedObjectFullPath, - permission.getUserName(), - true); - } else { - dataObjectAO.setAccessPermissionOwn( - permission.getUserZone(), - selectedObjectFullPath, - permission.getUserName()); - } - } - } - - if ((permissionsToAdd.length > 0) || (permissionsToDelete.length > 0)) { - JOptionPane.showMessageDialog( - this, "Permissions Updated Sucessfully", "Update Permissions", JOptionPane.PLAIN_MESSAGE); - } - - tm.resetOriginalPermissionList(); - - } catch (JargonException ex) { - Exceptions.printStackTrace(ex); - JOptionPane.showMessageDialog( - this, "Permission Update Failed", "Update Permissions", JOptionPane.PLAIN_MESSAGE); - } - - btnPermissionsSave.setEnabled(false); - }//GEN-LAST:event_btnPermissionsSaveActionPerformed - - private void btnAddSharePermissionsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddSharePermissionsActionPerformed - AddPermissionsDialog addPermissionsDialog = new AddPermissionsDialog( - this, true, irodsFileSystem, irodsAccount); - - addPermissionsDialog.setLocation( - (int) this.getLocation().getX(), (int) this.getLocation().getY()); - addPermissionsDialog.setVisible(true); - - UserFilePermission userFilePermission = addPermissionsDialog.getPermissionToAdd(); - - // first remove this user's entry from table if there is one - if (userFilePermission != null) { - try { - UserAO userAO = irodsFileSystem.getIRODSAccessObjectFactory().getUserAO(irodsAccount); - String tableUserName = userFilePermission.getUserName() + "#" + userFilePermission.getUserZone(); - - PermissionsTableModel tm = (PermissionsTableModel) tablePermissions.getModel(); - tm.deleteRow(userAO.findByName(tableUserName)); - - // now add to table - tm.addRow(userAO.findByName(tableUserName), userFilePermission.getFilePermissionEnum()); - } catch (JargonException ex) { - Exceptions.printStackTrace(ex); - } - btnPermissionsSave.setEnabled(true); - } - }//GEN-LAST:event_btnAddSharePermissionsActionPerformed - - private void btnDeleteSharePermissionsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDeleteSharePermissionsActionPerformed - - int[] selectedRows = tablePermissions.getSelectedRows(); - int numRowsSelected = selectedRows.length; - - // have to remove rows in reverse - for (int i = numRowsSelected - 1; i >= 0; i--) { - int selectedRow = selectedRows[i]; - if (selectedRow >= 0) { - PermissionsTableModel model = (PermissionsTableModel) tablePermissions.getModel(); - model.deleteRow(selectedRow); - btnPermissionsSave.setEnabled(true); - } - } - }//GEN-LAST:event_btnDeleteSharePermissionsActionPerformed - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JButton btnAddSharePermissions; - private javax.swing.JButton btnClose; - private javax.swing.JButton btnDeleteSharePermissions; - private javax.swing.JButton btnMetadataClear; - private javax.swing.JButton btnMetadataCreate; - private javax.swing.JButton btnMetadataDelete; - private javax.swing.JButton btnPermissionsSave; - private javax.swing.JButton btnRefresh; - private javax.swing.JButton btnUpdateTagsComments; - private javax.swing.JLabel jLabel10; - private javax.swing.JLabel jLabel11; - private javax.swing.JLabel jLabel12; - private javax.swing.JLabel jLabel13; - private javax.swing.JLabel jLabel14; - private javax.swing.JLabel jLabel15; - private javax.swing.JLabel jLabel16; - private javax.swing.JLabel jLabel17; - private javax.swing.JLabel jLabel18; - private javax.swing.JLabel jLabel19; - private javax.swing.JLabel jLabel2; - private javax.swing.JLabel jLabel20; - private javax.swing.JLabel jLabel21; - private javax.swing.JLabel jLabel22; - private javax.swing.JLabel jLabel23; - private javax.swing.JLabel jLabel24; - private javax.swing.JLabel jLabel25; - private javax.swing.JLabel jLabel26; - private javax.swing.JLabel jLabel27; - private javax.swing.JLabel jLabel28; - private javax.swing.JLabel jLabel29; - private javax.swing.JLabel jLabel3; - private javax.swing.JLabel jLabel30; - private javax.swing.JLabel jLabel4; - private javax.swing.JLabel jLabel5; - private javax.swing.JLabel jLabel6; - private javax.swing.JLabel jLabel7; - private javax.swing.JLabel jLabel8; - private javax.swing.JLabel jLabel9; - private javax.swing.JPanel jPanel1; - private javax.swing.JPanel jPanel16; - private javax.swing.JPanel jPanel2; - private javax.swing.JPanel jPanel3; - private javax.swing.JPanel jPanel4; - private javax.swing.JPanel jPanel5; - private javax.swing.JPanel jPanel6; - private javax.swing.JPanel jPanel7; - private javax.swing.JPanel jPanel8; - private javax.swing.JPanel jPanel9; - private javax.swing.JScrollPane jScrollPane1; - private javax.swing.JScrollPane jScrollPane2; - private javax.swing.JScrollPane jScrollPane3; - private javax.swing.JLabel lblInfoCollectionCreatedDate; - private javax.swing.JLabel lblInfoCollectionDescription; - private javax.swing.JLabel lblInfoCollectionInfo1; - private javax.swing.JLabel lblInfoCollectionInfo2; - private javax.swing.JLabel lblInfoCollectionModifiedDate; - private javax.swing.JLabel lblInfoCollectionObjectPath; - private javax.swing.JLabel lblInfoCollectionOwner; - private javax.swing.JLabel lblInfoCollectionOwnerZone; - private javax.swing.JLabel lblInfoCollectionType; - private javax.swing.JLabel lblInfoObjectChecksum; - private javax.swing.JLabel lblInfoObjectCreatedDate; - private javax.swing.JLabel lblInfoObjectDataPath; - private javax.swing.JLabel lblInfoObjectModifiedDate; - private javax.swing.JLabel lblInfoObjectName; - private javax.swing.JLabel lblInfoObjectOwner; - private javax.swing.JLabel lblInfoObjectOwnerZone; - private javax.swing.JLabel lblInfoObjectParent; - private javax.swing.JLabel lblInfoObjectReplicaNumber; - private javax.swing.JLabel lblInfoObjectReplicationStatus; - private javax.swing.JLabel lblInfoObjectResource; - private javax.swing.JLabel lblInfoObjectResourceGroup; - private javax.swing.JLabel lblInfoObjectSize; - private javax.swing.JLabel lblInfoObjectStatus; - private javax.swing.JLabel lblInfoObjectType; - private javax.swing.JLabel lblInfoObjectVersion; - private javax.swing.JLabel lblObjectCollection; - private javax.swing.JPanel pnlCloseBtn; - private javax.swing.JPanel pnlCollectionInfo; - private javax.swing.JPanel pnlInfoCards; - private javax.swing.JPanel pnlInfoTab; - private javax.swing.JPanel pnlMetaDataEdit; - private javax.swing.JPanel pnlMetadataTab; - private javax.swing.JPanel pnlMetadataTable; - private javax.swing.JPanel pnlObjectInfo; - private javax.swing.JPanel pnlPermissionsTab; - private javax.swing.JPanel pnlPermissionsTable; - private javax.swing.JPanel pnlSelectedObject; - private javax.swing.JPanel pnlTagsComments; - private javax.swing.JTabbedPane tabbedpanelMain; - private javax.swing.JTable tableMetadata; - private javax.swing.JTable tablePermissions; - private javax.swing.JTextArea textareaInfoComments; - private javax.swing.JTextField txtInfoTags; - private javax.swing.JTextField txtMetadataAttribute; - private javax.swing.JTextField txtMetadataUnit; - private javax.swing.JTextField txtMetadataValue; - // End of variables declaration//GEN-END:variables + ListSelectionListener, DocumentListener, ActionListener { + + /** + * + */ + private static final long serialVersionUID = -943089734580790199L; + private final iDrop idropGUI; + private final IRODSAccount irodsAccount; + private String selectedObjectFullPath; + private String selectedObjectName; + private String selectedObjectParent; + private final IRODSFileSystem irodsFileSystem; + private final IRODSTree irodsTree; + private IRODSInfoDialog dialog; + public static org.slf4j.Logger log = LoggerFactory + .getLogger(IRODSTree.class); + + // private final String fileName; + + /** + * Creates new form IRODSInfoDialog + */ + // public IRODSInfoDialog(java.awt.Frame parent, boolean modal) { + // super(parent, modal); + // initComponents(); + // } + public IRODSInfoDialog(final iDrop parent, final boolean modal, + final IRODSTree irodsTree) { + + super(parent, modal); + idropGUI = parent; + irodsAccount = idropGUI.getiDropCore().getIrodsAccount(); + irodsFileSystem = idropGUI.getiDropCore().getIrodsFileSystem(); + this.irodsTree = irodsTree; + initSelectedObjectName(); + initComponents(); + + selectInfoCard(); + + initializeFileInfo(); + initMetadataInfo(); + initPermissionInfo(); + + // for now hide clear button + btnMetadataClear.setVisible(false); + } + + private void initSelectedObjectName() { + + try { + new IRODSFileService(idropGUI.getiDropCore().getIrodsAccount(), + idropGUI.getiDropCore().getIrodsFileSystem()); + } catch (Exception ex) { + log.error("cannot create irods file service"); + return; + } + + IRODSOutlineModel irodsFileSystemModel = (IRODSOutlineModel) irodsTree + .getModel(); + ListSelectionModel selectionModel = irodsTree.getSelectionModel(); + int idxStart = selectionModel.getMinSelectionIndex(); + + IRODSNode selectedNode = (IRODSNode) irodsFileSystemModel.getValueAt( + idxStart, 0); + selectedObjectFullPath = selectedNode.getFullPath(); + String objectPath[] = selectedObjectFullPath.split("/"); + selectedObjectName = objectPath[objectPath.length - 1]; + IRODSNode pNode = (IRODSNode) selectedNode.getParent(); + selectedObjectParent = pNode.getFullPath(); + } + + private void selectInfoCard() { + + CardLayout cl = (CardLayout) (pnlInfoCards.getLayout()); + if (isCollection()) { + lblObjectCollection.setText("Collection:"); + cl.show(pnlInfoCards, "cardCollectionInfo"); + } else { + lblObjectCollection.setText("Object:"); + cl.show(pnlInfoCards, "cardObjectInfo"); + } + + // also populate header + if (selectedObjectName != null) { + lblInfoObjectName.setText(selectedObjectName); + } + if (selectedObjectParent != null) { + lblInfoObjectParent.setText(selectedObjectParent); + } + } + + private void initializeFileInfo() { + dialog = this; + java.awt.EventQueue.invokeLater(new Runnable() { + @Override + public void run() { + dialog.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + try { + + TaggingServiceFactory taggingServiceFactory = new TaggingServiceFactoryImpl( + irodsFileSystem.getIRODSAccessObjectFactory()); + FreeTaggingService freeTaggingService = taggingServiceFactory + .instanceFreeTaggingService(irodsAccount); + IRODSTaggingService irodsTaggingService = taggingServiceFactory + .instanceIrodsTaggingService(irodsAccount); + + if (isCollection()) { + + CollectionAO collectionAO = irodsFileSystem + .getIRODSAccessObjectFactory().getCollectionAO( + irodsAccount); + Collection collection = collectionAO + .findByAbsolutePath(selectedObjectFullPath); + + if (collection.getCreatedAt().toString() != null) { + lblInfoCollectionCreatedDate.setText(collection + .getCreatedAt().toString()); + } else { + lblInfoCollectionCreatedDate.setText(""); + } + + if (collection.getModifiedAt().toString() != null) { + lblInfoCollectionModifiedDate.setText(collection + .getModifiedAt().toString()); + } else { + lblInfoCollectionModifiedDate.setText(""); + } + + if (collection.getCollectionOwnerName() != null) { + lblInfoCollectionOwner.setText(collection + .getCollectionOwnerName()); + } else { + lblInfoCollectionOwner.setText(""); + } + + if (collection.getComments() != null) { + lblInfoCollectionDescription.setText(collection + .getComments()); + } else { + lblInfoCollectionDescription.setText(""); + } + + if (collection.getSpecColType() != null) { + lblInfoCollectionType.setText(collection + .getSpecColType().name()); + } else { + lblInfoCollectionType.setText(""); + } + + if (collection.getCollectionOwnerZone() != null) { + lblInfoCollectionOwnerZone.setText(collection + .getCollectionOwnerZone()); + } else { + lblInfoCollectionOwnerZone.setText(""); + } + + if (collection.getObjectPath() != null) { + lblInfoCollectionObjectPath.setText(collection + .getObjectPath()); + } else { + lblInfoCollectionObjectPath.setText(""); + } + + if (collection.getInfo1() != null) { + lblInfoCollectionInfo1.setText(collection + .getInfo1()); + } else { + lblInfoCollectionInfo1.setText(""); + } + + if (collection.getInfo2() != null) { + lblInfoCollectionInfo2.setText(collection + .getInfo2()); + } else { + lblInfoCollectionInfo2.setText(""); + } + + // now populate tags and comments for collection + txtInfoTags.setText(freeTaggingService + .getTagsForCollectionInFreeTagForm( + selectedObjectFullPath) + .getSpaceDelimitedTagsForDomain()); + IRODSTagValue irodsTagValue = irodsTaggingService + .getDescriptionOnCollectionForLoggedInUser(selectedObjectFullPath); + if (irodsTagValue != null) { + textareaInfoComments.setText(irodsTagValue + .getTagData()); + } + + } else { + + DataObjectAO dataObjectAO = irodsFileSystem + .getIRODSAccessObjectFactory().getDataObjectAO( + irodsAccount); + DataObject dataObject = dataObjectAO + .findByAbsolutePath(selectedObjectFullPath); + + if (dataObject.getDataSize() >= 0) { + lblInfoObjectSize.setText(FieldFormatHelper + .formatFileLength(dataObject.getDataSize())); + } else { + lblInfoObjectSize.setText(""); + } + + if (dataObject.getCreatedAt().toString() != null) { + lblInfoObjectCreatedDate.setText(dataObject + .getCreatedAt().toString()); + } else { + lblInfoObjectCreatedDate.setText(""); + } + + if (dataObject.getUpdatedAt().toString() != null) { + lblInfoObjectModifiedDate.setText(dataObject + .getUpdatedAt().toString()); + } else { + lblInfoObjectCreatedDate.setText(""); + } + + if (dataObject.getDataOwnerName() != null) { + lblInfoObjectOwner.setText(dataObject + .getDataOwnerName()); + } else { + lblInfoObjectOwner.setText(""); + } + + if (dataObject.getDataOwnerZone() != null) { + lblInfoObjectOwnerZone.setText(dataObject + .getDataOwnerZone()); + } else { + lblInfoObjectOwnerZone.setText(""); + } + + if (dataObject.getDataPath() != null) { + lblInfoObjectDataPath.setText(dataObject + .getDataPath()); + } else { + lblInfoObjectDataPath.setText(""); + } + + if (dataObject.getResourceGroupName() != null) { + lblInfoObjectResourceGroup.setText(dataObject + .getResourceGroupName()); + } else { + lblInfoObjectResourceGroup.setText(""); + } + + if (dataObject.getChecksum() != null) { + lblInfoObjectChecksum.setText(dataObject + .getChecksum()); + } else { + lblInfoObjectChecksum.setText(""); + } + + if (dataObject.getResourceName() != null) { + lblInfoObjectResource.setText(dataObject + .getResourceName()); + } else { + lblInfoObjectResource.setText(""); + } + + if (dataObject.getDataReplicationNumber() >= 0) { + lblInfoObjectReplicaNumber.setText(Integer + .toString(dataObject + .getDataReplicationNumber())); + } else { + lblInfoObjectReplicaNumber.setText(""); + } + + if (dataObject.getReplicationStatus() != null) { + lblInfoObjectReplicationStatus.setText(dataObject + .getReplicationStatus()); + } else { + lblInfoObjectReplicationStatus.setText(""); + } + + if (dataObject.getDataStatus() != null) { + lblInfoObjectStatus.setText(dataObject + .getDataStatus()); + } else { + lblInfoObjectStatus.setText(""); + } + + if (dataObject.getDataTypeName() != null) { + lblInfoObjectType.setText(dataObject + .getDataTypeName()); + } else { + lblInfoObjectType.setText(""); + } + + if (dataObject.getDataVersion() >= 0) { + lblInfoObjectVersion.setText(Integer + .toString(dataObject.getDataVersion())); + } else { + lblInfoObjectVersion.setText(""); + } + + // now populate tags and comments for data object + txtInfoTags.setText(freeTaggingService + .getTagsForDataObjectInFreeTagForm( + selectedObjectFullPath) + .getSpaceDelimitedTagsForDomain()); + IRODSTagValue irodsTagValue = irodsTaggingService + .getDescriptionOnDataObjectForLoggedInUser(selectedObjectFullPath); + if (irodsTagValue != null) { + textareaInfoComments.setText(irodsTagValue + .getTagData()); + } + + } + + } catch (FileNotFoundException ex) { + Exceptions.printStackTrace(ex); + } catch (JargonException ex) { + Exceptions.printStackTrace(ex); + } + + dialog.setCursor(Cursor + .getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + } + }); + } + + private void initMetadataInfo() { + dialog = this; + java.awt.EventQueue.invokeLater(new Runnable() { + @Override + public void run() { + dialog.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + try { + // set up metadata table and table model + IRODSFileService irodsFileService = new IRODSFileService( + irodsAccount, irodsFileSystem); + MetadataTableModel metadataTableModel; + + if (isCollection()) { + metadataTableModel = new MetadataTableModel( + irodsFileService + .getMetadataForCollection(selectedObjectFullPath)); + } else { + metadataTableModel = new MetadataTableModel( + irodsFileService.getMetadataForDataObject( + selectedObjectParent, + selectedObjectName)); + } + tableMetadata.setModel(metadataTableModel); + tableMetadata.getSelectionModel().addListSelectionListener( + dialog); + tableMetadata.validate(); + + // add document listener to metadata text fields + txtMetadataAttribute.getDocument().addDocumentListener( + dialog); + txtMetadataValue.getDocument().addDocumentListener(dialog); + txtMetadataUnit.getDocument().addDocumentListener(dialog); + } catch (IdropException ex) { + Logger.getLogger(MetadataViewDialog.class.getName()).log( + Level.SEVERE, null, ex); + idropGUI.showIdropException(ex); + } + + dialog.setCursor(Cursor + .getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + } + }); + } + + private void initPermissionInfo() { + dialog = this; + java.awt.EventQueue.invokeLater(new Runnable() { + @Override + public void run() { + + dialog.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + + // this list of ACLs contains permission that are not suppoted? + // List<FilePermissionEnum> permissions = + // FilePermissionEnum.listAllValues(); + // for (FilePermissionEnum permission: permissions) { + // cbPermissionsPermission.addItem(permission.name()); + // } + // will just do my own for now + // cbPermissionsPermission.addItem("NONE"); + javax.swing.JComboBox tableCombo = new javax.swing.JComboBox(); + tableCombo.addItem("READ"); + tableCombo.addItem("WRITE"); + tableCombo.addItem("OWN"); + + // set up permission table and table model + PermissionsTableModel permissionsTableModel = null; + try { + if (isCollection()) { + CollectionAO collectionAO = irodsFileSystem + .getIRODSAccessObjectFactory().getCollectionAO( + irodsAccount); + permissionsTableModel = new PermissionsTableModel( + collectionAO + .listPermissionsForCollection(selectedObjectFullPath)); + } else { + DataObjectAO dataObjectAO = irodsFileSystem + .getIRODSAccessObjectFactory().getDataObjectAO( + irodsAccount); + permissionsTableModel = new PermissionsTableModel( + dataObjectAO + .listPermissionsForDataObject(selectedObjectFullPath)); + } + } catch (JargonException ex) { + Exceptions.printStackTrace(ex); + } + + tablePermissions.setModel(permissionsTableModel); + tablePermissions.getSelectionModel().addListSelectionListener( + dialog); + TableColumn permissionColumn = tablePermissions + .getColumnModel().getColumn(1); + permissionColumn + .setCellEditor(new DefaultCellEditor(tableCombo)); + permissionsTableModel.resetOriginalPermissionList(); + tablePermissions.validate(); + + dialog.setCursor(Cursor + .getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + } + }); + } + + private boolean isCollection() { + + boolean state = false; + CollectionAndDataObjectListingEntry entry = null; + + // perhaps should throw exception if these vital member variables are + // null + if ((selectedObjectFullPath != null) && (irodsFileSystem != null) + && (irodsAccount != null)) { + CollectionAndDataObjectListAndSearchAOImpl collectionAndDataObjectListAndSearchAOImpl; + try { + collectionAndDataObjectListAndSearchAOImpl = (CollectionAndDataObjectListAndSearchAOImpl) irodsFileSystem + .getIRODSAccessObjectFactory() + .getCollectionAndDataObjectListAndSearchAO(irodsAccount); + entry = collectionAndDataObjectListAndSearchAOImpl + .getCollectionAndDataObjectListingEntryAtGivenAbsolutePath(selectedObjectFullPath); + } catch (JargonException ex) { + // TODO: respond correctly here + Exceptions.printStackTrace(ex); + } + + state = entry.isCollection(); + } + + return state; + } + + private void updateMetadataCreateBtnStatus() { + // create button should only be enabled when there is no tableMetadata + // selection and all text fields are populated + btnMetadataCreate + .setEnabled(txtMetadataAttribute.getText().length() > 0 + && txtMetadataValue.getText().length() > 0 + && txtMetadataUnit.getText().length() > 0); + } + + private void updateMetadataDeleteBtnStatus(final int selectedRowCount) { + // delete button should only be enabled when there is a tableMetadata + // selection + // add all text fields are populated + btnMetadataDelete.setEnabled(selectedRowCount > 0); + } + + private void updatePermissionsDeleteBtnStatus(final int selectedRowCount) { + // delete button should only be enabled when there is a tableMetadata or + // tablePermissions selection + btnDeleteSharePermissions.setEnabled(selectedRowCount > 0); + } + + // ListSelectionListener methods + @Override + public void valueChanged(final ListSelectionEvent lse) { + int selectedRowCount = 0; + + if (!lse.getValueIsAdjusting()) { + // determine which table is selected + // Metadata Table? + if (lse.getSource() == tableMetadata.getSelectionModel()) { + selectedRowCount = tableMetadata.getSelectedRowCount(); + updateMetadataDeleteBtnStatus(selectedRowCount); + } else { // Permissions Table + selectedRowCount = tablePermissions.getSelectedRowCount(); + updatePermissionsDeleteBtnStatus(selectedRowCount); + } + } + } + + // end ListSelectionListener methods + + // DocumentListener Methods + @Override + public void insertUpdate(final DocumentEvent de) { + updateMetadataCreateBtnStatus(); + } + + @Override + public void removeUpdate(final DocumentEvent de) { + updateMetadataCreateBtnStatus(); + } + + @Override + public void changedUpdate(final DocumentEvent de) { + updateMetadataCreateBtnStatus(); + } + + // end DocumentListener Methods + + // ActionListener Methods + @Override + public void actionPerformed(final ActionEvent ae) { + // if (ae.getSource() == cbPermissionsPermission || + // ae.getSource() == cbPermissionsUserName) { + // updatePermissonsCreateBtnStatus(); + // } + } + + // end ActionListener Methods + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // <editor-fold defaultstate="collapsed" + // desc="Generated Code">//GEN-BEGIN:initComponents + private void initComponents() { + + jPanel2 = new javax.swing.JPanel(); + jPanel1 = new javax.swing.JPanel(); + pnlSelectedObject = new javax.swing.JPanel(); + lblObjectCollection = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + lblInfoObjectName = new javax.swing.JLabel(); + lblInfoObjectParent = new javax.swing.JLabel(); + tabbedpanelMain = new javax.swing.JTabbedPane(); + pnlInfoTab = new javax.swing.JPanel(); + pnlInfoCards = new javax.swing.JPanel(); + pnlCollectionInfo = new javax.swing.JPanel(); + jLabel19 = new javax.swing.JLabel(); + jLabel20 = new javax.swing.JLabel(); + jLabel21 = new javax.swing.JLabel(); + jLabel22 = new javax.swing.JLabel(); + jLabel23 = new javax.swing.JLabel(); + jLabel24 = new javax.swing.JLabel(); + jLabel25 = new javax.swing.JLabel(); + jLabel26 = new javax.swing.JLabel(); + jLabel27 = new javax.swing.JLabel(); + lblInfoCollectionCreatedDate = new javax.swing.JLabel(); + lblInfoCollectionModifiedDate = new javax.swing.JLabel(); + lblInfoCollectionOwner = new javax.swing.JLabel(); + lblInfoCollectionOwnerZone = new javax.swing.JLabel(); + lblInfoCollectionType = new javax.swing.JLabel(); + lblInfoCollectionObjectPath = new javax.swing.JLabel(); + lblInfoCollectionDescription = new javax.swing.JLabel(); + lblInfoCollectionInfo1 = new javax.swing.JLabel(); + lblInfoCollectionInfo2 = new javax.swing.JLabel(); + pnlObjectInfo = new javax.swing.JPanel(); + jLabel3 = new javax.swing.JLabel(); + jLabel4 = new javax.swing.JLabel(); + jLabel5 = new javax.swing.JLabel(); + jLabel6 = new javax.swing.JLabel(); + jLabel7 = new javax.swing.JLabel(); + jLabel8 = new javax.swing.JLabel(); + jLabel9 = new javax.swing.JLabel(); + jLabel10 = new javax.swing.JLabel(); + jLabel11 = new javax.swing.JLabel(); + jLabel12 = new javax.swing.JLabel(); + jLabel13 = new javax.swing.JLabel(); + jLabel14 = new javax.swing.JLabel(); + jLabel15 = new javax.swing.JLabel(); + jLabel16 = new javax.swing.JLabel(); + lblInfoObjectSize = new javax.swing.JLabel(); + lblInfoObjectCreatedDate = new javax.swing.JLabel(); + lblInfoObjectModifiedDate = new javax.swing.JLabel(); + lblInfoObjectOwner = new javax.swing.JLabel(); + lblInfoObjectOwnerZone = new javax.swing.JLabel(); + lblInfoObjectDataPath = new javax.swing.JLabel(); + lblInfoObjectResourceGroup = new javax.swing.JLabel(); + lblInfoObjectChecksum = new javax.swing.JLabel(); + lblInfoObjectResource = new javax.swing.JLabel(); + lblInfoObjectReplicaNumber = new javax.swing.JLabel(); + lblInfoObjectReplicationStatus = new javax.swing.JLabel(); + lblInfoObjectStatus = new javax.swing.JLabel(); + lblInfoObjectType = new javax.swing.JLabel(); + lblInfoObjectVersion = new javax.swing.JLabel(); + pnlTagsComments = new javax.swing.JPanel(); + jLabel17 = new javax.swing.JLabel(); + txtInfoTags = new javax.swing.JTextField(); + jLabel18 = new javax.swing.JLabel(); + jScrollPane1 = new javax.swing.JScrollPane(); + textareaInfoComments = new javax.swing.JTextArea(); + btnUpdateTagsComments = new javax.swing.JButton(); + pnlMetadataTab = new javax.swing.JPanel(); + pnlMetadataTable = new javax.swing.JPanel(); + jScrollPane2 = new javax.swing.JScrollPane(); + tableMetadata = new javax.swing.JTable(); + jPanel5 = new javax.swing.JPanel(); + jPanel6 = new javax.swing.JPanel(); + btnMetadataDelete = new javax.swing.JButton(); + pnlMetaDataEdit = new javax.swing.JPanel(); + jLabel28 = new javax.swing.JLabel(); + jLabel29 = new javax.swing.JLabel(); + jLabel30 = new javax.swing.JLabel(); + btnMetadataClear = new javax.swing.JButton(); + btnMetadataCreate = new javax.swing.JButton(); + txtMetadataAttribute = new javax.swing.JTextField(); + txtMetadataValue = new javax.swing.JTextField(); + txtMetadataUnit = new javax.swing.JTextField(); + pnlPermissionsTab = new javax.swing.JPanel(); + pnlPermissionsTable = new javax.swing.JPanel(); + jScrollPane3 = new javax.swing.JScrollPane(); + tablePermissions = new javax.swing.JTable(); + jPanel7 = new javax.swing.JPanel(); + jPanel8 = new javax.swing.JPanel(); + btnPermissionsSave = new javax.swing.JButton(); + jPanel9 = new javax.swing.JPanel(); + jPanel16 = new javax.swing.JPanel(); + btnAddSharePermissions = new javax.swing.JButton(); + btnDeleteSharePermissions = new javax.swing.JButton(); + pnlCloseBtn = new javax.swing.JPanel(); + jPanel3 = new javax.swing.JPanel(); + jPanel4 = new javax.swing.JPanel(); + btnClose = new javax.swing.JButton(); + btnRefresh = new javax.swing.JButton(); + + org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout( + jPanel2); + jPanel2.setLayout(jPanel2Layout); + jPanel2Layout.setHorizontalGroup(jPanel2Layout.createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING).add(0, 100, + Short.MAX_VALUE)); + jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING).add(0, 100, + Short.MAX_VALUE)); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setPreferredSize(new java.awt.Dimension(560, 720)); + + jPanel1.setBorder(javax.swing.BorderFactory.createEmptyBorder(14, 10, + 10, 10)); + jPanel1.setPreferredSize(new java.awt.Dimension(600, 750)); + jPanel1.setLayout(new java.awt.BorderLayout()); + + pnlSelectedObject.setBorder(javax.swing.BorderFactory + .createEmptyBorder(1, 4, 1, 4)); + pnlSelectedObject.setPreferredSize(new java.awt.Dimension(528, 70)); + + lblObjectCollection.setFont(new java.awt.Font("Lucida Grande", 0, 14)); // NOI18N + lblObjectCollection.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, + "IRODSInfoDialog.lblObjectCollection.text")); // NOI18N + + jLabel2.setFont(new java.awt.Font("Lucida Grande", 0, 14)); // NOI18N + jLabel2.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, "IRODSInfoDialog.jLabel2.text")); // NOI18N + + lblInfoObjectName.setText(org.openide.util.NbBundle + .getMessage(IRODSInfoDialog.class, + "IRODSInfoDialog.lblInfoObjectName.text")); // NOI18N + + lblInfoObjectParent.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, + "IRODSInfoDialog.lblInfoObjectParent.text")); // NOI18N + + org.jdesktop.layout.GroupLayout pnlSelectedObjectLayout = new org.jdesktop.layout.GroupLayout( + pnlSelectedObject); + pnlSelectedObject.setLayout(pnlSelectedObjectLayout); + pnlSelectedObjectLayout + .setHorizontalGroup(pnlSelectedObjectLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add(pnlSelectedObjectLayout + .createSequentialGroup() + .addContainerGap() + .add(pnlSelectedObjectLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING, + false) + .add(lblObjectCollection, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + 140, Short.MAX_VALUE) + .add(jLabel2, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE)) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.RELATED) + .add(pnlSelectedObjectLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING, + false) + .add(lblInfoObjectName, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + 362, Short.MAX_VALUE) + .add(lblInfoObjectParent, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE)) + .addContainerGap(67, Short.MAX_VALUE))); + pnlSelectedObjectLayout + .setVerticalGroup(pnlSelectedObjectLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add(pnlSelectedObjectLayout + .createSequentialGroup() + .addContainerGap() + .add(pnlSelectedObjectLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.BASELINE) + .add(lblObjectCollection) + .add(lblInfoObjectName)) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.RELATED) + .add(pnlSelectedObjectLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel2, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, + 20, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(lblInfoObjectParent)) + .addContainerGap(19, Short.MAX_VALUE))); + + jPanel1.add(pnlSelectedObject, java.awt.BorderLayout.PAGE_START); + + tabbedpanelMain.setPreferredSize(new java.awt.Dimension(600, 867)); + + pnlInfoTab.setLayout(new java.awt.BorderLayout()); + + pnlInfoCards.setBorder(javax.swing.BorderFactory.createEtchedBorder()); + pnlInfoCards.setPreferredSize(new java.awt.Dimension(555, 640)); + pnlInfoCards.setLayout(new java.awt.CardLayout()); + + pnlCollectionInfo.setPreferredSize(new java.awt.Dimension(515, 500)); + + jLabel19.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, "IRODSInfoDialog.jLabel19.text")); // NOI18N + + jLabel20.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, "IRODSInfoDialog.jLabel20.text")); // NOI18N + + jLabel21.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, "IRODSInfoDialog.jLabel21.text")); // NOI18N + + jLabel22.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, "IRODSInfoDialog.jLabel22.text")); // NOI18N + + jLabel23.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, "IRODSInfoDialog.jLabel23.text")); // NOI18N + + jLabel24.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, "IRODSInfoDialog.jLabel24.text")); // NOI18N + + jLabel25.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, "IRODSInfoDialog.jLabel25.text")); // NOI18N + + jLabel26.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, "IRODSInfoDialog.jLabel26.text")); // NOI18N + + jLabel27.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, "IRODSInfoDialog.jLabel27.text")); // NOI18N + + lblInfoCollectionCreatedDate.setText(org.openide.util.NbBundle + .getMessage(IRODSInfoDialog.class, + "IRODSInfoDialog.lblInfoCollectionCreatedDate.text")); // NOI18N + + lblInfoCollectionModifiedDate.setText(org.openide.util.NbBundle + .getMessage(IRODSInfoDialog.class, + "IRODSInfoDialog.lblInfoCollectionModifiedDate.text")); // NOI18N + + lblInfoCollectionOwner.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, + "IRODSInfoDialog.lblInfoCollectionOwner.text")); // NOI18N + + lblInfoCollectionOwnerZone.setText(org.openide.util.NbBundle + .getMessage(IRODSInfoDialog.class, + "IRODSInfoDialog.lblInfoCollectionOwnerZone.text")); // NOI18N + + lblInfoCollectionType.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, + "IRODSInfoDialog.lblInfoCollectionType.text")); // NOI18N + + lblInfoCollectionObjectPath.setText(org.openide.util.NbBundle + .getMessage(IRODSInfoDialog.class, + "IRODSInfoDialog.lblInfoCollectionObjectPath.text")); // NOI18N + + lblInfoCollectionDescription.setText(org.openide.util.NbBundle + .getMessage(IRODSInfoDialog.class, + "IRODSInfoDialog.lblInfoCollectionDescription.text")); // NOI18N + + lblInfoCollectionInfo1.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, + "IRODSInfoDialog.lblInfoCollectionInfo1.text")); // NOI18N + + lblInfoCollectionInfo2.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, + "IRODSInfoDialog.lblInfoCollectionInfo2.text")); // NOI18N + + org.jdesktop.layout.GroupLayout pnlCollectionInfoLayout = new org.jdesktop.layout.GroupLayout( + pnlCollectionInfo); + pnlCollectionInfo.setLayout(pnlCollectionInfoLayout); + pnlCollectionInfoLayout + .setHorizontalGroup(pnlCollectionInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add(pnlCollectionInfoLayout + .createSequentialGroup() + .addContainerGap() + .add(pnlCollectionInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.TRAILING, + false) + .add(org.jdesktop.layout.GroupLayout.LEADING, + pnlCollectionInfoLayout + .createSequentialGroup() + .add(pnlCollectionInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add(jLabel22) + .add(jLabel23) + .add(jLabel24) + .add(jLabel25) + .add(jLabel26) + .add(jLabel27)) + .add(24, 24, 24) + .add(pnlCollectionInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add(lblInfoCollectionOwnerZone, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + 400, + Short.MAX_VALUE) + .add(lblInfoCollectionType, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .add(lblInfoCollectionObjectPath, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .add(lblInfoCollectionDescription, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .add(lblInfoCollectionInfo1, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .add(lblInfoCollectionInfo2, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE))) + .add(org.jdesktop.layout.GroupLayout.LEADING, + pnlCollectionInfoLayout + .createSequentialGroup() + .add(pnlCollectionInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add(jLabel19) + .add(jLabel20) + .add(jLabel21)) + .add(47, 47, 47) + .add(pnlCollectionInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING, + false) + .add(lblInfoCollectionCreatedDate, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + 400, + Short.MAX_VALUE) + .add(lblInfoCollectionModifiedDate, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .add(lblInfoCollectionOwner, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE)))) + .addContainerGap())); + pnlCollectionInfoLayout + .setVerticalGroup(pnlCollectionInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add(pnlCollectionInfoLayout + .createSequentialGroup() + .add(24, 24, 24) + .add(pnlCollectionInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel19) + .add(lblInfoCollectionCreatedDate)) + .add(18, 18, 18) + .add(pnlCollectionInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel20) + .add(lblInfoCollectionModifiedDate)) + .add(18, 18, 18) + .add(pnlCollectionInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel21) + .add(lblInfoCollectionOwner)) + .add(18, 18, 18) + .add(pnlCollectionInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel22) + .add(lblInfoCollectionOwnerZone)) + .add(18, 18, 18) + .add(pnlCollectionInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel23) + .add(lblInfoCollectionType)) + .add(18, 18, 18) + .add(pnlCollectionInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel24) + .add(lblInfoCollectionObjectPath)) + .add(18, 18, 18) + .add(pnlCollectionInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel25) + .add(lblInfoCollectionDescription)) + .add(18, 18, 18) + .add(pnlCollectionInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel26) + .add(lblInfoCollectionInfo1)) + .add(18, 18, 18) + .add(pnlCollectionInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel27) + .add(lblInfoCollectionInfo2)) + .addContainerGap(289, Short.MAX_VALUE))); + + pnlInfoCards.add(pnlCollectionInfo, "cardCollectionInfo"); + + pnlObjectInfo.setPreferredSize(new java.awt.Dimension(550, 530)); + + jLabel3.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, "IRODSInfoDialog.jLabel3.text")); // NOI18N + + jLabel4.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, "IRODSInfoDialog.jLabel4.text")); // NOI18N + + jLabel5.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, "IRODSInfoDialog.jLabel5.text")); // NOI18N + + jLabel6.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, "IRODSInfoDialog.jLabel6.text")); // NOI18N + + jLabel7.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, "IRODSInfoDialog.jLabel7.text")); // NOI18N + + jLabel8.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, "IRODSInfoDialog.jLabel8.text")); // NOI18N + + jLabel9.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, "IRODSInfoDialog.jLabel9.text")); // NOI18N + + jLabel10.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, "IRODSInfoDialog.jLabel10.text")); // NOI18N + + jLabel11.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, "IRODSInfoDialog.jLabel11.text")); // NOI18N + + jLabel12.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, "IRODSInfoDialog.jLabel12.text")); // NOI18N + + jLabel13.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, "IRODSInfoDialog.jLabel13.text")); // NOI18N + + jLabel14.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, "IRODSInfoDialog.jLabel14.text")); // NOI18N + + jLabel15.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, "IRODSInfoDialog.jLabel15.text")); // NOI18N + + jLabel16.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, "IRODSInfoDialog.jLabel16.text")); // NOI18N + + lblInfoObjectSize.setText(org.openide.util.NbBundle + .getMessage(IRODSInfoDialog.class, + "IRODSInfoDialog.lblInfoObjectSize.text")); // NOI18N + + lblInfoObjectCreatedDate.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, + "IRODSInfoDialog.lblInfoObjectCreatedDate.text")); // NOI18N + + lblInfoObjectModifiedDate.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, + "IRODSInfoDialog.lblInfoObjectModifiedDate.text")); // NOI18N + + lblInfoObjectOwner.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, + "IRODSInfoDialog.lblInfoObjectOwner.text")); // NOI18N + + lblInfoObjectOwnerZone.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, + "IRODSInfoDialog.lblInfoObjectOwnerZone.text")); // NOI18N + + lblInfoObjectDataPath.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, + "IRODSInfoDialog.lblInfoObjectDataPath.text")); // NOI18N + + lblInfoObjectResourceGroup.setText(org.openide.util.NbBundle + .getMessage(IRODSInfoDialog.class, + "IRODSInfoDialog.lblInfoObjectResourceGroup.text")); // NOI18N + + lblInfoObjectChecksum.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, + "IRODSInfoDialog.lblInfoObjectChecksum.text")); // NOI18N + + lblInfoObjectResource.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, + "IRODSInfoDialog.lblInfoObjectResource.text")); // NOI18N + + lblInfoObjectReplicaNumber.setText(org.openide.util.NbBundle + .getMessage(IRODSInfoDialog.class, + "IRODSInfoDialog.lblInfoObjectReplicaNumber.text")); // NOI18N + + lblInfoObjectReplicationStatus.setText(org.openide.util.NbBundle + .getMessage(IRODSInfoDialog.class, + "IRODSInfoDialog.lblInfoObjectReplicationStatus.text")); // NOI18N + + lblInfoObjectStatus.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, + "IRODSInfoDialog.lblInfoObjectStatus.text")); // NOI18N + + lblInfoObjectType.setText(org.openide.util.NbBundle + .getMessage(IRODSInfoDialog.class, + "IRODSInfoDialog.lblInfoObjectType.text")); // NOI18N + + lblInfoObjectVersion.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, + "IRODSInfoDialog.lblInfoObjectVersion.text")); // NOI18N + + org.jdesktop.layout.GroupLayout pnlObjectInfoLayout = new org.jdesktop.layout.GroupLayout( + pnlObjectInfo); + pnlObjectInfo.setLayout(pnlObjectInfoLayout); + pnlObjectInfoLayout + .setHorizontalGroup(pnlObjectInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add(pnlObjectInfoLayout + .createSequentialGroup() + .addContainerGap() + .add(pnlObjectInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING, + false) + .add(pnlObjectInfoLayout + .createSequentialGroup() + .add(pnlObjectInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add(jLabel3, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, + 70, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(jLabel4) + .add(jLabel5) + .add(jLabel6) + .add(jLabel7, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, + 90, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(jLabel8, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, + 90, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(jLabel9, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, + 115, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(jLabel10, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, + 80, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(jLabel11, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, + 70, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(jLabel12)) + .add(22, 22, 22) + .add(pnlObjectInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING, + false) + .add(lblInfoObjectResource, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .add(lblInfoObjectReplicaNumber, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .add(lblInfoObjectSize, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + 370, + Short.MAX_VALUE) + .add(lblInfoObjectCreatedDate, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .add(lblInfoObjectModifiedDate, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .add(lblInfoObjectOwner, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .add(lblInfoObjectOwnerZone, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .add(lblInfoObjectDataPath, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .add(lblInfoObjectResourceGroup, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .add(lblInfoObjectChecksum, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE))) + .add(pnlObjectInfoLayout + .createSequentialGroup() + .add(pnlObjectInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add(jLabel13, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, + 125, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(jLabel14) + .add(jLabel15) + .add(jLabel16)) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.UNRELATED) + .add(pnlObjectInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add(lblInfoObjectReplicationStatus, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .add(lblInfoObjectStatus, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .add(lblInfoObjectType, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .add(lblInfoObjectVersion, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE)))) + .addContainerGap(51, Short.MAX_VALUE))); + pnlObjectInfoLayout + .setVerticalGroup(pnlObjectInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add(pnlObjectInfoLayout + .createSequentialGroup() + .add(pnlObjectInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add(pnlObjectInfoLayout + .createSequentialGroup() + .add(18, 18, 18) + .add(lblInfoObjectSize)) + .add(org.jdesktop.layout.GroupLayout.TRAILING, + pnlObjectInfoLayout + .createSequentialGroup() + .addContainerGap() + .add(jLabel3))) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.RELATED) + .add(pnlObjectInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add(lblInfoObjectCreatedDate) + .add(jLabel4)) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.RELATED) + .add(pnlObjectInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel5) + .add(lblInfoObjectModifiedDate)) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.RELATED) + .add(pnlObjectInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add(lblInfoObjectOwner) + .add(org.jdesktop.layout.GroupLayout.TRAILING, + jLabel6)) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.RELATED) + .add(pnlObjectInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel7) + .add(lblInfoObjectOwnerZone)) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.RELATED) + .add(pnlObjectInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add(lblInfoObjectDataPath) + .add(org.jdesktop.layout.GroupLayout.TRAILING, + jLabel8)) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.RELATED) + .add(pnlObjectInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add(jLabel9) + .add(org.jdesktop.layout.GroupLayout.TRAILING, + lblInfoObjectResourceGroup)) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.RELATED) + .add(pnlObjectInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add(lblInfoObjectChecksum) + .add(org.jdesktop.layout.GroupLayout.TRAILING, + jLabel10)) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.RELATED) + .add(pnlObjectInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add(jLabel11) + .add(lblInfoObjectResource)) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.RELATED) + .add(pnlObjectInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel12) + .add(lblInfoObjectReplicaNumber)) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.RELATED) + .add(pnlObjectInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel13) + .add(lblInfoObjectReplicationStatus)) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.RELATED) + .add(pnlObjectInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel14).add(lblInfoObjectStatus)) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.RELATED) + .add(pnlObjectInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel15).add(lblInfoObjectType)) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.RELATED) + .add(pnlObjectInfoLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel16) + .add(lblInfoObjectVersion)) + .addContainerGap(281, Short.MAX_VALUE))); + + pnlInfoCards.add(pnlObjectInfo, "cardObjectInfo"); + + pnlInfoTab.add(pnlInfoCards, java.awt.BorderLayout.CENTER); + + pnlTagsComments.setBorder(javax.swing.BorderFactory + .createEtchedBorder()); + + jLabel17.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, "IRODSInfoDialog.jLabel17.text")); // NOI18N + + txtInfoTags.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, "IRODSInfoDialog.txtInfoTags.text")); // NOI18N + + jLabel18.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, "IRODSInfoDialog.jLabel18.text")); // NOI18N + + textareaInfoComments.setColumns(20); + textareaInfoComments.setRows(5); + jScrollPane1.setViewportView(textareaInfoComments); + + btnUpdateTagsComments.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, + "IRODSInfoDialog.btnUpdateTagsComments.text")); // NOI18N + btnUpdateTagsComments + .addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed( + final java.awt.event.ActionEvent evt) { + btnUpdateTagsCommentsActionPerformed(evt); + } + }); + + org.jdesktop.layout.GroupLayout pnlTagsCommentsLayout = new org.jdesktop.layout.GroupLayout( + pnlTagsComments); + pnlTagsComments.setLayout(pnlTagsCommentsLayout); + pnlTagsCommentsLayout + .setHorizontalGroup(pnlTagsCommentsLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add(pnlTagsCommentsLayout + .createSequentialGroup() + .add(pnlTagsCommentsLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add(org.jdesktop.layout.GroupLayout.TRAILING, + pnlTagsCommentsLayout + .createSequentialGroup() + .addContainerGap() + .add(pnlTagsCommentsLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add(jLabel17) + .add(jLabel18)) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.RELATED, + 66, + Short.MAX_VALUE) + .add(pnlTagsCommentsLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING, + false) + .add(txtInfoTags) + .add(jScrollPane1, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + 408, + Short.MAX_VALUE)) + .add(6, 6, 6)) + .add(org.jdesktop.layout.GroupLayout.TRAILING, + pnlTagsCommentsLayout + .createSequentialGroup() + .add(0, 0, + Short.MAX_VALUE) + .add(btnUpdateTagsComments))) + .addContainerGap())); + pnlTagsCommentsLayout + .setVerticalGroup(pnlTagsCommentsLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add(pnlTagsCommentsLayout + .createSequentialGroup() + .add(6, 6, 6) + .add(pnlTagsCommentsLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel17) + .add(txtInfoTags, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, + 28, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.UNRELATED) + .add(pnlTagsCommentsLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add(jLabel18) + .add(jScrollPane1, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.UNRELATED) + .add(btnUpdateTagsComments) + .addContainerGap( + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE))); + + pnlInfoTab.add(pnlTagsComments, java.awt.BorderLayout.SOUTH); + + tabbedpanelMain.addTab(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, + "IRODSInfoDialog.pnlInfoTab.TabConstraints.tabTitle"), + pnlInfoTab); // NOI18N + + pnlMetadataTab.setLayout(new java.awt.BorderLayout()); + + pnlMetadataTable.setLayout(new java.awt.BorderLayout()); + + tableMetadata.setModel(new javax.swing.table.DefaultTableModel( + new Object[][] { { null, null, null }, { null, null, null }, + { null, null, null }, { null, null, null } }, + new String[] { "Attribute", "Value", "Unit" }) { + Class[] types = new Class[] { java.lang.String.class, + java.lang.String.class, java.lang.String.class }; + boolean[] canEdit = new boolean[] { false, false, false }; + + @Override + public Class getColumnClass(final int columnIndex) { + return types[columnIndex]; + } + + @Override + public boolean isCellEditable(final int rowIndex, + final int columnIndex) { + return canEdit[columnIndex]; + } + }); + tableMetadata + .setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); + jScrollPane2.setViewportView(tableMetadata); + + pnlMetadataTable.add(jScrollPane2, java.awt.BorderLayout.CENTER); + + jPanel5.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, + 2)); + jPanel5.setPreferredSize(new java.awt.Dimension(568, 44)); + jPanel5.setLayout(new java.awt.BorderLayout()); + + jPanel6.setPreferredSize(new java.awt.Dimension(100, 40)); + + btnMetadataDelete.setText(org.openide.util.NbBundle + .getMessage(IRODSInfoDialog.class, + "IRODSInfoDialog.btnMetadataDelete.text")); // NOI18N + btnMetadataDelete.setActionCommand(org.openide.util.NbBundle + .getMessage(IRODSInfoDialog.class, + "IRODSInfoDialog.btnMetadataDelete.actionCommand")); // NOI18N + btnMetadataDelete.setEnabled(false); + btnMetadataDelete + .addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed( + final java.awt.event.ActionEvent evt) { + btnMetadataDeleteActionPerformed(evt); + } + }); + + org.jdesktop.layout.GroupLayout jPanel6Layout = new org.jdesktop.layout.GroupLayout( + jPanel6); + jPanel6.setLayout(jPanel6Layout); + jPanel6Layout.setHorizontalGroup(jPanel6Layout + .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(0, 100, Short.MAX_VALUE) + .add(jPanel6Layout.createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING).add( + jPanel6Layout.createSequentialGroup().add(8, 8, 8) + .add(btnMetadataDelete) + .addContainerGap(8, Short.MAX_VALUE)))); + jPanel6Layout + .setVerticalGroup(jPanel6Layout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add(0, 40, Short.MAX_VALUE) + .add(jPanel6Layout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add(jPanel6Layout + .createSequentialGroup() + .add(5, 5, 5) + .add(btnMetadataDelete) + .addContainerGap( + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE)))); + + jPanel5.add(jPanel6, java.awt.BorderLayout.EAST); + + pnlMetadataTable.add(jPanel5, java.awt.BorderLayout.SOUTH); + + pnlMetadataTab.add(pnlMetadataTable, java.awt.BorderLayout.CENTER); + + pnlMetaDataEdit.setBorder(javax.swing.BorderFactory + .createEtchedBorder()); + pnlMetaDataEdit.setPreferredSize(new java.awt.Dimension(527, 200)); + + jLabel28.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, "IRODSInfoDialog.jLabel28.text")); // NOI18N + + jLabel29.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, "IRODSInfoDialog.jLabel29.text")); // NOI18N + + jLabel30.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, "IRODSInfoDialog.jLabel30.text")); // NOI18N + + btnMetadataClear + .setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, + "IRODSInfoDialog.btnMetadataClear.text")); // NOI18N + btnMetadataClear.addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed(final java.awt.event.ActionEvent evt) { + btnMetadataClearActionPerformed(evt); + } + }); + + btnMetadataCreate.setText(org.openide.util.NbBundle + .getMessage(IRODSInfoDialog.class, + "IRODSInfoDialog.btnMetadataCreate.text")); // NOI18N + btnMetadataCreate.setEnabled(false); + btnMetadataCreate + .addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed( + final java.awt.event.ActionEvent evt) { + btnMetadataCreateActionPerformed(evt); + } + }); + + txtMetadataAttribute.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, + "IRODSInfoDialog.txtMetadataAttribute.text")); // NOI18N + + txtMetadataValue + .setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, + "IRODSInfoDialog.txtMetadataValue.text")); // NOI18N + + txtMetadataUnit.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, "IRODSInfoDialog.txtMetadataUnit.text")); // NOI18N + + org.jdesktop.layout.GroupLayout pnlMetaDataEditLayout = new org.jdesktop.layout.GroupLayout( + pnlMetaDataEdit); + pnlMetaDataEdit.setLayout(pnlMetaDataEditLayout); + pnlMetaDataEditLayout + .setHorizontalGroup(pnlMetaDataEditLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add(pnlMetaDataEditLayout + .createSequentialGroup() + .addContainerGap() + .add(pnlMetaDataEditLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add(pnlMetaDataEditLayout + .createSequentialGroup() + .add(pnlMetaDataEditLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add(jLabel28) + .add(jLabel29) + .add(jLabel30)) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.UNRELATED) + .add(pnlMetaDataEditLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add(txtMetadataValue, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + 480, + Short.MAX_VALUE) + .add(org.jdesktop.layout.GroupLayout.TRAILING, + txtMetadataAttribute) + .add(txtMetadataUnit))) + .add(org.jdesktop.layout.GroupLayout.TRAILING, + pnlMetaDataEditLayout + .createSequentialGroup() + .add(0, 0, + Short.MAX_VALUE) + .add(btnMetadataClear) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.RELATED) + .add(btnMetadataCreate))) + .addContainerGap())); + pnlMetaDataEditLayout + .setVerticalGroup(pnlMetaDataEditLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add(pnlMetaDataEditLayout + .createSequentialGroup() + .addContainerGap(18, Short.MAX_VALUE) + .add(pnlMetaDataEditLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel28) + .add(txtMetadataAttribute, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .add(18, 18, 18) + .add(pnlMetaDataEditLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel29) + .add(txtMetadataValue, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .add(18, 18, 18) + .add(pnlMetaDataEditLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel30) + .add(txtMetadataUnit, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .add(23, 23, 23) + .add(pnlMetaDataEditLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.BASELINE) + .add(btnMetadataClear) + .add(btnMetadataCreate)) + .addContainerGap())); + + pnlMetadataTab.add(pnlMetaDataEdit, java.awt.BorderLayout.SOUTH); + + tabbedpanelMain.addTab(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, + "IRODSInfoDialog.pnlMetadataTab.TabConstraints.tabTitle"), + pnlMetadataTab); // NOI18N + + pnlPermissionsTab.setLayout(new java.awt.BorderLayout()); + + pnlPermissionsTable.setLayout(new java.awt.BorderLayout()); + + tablePermissions.setModel(new javax.swing.table.DefaultTableModel( + new Object[][] { { "", null }, { null, null }, { null, null }, + { null, null } }, new String[] { "User Name", + "Share Permission" }) { + Class[] types = new Class[] { java.lang.String.class, + java.lang.Object.class }; + boolean[] canEdit = new boolean[] { false, true }; + + @Override + public Class getColumnClass(final int columnIndex) { + return types[columnIndex]; + } + + @Override + public boolean isCellEditable(final int rowIndex, + final int columnIndex) { + return canEdit[columnIndex]; + } + }); + tablePermissions + .setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); + jScrollPane3.setViewportView(tablePermissions); + + pnlPermissionsTable.add(jScrollPane3, java.awt.BorderLayout.CENTER); + + jPanel7.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, + 2)); + jPanel7.setPreferredSize(new java.awt.Dimension(568, 44)); + jPanel7.setLayout(new java.awt.BorderLayout()); + + jPanel8.setPreferredSize(new java.awt.Dimension(100, 44)); + + btnPermissionsSave.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, + "IRODSInfoDialog.btnPermissionsSave.text")); // NOI18N + btnPermissionsSave.setActionCommand(org.openide.util.NbBundle + .getMessage(IRODSInfoDialog.class, + "IRODSInfoDialog.btnPermissionsSave.actionCommand")); // NOI18N + btnPermissionsSave.setEnabled(false); + btnPermissionsSave + .addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed( + final java.awt.event.ActionEvent evt) { + btnPermissionsSaveActionPerformed(evt); + } + }); + + org.jdesktop.layout.GroupLayout jPanel8Layout = new org.jdesktop.layout.GroupLayout( + jPanel8); + jPanel8.setLayout(jPanel8Layout); + jPanel8Layout.setHorizontalGroup(jPanel8Layout.createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING).add( + org.jdesktop.layout.GroupLayout.TRAILING, + jPanel8Layout.createSequentialGroup() + .addContainerGap(19, Short.MAX_VALUE) + .add(btnPermissionsSave).addContainerGap())); + jPanel8Layout.setVerticalGroup(jPanel8Layout.createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING).add( + org.jdesktop.layout.GroupLayout.TRAILING, + jPanel8Layout + .createSequentialGroup() + .addContainerGap( + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE).add(btnPermissionsSave) + .addContainerGap())); + + jPanel7.add(jPanel8, java.awt.BorderLayout.EAST); + + jPanel9.setPreferredSize(new java.awt.Dimension(100, 25)); + jPanel9.setLayout(new java.awt.BorderLayout()); + + jPanel16.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, + 1, 1)); + + btnAddSharePermissions.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, + "IRODSInfoDialog.btnAddSharePermissions.text")); // NOI18N + btnAddSharePermissions.setPreferredSize(new java.awt.Dimension(22, 24)); + btnAddSharePermissions + .addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed( + final java.awt.event.ActionEvent evt) { + btnAddSharePermissionsActionPerformed(evt); + } + }); + jPanel16.add(btnAddSharePermissions); + + btnDeleteSharePermissions.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, + "IRODSInfoDialog.btnDeleteSharePermissions.text")); // NOI18N + btnDeleteSharePermissions.setEnabled(false); + btnDeleteSharePermissions.setPreferredSize(new java.awt.Dimension(22, + 24)); + btnDeleteSharePermissions + .addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed( + final java.awt.event.ActionEvent evt) { + btnDeleteSharePermissionsActionPerformed(evt); + } + }); + jPanel16.add(btnDeleteSharePermissions); + + jPanel9.add(jPanel16, java.awt.BorderLayout.WEST); + + jPanel7.add(jPanel9, java.awt.BorderLayout.WEST); + + pnlPermissionsTable.add(jPanel7, java.awt.BorderLayout.SOUTH); + + pnlPermissionsTab + .add(pnlPermissionsTable, java.awt.BorderLayout.CENTER); + + tabbedpanelMain.addTab(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, + "IRODSInfoDialog.pnlPermissionsTab.TabConstraints.tabTitle"), + pnlPermissionsTab); // NOI18N + + jPanel1.add(tabbedpanelMain, java.awt.BorderLayout.CENTER); + + pnlCloseBtn.setPreferredSize(new java.awt.Dimension(589, 35)); + pnlCloseBtn.setLayout(new java.awt.BorderLayout()); + + jPanel3.setPreferredSize(new java.awt.Dimension(100, 40)); + jPanel3.setSize(new java.awt.Dimension(200, 100)); + + org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout( + jPanel3); + jPanel3.setLayout(jPanel3Layout); + jPanel3Layout.setHorizontalGroup(jPanel3Layout.createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING).add(0, 100, + Short.MAX_VALUE)); + jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING).add(0, 35, + Short.MAX_VALUE)); + + pnlCloseBtn.add(jPanel3, java.awt.BorderLayout.WEST); + + btnClose.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, "IRODSInfoDialog.btnClose.text")); // NOI18N + btnClose.addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed(final java.awt.event.ActionEvent evt) { + btnCloseActionPerformed(evt); + } + }); + + btnRefresh.setText(org.openide.util.NbBundle.getMessage( + IRODSInfoDialog.class, "IRODSInfoDialog.btnRefresh.text")); // NOI18N + btnRefresh.addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed(final java.awt.event.ActionEvent evt) { + btnRefreshActionPerformed(evt); + } + }); + + org.jdesktop.layout.GroupLayout jPanel4Layout = new org.jdesktop.layout.GroupLayout( + jPanel4); + jPanel4.setLayout(jPanel4Layout); + jPanel4Layout.setHorizontalGroup(jPanel4Layout.createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING).add( + org.jdesktop.layout.GroupLayout.TRAILING, + jPanel4Layout + .createSequentialGroup() + .addContainerGap(417, Short.MAX_VALUE) + .add(btnRefresh) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.RELATED) + .add(btnClose).addContainerGap())); + jPanel4Layout + .setVerticalGroup(jPanel4Layout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add(org.jdesktop.layout.GroupLayout.TRAILING, + jPanel4Layout + .createSequentialGroup() + .add(0, 6, Short.MAX_VALUE) + .add(jPanel4Layout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.BASELINE) + .add(btnClose).add(btnRefresh)))); + + pnlCloseBtn.add(jPanel4, java.awt.BorderLayout.EAST); + + jPanel1.add(pnlCloseBtn, java.awt.BorderLayout.PAGE_END); + + getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER); + + pack(); + }// </editor-fold>//GEN-END:initComponents + + private void btnMetadataCreateActionPerformed( + final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnMetadataCreateActionPerformed + AvuData avuData; + CollectionAO collectionAO; + DataObjectAO dataObjectAO; + try { + // create AVU data object from text fields + String attr = txtMetadataAttribute.getText(); + String value = txtMetadataValue.getText(); + String unit = txtMetadataUnit.getText(); + avuData = new AvuData(attr, value, unit); + if (isCollection()) { + collectionAO = irodsFileSystem.getIRODSAccessObjectFactory() + .getCollectionAO(irodsAccount); + collectionAO.addAVUMetadata(selectedObjectFullPath, avuData); + } else { + dataObjectAO = irodsFileSystem.getIRODSAccessObjectFactory() + .getDataObjectAO(irodsAccount); + dataObjectAO.addAVUMetadata(selectedObjectFullPath, avuData); + } + + // add to table + MetadataTableModel tm = (MetadataTableModel) tableMetadata + .getModel(); + tm.addRow(selectedObjectFullPath, attr, value, unit); + + // clear text fields + txtMetadataAttribute.setText(""); + txtMetadataValue.setText(""); + txtMetadataUnit.setText(""); + + JOptionPane.showMessageDialog(this, "Metadata Sucessfully Created", + "Create Metadata", JOptionPane.PLAIN_MESSAGE); + + } catch (CatNoAccessException cna) { + + log.error("no access to collection for tagging", cna); + JOptionPane.showMessageDialog(this, + "Insufficient privilages to update this data"); + } catch (JargonException ex) { + Exceptions.printStackTrace(ex); + JOptionPane.showMessageDialog(this, "Metadata Creation Failed", + "Create Metadata", JOptionPane.PLAIN_MESSAGE); + } + }// GEN-LAST:event_btnMetadataCreateActionPerformed + + private void btnUpdateTagsCommentsActionPerformed( + final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnUpdateTagsCommentsActionPerformed + + TaggingServiceFactory taggingServiceFactory = null; + ; + IRODSTagValue irodsTagValue = null; + + try { + taggingServiceFactory = new TaggingServiceFactoryImpl( + irodsFileSystem.getIRODSAccessObjectFactory()); + FreeTaggingService freeTaggingService = taggingServiceFactory + .instanceFreeTaggingService(irodsAccount); + IRODSTaggingService irodsTaggingService = taggingServiceFactory + .instanceIrodsTaggingService(irodsAccount); + + // first update the tags + String newTagStr = txtInfoTags.getText(); + if (newTagStr != null) { // && !newTagStr.isEmpty()) { + + // now need to diff against existing tags to see what to add and + // what to delete + String existingTags = null; + if (isCollection()) { + existingTags = freeTaggingService + .getTagsForCollectionInFreeTagForm( + selectedObjectFullPath) + .getSpaceDelimitedTagsForDomain(); + } else { + existingTags = freeTaggingService + .getTagsForDataObjectInFreeTagForm( + selectedObjectFullPath) + .getSpaceDelimitedTagsForDomain(); + } + + List<String> existingTagList = Arrays.asList(existingTags + .split(" ")); + List<String> newTagsList = Arrays.asList(newTagStr.split(" +")); + + // find tags to delete and remove them + Set<String> tagsToDeleteSet = new HashSet<String>( + existingTagList); + tagsToDeleteSet.removeAll(newTagsList); + String[] tagsToDelete = tagsToDeleteSet.toArray(new String[0]); + for (String tag : tagsToDelete) { + if (tag.length() > 0) { + irodsTagValue = new IRODSTagValue(tag, + irodsAccount.getUserName()); + if (isCollection()) { + irodsTaggingService.deleteTagFromCollection( + selectedObjectFullPath, irodsTagValue); + } else { + irodsTaggingService.deleteTagFromDataObject( + selectedObjectFullPath, irodsTagValue); + } + } + } + + // find tags to add + Set<String> tagsToAddSet = new HashSet<String>(newTagsList); + tagsToAddSet.removeAll(existingTagList); + String[] tagsToAdd = tagsToAddSet.toArray(new String[0]); + + for (String tag : tagsToAdd) { + if (tag.length() > 0) { + irodsTagValue = new IRODSTagValue(tag, + irodsAccount.getUserName()); + if (isCollection()) { + irodsTaggingService.addTagToCollection( + selectedObjectFullPath, irodsTagValue); + } else { + irodsTaggingService.addTagToDataObject( + selectedObjectFullPath, irodsTagValue); + } + } + } + } + + // now update comments + String commentStr = textareaInfoComments.getText(); + if (commentStr != null && !commentStr.isEmpty()) { + + // update comments + irodsTagValue = new IRODSTagValue(commentStr, + irodsAccount.getUserName()); + if (isCollection()) { + irodsTaggingService.checkAndUpdateDescriptionOnCollection( + selectedObjectFullPath, irodsTagValue); + } else { + irodsTaggingService.checkAndUpdateDescriptionOnDataObject( + selectedObjectFullPath, irodsTagValue); + } + } else { + // remove all comments + if (isCollection()) { + irodsTagValue = irodsTaggingService + .getDescriptionOnCollectionForLoggedInUser(selectedObjectFullPath); + if (irodsTagValue != null) { + irodsTaggingService.deleteDescriptionFromCollection( + selectedObjectFullPath, irodsTagValue); + } + } else { + irodsTagValue = irodsTaggingService + .getDescriptionOnDataObjectForLoggedInUser(selectedObjectFullPath); + if (irodsTagValue != null) { + irodsTaggingService.deleteDescriptionFromDataObject( + selectedObjectFullPath, irodsTagValue); + } + } + } + + JOptionPane.showMessageDialog(this, + "Tags and Comments Sucessfully Updated", + "Update Tags and Comments", JOptionPane.PLAIN_MESSAGE); + + } catch (CatNoAccessException cna) { + log.error("no access to collection for tagging", cna); + JOptionPane.showMessageDialog(this, + "Insufficient privilages to update this data"); + + } catch (JargonException ex) { + Exceptions.printStackTrace(ex); + JOptionPane.showMessageDialog(this, + "Update of Tags and Comments Failed"); + } + }// GEN-LAST:event_btnUpdateTagsCommentsActionPerformed + + private void btnCloseActionPerformed(final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnCloseActionPerformed + dispose(); + }// GEN-LAST:event_btnCloseActionPerformed + + private void btnMetadataClearActionPerformed( + final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnMetadataClearActionPerformed + // clear table selection + // tableMetadata.clearSelection(); + // clear all text fields + // txtMetadataAttribute.setText(""); + // txtMetadataValue.setText(""); + // txtMetadataUnit.setText(""); + }// GEN-LAST:event_btnMetadataClearActionPerformed + + private void btnMetadataDeleteActionPerformed( + final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnMetadataDeleteActionPerformed + AvuData avuData; + CollectionAO collectionAO; + DataObjectAO dataObjectAO; + + try { + String attr = null; + String value = null; + String unit = null; + + // get selected rows to delete in metadata table + int[] selectedRows = tableMetadata.getSelectedRows(); + for (int selectedRow : selectedRows) { + // create AVU data object to delete + attr = (String) tableMetadata.getValueAt(selectedRow, 0); + value = (String) tableMetadata.getValueAt(selectedRow, 1); + unit = (String) tableMetadata.getValueAt(selectedRow, 2); + avuData = new AvuData(attr, value, unit); + if (isCollection()) { + collectionAO = irodsFileSystem + .getIRODSAccessObjectFactory().getCollectionAO( + irodsAccount); + collectionAO.deleteAVUMetadata(selectedObjectFullPath, + avuData); + } else { + dataObjectAO = irodsFileSystem + .getIRODSAccessObjectFactory().getDataObjectAO( + irodsAccount); + dataObjectAO.deleteAVUMetadata(selectedObjectFullPath, + avuData); + } + // remove from table + MetadataTableModel tm = (MetadataTableModel) tableMetadata + .getModel(); + tm.deleteRow(selectedObjectFullPath, attr, value, unit, + selectedRow); + } + + JOptionPane.showMessageDialog(this, "Metadata Sucessfully Deleted", + "Delete Metadata", JOptionPane.PLAIN_MESSAGE); + } catch (CatNoAccessException cna) { + + log.error("no access to collection for tagging", cna); + JOptionPane.showMessageDialog(this, + "Insufficient privilages to update this data"); + } catch (JargonException ex) { + Exceptions.printStackTrace(ex); + JOptionPane.showMessageDialog(this, "Metadata Delete Failed", + "Delete Metadata", JOptionPane.PLAIN_MESSAGE); + } + }// GEN-LAST:event_btnMetadataDeleteActionPerformed + + private void btnRefreshActionPerformed(final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnRefreshActionPerformed + + if (tabbedpanelMain.getSelectedComponent() == pnlInfoTab) { + initializeFileInfo(); + } else if (tabbedpanelMain.getSelectedComponent() == pnlMetadataTab) { + initMetadataInfo(); + } else { // permissions tab + initPermissionInfo(); + } + }// GEN-LAST:event_btnRefreshActionPerformed + + private void btnPermissionsSaveActionPerformed( + final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnPermissionsSaveActionPerformed + + PermissionsTableModel tm = (PermissionsTableModel) tablePermissions + .getModel(); + + try { + // first get any permissions that were removed + UserFilePermission[] permissionsToDelete = tm + .getPermissionsToDelete(); + + for (UserFilePermission permission : permissionsToDelete) { + + if (isCollection()) { + CollectionAO collectionAO = irodsFileSystem + .getIRODSAccessObjectFactory().getCollectionAO( + irodsAccount); + collectionAO.removeAccessPermissionForUser( + permission.getUserZone(), selectedObjectFullPath, + permission.getUserName(), true); + } else { + DataObjectAO dataObjectAO = irodsFileSystem + .getIRODSAccessObjectFactory().getDataObjectAO( + irodsAccount); + dataObjectAO.removeAccessPermissionsForUser( + permission.getUserZone(), selectedObjectFullPath, + permission.getUserName()); + } + } + + // now add any permissions that were added + UserFilePermission[] permissionsToAdd = tm.getPermissionsToAdd(); + + for (UserFilePermission permission : permissionsToAdd) { + CollectionAO collectionAO = irodsFileSystem + .getIRODSAccessObjectFactory().getCollectionAO( + irodsAccount); + DataObjectAO dataObjectAO = irodsFileSystem + .getIRODSAccessObjectFactory().getDataObjectAO( + irodsAccount); + + if (permission.getFilePermissionEnum() == FilePermissionEnum.READ) { + if (isCollection()) { + collectionAO.setAccessPermissionRead( + permission.getUserZone(), + selectedObjectFullPath, + permission.getUserName(), true); + } else { + dataObjectAO.setAccessPermissionRead( + permission.getUserZone(), + selectedObjectFullPath, + permission.getUserName()); + } + } else if (permission.getFilePermissionEnum() == FilePermissionEnum.WRITE) { + if (isCollection()) { + collectionAO.setAccessPermissionWrite( + permission.getUserZone(), + selectedObjectFullPath, + permission.getUserName(), true); + } else { + dataObjectAO.setAccessPermissionWrite( + permission.getUserZone(), + selectedObjectFullPath, + permission.getUserName()); + } + } else if (permission.getFilePermissionEnum() == FilePermissionEnum.OWN) { + if (isCollection()) { + collectionAO.setAccessPermissionOwn( + permission.getUserZone(), + selectedObjectFullPath, + permission.getUserName(), true); + } else { + dataObjectAO.setAccessPermissionOwn( + permission.getUserZone(), + selectedObjectFullPath, + permission.getUserName()); + } + } + } + + if ((permissionsToAdd.length > 0) + || (permissionsToDelete.length > 0)) { + JOptionPane.showMessageDialog(this, + "Permissions Updated Sucessfully", + "Update Permissions", JOptionPane.PLAIN_MESSAGE); + } + + tm.resetOriginalPermissionList(); + + } catch (JargonException ex) { + Exceptions.printStackTrace(ex); + JOptionPane.showMessageDialog(this, "Permission Update Failed", + "Update Permissions", JOptionPane.PLAIN_MESSAGE); + } + + btnPermissionsSave.setEnabled(false); + }// GEN-LAST:event_btnPermissionsSaveActionPerformed + + private void btnAddSharePermissionsActionPerformed( + final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnAddSharePermissionsActionPerformed + AddPermissionsDialog addPermissionsDialog = new AddPermissionsDialog( + this, true, irodsFileSystem, irodsAccount); + + addPermissionsDialog.setLocation((int) this.getLocation().getX(), + (int) this.getLocation().getY()); + addPermissionsDialog.setVisible(true); + + UserFilePermission userFilePermission = addPermissionsDialog + .getPermissionToAdd(); + + // first remove this user's entry from table if there is one + if (userFilePermission != null) { + try { + UserAO userAO = irodsFileSystem.getIRODSAccessObjectFactory() + .getUserAO(irodsAccount); + String tableUserName = userFilePermission.getUserName() + "#" + + userFilePermission.getUserZone(); + + PermissionsTableModel tm = (PermissionsTableModel) tablePermissions + .getModel(); + tm.deleteRow(userAO.findByName(tableUserName)); + + // now add to table + tm.addRow(userAO.findByName(tableUserName), + userFilePermission.getFilePermissionEnum()); + } catch (JargonException ex) { + Exceptions.printStackTrace(ex); + } + btnPermissionsSave.setEnabled(true); + } + }// GEN-LAST:event_btnAddSharePermissionsActionPerformed + + private void btnDeleteSharePermissionsActionPerformed( + final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnDeleteSharePermissionsActionPerformed + + int[] selectedRows = tablePermissions.getSelectedRows(); + int numRowsSelected = selectedRows.length; + + // have to remove rows in reverse + for (int i = numRowsSelected - 1; i >= 0; i--) { + int selectedRow = selectedRows[i]; + if (selectedRow >= 0) { + PermissionsTableModel model = (PermissionsTableModel) tablePermissions + .getModel(); + model.deleteRow(selectedRow); + btnPermissionsSave.setEnabled(true); + } + } + }// GEN-LAST:event_btnDeleteSharePermissionsActionPerformed + // Variables declaration - do not modify//GEN-BEGIN:variables + + private javax.swing.JButton btnAddSharePermissions; + private javax.swing.JButton btnClose; + private javax.swing.JButton btnDeleteSharePermissions; + private javax.swing.JButton btnMetadataClear; + private javax.swing.JButton btnMetadataCreate; + private javax.swing.JButton btnMetadataDelete; + private javax.swing.JButton btnPermissionsSave; + private javax.swing.JButton btnRefresh; + private javax.swing.JButton btnUpdateTagsComments; + private javax.swing.JLabel jLabel10; + private javax.swing.JLabel jLabel11; + private javax.swing.JLabel jLabel12; + private javax.swing.JLabel jLabel13; + private javax.swing.JLabel jLabel14; + private javax.swing.JLabel jLabel15; + private javax.swing.JLabel jLabel16; + private javax.swing.JLabel jLabel17; + private javax.swing.JLabel jLabel18; + private javax.swing.JLabel jLabel19; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel20; + private javax.swing.JLabel jLabel21; + private javax.swing.JLabel jLabel22; + private javax.swing.JLabel jLabel23; + private javax.swing.JLabel jLabel24; + private javax.swing.JLabel jLabel25; + private javax.swing.JLabel jLabel26; + private javax.swing.JLabel jLabel27; + private javax.swing.JLabel jLabel28; + private javax.swing.JLabel jLabel29; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel30; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JLabel jLabel7; + private javax.swing.JLabel jLabel8; + private javax.swing.JLabel jLabel9; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel16; + private javax.swing.JPanel jPanel2; + private javax.swing.JPanel jPanel3; + private javax.swing.JPanel jPanel4; + private javax.swing.JPanel jPanel5; + private javax.swing.JPanel jPanel6; + private javax.swing.JPanel jPanel7; + private javax.swing.JPanel jPanel8; + private javax.swing.JPanel jPanel9; + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JScrollPane jScrollPane2; + private javax.swing.JScrollPane jScrollPane3; + private javax.swing.JLabel lblInfoCollectionCreatedDate; + private javax.swing.JLabel lblInfoCollectionDescription; + private javax.swing.JLabel lblInfoCollectionInfo1; + private javax.swing.JLabel lblInfoCollectionInfo2; + private javax.swing.JLabel lblInfoCollectionModifiedDate; + private javax.swing.JLabel lblInfoCollectionObjectPath; + private javax.swing.JLabel lblInfoCollectionOwner; + private javax.swing.JLabel lblInfoCollectionOwnerZone; + private javax.swing.JLabel lblInfoCollectionType; + private javax.swing.JLabel lblInfoObjectChecksum; + private javax.swing.JLabel lblInfoObjectCreatedDate; + private javax.swing.JLabel lblInfoObjectDataPath; + private javax.swing.JLabel lblInfoObjectModifiedDate; + private javax.swing.JLabel lblInfoObjectName; + private javax.swing.JLabel lblInfoObjectOwner; + private javax.swing.JLabel lblInfoObjectOwnerZone; + private javax.swing.JLabel lblInfoObjectParent; + private javax.swing.JLabel lblInfoObjectReplicaNumber; + private javax.swing.JLabel lblInfoObjectReplicationStatus; + private javax.swing.JLabel lblInfoObjectResource; + private javax.swing.JLabel lblInfoObjectResourceGroup; + private javax.swing.JLabel lblInfoObjectSize; + private javax.swing.JLabel lblInfoObjectStatus; + private javax.swing.JLabel lblInfoObjectType; + private javax.swing.JLabel lblInfoObjectVersion; + private javax.swing.JLabel lblObjectCollection; + private javax.swing.JPanel pnlCloseBtn; + private javax.swing.JPanel pnlCollectionInfo; + private javax.swing.JPanel pnlInfoCards; + private javax.swing.JPanel pnlInfoTab; + private javax.swing.JPanel pnlMetaDataEdit; + private javax.swing.JPanel pnlMetadataTab; + private javax.swing.JPanel pnlMetadataTable; + private javax.swing.JPanel pnlObjectInfo; + private javax.swing.JPanel pnlPermissionsTab; + private javax.swing.JPanel pnlPermissionsTable; + private javax.swing.JPanel pnlSelectedObject; + private javax.swing.JPanel pnlTagsComments; + private javax.swing.JTabbedPane tabbedpanelMain; + private javax.swing.JTable tableMetadata; + private javax.swing.JTable tablePermissions; + private javax.swing.JTextArea textareaInfoComments; + private javax.swing.JTextField txtInfoTags; + private javax.swing.JTextField txtMetadataAttribute; + private javax.swing.JTextField txtMetadataUnit; + private javax.swing.JTextField txtMetadataValue; + // End of variables declaration//GEN-END:variables } diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IRODSTreeContainingComponent.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IRODSTreeContainingComponent.java index a65c6b1..c3a5cd2 100644 --- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IRODSTreeContainingComponent.java +++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IRODSTreeContainingComponent.java @@ -3,20 +3,23 @@ package org.irods.jargon.idrop.desktop.systraygui; import java.awt.Cursor; /** - * + * * @author mikeconway */ public interface IRODSTreeContainingComponent { - - /** - * Indicates a refresh action, this causes connections to be held open across node refreshes - * @return - */ - boolean isRefreshingTree(); - - /** - * allows proper setting of cursor for tree node operations - * @param cursor - */ - void setCursor(Cursor cursor); + + /** + * Indicates a refresh action, this causes connections to be held open + * across node refreshes + * + * @return + */ + boolean isRefreshingTree(); + + /** + * allows proper setting of cursor for tree node operations + * + * @param cursor + */ + void setCursor(Cursor cursor); } diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/LoginDialog.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/LoginDialog.java index e1598fb..fbdc6d2 100644 --- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/LoginDialog.java +++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/LoginDialog.java @@ -15,7 +15,6 @@ import org.irods.jargon.core.connection.IRODSAccount; import org.irods.jargon.core.connection.auth.AuthResponse; import org.irods.jargon.core.exception.JargonException; import org.irods.jargon.core.pub.IRODSFileSystem; -import org.irods.jargon.core.pub.UserAO; import org.irods.jargon.idrop.desktop.systraygui.services.IdropConfigurationService; import org.irods.jargon.idrop.desktop.systraygui.utils.IdropPropertiesHelper; import org.irods.jargon.idrop.exceptions.IdropException; @@ -23,536 +22,577 @@ import org.irods.jargon.idrop.exceptions.IdropRuntimeException; import org.slf4j.LoggerFactory; /** - * + * * @author mikeconway */ public class LoginDialog extends JDialog { - private static final long serialVersionUID = 1L; - private IDROPCore idropCore = null; - public static org.slf4j.Logger log = LoggerFactory.getLogger(LoginDialog.class); - - public LoginDialog(final JDialog parentDialog, final IDROPCore idropCore) { - super(parentDialog, true); - if (idropCore == null) { - throw new IllegalArgumentException("null idropCore"); - } - this.idropCore = idropCore; - initComponents(); - - if (idropCore.getIdropConfig().isLoginPreset()) { - loginUsingPreset(); - } else { - loginNormally(); - } - - registerKeystrokeListener(); - this.setLocationRelativeTo(parentDialog); - - } - - private void loginNormally() { - // predispose based on preferences - String host = idropCore.getIdropConfig().getPropertyForKey(IdropConfigurationService.ACCOUNT_CACHE_HOST); - if (host != null) { - txtHost.setText(host); - } - String port = idropCore.getIdropConfig().getPropertyForKey(IdropConfigurationService.ACCOUNT_CACHE_PORT); - if (port == null || port.isEmpty()) { - port = "1247"; - } - - String mode = idropCore.getIdropConfig().getPropertyForKey(IdropConfigurationService.ACCOUNT_CACHE_LOGIN_MODE); - if (mode == null || mode.isEmpty()) { - mode = IRODSAccount.AuthScheme.STANDARD.name(); - } else { - comboLoginMode.setSelectedItem(mode); - } - - txtPort.setText(port); - String zone = idropCore.getIdropConfig().getPropertyForKey(IdropConfigurationService.ACCOUNT_CACHE_ZONE); - txtZone.setText(zone); - String resource = idropCore.getIdropConfig().getPropertyForKey(IdropConfigurationService.ACCOUNT_CACHE_RESOURCE); - txtResource.setText(resource); - String username = idropCore.getIdropConfig().getPropertyForKey(IdropConfigurationService.ACCOUNT_CACHE_USER_NAME); - txtUserName.setText(username); - hideAdvancedViewFields(); - } - - private void loginUsingPreset() { - log.debug("login will use presets"); - lblHost.setVisible(false); - txtHost.setVisible(false); - lblPort.setVisible(false); - txtPort.setVisible(false); - lblZone.setVisible(false); - txtZone.setVisible(false); - lblResource.setVisible(false); - txtResource.setVisible(false); - chkAdvancedLogin.setVisible(false); - lblLoginMode.setVisible(false); - comboLoginMode.setVisible(false); - } - - /** - * Action to take when login is initiated - * - * @return - * @throws NumberFormatException - */ - private boolean processLogin() throws NumberFormatException { - // validate various inputs based on whether a full login, or a uid only - // login is indicated - if (!idropCore.getIdropConfig().isLoginPreset()) { - txtHost.setBackground(Color.white); - txtPort.setBackground(Color.white); - txtZone.setBackground(Color.white); - txtResource.setBackground(Color.white); - if (txtHost.getText().length() == 0) { - txtHost.setBackground(Color.red); - } - if (txtPort.getText().length() == 0) { - txtPort.setBackground(Color.red); - } else { - try { - Integer.parseInt(txtPort.getText()); - } catch (Exception e) { - txtPort.setBackground(Color.red); - } - } - if (txtZone.getText().length() == 0) { - txtZone.setBackground(Color.red); - } - if (txtResource.getText().length() == 0) { - txtResource.setBackground(Color.red); - } - } - - txtUserName.setBackground(Color.white); - password.setBackground(Color.white); - if (txtUserName.getText().length() == 0) { - txtUserName.setBackground(Color.red); - } - if (password.getPassword().length == 0) { - password.setBackground(Color.red); - } - StringBuilder sb = new StringBuilder(); - final IRODSAccount irodsAccount; - - try { - - // validated, now try to log in - if (idropCore.getIdropConfig().isLoginPreset()) { - log.debug("creating account with presets"); - String presetHost = idropCore.getIdropConfig().getPropertyForKey(IdropPropertiesHelper.LOGIN_PRESET_HOST); - log.info("presetHost:{}", presetHost); - int presetPort = Integer.parseInt(idropCore.getIdropConfig().getPropertyForKey(IdropPropertiesHelper.LOGIN_PRESET_PORT)); - log.info("presetPort:{}", presetPort); - String presetZone = idropCore.getIdropConfig().getPropertyForKey(IdropPropertiesHelper.LOGIN_PRESET_ZONE); - log.info("presetZone:{}", presetZone); - String presetResource = idropCore.getIdropConfig().getPropertyForKey( - IdropPropertiesHelper.LOGIN_PRESET_RESOURCE); - log.info("presetResource:{}", presetResource); - sb.append('/'); - sb.append(presetZone); - sb.append("/home/"); - sb.append(txtUserName.getText()); - - if (chkGuestLogin.isSelected()) { - irodsAccount = IRODSAccount.instanceForAnonymous(presetHost, - presetPort, "", - presetZone, presetResource); - } else { - irodsAccount = IRODSAccount.instance(presetHost, presetPort, - txtUserName.getText(), - new String(password.getPassword()), sb.toString(), - presetZone, presetResource); - } - } else { - sb.append('/'); - sb.append(txtZone.getText()); - sb.append("/home/"); - sb.append(txtUserName.getText()); - - if (chkGuestLogin.isSelected()) { - irodsAccount = IRODSAccount.instanceForAnonymous(txtHost.getText().trim(), - Integer.parseInt(txtPort.getText().trim()), - "", txtZone.getText().trim(), txtResource.getText().trim()); - } else { - irodsAccount = IRODSAccount.instance(txtHost.getText().trim(), - Integer.parseInt(txtPort.getText().trim()), - txtUserName.getText().trim(), - new String(password.getPassword()).trim(), sb.toString().trim(), - txtZone.getText().trim(), txtResource.getText().trim()); - } - } - } catch (JargonException ex) { - Logger.getLogger(LoginDialog.class.getName()).log(Level.SEVERE, - null, ex); - MessageManager.showError(this, ex.getMessage(), MessageManager.TITLE_MESSAGE); - return true; - } - - if (comboLoginMode.getSelectedItem().toString().equals(IRODSAccount.AuthScheme.PAM.name())) { - irodsAccount.setAuthenticationScheme(IRODSAccount.AuthScheme.PAM); - } - - - IRODSFileSystem irodsFileSystem = null; - - /* - * getting userAO will attempt the login - */ - - try { - irodsFileSystem = idropCore.getIrodsFileSystem(); - AuthResponse authResponse = irodsFileSystem.getIRODSAccessObjectFactory().authenticateIRODSAccount(irodsAccount); - idropCore.setIrodsAccount(authResponse.getAuthenticatedIRODSAccount()); - try { - idropCore.getIdropConfigurationService().saveLogin(irodsAccount); - } catch (IdropException ex) { - throw new IdropRuntimeException("error saving irodsAccount", ex); - } - this.dispose(); - } catch (JargonException ex) { - if (ex.getMessage().indexOf("Connection refused") > -1) { - Logger.getLogger(LoginDialog.class.getName()).log(Level.SEVERE, - null, ex); - MessageManager.showError(this, "Cannot connect to the server, is it down?", "Login Error"); - - return true; - } else if (ex.getMessage().indexOf("Connection reset") > -1) { - Logger.getLogger(LoginDialog.class.getName()).log(Level.SEVERE, - null, ex); - MessageManager.showError(this, "Cannot connect to the server, is it down?", "Login Error"); - - return true; - } else if (ex.getMessage().indexOf("io exception opening socket") > -1) { - Logger.getLogger(LoginDialog.class.getName()).log(Level.SEVERE, - null, ex); - MessageManager.showError(this, "Cannot connect to the server, is it down?", "Login Error"); - - return true; - } else { - Logger.getLogger(LoginDialog.class.getName()).log(Level.SEVERE, - null, ex); - MessageManager.showError(this, "login error - unable to log in, or invalid user id", "Login Error"); - - return true; - } - } finally { - if (irodsFileSystem != null) { - irodsFileSystem.closeAndEatExceptions(); - } - } - return false; - } - - /** - * Register a listener for the enter event, so login can occur. - */ - private void registerKeystrokeListener() { - - KeyStroke enter = KeyStroke.getKeyStroke( - java.awt.event.KeyEvent.VK_ENTER, 0); - Action enterAction = new AbstractAction() { - /** + private static final long serialVersionUID = 1L; + private IDROPCore idropCore = null; + public static org.slf4j.Logger log = LoggerFactory + .getLogger(LoginDialog.class); + + public LoginDialog(final JDialog parentDialog, final IDROPCore idropCore) { + super(parentDialog, true); + if (idropCore == null) { + throw new IllegalArgumentException("null idropCore"); + } + this.idropCore = idropCore; + initComponents(); + + if (idropCore.getIdropConfig().isLoginPreset()) { + loginUsingPreset(); + } else { + loginNormally(); + } + + registerKeystrokeListener(); + setLocationRelativeTo(parentDialog); + + } + + private void loginNormally() { + // predispose based on preferences + String host = idropCore.getIdropConfig().getPropertyForKey( + IdropConfigurationService.ACCOUNT_CACHE_HOST); + if (host != null) { + txtHost.setText(host); + } + String port = idropCore.getIdropConfig().getPropertyForKey( + IdropConfigurationService.ACCOUNT_CACHE_PORT); + if (port == null || port.isEmpty()) { + port = "1247"; + } + + String mode = idropCore.getIdropConfig().getPropertyForKey( + IdropConfigurationService.ACCOUNT_CACHE_LOGIN_MODE); + if (mode == null || mode.isEmpty()) { + mode = IRODSAccount.AuthScheme.STANDARD.name(); + } else { + comboLoginMode.setSelectedItem(mode); + } + + txtPort.setText(port); + String zone = idropCore.getIdropConfig().getPropertyForKey( + IdropConfigurationService.ACCOUNT_CACHE_ZONE); + txtZone.setText(zone); + String resource = idropCore.getIdropConfig().getPropertyForKey( + IdropConfigurationService.ACCOUNT_CACHE_RESOURCE); + txtResource.setText(resource); + String username = idropCore.getIdropConfig().getPropertyForKey( + IdropConfigurationService.ACCOUNT_CACHE_USER_NAME); + txtUserName.setText(username); + hideAdvancedViewFields(); + } + + private void loginUsingPreset() { + log.debug("login will use presets"); + lblHost.setVisible(false); + txtHost.setVisible(false); + lblPort.setVisible(false); + txtPort.setVisible(false); + lblZone.setVisible(false); + txtZone.setVisible(false); + lblResource.setVisible(false); + txtResource.setVisible(false); + chkAdvancedLogin.setVisible(false); + lblLoginMode.setVisible(false); + comboLoginMode.setVisible(false); + } + + /** + * Action to take when login is initiated + * + * @return + * @throws NumberFormatException + */ + private boolean processLogin() throws NumberFormatException { + // validate various inputs based on whether a full login, or a uid only + // login is indicated + if (!idropCore.getIdropConfig().isLoginPreset()) { + txtHost.setBackground(Color.white); + txtPort.setBackground(Color.white); + txtZone.setBackground(Color.white); + txtResource.setBackground(Color.white); + if (txtHost.getText().length() == 0) { + txtHost.setBackground(Color.red); + } + if (txtPort.getText().length() == 0) { + txtPort.setBackground(Color.red); + } else { + try { + Integer.parseInt(txtPort.getText()); + } catch (Exception e) { + txtPort.setBackground(Color.red); + } + } + if (txtZone.getText().length() == 0) { + txtZone.setBackground(Color.red); + } + if (txtResource.getText().length() == 0) { + txtResource.setBackground(Color.red); + } + } + + txtUserName.setBackground(Color.white); + password.setBackground(Color.white); + if (txtUserName.getText().length() == 0) { + txtUserName.setBackground(Color.red); + } + if (password.getPassword().length == 0) { + password.setBackground(Color.red); + } + StringBuilder sb = new StringBuilder(); + final IRODSAccount irodsAccount; + + try { + + // validated, now try to log in + if (idropCore.getIdropConfig().isLoginPreset()) { + log.debug("creating account with presets"); + String presetHost = idropCore.getIdropConfig() + .getPropertyForKey( + IdropPropertiesHelper.LOGIN_PRESET_HOST); + log.info("presetHost:{}", presetHost); + int presetPort = Integer.parseInt(idropCore.getIdropConfig() + .getPropertyForKey( + IdropPropertiesHelper.LOGIN_PRESET_PORT)); + log.info("presetPort:{}", presetPort); + String presetZone = idropCore.getIdropConfig() + .getPropertyForKey( + IdropPropertiesHelper.LOGIN_PRESET_ZONE); + log.info("presetZone:{}", presetZone); + String presetResource = idropCore.getIdropConfig() + .getPropertyForKey( + IdropPropertiesHelper.LOGIN_PRESET_RESOURCE); + log.info("presetResource:{}", presetResource); + sb.append('/'); + sb.append(presetZone); + sb.append("/home/"); + sb.append(txtUserName.getText()); + + if (chkGuestLogin.isSelected()) { + irodsAccount = IRODSAccount.instanceForAnonymous( + presetHost, presetPort, "", presetZone, + presetResource); + } else { + irodsAccount = IRODSAccount.instance(presetHost, + presetPort, txtUserName.getText(), new String( + password.getPassword()), sb.toString(), + presetZone, presetResource); + } + } else { + sb.append('/'); + sb.append(txtZone.getText()); + sb.append("/home/"); + sb.append(txtUserName.getText()); + + if (chkGuestLogin.isSelected()) { + irodsAccount = IRODSAccount.instanceForAnonymous(txtHost + .getText().trim(), Integer.parseInt(txtPort + .getText().trim()), "", txtZone.getText().trim(), + txtResource.getText().trim()); + } else { + irodsAccount = IRODSAccount.instance(txtHost.getText() + .trim(), + Integer.parseInt(txtPort.getText().trim()), + txtUserName.getText().trim(), + new String(password.getPassword()).trim(), sb + .toString().trim(), txtZone.getText() + .trim(), txtResource.getText().trim()); + } + } + } catch (JargonException ex) { + Logger.getLogger(LoginDialog.class.getName()).log(Level.SEVERE, + null, ex); + MessageManager.showError(this, ex.getMessage(), + MessageManager.TITLE_MESSAGE); + return true; + } + + if (comboLoginMode.getSelectedItem().toString() + .equals(IRODSAccount.AuthScheme.PAM.name())) { + irodsAccount.setAuthenticationScheme(IRODSAccount.AuthScheme.PAM); + } + + IRODSFileSystem irodsFileSystem = null; + + /* + * getting userAO will attempt the login + */ + + try { + irodsFileSystem = idropCore.getIrodsFileSystem(); + AuthResponse authResponse = irodsFileSystem + .getIRODSAccessObjectFactory().authenticateIRODSAccount( + irodsAccount); + idropCore.setIrodsAccount(authResponse + .getAuthenticatedIRODSAccount()); + try { + idropCore.getIdropConfigurationService() + .saveLogin(irodsAccount); + } catch (IdropException ex) { + throw new IdropRuntimeException("error saving irodsAccount", ex); + } + dispose(); + } catch (JargonException ex) { + if (ex.getMessage().indexOf("Connection refused") > -1) { + Logger.getLogger(LoginDialog.class.getName()).log(Level.SEVERE, + null, ex); + MessageManager.showError(this, + "Cannot connect to the server, is it down?", + "Login Error"); + + return true; + } else if (ex.getMessage().indexOf("Connection reset") > -1) { + Logger.getLogger(LoginDialog.class.getName()).log(Level.SEVERE, + null, ex); + MessageManager.showError(this, + "Cannot connect to the server, is it down?", + "Login Error"); + + return true; + } else if (ex.getMessage().indexOf("io exception opening socket") > -1) { + Logger.getLogger(LoginDialog.class.getName()).log(Level.SEVERE, + null, ex); + MessageManager.showError(this, + "Cannot connect to the server, is it down?", + "Login Error"); + + return true; + } else { + Logger.getLogger(LoginDialog.class.getName()).log(Level.SEVERE, + null, ex); + MessageManager.showError(this, + "login error - unable to log in, or invalid user id", + "Login Error"); + + return true; + } + } finally { + if (irodsFileSystem != null) { + irodsFileSystem.closeAndEatExceptions(); + } + } + return false; + } + + /** + * Register a listener for the enter event, so login can occur. + */ + private void registerKeystrokeListener() { + + KeyStroke enter = KeyStroke.getKeyStroke( + java.awt.event.KeyEvent.VK_ENTER, 0); + Action enterAction = new AbstractAction() { + /** * */ private static final long serialVersionUID = 3468144821565093455L; @Override - public void actionPerformed(final ActionEvent e) { - processLogin(); - } - }; - btnOK.registerKeyboardAction(enterAction, enter, - JComponent.WHEN_IN_FOCUSED_WINDOW); - - } - - /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. - */ - - // <editor-fold defaultstate="collapsed" - // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents - private void initComponents() { - java.awt.GridBagConstraints gridBagConstraints; - - pnlLoginInfo = new javax.swing.JPanel(); - lblHost = new javax.swing.JLabel(); - txtHost = new javax.swing.JTextField(); - lblPort = new javax.swing.JLabel(); - txtPort = new javax.swing.JTextField(); - lblZone = new javax.swing.JLabel(); - txtZone = new javax.swing.JTextField(); - lblResource = new javax.swing.JLabel(); - txtResource = new javax.swing.JTextField(); - lblUserName = new javax.swing.JLabel(); - txtUserName = new javax.swing.JTextField(); - lblPassword = new javax.swing.JLabel(); - password = new javax.swing.JPasswordField(); - jPanel1 = new javax.swing.JPanel(); - chkAdvancedLogin = new javax.swing.JCheckBox(); - chkGuestLogin = new javax.swing.JCheckBox(); - lblLoginMode = new javax.swing.JLabel(); - comboLoginMode = new javax.swing.JComboBox(); - pnlToolbar = new javax.swing.JPanel(); - btnOK = new javax.swing.JButton(); - btnCancel = new javax.swing.JButton(); - lblLogin = new javax.swing.JLabel(); - - setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - - pnlLoginInfo.setLayout(new java.awt.GridBagLayout()); - - lblHost.setText("Host:"); - lblHost.setMaximumSize(new java.awt.Dimension(40, 14)); - lblHost.setMinimumSize(new java.awt.Dimension(30, 14)); - lblHost.setPreferredSize(null); - lblHost.setRequestFocusEnabled(false); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - pnlLoginInfo.add(lblHost, gridBagConstraints); - - txtHost.setColumns(30); - txtHost.setPreferredSize(null); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 1; - gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - pnlLoginInfo.add(txtHost, gridBagConstraints); - - lblPort.setText("Port:"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - pnlLoginInfo.add(lblPort, gridBagConstraints); - - txtPort.setColumns(30); - txtPort.setText("1247"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - pnlLoginInfo.add(txtPort, gridBagConstraints); - - lblZone.setText("Zone:"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 3; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; - pnlLoginInfo.add(lblZone, gridBagConstraints); - - txtZone.setColumns(30); - txtZone.setPreferredSize(null); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 3; - gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - pnlLoginInfo.add(txtZone, gridBagConstraints); - - lblResource.setText("Resource:"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 4; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; - pnlLoginInfo.add(lblResource, gridBagConstraints); - - txtResource.setColumns(30); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 4; - gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - pnlLoginInfo.add(txtResource, gridBagConstraints); - - lblUserName.setText("User Name:"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 5; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; - pnlLoginInfo.add(lblUserName, gridBagConstraints); - - txtUserName.setColumns(30); - txtUserName.setPreferredSize(null); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 5; - gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - pnlLoginInfo.add(txtUserName, gridBagConstraints); - - lblPassword.setText("Password:"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 6; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; - pnlLoginInfo.add(lblPassword, gridBagConstraints); - - password.setColumns(30); - password.setPreferredSize(null); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 6; - gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - pnlLoginInfo.add(password, gridBagConstraints); - - chkAdvancedLogin.setText("Advanced Login Settings"); - chkAdvancedLogin.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - chkAdvancedLoginActionPerformed(evt); - } - }); - jPanel1.add(chkAdvancedLogin); - - chkGuestLogin.setText("Login As Guest"); - chkGuestLogin.setToolTipText("Use a guest login"); - chkGuestLogin.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.Action |