summaryrefslogtreecommitdiffstats
path: root/idrop-lite
diff options
context:
space:
mode:
authorLISA STILLWELL <lisa@simon.local>2011-08-17 13:52:46 (GMT)
committer LISA STILLWELL <lisa@simon.local>2011-08-17 13:52:46 (GMT)
commitcf062fde0ef4a4554a8b5f98769c3bce2997ce6b (patch)
tree7cd16c1f68879cce4839498008c663864344cf26 /idrop-lite
parente4720d1d78661183c975bad8fdd25a7eec2ccbac (diff)
downloadQCG-Data-cf062fde0ef4a4554a8b5f98769c3bce2997ce6b.zip
QCG-Data-cf062fde0ef4a4554a8b5f98769c3bce2997ce6b.tar.gz
QCG-Data-cf062fde0ef4a4554a8b5f98769c3bce2997ce6b.tar.bz2
[#427] Add Local Tree to main mode and add functionality for Upload mode
Diffstat (limited to 'idrop-lite')
-rw-r--r--idrop-lite/src/main/java/org/irods/jargon/idrop/lite/LocalFileUtils.java38
-rw-r--r--idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/FinderDeleteIRODSDialog.form136
-rw-r--r--idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/FinderDeleteIRODSDialog.java325
-rw-r--r--idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/FinderNewIRODSDirectoryDialog.form158
-rw-r--r--idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/FinderNewIRODSDirectoryDialog.java290
-rw-r--r--idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/FinderRenameIRODSDirectoryDialog.form196
-rw-r--r--idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/FinderRenameIRODSDirectoryDialog.java338
-rw-r--r--idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/FinderUtils.java186
-rw-r--r--idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/IRODSFinderDialog.form147
-rw-r--r--idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/IRODSFinderDialog.java252
-rw-r--r--idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/IRODSFinderOutlineModel.java185
-rw-r--r--idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/IRODSFinderTree.java312
-rw-r--r--idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/IRODSTreeContainingComponent.java23
-rw-r--r--idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/IrodsSelectionListenerForBuildingInfoPanel.java59
-rw-r--r--idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/MessageManager.java33
-rw-r--r--idrop-lite/src/main/resources/org/irods/jargon/idrop/lite/finder/Bundle.properties6
16 files changed, 2684 insertions, 0 deletions
diff --git a/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/LocalFileUtils.java b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/LocalFileUtils.java
new file mode 100644
index 0000000..557dec7
--- /dev/null
+++ b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/LocalFileUtils.java
@@ -0,0 +1,38 @@
+package org.irods.jargon.idrop.lite;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.tree.TreePath;
+
+/**
+ * Utilities for working with local file systems
+ *
+ * @author Mike Conway - DICE (www.irods.org)
+ */
+public class LocalFileUtils {
+
+ public static List<String> listFileRootsForSystem() {
+ List<String> fileRoots = new ArrayList<String>();
+ File[] roots = File.listRoots();
+ for (File root : roots) {
+ fileRoots.add(root.getPath());
+ }
+
+ return fileRoots;
+
+ }
+
+ public static String makeLocalFilePath(TreePath treePath) {
+
+ String filePath = "";
+
+ for(Object node: treePath.getPath()) {
+ if(node.toString().equals("/")) continue;
+ filePath += System.getProperty("file.separator") + node.toString();
+ }
+
+ return filePath;
+ }
+}
diff --git a/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/FinderDeleteIRODSDialog.form b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/FinderDeleteIRODSDialog.form
new file mode 100644
index 0000000..c843416
--- /dev/null
+++ b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/FinderDeleteIRODSDialog.form
@@ -0,0 +1,136 @@
+<?xml version="1.1" encoding="UTF-8" ?>
+
+<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
+ <Properties>
+ <Property name="defaultCloseOperation" type="int" value="2"/>
+ </Properties>
+ <SyntheticProperties>
+ <SyntheticProperty name="formSizePolicy" type="int" value="1"/>
+ </SyntheticProperties>
+ <AuxValues>
+ <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,0,-75,0,0,2,104"/>
+ </AuxValues>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
+ <SubComponents>
+ <Component class="javax.swing.JLabel" name="lblTitle">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="Please hit OK to delete the following file/folder from iRODS"/>
+ </Properties>
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
+ <BorderConstraints direction="North"/>
+ </Constraint>
+ </Constraints>
+ </Component>
+ <Container class="javax.swing.JPanel" name="pnlFolderData">
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
+ <BorderConstraints direction="Center"/>
+ </Constraint>
+ </Constraints>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridLayout">
+ <Property name="columns" type="int" value="1"/>
+ <Property name="rows" type="int" value="0"/>
+ </Layout>
+ <SubComponents>
+ <Container class="javax.swing.JPanel" name="pnlCurrentParent">
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="1" attributes="0">
+ <EmptySpace pref="40" max="32767" attributes="0"/>
+ <Component id="lblCurrentFolder" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="scrollFileToDelete" min="-2" pref="413" max="-2" attributes="1"/>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace min="-2" pref="35" max="-2" attributes="0"/>
+ <Component id="lblCurrentFolder" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace min="-2" pref="22" max="-2" attributes="0"/>
+ <Component id="scrollFileToDelete" min="-2" max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ <EmptySpace max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="java.awt.Label" name="lblCurrentFolder">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="File/folder to delete:"/>
+ </Properties>
+ </Component>
+ <Container class="javax.swing.JScrollPane" name="scrollFileToDelete">
+ <AuxValues>
+ <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
+ <SubComponents>
+ <Component class="javax.swing.JTextArea" name="txtAreaFileToDelete">
+ <Properties>
+ <Property name="columns" type="int" value="20"/>
+ <Property name="editable" type="boolean" value="false"/>
+ <Property name="lineWrap" type="boolean" value="true"/>
+ <Property name="rows" type="int" value="5"/>
+ </Properties>
+ </Component>
+ </SubComponents>
+ </Container>
+ </SubComponents>
+ </Container>
+ </SubComponents>
+ </Container>
+ <Container class="javax.swing.JPanel" name="pnlBottom">
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
+ <BorderConstraints direction="South"/>
+ </Constraint>
+ </Constraints>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout">
+ <Property name="alignment" type="int" value="2"/>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JButton" name="btnCancel">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="Cancel"/>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnCancelActionPerformed"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JButton" name="btnOK">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="OK"/>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnOKActionPerformed"/>
+ </Events>
+ </Component>
+ </SubComponents>
+ </Container>
+ </SubComponents>
+</Form>
diff --git a/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/FinderDeleteIRODSDialog.java b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/FinderDeleteIRODSDialog.java
new file mode 100644
index 0000000..fd68f94
--- /dev/null
+++ b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/FinderDeleteIRODSDialog.java
@@ -0,0 +1,325 @@
+package org.irods.jargon.idrop.lite.finder;
+
+import java.awt.Cursor;
+import java.awt.event.ActionEvent;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.JComponent;
+import javax.swing.KeyStroke;
+import javax.swing.SwingWorker;
+
+import org.irods.jargon.core.exception.JargonException;
+import org.irods.jargon.core.pub.io.IRODSFile;
+import org.irods.jargon.core.pub.io.IRODSFileFactory;
+import org.irods.jargon.core.query.CollectionAndDataObjectListingEntry;
+import org.irods.jargon.idrop.lite.IRODSNode;
+import org.irods.jargon.idrop.lite.IRODSOutlineModel;
+import org.irods.jargon.idrop.lite.IRODSTree;
+import org.irods.jargon.idrop.lite.IdropException;
+import org.irods.jargon.idrop.lite.IdropRuntimeException;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * @author mikeconway
+ */
+public class FinderDeleteIRODSDialog extends javax.swing.JDialog {
+
+
+ private final IRODSFinderTree irodsTree;
+ private final IRODSNode deletedNode;
+ private final List<IRODSNode> deletedNodes;
+ private final IRODSFinderDialog irodsFinderDialog;
+ public static org.slf4j.Logger log = LoggerFactory.getLogger(FinderDeleteIRODSDialog.class);
+
+ /** Creates new form NewIRODSDirectoryDialog */
+ public FinderDeleteIRODSDialog(final IRODSFinderDialog parent, final boolean modal,
+ final IRODSFinderTree irodsTree, final IRODSNode deletedNode) {
+ super(parent, modal);
+ this.irodsFinderDialog = 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 FinderDeleteIRODSDialog(final IRODSFinderDialog parent, final boolean modal,
+ final IRODSFinderTree irodsTree, final List<IRODSNode> deletedNodes) {
+ super(parent, modal);
+ this.irodsFinderDialog = parent;
+ this.irodsTree = irodsTree;
+ this.deletedNodes = deletedNodes;
+ this.deletedNode = null;
+ initialize();
+ 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(FinderDeleteIRODSDialog.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"
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ lblTitle = new javax.swing.JLabel();
+ pnlFolderData = new javax.swing.JPanel();
+ pnlCurrentParent = new javax.swing.JPanel();
+ lblCurrentFolder = new java.awt.Label();
+ scrollFileToDelete = new javax.swing.JScrollPane();
+ txtAreaFileToDelete = new javax.swing.JTextArea();
+ pnlBottom = new javax.swing.JPanel();
+ btnCancel = new javax.swing.JButton();
+ btnOK = new javax.swing.JButton();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
+
+ lblTitle.setText("Please hit OK to delete the following file/folder from iRODS");
+ getContentPane().add(lblTitle, java.awt.BorderLayout.NORTH);
+
+ pnlFolderData.setLayout(new java.awt.GridLayout(0, 1));
+
+ lblCurrentFolder.setText("File/folder to delete:");
+
+ txtAreaFileToDelete.setColumns(20);
+ txtAreaFileToDelete.setEditable(false);
+ txtAreaFileToDelete.setLineWrap(true);
+ txtAreaFileToDelete.setRows(5);
+ scrollFileToDelete.setViewportView(txtAreaFileToDelete);
+
+ org.jdesktop.layout.GroupLayout pnlCurrentParentLayout = new org.jdesktop.layout.GroupLayout(pnlCurrentParent);
+ pnlCurrentParent.setLayout(pnlCurrentParentLayout);
+ pnlCurrentParentLayout.setHorizontalGroup(
+ pnlCurrentParentLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(org.jdesktop.layout.GroupLayout.TRAILING, pnlCurrentParentLayout.createSequentialGroup()
+ .addContainerGap(40, Short.MAX_VALUE)
+ .add(lblCurrentFolder, 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(scrollFileToDelete, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 413, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap())
+ );
+ pnlCurrentParentLayout.setVerticalGroup(
+ pnlCurrentParentLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(pnlCurrentParentLayout.createSequentialGroup()
+ .add(pnlCurrentParentLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(pnlCurrentParentLayout.createSequentialGroup()
+ .add(35, 35, 35)
+ .add(lblCurrentFolder, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
+ .add(pnlCurrentParentLayout.createSequentialGroup()
+ .add(22, 22, 22)
+ .add(scrollFileToDelete, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
+ .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ );
+
+ pnlFolderData.add(pnlCurrentParent);
+
+ getContentPane().add(pnlFolderData, java.awt.BorderLayout.CENTER);
+
+ pnlBottom.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT));
+
+ btnCancel.setText("Cancel");
+ btnCancel.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnCancelActionPerformed(evt);
+ }
+ });
+ pnlBottom.add(btnCancel);
+
+ btnOK.setText("OK");
+ 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
+
+ private void btnCancelActionPerformed(final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnCancelActionPerformed
+ this.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(FinderDeleteIRODSDialog.class.getName()).log(
+ Level.SEVERE, null, ex);
+ throw new IdropRuntimeException(ex);
+ }
+
+ }// GEN-LAST:event_btnOKActionPerformed
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton btnCancel;
+ private javax.swing.JButton btnOK;
+ private java.awt.Label lblCurrentFolder;
+ private javax.swing.JLabel lblTitle;
+ private javax.swing.JPanel pnlBottom;
+ private javax.swing.JPanel pnlCurrentParent;
+ private javax.swing.JPanel pnlFolderData;
+ private javax.swing.JScrollPane scrollFileToDelete;
+ 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 FinderDeleteIRODSDialog 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(FinderDeleteIRODSDialog.class.getName()).log(
+ Level.SEVERE, null, ex);
+ throw new IdropException(ex);
+ } finally {
+ irodsFinderDialog.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 FinderDeleteIRODSDialog dialog;
+ private String message = "";
+
+ DeleteWorker(final FinderDeleteIRODSDialog dialog) {
+ if (dialog == null) {
+ throw new IllegalArgumentException("null dialog");
+ }
+
+ this.dialog = dialog;
+
+ }
+
+ @Override
+ public String doInBackground() {
+
+ try {
+
+ IRODSFileFactory irodsFileFactory = irodsFinderDialog.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(FinderDeleteIRODSDialog.class.getName()).log(
+ Level.SEVERE, null, ex);
+
+ throw new IdropRuntimeException(ex);
+ } finally {
+ irodsFinderDialog.getIdropCore().closeAllIRODSConnections();
+ }
+
+ return null;
+ }
+
+ @Override
+ protected void done() {
+ dialog.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ final IRODSFinderOutlineModel irodsFileSystemModel = (IRODSFinderOutlineModel) 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(FinderDeleteIRODSDialog.class.getName()).log(
+ Level.SEVERE, null, ex);
+ throw new IdropRuntimeException(ex);
+ }
+ dialog.dispose();
+
+ }
+ }
+}
diff --git a/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/FinderNewIRODSDirectoryDialog.form b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/FinderNewIRODSDirectoryDialog.form
new file mode 100644
index 0000000..c9a2786
--- /dev/null
+++ b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/FinderNewIRODSDirectoryDialog.form
@@ -0,0 +1,158 @@
+<?xml version="1.1" encoding="UTF-8" ?>
+
+<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
+ <Properties>
+ <Property name="defaultCloseOperation" type="int" value="2"/>
+ <Property name="title" type="java.lang.String" value="Create New Folder Dialog"/>
+ <Property name="name" type="java.lang.String" value="NewParentDialog" noResource="true"/>
+ </Properties>
+ <SyntheticProperties>
+ <SyntheticProperty name="formSizePolicy" type="int" value="1"/>
+ </SyntheticProperties>
+ <AuxValues>
+ <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,47,0,0,2,110"/>
+ </AuxValues>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
+ <SubComponents>
+ <Component class="javax.swing.JLabel" name="lblTitle">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="Please enter a name for the new folder"/>
+ </Properties>
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
+ <BorderConstraints direction="North"/>
+ </Constraint>
+ </Constraints>
+ </Component>
+ <Container class="javax.swing.JPanel" name="pnlFolderData">
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
+ <BorderConstraints direction="Center"/>
+ </Constraint>
+ </Constraints>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridLayout">
+ <Property name="columns" type="int" value="1"/>
+ <Property name="rows" type="int" value="0"/>
+ </Layout>
+ <SubComponents>
+ <Container class="javax.swing.JPanel" name="pnlCurrentParent">
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="1" attributes="0">
+ <EmptySpace pref="20" max="32767" attributes="0"/>
+ <Group type="103" groupAlignment="1" attributes="0">
+ <Component id="lblCurrentParent" min="-2" max="-2" attributes="0"/>
+ <Component id="lblNewDiretoryName" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" max="-2" attributes="0">
+ <Component id="txtNewFolder" max="32767" attributes="1"/>
+ <Component id="scrollCurrentParent" alignment="0" pref="413" max="32767" attributes="1"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace min="-2" pref="58" max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="scrollCurrentParent" alignment="0" min="-2" max="-2" attributes="0"/>
+ <Component id="lblCurrentParent" alignment="0" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="txtNewFolder" min="-2" max="-2" attributes="0"/>
+ <Component id="lblNewDiretoryName" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace pref="68" max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="java.awt.Label" name="lblCurrentParent">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="Current parent directory:"/>
+ </Properties>
+ </Component>
+ <Container class="javax.swing.JScrollPane" name="scrollCurrentParent">
+ <AuxValues>
+ <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
+ <SubComponents>
+ <Component class="javax.swing.JTextArea" name="txtAreaCurrentParent">
+ <Properties>
+ <Property name="columns" type="int" value="20"/>
+ <Property name="editable" type="boolean" value="false"/>
+ <Property name="lineWrap" type="boolean" value="true"/>
+ <Property name="rows" type="int" value="5"/>
+ <Property name="focusable" type="boolean" value="false"/>
+ </Properties>
+ </Component>
+ </SubComponents>
+ </Container>
+ <Component class="java.awt.Label" name="lblNewDiretoryName">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="New folder name:"/>
+ </Properties>
+ <AccessibilityProperties>
+ <Property name="AccessibleContext.accessibleName" type="java.lang.String" value="New directory name:"/>
+ </AccessibilityProperties>
+ </Component>
+ <Component class="javax.swing.JTextField" name="txtNewFolder">
+ <Properties>
+ <Property name="toolTipText" type="java.lang.String" value="A name for the new folder underneath the displayed parent"/>
+ </Properties>
+ </Component>
+ </SubComponents>
+ </Container>
+ </SubComponents>
+ </Container>
+ <Container class="javax.swing.JPanel" name="pnlBottom">
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
+ <BorderConstraints direction="South"/>
+ </Constraint>
+ </Constraints>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout">
+ <Property name="alignment" type="int" value="2"/>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JButton" name="btnCancel">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="Cancel"/>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnCancelActionPerformed"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JButton" name="btnOK">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="OK"/>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnOKActionPerformed"/>
+ </Events>
+ </Component>
+ </SubComponents>
+ </Container>
+ </SubComponents>
+</Form>
diff --git a/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/FinderNewIRODSDirectoryDialog.java b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/FinderNewIRODSDirectoryDialog.java
new file mode 100644
index 0000000..ef9cc86
--- /dev/null
+++ b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/FinderNewIRODSDirectoryDialog.java
@@ -0,0 +1,290 @@
+package org.irods.jargon.idrop.lite.finder;
+
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.event.ActionEvent;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.JComponent;
+import javax.swing.KeyStroke;
+import javax.swing.tree.TreePath;
+
+import org.irods.jargon.core.query.CollectionAndDataObjectListingEntry;
+import org.irods.jargon.idrop.lite.IRODSFileService;
+import org.irods.jargon.idrop.lite.TreeUtils;
+import org.irods.jargon.idrop.lite.IRODSNode;
+import org.irods.jargon.idrop.lite.IRODSTree;
+import org.irods.jargon.idrop.lite.IdropException;
+import org.irods.jargon.idrop.lite.IdropRuntimeException;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Dialog to gather a new directory name
+ *
+ * @author mikeconway
+ */
+public class FinderNewIRODSDirectoryDialog extends javax.swing.JDialog {
+
+ private final IRODSFinderDialog irodsFinderDialog;
+ private String parentDirectory = "";
+ private final IRODSFinderTree irodsTree;
+ private final IRODSNode parentNode;
+ public static org.slf4j.Logger log = LoggerFactory.getLogger(FinderNewIRODSDirectoryDialog.class);
+
+ public String getParentDirectory() {
+ return parentDirectory;
+ }
+
+ public void setParentDirectory(final String parentDirectory) {
+ this.parentDirectory = parentDirectory;
+ }
+
+ /** Creates new form NewIRODSDirectoryDialog */
+ public FinderNewIRODSDirectoryDialog(final IRODSFinderDialog parent, final boolean modal,
+ final String parentDirectory, final IRODSFinderTree stagingViewTree,
+ final IRODSNode parentNode) {
+ super(parent, modal);
+ this.irodsFinderDialog = parent;
+ this.parentDirectory = parentDirectory;
+ this.irodsTree = stagingViewTree;
+ this.parentNode = parentNode;
+ initComponents();
+ txtAreaCurrentParent.setText(this.parentDirectory);
+ 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.
+ */
+ @SuppressWarnings("unchecked")
+ // <editor-fold defaultstate="collapsed"
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ lblTitle = new javax.swing.JLabel();
+ pnlFolderData = new javax.swing.JPanel();
+ pnlCurrentParent = new javax.swing.JPanel();
+ lblCurrentParent = new java.awt.Label();
+ scrollCurrentParent = new javax.swing.JScrollPane();
+ txtAreaCurrentParent = new javax.swing.JTextArea();
+ lblNewDiretoryName = new java.awt.Label();
+ txtNewFolder = new javax.swing.JTextField();
+ pnlBottom = new javax.swing.JPanel();
+ btnCancel = new javax.swing.JButton();
+ btnOK = new javax.swing.JButton();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
+ setTitle("Create New Folder Dialog");
+ setName("NewParentDialog"); // NOI18N
+
+ lblTitle.setText("Please enter a name for the new folder");
+ getContentPane().add(lblTitle, java.awt.BorderLayout.NORTH);
+
+ pnlFolderData.setLayout(new java.awt.GridLayout(0, 1));
+
+ lblCurrentParent.setText("Current parent directory:");
+
+ txtAreaCurrentParent.setColumns(20);
+ txtAreaCurrentParent.setEditable(false);
+ txtAreaCurrentParent.setLineWrap(true);
+ txtAreaCurrentParent.setRows(5);
+ txtAreaCurrentParent.setFocusable(false);
+ scrollCurrentParent.setViewportView(txtAreaCurrentParent);
+
+ lblNewDiretoryName.setText("New folder name:");
+
+ txtNewFolder.setToolTipText("A name for the new folder underneath the displayed parent");
+
+ org.jdesktop.layout.GroupLayout pnlCurrentParentLayout = new org.jdesktop.layout.GroupLayout(pnlCurrentParent);
+ pnlCurrentParent.setLayout(pnlCurrentParentLayout);
+ pnlCurrentParentLayout.setHorizontalGroup(
+ pnlCurrentParentLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(org.jdesktop.layout.GroupLayout.TRAILING, pnlCurrentParentLayout.createSequentialGroup()
+ .addContainerGap(20, Short.MAX_VALUE)
+ .add(pnlCurrentParentLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
+ .add(lblCurrentParent, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ .add(lblNewDiretoryName, 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(pnlCurrentParentLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
+ .add(txtNewFolder)
+ .add(scrollCurrentParent, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 413, Short.MAX_VALUE))
+ .addContainerGap())
+ );
+ pnlCurrentParentLayout.setVerticalGroup(
+ pnlCurrentParentLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(pnlCurrentParentLayout.createSequentialGroup()
+ .add(58, 58, 58)
+ .add(pnlCurrentParentLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(scrollCurrentParent, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ .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(pnlCurrentParentLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(txtNewFolder, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ .add(lblNewDiretoryName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
+ .addContainerGap(68, Short.MAX_VALUE))
+ );
+
+ lblNewDiretoryName.getAccessibleContext().setAccessibleName("New directory name:");
+
+ pnlFolderData.add(pnlCurrentParent);
+
+ getContentPane().add(pnlFolderData, java.awt.BorderLayout.CENTER);
+
+ pnlBottom.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT));
+
+ btnCancel.setText("Cancel");
+ btnCancel.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnCancelActionPerformed(evt);
+ }
+ });
+ pnlBottom.add(btnCancel);
+
+ btnOK.setText("OK");
+ 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
+
+ private void btnCancelActionPerformed(final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnCancelActionPerformed
+ this.dispose();
+ }// GEN-LAST:event_btnCancelActionPerformed
+
+ private void btnOKActionPerformed(final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnOKActionPerformed
+ processNew();
+ }// GEN-LAST:event_btnOKActionPerformed
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton btnCancel;
+ private javax.swing.JButton btnOK;
+ private java.awt.Label lblCurrentParent;
+ private java.awt.Label lblNewDiretoryName;
+ private javax.swing.JLabel lblTitle;
+ private javax.swing.JPanel pnlBottom;
+ private javax.swing.JPanel pnlCurrentParent;
+ private javax.swing.JPanel pnlFolderData;
+ private javax.swing.JScrollPane scrollCurrentParent;
+ private javax.swing.JTextArea txtAreaCurrentParent;
+ private javax.swing.JTextField txtNewFolder;
+ // End of variables declaration//GEN-END:variables
+ private void processNew() {
+ // add the new folder to irods, add to the tree, and scroll the tree
+ // into view
+
+ if (txtNewFolder.getText().isEmpty()) {
+ txtNewFolder.setBackground(Color.red);
+ MessageManager.showError(this, "please enter a new folder name", MessageManager.TITLE_MESSAGE);
+ return;
+ }
+
+ final FinderNewIRODSDirectoryDialog thisDialog = this;
+
+ java.awt.EventQueue.invokeLater(new Runnable() {
+
+ @Override
+ public void run() {
+ try {
+ log.info("adding new folder named:{}",
+ txtNewFolder.getText());
+ thisDialog.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+
+ IRODSFileService irodsFileService;
+ try {
+ irodsFileService = new IRODSFileService(irodsFinderDialog.getIdropCore().getIrodsAccount(), irodsFinderDialog.getIdropCore().getIrodsFileSystem());
+ } catch (IdropException ex) {
+ Logger.getLogger(
+ FinderNewIRODSDirectoryDialog.class.getName()).log(
+ Level.SEVERE, null, ex);
+ throw new IdropRuntimeException(ex);
+ } finally {
+ thisDialog.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+
+ }
+
+ StringBuilder sb = new StringBuilder();
+ sb.append(parentDirectory);
+ sb.append('/');
+ sb.append(txtNewFolder.getText());
+ String newDirPath = sb.toString();
+
+ boolean created = irodsFileService.createNewFolder(newDirPath);
+
+ irodsTree.getModel();
+
+ if (!created) {
+ log.info("could not create new folder in:{}",
+ newDirPath);
+ MessageManager.showError(thisDialog, "directory could not be created", MessageManager.TITLE_MESSAGE);
+ thisDialog.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ return;
+ }
+
+ // directory created, add to tree and show as first node
+ CollectionAndDataObjectListingEntry entry = new CollectionAndDataObjectListingEntry();
+ entry.setObjectType(CollectionAndDataObjectListingEntry.ObjectType.COLLECTION);
+ entry.setParentPath(parentDirectory);
+ entry.setPathOrName(newDirPath);
+ IRODSNode newNode = new IRODSNode(entry, irodsFinderDialog.getIdropCore().getIrodsAccount(), irodsFinderDialog.getIdropCore().getIrodsFileSystem(), irodsFinderDialog.getIrodsTree());
+ log.info("inserting node at 0");
+ if (parentNode.isCached()) {
+ parentNode.insert(newNode, parentNode.getChildCount());
+ } else {
+ parentNode.forceReloadOfChildrenOfThisNode();
+ }
+
+ try {
+ TreePath path = FinderUtils.buildTreePathForIrodsAbsolutePath(
+ irodsFinderDialog.getIrodsTree(), entry.getParentPath());
+ irodsFinderDialog.getIrodsTree().collapsePath(path);
+ irodsFinderDialog.getIrodsTree().expandPath(path);
+ } catch (IdropException ex) {
+ Logger.getLogger(
+ FinderNewIRODSDirectoryDialog.class.getName()).log(
+ Level.SEVERE, null, ex);
+ throw new IdropRuntimeException(ex);
+ } finally {
+ thisDialog.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ }
+
+ MessageManager.showMessage(thisDialog, "new folder created", MessageManager.TITLE_MESSAGE);
+
+ thisDialog.dispose();
+ } catch (IdropException ex) {
+ Logger.getLogger(FinderNewIRODSDirectoryDialog.class.getName()).log(Level.SEVERE, null, ex);
+ throw new IdropRuntimeException(ex);
+ }
+ }
+ });
+ }
+
+ /**
+ * 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) {
+ processNew();
+ }
+ };
+ btnOK.registerKeyboardAction(enterAction, enter,
+ JComponent.WHEN_IN_FOCUSED_WINDOW);
+
+ }
+}
diff --git a/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/FinderRenameIRODSDirectoryDialog.form b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/FinderRenameIRODSDirectoryDialog.form
new file mode 100644
index 0000000..7a2ceda
--- /dev/null
+++ b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/FinderRenameIRODSDirectoryDialog.form
@@ -0,0 +1,196 @@
+<?xml version="1.1" encoding="UTF-8" ?>
+
+<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
+ <Properties>
+ <Property name="defaultCloseOperation" type="int" value="2"/>
+ <Property name="title" type="java.lang.String" value="Rename iRODS File or Folder"/>
+ <Property name="name" type="java.lang.String" value="NewParentDialog" noResource="true"/>
+ </Properties>
+ <AccessibilityProperties>
+ <Property name="AccessibleContext.accessibleName" type="java.lang.String" value="Rename file or folder dialog"/>
+ </AccessibilityProperties>
+ <SyntheticProperties>
+ <SyntheticProperty name="formSizePolicy" type="int" value="1"/>
+ </SyntheticProperties>
+ <AuxValues>
+ <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="lblTitle" min="-2" pref="747" max="-2" attributes="0"/>
+ <Component id="pnlFolderData" alignment="0" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <Component id="lblTitle" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="pnlFolderData" min="-2" max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JLabel" name="lblTitle">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="Please enter a new name for the file or collection"/>
+ </Properties>
+ </Component>
+ <Container class="javax.swing.JPanel" name="pnlFolderData">
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="pnlCurrentParent" min="-2" pref="757" max="-2" attributes="0"/>
+ <EmptySpace max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="pnlCurrentParent" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Container class="javax.swing.JPanel" name="pnlCurrentParent">
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="1" attributes="0">
+ <EmptySpace pref="30" max="32767" attributes="0"/>
+ <Group type="103" groupAlignment="1" attributes="0">
+ <Component id="lblCurrentParent" min="-2" max="-2" attributes="0"/>
+ <Component id="lblNewDiretoryName" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="1" max="-2" attributes="0">
+ <Component id="txtNewFolder" min="0" pref="0" max="32767" attributes="1"/>
+ <Component id="txtCurrentFolder" alignment="1" pref="421" max="32767" attributes="1"/>
+ </Group>
+ <EmptySpace min="-2" pref="213" max="-2" attributes="0"/>
+ </Group>
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="pnlBottom" min="-2" pref="747" max="-2" attributes="0"/>
+ <EmptySpace max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace min="-2" pref="58" max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="lblCurrentParent" min="-2" max="-2" attributes="0"/>
+ <Component id="txtCurrentFolder" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="txtNewFolder" min="-2" max="-2" attributes="0"/>
+ <Component id="lblNewDiretoryName" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace pref="22" max="32767" attributes="0"/>
+ <Component id="pnlBottom" min="-2" max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="java.awt.Label" name="lblCurrentParent">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="Current name:"/>
+ </Properties>
+ </Component>
+ <Component class="java.awt.Label" name="lblNewDiretoryName">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="New name:"/>
+ </Properties>
+ <AccessibilityProperties>
+ <Property name="AccessibleContext.accessibleName" type="java.lang.String" value="New directory name:"/>
+ </AccessibilityProperties>
+ </Component>
+ <Component class="javax.swing.JTextField" name="txtCurrentFolder">
+ <Properties>
+ <Property name="columns" type="int" value="50"/>
+ <Property name="editable" type="boolean" value="false"/>
+ <Property name="toolTipText" type="java.lang.String" value="A name for the new folder underneath the displayed parent"/>
+ <Property name="focusable" type="boolean" value="false"/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextField" name="txtNewFolder">
+ <Properties>
+ <Property name="columns" type="int" value="50"/>
+ <Property name="toolTipText" type="java.lang.String" value="A name for the new folder underneath the displayed parent"/>
+ </Properties>
+ </Component>
+ <Container class="javax.swing.JPanel" name="pnlBottom">
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <EmptySpace min="576" pref="576" max="576" attributes="0"/>
+ <Component id="btnCancel" min="-2" max="-2" attributes="0"/>
+ <EmptySpace min="5" pref="5" max="5" attributes="0"/>
+ <Component id="btnOK" min="-2" max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <EmptySpace min="5" pref="5" max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="btnCancel" min="-2" max="-2" attributes="0"/>
+ <Component id="btnOK" min="-2" max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JButton" name="btnCancel">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="Cancel"/>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnCancelActionPerformed"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JButton" name="btnOK">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="OK"/>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnOKActionPerformed"/>
+ </Events>
+ </Component>
+ </SubComponents>
+ </Container>
+ </SubComponents>
+ </Container>
+ </SubComponents>
+ </Container>
+ </SubComponents>
+</Form>
diff --git a/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/FinderRenameIRODSDirectoryDialog.java b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/FinderRenameIRODSDirectoryDialog.java
new file mode 100644
index 0000000..dfecc59
--- /dev/null
+++ b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/FinderRenameIRODSDirectoryDialog.java
@@ -0,0 +1,338 @@
+package org.irods.jargon.idrop.lite.finder;
+
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.event.ActionEvent;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.JComponent;
+import javax.swing.KeyStroke;
+import javax.swing.tree.TreePath;
+
+import org.irods.jargon.core.pub.io.IRODSFile;
+import org.irods.jargon.core.query.CollectionAndDataObjectListingEntry;
+import org.irods.jargon.idrop.lite.IRODSFileService;
+import org.irods.jargon.idrop.lite.TreeUtils;
+import org.irods.jargon.idrop.lite.IRODSFileSystemModel;
+import org.irods.jargon.idrop.lite.IRODSNode;
+import org.irods.jargon.idrop.lite.IRODSOutlineModel;
+import org.irods.jargon.idrop.lite.IRODSTree;
+import org.irods.jargon.idrop.lite.IdropException;
+import org.irods.jargon.idrop.lite.IdropRuntimeException;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Dialog to gather a new directory name
+ *
+ * @author mikeconway
+ */
+public class FinderRenameIRODSDirectoryDialog extends javax.swing.JDialog {
+
+ private final IRODSFinderDialog irodsFinderDialog;
+ private final String currentAbsolutePath;
+ private final IRODSFinderTree irodsTree;
+ private final IRODSNode currentNode;
+ public static org.slf4j.Logger log = LoggerFactory.getLogger(FinderRenameIRODSDirectoryDialog.class);
+
+ /** Creates new form NewIRODSDirectoryDialog */
+ public FinderRenameIRODSDirectoryDialog(final IRODSFinderDialog parent, final boolean modal,
+ final String currentAbsolutePath, final IRODSFinderTree irodsTree,
+ final IRODSNode currentNode) {
+ super(parent, modal);
+ this.irodsFinderDialog = parent;
+ this.currentAbsolutePath = currentAbsolutePath;
+ this.irodsTree = irodsTree;
+ this.currentNode = currentNode;
+ initComponents();
+ int lastPathPartIdx = currentAbsolutePath.lastIndexOf("/");
+ if (lastPathPartIdx == -1) {
+ String msg = "could not find last path component of absolute path:"
+ + currentAbsolutePath;
+ throw new IdropRuntimeException("could not find last path component of absolute path");
+ }
+
+ String parentAbsPath = currentAbsolutePath.substring(0, lastPathPartIdx);
+ String currentCollectionOrFileName = currentAbsolutePath.substring(lastPathPartIdx + 1);
+
+ log.debug("computed parent abs path as:{}", parentAbsPath);
+ log.debug("computed current file or collection name as:{}",
+ currentCollectionOrFileName);
+
+ txtCurrentFolder.setText(currentCollectionOrFileName);
+ 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.
+ */
+ @SuppressWarnings("unchecked")
+ // <editor-fold defaultstate="collapsed"
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ lblTitle = new javax.swing.JLabel();
+ pnlFolderData = new javax.swing.JPanel();
+ pnlCurrentParent = new javax.swing.JPanel();
+ lblCurrentParent = new java.awt.Label();
+ lblNewDiretoryName = new java.awt.Label();
+ txtCurrentFolder = new javax.swing.JTextField();
+ txtNewFolder = new javax.swing.JTextField();
+ pnlBottom = new javax.swing.JPanel();
+ btnCancel = new javax.swing.JButton();
+ btnOK = new javax.swing.JButton();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
+ setTitle("Rename iRODS File or Folder");
+ setName("NewParentDialog"); // NOI18N
+
+ lblTitle.setText("Please enter a new name for the file or collection");
+
+ lblCurrentParent.setText("Current name:");
+
+ lblNewDiretoryName.setText("New name:");
+
+ txtCurrentFolder.setColumns(50);
+ txtCurrentFolder.setEditable(false);
+ txtCurrentFolder.setToolTipText("A name for the new folder underneath the displayed parent");
+ txtCurrentFolder.setFocusable(false);
+
+ txtNewFolder.setColumns(50);
+ txtNewFolder.setToolTipText("A name for the new folder underneath the displayed parent");
+
+ btnCancel.setText("Cancel");
+ btnCancel.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnCancelActionPerformed(evt);
+ }
+ });
+
+ btnOK.setText("OK");
+ btnOK.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnOKActionPerformed(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(576, 576, 576)
+ .add(btnCancel)
+ .add(5, 5, 5)
+ .add(btnOK))
+ );
+ pnlBottomLayout.setVerticalGroup(
+ pnlBottomLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(pnlBottomLayout.createSequentialGroup()
+ .add(5, 5, 5)
+ .add(pnlBottomLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(btnCancel)
+ .add(btnOK)))
+ );
+
+ org.jdesktop.layout.GroupLayout pnlCurrentParentLayout = new org.jdesktop.layout.GroupLayout(pnlCurrentParent);
+ pnlCurrentParent.setLayout(pnlCurrentParentLayout);
+ pnlCurrentParentLayout.setHorizontalGroup(
+ pnlCurrentParentLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(org.jdesktop.layout.GroupLayout.TRAILING, pnlCurrentParentLayout.createSequentialGroup()
+ .addContainerGap(30, Short.MAX_VALUE)
+ .add(pnlCurrentParentLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
+ .add(lblCurrentParent, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ .add(lblNewDiretoryName, 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(pnlCurrentParentLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
+ .add(txtNewFolder, 0, 0, Short.MAX_VALUE)
+ .add(txtCurrentFolder, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 421, Short.MAX_VALUE))
+ .add(213, 213, 213))
+ .add(pnlCurrentParentLayout.createSequentialGroup()
+ .add(pnlBottom, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 747, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ );
+ pnlCurrentParentLayout.setVerticalGroup(
+ pnlCurrentParentLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(pnlCurrentParentLayout.createSequentialGroup()
+ .add(58, 58, 58)
+ .add(pnlCurrentParentLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(lblCurrentParent, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ .add(txtCurrentFolder, 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(pnlCurrentParentLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(txtNewFolder, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ .add(lblNewDiretoryName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 22, Short.MAX_VALUE)
+ .add(pnlBottom, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
+ );
+
+ lblNewDiretoryName.getAccessibleContext().setAccessibleName("New directory name:");
+
+ org.jdesktop.layout.GroupLayout pnlFolderDataLayout = new org.jdesktop.layout.GroupLayout(pnlFolderData);
+ pnlFolderData.setLayout(pnlFolderDataLayout);
+ pnlFolderDataLayout.setHorizontalGroup(
+ pnlFolderDataLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(pnlFolderDataLayout.createSequentialGroup()
+ .add(pnlCurrentParent, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 757, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ );
+ pnlFolderDataLayout.setVerticalGroup(
+ pnlFolderDataLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(pnlFolderDataLayout.createSequentialGroup()
+ .add(pnlCurrentParent, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ );
+
+ org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(layout.createSequentialGroup()
+ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(lblTitle, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 747, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ .add(pnlFolderData, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
+ .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(layout.createSequentialGroup()
+ .add(lblTitle)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(pnlFolderData, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
+ );
+
+ getAccessibleContext().setAccessibleName("Rename file or folder dialog");
+
+ 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 btnOKActionPerformed(final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnOKActionPerformed
+ doRename();
+ }// GEN-LAST:event_btnOKActionPerformed
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton btnCancel;
+ private javax.swing.JButton btnOK;
+ private java.awt.Label lblCurrentParent;
+ private java.awt.Label lblNewDiretoryName;
+ private javax.swing.JLabel lblTitle;
+ private javax.swing.JPanel pnlBottom;
+ private javax.swing.JPanel pnlCurrentParent;
+ private javax.swing.JPanel pnlFolderData;
+ private javax.swing.JTextField txtCurrentFolder;
+ private javax.swing.JTextField txtNewFolder;
+ // End of variables declaration//GEN-END:variables
+ private void doRename() {
+ // add the new folder to irods, add to the tree, and scroll the tree
+ // into view
+
+ if (txtNewFolder.getText().isEmpty()) {
+ txtNewFolder.setBackground(Color.red);
+ MessageManager.showError(this, "please enter a new file or collection name", MessageManager.TITLE_MESSAGE);
+ return;
+ }
+
+ final FinderRenameIRODSDirectoryDialog thisDialog = this;
+
+ java.awt.EventQueue.invokeLater(new Runnable() {
+
+ @Override
+ public void run() {
+ log.info("renaming a file named:{}", txtCurrentFolder.getText());
+ thisDialog.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+ try {
+
+ IRODSFileService irodsFileService = new IRODSFileService(
+ irodsFinderDialog.getIdropCore().getIrodsAccount(), irodsFinderDialog.getIdropCore().getIrodsFileSystem());
+ String newPath = irodsFileService.renameIRODSFileOrDirectory(currentAbsolutePath,
+ txtNewFolder.getText());
+
+ log.debug("New path:{}", newPath);
+ IRODSFinderOutlineModel irodsOutlineModel = (IRODSFinderOutlineModel) irodsTree.getModel();
+ // get the parent of the new directory, and force a reload
+ // of that parent
+ String[] dirs = newPath.split("/");
+ if (dirs.length == 0) {
+ throw new IdropRuntimeException(
+ "unable to find dir components");
+ }
+
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < dirs.length - 1; i++) {
+ if (i > 0) {
+ sb.append("/");
+ }
+ sb.append(dirs[i]);
+ }
+
+ String parentOfNewDir = sb.toString();
+ log.info("parent of new dir:{}", parentOfNewDir);
+
+ TreePath pathForOld = FinderUtils.buildTreePathForIrodsAbsolutePath(irodsTree,
+ currentAbsolutePath);
+
+ if (pathForOld == null) {
+ log.warn(
+ "could not find old path for node:{}, ignoring",
+ currentAbsolutePath);
+ } else {
+ IRODSFileSystemModel irodsFileSystemModel = irodsOutlineModel.getTreeModel();
+ IRODSNode oldNode = (IRODSNode) pathForOld.getLastPathComponent();
+ CollectionAndDataObjectListingEntry nodesEntry = (CollectionAndDataObjectListingEntry) oldNode.getUserObject();
+ IRODSFile newEntryAsFile = irodsFinderDialog.getIdropCore().getIRODSFileFactoryForLoggedInAccount().instanceIRODSFile(newPath);
+ if (newEntryAsFile.isDirectory()) {
+ nodesEntry.setParentPath(newEntryAsFile.getParent());
+ nodesEntry.setPathOrName(newEntryAsFile.getAbsolutePath());
+ } else {
+ nodesEntry.setParentPath(newEntryAsFile.getParent());
+ nodesEntry.setPathOrName(newEntryAsFile.getName());
+ }
+
+ oldNode.setUserObject(nodesEntry);
+ irodsFileSystemModel.nodeChanged(oldNode);
+
+ }
+
+
+
+ MessageManager.showMessage(irodsFinderDialog, "The rename was successful", MessageManager.TITLE_MESSAGE);
+
+ } catch (Exception ex) {
+ Logger.getLogger(FinderRenameIRODSDirectoryDialog.class.getName()).log(Level.SEVERE, null, ex);
+ throw new IdropRuntimeException(ex);
+ } finally {
+ thisDialog.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ irodsFinderDialog.getIdropCore().closeIRODSConnectionForLoggedInAccount();
+ }
+
+ thisDialog.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() {
+
+ @Override
+ public void actionPerformed(final ActionEvent e) {
+ doRename();
+ }
+ };
+ btnOK.registerKeyboardAction(enterAction, enter,
+ JComponent.WHEN_IN_FOCUSED_WINDOW);
+
+ }
+}
diff --git a/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/FinderUtils.java b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/FinderUtils.java
new file mode 100644
index 0000000..66a00f8
--- /dev/null
+++ b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/FinderUtils.java
@@ -0,0 +1,186 @@
+package org.irods.jargon.idrop.lite.finder;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.swing.JTree;
+import javax.swing.tree.TreeNode;
+import javax.swing.tree.TreePath;
+
+import org.irods.jargon.core.query.CollectionAndDataObjectListingEntry;
+import org.irods.jargon.idrop.lite.IRODSFileSystemModel;
+import org.irods.jargon.idrop.lite.IRODSNode;
+import org.irods.jargon.idrop.lite.IRODSOutlineModel;
+import org.irods.jargon.idrop.lite.LocalFileNode;
+import org.irods.jargon.idrop.lite.LocalFileSystemModel;
+import org.irods.jargon.idrop.lite.IdropException;
+import org.netbeans.swing.outline.Outline;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This is a set of utilities for manipulating a swing Jtree
+ *
+ * @author Mike Conway - DICE (www.irods.org)
+ */
+public class FinderUtils {
+
+ public static org.slf4j.Logger log = LoggerFactory.getLogger(FinderUtils.class);
+
+ public static IRODSNode findChild(final IRODSNode parent,
+ final String userObject) throws IdropException {
+ log.debug("finding child of parent:{}", parent);
+ log.debug("user object:{}", userObject);
+ parent.getUserObject();
+ CollectionAndDataObjectListingEntry childEntry = null;
+
+ IRODSNode foundNode = null;
+ try {
+ parent.lazyLoadOfChildrenOfThisNode();
+ } catch (IdropException ex) {
+ Logger.getLogger(FinderUtils.class.getName()).log(Level.SEVERE, null,
+ ex);
+ throw new IdropException("unable to load children of node");
+ }
+
+ for (int i = 0; i < parent.getChildCount(); i++) {
+ childEntry = (CollectionAndDataObjectListingEntry) ((IRODSNode) parent.getChildAt(i)).getUserObject();
+
+ if (childEntry.getObjectType() == CollectionAndDataObjectListingEntry.ObjectType.COLLECTION) {
+ log.debug("child entry is a collection");
+ if (userObject.equals(childEntry.getPathOrName())) {
+ foundNode = (IRODSNode) parent.getChildAt(i);
+ break;
+ }
+ } else {
+ log.debug("child entry is a data object");
+ StringBuilder sb = new StringBuilder();
+ sb.append(childEntry.getParentPath());
+ sb.append('/');
+ sb.append(childEntry.getPathOrName());
+ log.debug(
+ "looking for match when child entry is a file with abs path:{}",
+ sb.toString());
+ if (userObject.equals(sb.toString())) {
+ foundNode = (IRODSNode) parent.getChildAt(i);
+ break;
+ }
+ }
+ }
+ return foundNode;
+ }
+
+ public static TreePath buildTreePathForIrodsAbsolutePath(
+ final Outline tree, final String irodsAbsolutePath)
+ throws IdropException {
+
+ IRODSFinderOutlineModel irodsFileSystemModel = (IRODSFinderOutlineModel) tree.getModel();
+ // the root of the model, which may not be a path underneath the root of
+ // the irods resource
+ IRODSNode rootNode = (IRODSNode) irodsFileSystemModel.getRoot();
+ TreePath calculatedTreePath = new TreePath(rootNode);
+ CollectionAndDataObjectListingEntry rootEntry = (CollectionAndDataObjectListingEntry) rootNode.getUserObject();
+ String[] irodsPathComponents = irodsAbsolutePath.split("/");
+
+ /*
+ * get an array that has the path components that descend from the root
+ * of the iRODS file system to the subdirectory which the tree model
+ * considers the root of the tree
+ */
+ String[] irodsRootNodePathComponents = rootEntry.getPathOrName().split(
+ "/");
+
+ /*
+ * determine the relative calculatedTreePath of the given iRODS file
+ * underneath the root. There are cases where the root is not '/'.
+ */
+
+ StringBuilder searchRoot = new StringBuilder();
+ IRODSNode currentNode = (IRODSNode) irodsFileSystemModel.getRoot();
+ CollectionAndDataObjectListingEntry entry = (CollectionAndDataObjectListingEntry) currentNode.getUserObject();
+ searchRoot.append(entry.getPathOrName());
+
+ /*
+ * calculatedTreePath now holds the path from the root of iRODS to the
+ * root of the tree, now accumulate any TreePath entries that represent
+ * the path below the root of the tree contained in the absolute path.
+ * The relative path starts at the path component in the position after
+ * the length of the root path.
+ */
+
+ int relativePathStartsAfter = irodsRootNodePathComponents.length - 1;
+ String nextPathComponent;
+
+ for (int i = (relativePathStartsAfter + 1); i < irodsPathComponents.length; i++) {
+ // next element from userObjects is the child of the current node,
+ // note that for the first node (typically
+ // '/') a delimiting slash is not needed
+ if (searchRoot.length() > 1) {
+ searchRoot.append('/');
+ }
+
+ nextPathComponent = irodsPathComponents[i];
+ searchRoot.append(nextPathComponent);
+ if (i > 0) {
+ currentNode = findChild(currentNode, searchRoot.toString());
+ }
+
+ if (currentNode == null) {
+ log.warn(
+ "cannot find node for path, will attempt to return parent {}:",
+ searchRoot.toString());
+ break;
+ } else {
+ // root node is already part of the calculcated tree path
+ if (currentNode.getUserObject().toString().equals("/")) {
+ // ignore this node
+ } else {
+ calculatedTreePath = calculatedTreePath.pathByAddingChild(currentNode);
+ }
+ }
+ }
+ if (calculatedTreePath == null) {
+ throw new IdropException("cannot find path to node:"
+ + irodsAbsolutePath);
+ }
+ return calculatedTreePath;
+ }
+
+
+ public static TreePath[] getPaths(final Outline tree, final boolean expanded) {
+ TreeNode root = (TreeNode) tree.getOutlineModel().getRoot();
+
+ // Create array to hold the treepaths
+ List list = new ArrayList();
+
+ // Traverse tree from root adding treepaths for all nodes to list
+ getPaths(tree, new TreePath(root), expanded, list);
+
+ // Convert list to array
+ return (TreePath[]) list.toArray(new TreePath[list.size()]);
+ }
+
+ private static void getPaths(final Outline tree, final TreePath parent,
+ final boolean expanded, final List list) {
+ // Return if node is not expanded
+ if (expanded && !tree.isVisible(parent)) {
+ return;
+ }
+
+ // Add node to list
+ list.add(parent);
+
+ // Create paths for all children
+ TreeNode node = (TreeNode) parent.getLastPathComponent();
+ if (node.getChildCount() >= 0) {
+ for (Enumeration e = node.children(); e.hasMoreElements();) {
+ TreeNode n = (TreeNode) e.nextElement();
+ TreePath path = parent.pathByAddingChild(n);
+ getPaths(tree, path, expanded, list);
+ }
+ }
+ }
+}
diff --git a/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/IRODSFinderDialog.form b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/IRODSFinderDialog.form
new file mode 100644
index 0000000..14359d1
--- /dev/null
+++ b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/IRODSFinderDialog.form
@@ -0,0 +1,147 @@
+<?xml version="1.1" encoding="UTF-8" ?>
+
+<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
+ <Properties>
+ <Property name="defaultCloseOperation" type="int" value="2"/>
+ <Property name="modal" type="boolean" value="true"/>
+ </Properties>
+ <SyntheticProperties>
+ <SyntheticProperty name="formSizePolicy" type="int" value="1"/>
+ </SyntheticProperties>
+ <AuxValues>
+ <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,2,54,0,0,2,81"/>
+ </AuxValues>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
+ <SubComponents>
+ <Container class="javax.swing.JPanel" name="topPanel">
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
+ <BorderConstraints direction="Center"/>
+ </Constraint>
+ </Constraints>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <EmptySpace min="0" pref="593" max="32767" attributes="0"/>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <EmptySpace min="0" pref="484" max="32767" attributes="0"/>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ </Container>
+ <Container class="javax.swing.JPanel" name="treePanel">
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
+ <BorderConstraints direction="First"/>
+ </Constraint>
+ </Constraints>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
+ <SubComponents>
+ <Container class="javax.swing.JPanel" name="pnlIrodsTreeToolbar">
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
+ <BorderConstraints direction="North"/>
+ </Constraint>
+ </Constraints>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
+ <SubComponents>
+ <Component class="javax.swing.JButton" name="btnRefreshTargetTree">
+ <Properties>
+ <Property name="mnemonic" type="int" value="114"/>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/irods/jargon/idrop/finder/Bundle.properties" key="IRODSFinderDialog.btnRefreshTargetTree.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+ </Property>
+ <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/irods/jargon/idrop/finder/Bundle.properties" key="IRODSFinderDialog.btnRefreshTargetTree.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+ </Property>
+ <Property name="focusable" type="boolean" value="false"/>
+ <Property name="horizontalTextPosition" type="int" value="0"/>
+ <Property name="verticalTextPosition" type="int" value="3"/>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnRefreshTargetTreeActionPerformed"/>
+ </Events>
+ </Component>
+ </SubComponents>
+ </Container>
+ <Container class="javax.swing.JPanel" name="pnlIrodsTreeMaster">
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
+ <BorderConstraints direction="Center"/>
+ </Constraint>
+ </Constraints>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
+ <SubComponents>
+ <Container class="javax.swing.JScrollPane" name="scrollIrodsTree">
+ <Properties>
+ <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="null"/>
+ </Property>
+ <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="null"/>
+ </Property>
+ </Properties>
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
+ <BorderConstraints direction="Center"/>
+ </Constraint>
+ </Constraints>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
+ </Container>
+ </SubComponents>
+ </Container>
+ </SubComponents>
+ </Container>
+ <Container class="javax.swing.JPanel" name="bottomPanel">
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
+ <BorderConstraints direction="Last"/>
+ </Constraint>
+ </Constraints>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
+ <SubComponents>
+ <Component class="javax.swing.JButton" name="btnCancel">
+ <Properties>
+ <Property name="mnemonic" type="int" value="99"/>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/irods/jargon/idrop/finder/Bundle.properties" key="IRODSFinderDialog.btnCancel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+ </Property>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnCancelActionPerformed"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JButton" name="btnSelectFolder">
+ <Properties>
+ <Property name="mnemonic" type="int" value="115"/>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/irods/jargon/idrop/finder/Bundle.properties" key="IRODSFinderDialog.btnSelectFolder.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+ </Property>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnSelectFolderActionPerformed"/>
+ </Events>
+ </Component>
+ </SubComponents>
+ </Container>
+ </SubComponents>
+</Form>
diff --git a/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/IRODSFinderDialog.java b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/IRODSFinderDialog.java
new file mode 100644
index 0000000..c3de81c
--- /dev/null
+++ b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/IRODSFinderDialog.java
@@ -0,0 +1,252 @@
+package org.irods.jargon.idrop.lite.finder;
+
+import javax.swing.ListSelectionModel;
+import org.irods.jargon.core.query.CollectionAndDataObjectListingEntry;
+import org.irods.jargon.idrop.lite.IdropRuntimeException;
+import org.irods.jargon.idrop.lite.iDropLiteCore;
+import org.irods.jargon.idrop.lite.IRODSFileSystemModel;
+import org.irods.jargon.idrop.lite.IRODSNode;
+import org.irods.jargon.idrop.lite.IRODSRowModel;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * @author mikeconway
+ */
+public class IRODSFinderDialog extends javax.swing.JDialog {
+
+ private final iDropLiteCore idropCore;
+ private String selectedAbsolutePath = null;
+
+ public String getSelectedAbsolutePath() {
+ return selectedAbsolutePath;
+ }
+
+ public iDropLiteCore getIdropCore() {
+ return idropCore;
+ }
+
+ public IRODSFinderTree getIrodsTree() {
+ return irodsTree;
+ }
+ private static final org.slf4j.Logger log = LoggerFactory.getLogger(IRODSFinderDialog.class);
+ private IRODSFinderTree irodsTree = null;
+
+ /** Creates new form IRODSFinderDialog */
+ public IRODSFinderDialog(boolean modal, iDropLiteCore idropCore) {
+ //super(parent, modal);
+ super((java.awt.Frame)null, modal);
+
+ if (idropCore == null) {
+ throw new IllegalArgumentException("null idropCore");
+ }
+
+ this.idropCore = idropCore;
+ initComponents();
+ buildTargetTree();
+ }
+
+ /**
+ * build the JTree that will depict the iRODS resource
+ */
+ public void buildTargetTree() {
+ log.info("building tree to look at staging resource");
+ final IRODSFinderDialog gui = this;
+
+ java.awt.EventQueue.invokeLater(new Runnable() {
+
+ @Override
+ public void run() {
+
+
+ CollectionAndDataObjectListingEntry root = new CollectionAndDataObjectListingEntry();
+
+ //if (idropCore.getIdropConfig().isLoginPreset()) {
+ log.info("using policy preset home directory");
+ StringBuilder sb = new StringBuilder();
+ sb.append("/");
+ sb.append(idropCore.getIrodsAccount().getZone());
+ sb.append("/");
+ sb.append("home");
+ root.setParentPath(sb.toString());
+ root.setPathOrName(idropCore.getIrodsAccount().getHomeDirectory());
+ //} else {
+ //log.info("using root path, no login preset");
+ //root.setPathOrName("/");
+ //}
+
+ log.info("building new iRODS tree");
+ try {
+ if (irodsTree == null) {
+ irodsTree = new IRODSFinderTree(gui);
+ IRODSNode rootNode = new IRODSNode(root,
+ idropCore.getIrodsAccount(), idropCore.getIrodsFileSystem(), irodsTree);
+ irodsTree.setRefreshingTree(true);
+ // irodsTree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
+ }
+ IRODSNode rootNode = new IRODSNode(root, idropCore.getIrodsAccount(),
+ idropCore.getIrodsFileSystem(), irodsTree);
+
+ IRODSFileSystemModel irodsFileSystemModel = new IRODSFileSystemModel(
+ rootNode, idropCore.getIrodsAccount());
+ IRODSFinderOutlineModel mdl = new IRODSFinderOutlineModel(idropCore, irodsTree,
+ irodsFileSystemModel, new IRODSRowModel(), true,
+ "File System");
+ irodsTree.setModel(mdl);
+
+
+ } catch (Exception ex) {
+ log.error("exception building finder tree", ex);
+ throw new IdropRuntimeException(ex);
+ } finally {
+ idropCore.getIrodsFileSystem().closeAndEatExceptions(
+ idropCore.getIrodsAccount());
+ }
+
+ scrollIrodsTree.setViewportView(irodsTree);
+ scrollIrodsTree.validate();
+ gui.validate();
+
+ irodsTree.setRefreshingTree(false);
+
+ }
+ });
+ }
+
+
+ /** 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() {
+
+ topPanel = new javax.swing.JPanel();
+ treePanel = new javax.swing.JPanel();
+ pnlIrodsTreeToolbar = new javax.swing.JPanel();
+ btnRefreshTargetTree = new javax.swing.JButton();
+ pnlIrodsTreeMaster = new javax.swing.JPanel();
+ scrollIrodsTree = new javax.swing.JScrollPane();
+ bottomPanel = new javax.swing.JPanel();
+ btnCancel = new javax.swing.JButton();
+ btnSelectFolder = new javax.swing.JButton();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
+ setModal(true);
+
+ org.jdesktop.layout.GroupLayout topPanelLayout = new org.jdesktop.layout.GroupLayout(topPanel);
+ topPanel.setLayout(topPanelLayout);
+ topPanelLayout.setHorizontalGroup(
+ topPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(0, 593, Short.MAX_VALUE)
+ );
+ topPanelLayout.setVerticalGroup(
+ topPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(0, 484, Short.MAX_VALUE)
+ );
+
+ getContentPane().add(topPanel, java.awt.BorderLayout.CENTER);
+
+ treePanel.setLayout(new java.awt.BorderLayout());
+
+ btnRefreshTargetTree.setMnemonic('r');
+ btnRefreshTargetTree.setText(org.openide.util.NbBundle.getMessage(IRODSFinderDialog.class, "IRODSFinderDialog.btnRefreshTargetTree.text")); // NOI18N
+ btnRefreshTargetTree.setToolTipText(org.openide.util.NbBundle.getMessage(IRODSFinderDialog.class, "IRODSFinderDialog.btnRefreshTargetTree.toolTipText")); // NOI18N
+ btnRefreshTargetTree.setFocusable(false);
+ btnRefreshTargetTree.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
+ btnRefreshTargetTree.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
+ btnRefreshTargetTree.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnRefreshTargetTreeActionPerformed(evt);
+ }
+ });
+ pnlIrodsTreeToolbar.add(btnRefreshTargetTree);
+
+ treePanel.add(pnlIrodsTreeToolbar, java.awt.BorderLayout.NORTH);
+
+ pnlIrodsTreeMaster.setLayout(new java.awt.BorderLayout());
+
+ scrollIrodsTree.setMinimumSize(null);
+ scrollIrodsTree.setPreferredSize(null);
+ pnlIrodsTreeMaster.add(scrollIrodsTree, java.awt.BorderLayout.CENTER);
+
+ treePanel.add(pnlIrodsTreeMaster, java.awt.BorderLayout.CENTER);
+
+ getContentPane().add(treePanel, java.awt.BorderLayout.PAGE_START);
+
+ btnCancel.setMnemonic('c');
+ btnCancel.setText(org.openide.util.NbBundle.getMessage(IRODSFinderDialog.class, "IRODSFinderDialog.btnCancel.text")); // NOI18N
+ btnCancel.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnCancelActionPerformed(evt);
+ }
+ });
+ bottomPanel.add(btnCancel);
+
+ btnSelectFolder.setMnemonic('s');
+ btnSelectFolder.setText(org.openide.util.NbBundle.getMessage(IRODSFinderDialog.class, "IRODSFinderDialog.btnSelectFolder.text")); // NOI18N
+ btnSelectFolder.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnSelectFolderActionPerformed(evt);
+ }
+ });
+ bottomPanel.add(btnSelectFolder);
+
+ getContentPane().add(bottomPanel, java.awt.BorderLayout.PAGE_END);
+
+ pack();
+ }// </editor-fold>//GEN-END:initComponents
+
+ private void btnRefreshTargetTreeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRefreshTargetTreeActionPerformed
+ buildTargetTree();
+ }//GEN-LAST:event_btnRefreshTargetTreeActionPerformed
+
+ private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelActionPerformed
+ this.selectedAbsolutePath = null;
+ this.setVisible(false);
+ }//GEN-LAST:event_btnCancelActionPerformed
+
+ private void btnSelectFolderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSelectFolderActionPerformed
+
+ IRODSFinderOutlineModel irodsFileSystemModel = (IRODSFinderOutlineModel) irodsTree.getModel();
+
+
+ ListSelectionModel selectionModel = irodsTree.getSelectionModel();
+ int idx = selectionModel.getLeadSelectionIndex();
+
+ if (idx == -1) {
+ MessageManager.showWarning(this, "Please select a directory", MessageManager.TITLE_MESSAGE);
+ return;
+
+}
+
+ // use first selection for info
+ IRODSNode selectedNode = (IRODSNode) irodsFileSystemModel.getValueAt(
+ idx, 0);
+ log.info("selected node:{}", selectedNode);
+ CollectionAndDataObjectListingEntry entry = (CollectionAndDataObjectListingEntry) selectedNode.getUserObject();
+ if (entry.getObjectType() == CollectionAndDataObjectListingEntry.ObjectType.DATA_OBJECT) {
+ MessageManager.showWarning(this, "Please select a directory", MessageManager.TITLE_MESSAGE);
+ return;
+ }
+
+ this.selectedAbsolutePath = entry.getFormattedAbsolutePath();
+ this.setVisible(false);
+
+ }//GEN-LAST:event_btnSelectFolderActionPerformed
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JPanel bottomPanel;
+ private javax.swing.JButton btnCancel;
+ private javax.swing.JButton btnRefreshTargetTree;
+ private javax.swing.JButton btnSelectFolder;
+ private javax.swing.JPanel pnlIrodsTreeMaster;
+ private javax.swing.JPanel pnlIrodsTreeToolbar;
+ private javax.swing.JScrollPane scrollIrodsTree;
+ private javax.swing.JPanel topPanel;
+ private javax.swing.JPanel treePanel;
+ // End of variables declaration//GEN-END:variables
+
+}
diff --git a/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/IRODSFinderOutlineModel.java b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/IRODSFinderOutlineModel.java
new file mode 100644
index 0000000..6942b13
--- /dev/null
+++ b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/IRODSFinderOutlineModel.java
@@ -0,0 +1,185 @@
+package org.irods.jargon.idrop.lite.finder;
+
+import java.util.Date;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.swing.table.TableModel;
+import javax.swing.tree.TreeModel;
+import javax.swing.tree.TreePath;
+
+import org.irods.jargon.core.exception.JargonException;
+import org.irods.jargon.core.pub.io.IRODSFile;
+import org.irods.jargon.core.pub.io.IRODSFileFactory;
+import org.irods.jargon.core.query.CollectionAndDataObjectListingEntry;
+import org.irods.jargon.core.transfer.TransferStatus;
+import org.irods.jargon.core.transfer.TransferStatus.TransferState;
+import org.irods.jargon.idrop.lite.IRODSFileSystemModel;
+import org.irods.jargon.idrop.lite.IRODSNode;
+import org.irods.jargon.idrop.lite.IRODSOutlineModel;
+import org.irods.jargon.idrop.lite.IRODSTree;
+import org.irods.jargon.idrop.lite.iDropLiteCore;
+import org.irods.jargon.idrop.lite.iDropLiteApplet;
+import org.irods.jargon.idrop.lite.TreeUtils;
+import org.irods.jargon.idrop.lite.IdropException;
+import org.irods.jargon.idrop.lite.IdropRuntimeException;
+import org.netbeans.swing.outline.DefaultOutlineModel;
+import org.netbeans.swing.outline.RowModel;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author Mike Conway - DICE (www.irods.org)
+ */
+public class IRODSFinderOutlineModel extends DefaultOutlineModel {
+
+ public static final org.slf4j.Logger log = LoggerFactory.getLogger(IRODSFinderOutlineModel.class);
+ private final IRODSFileSystemModel treeModel;
+ private final IRODSFinderTree irodsFinderTree;
+ private final iDropLiteCore idropCore;
+
+ public IRODSFileSystemModel getTreeModel() {
+ return treeModel;
+ }
+
+ public IRODSFinderOutlineModel(final iDropLiteCore idropCore, final IRODSFinderTree irodsFinderTree, final TreeModel tm,
+ final TableModel tm1, final boolean bln, final String string) {
+ super(tm, tm1, bln, string);
+ this.treeModel = (IRODSFileSystemModel) tm;
+ this.irodsFinderTree = irodsFinderTree;
+ this.idropCore = idropCore;
+ }
+
+ public IRODSFinderOutlineModel(final iDropLiteCore idropCore,final IRODSFinderTree irodsFinderTree,final TreeModel tm,
+ final RowModel rm, final boolean bln, final String string) {
+ super(tm, rm, bln, string);
+ this.treeModel = (IRODSFileSystemModel) tm;
+ this.irodsFinderTree = irodsFinderTree;
+ this.idropCore = idropCore;
+ }
+
+ public void notifyFileShouldBeRemoved(final IRODSNode deletedNode)
+ throws IdropException {
+
+ if (deletedNode == null) {
+ return;
+ }
+ log.info("deleting node from parent:{}", deletedNode);
+ final IRODSNode parent = (IRODSNode) deletedNode.getParent();
+
+ if (parent == null) {
+ return;
+ }
+
+ final IRODSFinderOutlineModel thisModel = this;
+
+ java.awt.EventQueue.invokeLater(new Runnable() {
+
+ @Override
+ public void run() {
+ deletedNode.getUserObject();
+ CollectionAndDataObjectListingEntry entry = (CollectionAndDataObjectListingEntry) (parent).getUserObject();
+
+ try {
+ FinderUtils.buildTreePathForIrodsAbsolutePath(
+ irodsFinderTree, entry.getFormattedAbsolutePath());
+
+ } catch (IdropException ex) {
+ Logger.getLogger(IRODSOutlineModel.class.getName()).log(
+ Level.SEVERE, null, ex);
+ throw new IdropRuntimeException(ex);
+ }
+
+ treeModel.removeNodeFromParent(deletedNode);
+
+ }
+ });
+ }
+
+
+ public void notifyFileShouldBeAdded(final IRODSTree irodsTree,
+ final String irodsFileAbsolutePath) {
+ log.info("notifyFileShouldBeAdded() for node:{}", irodsFileAbsolutePath);
+
+ java.awt.EventQueue.invokeLater(new Runnable() {
+
+ @Override
+ public void run() {
+
+ IRODSFileFactory irodsFileFactory = idropCore.getIRODSFileFactoryForLoggedInAccount();
+ try {
+ try {
+ // if the node already exists (e.g. an overwrite, don'
+ // add it
+
+ TreePath currentPath = TreeUtils.buildTreePathForIrodsAbsolutePath(irodsTree,
+ irodsFileAbsolutePath);
+ // build treePath will return parent if child not found
+ if (currentPath == null) {
+ log.warn(
+ "null tree path found for:{} logged and ignored as a warning",
+ irodsFileAbsolutePath);
+ return;
+ }
+ IRODSNode irodsNode = (IRODSNode) currentPath.getLastPathComponent();
+ CollectionAndDataObjectListingEntry lastPathNodeEntry = (CollectionAndDataObjectListingEntry) irodsNode.getUserObject();
+ if (irodsFileAbsolutePath.equals(lastPathNodeEntry.getFormattedAbsolutePath())) {
+ log.info("path already exists, do not double-add");
+ return;
+ }
+
+ } catch (IdropException ex) {
+ Logger.getLogger(IRODSOutlineModel.class.getName()).log(Level.SEVERE, null, ex);
+ throw new IdropRuntimeException(ex);
+ }
+
+ IRODSFile addedFile = irodsFileFactory.instanceIRODSFile(irodsFileAbsolutePath);
+ if (!addedFile.exists()) {
+ log.info(
+ "looking for file that was added, I don't find it, so just move on: {}",
+ irodsFileAbsolutePath);
+ return;
+ }
+ TreePath parentPath;
+ try {
+ parentPath = TreeUtils.buildTreePathForIrodsAbsolutePath(irodsTree,
+ addedFile.getParent());
+ } catch (IdropException ex) {
+ Logger.getLogger(IRODSOutlineModel.class.getName()).log(Level.SEVERE, null, ex);
+ throw new IdropRuntimeException(ex);
+ }
+
+ if (parentPath == null) {
+ log.info("null path for lookup, just move on");
+ return;
+ }
+ log.info("building a new node");
+ CollectionAndDataObjectListingEntry newEntry = new CollectionAndDataObjectListingEntry();
+ newEntry.setCreatedAt(new Date(addedFile.lastModified()));
+ newEntry.setDataSize(addedFile.length());
+ newEntry.setModifiedAt(new Date(addedFile.lastModified()));
+
+ if (addedFile.isDirectory()) {
+ newEntry.setObjectType(CollectionAndDataObjectListingEntry.ObjectType.COLLECTION);
+ newEntry.setParentPath(addedFile.getParent());
+ newEntry.setPathOrName(addedFile.getAbsolutePath());
+ } else {
+ newEntry.setObjectType(CollectionAndDataObjectListingEntry.ObjectType.DATA_OBJECT);
+ newEntry.setParentPath(addedFile.getParent());
+ newEntry.setPathOrName(addedFile.getName());
+ }
+
+ IRODSNode newNode = new IRODSNode(newEntry, idropCore.getIrodsAccount(), idropCore.getIrodsFileSystem(), irodsTree);
+ ((IRODSNode) parentPath.getLastPathComponent()).add(newNode);
+ irodsTree.highlightPath(parentPath);
+ } catch (JargonException ex) {
+ Logger.getLogger(IRODSOutlineModel.class.getName()).log(
+ Level.SEVERE, null, ex);
+ } finally {
+ idropCore.closeIRODSConnectionForLoggedInAccount();
+ }
+ }
+ });
+ }
+
+}
+
diff --git a/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/IRODSFinderTree.java b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/IRODSFinderTree.java
new file mode 100644
index 0000000..85a1621
--- /dev/null
+++ b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/IRODSFinderTree.java
@@ -0,0 +1,312 @@
+package org.irods.jargon.idrop.lite.finder;
+
+import java.awt.Cursor;
+import java.awt.event.ActionEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.JOptionPane;
+import javax.swing.JPopupMenu;
+import javax.swing.event.TreeExpansionEvent;
+import javax.swing.event.TreeExpansionListener;
+import javax.swing.event.TreeWillExpandListener;
+import javax.swing.tree.ExpandVetoException;
+import javax.swing.tree.TreeModel;
+import javax.swing.tree.TreePath;
+
+import org.irods.jargon.core.query.CollectionAndDataObjectListingEntry;
+import org.irods.jargon.idrop.lite.DeleteIRODSDialog;
+import org.irods.jargon.idrop.lite.NewIRODSDirectoryDialog;
+import org.irods.jargon.idrop.lite.RenameIRODSDirectoryDialog;
+import org.irods.jargon.idrop.lite.iDropLiteApplet;
+import org.irods.jargon.idrop.lite.IRODSNode;
+import org.irods.jargon.idrop.lite.IRODSRowModel;
+import org.irods.jargon.idrop.lite.IdropException;
+import org.irods.jargon.idrop.lite.IdropRuntimeException;
+import org.netbeans.swing.outline.DefaultOutlineModel;
+import org.netbeans.swing.outline.Outline;
+import org.netbeans.swing.outline.OutlineModel;
+import org.netbeans.swing.outline.TreePathSupport;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Swing JTree component for viewing iRODS server file system
+ *
+ * @author Mike Conway - DICE (www.irods.org)
+ */
+public class IRODSFinderTree extends Outline implements TreeWillExpandListener,
+ TreeExpansionListener, IRODSTreeContainingComponent {
+
+ public IRODSFinderDialog irodsFinderDialog = null;
+ public static org.slf4j.Logger log = LoggerFactory.getLogger(IRODSFinderTree.class);
+ protected JPopupMenu m_popup = null;
+ protected Action m_action;
+ protected TreePath m_clickedPath;
+ protected IRODSFinderTree thisTree;
+ private boolean refreshingTree = false;
+ TreePathSupport tps;
+
+ public boolean isRefreshingTree() {
+ synchronized (this) {
+ return refreshingTree;
+ }
+ }
+
+ public void setRefreshingTree(final boolean refreshingTree) {
+ synchronized (this) {
+ this.refreshingTree = refreshingTree;
+ }
+ }
+
+ public IRODSFinderTree(final TreeModel newModel,final IRODSFinderDialog irodsFinderDialog) {
+ super();
+
+ OutlineModel mdl = DefaultOutlineModel.createOutlineModel(newModel,
+ new IRODSRowModel(), true, "File System");
+ this.irodsFinderDialog = irodsFinderDialog;
+ tps = new TreePathSupport(mdl, this.getLayoutCache());
+
+ tps.addTreeExpansionListener(this);
+ tps.addTreeWillExpandListener(this);
+ initializeMenusAndListeners();
+ }
+
+ public IRODSFinderTree() {
+ super();
+ }
+
+ public IRODSFinderTree(final IRODSFinderDialog irodsFinderDialog) {
+ super();
+ this.irodsFinderDialog = irodsFinderDialog;
+ initializeMenusAndListeners();
+ }
+
+ private void initializeMenusAndListeners() {
+ setDragEnabled(false);
+ setUpTreeMenu();
+ }
+
+ /**
+ * Set up context sensitive tree menu
+ */
+ private void setUpTreeMenu() {
+ thisTree = this;
+
+ m_popup = new JPopupMenu();
+ m_action = new AbstractAction() {
+
+ @Override
+ public void actionPerformed(final ActionEvent e) {
+ if (m_clickedPath == null) {
+ return;
+ }
+
+ if (thisTree.isExpanded(m_clickedPath)) {
+ thisTree.collapsePath(m_clickedPath);
+ } else {
+ thisTree.expandPath(m_clickedPath);
+ }
+ }
+ };
+
+ m_popup.add(m_action);
+
+ Action newAction = new AbstractAction("New Folder") {
+
+ @Override
+ public void actionPerformed(final ActionEvent e) {
+
+ log.info("adding new node");
+
+ IRODSNode parent = (IRODSNode) m_clickedPath.getLastPathComponent();
+ log.info("parent of new node is: {}", parent);
+ CollectionAndDataObjectListingEntry dataEntry = (CollectionAndDataObjectListingEntry) parent.getUserObject();
+ if (dataEntry.getObjectType() == CollectionAndDataObjectListingEntry.ObjectType.DATA_OBJECT) {
+ JOptionPane.showMessageDialog(
+ thisTree,
+ "The selected item is not a folder, cannot create a new directory",
+ "Info", JOptionPane.INFORMATION_MESSAGE);
+ log.info("new folder not created, the selected parent is not a collection");
+ return;
+ }
+ // show a dialog asking for the new directory name...
+
+ FinderNewIRODSDirectoryDialog newDirectoryDialog = new FinderNewIRODSDirectoryDialog(
+ irodsFinderDialog, true, dataEntry.getPathOrName(),
+ thisTree, parent);
+ newDirectoryDialog.setLocation(
+ (int) (irodsFinderDialog.getLocation().getX() + irodsFinderDialog.getWidth() / 2), (int) (irodsFinderDialog.getLocation().getY() + irodsFinderDialog.getHeight() / 2));
+ newDirectoryDialog.setVisible(true);
+
+ }
+ };
+ m_popup.add(newAction);
+
+ m_popup.addSeparator();
+
+ Action a1 = new AbstractAction("Delete") {
+
+ @Override
+ public void actionPerformed(final ActionEvent e) {
+ log.info("deleting a node");
+ int[] rows = thisTree.getSelectedRows();
+ log.debug("selected rows for delete:{}", rows);
+
+
+ FinderDeleteIRODSDialog deleteDialog;
+
+ if (rows.length == 1) {
+
+ IRODSNode toDelete = (IRODSNode) thisTree.getValueAt(
+ rows[0], 0);
+ log.info("deleting a single node: {}", toDelete);
+
+ deleteDialog = new FinderDeleteIRODSDialog(irodsFinderDialog, true,
+ thisTree, toDelete);
+ } else {
+ List<IRODSNode> nodesToDelete = new ArrayList<IRODSNode>();
+ for (int row : rows) {
+ nodesToDelete.add((IRODSNode) thisTree.getValueAt(row,
+ 0));
+
+ }
+
+ deleteDialog = new FinderDeleteIRODSDialog(irodsFinderDialog, true,
+ thisTree, nodesToDelete);
+ }
+
+ deleteDialog.setLocation(
+ (int) (irodsFinderDialog.getLocation().getX() + irodsFinderDialog.getWidth() / 2), (int) (irodsFinderDialog.getLocation().getY() + irodsFinderDialog.getHeight() / 2));
+ deleteDialog.setVisible(true);
+
+ }
+ };
+
+ m_popup.add(a1);
+ Action a2 = new AbstractAction("Rename") {
+
+ @Override
+ public void actionPerformed(final ActionEvent e) {
+ log.info("renaming node");
+
+ IRODSNode toRename = (IRODSNode) m_clickedPath.getLastPathComponent();
+ log.info("node to rename is: {}", toRename);
+ CollectionAndDataObjectListingEntry dataEntry = (CollectionAndDataObjectListingEntry) toRename.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());
+ }
+
+ // show a dialog asking for the new directory name...
+ FinderRenameIRODSDirectoryDialog renameDialog = new FinderRenameIRODSDirectoryDialog(
+ irodsFinderDialog, true, sb.toString(), thisTree, toRename);
+ renameDialog.setLocation(
+ (int) (irodsFinderDialog.getLocation().getX() + irodsFinderDialog.getWidth() / 2), (int) (irodsFinderDialog.getLocation().getY() + irodsFinderDialog.getHeight() / 2));
+ renameDialog.setVisible(true);
+ }
+ };
+ m_popup.add(a2);
+ thisTree.add(m_popup);
+ thisTree.addMouseListener(new PopupTrigger());
+
+ }
+
+ @Override
+ public void treeExpanded(final TreeExpansionEvent event) {
+ }
+
+ @Override
+ public void treeCollapsed(final TreeExpansionEvent event) {
+ }
+
+ class PopupTrigger extends MouseAdapter {
+
+ @Override
+ public void mouseReleased(final MouseEvent e) {
+ if (e.isPopupTrigger()) {
+ int x = e.getX();
+ int y = e.getY();
+
+ TreePath path = thisTree.getClosestPathForLocation(x, y);
+ if (path != null) {
+ if (thisTree.isExpanded(path)) {
+ m_action.putValue(Action.NAME, "Collapse");
+ } else {
+ m_action.putValue(Action.NAME, "Expand");
+ }
+ m_popup.show(thisTree, x, y);
+ m_clickedPath = path;
+ }
+ }
+ }
+
+ @Override
+ public void mousePressed(final MouseEvent e) {
+ if (e.isPopupTrigger()) {
+ int x = e.getX();
+ int y = e.getY();
+ TreePath path = thisTree.getClosestPathForLocation(x, y);
+ if (path != null) {
+ if (thisTree.isExpanded(path)) {
+ m_action.putValue(Action.NAME, "Collapse");
+ } else {
+ m_action.putValue(Action.NAME, "Expand");
+ }
+ m_popup.show(thisTree, x, y);
+ m_clickedPath = path;
+ }
+ }
+ }
+ }
+
+ @Override
+ public void treeWillCollapse(final TreeExpansionEvent event)
+ throws ExpandVetoException {
+ }
+
+ @Override
+ public void treeWillExpand(final TreeExpansionEvent event)
+ throws ExpandVetoException {
+ setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+ log.debug("tree expansion event:{}", event);
+ IRODSNode expandingNode = (IRODSNode) event.getPath().getLastPathComponent();
+ // If I am refreshing the tree, then do not close the connection after
+ // each load. It will be closed in the thing
+ // doing the refreshing
+ try {
+ expandingNode.lazyLoadOfChildrenOfThisNode(!isRefreshingTree());
+ } catch (IdropException ex) {
+ Logger.getLogger(IRODSFinderTree.class.getName()).log(Level.SEVERE, null,
+ ex);
+ throw new IdropRuntimeException("error expanding irodsNode");
+ } finally {
+ setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ }
+ }
+
+ public void highlightPath(final TreePath pathToHighlight) {
+ final IRODSFinderTree highlightTree = this;
+ java.awt.EventQueue.invokeLater(new Runnable() {
+
+ @Override
+ public void run() {
+ highlightTree.collapsePath(pathToHighlight);
+ highlightTree.expandPath(pathToHighlight);
+ // highlightTree.sc
+ // highlightTree.scrollPathToVisible(pathToHighlight);
+ }
+ });
+ }
+}
diff --git a/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/IRODSTreeContainingComponent.java b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/IRODSTreeContainingComponent.java
new file mode 100644
index 0000000..f2bcadc
--- /dev/null
+++ b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/IRODSTreeContainingComponent.java
@@ -0,0 +1,23 @@
+package org.irods.jargon.idrop.lite.finder;
+
+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);
+
+}
diff --git a/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/IrodsSelectionListenerForBuildingInfoPanel.java b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/IrodsSelectionListenerForBuildingInfoPanel.java
new file mode 100644
index 0000000..3dbe017
--- /dev/null
+++ b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/IrodsSelectionListenerForBuildingInfoPanel.java
@@ -0,0 +1,59 @@
+package org.irods.jargon.idrop.lite.finder;
+
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.event.TreeExpansionEvent;
+
+
+import org.irods.jargon.idrop.lite.iDropLiteApplet;
+import org.irods.jargon.idrop.lite.IdropException;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Class to encapsulate handling of info panel. This object will listen to tree
+ * selection events in the iDROP iRODS tree, and initialize the info panel.
+ *
+ *
+ *
+ * @author Mike Conway - DICE (www.irods.org)
+ */
+public class IrodsSelectionListenerForBuildingInfoPanel implements
+ ListSelectionListener {
+
+ public static org.slf4j.Logger log = LoggerFactory.getLogger(IrodsSelectionListenerForBuildingInfoPanel.class);
+ public IrodsSelectionListenerForBuildingInfoPanel(final iDropLiteApplet idrop)
+ throws IdropException {
+ if (idrop == null) {
+ throw new IdropException("null iDrop");
+ }
+
+ }
+
+ public void treeExpanded(final TreeExpansionEvent event) {
+ /*
+ * TreePath expandedTreePath = event.getPath(); IRODSNode expandedNode =
+ * (IRODSNode) expandedTreePath.getLastPathComponent(); try {
+ * identifyNodeTypeAndInitializeInfoPanel(expandedNode); } catch
+ * (IdropException ex) {
+ * Logger.getLogger(IrodsTreeListenerForBuildingInfoPanel
+ * .class.getName()).log(Level.SEVERE, null, ex); throw new
+ * IdropRuntimeException
+ * ("exception processing treeExpanded() event for IRODSNode selection"
+ * ); }
+ */
+ }
+
+ public void treeCollapsed(final TreeExpansionEvent event) {
+ // operation not needed, left for interface contract
+ }
+
+
+ @Override
+ public void valueChanged(final ListSelectionEvent lse) {
+ if (lse.getValueIsAdjusting()) {
+ return;
+ }
+ log.info("lse: {}", lse);
+ //idrop.triggerInfoPanelUpdate();
+ }
+}
diff --git a/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/MessageManager.java b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/MessageManager.java
new file mode 100644
index 0000000..41abcef
--- /dev/null
+++ b/idrop-lite/src/main/java/org/irods/jargon/idrop/lite/finder/MessageManager.java
@@ -0,0 +1,33 @@
+package org.irods.jargon.idrop.lite.finder;
+
+import java.awt.Component;
+
+import javax.swing.JOptionPane;
+
+/**
+ *
+ * @author jdr0887
+ *
+ */
+public class MessageManager {
+
+ public static final String TITLE_MESSAGE = "iDrop Message";
+
+ public static void showError(final Component rootComponent,
+ final String message, final String title) {
+ JOptionPane.showMessageDialog(rootComponent, message, title,
+ JOptionPane.ERROR_MESSAGE);
+ }
+
+ public static void showWarning(final Component rootComponent,
+ final String message, final String title) {
+ JOptionPane.showMessageDialog(rootComponent, message, title,
+ JOptionPane.WARNING_MESSAGE);
+ }
+
+ public static void showMessage(final Component rootComponent,
+ final String message, final String title) {
+ JOptionPane.showMessageDialog(rootComponent, message, title,
+ JOptionPane.INFORMATION_MESSAGE);
+ }
+}
diff --git a/idrop-lite/src/main/resources/org/irods/jargon/idrop/lite/finder/Bundle.properties b/idrop-lite/src/main/resources/org/irods/jargon/idrop/lite/finder/Bundle.properties
new file mode 100644
index 0000000..5dd2f57
--- /dev/null
+++ b/idrop-lite/src/main/resources/org/irods/jargon/idrop/lite/finder/Bundle.properties
@@ -0,0 +1,6 @@
+IRODSFinderDialog.btnRefreshTargetTree.toolTipText=Refresh the view of the iRODS server
+IRODSFinderDialog.btnRefreshTargetTree.text=Refresh
+IRODSFinderDialog.btnSelectFolder.text=Select
+# To change this template, choose Tools | Templates
+# and open the template in the editor.
+IRODSFinderDialog.btnCancel.text=Cancel