LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.control
Class LyTreeController

java.lang.Object
  extended by leon.control.LyController
      extended by leon.control.LyAreaController
          extended by leon.control.LyPanelController
              extended by leon.control.LyTreeBaseController
                  extended by leon.control.LyTreeController
All Implemented Interfaces:
LyGetSessionInterface, LyContextInterface, LyGetActionInterface, LySelectFileListenerInterface, LyAdvancedWorkSpaceListener, LyGuiListener, LyWorkSpaceListener, LyInfoListener, LyEvaluator, LyDemandListener, LyAnswerInterface, LyQuestionAnswerInterface

public class LyTreeController
extends LyTreeBaseController
implements LyAdvancedWorkSpaceListener

The LyTreeController implements the generic behavior for a tree. This controller is associated with a builder (LyTreeBuilder) and a behavior. The behavior must implements LyTreeBehaviorInterfave. Usually, this behavior is an instance of the LyTreeBehavior class

See Also:
LyTreeBaseController, LyTreeBehaviorInterface, LyTreeBehavior

Field Summary
static java.lang.String __VERSION
          File Version
static java.lang.String DISCOVER_ON_CLICK
          Form field identifier: flag to indicate if the tree must be fully discovered or discovered on node open action.
static java.lang.String SEP_ID
          separator id for treeNode.
static java.lang.Integer STATUS_NONE
          Close state for a node.
static java.lang.Integer STATUS_OPENED
          Open state for a node.
 
Fields inherited from class leon.control.LyPanelController
DEMAND_DEFAULT_FOR_MOBILE_PREFERENCE, DEMAND_DEFAULT_PREFERENCE, DEMAND_PREFERENCE_TARGET, DEMAND_SAVE_PREFERENCE, DEMAND_SELECT_ALL, DEMAND_SHARED_PREFERENCE, DEMAND_UNSELECT_ALL, EXTEND_SIMPLE_FILTER, EXTENDED_FILTER_NEW, FAST_FILTER, FILTER_ACTIVE, FILTER_SET, PREFERENCE_TARGET_ACTION, PREFERENCE_TARGET_CLASS, SIMPLE_FILTER_NEW
 
Fields inherited from class leon.control.LyAreaController
DEFAULT_MENU_ITEM_IMAGE_SIZE, DEMAND_APPLY, DEMAND_CANCEL, DEMAND_CLOSE, DEMAND_CREATE_CHART, DEMAND_DELETE_CHART, DEMAND_DELETE_OBJECTINFOS, DEMAND_DELETE_PREFERENCE, DEMAND_UPDATE_VIEW, DEMAND_VALIDATE
 
Fields inherited from class leon.control.LyController
_nbControllers, _nextId, CONTROLLER_ID_SEP, DEFAULT_IMAGE_FORMAT, DEMAND_HELP, ID_SEP
 
Constructor Summary
LyTreeController(LySession session, LyController parent, LyAction action, LyClassInfo classInfo, LyObjectList context)
          Constructor.
 
Method Summary
 void actionDemand(LyActionDemand demand)
          Invoked when an action occurs.
 LyTreeNode addTreeNode(LyTreeNode parentNode, java.lang.Object appObject, java.lang.String level)
          Create a node subtree for the parent node.
 void addTreeNodeFromObjectId(LyObjectId objectId, LyTreeNode treeNode)
          Add a reference to a treeNode for the objectId.
 void clearTreeContent()
          Empty the tree (remove all nodes).
 void clearViewCache()
          Clears all cached data for this controller (especially the view and the component).
 void dragDropDemand(LyDragDropDemand demand)
          Invoked when a Drag & Drop occurs.
 boolean enablesMultiSelection()
          Method that indicates if controlled panel enables multi-selection or not.
 void expandNode(LyTreeNode treeNode, boolean expand)
          This method expand (or close) the given node.
 void free(LyController controller)
          Free this controller.
 java.lang.Class<?> getBehaviorInterface()
          Method that gives the interface that must be implemented by the behavior associated to this controller.
 java.util.Vector<java.lang.String> getBranchFromTreeNode(LyTreeNode treeNode)
          This method returns a vector of Strings Each string represent an object The first element is the tree root.
 LyClassInfo getClassInfoFromLevel(java.lang.String level)
          Get the classInfo associated with a given level.
 LyInfoList<LyClassInfo> getClassInfos()
          Return a list of all classes in the tree.
 LyObjectList getContent()
          Get content of the tree.
 java.lang.Integer getExpandedStatusFromNode(LyGetIdInterface getIdObject)
          Gets current expand status of a node.
 LyFilter getFilterFromLevel(java.lang.String level)
          Get the filter associated with a given level.
 java.lang.String getLevel(java.lang.String compId)
          Retrieves a level from a component id.
 java.util.Vector<java.lang.String> getLevels(LyClassInfo classInfo)
          Get all levels that have the given classinfo.
 LyObject getObjectFromTreeNodeId(java.lang.String treeNodeId)
          Method used to get the object associated with a TreeNode, using the node Id.
 LyObjectId getObjectIdFromTreeNodeId(java.lang.String treeNodeId)
          Method used to get the object associated with a TreeNode, using the node Id.
 LyInfoList<LyClassInfo> getParentClassInfos(LyClassInfo classInfo)
          Search the list of possible parent classInfos in the tree.
 LyInfoList<LyClassInfo> getRootClassInfos()
          Accessor to the list of root classInfos of the tree.
 java.util.Vector<LyComponent> getSelectedTreeNodes()
          Get the selected treeNodes.
 LyInfoList<LyClassInfo> getSonsClassInfos(java.lang.String level)
          Get a list of available classInfo for the sons at the given level.
 LySort getSortFromLevel(java.lang.String level)
          Get the sort associated with a given level.
 java.util.Vector<LyComponent> getTreeNodesFromObjectId(LyObjectId objectId)
          get all references associated to this objectId.
 boolean isDiscoverOnClick()
          Check discovering mode of the tree (fully or on node click).
 boolean isHorizontal()
          Method that indicates if controlled panel is horizontal.
 boolean isIgnoreIdle()
          Check ignore idle status of the tree controller.
 boolean isTopLevelClassInfo(LyClassInfo classInfo)
          Search if the object is suitable to be added witout a parent classInfo.
 void menuDemand(LyMenuDemand demand)
          Invoked when an action occurs.
 boolean objectAdded(LyWorkSpaceEvent event)
          Called when an object is added in the dynamic object list.
 boolean objectChanged(LyWorkSpaceEvent event)
          Called when an object has changed in the dynamic object list.
 boolean objectRemoved(LyWorkSpaceEvent event)
          Called when an object is removed from the dynamic object list.
 boolean objectStateChanged(LyAdvancedWorkSpaceEvent event)
          Called when an object state is changed.
 void removeTreeNodeFromObjectId(LyObject object, LyTreeNode treeNode)
          Remove a reference.
 void selectAllObjects(boolean select)
          Select/unselect all nodes.
 void selectionDemand(LySelectionDemand demand)
          Invoked when an selection occurs.
 void selectObject(LyObject object, boolean select)
          Select an object in the table.
 void setIgnoreIdle(boolean mode)
          Set the ignore idle status of tree controller.
 void updateContent()
          Reset the content of the view (Nodes).
 
Methods inherited from class leon.control.LyTreeBaseController
getPanelComponent, getTreeComponent, updateMessages, updateTools
 
Methods inherited from class leon.control.LyPanelController
buildFilter, closeBorderPanel, endFilter, findObject, getFilter, getFilterController, getFilterEditorController, getPreference, getRefreshTime, getSelection, isFilterActive, objectUserEvent, questionAnswer, reset, setFilter, setIdle, setPreference, setRefreshTime, updatePreferencesMenu, workSpaceEventsGrouped
 
Methods inherited from class leon.control.LyAreaController
canClose, canFree, completeMenuBar, completeMessages, free, getAction, getAreaStackController, getBehavior, getBuilder, getClassInfo, getContext, getContextClient, getContextTitle, getDefaultAction, getEnvironment, getFastEditionAction, getHelpFile, getImage, getImageTooltip, getInfoLabel, getInfoLabel, getKeyValue, getLabel, getLastModified, getMenuItemImage, getName, getParameter, getParameter, getParameterMarks, getParent, getParent, getParentAreaController, getShortLabel, getTarget, getTitle, getViewController, getViewController, hasMark, hasNotMark, hasViewController, hideView, infoEvent, initialize, isInitialized, isOutlined, isViewResizable, reset, selectFileDemand, setContext, setContext, setContextClient, setViewController, showView, showView, testParameter, toString, update, updateTitleBar
 
Methods inherited from class leon.control.LyController
activateViewDemand, demandPerformed, getApplication, getClassInfo, getComponent, getId, getImage, getImage, getImage, getImage, getImageFromPrefix, getImageFromPrefix, getImageFromPrefix, getName, getObjectId, getSession, getUserData, getView, getViewManager, helpDemand, hideView, isFreed, isIdle, setBuilder, setBuilderClass, setLastModified, setName, setUserData, showError, showError, showWarning, updateViewFromValues
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface leon.data.LyAdvancedWorkSpaceListener
objectUserEvent, workSpaceEventsGrouped
 

Field Detail

__VERSION

public static final java.lang.String __VERSION
File Version

See Also:
Constant Field Values

DISCOVER_ON_CLICK

public static final java.lang.String DISCOVER_ON_CLICK
Form field identifier: flag to indicate if the tree must be fully discovered or discovered on node open action.


SEP_ID

public static final java.lang.String SEP_ID
separator id for treeNode.


STATUS_NONE

public static final java.lang.Integer STATUS_NONE
Close state for a node.


STATUS_OPENED

public static final java.lang.Integer STATUS_OPENED
Open state for a node.

Constructor Detail

LyTreeController

public LyTreeController(LySession session,
                        LyController parent,
                        LyAction action,
                        LyClassInfo classInfo,
                        LyObjectList context)
Constructor.

Parameters:
session - current session associated to the controller. The controller automatically registers on the specified session.
parent - parent controller (or null for 'root' controller). Controller hierarchy indicates a child controller (for example a dialog created from a main view)
action - related action. If an action is specified, the controller uses action parameters (action name, action specific XML view description ...)
classInfo - classInfo for this controller (unused)
context - current context (may be null if the view is not contextual to a list of objects).
Method Detail

getBehaviorInterface

public java.lang.Class<?> getBehaviorInterface()
Method that gives the interface that must be implemented by the behavior associated to this controller.

Overrides:
getBehaviorInterface in class LyAreaController
Returns:
Class representing the behavior interface of this controller.

getLevels

public java.util.Vector<java.lang.String> getLevels(LyClassInfo classInfo)
Get all levels that have the given classinfo.

Parameters:
classInfo - a classInfo
Returns:
a list of levels

getSonsClassInfos

public LyInfoList<LyClassInfo> getSonsClassInfos(java.lang.String level)
Get a list of available classInfo for the sons at the given level.

Parameters:
level - Tree level
Returns:
a list of classInfo

getClassInfoFromLevel

public LyClassInfo getClassInfoFromLevel(java.lang.String level)
Get the classInfo associated with a given level.

Parameters:
level - the level
Returns:
the classInfo

getSortFromLevel

public LySort getSortFromLevel(java.lang.String level)
Get the sort associated with a given level.

Parameters:
level - the level
Returns:
the sort

getFilterFromLevel

public LyFilter getFilterFromLevel(java.lang.String level)
Get the filter associated with a given level.

Parameters:
level - the level
Returns:
the filter

getLevel

public java.lang.String getLevel(java.lang.String compId)
Retrieves a level from a component id.

Parameters:
compId - the id of the component
Returns:
the level of the given component

getClassInfos

public LyInfoList<LyClassInfo> getClassInfos()
Return a list of all classes in the tree.

Returns:
the list of classInfo

getRootClassInfos

public LyInfoList<LyClassInfo> getRootClassInfos()
Accessor to the list of root classInfos of the tree.

Returns:
the list of all root classes (may be null)

clearTreeContent

public void clearTreeContent()
Empty the tree (remove all nodes).

Overrides:
clearTreeContent in class LyTreeBaseController

updateContent

public void updateContent()
Reset the content of the view (Nodes).

Overrides:
updateContent in class LyTreeBaseController

free

public void free(LyController controller)
Free this controller.

Overrides:
free in class LyPanelController
Parameters:
controller - parent controller
See Also:
LyAreaController.free()

addTreeNode

public LyTreeNode addTreeNode(LyTreeNode parentNode,
                              java.lang.Object appObject,
                              java.lang.String level)
Create a node subtree for the parent node.

Parameters:
parentNode - of the subtree, or null if create subtree a root level
appObject - the application object which is the node of the subtree, or null to fetch root component
level - deepth level
Returns:
subtreenode associated with Application object and its own subtree nodes

menuDemand

public void menuDemand(LyMenuDemand demand)
Invoked when an action occurs.

Overrides:
menuDemand in class LyAreaController
Parameters:
demand - menu demand
See Also:
LyController.demandPerformed(leon.view.event.LyDemand)

actionDemand

public void actionDemand(LyActionDemand demand)
Invoked when an action occurs. (LyDemandListener interface) This method handles: opening and closing node, action

Overrides:
actionDemand in class LyPanelController
Parameters:
demand - action demand
See Also:
LyController.demandPerformed(leon.view.event.LyDemand)

dragDropDemand

public void dragDropDemand(LyDragDropDemand demand)
Invoked when a Drag & Drop occurs. (LyDemandListener interface) This method handles: opening and closing line, moving an interval, action

Overrides:
dragDropDemand in class LyController
Parameters:
demand - drag-drop demand

expandNode

public void expandNode(LyTreeNode treeNode,
                       boolean expand)
This method expand (or close) the given node.

Parameters:
treeNode - the tree node to expand or close
expand - boolean: true if node must be expanded, false if it must be closed

addTreeNodeFromObjectId

public void addTreeNodeFromObjectId(LyObjectId objectId,
                                    LyTreeNode treeNode)
Add a reference to a treeNode for the objectId.

Parameters:
objectId - LyObjectId of the object associated with this treeNode
treeNode - LyTreeNode associated to the object Id,

removeTreeNodeFromObjectId

public void removeTreeNodeFromObjectId(LyObject object,
                                       LyTreeNode treeNode)
Remove a reference.

Parameters:
object - object previously associated with this treeNode
treeNode - LyTreeNode associated to the object Id, or null to remove all association for this object Id

getTreeNodesFromObjectId

public java.util.Vector<LyComponent> getTreeNodesFromObjectId(LyObjectId objectId)
get all references associated to this objectId.

Parameters:
objectId - LyObjectId of the object
Returns:
a vector of treeNodes associated with this objectId or null if none

getObjectIdFromTreeNodeId

public LyObjectId getObjectIdFromTreeNodeId(java.lang.String treeNodeId)
Method used to get the object associated with a TreeNode, using the node Id.

Parameters:
treeNodeId - the node id
Returns:
the object corresponding to the key

getObjectFromTreeNodeId

public LyObject getObjectFromTreeNodeId(java.lang.String treeNodeId)
Method used to get the object associated with a TreeNode, using the node Id.

Parameters:
treeNodeId - the node id
Returns:
the object corresponding to the key

getBranchFromTreeNode

public java.util.Vector<java.lang.String> getBranchFromTreeNode(LyTreeNode treeNode)
This method returns a vector of Strings Each string represent an object The first element is the tree root. The last element is the LyObjectId (as a string) of the given treenode All element between are grandparents and parent of the treenode

Parameters:
treeNode - the given treeNode
Returns:
the vector of Id

selectionDemand

public void selectionDemand(LySelectionDemand demand)
Invoked when an selection occurs.

Overrides:
selectionDemand in class LyController
Parameters:
demand - selection demand
See Also:
LyController.demandPerformed(leon.view.event.LyDemand)

selectObject

public void selectObject(LyObject object,
                         boolean select)
Select an object in the table.

Overrides:
selectObject in class LyPanelController
Parameters:
object - selected or unselected object
select - new selection status

selectAllObjects

public void selectAllObjects(boolean select)
Select/unselect all nodes.

Overrides:
selectAllObjects in class LyPanelController
Parameters:
select - true to select all objects, false to unselect

getSelectedTreeNodes

public java.util.Vector<LyComponent> getSelectedTreeNodes()
Get the selected treeNodes.

Returns:
A vector of selected treeNodes

getExpandedStatusFromNode

public java.lang.Integer getExpandedStatusFromNode(LyGetIdInterface getIdObject)
Gets current expand status of a node.

Parameters:
getIdObject - view component
Returns:
status of the view component (Opened -> STATUS_OPENED or closed -> STATUS_NONE)

getContent

public LyObjectList getContent()
Get content of the tree.

Specified by:
getContent in class LyPanelController
Returns:
the list of objects in the node

objectAdded

public boolean objectAdded(LyWorkSpaceEvent event)
Called when an object is added in the dynamic object list.

Specified by:
objectAdded in interface LyWorkSpaceListener
Overrides:
objectAdded in class LyPanelController
Parameters:
event - event
Returns:
true is demand was successfull.
See Also:
LyWorkSpaceListener.objectAdded(leon.data.LyWorkSpaceEvent)

objectRemoved

public boolean objectRemoved(LyWorkSpaceEvent event)
Called when an object is removed from the dynamic object list.

Specified by:
objectRemoved in interface LyWorkSpaceListener
Overrides:
objectRemoved in class LyPanelController
Parameters:
event - event
Returns:
true is demand was successfull.
See Also:
LyWorkSpaceListener.objectRemoved(leon.data.LyWorkSpaceEvent)

objectChanged

public boolean objectChanged(LyWorkSpaceEvent event)
Called when an object has changed in the dynamic object list.

Specified by:
objectChanged in interface LyWorkSpaceListener
Overrides:
objectChanged in class LyPanelController
Parameters:
event - event
Returns:
true is demand was successfull.
See Also:
LyWorkSpaceListener.objectChanged(leon.data.LyWorkSpaceEvent)

objectStateChanged

public boolean objectStateChanged(LyAdvancedWorkSpaceEvent event)
Called when an object state is changed.

Specified by:
objectStateChanged in interface LyAdvancedWorkSpaceListener
Overrides:
objectStateChanged in class LyPanelController
Parameters:
event - Event notifying object state change.
Returns:
True if the event is used by the listener, false otherwise.
See Also:
LyAdvancedWorkSpaceListener.objectStateChanged(leon.data.LyAdvancedWorkSpaceEvent)

getParentClassInfos

public LyInfoList<LyClassInfo> getParentClassInfos(LyClassInfo classInfo)
Search the list of possible parent classInfos in the tree.

Parameters:
classInfo - current classInfo
Returns:
the list of parent classInfo (above in the tree structure)
See Also:
isTopLevelClassInfo(LyClassInfo)

isTopLevelClassInfo

public boolean isTopLevelClassInfo(LyClassInfo classInfo)
Search if the object is suitable to be added witout a parent classInfo.

Parameters:
classInfo - current classInfo
Returns:
true if the object may be added at top level
See Also:
getParentClassInfos(LyClassInfo)

clearViewCache

public void clearViewCache()
Clears all cached data for this controller (especially the view and the component).

This method may be invoked for memory optimization, but the controller is still valid and may be used. (Unlike free) Further usage, needs to rebuild internal component & view which may be time consuming.

Overrides:
clearViewCache in class LyAreaController

enablesMultiSelection

public boolean enablesMultiSelection()
Method that indicates if controlled panel enables multi-selection or not.

Overrides:
enablesMultiSelection in class LyPanelController
Returns:
A boolean indicating if multi-selection is allowed or not.

isHorizontal

public boolean isHorizontal()
Method that indicates if controlled panel is horizontal.

Overrides:
isHorizontal in class LyPanelController
Returns:
A boolean indicating if the panel component is horizontal.

isIgnoreIdle

public boolean isIgnoreIdle()
Check ignore idle status of the tree controller.

Returns:
boolean indicating the ignore idle mode

setIgnoreIdle

public void setIgnoreIdle(boolean mode)
Set the ignore idle status of tree controller.

Parameters:
mode - true to ignore idle, false else

isDiscoverOnClick

public boolean isDiscoverOnClick()
Check discovering mode of the tree (fully or on node click).

Returns:
boolean indicating if the discovering is made on click

(c) January 2013 - W4 S.A.

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