LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.view.web.struts
Class LyStrutsMapRegion

java.lang.Object
  extended by leon.view.graphic.LyGraphicalObject
      extended by leon.view.web.LyWebObject
          extended by leon.view.web.struts.LyStrutsMapObject
              extended by leon.view.web.struts.LyStrutsMapRegion
All Implemented Interfaces:
LyGetIdInterface, LyGraphicalComponent, LyGraphicalMapRegion, LyViewComponent, LyFreeInterface, LySetHiddenInterface, LySetSelectedInterface, LyWebComponent, leon.view.web.struts.map.LyStrutsMapElement

public class LyStrutsMapRegion
extends LyStrutsMapObject
implements LyGraphicalMapRegion, leon.view.web.struts.map.LyStrutsMapElement

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

MAP_REGION: Map Region
Regions allow representing geometric areas, who can be sensitive, defined by a discrete set of points. These points define polygons that are displayed on the map with a given color. It is notably possible to lead to other map views when launching an action over one of these regions.
Regions follow zooms made on the map (their size increases or decreases when zooming in or out).

See Also:
LyMap

Field Summary
static java.lang.String __VERSION
           
static int SHADOW_OFFSET
          Offset for region shadow.
static boolean USE_DIV_FOR_TREEMAP_LAYOUT
          Indicates id the HTML tag DIV has to be used for treemap layout.
 
Fields inherited from class leon.view.web.LyWebObject
WEB_COMPONENT_ID, WEB_CONTROLLER_ID, WEB_SESSION_ID
 
Fields inherited from interface leon.view.web.struts.map.LyStrutsMapElement
DRAW_MODE_NORMAL, DRAW_MODE_REDUCED
 
Constructor Summary
LyStrutsMapRegion(LyMapRegion region)
          Class constructor of a Map region object for the Struts target.
 
Method Summary
 void addMapRegion(LyMapRegion mapRegion, int pos)
          (non-Javadoc).
 void draw(leon.view.web.struts.map.LyStrutsMapCanvas map, java.awt.Graphics g, int mode)
          (non-Javadoc).
 void draw(leon.view.web.struts.map.LyStrutsMapCanvas map, java.awt.Graphics g, int mode, boolean forceDraw, int level)
          Draws the map region.
 void drawHtml(leon.view.web.struts.map.LyStrutsMapCanvas map, LyWebPageWriter pw)
          (non-Javadoc).
 void drawHtml(leon.view.web.struts.map.LyStrutsMapCanvas map, LyWebPageWriter pw, int level)
          Draws the HTML tag for this region.
 void drawHtmlPolygon(leon.view.web.struts.map.LyStrutsMapCanvas mapCanvas, LyWebPageWriter pw, LyPolygon polygon, boolean selected)
          Draws the HTML tag for a polygon on the map canvas.
 void drawHtmlTooltip(leon.view.web.struts.map.LyStrutsMapCanvas mapCanvas, LyWebPageWriter pw, boolean smallImage)
          Draws the HTML tag for the tooltip of the current map region or its small image.
 void drawInViewer(leon.view.web.struts.map.LyStrutsMapCanvas map, java.awt.Graphics g)
          (non-Javadoc).
 Ly3DBox getBoundingBox(leon.view.web.struts.map.LyStrutsMapCanvas map)
          (non-Javadoc).
 java.awt.Rectangle getBoundingRectangle(leon.view.web.struts.map.LyStrutsMapCanvas map)
          (non-Javadoc).
 java.awt.Polygon getBoundingShape(leon.view.web.struts.map.LyStrutsMapCanvas map)
          Gets the polygon that contains this region.
 java.awt.Shape getClippingArea(leon.view.web.struts.map.LyStrutsMapCanvas map, java.awt.Image image)
          (non-Javadoc).
 java.lang.String getId()
          (non-Javadoc).
 java.awt.Image[] getImages()
          (non-Javadoc).
 java.lang.String getLabel()
          (non-Javadoc).
 java.awt.Rectangle getLabelFrame()
          Gets the rectangle frame where the label can be drawn.
 int getLayer()
          (non-Javadoc).
 java.util.Vector<LyPoint> getPoints()
          Gets all points of this region polygon and of all its subcomponents.
 java.awt.Rectangle getSmallImageBounds()
          Gets the small image bounds.
 java.lang.String getSmallImageTooltip()
          Gets the tooltip for small image.
 java.lang.String getTooltip()
          (non-Javadoc).
 boolean isAtPosition(leon.view.web.struts.map.LyStrutsMapCanvas map, java.awt.Graphics g, int x, int y)
          (non-Javadoc).
 boolean isDrawableInterface(leon.view.web.struts.map.LyStrutsMapCanvas map)
          Indicates if the component is drawable or not in web.
 boolean isHidden()
          (non-Javadoc).
 boolean isOverlay()
          (non-Javadoc).
 boolean isSelected()
          (non-Javadoc).
 boolean isSensitive()
          (non-Javadoc).
 void removeMapRegion(LyMapRegion mapRegion)
          (non-Javadoc).
 void resetPosition()
          Generates the Javascript code that resets the position of the element.
 void setContent()
          Sets the content of the map region.
 void setHidden(boolean hidden)
          (non-Javadoc).
 void setLabelFrame(java.awt.Rectangle rect)
          Sets the frame reserved for the label.
 void setSelected(boolean selected)
          (non-Javadoc).
 void setSmallImage(java.lang.String smallImage)
          (non-Javadoc).
 void setSmallImageTooltip(java.lang.String tooltip)
          (non-Javadoc).
 void setWeight(float weight)
          (non-Javadoc).
 void translate(float dx, float dy, float dz)
          (non-Javadoc).
 void writeHtml(LyWebPageWriter pw)
          (non-Javadoc).
 
Methods inherited from class leon.view.web.struts.LyStrutsMapObject
getColor, getFont, getHexString, getImage
 
Methods inherited from class leon.view.web.LyWebObject
addFileScript, decodeUrl, displayUpPage, encodeUrl, encodeUrlXhtml, expandUrl, free, getDisabledImageUrl, getFontSize, getFontString, getFontString, getFontString, getHexColor, getHexColor, getHtmlEntitiesString, getHtmlString, getImageSize, getImageSize, getImageUrl, getJavascriptString, getLastFrameName, getLyFont, getMessage, getRootUrl, getRootURL, getScrollHeightForSplitter, 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
free, getViewComponent
 

Field Detail

__VERSION

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

USE_DIV_FOR_TREEMAP_LAYOUT

public static final boolean USE_DIV_FOR_TREEMAP_LAYOUT
Indicates id the HTML tag DIV has to be used for treemap layout.

See Also:
Constant Field Values

SHADOW_OFFSET

public static final int SHADOW_OFFSET
Offset for region shadow.

See Also:
Constant Field Values
Constructor Detail

LyStrutsMapRegion

public LyStrutsMapRegion(LyMapRegion region)
Class constructor of a Map region object for the Struts target.

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

setContent

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


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)

getImages

public java.awt.Image[] getImages()
(non-Javadoc).

Specified by:
getImages in interface leon.view.web.struts.map.LyStrutsMapElement
Returns:
the list of images
See Also:
LyStrutsMapElement.getImages()

drawInViewer

public void drawInViewer(leon.view.web.struts.map.LyStrutsMapCanvas map,
                         java.awt.Graphics g)
(non-Javadoc).

Specified by:
drawInViewer in interface leon.view.web.struts.map.LyStrutsMapElement
Parameters:
map - the map
g - the graphical context
See Also:
leon.view.web.struts.map.LyStrutsMapElement#drawInViewer(leon.view.web.struts.map.LyStrutsMapCanvas, java.awt.Graphics, int)

draw

public void draw(leon.view.web.struts.map.LyStrutsMapCanvas map,
                 java.awt.Graphics g,
                 int mode)
(non-Javadoc).

Specified by:
draw in interface leon.view.web.struts.map.LyStrutsMapElement
Parameters:
map - the map
g - the graphical context
mode - drawing mode
See Also:
LyStrutsMapElement.draw(leon.view.web.struts.map.LyStrutsMapCanvas, java.awt.Graphics, int)

draw

public void draw(leon.view.web.struts.map.LyStrutsMapCanvas map,
                 java.awt.Graphics g,
                 int mode,
                 boolean forceDraw,
                 int level)
Draws the map region.

Parameters:
map - the map of this region
g - ths graphics context
mode - the map style
forceDraw - indicates if the region must be drawn
level - te level of the region (its children will be at the level level+1 for example)

getBoundingBox

public Ly3DBox getBoundingBox(leon.view.web.struts.map.LyStrutsMapCanvas map)
(non-Javadoc).

Specified by:
getBoundingBox in interface leon.view.web.struts.map.LyStrutsMapElement
Parameters:
map - the map
Returns:
the 3D bounding box
See Also:
LyStrutsMapElement.getBoundingBox(leon.view.web.struts.map.LyStrutsMapCanvas)

getBoundingShape

public java.awt.Polygon getBoundingShape(leon.view.web.struts.map.LyStrutsMapCanvas map)
Gets the polygon that contains this region.

Parameters:
map - the region map
Returns:
the polygon that contains this region

getBoundingRectangle

public java.awt.Rectangle getBoundingRectangle(leon.view.web.struts.map.LyStrutsMapCanvas map)
(non-Javadoc).

Specified by:
getBoundingRectangle in interface leon.view.web.struts.map.LyStrutsMapElement
Parameters:
map - the map
Returns:
the bounding rectangle
See Also:
LyStrutsMapElement.getBoundingRectangle(leon.view.web.struts.map.LyStrutsMapCanvas)

getClippingArea

public java.awt.Shape getClippingArea(leon.view.web.struts.map.LyStrutsMapCanvas map,
                                      java.awt.Image image)
(non-Javadoc).

Specified by:
getClippingArea in interface leon.view.web.struts.map.LyStrutsMapElement
Parameters:
map - the map
image - the image
Returns:
the clipping area
See Also:
LyStrutsMapElement.getClippingArea(leon.view.web.struts.map.LyStrutsMapCanvas, java.awt.Image)

getLayer

public int getLayer()
(non-Javadoc).

Specified by:
getLayer in interface leon.view.web.struts.map.LyStrutsMapElement
Returns:
the layer
See Also:
LyStrutsMapElement.getLayer()

getLabel

public java.lang.String getLabel()
(non-Javadoc).

Specified by:
getLabel in interface leon.view.web.struts.map.LyStrutsMapElement
Returns:
the label
See Also:
LyStrutsMapElement.getLabel()

drawHtml

public void drawHtml(leon.view.web.struts.map.LyStrutsMapCanvas map,
                     LyWebPageWriter pw)
(non-Javadoc).

Specified by:
drawHtml in interface leon.view.web.struts.map.LyStrutsMapElement
Parameters:
map - the map where the element must be drawn
pw - the page writer
See Also:
LyStrutsMapElement.drawHtml(leon.view.web.struts.map.LyStrutsMapCanvas, leon.view.web.LyWebPageWriter)

drawHtml

public void drawHtml(leon.view.web.struts.map.LyStrutsMapCanvas map,
                     LyWebPageWriter pw,
                     int level)
Draws the HTML tag for this region.

Parameters:
map - the ragion map
pw - the page writer
level - the level of the region (for example, its children are at the level level+1

drawHtmlPolygon

public void drawHtmlPolygon(leon.view.web.struts.map.LyStrutsMapCanvas mapCanvas,
                            LyWebPageWriter pw,
                            LyPolygon polygon,
                            boolean selected)
Draws the HTML tag for a polygon on the map canvas.

Parameters:
mapCanvas - the map canvas
pw - the page writer
polygon - the polygon to draw
selected - indicates whether polygon is selected or not

drawHtmlTooltip

public void drawHtmlTooltip(leon.view.web.struts.map.LyStrutsMapCanvas mapCanvas,
                            LyWebPageWriter pw,
                            boolean smallImage)
Draws the HTML tag for the tooltip of the current map region or its small image.

Parameters:
mapCanvas - the map canvas
pw - the web page writer
smallImage - indicates whether tooltip is needed for the small image or not

getTooltip

public java.lang.String getTooltip()
(non-Javadoc).

Specified by:
getTooltip in interface leon.view.web.struts.map.LyStrutsMapElement
Returns:
the tooltip
See Also:
LyStrutsMapElement.getTooltip()

getSmallImageTooltip

public java.lang.String getSmallImageTooltip()
Gets the tooltip for small image.

Returns:
always null
See Also:
setSmallImageTooltip(String)

isDrawableInterface

public boolean isDrawableInterface(leon.view.web.struts.map.LyStrutsMapCanvas map)
Indicates if the component is drawable or not in web.

Specified by:
isDrawableInterface in interface leon.view.web.struts.map.LyStrutsMapElement
Parameters:
map - the map
Returns:
if the map is a Treemap the component is Drawable so return true in other case return false

isAtPosition

public boolean isAtPosition(leon.view.web.struts.map.LyStrutsMapCanvas map,
                            java.awt.Graphics g,
                            int x,
                            int y)
(non-Javadoc).

Specified by:
isAtPosition in interface leon.view.web.struts.map.LyStrutsMapElement
Parameters:
map - the map
g - the graphical context
x - the x coordonate
y - the y coordonate
Returns:
true if the point is at the (x, y) position, false otherwise
See Also:
LyStrutsMapElement.isAtPosition(leon.view.web.struts.map.LyStrutsMapCanvas, java.awt.Graphics, int, int)

getId

public java.lang.String getId()
(non-Javadoc).

Specified by:
getId in interface LyGetIdInterface
See Also:
LyGetIdInterface.getId()

setSelected

public void setSelected(boolean selected)
(non-Javadoc).

Specified by:
setSelected in interface LyGraphicalMapRegion
Specified by:
setSelected in interface LySetSelectedInterface
Specified by:
setSelected in interface leon.view.web.struts.map.LyStrutsMapElement
Parameters:
selected - Boolean indicating if attribute selected is set or unset.
See Also:
LySetSelectedInterface.setSelected(boolean)

setSmallImageTooltip

public void setSmallImageTooltip(java.lang.String tooltip)
(non-Javadoc).

Specified by:
setSmallImageTooltip in interface LyGraphicalMapRegion
Parameters:
tooltip - New value of smallImageTooltip.
See Also:
LyGraphicalMapRegion.setSmallImageTooltip(java.lang.String)

setWeight

public void setWeight(float weight)
(non-Javadoc).

Specified by:
setWeight in interface LyGraphicalMapRegion
Parameters:
weight - New value of weight.
See Also:
LyGraphicalMapRegion.setWeight(float)

setSmallImage

public void setSmallImage(java.lang.String smallImage)
(non-Javadoc).

Specified by:
setSmallImage in interface LyGraphicalMapRegion
Parameters:
smallImage - New value of smallImage.
See Also:
LyGraphicalMapRegion.setSmallImage(java.lang.String)

isSelected

public boolean isSelected()
(non-Javadoc).

Specified by:
isSelected in interface leon.view.web.struts.map.LyStrutsMapElement
Returns:
true is the element is selected, false otherwise
See Also:
LyStrutsMapElement.isSelected()

translate

public void translate(float dx,
                      float dy,
                      float dz)
(non-Javadoc).

Specified by:
translate in interface leon.view.web.struts.map.LyStrutsMapElement
Parameters:
dx - x translation.
dy - y translation.
dz - z translation.
See Also:
LyStrutsMapElement.translate(float, float, float)

isOverlay

public boolean isOverlay()
(non-Javadoc).

Specified by:
isOverlay in interface leon.view.web.struts.map.LyStrutsMapElement
Returns:
true is the element is overlay, false otherwise
See Also:
LyStrutsMapElement.isOverlay()

isHidden

public boolean isHidden()
(non-Javadoc).

Specified by:
isHidden in interface leon.view.web.struts.map.LyStrutsMapElement
Returns:
true is the element is hidden, false otherwise
See Also:
LyStrutsMapElement.isHidden()

setHidden

public void setHidden(boolean hidden)
(non-Javadoc).

Specified by:
setHidden in interface LyGraphicalMapRegion
Specified by:
setHidden in interface LySetHiddenInterface
Parameters:
hidden - Boolean indicating if attribute hidden is set or unset.
See Also:
LySetHiddenInterface.setHidden(boolean)

isSensitive

public boolean isSensitive()
(non-Javadoc).

Specified by:
isSensitive in interface leon.view.web.struts.map.LyStrutsMapElement
Returns:
true is the element is sensitive, false otherwise
See Also:
LyStrutsMapElement.isSensitive()

addMapRegion

public void addMapRegion(LyMapRegion mapRegion,
                         int pos)
(non-Javadoc).

Specified by:
addMapRegion in interface LyGraphicalMapRegion
Parameters:
mapRegion - The mapRegions to add to mapRegions list.
pos - Position where the sub-component is inserted.
See Also:
LyGraphicalMapRegion.addMapRegion(leon.view.LyMapRegion, int)

removeMapRegion

public void removeMapRegion(LyMapRegion mapRegion)
(non-Javadoc).

Specified by:
removeMapRegion in interface LyGraphicalMapRegion
Parameters:
mapRegion - The mapRegions to remove to mapRegions list.
See Also:
LyGraphicalMapRegion.removeMapRegion(leon.view.LyMapRegion)

setLabelFrame

public void setLabelFrame(java.awt.Rectangle rect)
Sets the frame reserved for the label.

Parameters:
rect - the new label frame
See Also:
getLabelFrame()

getPoints

public java.util.Vector<LyPoint> getPoints()
Gets all points of this region polygon and of all its subcomponents.

Returns:
the list of points

getLabelFrame

public java.awt.Rectangle getLabelFrame()
Gets the rectangle frame where the label can be drawn.

Returns:
the label frame
See Also:
setLabelFrame(Rectangle)

getSmallImageBounds

public java.awt.Rectangle getSmallImageBounds()
Gets the small image bounds.

Returns:
the small image bounds

resetPosition

public void resetPosition()
Generates the Javascript code that resets the position of the element.

Specified by:
resetPosition in interface leon.view.web.struts.map.LyStrutsMapElement

(c) January 2013 - W4 S.A.

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