public class LegendView extends View
LegendView(String, boolean, LanguageFile, String)
to specify a language file from which
labels, tooltips and messages are read by the given language id. The following language labels are available:
Resources.LANGUAGE_FILE
.
add(LegendItem)
to add items to the legend view and call getItem(String)
to get the legend item
of a specific item name.LegendItem.createCircleIcon(Color, Color, int)
, ...
to create predefined icons or you can load custom icons by using ImageIcon
.
setGroupBackground(Color)
/setGroupForeground(Color)
.
View.saveConfiguration(Configuration)
and View.loadConfiguration(Configuration)
.
It is saved or restored the visibility of the view. This makes it possible that you can store the state of the view persistent.Legend
,
Serialized Formjavax.swing.JComponent.AccessibleJComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
LegendView(java.lang.String title)
Creates a new legend view.
|
LegendView(java.lang.String title,
boolean closable)
Creates a new legend view.
|
LegendView(java.lang.String title,
boolean closable,
LanguageFile langFile,
java.lang.String langID)
Creates a new legend view.
|
Modifier and Type | Method and Description |
---|---|
void |
add(LegendItem item)
Adds a new item to the legend view.
|
java.awt.Font |
getFont()
Gets the font of the legend view.
|
java.awt.Color |
getGroupBackground()
Gets the background color of the groups in the legend.
|
java.awt.Color |
getGroupForeground()
Gets the foreground color of the groups in the legend.
|
LegendItem |
getItem(java.lang.String itemName)
Gets the legend item of a specific name.
|
protected void |
readConfigurationData(Configuration cd)
Reads the configuration data of the view.
|
void |
removeAll()
Removes all items from the legend.
|
void |
reset()
Resets the view which means sets the initial state of the view.
|
void |
setFont(java.awt.Font font)
Sets the font of the legend in the view.
|
void |
setGroupBackground(java.awt.Color color)
Sets the background color of the groups in the legend.
|
void |
setGroupForeground(java.awt.Color color)
Sets the foreground color of the groups in the legend.
|
protected void |
writeConfigurationData(Configuration cd)
Writes the configuration data of the view.
|
addHeaderBarComponent, addHeaderBarSeparator, addImpl, autoRepaint, beforeRemove, close, extendTitle, getAutoRepaint, getContentPanel, getTitle, highlight, highlight, isClosable, isVisible, loadConfiguration, loadConfiguration, removeHeaderBarComponent, saveConfiguration, saveConfiguration, setAutoRepaint, setBorder, setCloseButtonToolTip, setLayout, setVisible, toString
isRepaintDisabled, repaint, repaintComponent, setRepaintDisabled
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, 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, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update, updateUI
add, add, add, add, add, addContainerListener, 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, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusDownCycle, validate, validateTree
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, 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, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle
public LegendView(java.lang.String title) throws java.lang.IllegalArgumentException
title
- the title of the view which is displayed in the header barjava.lang.IllegalArgumentException
- public LegendView(java.lang.String title, boolean closable) throws java.lang.IllegalArgumentException
title
- the title of the view which is displayed in the header barclosable
- true
if the legend view can be closed by the user using the "X" in the header bar otherwise false
(if a legend view is not closable he must be set invisible manually using View.setVisible(boolean)
if required)java.lang.IllegalArgumentException
- public LegendView(java.lang.String title, boolean closable, LanguageFile langFile, java.lang.String langID) throws java.lang.IllegalArgumentException
LanguageFile
and a language id to display language dependent
messages and tooltips in the legend view. The following language labels are available:
title
- the title of the view which is displayed in the header barclosable
- true
if the legend view can be closed by the user using the "X" in the header bar otherwise false
(if a legend view is not closable he must be set invisible manually using View.setVisible(boolean)
if required)langFile
- the language file or null
if the legend view should not use language dependent labels, tooltips or messages (in this case the predefined labels, tooltips and messages are shown)langID
- the language idjava.lang.IllegalArgumentException
- public void add(LegendItem item) throws java.lang.IllegalArgumentException
item
- the itemjava.lang.IllegalArgumentException
- public LegendItem getItem(java.lang.String itemName)
itemName
- the name of the itemnull
if the legend view does not contain an item with the given namepublic java.awt.Color getGroupBackground()
public void setGroupBackground(java.awt.Color color) throws java.lang.IllegalArgumentException
color
- the backgroundjava.lang.IllegalArgumentException
- public java.awt.Color getGroupForeground()
public void setGroupForeground(java.awt.Color color) throws java.lang.IllegalArgumentException
color
- the foregroundjava.lang.IllegalArgumentException
- public java.awt.Font getFont()
getFont
in interface java.awt.MenuContainer
getFont
in class java.awt.Component
public void setFont(java.awt.Font font)
setFont
in class javax.swing.JComponent
font
- the fontpublic void removeAll()
public void reset()
View
protected void readConfigurationData(Configuration cd)
... protected void readConfigurationData(Configuration cd) { super.readConfigurationData(cd); // load custom data like // foreground = cd.getColor("foreground"); // ... } ...Furthermore it is read the font size (key "fontSize") of the legend view.
readConfigurationData
in class View
cd
- the configuration dataprotected void writeConfigurationData(Configuration cd)
... protected void writeConfigurationData(Configuration cd) { super.writeConfigurationData(cd); // write custom data like // cd.addColor("foreground", foreground); // ... } ...Furthermore it is written the font size (key "fontSize") of the legend view.
writeConfigurationData
in class View
cd
- the configuration data