LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.control
Class LyFilterEditorController

java.lang.Object
  extended by leon.control.LyController
      extended by leon.control.LyAreaController
          extended by leon.control.LyMultiAreaController
              extended by leon.control.LyFilterEditorController
All Implemented Interfaces:
LyGetSessionInterface, LyContextInterface, LyFilterEndInterface, LyGetActionInterface, LySelectFileListenerInterface, LyGuiListener, LyInfoListener, LyEvaluator, LyDemandListener, LyAnswerInterface, LyQuestionAnswerInterface

public class LyFilterEditorController
extends LyMultiAreaController
implements LyFilterEndInterface, LyQuestionAnswerInterface

This class implements an extended filter edition form. The extended filter is a 'tree'-like view which is used as a GUI to edit extended filters. An extended filter is a set of elementary conditions associated with operators AND / OR.

The extended filter view is based on a LyFilterController (elementary edition area) to create conditions and add them into the tree.

See Also:
LyFilterController, LyFilterEndInterface

Field Summary
static java.lang.String __VERSION
          File Version
static java.lang.String CURRENT_FILTER_EXPRESSION
          String used when modifying a filter expression.
 
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
LyFilterEditorController(LySession session, LyController parent, LyAction action)
          Constructor.
LyFilterEditorController(LySession session, LyController parent, LyAction action, LyClassInfo classInfo, LyObjectList objects)
          Constructor.
 
Method Summary
 void actionDemand(LyActionDemand demand)
          Method called to allows to execute specific action in toolbar and tree.
 LyTreeNode addTreeNode(LyTreeNode parent, java.lang.Object appObject, int position)
          Create a node subtree for the parent node.
 LyTreeNode buildTreeNode(java.lang.Object nodeObject)
          Build a view object instance from the application object Node status (colors, borders, ...)
 void clearTreeContent()
          Empty the tree (remove all nodes).
 void dragDropDemand(LyDragDropDemand demand)
          Invoked when a Drag & Drop occurs.
 boolean endAction(LyAreaController form, LyAction action)
          Ends an action for the given controller.
 void endFilter(LyController controller, java.lang.String actionDemand, LyFilter filter)
          The filter edition form is closed : notify registered listener.
 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.
 LyClassInfo getClassInfo()
          Accessor to the class info for which this filter is created.
 LyDependencies getDependencies()
          Gets dependencies of the tree controller.
 LyFilter getFilter()
          Accessor to initial filter for the creation of an elementary filter.
 LyFilterEndInterface getFilterEndInterface()
          Gets client (listener) for closing notification.
 java.lang.String getImage(LyAreaController areaController, LyAction action)
          Gets the image corresponding to the given object for the given controller.
static java.lang.String getNameExpression(LyFilterExpression exp, LyEnvironment environment)
          Builds the displayed label of a LyFilterExpression.
static java.lang.String getNameFilter(LyFilter filter, LyEnvironment environment, boolean expand)
          Builds the displayed label of a LyFilter.
static java.lang.String getNameFilterCriterion(LyFilterCriterion criterion, LyEnvironment environment)
          Builds the displayed label of a LyFilterCriterion.
static java.lang.String getNameFilterRelation(LyFilterRelation filter, LyEnvironment environment)
          Builds the displayed label of a LyFilterRelation.
static java.lang.String getNameFilterRelation(LyFilterRelation filter, LyEnvironment environment, boolean expand)
          Builds the displayed label of a LyFilterRelation.
 java.lang.String getTitle(LyAreaController areaController, LyAction action)
          Gets title corresponding to the given action.
 LyTree getTreeComponent()
          Accessor to the Tree component (view).
 java.util.Vector<LyFilterElement> getTreeSons(java.lang.Object parentNodeObject)
          Fetch the subtree objects for the specified parent node.
 boolean handleDemand(LyController controller, LyDemand demand)
          Invoked when a demand is sent to this listener.
 void menuDemand(LyMenuDemand demand)
          Invoked when an menu item notification is sent to this listener.
 void questionAnswer(boolean result, java.lang.Object clientData)
          Answer to a askQuestion request.
 void reset(boolean full)
          Reset the entire view : everything is rebuilt.
 void selectionDemand(LySelectionDemand demand)
          Method called when there is a selection in tree.
 void setContextClient(LyAreaController controller)
          Set accessor to the context client area controller which will receive contextual notification when something occur on this area controller.
 void setFilterEndInterface(LyFilterEndInterface endInterface)
          Sets client (listener) for closing notification.
 boolean startAction(LyAreaController form, LyAction action)
          Starts an action for the given controller.
 java.lang.String translate(java.lang.String value)
          Translate the values displayed in filter form.
 void updateContent()
          Update the content of the view (Nodes).
 void updateTools()
          Reset the tool bar status (depends on current selection).
 void updateTreeNode(java.lang.Object nodeObject, LyTreeNode treeNode)
          Update view object status (colors, label, border, style ...) the tree controller invokes this method when nodeObject is modified.
 boolean validateAction(LyAction action)
          Method that checks if the given action is present or not.
 
Methods inherited from class leon.control.LyMultiAreaController
addAreaController, addAreaControllerStack, canClose, clearViewCache, getAreaController, getAreaController, getAreaControllersCount, getAreaControllerStack, getAreaControllerStackCount, getFinalAreaControllers, getLastModified, isViewResizable, openSubAreaController, removeAreaController, removeAreaControllerStack, setAction, setContext, setIdle, setViewController, update
 
Methods inherited from class leon.control.LyAreaController
canFree, completeMenuBar, completeMessages, free, getAction, getAreaStackController, getBehavior, getBuilder, getContent, getContext, getContextClient, getContextTitle, getDefaultAction, getEnvironment, getFastEditionAction, getHelpFile, getImage, getImageTooltip, getInfoLabel, getInfoLabel, getKeyValue, getLabel, getMenuItemImage, getName, getParameter, getParameter, getParameterMarks, getParent, getParent, getParentAreaController, getRefreshTime, getSelection, getShortLabel, getTarget, getTitle, getViewController, getViewController, hasMark, hasNotMark, hasViewController, hideView, infoEvent, initialize, isInitialized, isOutlined, reset, selectFileDemand, setContext, setPreference, showView, showView, testParameter, toString, 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
 

Field Detail

__VERSION

public static final java.lang.String __VERSION
File Version

See Also:
Constant Field Values

CURRENT_FILTER_EXPRESSION

public static final java.lang.String CURRENT_FILTER_EXPRESSION
String used when modifying a filter expression.

See Also:
Constant Field Values
Constructor Detail

LyFilterEditorController

public LyFilterEditorController(LySession session,
                                LyController parent,
                                LyAction action,
                                LyClassInfo classInfo,
                                LyObjectList objects)
Constructor.

Parameters:
session - current session associated to the controller. The controller automatically registers on the specified session.
parent - parent controller. If the parent implements LyFilterEndInterface, it will be notified when the filter form is closed.
action - related action. (action based on '_filter' action)
classInfo - the application class associated to the filter
objects - the current context

LyFilterEditorController

public LyFilterEditorController(LySession session,
                                LyController parent,
                                LyAction action)
Constructor.

Parameters:
session - current session associated to the controller. The controller automatically registers on the specified session.
parent - parent controller. If the parent implements LyFilterEndInterface, it will be notified when the filter form is closed.
action - related action. (action based on '_filter' action)
Method Detail

free

public void free(LyController controller)
Free this controller.

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

reset

public void reset(boolean full)
Reset the entire view : everything is rebuilt.

Overrides:
reset in class LyAreaController
Parameters:
full - Boolean indicating if a full reset (including reset of datas) is requiered or not (only reset graphical area).

updateContent

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


clearTreeContent

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


addTreeNode

public LyTreeNode addTreeNode(LyTreeNode parent,
                              java.lang.Object appObject,
                              int position)
Create a node subtree for the parent node.

Parameters:
parent - 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
position - Positon of the new tree node.
Returns:
subtreenode associated with Application object and its own subtree nodes

getTreeSons

public java.util.Vector<LyFilterElement> getTreeSons(java.lang.Object parentNodeObject)
Fetch the subtree objects for the specified parent node.

Parameters:
parentNodeObject - parentNodeObject parent of the requested objects.
Returns:
the son list, or null if the subtree is empty
See Also:
LyTreeBehaviorInterface.getTreeSons(java.lang.Object, leon.info.LyInfoList, leon.control.LyTreeController)

handleDemand

public boolean handleDemand(LyController controller,
                            LyDemand demand)
Invoked when a demand is sent to this listener. Default implementation does nothing.

Parameters:
controller - controller that routed the demand.
demand - demand parameters sent by the view component.
Returns:
Return true if the demand was handled, false otherwise. If false, the demand is transmitted to the controller to try to handle it.

actionDemand

public void actionDemand(LyActionDemand demand)
Method called to allows to execute specific action in toolbar and tree. Following actions are coded: Add filter item on filter Add AND or OR filter delete subItem expand node

Overrides:
actionDemand in class LyMultiAreaController
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

menuDemand

public void menuDemand(LyMenuDemand demand)
Invoked when an menu item notification is sent to this listener.

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

selectionDemand

public void selectionDemand(LySelectionDemand demand)
Method called when there is a selection in tree. It will update toolbar and change the aspect of the selected node

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

questionAnswer

public void questionAnswer(boolean result,
                           java.lang.Object clientData)
Answer to a askQuestion request.

Specified by:
questionAnswer in interface LyQuestionAnswerInterface
Parameters:
result - true if the user has clicked on Yes or Ok
clientData - data specified in the askQuestion method
See Also:
LyQuestionAnswerInterface

updateTools

public void updateTools()
Reset the tool bar status (depends on current selection).


validateAction

public boolean validateAction(LyAction action)
Method that checks if the given action is present or not.

Parameters:
action - the action to validate
Returns:
the status

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.

getNameExpression

public static java.lang.String getNameExpression(LyFilterExpression exp,
                                                 LyEnvironment environment)
Builds the displayed label of a LyFilterExpression.

Parameters:
exp - the LyFilterExpression.
environment - the environment used to translate strings.
Returns:
Label to display.

getNameFilter

public static java.lang.String getNameFilter(LyFilter filter,
                                             LyEnvironment environment,
                                             boolean expand)
Builds the displayed label of a LyFilter. The label may be different depending on the status (expanded / collapsed) of the filter in the tree. (Collapse may show the content for instance).

Parameters:
filter - the filter
environment - current environment
expand - indicates if tree node associated to the filter is expanded or not
Returns:
Label which is displayed

getNameFilterRelation

public static java.lang.String getNameFilterRelation(LyFilterRelation filter,
                                                     LyEnvironment environment)
Builds the displayed label of a LyFilterRelation.

Parameters:
filter - the filter.
environment - the environment used to translate strings.
Returns:
Label which is displayed.

getNameFilterRelation

public static java.lang.String getNameFilterRelation(LyFilterRelation filter,
                                                     LyEnvironment environment,
                                                     boolean expand)
Builds the displayed label of a LyFilterRelation.

Parameters:
filter - the filter.
environment - the environment used to translate strings.
expand - indicates if tree node associated to the filter is expanded or not.
Returns:
Label which is displayed

getNameFilterCriterion

public static java.lang.String getNameFilterCriterion(LyFilterCriterion criterion,
                                                      LyEnvironment environment)
Builds the displayed label of a LyFilterCriterion.

Parameters:
criterion - the criterion.
environment - the environment used to translate strings.
Returns:
Label which is displayed.

setContextClient

public void setContextClient(LyAreaController controller)
Set accessor to the context client area controller which will receive contextual notification when something occur on this area controller. This method is overriden to set the given controller as filter client when the filter controller is used in a compound action.

Overrides:
setContextClient in class LyMultiAreaController
Parameters:
controller - the contextual controller.

getFilterEndInterface

public LyFilterEndInterface getFilterEndInterface()
Gets client (listener) for closing notification.

Returns:
client notified when the dialog closes. May be null.

setFilterEndInterface

public void setFilterEndInterface(LyFilterEndInterface endInterface)
Sets client (listener) for closing notification.

Parameters:
endInterface - client notified when the dialog closes.

getClassInfo

public LyClassInfo getClassInfo()
Accessor to the class info for which this filter is created.

Overrides:
getClassInfo in class LyAreaController
Returns:
the requested classInfo

getFilter

public LyFilter getFilter()
Accessor to initial filter for the creation of an elementary filter.

Specified by:
getFilter in interface LyFilterEndInterface
Returns:
the current filter

endFilter

public void endFilter(LyController controller,
                      java.lang.String actionDemand,
                      LyFilter filter)
The filter edition form is closed : notify registered listener.

Specified by:
endFilter in interface LyFilterEndInterface
Parameters:
controller - reference to the filter controller (filter form which is closing)
actionDemand - actionDemand on filter controller : id of the command such as LyFormController.DEMAND_VALIDATE, LyFormController.DEMAND_APPLY, LyFormController.DEMAND_CANCEL
filter - the filter that was created in the form

startAction

public boolean startAction(LyAreaController form,
                           LyAction action)
Starts an action for the given controller.

Parameters:
form - the current LyAreaController instance
action - the action that will be executed
Returns:
true if the action starts correctly, false otherwise.

endAction

public boolean endAction(LyAreaController form,
                         LyAction action)
Ends an action for the given controller.

Parameters:
form - the current LyAreaController instance
action - the action that was executed
Returns:
true if the action performed correctly, false otherwise

getImage

public java.lang.String getImage(LyAreaController areaController,
                                 LyAction action)
Gets the image corresponding to the given object for the given controller. This image is mostly used in titlebar.

Parameters:
areaController - controller for which the image is required.
action - the action that was executed
Returns:
Logical name of the image for the given action.

getTitle

public java.lang.String getTitle(LyAreaController areaController,
                                 LyAction action)
Gets title corresponding to the given action.

Parameters:
areaController - the current LyAreaController instance
action - the action that was executed
Returns:
Title for the given action.

buildTreeNode

public LyTreeNode buildTreeNode(java.lang.Object nodeObject)
Build a view object instance from the application object Node status (colors, borders, ...) should be set in updateTreeNode.

Parameters:
nodeObject - usually LyObject instance but not mandatory
Returns:
node view object.

updateTreeNode

public void updateTreeNode(java.lang.Object nodeObject,
                           LyTreeNode treeNode)
Update view object status (colors, label, border, style ...) the tree controller invokes this method when nodeObject is modified.

Parameters:
nodeObject - application object (reference)
treeNode - view objects (need update)

getTreeComponent

public LyTree getTreeComponent()
Accessor to the Tree component (view).

Returns:
The tree view component

getDependencies

public LyDependencies getDependencies()
Gets dependencies of the tree controller.

Returns:
Dependencies of the tree controller.
See Also:
LyDependencies

translate

public java.lang.String translate(java.lang.String value)
Translate the values displayed in filter form.

Parameters:
value - the value that must be translated
Returns:
the value that must be displayed

(c) January 2013 - W4 S.A.

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