LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.app.behavior
Class LyTreeBehavior

java.lang.Object
  extended by leon.app.behavior.LyBehavior
      extended by leon.app.behavior.LyActionBehavior
          extended by leon.app.behavior.LyPanelBehavior
              extended by leon.app.behavior.LyTreeBehavior
All Implemented Interfaces:
LyActionBehaviorInterface, LyBehaviorInterface, LyPanelBehaviorInterface, LyTreeBaseBehaviorInterface, LyTreeBehaviorInterface, LyGetSessionInterface

public class LyTreeBehavior
extends LyPanelBehavior
implements LyTreeBehaviorInterface

This class implements the default behavior for a LyTreeController.

See Also:
LyTreeController, LyTreeBehaviorInterface

Field Summary
static java.lang.String __VERSION
          File version
 
Constructor Summary
LyTreeBehavior()
          Default constructor.
 
Method Summary
 LyTreeNode buildTreeNode(java.lang.Object nodeObject, LyTreeBaseController controller)
          Build a view object instance from the given application object.
 void dragFinished(LyTreeController treeController, int type)
          Method called at the end of a drag-and-drop.
 void dragStart(LyTreeController treeController, LyObject draggedObject)
          Method invoked at the beginning of the given object drag.
 void drop(LyTreeController treeController, LyObject droppedObject, LyObject draggedObject)
          Method called when the given dragged object is dropped on the given dropped object.
 LyInfoList<LyClassInfo> getClassInfos(LyTreeController controller)
          Gets the list of all classInfos that can be found in the tree.
 LyInfoDataList<LyAction,LyClassInfo> getExtraPopupMenuActions(LyTreeController treeController, LyInfoDataList<LyAction,LyClassInfo> actions, LyClassInfo classInfo, LyInfoList<LyClassInfo> sons)
          Gets the ordered list of pairs of (action, classInfo) to display in popup menu.
 LyFilter getFilter(LyTreeController controller, java.lang.String level)
          Gets the filter used in the tree for the given level.
 LyObjectList getParents(java.lang.Object nodeObject, LyTreeController controller)
          Gets the given node parent objects list.
 LyObjectList getSons(LyObject parentNodeObject, LyTreeNode treeNode, java.lang.String level, LyTreeController controller)
          Gets all children objects of the given parent.
 LyObjectList getSons(LyObject parentNodeObject, java.lang.String level, LyTreeController controller)
          Deprecated. Since V3.3, use getSons(LyObject, LyTreeNode, String, LyTreeController).
 LyInfoList<LyClassInfo> getSonsClassInfos(LyClassInfo parentClassInfo, java.lang.String parentLevel, LyTreeController controller)
          Gets the list of classInfo that represent the possibles children of the given classInfo at the given level.
 LySort getSort(LyTreeController controller, java.lang.String level)
          Gets the sort used in the tree for the given level.
 java.lang.Object getTreeRootObject(LyTreeBaseController controller)
          Gets the tree root node.
 LyObjectList getTreeSons(java.lang.Object parentNodeObject, LyInfoList<LyClassInfo> classInfos, LyTreeController controller)
          Deprecated. use getSons(LyObject, String, LyTreeController)
 boolean handleDemand(LyController controller, LyDemand demand)
          Handle a demand raised by the view
 boolean isSorted(LyTreeController controller)
          Indicates if data in the tree are sorted or not.
 void selectionChanged(LyTreeController controller)
          Method invoked when the selection has changed in the tree view.
 void updateTreeNode(java.lang.Object nodeObject, LyTreeNode treeNode, LyTreeBaseController controller)
          Updates the given tree node view object status (colors, label, border, style ...) from the given node object properties.
 void validityModified(LyTreeNode treeNode, LyTreeBaseController controller)
          Method invoked when a validity changed in a three state tree (valid, invalid, partially).
 
Methods inherited from class leon.app.behavior.LyPanelBehavior
completePopupMenu, getPopupMenuActions, getTitle, needRefresh, validateFilter
 
Methods inherited from class leon.app.behavior.LyActionBehavior
endAction, getClientContext, getContextTitle, getHelpFile, getImage, getImageTooltip, getKeyValue, getMenuItemImage, reset, startAction
 
Methods inherited from class leon.app.behavior.LyBehavior
free, getSession, init
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface leon.app.behaviorinterface.LyPanelBehaviorInterface
completePopupMenu, getPopupMenuActions, needRefresh, validateFilter
 
Methods inherited from interface leon.app.behaviorinterface.LyActionBehaviorInterface
endAction, getClientContext, getContextTitle, getHelpFile, getImage, getImageTooltip, getKeyValue, getMenuItemImage, getTitle, reset, startAction
 
Methods inherited from interface leon.app.behaviorinterface.LyBehaviorInterface
free, init
 

Field Detail

__VERSION

public static final java.lang.String __VERSION
File version

See Also:
Constant Field Values
Constructor Detail

LyTreeBehavior

public LyTreeBehavior()
Default constructor.
The default implementation does nothing.

Method Detail

isSorted

public boolean isSorted(LyTreeController controller)
Indicates if data in the tree are sorted or not.
The default implementation does nothing and return true.

Specified by:
isSorted in interface LyTreeBehaviorInterface
Parameters:
controller - current Tree Controller
Returns:
true if the tree must be sorted false otherwise

getTreeSons

public LyObjectList getTreeSons(java.lang.Object parentNodeObject,
                                LyInfoList<LyClassInfo> classInfos,
                                LyTreeController controller)
Deprecated. use getSons(LyObject, String, LyTreeController)

Gets children of the given parent node.
The default implementation does nothing and return null.

Specified by:
getTreeSons in interface LyTreeBehaviorInterface
Parameters:
parentNodeObject - parent of the requested objects.
classInfos - target (only for data tree)
controller - current LyTreeController instance
Returns:
the list of children objects, or null if the subtree is empty
See Also:
getSons(LyObject, String, LyTreeController)

getSons

public LyObjectList getSons(LyObject parentNodeObject,
                            java.lang.String level,
                            LyTreeController controller)
Deprecated. Since V3.3, use getSons(LyObject, LyTreeNode, String, LyTreeController).

Gets children objects of the given parent.
A null parent object is considered as the root node.

Specified by:
getSons in interface LyTreeBehaviorInterface
Parameters:
parentNodeObject - parent of the requested objects.
level - the current level of the tree, as declared in the metamodel
controller - the current tree controller
Returns:
the list of children objects, or null if the subtree is empty

getSons

public LyObjectList getSons(LyObject parentNodeObject,
                            LyTreeNode treeNode,
                            java.lang.String level,
                            LyTreeController controller)
Gets all children objects of the given parent. A null parent object is considered as the root node.

Specified by:
getSons in interface LyTreeBehaviorInterface
Parameters:
parentNodeObject - parent of the requested objects.
treeNode - the current tree node associated to given object
level - the current level of the tree, as declared in the metamodel
controller - the current tree controller
Returns:
the list of children objects, or null if the subtree is empty

getParents

public LyObjectList getParents(java.lang.Object nodeObject,
                               LyTreeController controller)
Gets the given node parent objects list.

Specified by:
getParents in interface LyTreeBehaviorInterface
Parameters:
nodeObject - the node object
controller - current LyTreeController instance
Returns:
the list of possible given node parents

getTreeRootObject

public java.lang.Object getTreeRootObject(LyTreeBaseController controller)
Gets the tree root node.
The default implementation gets the LY_TREE_ROOT environment resource and returns the String representation as show in the tree.

Specified by:
getTreeRootObject in interface LyTreeBaseBehaviorInterface
Parameters:
controller - current LyTreeController instance
Returns:
the object shown as the root of the tree, or null if the tree is empty

buildTreeNode

public LyTreeNode buildTreeNode(java.lang.Object nodeObject,
                                LyTreeBaseController controller)
Build a view object instance from the given application object. Node status (colors, borders, ...) should be set in updateTreeNode(Object, LyTreeNode, LyTreeBaseController).
The default implementation just returns null if the given object is null or constructs a LyTreeNode and returns it otherwise.

Specified by:
buildTreeNode in interface LyTreeBaseBehaviorInterface
Parameters:
nodeObject - the node to build, usually LyObject instance but not mandatory
controller - current LyTreeController instance
Returns:
the built node view object.

updateTreeNode

public void updateTreeNode(java.lang.Object nodeObject,
                           LyTreeNode treeNode,
                           LyTreeBaseController controller)
Updates the given tree node view object status (colors, label, border, style ...) from the given node object properties. The controller invokes this method when the given nodeObject is modified.
The default implementation, if the given node object is a string, sets the label with its value, sets image to null and open the node. If the given object is a LyObject, sets the label, the image, th open property and the hidden property with the given object one.

Specified by:
updateTreeNode in interface LyTreeBaseBehaviorInterface
Parameters:
nodeObject - application object (reference)
treeNode - view objects (need update)
controller - current tree controller instance

getSonsClassInfos

public LyInfoList<LyClassInfo> getSonsClassInfos(LyClassInfo parentClassInfo,
                                                 java.lang.String parentLevel,
                                                 LyTreeController controller)
Gets the list of classInfo that represent the possibles children of the given classInfo at the given level.
The default implementation gets the controller children class infos and returns a list containing those classes and their children or null if the controller does not have children classe info.

Specified by:
getSonsClassInfos in interface LyTreeBehaviorInterface
Parameters:
parentClassInfo - the classInfo of the parent
parentLevel - the current level of the parent
controller - the current tree controller
Returns:
a list of classInfo

getClassInfos

public LyInfoList<LyClassInfo> getClassInfos(LyTreeController controller)
Gets the list of all classInfos that can be found in the tree.
The default implementation retreives the controller class infos.

Specified by:
getClassInfos in interface LyTreeBehaviorInterface
Parameters:
controller - the current tree controller
Returns:
the list of classInfo

selectionChanged

public void selectionChanged(LyTreeController controller)
Method invoked when the selection has changed in the tree view.
The default implementation does nothing.

Specified by:
selectionChanged in interface LyTreeBehaviorInterface
Parameters:
controller - the current tree controller

getSort

public LySort getSort(LyTreeController controller,
                      java.lang.String level)
Gets the sort used in the tree for the given level.
The default implementation does nothing and returns null.

Specified by:
getSort in interface LyTreeBehaviorInterface
Parameters:
controller - the current tree controller
level - the current level on tree
Returns:
the found sort

getFilter

public LyFilter getFilter(LyTreeController controller,
                          java.lang.String level)
Gets the filter used in the tree for the given level.
The default implementation does nothing and returns null.

Specified by:
getFilter in interface LyTreeBehaviorInterface
Parameters:
controller - the current tree controller
level - the current level on tree
Returns:
the found filter

validityModified

public void validityModified(LyTreeNode treeNode,
                             LyTreeBaseController controller)
Method invoked when a validity changed in a three state tree (valid, invalid, partially).
Note: a tree is activated as a three state validity tree by the resource : LY_TREE_VALIDITY=true.
The default implementation does nothing.

Specified by:
validityModified in interface LyTreeBaseBehaviorInterface
Parameters:
treeNode - view objects (need update)
controller - current LyTreeBaseController instance

getExtraPopupMenuActions

public LyInfoDataList<LyAction,LyClassInfo> getExtraPopupMenuActions(LyTreeController treeController,
                                                                     LyInfoDataList<LyAction,LyClassInfo> actions,
                                                                     LyClassInfo classInfo,
                                                                     LyInfoList<LyClassInfo> sons)
Gets the ordered list of pairs of (action, classInfo) to display in popup menu.
The default implementation does nothing and returns the given action.

Specified by:
getExtraPopupMenuActions in interface LyTreeBehaviorInterface
Parameters:
treeController - Tree controller that displays the menu.
actions - List of pairs (action, classInfo) that the controller is about to present in popup menu.
classInfo - Class of the selected object.
sons - List of classes declared as sons of the given class info.
Returns:
List of pairs (action, classInfo) that the controller will display in menu.

dragStart

public void dragStart(LyTreeController treeController,
                      LyObject draggedObject)
Method invoked at the beginning of the given object drag.
The default implementation keep in the controller session memory that the object is dragged and log a trace.

Specified by:
dragStart in interface LyTreeBaseBehaviorInterface
Parameters:
treeController - current LyTreeController instance
draggedObject - dragged object

drop

public void drop(LyTreeController treeController,
                 LyObject droppedObject,
                 LyObject draggedObject)
Method called when the given dragged object is dropped on the given dropped object.
The default implementation only logs a trace.

Specified by:
drop in interface LyTreeBaseBehaviorInterface
Parameters:
treeController - current LyTreeController instance
droppedObject - object on where the dragged object is dropped
draggedObject - the dragged object

handleDemand

public boolean handleDemand(LyController controller,
                            LyDemand demand)
Handle a demand raised by the view

Specified by:
handleDemand in interface LyBehaviorInterface
Overrides:
handleDemand in class LyBehavior
Parameters:
controller - the controller
demand - the view demand
Returns:
true if the demand was handled

dragFinished

public void dragFinished(LyTreeController treeController,
                         int type)
Method called at the end of a drag-and-drop.
The default implementation does nothing.

Specified by:
dragFinished in interface LyTreeBaseBehaviorInterface
Parameters:
treeController - current LyMapController instance
type - drag-and-drop type (org.eclipse.swt.dnd.DND#DROP_COPY or org.eclipse.swt.dnd.DND#DROP_MOVE)

(c) January 2013 - W4 S.A.

Website: W4 S.A., contact us: support@w4global.com