public class LayersMenu extends AbstractOpenMapMenu implements java.io.Serializable, LayerListener
This object is interested in contacting a LayerHandler to find out all the layers available, and optionally, a LayersPanel in order to provide a menu item that will call up the GUI for the LayersPanel. If this LayersMenu is a member of a BeanContext, it expects that only one of each of these objects will be added, but if more than one per type is added, the last one added to be BeanContext will be the one hooked up to this LayersMenu.
javax.swing.JMenu.AccessibleJMenu, javax.swing.JMenu.WinListener
javax.swing.JMenuItem.AccessibleJMenuItem
javax.swing.AbstractButton.AccessibleAbstractButton, javax.swing.AbstractButton.ButtonChangeListener
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
protected javax.swing.JMenuItem |
add
The menu item to add a layer to the map.
|
protected java.lang.String |
addLayersButtonTitle
The default add button title.
|
static java.lang.String |
defaultEditLayersButtonTitle
The default edit button title.
|
protected javax.swing.JMenuItem |
edit
A button on the bottom of the menu to bring up the layersPanel.
|
protected java.lang.String |
editLayersButtonTitle
The actual edit button title.
|
protected LayerHandler |
layerHandler
The LayerHandler to listen to for layers available for the map.
|
static int |
LAYERS_ON_OFF
Static value to set this menu to control layer visibility.
|
protected LayersPanel |
layersPanel
Used by the BeanContext methods to insure that the component we
disconnect the edit button from is the same one being removed from the
BeanContext.
|
protected int |
menuType
The flag setting the behavior of the menu, whether it controls the layers
or the layers palettes.
|
static int |
PALETTES_ON_OFF
Static value to set this menu to control layer palette visibility.
|
beanContextChildSupport, i18n, items, itemsProperties, ItemsProperty, itemsPropertyContents, MnemonicProperty, PrettyNameProperty, propertyPrefix, SeparatorProperty
actionListener, BORDER_PAINTED_CHANGED_PROPERTY, changeEvent, changeListener, CONTENT_AREA_FILLED_CHANGED_PROPERTY, DISABLED_ICON_CHANGED_PROPERTY, DISABLED_SELECTED_ICON_CHANGED_PROPERTY, FOCUS_PAINTED_CHANGED_PROPERTY, HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, ICON_CHANGED_PROPERTY, itemListener, MARGIN_CHANGED_PROPERTY, MNEMONIC_CHANGED_PROPERTY, model, MODEL_CHANGED_PROPERTY, PRESSED_ICON_CHANGED_PROPERTY, ROLLOVER_ENABLED_CHANGED_PROPERTY, ROLLOVER_ICON_CHANGED_PROPERTY, ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, SELECTED_ICON_CHANGED_PROPERTY, TEXT_CHANGED_PROPERTY, VERTICAL_ALIGNMENT_CHANGED_PROPERTY, VERTICAL_TEXT_POSITION_CHANGED_PROPERTY
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty
Constructor and Description |
---|
LayersMenu()
Construct LayersMenu.
|
LayersMenu(LayerHandler lHandler)
Construct LayersMenu.
|
LayersMenu(LayerHandler lHandler,
java.lang.String menuName,
int menuType)
Construct LayersMenu.
|
Modifier and Type | Method and Description |
---|---|
void |
findAndInit(java.lang.Object someObj)
Called when the BeanContext membership changes with object from the
BeanContext.
|
void |
findAndUndo(java.lang.Object someObj)
Called when objects are removed from the BeanContext.
|
void |
fireVetoableChange(java.lang.String name,
java.lang.Object oldValue,
java.lang.Object newValue)
Report a vetoable property update to any registered listeners.
|
javax.swing.JMenuItem |
getEdit()
Get the edit menu item that triggers the LayersPanel action listener.
|
java.lang.String |
getEditLayersButtonTitle()
Return the title of the menu option to call up LayersPanel.
|
LayerHandler |
getLayerHandler()
Get the LayerHandler that the LayersPanel listens to.
|
protected LayersPanel |
getLayersPanel()
Get the LayersPanel, privately held to keep track of what object is being
used from the BeanContext.
|
void |
removeAll()
Remove all the components from the menu.
|
void |
setAdd(javax.swing.JMenuItem a)
Set the add menu item.
|
void |
setEdit(javax.swing.JMenuItem e)
Set the edit menu item that triggers the LayersPanel action listener.
|
void |
setEditLayersButtonTitle(java.lang.String buttonTitle)
Return the title of the menu option to call up LayersPanel.
|
void |
setLayerHandler(LayerHandler lh)
Set the LayerHandler that the LayersPanel listens to.
|
void |
setLayers(Layer[] inLayers)
Set the layers that are on the menu.
|
void |
setLayers(LayerEvent evt)
LayerListener interface method.
|
protected void |
setLayersFromEDT(Layer[] inLayers) |
protected void |
setLayersPanel(LayersPanel lp)
Set the LayersPanel privately to keep track of what object is being used
from the BeanContext.
|
void |
setupEditLayersButton(LayersPanel lp)
Given a LayersPanel, set up a JButton to add to the end of the LayersMenu
that will trigger the action listener of the LayersPanel.
|
void |
setupLayerAddButton(LayerAddPanel menu)
Constructs the menu item that will bring up the LayerAddPanel.
|
void |
updateLayerLabels()
Update the layer names.
|
addPropertyChangeListener, addVetoableChangeListener, childrenAdded, childrenRemoved, findAndInit, findAndUndo, getBeanContext, getMapHandler, getProperties, getPropertyInfo, getPropertyPrefix, removePropertyChangeListener, removeVetoableChangeListener, setBeanContext, setProperties, setProperties, setPropertyPrefix
add, add, add, add, add, addMenuListener, addSeparator, applyComponentOrientation, createActionChangeListener, createActionComponent, createWinListener, doClick, fireMenuCanceled, fireMenuDeselected, fireMenuSelected, getAccessibleContext, getComponent, getDelay, getItem, getItemCount, getMenuComponent, getMenuComponentCount, getMenuComponents, getMenuListeners, getPopupMenu, getPopupMenuOrigin, getSubElements, getUIClassID, insert, insert, insert, insertSeparator, isMenuComponent, isPopupMenuVisible, isSelected, isTearOff, isTopLevelMenu, menuSelectionChanged, paramString, processKeyEvent, remove, remove, remove, removeMenuListener, setAccelerator, setComponentOrientation, setDelay, setMenuLocation, setModel, setPopupMenuVisible, setSelected, updateUI
actionPropertyChanged, addMenuDragMouseListener, addMenuKeyListener, configurePropertiesFromAction, fireMenuDragMouseDragged, fireMenuDragMouseEntered, fireMenuDragMouseExited, fireMenuDragMouseReleased, fireMenuKeyPressed, fireMenuKeyReleased, fireMenuKeyTyped, getAccelerator, getMenuDragMouseListeners, getMenuKeyListeners, init, isArmed, processKeyEvent, processMenuDragMouseEvent, processMenuKeyEvent, processMouseEvent, removeMenuDragMouseListener, removeMenuKeyListener, setArmed, setEnabled, setUI
addActionListener, addChangeListener, addImpl, addItemListener, checkHorizontalKey, checkVerticalKey, createActionListener, createActionPropertyChangeListener, createChangeListener, createItemListener, doClick, fireActionPerformed, fireItemStateChanged, fireStateChanged, getAction, getActionCommand, getActionListeners, getChangeListeners, getDisabledIcon, getDisabledSelectedIcon, getDisplayedMnemonicIndex, getHideActionText, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getItemListeners, getLabel, getMargin, getMnemonic, getModel, getMultiClickThreshhold, getPressedIcon, getRolloverIcon, getRolloverSelectedIcon, getSelectedIcon, getSelectedObjects, getText, getUI, getVerticalAlignment, getVerticalTextPosition, imageUpdate, isBorderPainted, isContentAreaFilled, isFocusPainted, isRolloverEnabled, paintBorder, removeActionListener, removeChangeListener, removeItemListener, removeNotify, setAction, setActionCommand, setBorderPainted, setContentAreaFilled, setDisabledIcon, setDisabledSelectedIcon, setDisplayedMnemonicIndex, setFocusPainted, setHideActionText, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabel, setLayout, setMargin, setMnemonic, setMnemonic, setMultiClickThreshhold, setPressedIcon, setRolloverEnabled, setRolloverIcon, setRolloverSelectedIcon, setSelectedIcon, setText, setUI, setVerticalAlignment, setVerticalTextPosition
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, 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, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, addContainerListener, addPropertyChangeListener, 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, 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, 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, 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, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final transient int LAYERS_ON_OFF
public static final transient int PALETTES_ON_OFF
protected int menuType
protected transient LayerHandler layerHandler
protected transient LayersPanel layersPanel
protected transient javax.swing.JMenuItem edit
public static final java.lang.String defaultEditLayersButtonTitle
protected transient java.lang.String editLayersButtonTitle
protected transient javax.swing.JMenuItem add
protected transient java.lang.String addLayersButtonTitle
public LayersMenu()
public LayersMenu(LayerHandler lHandler)
lHandler
- the handler for the layerpublic LayersMenu(LayerHandler lHandler, java.lang.String menuName, int menuType)
lHandler
- the handler for the layermenuName
- the name of the menumenuType
- either LAYERS_ON_OFF, or PALETTES_ON_OFFpublic void setLayerHandler(LayerHandler lh)
If there is a LayerHandler that is already being listened to, then the LayersPanel will remove itself from current LayerHandler as a LayerListener, before adding itself to the new LayerHandler.
Lastly, if the LayerHandler passed in is null, the LayersPanel will disconnect itself from any LayerHandler currently held, and reset itself with no layers.
lh
- the LayerHandler containing the layers.public LayerHandler getLayerHandler()
protected void setLayersPanel(LayersPanel lp)
protected LayersPanel getLayersPanel()
public void setEditLayersButtonTitle(java.lang.String buttonTitle)
public java.lang.String getEditLayersButtonTitle()
public void setEdit(javax.swing.JMenuItem e)
public void setAdd(javax.swing.JMenuItem a)
public javax.swing.JMenuItem getEdit()
public void setLayers(LayerEvent evt)
setLayers
in interface LayerListener
evt
- a LayerEventpublic void setLayers(Layer[] inLayers)
inLayers
- the array of layers.protected void setLayersFromEDT(Layer[] inLayers)
public void removeAll()
removeAll
in class javax.swing.JMenu
public void updateLayerLabels()
public void setupEditLayersButton(LayersPanel lp)
lp
- the LayersPanel to ask for an ActionListener from.public void setupLayerAddButton(LayerAddPanel menu)
public void findAndInit(java.lang.Object someObj)
findAndInit
in interface LightMapHandlerChild
findAndInit
in class AbstractOpenMapMenu
someObj
- Object received in the BeanContext or
BeanContextMembershipEvent.public void findAndUndo(java.lang.Object someObj)
findAndUndo
in interface LightMapHandlerChild
findAndUndo
in class AbstractOpenMapMenu
someObj
- the object being removed from the BeanContextpublic void fireVetoableChange(java.lang.String name, java.lang.Object oldValue, java.lang.Object newValue) throws java.beans.PropertyVetoException
No event is fired if old and new are equal and non-null.
fireVetoableChange
in class javax.swing.JComponent
name
- The programmatic name of the property that is about to changeoldValue
- The old value of the propertynewValue
- - The new value of the propertyjava.beans.PropertyVetoException
- if the recipient wishes the property change
to be rolled back.Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details