LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.control
Class LyTextController

java.lang.Object
  extended by leon.control.LyController
      extended by leon.control.LyAreaController
          extended by leon.control.LyTextController
All Implemented Interfaces:
LyGetSessionInterface, LyContextInterface, LyGetActionInterface, LySelectFileListenerInterface, LyGuiListener, LyInfoListener, LyEvaluator, LyDemandListener

public class LyTextController
extends LyAreaController

This class implements a dialog window that displays a text chosen by the user or the content of a text file. The generated window can have a titleBar and an image. If a file is used, the user can specify a refresh time ( in seconds ). If the time interval is set to zero, there is no refresh.


Field Summary
static java.lang.String __VERSION
          File Version
static java.lang.String DEMAND_CLEAR
          "Clear" demand.
static java.lang.String DEMAND_SAVE_AS
          "Save as" demand.
 
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
LyTextController(LySession session, LyController parent, LyAction action, LyClassInfo classInfo, LyObjectList objects)
          Default constructor.
LyTextController(LySession session, LyController parent, LyAction action, java.lang.String[] commands, java.lang.String commandString)
          Specific constructor for console mode.
LyTextController(LySession session, LyController parent, LyAction action, java.lang.String[] commands, java.lang.String commandString, java.lang.String errorMessage)
          Specific constructor for console mode.
LyTextController(LySession session, LyController parent, LyAction action, java.lang.String file, int interval)
          Specific constructor.
LyTextController(LySession session, LyController parent, LyAction action, java.lang.String file, int interval, boolean seconds)
          Specific constructor.
LyTextController(LySession session, LyController parent, LyAction action, java.lang.String command, java.lang.String commandString)
          Specific constructor for console mode.
LyTextController(LySession session, LyController parent, LyAction action, java.lang.String command, java.lang.String commandString, java.lang.String errorMessage)
          Specific constructor for console mode.
 
Method Summary
 void actionDemand(LyActionDemand demand)
          Invoked when an action occurs.
 void clear()
          Clear text content.
 void free(LyController controller)
          Invoked when the controller is destroyed.
 java.lang.Class<?> getBehaviorInterface()
          Method that gives the interface that must be implemented by the behavior associated to this controller.
 int getInterval()
          Retrieve the refresh time.
 int getIntervalInMillis()
          Retrieve the refresh time.
 java.lang.Process getProcess()
          Gets process corresponding to command execution when used as console.
 void save(java.lang.String file)
          Open file chooser and save current text in chosen file.
 void selectFileDemand(LySelectFileController controller, LyDemand demand)
          Invoked when the user validates the input content.
 LyText setFile(java.lang.String file)
          Set the file to display in the text window.
 LyText setFile(java.lang.String file, java.lang.String fieldLabel, int nCols, int nRows)
          Set the file to display in the text window.
 void setInterval(int interval)
          Set the refresh time.
 void setIntervalInMillis(int interval)
          Set the refresh time.
 LyText setText(java.lang.String fieldLabel, java.lang.String itemLabel, int nCols, int nRows, java.lang.String format)
          Set the text to display in the text window.
 void updateText(java.lang.String content)
          Update the text in the field with the given id.
 
Methods inherited from class leon.control.LyAreaController
canClose, canFree, clearViewCache, completeMenuBar, completeMessages, free, getAction, getAreaStackController, getBehavior, getBuilder, getClassInfo, getContent, getContext, getContextClient, getContextTitle, getDefaultAction, getEnvironment, getFastEditionAction, getHelpFile, getImage, getImageTooltip, getInfoLabel, getInfoLabel, getKeyValue, getLabel, getLastModified, getMenuItemImage, getName, getParameter, getParameter, getParameterMarks, getParent, getParent, getParentAreaController, getRefreshTime, getSelection, getShortLabel, getTarget, getTitle, getViewController, getViewController, hasMark, hasNotMark, hasViewController, hideView, infoEvent, initialize, isInitialized, isOutlined, isViewResizable, menuDemand, reset, reset, setContext, setContext, setContextClient, setIdle, setPreference, setViewController, showView, showView, testParameter, toString, update, updateTitleBar
 
Methods inherited from class leon.control.LyController
activateViewDemand, demandPerformed, dragDropDemand, getApplication, getClassInfo, getComponent, getId, getImage, getImage, getImage, getImage, getImageFromPrefix, getImageFromPrefix, getImageFromPrefix, getName, getObjectId, getSession, getUserData, getView, getViewManager, helpDemand, hideView, isFreed, isIdle, selectionDemand, 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

DEMAND_SAVE_AS

public static final java.lang.String DEMAND_SAVE_AS
"Save as" demand.

See Also:
Constant Field Values

DEMAND_CLEAR

public static final java.lang.String DEMAND_CLEAR
"Clear" demand.

See Also:
Constant Field Values
Constructor Detail

LyTextController

public LyTextController(LySession session,
                        LyController parent,
                        LyAction action,
                        java.lang.String file,
                        int interval)
Specific constructor.

Parameters:
session - Session for this controller
parent - Parent controller
action - Action
file - File to display in the text window
interval - refresh interval

LyTextController

public LyTextController(LySession session,
                        LyController parent,
                        LyAction action,
                        java.lang.String file,
                        int interval,
                        boolean seconds)
Specific constructor.

Parameters:
session - Session for this controller
parent - Parent controller
action - Action
file - File to display in the text window
interval - refresh interval
seconds - true to set the unit of the refresh interval in second, false for millisecond

LyTextController

public LyTextController(LySession session,
                        LyController parent,
                        LyAction action,
                        java.lang.String command,
                        java.lang.String commandString)
Specific constructor for console mode.

Parameters:
session - Session for this controller
parent - Parent controller
action - Action
command - Command to execute
commandString - Command string to display to the end-user

LyTextController

public LyTextController(LySession session,
                        LyController parent,
                        LyAction action,
                        java.lang.String[] commands,
                        java.lang.String commandString)
Specific constructor for console mode.

Parameters:
session - Session for this controller
parent - Parent controller
action - Action
commands - Command list to execute
commandString - Command string to display to the end-user

LyTextController

public LyTextController(LySession session,
                        LyController parent,
                        LyAction action,
                        java.lang.String[] commands,
                        java.lang.String commandString,
                        java.lang.String errorMessage)
Specific constructor for console mode.

Parameters:
session - Session for this controller
parent - Parent controller
action - Action
commands - Command list to execute
commandString - Command string to display to the end-user
errorMessage - Error message to show to the end-user if needed

LyTextController

public LyTextController(LySession session,
                        LyController parent,
                        LyAction action,
                        java.lang.String command,
                        java.lang.String commandString,
                        java.lang.String errorMessage)
Specific constructor for console mode.

Parameters:
session - Session for this controller
parent - Parent controller
action - Action
command - Command to execute
commandString - Command string to display to the end-user
errorMessage - error message to show to the end-user if needed

LyTextController

public LyTextController(LySession session,
                        LyController parent,
                        LyAction action,
                        LyClassInfo classInfo,
                        LyObjectList objects)
Default constructor.

Parameters:
session - Session for this controller
parent - Parent controller
action - Action
classInfo - related classinfo
objects - context of the action
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.

actionDemand

public void actionDemand(LyActionDemand demand)
Invoked when an action occurs.

Overrides:
actionDemand in class LyAreaController
Parameters:
demand - Paramters of the action to perform
See Also:
LyController.demandPerformed(leon.view.event.LyDemand)

free

public void free(LyController controller)
Invoked when the controller is destroyed.

Overrides:
free in class LyAreaController
Parameters:
controller - parent controller
See Also:
LyAreaController

getInterval

public int getInterval()
Retrieve the refresh time.

Returns:
Refresh time interval in seconds

getIntervalInMillis

public int getIntervalInMillis()
Retrieve the refresh time.

Returns:
Refresh time interval in milliseconds

setInterval

public void setInterval(int interval)
Set the refresh time.

Parameters:
interval - Refresh time interval (in seconds). the 0 value disables the refresh

setIntervalInMillis

public void setIntervalInMillis(int interval)
Set the refresh time.

Parameters:
interval - Refresh time interval (in seconds). the 0 value disables the refresh

setFile

public LyText setFile(java.lang.String file,
                      java.lang.String fieldLabel,
                      int nCols,
                      int nRows)
Set the file to display in the text window.

Parameters:
file - Path of the file to display
fieldLabel - Label of the text field
nCols - Number of columns of the text field
nRows - Number of rows of the text field
Returns:
the text view component

setFile

public LyText setFile(java.lang.String file)
Set the file to display in the text window. In this case there is no label, and the text field has 100 columns and 20 rows

Parameters:
file - Path of the file to display
Returns:
the text view component

setText

public LyText setText(java.lang.String fieldLabel,
                      java.lang.String itemLabel,
                      int nCols,
                      int nRows,
                      java.lang.String format)
Set the text to display in the text window.

Parameters:
fieldLabel - Label of the text field
itemLabel - Text to display
nCols - Number of columns of the text field
nRows - Number of rows of the text field
format - Format of the text (See also tag of leon.dtd)
Returns:
the text view component

updateText

public void updateText(java.lang.String content)
Update the text in the field with the given id.

Parameters:
content - New text for the field

clear

public void clear()
Clear text content.


save

public void save(java.lang.String file)
Open file chooser and save current text in chosen file.

Parameters:
file - path of the file used to save the content

selectFileDemand

public void selectFileDemand(LySelectFileController controller,
                             LyDemand demand)
Invoked when the user validates the input content.

Specified by:
selectFileDemand in interface LySelectFileListenerInterface
Overrides:
selectFileDemand in class LyAreaController
Parameters:
controller - the current LySelectFileController instance
demand - demand parameters sent by the view component.

getProcess

public java.lang.Process getProcess()
Gets process corresponding to command execution when used as console.

Returns:
the process

(c) January 2013 - W4 S.A.

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