Class AbstractOverlayListPanel
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,Accessible
The AbstractOverlayListPanel
class is the abstract
parent of all overlay list panels. It allows the user to add new
overlays via a set of buttons, remove overlays from the current
list, edit a specific overlay using an overlay property chooser,
and rearrange the overlay layers within the list. Child classes
must implement the getAddButtons()
method which
returns a list of the "add overlay" buttons, and the
getTitle()
method which determine the title for parts
of the panel. Child classes may also override the
getCustomPanel()
method to supply a custom panel that
is inserted between the add button panel and the overlay list.
The overlay list panel signals an add/remove in the overlay list by
firing a property change event whose property name is given by the
OVERLAY_PROPERTY
constant, and old value (if non-null)
contains an overlay to remove from the view, and new value (if
non-null) contains an overlay to add to the view. If the overlay
to add already exists in the view, then the overlay's internal
properties have changed and the view should be re-rendered.
Additionally, a selection change in the overlay list is signaled by
firing a property change event whose property name is given by the
SELECTION_PROPERTY
constant. The selection value is
the currently selected EarthDataOverlay
object, or
null if none is selected. If multiple overlays are selected, no
event is fired.
- Since:
- 3.1.7
- Author:
- Peter Hollemans
- See Also:
-
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.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
Modifier and TypeFieldDescriptionstatic String
The overlay property for change events.protected ComponentList<VisualOverlay>
The list of overlays.static String
The selection property for change events.Fields inherited from class javax.swing.JComponent
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
accessibleContext, 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
ModifierConstructorDescriptionprotected
Creates a new list panel, showing the Remove/Edit/Up/Down buttons.protected
AbstractOverlayListPanel
(boolean showRemove, boolean showEdit, boolean showArrange, boolean showVisibility, boolean showGroup) Creates a new list panel with the specified buttons. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addOverlay
(EarthDataOverlay overlay) Adds an overlay to the list.protected void
addOverlays
(List overlays) Adds a set of overlays to the list.protected abstract List
Gets the list of add overlay buttons.protected String
Gets the title that will be used to annotate the button panel.protected JPanel
Gets a custom panel to be placed between the add overlay button panel and the overlay list.protected String
Gets the title that will be used to annotate the groups panel.protected String
Gets the title that will be used to annotate the list panel.protected int
getOverlayCount
(Object overlayKey) Gets and increments the current count of overlays created with the specified key.Gets the list of overlays.protected abstract String
getTitle()
Gets the title that will be used to annotate the button and list panels.static void
Tests this class.protected void
Removes all overlays from the list.void
setBaseLayer
(int baseLayer) Sets the base layer.void
setDataSource
(EarthDataReader reader, List variableList) Sets the data source for bitmask grid data.void
setVisibleRowCount
(int rows) Sets the preferred number of visible overlay list rows.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, 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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
OVERLAY_PROPERTY
The overlay property for change events. -
SELECTION_PROPERTY
The selection property for change events. -
overlayList
The list of overlays.
-
-
Constructor Details
-
AbstractOverlayListPanel
protected AbstractOverlayListPanel()Creates a new list panel, showing the Remove/Edit/Up/Down buttons. -
AbstractOverlayListPanel
protected AbstractOverlayListPanel(boolean showRemove, boolean showEdit, boolean showArrange, boolean showVisibility, boolean showGroup) Creates a new list panel with the specified buttons.- Parameters:
showRemove
- if true, shows the remove overlay button.showEdit
- if true, shows the edit selected overlay button.showArrange
- if true, shows the up and down overlay buttons.showVisibility
- if true, shows the visibility modifier buttons.showGroup
- if true, shows the overlay group panel.
-
-
Method Details
-
setDataSource
Sets the data source for bitmask grid data. This method need only be used if the overlay group feature is enabled, and the group manager needs to load bitmask overlays.- Parameters:
reader
- the reader to use for data variables.variableList
- the list of allowed data variable names.- See Also:
-
getCustomPanel
Gets a custom panel to be placed between the add overlay button panel and the overlay list.- Returns:
- the custom panel or null for none (the default).
-
setVisibleRowCount
public void setVisibleRowCount(int rows) Sets the preferred number of visible overlay list rows.- Parameters:
rows
- the number of visible rows.
-
setBaseLayer
public void setBaseLayer(int baseLayer) Sets the base layer. When overlays are added to the list, they are given a layer number that is higher than any other overlay currently in the list so that the new overlay is rendered on top of existing overlays. The base layer determines what layer value the initially added overlay will have. By default the base layer is 0.- Parameters:
baseLayer
- the base layer for the initial overlay.
-
removeOverlays
protected void removeOverlays()Removes all overlays from the list. No property change event is fired. -
addOverlays
Adds a set of overlays to the list. This method should be called by the child class to setup the initial list of overlays. No property change event is fired, and no layer numbers are assigned, since we assume that the layers are set correctly. Overlays are displayed in the order that the layer values dictate.- Parameters:
overlays
- the initial set of overlays.
-
addOverlay
Adds an overlay to the list. This method should be called by the child class when a new overlay is added. A property change event is fired to indicate that the overlay has been added. The layer number of the overlay is set to be larger than any existing layer number in the list. The new overlay is set to be selected in the list.- Parameters:
overlay
- the overlay to add.
-
getAddButtons
Gets the list of add overlay buttons. Generally, the list should contain buttons of all one size with tool text and action listeners attached. In order to add an overlay when clicked, the button listener should invoke theaddOverlay()
method.- Returns:
- the list of add buttons, or null to not create a button panel.
-
getTitle
Gets the title that will be used to annotate the button and list panels.- Returns:
- the title string, or null if no titles should be used.
-
getButtonTitle
Gets the title that will be used to annotate the button panel.- Returns:
- the title string, or null if no titles should be used.
-
getListTitle
Gets the title that will be used to annotate the list panel.- Returns:
- the title string, or null if no titles should be used.
-
getGroupTitle
Gets the title that will be used to annotate the groups panel.- Returns:
- the title string, or null if no titles should be used.
-
getOverlayCount
Gets and increments the current count of overlays created with the specified key. This method may be used by child classes to help name new overlays as they are created.- Parameters:
overlayKey
- the overlay key used to uniquely identify a set of overlays.- Returns:
- the total number of calls to this method with the specified overlay key.
-
getOverlayList
Gets the list of overlays.- Returns:
- the list of overlays.
-
main
Tests this class.- Parameters:
argv
- the array of arguments (ignored).
-