LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.view.web.struts
Class LyStrutsMap

java.lang.Object
  extended by leon.view.graphic.LyGraphicalObject
      extended by leon.view.web.LyWebObject
          extended by leon.view.web.LyWebPageWriter
              extended by leon.view.web.struts.LyStrutsMap
All Implemented Interfaces:
LyGraphicalComponent, LyGraphicalFieldItem, LyGraphicalMap, LyGraphicalPanel, LyViewComponent, LyFreeInterface, LyResetContentInterface, LySetIdleInterface, LySetLabelInterface, LySetPopupMenuInterface, LySetViewerInterface, LySetVisibleInterface, LyWebComponent

public class LyStrutsMap
extends LyWebPageWriter
implements LyGraphicalMap, LySetVisibleInterface, LyResetContentInterface, LySetIdleInterface, LySetPopupMenuInterface

This class implements the Map object (as described in the dtd) for Struts viewer.

See Also:
LyMap

Nested Class Summary
static class LyStrutsMap.TranslationDirection
          Directions that may be used to translate the map component.
static class LyStrutsMap.ViewerPosition
          Possible positions of the viewer widget.
 
Field Summary
static java.lang.String __VERSION
           
static boolean CLEAR_MAP_FILES
          Force the map to keep the ten last map files and to destroy the oldest.
static int MAP_HEIGHT
          the map height.
static int MAP_WIDTH
          The map width.
static int MAX_TEMP_FILES
          Deprecated.  
static boolean NO_BACKGROUND
           
static java.awt.Color VIEWER_BORDER_COLOR
          Color used for the border of the viewer.
static java.awt.Color VIEWER_DISPLAYED_PART_BORDER_COLOR
          Color used for the border of the displayed part in the viewer.
static int ZOOM_STEPS_NB
          Number of steps available in the zoom widget (positive as well as negative).
 
Fields inherited from class leon.view.web.LyWebPageWriter
FORCE_AJAX, MAIN_BUFFER
 
Fields inherited from class leon.view.web.LyWebObject
WEB_COMPONENT_ID, WEB_CONTROLLER_ID, WEB_SESSION_ID
 
Constructor Summary
LyStrutsMap(LyMap map)
          Class constructor of a Map object for the struts target.
 
Method Summary
 void addComponent(LyComponent component, int pos)
          (non-Javadoc).
 void free()
          (non-Javadoc).
 java.lang.String generateMapImage(int xoffset, int yoffset, int width, int height, boolean viewer)
           
 java.awt.Color getColor(java.lang.String key)
          Retrieves a Color from the current environment.
 java.awt.Component getComponent()
          Gets the map box component.
static java.awt.Frame getDefaultFrame()
          Gets the default frame.
 java.awt.Font getFont(java.lang.String key)
          Retrieves a Font from the current environment.
static java.lang.String getHexString(java.awt.Color color)
          Gets the hexadecimal string representing the given color.
 java.awt.Image getImage(java.lang.String key)
          Retrieves an image from the current environment.
 leon.view.web.struts.map.LyStrutsMapCanvas getMapCanvas()
          Returns the map canvas.
 java.awt.Dimension getMapDimension()
          Returns the dimension of the generated image.
 LyStrutsMapNode getNodeById(java.lang.String nodeId)
          Gets the node cprresponding to the given Id.
 java.util.Vector<LyWebPageWriter> getPageWriters()
          (non-Javadoc).
 java.lang.String getRedirect(java.lang.String frame)
          (non-Javadoc).
 int getScrollHeightForSplitter(LyWebPageWriter pw)
          Indicates whether this component needs scrollbars when inserted in a splitter.
 void init()
          (non-Javadoc).
 boolean isFrameSet()
          (non-Javadoc).
 boolean isIdle()
          Checks if the component is idle or not.
 void preparePage(java.lang.String frame, java.lang.String targetWindow)
          (non-Javadoc).
 void refreshMapImage()
          Set the _refreshBackgroundImage attribute in order to refresh the background image used by the map.
 void refreshViewerImage()
          Set the _refreshViewerImage attribute in order to refresh the viewer image used by the map.
 void removeComponent(LyComponent component)
          (non-Javadoc).
 void resetContent()
          (non-Javadoc).
 void resetContent(boolean full)
          (non-Javadoc).
 void resetElementsPositions()
          Resets the position of all the elements contained in the map.
 void setContent()
          Sets the content of the map.
 void setIdle(boolean status)
          (non-Javadoc).
 void setLabel(java.lang.String label)
          (non-Javadoc).
 void setLayout(LyLayout layout)
          (non-Javadoc).
 void setMapContent(LyMapContent mapContent)
          Sets sub-component mapContent.
 void setPopupMenu(LyPopupMenu popup)
          Sets the popup menu with the given value.
 void setSpatial(boolean spatial)
          (non-Javadoc).
 void setTranslation(boolean translation)
          Updates attribute translation to the given value.
 void setTranslationStatus(LyMapBase.TranslationStatus translationStatus)
          (non-Javadoc).
 void setViewer(boolean viewer)
          (non-Javadoc).
 void setViewerStatus(LyMapBase.ViewerStatus viewerStatus)
          (non-Javadoc).
 void setVisible(boolean status)
          (non-Javadoc).
 void setZoom(boolean zoom)
          Updates attribute zoom to the given value.
 void setZoomFactor(float zoomFactor)
          Updates attribute zoomFactor to the given value.
 void setZoomStatus(LyMapBase.ZoomStatus zoomStatus)
          (non-Javadoc).
 void updateBackgroundImage()
          Refresh the background image used by the map.
 void updateViewerImage()
          Refresh the viewer image used by the map.
 void writeBeginPage(java.io.Writer pw, java.lang.String frame)
          (non-Javadoc).
 void writeHiddenFrame(LyWebPageWriter pw)
          Writes HTML description corresponding to this component.
 void writeHtml(LyWebPageWriter pw)
          (non-Javadoc).
 void writeHtml(java.io.Writer pw, java.lang.String frame)
          (non-Javadoc).
 void writeMapFrame(LyWebPageWriter pw)
          Write HTML description of the map frame.
 
Methods inherited from class leon.view.web.LyWebPageWriter
addBeginScript, addCssScript, addEndScript, addEndScript, append, clearBeginScripts, clearBeginScripts, clearBuffer, clearCssScripts, clearCssScripts, clearEndScripts, clearEndScripts, copyScriptsTo, endComponent, getActionUrl, getActiveFormId, getActiveName, getAttachmentDirectory, getAttachmentHandler, getBackground, getBackgroundColor, getBeginScriptsAsHtml, getBuffer, getCssFileAsHtml, getCssScriptsAsHtml, getEndScriptsAsHtml, getForceReloadState, getFormId, getFrameName, getId, getLastReloadTime, getNextJavaScriptId, getOldIds, getOpenFormContent, getOpenFormContent, getProperty, getScriptRoot, getTarget, getWindowName, isInnerView, isNoFrames, isPrintMode, isVisible, setActiveBuffer, setAttachmentDirectory, setAttachmentDirectory, setAttachmentHandler, setAttachmentHandler, setBackground, setBackgroundColor, setBodyClassName, setForceReloadState, setFormId, setFrameName, setInnerView, setLastModified, setNoFrames, setPrintMode, setProperty, setTitle, setWindowName, setWriteDivOnly, startComponent, writeBeginScripts, writeCssScripts, writeDivOnly, writeEndPage, writeEndScripts, writePageContent
 
Methods inherited from class leon.view.web.LyWebObject
addFileScript, decodeUrl, displayUpPage, encodeUrl, encodeUrlXhtml, expandUrl, getDisabledImageUrl, getFontSize, getFontString, getFontString, getFontString, getHexColor, getHexColor, getHtmlEntitiesString, getHtmlString, getImageSize, getImageSize, getImageUrl, getJavascriptString, getLastFrameName, getLyFont, getMessage, getRootUrl, getRootURL, getUrl, getWebViewManager, refresh, replaceUrl, replaceUrl, setUpdating, updateRefreshInfo, writeJson
 
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.graphic.LyGraphicalComponent
getViewComponent
 

Field Detail

__VERSION

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

VIEWER_BORDER_COLOR

public static java.awt.Color VIEWER_BORDER_COLOR
Color used for the border of the viewer.


VIEWER_DISPLAYED_PART_BORDER_COLOR

public static java.awt.Color VIEWER_DISPLAYED_PART_BORDER_COLOR
Color used for the border of the displayed part in the viewer.


ZOOM_STEPS_NB

public static int ZOOM_STEPS_NB
Number of steps available in the zoom widget (positive as well as negative).


MAP_WIDTH

public static int MAP_WIDTH
The map width.


MAP_HEIGHT

public static int MAP_HEIGHT
the map height.


MAX_TEMP_FILES

public static int MAX_TEMP_FILES
Deprecated. 
The maximum number of temporary files.


NO_BACKGROUND

public static boolean NO_BACKGROUND

CLEAR_MAP_FILES

public static boolean CLEAR_MAP_FILES
Force the map to keep the ten last map files and to destroy the oldest.

Constructor Detail

LyStrutsMap

public LyStrutsMap(LyMap map)
Class constructor of a Map object for the struts target.

Parameters:
map - the generic Map defined for every type of view targets.
Method Detail

getDefaultFrame

public static java.awt.Frame getDefaultFrame()
Gets the default frame.

Returns:
the default frame.

getHexString

public static java.lang.String getHexString(java.awt.Color color)
Gets the hexadecimal string representing the given color.

Parameters:
color - the color to convert.
Returns:
the hexadecimal code for the color.

writeHtml

public void writeHtml(LyWebPageWriter pw)
(non-Javadoc).

Specified by:
writeHtml in interface LyWebComponent
Parameters:
pw - the page writer
See Also:
LyWebComponent.writeHtml(leon.view.web.LyWebPageWriter)

writeHtml

public void writeHtml(java.io.Writer pw,
                      java.lang.String frame)
               throws java.io.IOException
(non-Javadoc).

Overrides:
writeHtml in class LyWebPageWriter
Throws:
java.io.IOException
See Also:
LyWebPageWriter.writeHtml(java.io.Writer, java.lang.String)

writeMapFrame

public void writeMapFrame(LyWebPageWriter pw)
Write HTML description of the map frame.

Parameters:
pw - the page writer

generateMapImage

public java.lang.String generateMapImage(int xoffset,
                                         int yoffset,
                                         int width,
                                         int height,
                                         boolean viewer)

free

public void free()
(non-Javadoc).

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

refreshViewerImage

public void refreshViewerImage()
Set the _refreshViewerImage attribute in order to refresh the viewer image used by the map.


setIdle

public void setIdle(boolean status)
(non-Javadoc).

Specified by:
setIdle in interface LySetIdleInterface
Parameters:
status - new idle status (LySetIdleInterface interface)
See Also:
LySetIdleInterface.setIdle(boolean)

updateBackgroundImage

public void updateBackgroundImage()
Refresh the background image used by the map.


updateViewerImage

public void updateViewerImage()
Refresh the viewer image used by the map.


removeComponent

public void removeComponent(LyComponent component)
(non-Javadoc).

Specified by:
removeComponent in interface LyGraphicalMap
Parameters:
component - The components to remove to components list.
See Also:
LyGraphicalMap.removeComponent(leon.view.LyComponent)

getScrollHeightForSplitter

public int getScrollHeightForSplitter(LyWebPageWriter pw)
Description copied from class: LyWebObject
Indicates whether this component needs scrollbars when inserted in a splitter.

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

getMapCanvas

public leon.view.web.struts.map.LyStrutsMapCanvas getMapCanvas()
Returns the map canvas.


resetElementsPositions

public void resetElementsPositions()
Resets the position of all the elements contained in the map.


isIdle

public boolean isIdle()
Checks if the component is idle or not.

Returns:
true if the component is idle (it is not refreshed when modifications are applied).

setZoomFactor

public void setZoomFactor(float zoomFactor)
Description copied from interface: LyGraphicalMap
Updates attribute zoomFactor to the given value.

Specified by:
setZoomFactor in interface LyGraphicalMap
Parameters:
zoomFactor - New value of zoomFactor.

setTranslationStatus

public void setTranslationStatus(LyMapBase.TranslationStatus translationStatus)
(non-Javadoc).

Specified by:
setTranslationStatus in interface LyGraphicalMap
Parameters:
translationStatus - New value of translationStatus.
See Also:
LyGraphicalMap.setTranslationStatus(leon.view.LyMapBase.TranslationStatus)

setZoomStatus

public void setZoomStatus(LyMapBase.ZoomStatus zoomStatus)
(non-Javadoc).

Specified by:
setZoomStatus in interface LyGraphicalMap
Parameters:
zoomStatus - New value of zoomStatus.
See Also:
LyGraphicalMap.setZoomStatus(leon.view.LyMapBase.ZoomStatus)

setViewerStatus

public void setViewerStatus(LyMapBase.ViewerStatus viewerStatus)
(non-Javadoc).

Specified by:
setViewerStatus in interface LyGraphicalMap
Parameters:
viewerStatus - New value of viewerStatus.
See Also:
LyGraphicalMap.setViewerStatus(leon.view.LyMapBase.ViewerStatus)

writeBeginPage

public void writeBeginPage(java.io.Writer pw,
                           java.lang.String frame)
                    throws java.io.IOException
(non-Javadoc).

Overrides:
writeBeginPage in class LyWebPageWriter
Parameters:
pw - the page writer
frame - the frame where the page is written
Throws:
java.io.IOException - if something is wrong during page writing
See Also:
leon.view.web.LyWebPage#writeBeginPage(java.io.Writer, java.lang.String)

preparePage

public void preparePage(java.lang.String frame,
                        java.lang.String targetWindow)
(non-Javadoc).

Overrides:
preparePage in class LyWebPageWriter
See Also:
LyWebPageWriter.preparePage(java.lang.String, java.lang.String)

init

public void init()
(non-Javadoc).

Overrides:
init in class LyWebPageWriter
See Also:
leon.view.web.LyWebPage#init()

setPopupMenu

public void setPopupMenu(LyPopupMenu popup)
Sets the popup menu with the given value.

Specified by:
setPopupMenu in interface LySetPopupMenuInterface
Parameters:
popup - the new popup menu

setContent

public void setContent()
Sets the content of the map.


addComponent

public void addComponent(LyComponent component,
                         int pos)
(non-Javadoc).

Specified by:
addComponent in interface LyGraphicalMap
Parameters:
component - The components to add to components list.
pos - Position where the sub-component is inserted.
See Also:
LyGraphicalMap.addComponent(leon.view.LyComponent, int)

writeHiddenFrame

public void writeHiddenFrame(LyWebPageWriter pw)
Writes HTML description corresponding to this component.

Parameters:
pw - the page writer

setVisible

public void setVisible(boolean status)
(non-Javadoc).

Specified by:
setVisible in interface LySetVisibleInterface
Overrides:
setVisible in class LyWebPageWriter
Parameters:
status - new visibility status, if true the component will be shown, if false it will be hiden
See Also:
leon.view.web.LyWebPage#setVisible(boolean)

setMapContent

public void setMapContent(LyMapContent mapContent)
Sets sub-component mapContent.

Specified by:
setMapContent in interface LyGraphicalMap
Parameters:
mapContent - New value of mapContent

resetContent

public void resetContent()
(non-Javadoc).

Specified by:
resetContent in interface LyResetContentInterface
See Also:
LyResetContentInterface.resetContent()

resetContent

public void resetContent(boolean full)
(non-Javadoc).

Specified by:
resetContent in interface LyResetContentInterface
Parameters:
full - indicates whether old components must be removed from graphical view.
See Also:
LyResetContentInterface.resetContent(boolean)

getMapDimension

public java.awt.Dimension getMapDimension()
Returns the dimension of the generated image.

Returns:
the dimension of the generated image.

getComponent

public java.awt.Component getComponent()
Gets the map box component.

Returns:
the map box component

getNodeById

public LyStrutsMapNode getNodeById(java.lang.String nodeId)
Gets the node cprresponding to the given Id.

Parameters:
nodeId - the id of the wanted node
Returns:
the node if it is found, null otherwise

setLabel

public void setLabel(java.lang.String label)
(non-Javadoc).

Specified by:
setLabel in interface LyGraphicalMap
Specified by:
setLabel in interface LySetLabelInterface
Parameters:
label - New value of label.
See Also:
LySetLabelInterface.setLabel(java.lang.String)

setSpatial

public void setSpatial(boolean spatial)
(non-Javadoc).

Specified by:
setSpatial in interface LyGraphicalMap
Parameters:
spatial - Boolean indicating if attribute spatial is set or unset.
See Also:
LyGraphicalMap.setSpatial(boolean)

setViewer

public void setViewer(boolean viewer)
(non-Javadoc).

Specified by:
setViewer in interface LyGraphicalMap
Specified by:
setViewer in interface LySetViewerInterface
Parameters:
viewer - Boolean indicating if attribute viewer is set or unset.
See Also:
LySetViewerInterface.setViewer(boolean)

setLayout

public void setLayout(LyLayout layout)
(non-Javadoc).

Specified by:
setLayout in interface LyGraphicalMap
Parameters:
layout - New value of layout
See Also:
LyGraphicalMap.setLayout(leon.view.LyLayout)

refreshMapImage

public void refreshMapImage()
Set the _refreshBackgroundImage attribute in order to refresh the background image used by the map.


getPageWriters

public java.util.Vector<LyWebPageWriter> getPageWriters()
(non-Javadoc).

Specified by:
getPageWriters in class LyWebPageWriter
See Also:
LyWebPageWriter.getPageWriters()

getRedirect

public java.lang.String getRedirect(java.lang.String frame)
(non-Javadoc).

Specified by:
getRedirect in class LyWebPageWriter
Parameters:
frame - the frame to redirect
Returns:
the URL of the alternate Web page
See Also:
LyWebPageWriter.getRedirect(java.lang.String)

getColor

public final java.awt.Color getColor(java.lang.String key)
Retrieves a Color from the current environment.

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

getFont

public final java.awt.Font getFont(java.lang.String key)
Retrieves a Font from the current environment.

Parameters:
key - The ressource name (key) of the font.
Returns:
A reference to the requested Font, or a default font if it could not be found.
See Also:
LyEnvironment.getFont(String)

getImage

public final java.awt.Image getImage(java.lang.String key)
Retrieves an image from the current environment.

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

isFrameSet

public boolean isFrameSet()
(non-Javadoc).

Overrides:
isFrameSet in class LyWebPageWriter
See Also:
LyWebPageWriter.isFrameSet()

setTranslation

public void setTranslation(boolean translation)
Description copied from interface: LyGraphicalMap
Updates attribute translation to the given value.

Specified by:
setTranslation in interface LyGraphicalMap
Parameters:
translation - Boolean indicating if attribute translation is set or unset.

setZoom

public void setZoom(boolean zoom)
Description copied from interface: LyGraphicalMap
Updates attribute zoom to the given value.

Specified by:
setZoom in interface LyGraphicalMap
Parameters:
zoom - Boolean indicating if attribute zoom is set or unset.

(c) January 2013 - W4 S.A.

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