fr.ifremer.isisfish.ui.script.model
Class ScriptTreeModel

java.lang.Object
  extended by fr.ifremer.isisfish.ui.script.model.ScriptTreeModel
All Implemented Interfaces:
TreeModel

public class ScriptTreeModel
extends Object
implements TreeModel

Tree model for scripts edition. Tree model is structured as this :

 - root
   - vcs
     - categories
       - files
 

Version:
$Revision: 3436 $ Last update : $Date: 2011-07-07 16:33:45 +0200 (Thu, 07 Jul 2011) $ By : $Author$
Author:
chatellier

Field Summary
protected  org.jdesktop.swingx.tree.TreeModelSupport modelSupport
           
static int OPERATION_ADD
          Add node operation
static int OPERATION_DELETE
          Delete Node operation
static int OPERATION_MODIFY
          Modify node operation
protected  Map<VCS,List<File>> rootFiles
          Categories files for VCS.
protected  List<VCS> vcsList
          VCS list.
 
Constructor Summary
ScriptTreeModel()
           
 
Method Summary
 void addTreeModelListener(TreeModelListener l)
           
 void fileAdded(File file)
          Notify for file addition.
 void fileDeleted(File file)
          Notify for file deletion.
 void fileModified(File file)
          Notify for file modification.
 Object getChild(Object parent, int index)
           
 int getChildCount(Object parent)
           
 int getIndexOfChild(Object parent, Object child)
           
protected  TreePath getRecursiveTreePath(File file, TreePath path)
          Find file in tree, and return tree path.
 Object getRoot()
           
 TreePath getTreePathFor(File file)
          Find tree path for a file
protected  List<File> getVersionnableSortedFiles(File[] filesArray)
          Filter input file array and return only sorted collection with only directories.
 boolean isLeaf(Object node)
           
 void removeTreeModelListener(TreeModelListener l)
           
protected  boolean updateChildren(File file, TreePath path, int operation)
          Notify for tree operation.
 void valueForPathChanged(TreePath path, Object newValue)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

modelSupport

protected org.jdesktop.swingx.tree.TreeModelSupport modelSupport

vcsList

protected List<VCS> vcsList
VCS list.


rootFiles

protected Map<VCS,List<File>> rootFiles
Categories files for VCS.


OPERATION_ADD

public static final int OPERATION_ADD
Add node operation

See Also:
Constant Field Values

OPERATION_MODIFY

public static final int OPERATION_MODIFY
Modify node operation

See Also:
Constant Field Values

OPERATION_DELETE

public static final int OPERATION_DELETE
Delete Node operation

See Also:
Constant Field Values
Constructor Detail

ScriptTreeModel

public ScriptTreeModel()
Method Detail

addTreeModelListener

public void addTreeModelListener(TreeModelListener l)
Specified by:
addTreeModelListener in interface TreeModel

getChild

public Object getChild(Object parent,
                       int index)
Specified by:
getChild in interface TreeModel

getChildCount

public int getChildCount(Object parent)
Specified by:
getChildCount in interface TreeModel

getIndexOfChild

public int getIndexOfChild(Object parent,
                           Object child)
Specified by:
getIndexOfChild in interface TreeModel

getRoot

public Object getRoot()
Specified by:
getRoot in interface TreeModel

isLeaf

public boolean isLeaf(Object node)
Specified by:
isLeaf in interface TreeModel

removeTreeModelListener

public void removeTreeModelListener(TreeModelListener l)
Specified by:
removeTreeModelListener in interface TreeModel

valueForPathChanged

public void valueForPathChanged(TreePath path,
                                Object newValue)
Specified by:
valueForPathChanged in interface TreeModel

getVersionnableSortedFiles

protected List<File> getVersionnableSortedFiles(File[] filesArray)
Filter input file array and return only sorted collection with only directories.

Parameters:
filesArray - file array
Returns:
sorted list

fileAdded

public void fileAdded(File file)
Notify for file addition.

Parameters:
file - added file

fileModified

public void fileModified(File file)
Notify for file modification.

Parameters:
file - modified file

fileDeleted

public void fileDeleted(File file)
Notify for file deletion. TODO must be called "before" effective deletion

Parameters:
file - deleted file

updateChildren

protected boolean updateChildren(File file,
                                 TreePath path,
                                 int operation)
Notify for tree operation.

Parameters:
file -
path - path to update
operation - operation #OPERATION_DELETE #OPERATION_MODIFY
Returns:
true if path has been updated

getTreePathFor

public TreePath getTreePathFor(File file)
Find tree path for a file

Parameters:
file - to search
Returns:
tree path

getRecursiveTreePath

protected TreePath getRecursiveTreePath(File file,
                                        TreePath path)
Find file in tree, and return tree path.

Parameters:
file -
path - path to update
Returns:
tree path


Copyright © 1999-2012 CodeLutin. All Rights Reserved.