summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Conway <mikeconway@Mike-Conways-MacBook-Pro.local>2011-07-16 21:32:50 (GMT)
committer Mike Conway <mikeconway@Mike-Conways-MacBook-Pro.local>2011-07-16 21:32:50 (GMT)
commiteb1a0d60664d9b2d95a1b08caf714b15b9176a00 (patch)
tree734c0c1464e4e942caf976fd23ba55437cc718a0
parent2d0b28c33ce48df2fb706774d1d7a116b35332b9 (diff)
downloadQCG-Data-eb1a0d60664d9b2d95a1b08caf714b15b9176a00.zip
QCG-Data-eb1a0d60664d9b2d95a1b08caf714b15b9176a00.tar.gz
QCG-Data-eb1a0d60664d9b2d95a1b08caf714b15b9176a00.tar.bz2
building custom idrop finder as swing JFinder is too buggy
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IRODSTreeContainingComponent.java26
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/IRODSFileChooser.java26
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/IRODSFileSystemChooserView.java243
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/IRODSNode.java5
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/IRODSTree.java3
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/RemoteChooserView.java33
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/SetupWizard.form9
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/SetupWizard.java28
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/finder/IRODSFinderDialog.form159
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/finder/IRODSFinderDialog.java239
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/finder/IRODSFinderOutlineModel.java54
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/finder/IRODSFinderTree.java317
-rw-r--r--idrop-swing/src/main/resources/log4j.properties6
-rw-r--r--idrop-swing/src/main/resources/org/irods/jargon/idrop/finder/Bundle.properties8
14 files changed, 858 insertions, 298 deletions
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IRODSTreeContainingComponent.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IRODSTreeContainingComponent.java
new file mode 100644
index 0000000..4eba86a
--- /dev/null
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/IRODSTreeContainingComponent.java
@@ -0,0 +1,26 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.irods.jargon.idrop.desktop.systraygui;
+
+import java.awt.Cursor;
+
+/**
+ *
+ * @author mikeconway
+ */
+public interface IRODSTreeContainingComponent {
+
+ /**
+ * Indicates a refresh action, this causes connections to be held open across node refreshes
+ * @return
+ */
+ boolean isRefreshingTree();
+
+ /**
+ * allows proper setting of cursor for tree node operations
+ * @param cursor
+ */
+ void setCursor(Cursor cursor);
+}
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/IRODSFileChooser.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/IRODSFileChooser.java
deleted file mode 100644
index 2c0b51c..0000000
--- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/IRODSFileChooser.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.irods.jargon.idrop.desktop.systraygui.viscomponents;
-
-import javax.swing.JFileChooser;
-import org.irods.jargon.idrop.desktop.systraygui.IDROPCore;
-
-/**
- * Chooser control for an iRODS file system
- * @author Mike Conway - DICE (www.irods.org)
- */
-public class IRODSFileChooser extends JFileChooser {
-
- private final IDROPCore idropCore;
-
- public IRODSFileChooser(final IDROPCore idropCore, final String irodsAbsolutePath, final IRODSFileSystemChooserView irodsFileSystemChooserView) {
- super(irodsAbsolutePath, irodsFileSystemChooserView);
- if (idropCore == null) {
- throw new IllegalArgumentException("null idropCore");
- }
-
- this.idropCore = idropCore;
- this.setMultiSelectionEnabled(false);
- this.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
-
- }
-
-}
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/IRODSFileSystemChooserView.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/IRODSFileSystemChooserView.java
deleted file mode 100644
index 2b5af41..0000000
--- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/IRODSFileSystemChooserView.java
+++ /dev/null
@@ -1,243 +0,0 @@
-package org.irods.jargon.idrop.desktop.systraygui.viscomponents;
-
-import java.io.File;
-import java.io.IOException;
-import javax.swing.filechooser.FileSystemView;
-import org.irods.jargon.core.exception.JargonException;
-import org.irods.jargon.core.pub.IRODSFileSystem;
-import org.irods.jargon.core.pub.io.IRODSFile;
-import org.irods.jargon.idrop.desktop.systraygui.IDROPCore;
-import org.irods.jargon.idrop.exceptions.IdropRuntimeException;
-import org.openide.util.Exceptions;
-import org.slf4j.LoggerFactory;
-
-/**
- * Model for an iRODS file chooser. Note that the irodsFIleSystem must be externally managed, such that the connection is closed
- * when the dialog is done
- * @author Mike Conway - DICE (www.irods.org)
- */
-public class IRODSFileSystemChooserView extends FileSystemView {
-
-
- private final IDROPCore idropCore;
- private final IRODSFileSystem irodsFileSystem;
- private static final org.slf4j.Logger log = LoggerFactory.getLogger(IRODSFileSystemChooserView.class);
- private File defaultDirectory = null;
- public static final String NEW_FOLDER = "New Folder";
-
- @Override
- public File getHomeDirectory() {
- return getDefaultDirectory();
- }
-
- IRODSFileSystemChooserView(final IDROPCore idropCore) {
- if (idropCore == null) {
- throw new IllegalArgumentException("null idropCore");
- }
- this.idropCore = idropCore;
- this.irodsFileSystem = idropCore.getIrodsFileSystem();
- }
-
- @Override
- public File createFileObject(File file, String fileName) {
- if (file == null) {
- throw new IllegalArgumentException("null file");
- }
-
- if (fileName == null || fileName.isEmpty()) {
- throw new IllegalArgumentException("fileName is null or empty");
- }
-
- log.info("createFileObject");
- log.info("parent:{}", file.getAbsolutePath());
- log.info("fileName:{}", fileName);
- IRODSFile newFile;
- try {
- newFile = idropCore.getIRODSFileFactoryForLoggedInAccount().instanceIRODSFile(file.getAbsolutePath(), fileName);
- //newFile.mkdirs();
-
- } catch (Exception ex) {
- log.error("error creating file", ex);
- throw new IdropRuntimeException("error creating file", ex);
- }
-
- log.info("irodsFile created");
- return (File) newFile;
- }
-
- @Override
- public File createFileObject(String fileName) {
- if (fileName == null || fileName.isEmpty()) {
- throw new IllegalArgumentException("fileName is null or empty");
- }
-
- log.info("createFileObject");
-
- log.info("fileName:{}", fileName);
- IRODSFile newFile;
- try {
- newFile = idropCore.getIRODSFileFactoryForLoggedInAccount().instanceIRODSFile(fileName);
- // newFile.createNewFile();
-
- } catch (Exception ex) {
- log.error("error creating file", ex);
- throw new IdropRuntimeException("error creating file", ex);
- }
-
- log.info("irodsFile created");
- return (File) newFile;
- }
-
- @Override
- protected File createFileSystemRoot(File file) {
- return super.createFileSystemRoot(file);
- }
-
- @Override
- public File getChild(File file, String fileName) {
-
- if (file == null) {
- throw new IllegalArgumentException("null file");
- }
-
- if (fileName == null || fileName.isEmpty()) {
- throw new IllegalArgumentException("fileName is null or empty");
- }
-
- log.info("getChild");
-
- log.info("fileName:{}", fileName);
- log.info("file:{}", file.getAbsolutePath());
- IRODSFile newFile;
- try {
- newFile = idropCore.getIRODSFileFactoryForLoggedInAccount().instanceIRODSFile(fileName);
-
- } catch (Exception ex) {
- log.error("error creating file", ex);
- throw new IdropRuntimeException("error creating file", ex);
- }
-
- log.info("irodsFile retrieved");
- return (File) newFile;
- }
-
- @Override
- public File getDefaultDirectory() {
- // cache this for a bit more performance
- if (defaultDirectory != null) {
- return defaultDirectory;
- }
-
- String root = null;
- 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 = sb.toString();
- } else {
- log.info("using root path, no login preset");
- root = "/";
- }
- IRODSFile newFile;
- try {
- newFile = idropCore.getIRODSFileFactoryForLoggedInAccount().instanceIRODSFile(root);
- } catch (Exception ex) {
- log.error("error creating file", ex);
- throw new IdropRuntimeException("error creating file", ex);
- }
-
- log.info("irodsFile retrieved");
- defaultDirectory = (File) newFile;
- return defaultDirectory;
- }
-
- @Override
- public File[] getFiles(File file, boolean showHidden) {
-
- log.info("getFiles");
- if (file == null) {
- throw new IllegalArgumentException("null file");
- }
-
- log.info("file:{}", file.getAbsolutePath());
- IRODSFile newFile;
- try {
- newFile = (IRODSFile) file;
- log.info("irodsFiles listing...");
- return newFile.listFiles();
- } catch (Exception ex) {
- log.error("error listing file", ex);
- throw new IdropRuntimeException("error listing file", ex);
- }
- }
-
- @Override
- public File[] getRoots() {
- log.info("getRoots() returns the default directory");
- File[] roots = { getDefaultDirectory()};
- return roots;
- }
-
- @Override
- public String getSystemDisplayName(File file) {
- return file.getName();
- }
-
- @Override
- public boolean isFileSystem(File file) {
- return true;
- }
-
- @Override
- public boolean isHiddenFile(File file) {
- // FIXME: implement this
- return super.isHiddenFile(file);
- }
-
- @Override
- public boolean isParent(File file, File file1) {
- return true;
- }
-
- @Override
- public boolean isRoot(File file) {
- log.info("isRoot");
- File rootFile = getDefaultDirectory();
- if (file.equals(rootFile)) {
- return true;
- } else {
- return false;
- }
-
- }
-
- @Override
- public Boolean isTraversable(File file) {
- return true;
- }
-
-
- @Override
- public File createNewFolder(File file) throws IOException {
- if (file == null) {
- throw new IllegalArgumentException("null file");
- }
-
- log.info("createNewFolder");
- log.info("folderName:{}", file.getAbsolutePath());
- IRODSFile newFile;
- try {
- newFile = idropCore.getIRODSFileFactoryForLoggedInAccount().instanceIRODSFile(file.getAbsolutePath(), NEW_FOLDER);
- //newFile.mkdirs();
- } catch (Exception ex) {
- log.error("error creating folder", ex);
- throw new IdropRuntimeException("error creating folder", ex);
- }
-
- log.info("irodsFile created");
- return (File) newFile;
- }
-}
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/IRODSNode.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/IRODSNode.java
index 90b5673..a9aed3b 100644
--- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/IRODSNode.java
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/IRODSNode.java
@@ -12,6 +12,7 @@ import org.irods.jargon.core.connection.IRODSAccount;
import org.irods.jargon.core.pub.CollectionAndDataObjectListAndSearchAO;
import org.irods.jargon.core.pub.IRODSFileSystem;
import org.irods.jargon.core.query.CollectionAndDataObjectListingEntry;
+import org.irods.jargon.idrop.desktop.systraygui.IRODSTreeContainingComponent;
import org.irods.jargon.idrop.exceptions.IdropException;
import org.irods.jargon.idrop.exceptions.IdropRuntimeException;
import org.slf4j.LoggerFactory;
@@ -29,11 +30,11 @@ public class IRODSNode extends DefaultMutableTreeNode {
public final IRODSFileSystem irodsFileSystem;
public boolean hasMore = true;
public boolean continuation = false;
- private final IRODSTree irodsTree;
+ private final IRODSTreeContainingComponent irodsTree;
public IRODSNode(final CollectionAndDataObjectListingEntry entry,
final IRODSAccount irodsAccount,
- final IRODSFileSystem irodsFileSystem, final IRODSTree irodsTree) {
+ final IRODSFileSystem irodsFileSystem, final IRODSTreeContainingComponent irodsTree) {
super(entry);
if (irodsAccount == null) {
throw new IdropRuntimeException("null irodsAccount");
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/IRODSTree.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/IRODSTree.java
index 2806231..c93ec00 100644
--- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/IRODSTree.java
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/IRODSTree.java
@@ -22,6 +22,7 @@ import javax.swing.tree.TreePath;
import org.irods.jargon.core.query.CollectionAndDataObjectListingEntry;
import org.irods.jargon.idrop.desktop.systraygui.DeleteIRODSDialog;
+import org.irods.jargon.idrop.desktop.systraygui.IRODSTreeContainingComponent;
import org.irods.jargon.idrop.desktop.systraygui.NewIRODSDirectoryDialog;
import org.irods.jargon.idrop.desktop.systraygui.RenameIRODSDirectoryDialog;
import org.irods.jargon.idrop.desktop.systraygui.iDrop;
@@ -39,7 +40,7 @@ import org.slf4j.LoggerFactory;
* @author Mike Conway - DICE (www.irods.org)
*/
public class IRODSTree extends Outline implements TreeWillExpandListener,
- TreeExpansionListener {
+ TreeExpansionListener, IRODSTreeContainingComponent {
public static org.slf4j.Logger log = LoggerFactory.getLogger(IRODSTree.class);
protected iDrop idropParentGui = null;
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/RemoteChooserView.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/RemoteChooserView.java
new file mode 100644
index 0000000..d37ce09
--- /dev/null
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/RemoteChooserView.java
@@ -0,0 +1,33 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.irods.jargon.idrop.desktop.systraygui.viscomponents;
+
+import java.io.File;
+
+/**
+ *
+ * @author mikeconway
+ */
+public interface RemoteChooserView {
+ /**
+ * Returns the children of the parent directory.
+ */
+ public File[] getChildren(File aDir);
+ /**
+ * Returns the root (in this case, Baseball).
+ */
+ public File getRoot();
+
+ /**
+ * Creates a new folder in the containing directory.
+ */
+ public File createNewFolder(File aContainingDir);
+ /**
+ * Determines if the file should be displayed
+ * based on the current filter.
+ */
+ public boolean acceptFilter(File aFile,
+ String aCurrentFilter);
+}
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/SetupWizard.form b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/SetupWizard.form
index 4aa1078..0630b6c 100644
--- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/SetupWizard.form
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/SetupWizard.form
@@ -3,7 +3,6 @@
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
- <Property name="undecorated" type="boolean" value="true"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
@@ -179,11 +178,6 @@
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane2">
- <Properties>
- <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
- <Dimension value="null"/>
- </Property>
- </Properties>
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
@@ -200,9 +194,6 @@
<ResourceString bundle="org/irods/jargon/idrop/desktop/systraygui/viscomponents/Bundle.properties" key="SetupWizard.txtSeeIcon1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="wrapStyleWord" type="boolean" value="true"/>
- <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>
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/SetupWizard.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/SetupWizard.java
index 039163e..9da01c3 100644
--- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/SetupWizard.java
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/SetupWizard.java
@@ -1,9 +1,4 @@
/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
-/*
* SetupWizard.java
*
* Created on Jul 12, 2011, 5:54:17 PM
@@ -20,6 +15,7 @@ import org.irods.jargon.idrop.desktop.systraygui.iDrop;
import org.irods.jargon.idrop.desktop.systraygui.services.IdropConfigurationService;
import org.irods.jargon.idrop.exceptions.IdropException;
import org.irods.jargon.idrop.exceptions.IdropRuntimeException;
+import org.irods.jargon.idrop.finder.IRODSFinderDialog;
import org.openide.util.Exceptions;
import org.slf4j.LoggerFactory;
@@ -103,9 +99,8 @@ public class SetupWizard extends javax.swing.JDialog {
btnLater = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
- setUndecorated(true);
- panelTop.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N
+ panelTop.setFont(new java.awt.Font("Lucida Grande", 0, 12));
lblWelcome.setFont(new java.awt.Font("Lucida Grande", 0, 18));
lblWelcome.setText(org.openide.util.NbBundle.getMessage(SetupWizard.class, "SetupWizard.lblWelcome.text")); // NOI18N
@@ -162,15 +157,12 @@ public class SetupWizard extends javax.swing.JDialog {
panelTabNameDevice.setLayout(new java.awt.BorderLayout());
- jScrollPane2.setPreferredSize(null);
-
txtSeeIcon1.setColumns(60);
txtSeeIcon1.setEditable(false);
txtSeeIcon1.setLineWrap(true);
txtSeeIcon1.setRows(8);
txtSeeIcon1.setText(org.openide.util.NbBundle.getMessage(SetupWizard.class, "SetupWizard.txtSeeIcon1.text")); // NOI18N
txtSeeIcon1.setWrapStyleWord(true);
- txtSeeIcon1.setMinimumSize(null);
txtSeeIcon1.setPreferredSize(null);
jScrollPane2.setViewportView(txtSeeIcon1);
@@ -368,15 +360,23 @@ public class SetupWizard extends javax.swing.JDialog {
private void btnChooseLocalSynchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnChooseLocalSynchActionPerformed
// TODO add your handling code here:
JFileChooser localFileChooser = new JFileChooser();
- localFileChooser.setMultiSelectionEnabled(false);
+ localFileChooser.setMultiSelectionEnabled(false);
localFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
int returnVal = localFileChooser.showOpenDialog(this);
}//GEN-LAST:event_btnChooseLocalSynchActionPerformed
private void btnChooseIrodsSynchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnChooseIrodsSynchActionPerformed
- IRODSFileSystemChooserView irodsFileSystemChooserView = new IRODSFileSystemChooserView(idropCore);
- IRODSFileChooser irodsFileChooser = new IRODSFileChooser(idropCore, idropCore.getDefaultDirectory().getAbsolutePath(), irodsFileSystemChooserView);
- int returnVal = irodsFileChooser.showOpenDialog(this);
+ try {
+ IRODSFinderDialog irodsFileSystemChooserView = new IRODSFinderDialog(null, true, idropCore);
+ irodsFileSystemChooserView.setVisible(true);
+
+ // int returnVal = irodsFileChooser.showSaveDialog(this);
+ } catch (Exception e) {
+ log.error("exception choosings iRODS file");
+ throw new IdropRuntimeException("exception choosing irods fie", e);
+ } finally {
+ idropCore.getIrodsFileSystem().closeAndEatExceptions();
+ }
}//GEN-LAST:event_btnChooseIrodsSynchActionPerformed
private void btnSeeSystemTrayNoActionPerformed(
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/finder/IRODSFinderDialog.form b/idrop-swing/src/main/java/org/irods/jargon/idrop/finder/IRODSFinderDialog.form
new file mode 100644
index 0000000..4a2b0a0
--- /dev/null
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/finder/IRODSFinderDialog.form
@@ -0,0 +1,159 @@
+<?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"/>
+ </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,1,-15"/>
+ </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="497" max="32767" attributes="0"/>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <EmptySpace min="0" pref="0" 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>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <EmptySpace min="0" pref="497" max="32767" attributes="0"/>
+ <Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <EmptySpace min="0" pref="60" max="32767" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="pnlIrodsTreeToolbar" min="-2" pref="377" max="-2" attributes="0"/>
+ <Component id="pnlIrodsTreeMaster" min="-2" pref="377" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace min="0" pref="60" max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <EmptySpace min="0" pref="527" max="32767" attributes="0"/>
+ <Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
+ <Component id="pnlIrodsTreeToolbar" min="-2" max="-2" attributes="0"/>
+ <Component id="pnlIrodsTreeMaster" min="-2" pref="488" max="-2" attributes="0"/>
+ <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Container class="javax.swing.JPanel" name="pnlIrodsTreeToolbar">
+
+ <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">
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
+ <SubComponents>
+ <Container class="javax.swing.JScrollPane" name="scrollIrodsTree">
+ <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="btnNewFolder">
+ <Properties>
+ <Property name="mnemonic" type="int" value="110"/>
+ <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.btnNewFolder.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+ </Property>
+ </Properties>
+ </Component>
+ <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>
+ </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>
+ </Component>
+ </SubComponents>
+ </Container>
+ </SubComponents>
+</Form>
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/finder/IRODSFinderDialog.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/finder/IRODSFinderDialog.java
new file mode 100644
index 0000000..d2c1483
--- /dev/null
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/finder/IRODSFinderDialog.java
@@ -0,0 +1,239 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+/*
+ * IRODSFinderDialog.java
+ *
+ * Created on Jul 16, 2011, 1:58:04 PM
+ */
+package org.irods.jargon.idrop.finder;
+
+import java.util.logging.Level;
+import org.irods.jargon.core.query.CollectionAndDataObjectListingEntry;
+import org.irods.jargon.idrop.desktop.systraygui.IDROPCore;
+import org.irods.jargon.idrop.desktop.systraygui.IRODSTreeContainingComponent;
+import org.irods.jargon.idrop.desktop.systraygui.viscomponents.IRODSFileSystemModel;
+import org.irods.jargon.idrop.desktop.systraygui.viscomponents.IRODSNode;
+import org.irods.jargon.idrop.desktop.systraygui.viscomponents.IRODSOutlineModel;
+import org.irods.jargon.idrop.desktop.systraygui.viscomponents.IRODSRowModel;
+import org.irods.jargon.idrop.exceptions.IdropRuntimeException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * @author mikeconway
+ */
+public class IRODSFinderDialog extends javax.swing.JDialog {
+
+ private final IDROPCore idropCore;
+ private static final org.slf4j.Logger log = LoggerFactory.getLogger(IRODSFinderDialog.class);
+ private IRODSFinderTree irodsTree = null;
+
+ /** Creates new form IRODSFinderDialog */
+ public IRODSFinderDialog(java.awt.Frame parent, boolean modal, IDROPCore idropCore) {
+ super(parent, 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(
+ irodsFileSystemModel, new IRODSRowModel(), true,
+ "File System");
+ irodsTree.setModel(mdl);
+
+ /*
+ * IrodsTreeListenerForBuildingInfoPanel treeListener = new
+ * IrodsTreeListenerForBuildingInfoPanel(gui);
+ * irodsTree.addTreeExpansionListener(treeListener);
+ * irodsTree.addTreeSelectionListener(treeListener); //
+ * preset to display root tree node
+ * irodsTree.setSelectionRow(0);
+ */
+ } catch (Exception ex) {
+ log.error("exception building finder tree", ex);
+ throw new IdropRuntimeException(ex);
+ }
+
+ scrollIrodsTree.setViewportView(irodsTree);
+ /*
+ * TreePath currentPath;
+ *
+ * if (currentPaths != null) { while
+ * (currentPaths.hasMoreElements()) { currentPath = (TreePath)
+ * currentPaths.nextElement();
+ * log.debug("expanding tree path:{}", currentPath);
+ * irodsTree.expandPath(currentPath); } }
+ */
+ irodsTree.setRefreshingTree(false);
+
+ idropCore.getIrodsFileSystem().closeAndEatExceptions(
+ idropCore.getIrodsAccount());
+ }
+ });
+ }
+
+
+ /** 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();
+ btnNewFolder = new javax.swing.JButton();
+ btnCancel = new javax.swing.JButton();
+ btnSelectFolder = new javax.swing.JButton();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
+
+ 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, 497, Short.MAX_VALUE)
+ );
+ topPanelLayout.setVerticalGroup(
+ topPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(0, 0, Short.MAX_VALUE)
+ );
+
+ getContentPane().add(topPanel, java.awt.BorderLayout.CENTER);
+
+ 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);
+
+ pnlIrodsTreeMaster.setLayout(new java.awt.BorderLayout());
+ pnlIrodsTreeMaster.add(scrollIrodsTree, java.awt.BorderLayout.CENTER);
+
+ org.jdesktop.layout.GroupLayout treePanelLayout = new org.jdesktop.layout.GroupLayout(treePanel);
+ treePanel.setLayout(treePanelLayout);
+ treePanelLayout.setHorizontalGroup(
+ treePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(0, 497, Short.MAX_VALUE)
+ .add(treePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(treePanelLayout.createSequentialGroup()
+ .add(0, 60, Short.MAX_VALUE)
+ .add(treePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(pnlIrodsTreeToolbar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 377, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ .add(pnlIrodsTreeMaster, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 377, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
+ .add(0, 60, Short.MAX_VALUE)))
+ );
+ treePanelLayout.setVerticalGroup(
+ treePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(0, 527, Short.MAX_VALUE)
+ .add(treePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(treePanelLayout.createSequentialGroup()
+ .add(0, 0, Short.MAX_VALUE)
+ .add(pnlIrodsTreeToolbar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ .add(pnlIrodsTreeMaster, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 488, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ .add(0, 0, Short.MAX_VALUE)))
+ );
+
+ getContentPane().add(treePanel, java.awt.BorderLayout.PAGE_START);
+
+ btnNewFolder.setMnemonic('n');
+ btnNewFolder.setText(org.openide.util.NbBundle.getMessage(IRODSFinderDialog.class, "IRODSFinderDialog.btnNewFolder.text")); // NOI18N
+ bottomPanel.add(btnNewFolder);
+
+ btnCancel.setMnemonic('c');
+ btnCancel.setText(org.openide.util.NbBundle.getMessage(IRODSFinderDialog.class, "IRODSFinderDialog.btnCancel.text")); // NOI18N
+ bottomPanel.add(btnCancel);
+
+ btnSelectFolder.setMnemonic('s');
+ btnSelectFolder.setText(org.openide.util.NbBundle.getMessage(IRODSFinderDialog.class, "IRODSFinderDialog.btnSelectFolder.text")); // NOI18N
+ 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
+ // TODO add your handling code here:
+ }//GEN-LAST:event_btnRefreshTargetTreeActionPerformed
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JPanel bottomPanel;
+ private javax.swing.JButton btnCancel;
+ private javax.swing.JButton btnNewFolder;
+ 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-swing/src/main/java/org/irods/jargon/idrop/finder/IRODSFinderOutlineModel.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/finder/IRODSFinderOutlineModel.java
new file mode 100644
index 0000000..09f443e
--- /dev/null
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/finder/IRODSFinderOutlineModel.java
@@ -0,0 +1,54 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.irods.jargon.idrop.finder;
+
+import org.irods.jargon.idrop.desktop.systraygui.viscomponents.*;
+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.desktop.systraygui.iDrop;
+import org.irods.jargon.idrop.desktop.systraygui.utils.TreeUtils;
+import org.irods.jargon.idrop.exceptions.IdropException;
+import org.irods.jargon.idrop.exceptions.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;
+
+ public IRODSFileSystemModel getTreeModel() {
+ return treeModel;
+ }
+
+ public IRODSFinderOutlineModel(final TreeModel tm,
+ final TableModel tm1, final boolean bln, final String string) {
+ super(tm, tm1, bln, string);
+ this.treeModel = (IRODSFileSystemModel) tm;
+ }
+
+ public IRODSFinderOutlineModel(final TreeModel tm,
+ final RowModel rm, final boolean bln, final String string) {
+ super(tm, rm, bln, string);
+ this.treeModel = (IRODSFileSystemModel) tm;
+ }
+
+}
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/finder/IRODSFinderTree.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/finder/IRODSFinderTree.java
new file mode 100644
index 0000000..a05edbe
--- /dev/null
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/finder/IRODSFinderTree.java
@@ -0,0 +1,317 @@
+package org.irods.jargon.idrop.finder;
+
+import org.irods.jargon.idrop.finder.IRODSFinderDialog;
+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.desktop.systraygui.DeleteIRODSDialog;
+import org.irods.jargon.idrop.desktop.systraygui.IRODSTreeContainingComponent;
+import org.irods.jargon.idrop.desktop.systraygui.NewIRODSDirectoryDialog;
+import org.irods.jargon.idrop.desktop.systraygui.RenameIRODSDirectoryDialog;
+import org.irods.jargon.idrop.desktop.systraygui.iDrop;
+import org.irods.jargon.idrop.desktop.systraygui.viscomponents.IRODSNode;
+import org.irods.jargon.idrop.desktop.systraygui.viscomponents.IRODSRowModel;
+import org.irods.jargon.idrop.exceptions.IdropException;
+import org.irods.jargon.idrop.exceptions.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...
+ /* FIXME: implement
+ NewIRODSDirectoryDialog newDirectoryDialog = new NewIRODSDirectoryDialog(
+ idropParentGui, true, dataEntry.getPathOrName(),
+ thisTree, parent);
+ newDirectoryDialog.setLocation(
+ (int) (idropParentGui.getLocation().getX() + idropParentGui.getWidth() / 2), (int) (idropParentGui.getLocation().getY() + idropParentGui.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);
+
+ /* FIXME: redo
+ DeleteIRODSDialog deleteDialog;
+
+ if (rows.length == 1) {
+
+ IRODSNode toDelete = (IRODSNode) thisTree.getValueAt(
+ rows[0], 0);
+ log.info("deleting a single node: {}", toDelete);
+
+ deleteDialog = new DeleteIRODSDialog(idropParentGui, true,
+ thisTree, toDelete);
+ } else {
+ List<IRODSNode> nodesToDelete = new ArrayList<IRODSNode>();
+ for (int row : rows) {
+ nodesToDelete.add((IRODSNode) thisTree.getValueAt(row,
+ 0));
+
+ }
+
+ deleteDialog = new DeleteIRODSDialog(idropParentGui, true,
+ thisTree, nodesToDelete);
+ }
+
+ deleteDialog.setLocation(
+ (int) (idropParentGui.getLocation().getX() + idropParentGui.getWidth() / 2), (int) (idropParentGui.getLocation().getY() + idropParentGui.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());
+ }
+/* FIXME redo
+ // show a dialog asking for the new directory name...
+ RenameIRODSDirectoryDialog renameDialog = new RenameIRODSDirectoryDialog(
+ idropParentGui, true, sb.toString(), thisTree, toRename);
+ renameDialog.setLocation(
+ (int) (idropParentGui.getLocation().getX() + idropParentGui.getWidth() / 2), (int) (idropParentGui.getLocation().getY() + idropParentGui.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-swing/src/main/resources/log4j.properties b/idrop-swing/src/main/resources/log4j.properties
index e57c1e9..9434b5a 100644
--- a/idrop-swing/src/main/resources/log4j.properties
+++ b/idrop-swing/src/main/resources/log4j.properties
@@ -1,10 +1,10 @@
# Set root logger level to DEBUG and its only appender to A1.
#log4j.rootCategory=WARN, A1
log4j.category.org.irods.jargon.idrop=INFO, A1
-log4j.category.org.irods.jargon.core=INFO, A1
-log4j.categor.org.irods.jargon.usertagging=INFO,A1
+log4j.category.org.irods.jargon.core=ERROR, A1
+log4j.categor.org.irods.jargon.usertagging=ERROR,A1
log4j.category.org.irods.jargon.transfer=INFO, A1
-log4j.category.org.irods.jargon.datautils=DEBUG, A1
+log4j.category.org.irods.jargon.datautils=WARN, A1
log4j.category.org.hibernate=ERROR, A1
diff --git a/idrop-swing/src/main/resources/org/irods/jargon/idrop/finder/Bundle.properties b/idrop-swing/src/main/resources/org/irods/jargon/idrop/finder/Bundle.properties
new file mode 100644
index 0000000..fddf9ac
--- /dev/null
+++ b/idrop-swing/src/main/resources/org/irods/jargon/idrop/finder/Bundle.properties
@@ -0,0 +1,8 @@
+# To change this template, choose Tools | Templates
+# and open the template in the editor.
+
+IRODSFinderDialog.btnCancel.text=Cancel
+IRODSFinderDialog.btnRefreshTargetTree.toolTipText=Refresh the view of the iRODS server
+IRODSFinderDialog.btnRefreshTargetTree.text=Refresh
+IRODSFinderDialog.btnNewFolder.text=New Folder
+IRODSFinderDialog.btnSelectFolder.text=Select