LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.view.web
Class LyWebObject

java.lang.Object
  extended by leon.view.graphic.LyGraphicalObject
      extended by leon.view.web.LyWebObject
All Implemented Interfaces:
LyGraphicalComponent, LyViewComponent, LyFreeInterface, LyWebComponent
Direct Known Subclasses:
LyJQInternalView, LyJQLayout, LyStrutsCaption, LyStrutsCell, LyStrutsCommand, LyStrutsCommands, LyStrutsFieldItem, LyStrutsFooter, LyStrutsFooters, LyStrutsFormField, LyStrutsGauge, LyStrutsHeader, LyStrutsHeaders, LyStrutsInterval, LyStrutsItem, LyStrutsLayout, LyStrutsLine, LyStrutsLink, LyStrutsListOption, LyStrutsMapContent, LyStrutsMapObject, LyStrutsMenu, LyStrutsMenuBar, LyStrutsMessage, LyStrutsMessages, LyStrutsOption, LyStrutsPolygon, LyStrutsRow, LyStrutsRows, LyStrutsSelectItem, LyStrutsTab, LyStrutsTip, LyStrutsTitleBar, LyStrutsTool, LyStrutsToolBar, LyStrutsTreeNode, LyWebPageWriter

public abstract class LyWebObject
extends LyGraphicalObject
implements LyWebComponent

The LyWebObject class implements root object for all Web components.


Field Summary
static java.lang.String __VERSION
           
static java.lang.String WEB_COMPONENT_ID
           
static java.lang.String WEB_CONTROLLER_ID
           
static java.lang.String WEB_SESSION_ID
           
 
Constructor Summary
LyWebObject(LyComponent viewComponent)
          Constructs abstract graphical component.
 
Method Summary
 void addFileScript(java.lang.String fileName)
          Add an external Javascript file to the view manager scripts.
static java.lang.String decodeUrl(java.lang.String url)
          Encode an URL by replacing unauthorized characters.
static boolean displayUpPage(LyEnvironment env)
          Indicates if an up page is displayed in the web browser.
static java.lang.String encodeUrl(java.lang.String url)
          Encode an URL by replacing unauthorized characters.
static java.lang.String encodeUrlXhtml(java.lang.String url)
          Encode an URL by replacing unauthorized characters.
 java.lang.String expandUrl(java.lang.String text)
          Replaces within a given String some $properties$ found in the system environment.
 void free()
          Free resources allocated to this component.
 java.lang.String getDisabledImageUrl(java.lang.String key)
          Retrieves a disabled image url from the application environment.
 int getFontSize(java.lang.String key)
          Gets font corresponding to the given key.
 java.lang.String getFontString(java.lang.String key)
          Gets font description.
 java.lang.String getFontString(java.lang.String key, boolean color)
          Gets font description.
 java.lang.String getFontString(java.lang.String key, java.lang.String color)
          Gets font and color description.
 java.lang.String getHexColor(java.lang.String key)
          Get hexadecimal color from given key.
 java.lang.String getHexColor(java.lang.String key, java.lang.String defaultKey)
          Get hexadecimal color from given key.
 java.lang.String getHtmlEntitiesString(java.lang.String label)
          Gets encoded HTML string from given string.
 java.lang.String getHtmlString(java.lang.String label)
          Gets encoded HTML string from given string.
 int[] getImageSize(java.lang.String key)
          Retrieves the dimensions of an image.
 int[] getImageSize(java.lang.String key, boolean enableLoadImage)
          Retrieves the dimensions of an image.
 java.lang.String getImageUrl(java.lang.String key)
          Retrieves an image url from the application environment.
 java.lang.String getJavascriptString(java.lang.String label)
          Gets encoded Javascript string from given string.
 java.lang.String getLastFrameName()
          Return the name of the frame where this object was last generated.
 LyFont getLyFont(java.lang.String key)
          Gets font corresponding to the given key.
 java.lang.String getMessage(java.lang.String key, java.lang.Object[] arguments)
          Convenient routine to get a formated message with given arguments.
 java.lang.String getRootUrl()
          Gets root URL.
static java.lang.String getRootURL(LyEnvironment environment)
          Get servlet root URL : this is "http://"+local host + LY_APP_DOC rebuild the root Url.
 int getScrollHeightForSplitter(LyWebPageWriter pw)
          Indicates whether this component needs scrollbars when inserted in a splitter.
 java.lang.String getUrl(java.lang.String key)
          Retrieves an url from the application environment.
 LyWebViewManager getWebViewManager()
          Gets web view manager.
 void refresh()
          Refresh frame containing this web object.
 java.lang.String replaceUrl(java.lang.String label, java.lang.String target, boolean printMode)
          Replace an URL pattern http:// inside the document by href tags.
 java.lang.String replaceUrl(java.lang.String label, java.lang.String target, boolean printMode, int maxLength, java.lang.String fontString)
          Replace an URL pattern http:// inside the document by href tags.
 void setUpdating(boolean updating)
          Indicates if a modification of the component is in process.
 void updateRefreshInfo(LyWebPageWriter pw)
          Update the refresh info of this object.
 void writeJson(java.io.PrintWriter pw, java.lang.String sessionId)
          Generate a webview on a mobile
 
Methods inherited from class leon.view.graphic.LyGraphicalObject
expand, getBounds, getChildrenBounds, getController, getEnv, getEnvironment, getIdCode, getIntResource, getMessage, getResource, getString, getString, getString, getViewComponent, getViewManager, isFreed, isFreeing, isImageAnimated, processDemand, processDemand, testResource, translate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface leon.view.web.LyWebComponent
writeHtml
 

Field Detail

__VERSION

public static final java.lang.String __VERSION
See Also:
Constant Field Values

WEB_COMPONENT_ID

public static final java.lang.String WEB_COMPONENT_ID

WEB_CONTROLLER_ID

public static final java.lang.String WEB_CONTROLLER_ID

WEB_SESSION_ID

public static final java.lang.String WEB_SESSION_ID
Constructor Detail

LyWebObject

public LyWebObject(LyComponent viewComponent)
Constructs abstract graphical component.

Parameters:
viewComponent - the view component
Method Detail

encodeUrl

public static java.lang.String encodeUrl(java.lang.String url)
Encode an URL by replacing unauthorized characters.

Parameters:
url - the URL to encode
Returns:
the encoded URL

encodeUrlXhtml

public static java.lang.String encodeUrlXhtml(java.lang.String url)
Encode an URL by replacing unauthorized characters.

Parameters:
url - the URL to encode
Returns:
the encoded URL

decodeUrl

public static java.lang.String decodeUrl(java.lang.String url)
Encode an URL by replacing unauthorized characters.

Parameters:
url - the URL to encode
Returns:
the encoded URL

getRootURL

public static java.lang.String getRootURL(LyEnvironment environment)
Get servlet root URL : this is "http://"+local host + LY_APP_DOC rebuild the root Url.

Parameters:
environment - the application environment
Returns:
the root URL

displayUpPage

public static boolean displayUpPage(LyEnvironment env)
Indicates if an up page is displayed in the web browser.

Parameters:
env - the application environment
Returns:
true if an up page is displayed in the web browser, false otherwise

free

public void free()
Description copied from class: LyGraphicalObject
Free resources allocated to this component.

Specified by:
free in interface LyGraphicalComponent
Specified by:
free in interface LyFreeInterface
Overrides:
free in class LyGraphicalObject
See Also:
LyFreeInterface.free()

getWebViewManager

public final LyWebViewManager getWebViewManager()
Gets web view manager.

Returns:
the web view manager

getHtmlString

public final java.lang.String getHtmlString(java.lang.String label)
Gets encoded HTML string from given string.

Parameters:
label - the string to encode
Returns:
the HTML encoded string
See Also:
LyString.getHtmlString(String)

getHtmlEntitiesString

public final java.lang.String getHtmlEntitiesString(java.lang.String label)
Gets encoded HTML string from given string.

Parameters:
label - the string to encode
Returns:
the HTML encoded string
See Also:
LyString.getHtmlEntitiesString(String)

getJavascriptString

public final java.lang.String getJavascriptString(java.lang.String label)
Gets encoded Javascript string from given string.

Parameters:
label - the given string
Returns:
the encoded Javascript string
See Also:
LyString.getJavascriptString(String)

getLyFont

public final LyFont getLyFont(java.lang.String key)
Gets font corresponding to the given key.

Parameters:
key - the font key
Returns:
the font

getFontSize

public final int getFontSize(java.lang.String key)
Gets font corresponding to the given key.

Parameters:
key - the font key
Returns:
the font size

getRootUrl

public java.lang.String getRootUrl()
Gets root URL.

Returns:
the root URL
See Also:
getRootURL(LyEnvironment)

expandUrl

public final java.lang.String expandUrl(java.lang.String text)
Replaces within a given String some $properties$ found in the system environment. This method is looking for macros between '$' and replaces these macros by a property if any (such as $LY_APP_DIR$/data/test.html).

Parameters:
text - The original string, before any substitution.
Returns:
The string after all substitutions.

getUrl

public java.lang.String getUrl(java.lang.String key)
Retrieves an url from the application environment.

Parameters:
key - The ressource name (key) of the url
Returns:
A reference to the requested url, or null if it could not be found.
See Also:
LyEnvironment.getUrl(String)

getImageUrl

public final java.lang.String getImageUrl(java.lang.String key)
Retrieves an image url from the application environment.

Parameters:
key - The ressource name (key) of the image.
Returns:
The image url, or the key if it could not be found.
See Also:
LyEnvironment.getImageUrl(String)

getDisabledImageUrl

public final java.lang.String getDisabledImageUrl(java.lang.String key)
Retrieves a disabled image url from the application environment.

Parameters:
key - The ressource name (key) of the image.
Returns:
The image url, or the key if it could not be found.
See Also:
LyEnvironment.getDisabledImageUrl(String)

getImageSize

public final int[] getImageSize(java.lang.String key)
Retrieves the dimensions of an image.

Parameters:
key - the key of the image or the path of the image
Returns:
An array of two integers (width, height) describing the size of the image or null if no size is given.

getImageSize

public final int[] getImageSize(java.lang.String key,
                                boolean enableLoadImage)
Retrieves the dimensions of an image.

Parameters:
key - the key of the image or the path of the image
enableLoadImage - indicates wether the application is allowed to load the image
Returns:
An array of two integers (width, height) describing the size of the image or null if no size is given.

getMessage

public final java.lang.String getMessage(java.lang.String key,
                                         java.lang.Object[] arguments)
Convenient routine to get a formated message with given arguments.

Overrides:
getMessage in class LyGraphicalObject
See Also:
LyEnvironment.getMessage(String, Object[])

getHexColor

public java.lang.String getHexColor(java.lang.String key)
Get hexadecimal color from given key.

Parameters:
key - The ressource name (key) of the Color.
Returns:
the hexadecimal color for the given key (eg: #FF0000)

getHexColor

public java.lang.String getHexColor(java.lang.String key,
                                    java.lang.String defaultKey)
Get hexadecimal color from given key.

Parameters:
key - The ressource name (key) of the Color.
defaultKey - The default ressource name (key) to be used if no color was found for given key
Returns:
the hexadecimal color for the given key (eg: #FF0000)

getFontString

public final java.lang.String getFontString(java.lang.String key)
Gets font description.

Parameters:
key - The ressource name (key) of the Font.
Returns:
a string describing the font. This result may be used in a css stylesheet.

getFontString

public java.lang.String getFontString(java.lang.String key,
                                      boolean color)
Gets font description.

Parameters:
key - The ressource name (key) of the Font.
color - Indicates whether the color for given key must be retrieved.
Returns:
a string describing the font. This result may be used in a css stylesheet.

getFontString

public java.lang.String getFontString(java.lang.String key,
                                      java.lang.String color)
Gets font and color description.

Parameters:
key - The ressource name (key) of the Font.
color - The ressource name (key) of the Color.
Returns:
a string describing the font. This result may be used in a css stylesheet.

updateRefreshInfo

public void updateRefreshInfo(LyWebPageWriter pw)
Update the refresh info of this object. This method updates information such as _lastFrameName and _lastWindowName with values given by the page writer parameter.

Parameters:
pw - the current page writer

getLastFrameName

public java.lang.String getLastFrameName()
Return the name of the frame where this object was last generated.

Returns:
the value of the _lastFrameName attribute.

refresh

public void refresh()
Refresh frame containing this web object.


addFileScript

public void addFileScript(java.lang.String fileName)
Add an external Javascript file to the view manager scripts.

Parameters:
fileName - the name of the external Javascript file

replaceUrl

public java.lang.String replaceUrl(java.lang.String label,
                                   java.lang.String target,
                                   boolean printMode)
Replace an URL pattern http:// inside the document by href tags. This method is a recursive building of links like :

Parameters:
label - the label containing URLs
target - the target frame of the URL
printMode - indicates if print mode is active
Returns:
the new URL

replaceUrl

public java.lang.String replaceUrl(java.lang.String label,
                                   java.lang.String target,
                                   boolean printMode,
                                   int maxLength,
                                   java.lang.String fontString)
Replace an URL pattern http:// inside the document by href tags. This method is a recursive building of links like :

Parameters:
label - the label containing URLs
target - the target frame of the URL
printMode - indicates if print mode is active
maxLength - indicates the maxLength of the generated link
fontString - the font property used to display label
Returns:
the new URL

getScrollHeightForSplitter

public int getScrollHeightForSplitter(LyWebPageWriter pw)
Indicates whether this component needs scrollbars when inserted in a splitter.

Parameters:
pw - current page writer
Returns:
a positive value if this component needs scrollbars, a negative or null value otherwise.

setUpdating

public void setUpdating(boolean updating)
Indicates if a modification of the component is in process.

Parameters:
updating - true if component is being updated, false otherwise.

writeJson

public void writeJson(java.io.PrintWriter pw,
                      java.lang.String sessionId)
Generate a webview on a mobile

Parameters:
pw - PrintWriter
sessionId - the session id

(c) January 2013 - W4 S.A.

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