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

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

public class ScriptTreeModel
extends java.lang.Object
implements javax.swing.tree.TreeModel

Tree model for scripts edition.

Version:
$Revision: 2805 $ Last update : $Date: 2009-12-07 16:46:49 +0100 (lun., 07 déc. 2009) $ 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
 java.util.List<java.io.File> rootFiles
           
 
Constructor Summary
ScriptTreeModel()
           
 
Method Summary
 void addTreeModelListener(javax.swing.event.TreeModelListener l)
           
 void fileAdded(java.io.File file)
          Notify for file addition.
 void fileDeleted(java.io.File file)
          Notify for file deletion.
 void fileModified(java.io.File file)
          Notify for file modification.
 java.lang.Object getChild(java.lang.Object parent, int index)
           
 int getChildCount(java.lang.Object parent)
           
 int getIndexOfChild(java.lang.Object parent, java.lang.Object child)
           
protected  javax.swing.tree.TreePath getRecursiveTreePath(java.io.File file, javax.swing.tree.TreePath path)
          Find file in tree, and return tree path.
 java.lang.Object getRoot()
           
 javax.swing.tree.TreePath getTreePathFor(java.io.File file)
          Find tree path for a file
protected  java.util.List<java.io.File> getVersionnableSortedFiles(java.io.File[] filesArray)
          Filter input file array and return only sorted collection with only directories.
 boolean isLeaf(java.lang.Object node)
           
 void removeTreeModelListener(javax.swing.event.TreeModelListener l)
           
protected  boolean updateChildren(java.io.File file, javax.swing.tree.TreePath path, int operation)
          Notify for tree operation.
 void valueForPathChanged(javax.swing.tree.TreePath path, java.lang.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

rootFiles

public java.util.List<java.io.File> rootFiles

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(javax.swing.event.TreeModelListener l)
Specified by:
addTreeModelListener in interface javax.swing.tree.TreeModel

getChild

public java.lang.Object getChild(java.lang.Object parent,
                                 int index)
Specified by:
getChild in interface javax.swing.tree.TreeModel

getChildCount

public int getChildCount(java.lang.Object parent)
Specified by:
getChildCount in interface javax.swing.tree.TreeModel

getIndexOfChild

public int getIndexOfChild(java.lang.Object parent,
                           java.lang.Object child)
Specified by:
getIndexOfChild in interface javax.swing.tree.TreeModel

getRoot

public java.lang.Object getRoot()
Specified by:
getRoot in interface javax.swing.tree.TreeModel

isLeaf

public boolean isLeaf(java.lang.Object node)
Specified by:
isLeaf in interface javax.swing.tree.TreeModel

removeTreeModelListener

public void removeTreeModelListener(javax.swing.event.TreeModelListener l)
Specified by:
removeTreeModelListener in interface javax.swing.tree.TreeModel

valueForPathChanged

public void valueForPathChanged(javax.swing.tree.TreePath path,
                                java.lang.Object newValue)
Specified by:
valueForPathChanged in interface javax.swing.tree.TreeModel

getVersionnableSortedFiles

protected java.util.List<java.io.File> getVersionnableSortedFiles(java.io.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(java.io.File file)
Notify for file addition.

Parameters:
file - added file

fileModified

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

Parameters:
file - modified file

fileDeleted

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

Parameters:
file - deleted file

updateChildren

protected boolean updateChildren(java.io.File file,
                                 javax.swing.tree.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 javax.swing.tree.TreePath getTreePathFor(java.io.File file)
Find tree path for a file

Parameters:
file - to search
Returns:
tree path

getRecursiveTreePath

protected javax.swing.tree.TreePath getRecursiveTreePath(java.io.File file,
                                                         javax.swing.tree.TreePath path)
Find file in tree, and return tree path.

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


Copyright © 1999-2010 CodeLutin. All Rights Reserved.