ilog.views.maps.beans
Class IlvJMapLegend

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by ilog.views.maps.beans.IlvJMapLegend
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class IlvJMapLegend
extends JPanel

This class defines a Swing component than can show the legend of a map displayed in an IlvManagerView.

The map legend is displayed in a rectangle that contains the list of the layer names. For each layer, a check box lets the user change the visibility of the layer. However, the visibility flag does not override the visibility filters, such as instances of IlvScaleVisibilityFilter set on the layer. A component can be specified for each layer to show a typical representation of the layer theme. This component can eventually be a GUI component written for the purpose of a map application, for instance a button to change the colors of the graphic objects in a layer.

This class is packaged as a Java Bean and is designed to be used very easily in a Java development environment supporting visual programming with Beans.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
IlvJMapLegend()
          Instantiates a map legend.
 
Method Summary
 JLabel createLayerLabel(String label)
          This method is called when the legend needs to create its labels.
 String getFilteredText()
          Returns the text used to print the display status of a layer.
 JLabel getLayerLabel(IlvManagerLayer layer)
          Returns the JLabel object representing the layer label.
 String getLayerName(IlvManagerLayer layer)
          Returns the name used to display a layer if the internal name has been overridden.
 Component getLayerRepresentation(IlvManagerLayer layer)
          Returns the representation component that is used to show a typical item of the layer content.
 LayoutManager getLegendLayout(IlvManagerLayer layer)
          Returns the layout manager used to display the items representing the specified layer if the default layout has been overridden.
 String getUnnamedLayerText()
          Returns the text used as the name of unnamed layers.
 IlvManagerView getView()
          Returns the view for which the legend is displayed by this component.
 boolean isEditable()
          Returns the editing mode for the IlvJMapLegend.
 boolean isLayerGlobalVisibilityMode()
          Tests whether this legend instance controls the global visibility of the manager layers for all views or the associated view only.
 void setEditable(boolean editable)
          Sets the editable mode of the IlvJMapLegend.
 void setFilteredText(String text)
          Sets the String used to print the display status of a layer.
 void setLayerGlobalVisibilityMode(boolean set)
          Sets whether this legend instance controls the global visibility of the manager layers for all views or the associated view only.
 void setLayerName(IlvManagerLayer layer, String name)
          Sets the name for the specified layer.
 void setLayerRepresentation(IlvManagerLayer layer, Component representation)
          Specifies a representation component that can be used to show a typical item of the layer content.
 void setLegendLayout(IlvManagerLayer layer, LayoutManager layout)
          Changes the layout manager used to display the items representing the specified layer.
 void setUnnamedLayerText(String text)
          Sets the String used as the name of unnamed layers.
 void setView(IlvManagerView view)
          Sets the manager view for which the legend will be displayed.
 void updateAll()
          Updates the legend display.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IlvJMapLegend

public IlvJMapLegend()
Instantiates a map legend. The legend is not active until an IlvManagerView view is set.

See Also:
setView(ilog.views.IlvManagerView)
Method Detail

setView

public final void setView(IlvManagerView view)
Sets the manager view for which the legend will be displayed.

Parameters:
view - The manager view.

getView

public final IlvManagerView getView()
Returns the view for which the legend is displayed by this component.

Returns:
The attached manager view.

updateAll

public void updateAll()
Updates the legend display.


setLayerGlobalVisibilityMode

public void setLayerGlobalVisibilityMode(boolean set)
Sets whether this legend instance controls the global visibility of the manager layers for all views or the associated view only. When you use the legend to set the visibility of a layer, it can be set as the following:
SettingDescription
falsevisible to the associated view only
truevisible for all the views

By default, this value is set to false.

Parameters:
set - Set to true so the layer is global, that is, visible to all associated layers.
Since:
JViews 6.0

isLayerGlobalVisibilityMode

public boolean isLayerGlobalVisibilityMode()
Tests whether this legend instance controls the global visibility of the manager layers for all views or the associated view only. The default mode is false, that is, this legend instance controls the visibility for the associated view only.

Returns:
The visibility mode.
Since:
JViews 6.0
See Also:
setLayerGlobalVisibilityMode(boolean)

setLayerName

public void setLayerName(IlvManagerLayer layer,
                         String name)
Sets the name for the specified layer. This function can be used to display the layer with a different name from its internal name. (specified by the method IlvManagerLayer.setName).

Parameters:
layer - The layer.
name - The name to be used to represent the layer.

getLayerName

public String getLayerName(IlvManagerLayer layer)
Returns the name used to display a layer if the internal name has been overridden.

Parameters:
layer - The layer.
Returns:
The name associated with layer or null if the layer internal name has not been overridden.

setLayerRepresentation

public void setLayerRepresentation(IlvManagerLayer layer,
                                   Component representation)
Specifies a representation component that can be used to show a typical item of the layer content. This component will be displayed after the name of the layer. It can be an active component (for instance, a button that would be used to change the color of the graphic objects in the layer). The default representation component is an icon that supports layers containing instances of IlvMarker, IlvPolyPoints or IlvPolygon.

Parameters:
layer - The layer whose representation is specified.
representation - The component that paints the representation.

getLayerRepresentation

public Component getLayerRepresentation(IlvManagerLayer layer)
Returns the representation component that is used to show a typical item of the layer content.

Parameters:
layer - The layer whose representation is to be returned.
Returns:
The representation associated with layer or null if no representation has been associated with this layer.

getLayerLabel

public JLabel getLayerLabel(IlvManagerLayer layer)
Returns the JLabel object representing the layer label. Use this method to customize the layer label. For example, to change the foreground color and the font for the label.

Parameters:
layer - The layer whose label is to be returned.
Returns:
The JLabel associated with layer or null if no label has been associated with this layer.
Since:
JViews 6.0

createLayerLabel

public JLabel createLayerLabel(String label)
This method is called when the legend needs to create its labels. Override this method to customize the layer label. For example, to change the foreground color and the font for each JLabel instance used by the legend.

Parameters:
label - The string associated to the layer. This string is returned by the method getLayerName(IlvManagerLayer).
Returns:
The JLabel instance used in the legend.
Since:
JViews 6.0

setLegendLayout

public void setLegendLayout(IlvManagerLayer layer,
                            LayoutManager layout)
Changes the layout manager used to display the items representing the specified layer. The default layout displays a check box to the left, then the name of the layer, and finally the representation component.

Parameters:
layer - The layer whose representation is specified.
layout - The layout manager.

getLegendLayout

public LayoutManager getLegendLayout(IlvManagerLayer layer)
Returns the layout manager used to display the items representing the specified layer if the default layout has been overridden.

Parameters:
layer - The layer.
Returns:
The layout manager associated with layer or null if no layout manager have been associated with this layer.

setEditable

public void setEditable(boolean editable)
Sets the editable mode of the IlvJMapLegend. When the IlvJMapLegend is in editable mode, the user can change the layer order by dragging the components representing the layers.

Parameters:
editable - The new mode.
Since:
JViews 5.0

isEditable

public boolean isEditable()
Returns the editing mode for the IlvJMapLegend.

Returns:
true if the layer is editable, false otherwise.
Since:
JViews 5.0

setFilteredText

public void setFilteredText(String text)
Sets the String used to print the display status of a layer. A layer is filtered if it is not displayed in a view due to its visibility filters. The default text is " (Filtered)"

Parameters:
text - The text to use when a layer is filtered.
Since:
JViews 5.0
See Also:
getFilteredText()

getFilteredText

public String getFilteredText()
Returns the text used to print the display status of a layer.

Returns:
The text used to print the display status.
Since:
JViews 5.0
See Also:
setFilteredText(java.lang.String)

setUnnamedLayerText

public void setUnnamedLayerText(String text)
Sets the String used as the name of unnamed layers. The default text is "(No name)".

Parameters:
text - The text to use when a layer is filtered.
Since:
JViews 5.0
See Also:
getUnnamedLayerText()

getUnnamedLayerText

public String getUnnamedLayerText()
Returns the text used as the name of unnamed layers.

Returns:
The text used as the name of unnamed layers.
Since:
JViews 5.0
See Also:
setUnnamedLayerText(java.lang.String)


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.