Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright (c) 2014 Leibniz Institute of Plant Genetics and Crop Plant Research (IPK), Gatersleben, Germany.
   * All rights reserved. This program and the accompanying materials
   * are made available under the terms of the Creative Commons Attribution-NoDerivatives 4.0 International (CC BY-ND 4.0)
   * which accompanies this distribution, and is available at http://creativecommons.org/licenses/by-nd/4.0/
   *
   * Contributors:
   *      Leibniz Institute of Plant Genetics and Crop Plant Research (IPK), Gatersleben, Germany - RMI Client, FileChooser and WebDAV
   */
 package de.ipk_gatersleben.bit.bi.edal.rmi.client.gui;
 
 import java.util.List;
 import java.util.Map;
 
 
A class which implements TreeWillExpandListener interface, The listener that's notified when a tree expands or collapses a node.

Author(s):
Jinbo Chen
Version:
1.0
 
 
     private final JTree tree;
     private final ClientPrimaryDataDirectory rootDirectory;

    
Constructs a TreeWillExpandListenerAction that is initialized with tree as the jtree component, and rootDirectory as the EDAL Directory. If any of the parameters are null this method will not initialize.

Parameters:
tree the jtree component
rootDirectory the EDAL Directory
 
     public TreeWillExpandListenerAction(final JTree tree,
 	    final ClientPrimaryDataDirectory rootDirectory) {
 	this. = tree;
 	this. = rootDirectory;
     }
 
     @Override
     public void treeWillCollapse(final TreeExpansionEvent e)
 	    throws ExpandVetoException {
     }
 
     @Override
     public void treeWillExpand(final TreeExpansionEvent e)
 	    throws ExpandVetoException {
 	final EdalNode mynodeobj = (EdalNodenode.getUserObject();
 
 	try {
 	    node.removeAllChildren();
 	    final ClientPrimaryDataDirectory curdir = (ClientPrimaryDataDirectory) EdalFileHelper
 		    .getEntity(mynodeobj.getPath(), this.);
 	    final Map<StringClientPrimaryDataEntitydirnamemap = new HashMap<StringClientPrimaryDataEntity>();
 
 	    if (curdir.isDirectory()) {
 		final List<ClientPrimaryDataEntitydirlist = curdir
 		final List<Stringdirnamelist = new ArrayList<String>();
 
 		if (dirlist != null) {
 		    for (final ClientPrimaryDataEntity dir : dirlist) {
 			if (dir.isDirectory()
 				&& !dir.getCurrentVersion().isDeleted()) {
 			    dirnamelist.add(dir.getName());
 			    dirnamemap.put(dir.getName(), dir);
 			}
 		    }
 		}
 		Collections.sort(dirnamelist.);
 
 		for (final String dirname : dirnamelist) {
 		    final DefaultMutableTreeNode child = new EdalMutableTreeModel(
			    new EdalNode(dirname,
				    ((ClientPrimaryDataDirectorydirnamemap
					    .get(dirname)).getPath()));
		    node.add(child);
		}
	    }
	    this..scrollPathToVisible(e.getPath());
catch (final RemoteException e1) {
	    ..error(StackTraceUtil.getStackTrace(e1));
	    ErrorDialog.showError(e1);
catch (final PrimaryDataDirectoryException e1) {
	    ..error(StackTraceUtil.getStackTrace(e1));
	    ErrorDialog.showError(e1);
catch (final NotBoundException e1) {
	    ..error(StackTraceUtil.getStackTrace(e1));
	    ErrorDialog.showError(e1);
catch (final AccessControlException e1) {
		ErrorDialog.showError(e1);
	}
    }
New to GrepCode? Check out our FAQ X