diff options
-rw-r--r-- | idrop-swing/pom.xml | 18 | ||||
-rw-r--r-- | idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/iDrop.form | 7 | ||||
-rw-r--r-- | idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/iDrop.java | 103 | ||||
-rw-r--r-- | idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/utils/TreeUtils.java | 84 | ||||
-rw-r--r-- | idrop-swing/src/main/resources/log4j.properties | 2 | ||||
-rw-r--r-- | idrop-web/web-app/WEB-INF/web.xml | 6 | ||||
-rw-r--r-- | pom.xml | 25 |
7 files changed, 134 insertions, 111 deletions
diff --git a/idrop-swing/pom.xml b/idrop-swing/pom.xml index e01aa6a..d09079b 100644 --- a/idrop-swing/pom.xml +++ b/idrop-swing/pom.xml @@ -67,6 +67,12 @@ <groupId>org.swinglabs</groupId> <artifactId>swing-layout</artifactId> </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-core</artifactId> + <version>3.3.2.GA</version> + <scope>runtime</scope> +</dependency> </dependencies> <build> <plugins> @@ -161,18 +167,6 @@ </archive> </configuration> </plugin> - <!-- <plugin> - <groupId>org.dstovall</groupId> - <artifactId>onejar-maven-plugin</artifactId> - <version>1.4.4</version> - <executions> - <execution> - <goals> - <goal>one-jar</goal> - </goals> - </execution> - </executions> - </plugin>--> <plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/iDrop.form b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/iDrop.form index d3b806d..b04342c 100644 --- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/iDrop.form +++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/iDrop.form @@ -1129,11 +1129,6 @@ </SubComponents> </Container> <Container class="javax.swing.JPanel" name="pnlToolbarInfo"> - <Properties> - <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> - <Dimension value="null"/> - </Property> - </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="7" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.8" weightY="0.0"/> @@ -1232,7 +1227,7 @@ </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> - <GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.005" weightY="0.0"/> + <GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0050" weightY="0.0"/> </Constraint> </Constraints> </Component> diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/iDrop.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/iDrop.java index ddc9155..85dabb8 100644 --- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/iDrop.java +++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/iDrop.java @@ -45,6 +45,7 @@ import javax.swing.UIManager; import javax.swing.UIManager.LookAndFeelInfo; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; +import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; import org.irods.jargon.core.connection.IRODSAccount; @@ -532,7 +533,7 @@ public class iDrop extends javax.swing.JFrame implements ActionListener, /** * Handler for iDrop system tray menu options. - * + * * @param e */ @Override @@ -754,6 +755,12 @@ public class iDrop extends javax.swing.JFrame implements ActionListener, // item, or the root of the iRODS tree if none // selected IRODSNode node; + + if (irodsTree.getSelectionModel().getLeadSelectionIndex() < 0) { + if (irodsTree.getRowCount() > 0 ) { + irodsTree.setRowSelectionInterval(0, 0); + } + } if (pnlIrodsInfo.isVisible()) { idropGuiReference.triggerInfoPanelUpdate(); @@ -875,27 +882,17 @@ public class iDrop extends javax.swing.JFrame implements ActionListener, @Override public void run() { + log.debug("refreshing series panel"); + TreePath[] currentPaths = null; + + if (getTreeStagingResource() != null) { + TreeNode root = (TreeNode) irodsTree.getOutlineModel().getRoot(); + log.debug("tree root:{}", root); + TreePath rootPath = TreeUtils.getPath(root); + currentPaths = irodsTree.getOutlineModel().getTreePathSupport().getExpandedDescendants(rootPath); + log.info("expanded paths:{}", currentPaths); + } - /* - * log.debug("refreshing series panel"); Enumeration<TreePath> - * currentPaths = null; TreePath firstVisibleRow = null; - * TreePath rootPath = null; - * - * if (getTreeStagingResource() != null) { TreePath[] - * expandedPaths = TreeUtils.getPaths(getTreeStagingResource(), - * true); //FIXME: get this code out of idrop and put into iRODS - * tree log.info("expanded paths:{}", expandedPaths); rootPath = - * getTreeStagingResource().get getPathForRow(0); // Rectangle - * nodeRectangle = scrollIrodsTree.getViewport().getViewRect(); - * // TreeModel treeModel = getTreeStagingResource().getModel(); - * // TreeNode root = (TreeNode) treeModel.getRoot(); - * currentPaths = - * getTreeStagingResource().getExpandedDescendants(rootPath); - * //firstVisibleRow = - * getTreeStagingResource().getClosestPathForLocation(0, 0); - * log.debug("selected tree node, paths are:{}", currentPaths); - * log.debug("first visible row is:{}", firstVisibleRow); } - */ CollectionAndDataObjectListingEntry root = new CollectionAndDataObjectListingEntry(); if (iDropCore.getIdropConfig().isLoginPreset()) { @@ -911,7 +908,7 @@ public class iDrop extends javax.swing.JFrame implements ActionListener, log.info("using root path, no login preset"); root.setPathOrName("/"); } - + IRODSOutlineModel mdl = null; log.info("building new iRODS tree"); try { if (irodsTree == null) { @@ -919,47 +916,43 @@ public class iDrop extends javax.swing.JFrame implements ActionListener, IRODSNode rootNode = new IRODSNode(root, getIrodsAccount(), getiDropCore().getIrodsFileSystem(), irodsTree); irodsTree.setRefreshingTree(true); + IRODSFileSystemModel irodsFileSystemModel = new IRODSFileSystemModel( + rootNode, getIrodsAccount()); + mdl = new IRODSOutlineModel(gui, + irodsFileSystemModel, new IRODSRowModel(), true, + "File System"); + + irodsTree.setModel(mdl); scrollIrodsTree.setViewportView(irodsTree); + } else { + mdl = (IRODSOutlineModel) irodsTree.getModel(); + IRODSNode rootNode = new IRODSNode(root, getIrodsAccount(), + getiDropCore().getIrodsFileSystem(), irodsTree); + mdl.setValueAt(rootNode, 0, 0); } - IRODSNode rootNode = new IRODSNode(root, getIrodsAccount(), - getiDropCore().getIrodsFileSystem(), irodsTree); - - IRODSFileSystemModel irodsFileSystemModel = new IRODSFileSystemModel( - rootNode, getIrodsAccount()); - IRODSOutlineModel mdl = new IRODSOutlineModel(gui, - 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); - */ + + // mdl.getTreePathSupport().clear(); + if (currentPaths != null) { + IRODSNode irodsNode = null; + TreePath pathOfExpandingNode = null; + log.info("looking to re-expand paths..."); + for (TreePath treePath : currentPaths) { + irodsNode = (IRODSNode) treePath.getLastPathComponent(); + irodsNode.forceReloadOfChildrenOfThisNode(); + irodsTree.collapsePath(treePath); + irodsTree.expandPath(treePath); + } + } + } catch (Exception ex) { Logger.getLogger(iDrop.class.getName()).log(Level.SEVERE, null, ex); throw new IdropRuntimeException(ex); + } finally { + getiDropCore().getIrodsFileSystem().closeAndEatExceptions( + iDropCore.getIrodsAccount()); } - - /* - * TreePath currentPath; - * - * if (currentPaths != null) { while - * (currentPaths.hasMoreElements()) { currentPath = (TreePath) - * currentPaths.nextElement(); - * log.debug("expanding tree path:{}", currentPath); - * irodsTree.expandPath(currentPath); } } - */ - irodsTree.setRefreshingTree(false); - - getiDropCore().getIrodsFileSystem().closeAndEatExceptions( - iDropCore.getIrodsAccount()); } }); } diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/utils/TreeUtils.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/utils/TreeUtils.java index 862d7ad..c09a3ad 100644 --- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/utils/TreeUtils.java +++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/utils/TreeUtils.java @@ -19,6 +19,7 @@ import org.irods.jargon.idrop.desktop.systraygui.viscomponents.LocalFileNode; import org.irods.jargon.idrop.desktop.systraygui.viscomponents.LocalFileSystemModel; import org.irods.jargon.idrop.exceptions.IdropException; import org.netbeans.swing.outline.Outline; +import org.netbeans.swing.outline.TreePathSupport; import org.slf4j.LoggerFactory; /** @@ -30,6 +31,25 @@ public class TreeUtils { public static org.slf4j.Logger log = LoggerFactory.getLogger(TreeUtils.class); + /** + * Given a <code>TreeNode</code> get the corresponding <code>TreePath</code> + * @param treeNode + * @return + */ + public static TreePath getPath(TreeNode treeNode) { + List<Object> nodes = new ArrayList<Object>(); + if (treeNode != null) { + nodes.add(treeNode); + treeNode = treeNode.getParent(); + while (treeNode != null) { + nodes.add(0, treeNode); + treeNode = treeNode.getParent(); + } + } + + return nodes.isEmpty() ? null : new TreePath(nodes.toArray()); + } + public static IRODSNode findChild(final IRODSNode parent, final String userObject) throws IdropException { log.debug("finding child of parent:{}", parent); @@ -345,7 +365,29 @@ public class TreeUtils { tree.collapsePath(parent); } } + + public static void expandAll(final Outline tree, final TreePath parent, + final boolean expand) { + // Traverse 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); + expandAll(tree, path, expand); + } + } + // Expansion or collapse must be done bottom-up + if (expand) { + tree.expandPath(parent); + } else { + tree.collapsePath(parent); + } + } + + + //FIXME: consider getting rid of defunct code below... /** * Given a tree node, get the nodes that are in the given expansion state as * a list of TreePath @@ -371,13 +413,18 @@ public class TreeUtils { } public static TreePath[] getPaths(final Outline tree, final boolean expanded) { + TreeNode root = (TreeNode) tree.getOutlineModel().getRoot(); + log.debug("tree root:{}", root); + TreePath rootPath = getPath(root); + log.debug("root path:{}", rootPath); + TreePathSupport treePathSupport = tree.getOutlineModel().getTreePathSupport(); // 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); + getPaths(tree, new TreePath(root), expanded, list, treePathSupport); // Convert list to array return (TreePath[]) list.toArray(new TreePath[list.size()]); @@ -405,22 +452,33 @@ public class TreeUtils { } private static void getPaths(final Outline tree, final TreePath parent, - final boolean expanded, final List list) { + final boolean expanded, final List list, final TreePathSupport treePathSupport) { // Return if node is not expanded - if (expanded && !tree.isVisible(parent)) { - return; - } + /* if (expanded && !tree.isVisible(parent)) { + return; + }*/ - // Add node to list - list.add(parent); + log.debug("getPaths for parent:{}", 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); + IRODSNode node = (IRODSNode) parent.getLastPathComponent(); + if (treePathSupport.hasBeenExpanded(parent)) { + // Add node to list + log.info("path is expanded, adding to list and checking children"); + list.add(parent); + + if (!node.isCached()) { + log.debug("node not cached, not expanded"); + return; + } + + log.debug("iterating cached children of this node...."); + 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, treePathSupport); + } } } } diff --git a/idrop-swing/src/main/resources/log4j.properties b/idrop-swing/src/main/resources/log4j.properties index 5f3356d..aa32cbd 100644 --- a/idrop-swing/src/main/resources/log4j.properties +++ b/idrop-swing/src/main/resources/log4j.properties @@ -1,6 +1,6 @@ # 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.idrop=DEBUG, A1 log4j.category.org.irods.jargon.core=ERROR, A1 log4j.categor.org.irods.jargon.usertagging=ERROR,A1 log4j.category.org.irods.jargon.transfer=DEBUG, A1 diff --git a/idrop-web/web-app/WEB-INF/web.xml b/idrop-web/web-app/WEB-INF/web.xml new file mode 100644 index 0000000..7f53625 --- /dev/null +++ b/idrop-web/web-app/WEB-INF/web.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> + +</web-app>
\ No newline at end of file @@ -15,7 +15,7 @@ <jargon.version>2.5.0-beta2-SNAPSHOT</jargon.version> <spring.core.version>3.0.5.RELEASE</spring.core.version> <commons.io.version>2.0.1</commons.io.version> - <netbeans.version>RELEASE70</netbeans.version> + <netbeans.version>RELEASE701</netbeans.version> </properties> <issueManagement> <system>gForge</system> @@ -96,12 +96,6 @@ </snapshots> </repository> </repositories> - <pluginRepositories> - <pluginRepository> - <id>onejar-maven-plugin.googlecode.com</id> - <url>http://onejar-maven-plugin.googlecode.com/svn/mavenrepo</url> - </pluginRepository> - </pluginRepositories> <distributionManagement> <repository> <id>renci.repository</id> @@ -321,23 +315,6 @@ <artifactId>swing-layout</artifactId> <version>1.0.3</version> </dependency> - <!-- - <dependency> - <groupId>cookxml</groupId> - <artifactId>cookswing</artifactId> - <version>1.5</version> - </dependency> - <dependency> - <groupId>cookxml</groupId> - <artifactId>cookxml</artifactId> - <version>3.0.1</version> - </dependency> - - <dependency> - <groupId>com.jgoodies</groupId> - <artifactId>validation</artifactId> - <version>2.0.0</version> - </dependency> --> </dependencies> </dependencyManagement> <dependencies> |