LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.control
Class LyShowUrlController

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

public class LyShowUrlController
extends LyPanelController

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
 
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
LyShowUrlController(LySession session, LyController parent, LyAction action, LyClassInfo classInfo, LyObjectList context)
          Specific constructor.
 
Method Summary
 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.
 LyObjectList getContent()
          This method is overriden to return null because there is not any content.
 java.lang.String getFileContent(java.io.InputStream in, LyEnvironment environment, boolean showError)
          Get the file content
 java.lang.String getFileContent(java.lang.String fileName, LyEnvironment environment)
          Gets the given file content.
 java.lang.String getFileContent(java.lang.String fileName, LyEnvironment environment, boolean showError)
          Gets the given file content.
 java.io.InputStream getFileInputStream(java.lang.String urlName, LyEnvironment environment, boolean showError)
          Gets the Input Stream associated to the given file name.
 java.net.URL getFileUrl(java.lang.String fileName, LyEnvironment environment, boolean showError)
          Gets the URL from the file name.
 LyPanel getPanelComponent()
          Accessor to the Table component.
 LyObjectList getSelection()
          This method is overriden to return null because there is not any selection.
 java.lang.String getUrl()
          Gets the current url.
 void initialize(LyAction action)
          Initialize the controller for the given action
 LyText setText(java.lang.String fieldLabel, java.lang.String itemLabel, int nCols, int nRows, java.lang.String format)
          Sets the text to display in the text window.
 LyText setUrl(java.lang.String url)
          Sets the file to display in the text window.
 LyText setUrl(java.lang.String request, java.lang.String fieldLabel, int nCols, int nRows)
          Sets the url to display in the text window.
 void showView()
          Make the view visible to the user.
 void updateText(java.lang.String itemLabel)
          Updates the text in the field with the given id.
 void updateUrl(java.lang.String url)
          Sets the current url and update the view.
 
Methods inherited from class leon.control.LyPanelController
actionDemand, buildFilter, closeBorderPanel, enablesMultiSelection, endFilter, findObject, getFilter, getFilterController, getFilterEditorController, getPreference, getRefreshTime, isFilterActive, isHorizontal, objectAdded, objectChanged, objectRemoved, objectStateChanged, objectUserEvent, questionAnswer, reset, selectAllObjects, selectObject, setFilter, setIdle, setPreference, setRefreshTime, updatePreferencesMenu, workSpaceEventsGrouped
 
Methods inherited from class leon.control.LyAreaController
canClose, canFree, clearViewCache, 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, menuDemand, reset, selectFileDemand, setContext, setContext, setContextClient, setViewController, 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
Constructor Detail

LyShowUrlController

public LyShowUrlController(LySession session,
                           LyController parent,
                           LyAction action,
                           LyClassInfo classInfo,
                           LyObjectList context)
Specific constructor.

Parameters:
session - Session for this controller
parent - Parent controller
action - Action
classInfo - corresponding classinfo
context - current context
Method Detail

initialize

public void initialize(LyAction action)
Initialize the controller for the given action

Parameters:
action - an action

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.

free

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

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

setUrl

public LyText setUrl(java.lang.String request,
                     java.lang.String fieldLabel,
                     int nCols,
                     int nRows)
Sets the url to display in the text window.

Parameters:
request - Url 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

getFileUrl

public java.net.URL getFileUrl(java.lang.String fileName,
                               LyEnvironment environment,
                               boolean showError)
Gets the URL from the file name.
Tries first to create the URL from the String.
If an exception occurs, tries to create the URL from a file.

If a url is found, encode the URL name thaks to the method LyString.getXmlString(String, boolean, boolean).

Parameters:
fileName - the file whose URL is required
environment - the current environment
showError - indicates if an error message has to be shown to the user.
Returns:
the XML encoded file URL if found, null otherwise.

getFileInputStream

public java.io.InputStream getFileInputStream(java.lang.String urlName,
                                              LyEnvironment environment,
                                              boolean showError)
Gets the Input Stream associated to the given file name.

Parameters:
urlName - the file to read given as an url string
environment - the current environment
showError - if true, show errors thrown to the user
Returns:
the input stream of the file if found, null otherwise
See Also:
LyShowUrlBehavior.getFileUrl(LyShowUrlController, String, LyEnvironment, boolean)

getFileContent

public java.lang.String getFileContent(java.lang.String fileName,
                                       LyEnvironment environment,
                                       boolean showError)
Gets the given file content.

Parameters:
fileName - the file to read
environment - the current environment
showError - indicates if an error has to be shown to the user. If false, only print error in log files
Returns:
the file content if the file is found and could be read, null otherwise

getFileContent

public java.lang.String getFileContent(java.io.InputStream in,
                                       LyEnvironment environment,
                                       boolean showError)
Get the file content

Parameters:
in - the source input stream
environment - the current environment
showError - indicates if an error must be shown to the user if needed
Returns:
the file content

getFileContent

public java.lang.String getFileContent(java.lang.String fileName,
                                       LyEnvironment environment)
Gets the given file content.

Parameters:
fileName - the file to read
environment - the current environment
Returns:
the file content if the file is found and could be read, null otherwise
See Also:
getFileContent(String, LyEnvironment, boolean)

setUrl

public LyText setUrl(java.lang.String url)
Sets 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:
url - Url 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)
Sets 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 itemLabel)
Updates the text in the field with the given id.

Parameters:
itemLabel - New text for the field

getSelection

public LyObjectList getSelection()
This method is overriden to return null because there is not any selection.

Overrides:
getSelection in class LyPanelController
Returns:
always null

getContent

public LyObjectList getContent()
This method is overriden to return null because there is not any content.

Specified by:
getContent in class LyPanelController
Returns:
always null

getPanelComponent

public LyPanel getPanelComponent()
Description copied from class: LyPanelController
Accessor to the Table component.

Specified by:
getPanelComponent in class LyPanelController
Returns:
the panel component
See Also:
LyPanelController.getPanelComponent()

showView

public void showView()
Make the view visible to the user. The effect of this command depends on the nature of the application. If the display is a fat client (windows (awt) / swing) this methods should open a window and show the view. In the case of thin client (html), this prepares the pages which will be returned and displayed in the client browser.

For any display, this method should consider that the page is ready to be shown and should be displayed.

Overrides:
showView in class LyAreaController

updateUrl

public void updateUrl(java.lang.String url)
Sets the current url and update the view.

Parameters:
url - the new url

getUrl

public java.lang.String getUrl()
Gets the current url. Gets the behavior url if not null, the first url otherwise.

Returns:
the current url
See Also:
LyShowUrlBehavior.getUrl(LyShowUrlController)

(c) January 2013 - W4 S.A.

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