LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.view.win.swing
Class LySwingMapLink

java.lang.Object
  extended by leon.view.graphic.LyGraphicalObject
      extended by leon.view.win.swing.LySwingObject
          extended by leon.view.win.swing.LySwingMapObject
              extended by leon.view.win.swing.LySwingMapLink
All Implemented Interfaces:
LyGetIdInterface, LyGraphicalComponent, LyGraphicalMapLink, LyViewComponent, LyFreeInterface, LySetHiddenInterface, LySetLabelInterface, LySetSelectedInterface, LySwingComponent, leon.view.win.swing.map.LyMapElement

public class LySwingMapLink
extends LySwingMapObject
implements LyGraphicalMapLink, leon.view.win.swing.map.LyMapElement

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

See Also:
LyMapContent

Field Summary
static java.lang.String __VERSION
           
static int AUTO_LINK_ANGLE
          Value of the angle drawn in an auto link
static int DISPLACEMENT_VALUE
          Value used to displace multiple links on same node
static int SELECTION_OFFSET
          Offset between the link and the selection area.
 
Fields inherited from interface leon.view.win.swing.map.LyMapElement
NORMAL_MODE, REDUCED_MODE
 
Constructor Summary
LySwingMapLink(LyMapLink mapLink)
          Class constructor of a Map link object for the Swing target.
 
Method Summary
 void addNewPoint(LyPoint point, int idx)
          Adds a new point in the view at the given index position.
 void addPoint(LyPoint point, int pos)
          The specified point is added in the view layer.
 void draw(leon.view.win.swing.map.LyAbstractMapComponentManager map, java.awt.Graphics g, int mode)
          Draws the link on the map, then prints its label at its center.
 void drawInViewer(leon.view.win.swing.map.LyAbstractMapComponentManager map, java.awt.Graphics g)
          (non-Javadoc).
 void drawLabels(leon.view.win.swing.map.LyAbstractMapComponentManager map, java.awt.Graphics g, int mode)
          Draws the label of this link on the specified map.
 void drawLink(leon.view.win.swing.map.LyAbstractMapComponentManager map, java.awt.Graphics g, int mode)
          Draws the link.
 Ly3DBox getBoundingBox(leon.view.win.swing.map.LyAbstractMapComponentManager map)
          Gets the bounding box of this link in the 3D space.
 java.awt.Rectangle getBoundingRectangle(leon.view.win.swing.map.LyAbstractMapComponentManager map)
          Returns the bounding rectangle of the elements.
 java.awt.Shape getClippingArea(leon.view.win.swing.map.LyAbstractMapComponentManager map, java.awt.Image image)
          Returns the clipping area of the image or the element.
 java.awt.Color getColor(LyEnvironment environment)
          Gets the color of this map link.
 java.awt.Color getColorEnd(LyEnvironment environment)
          Gets the end color of this map link.
 java.awt.Color getColorStart(LyEnvironment environment)
          Gets the start color of this map link.
 java.lang.String getEndLabel()
          (non-Javadoc).
 java.awt.Dimension getEndLabelSize(leon.view.win.swing.map.LyAbstractMapComponentManager map, java.awt.Graphics g)
          Returns the dimension of the label part of the link.
 java.awt.Point getEndLinkPoint(leon.view.win.swing.map.LyAbstractMapComponentManager map, boolean onBoundingRectangle)
          Finds the position of the ending arrow of the link.
 LySwingMapNode getEndNode()
          Gets the end node of this link.
 java.awt.Color getFontColor(LyEnvironment environment)
          Gets the font color of this map link.
 java.lang.String getId()
          Return current component identification (LyGetIdInterface interface).
 java.awt.Image[] getImages()
          Returns the images of the link.
 java.awt.Color getInactiveSelectedColor(LyEnvironment environment)
          Gets the inactive selected color of this map link.
 java.lang.String getLabel()
          Returns the label of this element.
 java.awt.Dimension getLabelSize(leon.view.win.swing.map.LyAbstractMapComponentManager map, java.awt.Graphics g)
          Returns the dimension of the label part of the link.
 int getLayer()
          Returns the layer of this element.
 int getLinkWidth()
          Return the width of the link.
 java.awt.Color getOutlineColor(LyEnvironment environment)
          Gets the outline color of this map link.
 java.awt.Color getSelectedColor(LyEnvironment environment)
          Gets the selected color of this map link.
 java.lang.String getStartLabel()
          (non-Javadoc).
 java.awt.Dimension getStartLabelSize(leon.view.win.swing.map.LyAbstractMapComponentManager map, java.awt.Graphics g)
          Returns the dimension of the label part of the link.
 java.awt.Point getStartLinkPoint(leon.view.win.swing.map.LyAbstractMapComponentManager map, boolean onBoundingRectangle)
          Finds the position of the starting arrow of the link.
 LySwingMapNode getStartNode()
          Gets the start node of this link.
 java.lang.String getTooltip()
          Returns the tooltip of this element.
 void initialize()
          Initializes the class fields with default values.
 boolean isAtPosition(leon.view.win.swing.map.LyAbstractMapComponentManager map, java.awt.Graphics g, int x, int y)
          Checks that this element draws itself at the specified (x,y) position.
 boolean isHidden()
          Indicates whether this element is hidden or not.
 boolean isLabelZoomable()
          Return true is displayed label should be zoom dependant.
 boolean isOverlay()
          Indicates whether this element is overlay or not.
 boolean isSelected()
          Indicates whether this element is selected or not.
 boolean isSensitive()
          Indicates whether this element is sensitive or not.
 void removeAllPoints()
          Clears all points in the view elements.
 void removePoint(LyPoint point)
          The specified point is removed in the view layer.
 void setColor(java.lang.String color)
           
 void setColorEnd(java.lang.String colorEnd)
          Updates attribute colorEnd to the given value.
 void setColorStart(java.lang.String colorStart)
          Updates attribute colorStart to the given value.
 void setEndLabel(java.lang.String leftLabel)
          Set the left label and clear the label cache.
 void setEndNode(LySwingMapNode node)
          Sets the end node of this link.
 void setFontColor(java.lang.String labelColor)
           
 void setHidden(boolean hidden)
          Updates attribute hidden to the given value.
 void setLabel(java.lang.String label)
          Sets the label attribute to null in order to get rid of cache.
 void setSelected(boolean selected)
          Updates attribute selected to the given value.
 void setStartLabel(java.lang.String rightLabel)
          Set the right label and clear the label cache.
 void setStartNode(LySwingMapNode node)
          Sets the start node of this link.
 java.lang.String toString()
           
 void translate(float dx, float dy, float dz)
          Don't move this object.
 
Methods inherited from class leon.view.win.swing.LySwingObject
getBounds, getChildrenBounds, getComponent, getDefaultFrame
 
Methods inherited from class leon.view.graphic.LyGraphicalObject
expand, free, getController, getEnv, getEnvironment, getIdCode, getIntResource, getMessage, 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, 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

SELECTION_OFFSET

public static final int SELECTION_OFFSET
Offset between the link and the selection area.

See Also:
Constant Field Values

DISPLACEMENT_VALUE

public static int DISPLACEMENT_VALUE
Value used to displace multiple links on same node


AUTO_LINK_ANGLE

public static int AUTO_LINK_ANGLE
Value of the angle drawn in an auto link

Constructor Detail

LySwingMapLink

public LySwingMapLink(LyMapLink mapLink)
Class constructor of a Map link object for the Swing target.

Parameters:
mapLink - a MAP_LINK component defined for every type of view targets. This map link is initialized for the swing view.
Method Detail

initialize

public void initialize()
Initializes the class fields with default values.


getImages

public java.awt.Image[] getImages()
Returns the images of the link.

Specified by:
getImages in interface leon.view.win.swing.map.LyMapElement
Returns:
the list of images used in the link
See Also:
LyMapElement.getImages()

getColorStart

public java.awt.Color getColorStart(LyEnvironment environment)
Gets the start color of this map link.

Parameters:
environment - the environment
Returns:
the starting color of the link

getColor

public java.awt.Color getColor(LyEnvironment environment)
Gets the color of this map link.

Parameters:
environment - the environment, not used in this implementation
Returns:
the color of the link

getColorEnd

public java.awt.Color getColorEnd(LyEnvironment environment)
Gets the end color of this map link.

Parameters:
environment - the environment
Returns:
the ending color of the link

getSelectedColor

public java.awt.Color getSelectedColor(LyEnvironment environment)
Gets the selected color of this map link.

Parameters:
environment - the environment, not used in this implementation
Returns:
the selected color of the link

getInactiveSelectedColor

public java.awt.Color getInactiveSelectedColor(LyEnvironment environment)
Gets the inactive selected color of this map link.

Parameters:
environment - the environment, not used in this implementation
Returns:
the inactive selected color of the link

getFontColor

public java.awt.Color getFontColor(LyEnvironment environment)
Gets the font color of this map link.

Parameters:
environment - the environment, not used in this implementation
Returns:
the font color of the link

getOutlineColor

public java.awt.Color getOutlineColor(LyEnvironment environment)
Gets the outline color of this map link.

Parameters:
environment - the environment, not used in this implementation
Returns:
the outline color of the link

getLabelSize

public java.awt.Dimension getLabelSize(leon.view.win.swing.map.LyAbstractMapComponentManager map,
                                       java.awt.Graphics g)
Returns the dimension of the label part of the link. If the _labelWidth and _labelHeight values of this link are not set (equal -1), the width and height are computed to the correct values for the label to be displayed.

Parameters:
map - the map containing the label to draw
g - the graphics context
Returns:
the label size of the current node

getStartLabelSize

public java.awt.Dimension getStartLabelSize(leon.view.win.swing.map.LyAbstractMapComponentManager map,
                                            java.awt.Graphics g)
Returns the dimension of the label part of the link. If the _labelWidth and _labelHeight values of this link are not set (equal -1), the width and height are computed to the correct values for the label to be displayed.

Parameters:
map - the map containing the label to draw
g - the graphics context
Returns:
the label size of the current node

getEndLabelSize

public java.awt.Dimension getEndLabelSize(leon.view.win.swing.map.LyAbstractMapComponentManager map,
                                          java.awt.Graphics g)
Returns the dimension of the label part of the link. If the _labelWidth and _labelHeight values of this link are not set (equal -1), the width and height are computed to the correct values for the label to be displayed.

Parameters:
map - the map containing the label to draw
g - the graphics context
Returns:
the label size of the current node

draw

public void draw(leon.view.win.swing.map.LyAbstractMapComponentManager map,
                 java.awt.Graphics g,
                 int mode)
Draws the link on the map, then prints its label at its center.

Specified by:
draw in interface leon.view.win.swing.map.LyMapElement
Parameters:
map - the map to draw
g - the graphical context
mode - the drawing mode
See Also:
LyMapElement.draw(leon.view.win.swing.map.LyAbstractMapComponentManager, java.awt.Graphics, int)

drawLabels

public void drawLabels(leon.view.win.swing.map.LyAbstractMapComponentManager map,
                       java.awt.Graphics g,
                       int mode)
Draws the label of this link on the specified map.

Parameters:
map - the map containing the label to draw
g - the graphics context
mode - the mode of the drawing, not used in this implementation

drawLink

public void drawLink(leon.view.win.swing.map.LyAbstractMapComponentManager map,
                     java.awt.Graphics g,
                     int mode)
Draws the link.

Parameters:
map - the link to draw
g - the graphics context
mode - the mode of the drawing

drawInViewer

public void drawInViewer(leon.view.win.swing.map.LyAbstractMapComponentManager map,
                         java.awt.Graphics g)
(non-Javadoc).

Specified by:
drawInViewer in interface leon.view.win.swing.map.LyMapElement
Parameters:
map - the map
g - the graphical context
See Also:
LyMapElement.drawInViewer(leon.view.win.swing.map.LyAbstractMapComponentManager, java.awt.Graphics)

addPoint

public void addPoint(LyPoint point,
                     int pos)
The specified point is added in the view layer.

Specified by:
addPoint in interface LyGraphicalMapLink
Parameters:
point - The points to add to points list.
pos - Position where the sub-component is inserted.
See Also:
LyGraphicalMapLink.addPoint(leon.view.LyPoint, int)

removePoint

public void removePoint(LyPoint point)
The specified point is removed in the view layer.

Specified by:
removePoint in interface LyGraphicalMapLink
Parameters:
point - The points to remove to points list.
See Also:
LyGraphicalMapLink.removePoint(LyPoint)

addNewPoint

public void addNewPoint(LyPoint point,
                        int idx)
Adds a new point in the view at the given index position.

Parameters:
point - new point inserted
idx - index of the point

removeAllPoints

public void removeAllPoints()
Clears all points in the view elements.


getId

public java.lang.String getId()
Description copied from interface: LyGetIdInterface
Return current component identification (LyGetIdInterface interface).

Specified by:
getId in interface LyGetIdInterface

getBoundingBox

public Ly3DBox getBoundingBox(leon.view.win.swing.map.LyAbstractMapComponentManager map)
Gets the bounding box of this link in the 3D space. The bounding box is already in 3D, so the link points doesn't need to be converted to the 2D space with the specified map manager.

Specified by:
getBoundingBox in interface leon.view.win.swing.map.LyMapElement
Parameters:
map - the map manager of this link. Unused in this method.
Returns:
the bounding box of this map link in the 3D space
See Also:
LyMapElement.getBoundingBox(leon.view.win.swing.map.LyAbstractMapComponentManager)

getBoundingRectangle

public java.awt.Rectangle getBoundingRectangle(leon.view.win.swing.map.LyAbstractMapComponentManager map)
Description copied from interface: leon.view.win.swing.map.LyMapElement
Returns the bounding rectangle of the elements.

Specified by:
getBoundingRectangle in interface leon.view.win.swing.map.LyMapElement
Parameters:
map - the map component to retrieve its bounding rectangle
Returns:
the bounding rectangle of the specified elements in the 2D plan

getClippingArea

public java.awt.Shape getClippingArea(leon.view.win.swing.map.LyAbstractMapComponentManager map,
                                      java.awt.Image image)
Description copied from interface: leon.view.win.swing.map.LyMapElement
Returns the clipping area of the image or the element.

Specified by:
getClippingArea in interface leon.view.win.swing.map.LyMapElement
Parameters:
map - the map component
image - the image
Returns:
the clipping area shape of the specified image, or of this element if the image is null

getLayer

public int getLayer()
Description copied from interface: leon.view.win.swing.map.LyMapElement
Returns the layer of this element.

Specified by:
getLayer in interface leon.view.win.swing.map.LyMapElement
Returns:
the layer number

getLabel

public java.lang.String getLabel()
Description copied from interface: leon.view.win.swing.map.LyMapElement
Returns the label of this element.

Specified by:
getLabel in interface leon.view.win.swing.map.LyMapElement
Returns:
the label text

getStartLabel

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

See Also:
LyMapElement.getLabel()

getEndLabel

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

See Also:
LyMapElement.getLabel()

setLabel

public void setLabel(java.lang.String label)
Sets the label attribute to null in order to get rid of cache.

Specified by:
setLabel in interface LyGraphicalMapLink
Specified by:
setLabel in interface LySetLabelInterface
Parameters:
label - This attribute is not used in this implementation.
See Also:
getLabel()

getTooltip

public java.lang.String getTooltip()
Description copied from interface: leon.view.win.swing.map.LyMapElement
Returns the tooltip of this element.

Specified by:
getTooltip in interface leon.view.win.swing.map.LyMapElement
Returns:
the tooltip text

isAtPosition

public boolean isAtPosition(leon.view.win.swing.map.LyAbstractMapComponentManager map,
                            java.awt.Graphics g,
                            int x,
                            int y)
Description copied from interface: leon.view.win.swing.map.LyMapElement
Checks that this element draws itself at the specified (x,y) position.

Specified by:
isAtPosition in interface leon.view.win.swing.map.LyMapElement
Parameters:
map - the map
g - the graphical context
x - the x coordinate
y - the y coordinate
Returns:
true if this element is at the specified point in the map, false otherwise

setSelected

public void setSelected(boolean selected)
Description copied from interface: LyGraphicalMapLink
Updates attribute selected to the given value.

Specified by:
setSelected in interface LyGraphicalMapLink
Specified by:
setSelected in interface LySetSelectedInterface
Specified by:
setSelected in interface leon.view.win.swing.map.LyMapElement
Parameters:
selected - Boolean indicating if attribute selected is set or unset.

isSelected

public boolean isSelected()
Description copied from interface: leon.view.win.swing.map.LyMapElement
Indicates whether this element is selected or not.

Specified by:
isSelected in interface leon.view.win.swing.map.LyMapElement
Returns:
true if this element is selected, false otherwise

translate

public void translate(float dx,
                      float dy,
                      float dz)
Don't move this object.

Specified by:
translate in interface leon.view.win.swing.map.LyMapElement
Parameters:
dx - the x delta, not used in this implementation
dy - the y delta, not used in this implementation
dz - the z delta, not used in this implementation
See Also:
LyMapElement.translate(float, float, float)

isOverlay

public boolean isOverlay()
Description copied from interface: leon.view.win.swing.map.LyMapElement
Indicates whether this element is overlay or not.

Specified by:
isOverlay in interface leon.view.win.swing.map.LyMapElement
Returns:
true if this element is overlaid, false otherwise

isHidden

public boolean isHidden()
Description copied from interface: leon.view.win.swing.map.LyMapElement
Indicates whether this element is hidden or not.

Specified by:
isHidden in interface leon.view.win.swing.map.LyMapElement
Returns:
true if this element is hidden, false otherwise

setHidden

public void setHidden(boolean hidden)
Description copied from interface: LyGraphicalMapLink
Updates attribute hidden to the given value.

Specified by:
setHidden in interface LyGraphicalMapLink
Specified by:
setHidden in interface LySetHiddenInterface
Parameters:
hidden - Boolean indicating if attribute hidden is set or unset.

isSensitive

public boolean isSensitive()
Description copied from interface: leon.view.win.swing.map.LyMapElement
Indicates whether this element is sensitive or not.

Specified by:
isSensitive in interface leon.view.win.swing.map.LyMapElement
Returns:
true if this element is sensitive, false otherwise

setStartNode

public void setStartNode(LySwingMapNode node)
Sets the start node of this link.

Parameters:
node - value of the starting node
See Also:
getStartNode()

setEndNode

public void setEndNode(LySwingMapNode node)
Sets the end node of this link.

Parameters:
node - value of the ending node
See Also:
getEndNode()

getStartNode

public LySwingMapNode getStartNode()
Gets the start node of this link.

Returns:
the starting node
See Also:
setStartNode(LySwingMapNode)

getEndNode

public LySwingMapNode getEndNode()
Gets the end node of this link.

Returns:
the ending node
See Also:
setEndNode(LySwingMapNode)

setColorStart

public void setColorStart(java.lang.String colorStart)
Description copied from interface: LyGraphicalMapLink
Updates attribute colorStart to the given value.

Specified by:
setColorStart in interface LyGraphicalMapLink
Parameters:
colorStart - New value of colorStart.

setColor

public void setColor(java.lang.String color)

setColorEnd

public void setColorEnd(java.lang.String colorEnd)
Description copied from interface: LyGraphicalMapLink
Updates attribute colorEnd to the given value.

Specified by:
setColorEnd in interface LyGraphicalMapLink
Parameters:
colorEnd - New value of colorEnd.

setFontColor

public void setFontColor(java.lang.String labelColor)

setEndLabel

public void setEndLabel(java.lang.String leftLabel)
Set the left label and clear the label cache.

Specified by:
setEndLabel in interface LyGraphicalMapLink
Parameters:
leftLabel - New value of endLabel.
See Also:
LyGraphicalMapLink.setEndLabel(java.lang.String)

setStartLabel

public void setStartLabel(java.lang.String rightLabel)
Set the right label and clear the label cache.

Specified by:
setStartLabel in interface LyGraphicalMapLink
Parameters:
rightLabel - New value of startLabel.
See Also:
LyGraphicalMapLink.setStartLabel(java.lang.String)

getStartLinkPoint

public java.awt.Point getStartLinkPoint(leon.view.win.swing.map.LyAbstractMapComponentManager map,
                                        boolean onBoundingRectangle)
Finds the position of the starting arrow of the link.

Parameters:
map - the map that is drawn
onBoundingRectangle - if onBoundingRectangle, the starting point is the intersection of the (startNode, endNode) line and the startNode boundingRectangle, otherwise it is the intersection of the (startNode, endNode) line and the circle around the startNode.
Returns:
a LyPoint containing the point where the arrow starts, or null if one of the node is null.

getEndLinkPoint

public java.awt.Point getEndLinkPoint(leon.view.win.swing.map.LyAbstractMapComponentManager map,
                                      boolean onBoundingRectangle)
Finds the position of the ending arrow of the link.

Parameters:
map - the map that is drawn
Returns:
a LyPoint containing the point where the arrow ends, or null if one of the node is null.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

isLabelZoomable

public boolean isLabelZoomable()
Return true is displayed label should be zoom dependant.

Returns:
true is label are zoomable

getLinkWidth

public int getLinkWidth()
Return the width of the link. It handle the default value of -1 (it returns 1)

Returns:
the width of the linkg

(c) January 2013 - W4 S.A.

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