LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.control
Class LyViewController

java.lang.Object
  extended by leon.control.LyController
      extended by leon.control.LyViewController
All Implemented Interfaces:
LyGetSessionInterface, LyContextInterface, LyGuiListener, LyEvaluator, LyDemandListener, LyAnswerInterface, LyQuestionAnswerInterface
Direct Known Subclasses:
LyDialogController, LyFrameController

public abstract class LyViewController
extends LyController
implements LyContextInterface, LyQuestionAnswerInterface

This class implements the basis of all view controller.

See Also:
LyController, LyFrameController, LyDialogController

Field Summary
static java.lang.String __VERSION
          File Version
static java.lang.String DEMAND_ABOUT
          Show about.
static java.lang.String DEMAND_CLOSE
          Closing view (deletes window and associated controller).
static java.lang.String DEMAND_EXIT
          Identifier of a action in the view : Application end.
static java.lang.String DEMAND_HIDE
          Hiding view.
static java.lang.String DEMAND_LOG
          Show log.
static java.lang.String DEMAND_UPDATE
          Update.
static java.lang.String DEMAND_VERSION
          Show version.
static int LEVEL_PRIMARY
          Indicates the primary level controller, the view controller if the view is simple (Table, Tree, Map) or the main controller in the case of multi view.
static int LEVEL_ROOT
          Indicates the root level controller, usually a "Frame" (generic).
static int LEVEL_SECONDARY
          Indicates the secondary level controller.
static int LEVEL_THIRD
          Third level controller.
 
Fields inherited from class leon.control.LyController
_nbControllers, _nextId, CONTROLLER_ID_SEP, DEFAULT_IMAGE_FORMAT, DEMAND_HELP, ID_SEP
 
Constructor Summary
LyViewController(LySession session, LyController parent)
          Default constructor.
LyViewController(LySession session, LyController parent, LyAreaController areaController)
          Default constructor.
 
Method Summary
 void actionDemand(LyActionDemand demand)
          Invoked when an action occurs.
 void clearViewCache()
          Clears all cached data for this controller (especially the view and the component).
 void close()
          Close this controller If a print thread is in progress, ask the user if the print must be cancelled.
 void demandPerformed(LyDemand demand)
          Invoked when a notification is sent to this listener.
 void exit()
          Exit.
 void free()
          Free this controller.
 LyAreaController getAreaController()
          Get Accessor to the associated area controller.
 LyWorkSpace getContext()
          Get current controller context.
 java.util.Stack<LyViewController> getControllerStack()
          Accessor to popup view controller stack (internal use).
 LyEnvironment getEnvironment()
          Accessor to the current Environment instance This method returns the environment of the area controller displayed by this view controller.
 boolean getFreeOnClose()
          Returns boolean indicating if this controller is freed on close.
 long getLastModified()
          To get the last modification date of this controller.
 LyViewController getSon(int index)
          Get the son controller at the given position.
 int getSonsCount()
          Number of son controller.
 LyView getView()
          Creates a root view which contains the view.
 LyArea getViewArea()
          Get view area.
 LyViewController getViewController()
          Returns view controller that contains this controller.
 boolean hasPrintThread()
          Indicates if there is a printing thread registered on this controller.
 boolean hasSonShowing()
          Check if this controller as son window showing (may decide if we free it or not).
 void hideView(boolean free)
          Hides the Window which contains the view.
 void initialize()
          Initializes this area controller.
 void interruptPrintThread()
          Interrupts printing thread registered on this controller.
 boolean isInShowProcess()
           
 boolean isShown()
          Tests if controlled view is shown or not.
 void questionAnswer(boolean result, java.lang.Object clientData)
          Answer to a askQuestion request.
 void setAreaController(LyAreaController areaController)
          Set Accessor to the associated area controller.
 boolean setContext(LyWorkSpace context)
          Set current controller context.
 void setControllerStack(java.util.Stack<LyViewController> controllerStack)
          Accessor to popup view controller stack (internal use).
 void setFreeOnClose(boolean freeOnClose)
          Sets boolean indicating if this controller is freed on close.
 void setIdle(boolean idle)
          Sets idle mode on this controller.
 void setInShowProcess(boolean showProcess)
           
 void setName(java.lang.String name)
          Sets view name.
 void setPrintThread(java.lang.Thread thread)
          Sets the printing thread for this controller.
 void setViewArea(LyArea area)
          Set view area.
 void showView()
          Shows the Window which contains the view.
 
Methods inherited from class leon.control.LyController
activateViewDemand, dragDropDemand, getApplication, getBehavior, getBehaviorInterface, getBuilder, getClassInfo, getComponent, getId, getImage, getImage, getImage, getImage, getImageFromPrefix, getImageFromPrefix, getImageFromPrefix, getKeyValue, getName, getObjectId, getParent, getSession, getUserData, getViewManager, hasViewController, helpDemand, hideView, isFreed, isIdle, menuDemand, selectionDemand, setBuilder, setBuilderClass, setLastModified, setUserData, showError, showError, showWarning, toString, 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

LEVEL_ROOT

public static final int LEVEL_ROOT
Indicates the root level controller, usually a "Frame" (generic).

See Also:
Constant Field Values

LEVEL_PRIMARY

public static final int LEVEL_PRIMARY
Indicates the primary level controller, the view controller if the view is simple (Table, Tree, Map) or the main controller in the case of multi view.

See Also:
Constant Field Values

LEVEL_SECONDARY

public static final int LEVEL_SECONDARY
Indicates the secondary level controller. Content depends on the primary controller, and this controller may not add some menus to the menubar.

See Also:
Constant Field Values

LEVEL_THIRD

public static final int LEVEL_THIRD
Third level controller. May be used within specific implementations

See Also:
Constant Field Values

DEMAND_EXIT

public static final java.lang.String DEMAND_EXIT
Identifier of a action in the view : Application end.


DEMAND_CLOSE

public static final java.lang.String DEMAND_CLOSE
Closing view (deletes window and associated controller).


DEMAND_HIDE

public static final java.lang.String DEMAND_HIDE
Hiding view.


DEMAND_VERSION

public static final java.lang.String DEMAND_VERSION
Show version.


DEMAND_ABOUT

public static final java.lang.String DEMAND_ABOUT
Show about.


DEMAND_LOG

public static final java.lang.String DEMAND_LOG
Show log.


DEMAND_UPDATE

public static final java.lang.String DEMAND_UPDATE
Update.

Constructor Detail

LyViewController

public LyViewController(LySession session,
                        LyController parent)
Default constructor.

Parameters:
session - session for the controller
parent - the parent controller

LyViewController

public LyViewController(LySession session,
                        LyController parent,
                        LyAreaController areaController)
Default constructor.

Parameters:
session - session for the controller
parent - the parent controller
areaController - the associated area controller
Method Detail

getAreaController

public LyAreaController getAreaController()
Get Accessor to the associated area controller.

Returns:
the associated area controller

setAreaController

public void setAreaController(LyAreaController areaController)
Set Accessor to the associated area controller.

Parameters:
areaController - the area controller

initialize

public void initialize()
Initializes this area controller.


free

public void free()
Free this controller.

Overrides:
free in class LyController
See Also:
LyController.free()

getSonsCount

public int getSonsCount()
Number of son controller.

Returns:
the number of sons controllers

getSon

public LyViewController getSon(int index)
Get the son controller at the given position.

Parameters:
index - the position of the controller to get
Returns:
the son view controller

questionAnswer

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

Specified by:
questionAnswer in interface LyQuestionAnswerInterface
Parameters:
result - one of the possible return code for LyViewManager : COMMAND_XXX
clientData - data specified in the askQuestion method
See Also:
LyMessageAnswerInterface

getViewController

public LyViewController getViewController()
Returns view controller that contains this controller. This controller IS a view Controller. Return this.

Specified by:
getViewController in class LyController
Returns:
this

getView

public LyView getView()
Creates a root view which contains the view.

Overrides:
getView in class LyController
Returns:
the root view
See Also:
LyController.getView()

showView

public void showView()
Shows the Window which contains the view.

Overrides:
showView in class LyController

hideView

public void hideView(boolean free)
Hides the Window which contains the view.

Overrides:
hideView in class LyController
Parameters:
free - true if this controller must be freed
See Also:
LyController.hideView()

isShown

public boolean isShown()
Tests if controlled view is shown or not.

Returns:
True if shown, false otherwise.

close

public void close()
Close this controller If a print thread is in progress, ask the user if the print must be cancelled.


exit

public void exit()
Exit.


demandPerformed

public void demandPerformed(LyDemand demand)
Invoked when a notification is sent to this listener. Overriden to call behvior of the area controller.

Specified by:
demandPerformed in interface LyDemandListener
Overrides:
demandPerformed in class LyController
Parameters:
demand - demand parameters sent by the view component.
See Also:
LyController.demandPerformed(leon.view.event.LyDemand)

actionDemand

public void actionDemand(LyActionDemand demand)
Invoked when an action occurs. This method handles close and help demand

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

getFreeOnClose

public boolean getFreeOnClose()
Returns boolean indicating if this controller is freed on close.

Returns:
true if the controller is freed on close

setFreeOnClose

public void setFreeOnClose(boolean freeOnClose)
Sets boolean indicating if this controller is freed on close.

Parameters:
freeOnClose - true if this controller must be freed on close

getViewArea

public LyArea getViewArea()
Get view area.

Returns:
the view area

setViewArea

public void setViewArea(LyArea area)
Set view area.

Parameters:
area - the view area

getLastModified

public long getLastModified()
To get the last modification date of this controller.

Overrides:
getLastModified in class LyController
Returns:
the last modification date

setContext

public boolean setContext(LyWorkSpace context)
Set current controller context.

Specified by:
setContext in interface LyContextInterface
Parameters:
context - current context or null if none is specified
Returns:
true if the context was correctly set
See Also:
LyContextInterface.getContext()

getContext

public LyWorkSpace getContext()
Get current controller context.

Specified by:
getContext in interface LyContextInterface
Returns:
current context or null if none is specified
See Also:
LyContextInterface.getContext()

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 LyController

interruptPrintThread

public void interruptPrintThread()
Interrupts printing thread registered on this controller.


setPrintThread

public void setPrintThread(java.lang.Thread thread)
Sets the printing thread for this controller.

Parameters:
thread - printing thread

hasPrintThread

public boolean hasPrintThread()
Indicates if there is a printing thread registered on this controller.

Returns:
true if there is a printing thread registered on this controller, false otherwise.

getEnvironment

public LyEnvironment getEnvironment()
Accessor to the current Environment instance This method returns the environment of the area controller displayed by this view controller.

Overrides:
getEnvironment in class LyController
Returns:
current environment instance.

setIdle

public void setIdle(boolean idle)
Sets idle mode on this controller. Calls setIdle on the area controller.

Overrides:
setIdle in class LyController
Parameters:
idle - the desired idle mode

hasSonShowing

public boolean hasSonShowing()
Check if this controller as son window showing (may decide if we free it or not).

Returns:
true if a son is visible

isInShowProcess

public boolean isInShowProcess()
Returns:
Returns the _inShowProcess.

setInShowProcess

public void setInShowProcess(boolean showProcess)
Parameters:
showProcess - The _inShowProcess to set.

getControllerStack

public java.util.Stack<LyViewController> getControllerStack()
Accessor to popup view controller stack (internal use).

Returns:
the sub controller stack

setControllerStack

public void setControllerStack(java.util.Stack<LyViewController> controllerStack)
Accessor to popup view controller stack (internal use).

Parameters:
controllerStack - the sub controller stack

setName

public void setName(java.lang.String name)
Sets view name.

Overrides:
setName in class LyController
Parameters:
name - The name of the controller may be displayed to the user in a view.

(c) January 2013 - W4 S.A.

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