LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.view.win.swing
Class LySwingMap

java.lang.Object
  extended by leon.view.graphic.LyGraphicalObject
      extended by leon.view.win.swing.LySwingObject
          extended by leon.view.win.swing.LySwingFieldItem
              extended by leon.view.win.swing.LySwingPanel
                  extended by leon.view.win.swing.LySwingMap
All Implemented Interfaces:
LyActionListener, LyEventTransmitter, LySelectionListener, LyGetLockInterface, LyPrintInterface, LyGraphicalComponent, LyGraphicalFieldItem, LyGraphicalMap, LyGraphicalPanel, LyViewComponent, LyFreeInterface, LyResetContentInterface, LySetIdleInterface, LySetLabelInterface, LySetPopupMenuInterface, LySetViewerInterface, LySetVisibleInterface, LySwingComponent

public class LySwingMap
extends LySwingPanel
implements LySwingComponent, LyGraphicalMap, LyActionListener, LySelectionListener, LySetIdleInterface, LyResetContentInterface, LyPrintInterface, LySetVisibleInterface, LySetViewerInterface, LyGetLockInterface

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

A map allows to display any type of map view: maps representing geographic or synoptic areas, displaying of elements with different types of positioning, displaying of nodes, links, images, etc.

There are four types of elements that can be placed on a map: the nodes, the links, the regions and the images. The elements placed on a map can be sensitive or not (except the images that can never be sensitive). It is possible to specify for the nodes and the links the layer on which they are. This layer allows to place the elements of a higher layer over the elements of a lower layer (for example, the elements of the layer 2 are placed over the elements of the layer 1).

The nodes allow to define elements that can be placed at any location on the map and that can be moved. By using a special positioning manager, it is possible to place these nodes according to a predefined geometry (matrix, circle, ellipse, line,...). When zooming on the map, a node keeps always the same aspect unlike an element of image type.

The links allow to define segments between two nodes of the map. If one of the two nodes defining the link is moved, the link follows the moved node so that it always starts from its source node and that it always arrives to its destination node.

The regions allow to represent geometric areas defined by a discrete set of points. These areas can be sensitive. It is notably possible to lead to other map views when launching an action over one of these regions.

It is possible to define the background that will be used for the map (defined by an image), the selection mode (none, simple or multiple), the visualization mode (through a viewer or with scroll bars) and to specify if the map is in two or three dimensions.

The possible movements on a map are translations, zooms (forward/backward) and rotations. A map in three dimensions allows spatial rotations enabling to display the regions in three dimensions. A map in two dimensions allows the axial rotations around the center of the map.

See Also:
LyMap

Field Summary
static java.lang.String __VERSION
           
static java.lang.String IS_CONTROL_KEY_DOWN
          The constant used to represent the key IS_CONTROL_KEY_DOWN
static java.lang.String IS_SHIFT_KEY_DOWN
          The constant used to represent the key IS_SHIFT_KEY_DOWN
static java.lang.Class<?> MANAGER_CLASS
          The class used as the map manager.
static java.lang.Class<?> PANEL_CLASS
          The class used as the panel component.
 
Constructor Summary
LySwingMap(LyMap map)
          Class constructor of a Map object for the Swing target.
 
Method Summary
 void actionPerformed(LyActionEvent actionEvent)
          Invoked when an action occurs.
 void addComponent(LyComponent component, int pos)
          Adds a map component in this map at the specified position.
 leon.view.win.swing.map.LyMapContainer createMapContainer()
          Creates a generic container for this map.
 void demandPerformed(LyDemand demand)
          Invoked when a demand occurs.
 void free()
          (non-Javadoc).
 java.awt.Component getComponent()
          (non-Javadoc).
 java.lang.String getController()
          Gets the controller associated with this map.
 java.lang.Object getLock()
          Get a lock on the table to prevent concurrent access on rows.
 LySwingMapNode getNodeById(java.lang.String nodeId)
          Gets the map node with the specified Id.
 void initialize()
          Initializes the default swing values of this component and registers its listeners.
 void print(LyPrintListenerInterface listener)
          Initializes the printing process and starts printing the content of the map on the default printer.
 void printEnd(java.awt.PrintJob job, leon.view.win.swing.map.LyMapComponent canvas, LyPrintListenerInterface listener)
          Prints the content of the map with the specified printer job.
 void removeComponent(LyComponent component)
          (non-Javadoc).
 void resetContent()
          (non-Javadoc).
 void resetContent(boolean full)
          (non-Javadoc).
 void selectionPerformed(LySelectionEvent selectionEvent)
          Invoked when a selection occurs.
 void setContent()
          Sets the content of this component.
 void setIdle(boolean status)
          (non-Javadoc).
 void setLabel(java.lang.String label)
          Sets the title of this map.
 void setLayout(LyLayout layout)
          Sets the Layout of the map.
 void setMapContent(LyMapContent mapContent)
          Sets sub-component mapContent.
 void setSpatial(boolean spatial)
          Sets the spatial mode.
 void setTranslation(boolean translation)
          Updates attribute translation to the given value.
 void setTranslationStatus(LyMapBase.TranslationStatus translationStatus)
          Updates attribute translationStatus to the given value.
 void setViewer(boolean viewer)
          Sets the viewer mode.
 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)
          Updates attribute zoomStatus to the given value.
 
Methods inherited from class leon.view.win.swing.LySwingPanel
setPopupMenu
 
Methods inherited from class leon.view.win.swing.LySwingFieldItem
getActionTransmitter, getSelectionTransmitter
 
Methods inherited from class leon.view.win.swing.LySwingObject
getBounds, getChildrenBounds, getDefaultFrame
 
Methods inherited from class leon.view.graphic.LyGraphicalObject
expand, 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, 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

PANEL_CLASS

public static java.lang.Class<?> PANEL_CLASS
The class used as the panel component.


MANAGER_CLASS

public static java.lang.Class<?> MANAGER_CLASS
The class used as the map manager.


IS_SHIFT_KEY_DOWN

public static final java.lang.String IS_SHIFT_KEY_DOWN
The constant used to represent the key IS_SHIFT_KEY_DOWN

See Also:
Constant Field Values

IS_CONTROL_KEY_DOWN

public static final java.lang.String IS_CONTROL_KEY_DOWN
The constant used to represent the key IS_CONTROL_KEY_DOWN

See Also:
Constant Field Values
Constructor Detail

LySwingMap

public LySwingMap(LyMap map)
Class constructor of a Map object for the Swing target.

Parameters:
map - a MAP component defined for every type of view targets. This map is initialized for the swing view and filled with the default values.
Method Detail

initialize

public void initialize()
Initializes the default swing values of this component and registers its listeners.


setMapContent

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

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

setContent

public void setContent()
Sets the content of this component. Creates the layout manager then adds the map elements to the map container.


createMapContainer

public leon.view.win.swing.map.LyMapContainer createMapContainer()
Creates a generic container for this map. The default container is a LyMapScrollPane object.

Returns:
the new map container

free

public void free()
(non-Javadoc).

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

addComponent

public void addComponent(LyComponent component,
                         int pos)
Adds a map component in this map at the specified position.

Specified by:
addComponent in interface LyGraphicalMap
Parameters:
component - the new component to add
pos - the position of the component in this map
See Also:
addComponent(LyComponent, int, String), LyGraphicalMap.addComponent(leon.view.LyComponent, int)

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)

setSpatial

public void setSpatial(boolean spatial)
Sets the spatial mode.

Specified by:
setSpatial in interface LyGraphicalMap
Parameters:
spatial - Indicates if the map manager is spatial or not.
See Also:
LyAbstractMapComponentManager.SPATIAL, LyGraphicalMap.setSpatial(boolean)

setViewer

public void setViewer(boolean viewer)
Sets the viewer mode.

Specified by:
setViewer in interface LyGraphicalMap
Specified by:
setViewer in interface LySetViewerInterface
Parameters:
viewer - Indicates if the map manager must show the viewer or not.
See Also:
LyAbstractMapComponentManager.VIEWER, LyGraphicalMap.setViewer(boolean)

setViewerStatus

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

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

getLock

public java.lang.Object getLock()
Get a lock on the table to prevent concurrent access on rows.

Specified by:
getLock in interface LyGetLockInterface
Returns:
a valid lock for synchronized()

setLayout

public void setLayout(LyLayout layout)
Sets the Layout of the map.

Specified by:
setLayout in interface LyGraphicalMap
Parameters:
layout - the new layout to use
See Also:
LyGraphicalMap.setLayout(LyLayout)

setLabel

public void setLabel(java.lang.String label)
Sets the title of this map.

Specified by:
setLabel in interface LyGraphicalMap
Specified by:
setLabel in interface LySetLabelInterface
Parameters:
label - the new title of the map
See Also:
LyAbstractMapContainerManager.setTitle(String), LySetLabelInterface.setLabel(java.lang.String)

actionPerformed

public void actionPerformed(LyActionEvent actionEvent)
Invoked when an action occurs. The action demands that trigger the processing of the event are the following:

Specified by:
actionPerformed in interface LyActionListener
See Also:
LyActionListener.actionPerformed(leon.view.event.LyActionEvent)

selectionPerformed

public void selectionPerformed(LySelectionEvent selectionEvent)
Invoked when a selection occurs.

Specified by:
selectionPerformed in interface LySelectionListener
Parameters:
selectionEvent - description of the selection which has occured
See Also:
LySelectionListener.selectionPerformed(LySelectionEvent)

demandPerformed

public void demandPerformed(LyDemand demand)
Invoked when a demand occurs.

Parameters:
demand - the demand to process
See Also:
LyDemandListener.demandPerformed(LyDemand)

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)

setVisible

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

Specified by:
setVisible in interface LySetVisibleInterface
Parameters:
status - new visibility status, if true the component will be shown, if false it will be hiden
See Also:
LySetVisibleInterface.setVisible(boolean)

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()

getComponent

public java.awt.Component getComponent()
(non-Javadoc).

Specified by:
getComponent in interface LySwingComponent
Overrides:
getComponent in class LySwingObject
Returns:
this Swing view component
See Also:
LySwingComponent.getComponent()

getNodeById

public LySwingMapNode getNodeById(java.lang.String nodeId)
Gets the map node with the specified Id. Returns null if the node is not found.

Parameters:
nodeId - the Id of the node to retreive
Returns:
the map node with the given Id

getController

public java.lang.String getController()
Gets the controller associated with this map. If not found, try to get parent controller.

Overrides:
getController in class LyGraphicalObject
Returns:
the map controller id
See Also:
LyGraphicalObject.getController()

print

public void print(LyPrintListenerInterface listener)
Initializes the printing process and starts printing the content of the map on the default printer.

Specified by:
print in interface LyPrintInterface
Parameters:
listener - the printing listener
See Also:
LyPrintInterface.print(LyPrintListenerInterface)

printEnd

public void printEnd(java.awt.PrintJob job,
                     leon.view.win.swing.map.LyMapComponent canvas,
                     LyPrintListenerInterface listener)
Prints the content of the map with the specified printer job.

Parameters:
job - the printer handler
canvas - the drawing area
listener - the print listener, not used in this implementation

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.

setTranslationStatus

public void setTranslationStatus(LyMapBase.TranslationStatus translationStatus)
Description copied from interface: LyGraphicalMap
Updates attribute translationStatus to the given value.

Specified by:
setTranslationStatus in interface LyGraphicalMap
Parameters:
translationStatus - New value of translationStatus.

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.

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.

setZoomStatus

public void setZoomStatus(LyMapBase.ZoomStatus zoomStatus)
Description copied from interface: LyGraphicalMap
Updates attribute zoomStatus to the given value.

Specified by:
setZoomStatus in interface LyGraphicalMap
Parameters:
zoomStatus - New value of zoomStatus.

(c) January 2013 - W4 S.A.

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