|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JToolBar
com.bbn.openmap.gui.ToolPanel
Represents the toolbar containing tools to apply to the map. Tools can be added in sequential order, and retrieved using the tool's keyword. NOTE: Every time a string is passed into a method of this class, the interned version of it is used as a key.
When the ToolPanel is part of the BeanContext, it looks for Tools that have also been added to the BeanContext. If there is more than one ToolPanel in a BeanContext at a time, both will show the same Tool faces. The 'components' property can be used to control which tools can be added to a specific instance of a ToolPanel. That property should contain a space separated list of prefixes used for Tools, which in turn should be set in the Tools as their keys.
Tool
,
Serialized FormNested Class Summary |
Nested classes inherited from class javax.swing.JToolBar |
javax.swing.JToolBar.AccessibleJToolBar, javax.swing.JToolBar.Separator |
Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
protected boolean |
autoSpace
A flag to note whether the ToolPanel inserts spaces between tools. |
static java.lang.String |
AvoidComponentsProperty
A list of components to use for filtering out tools found in the MapHandler. |
protected java.util.List |
avoidList
A filter list of components to avoid. |
protected java.awt.GridBagConstraints |
c
|
protected java.util.List |
componentList
A filter list of components to look for and add. |
static java.lang.String |
ComponentsProperty
A list of components to use for filtering tools found in the MapHandler to add to this ToolPanel. |
protected javax.swing.JLabel |
filler
Holder that expands in the GridBagLayout, keeping things pushed to the left side of the toolpanel. |
protected java.awt.GridBagLayout |
gridbag
|
protected java.util.Hashtable |
items
The set of tools contained on the toolbar. |
int |
MAX_INDEXES
|
protected java.lang.String |
preferredLocation
BorderLayout.NORTH by default for this class. |
protected java.lang.String |
propertyPrefix
The property prefix used for this ToolPanel. |
protected boolean[] |
usedIndexes
A little array used to track what indexes are already used, to prevent the GridBagLayout from placing things on top of each other. |
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 com.bbn.openmap.gui.MapPanelChild |
PreferredLocationProperty |
Fields inherited from interface com.bbn.openmap.PropertyConsumer |
EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty |
Fields inherited from interface javax.swing.SwingConstants |
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
ToolPanel()
Constructor |
Method Summary | |
void |
add(java.lang.String key,
Tool item)
Add an item to the tool bar. |
void |
add(java.lang.String key,
Tool item,
int index)
Add an item to the tool bar. |
void |
add(Tool item)
Add an item to the tool bar. |
void |
add(Tool item,
int index)
Add an item to the tool bar. |
void |
addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener in_pcl)
Method for BeanContextChild interface. |
protected void |
addSpace()
Add a space between tools. |
void |
addVetoableChangeListener(java.lang.String propertyName,
java.beans.VetoableChangeListener in_vcl)
Method for BeanContextChild interface. |
boolean |
areComponentsVisible()
|
void |
childrenAdded(java.beans.beancontext.BeanContextMembershipEvent bcme)
BeanContextMembershipListener method. |
void |
childrenRemoved(java.beans.beancontext.BeanContextMembershipEvent bcme)
BeanContextMembershipListener method. |
void |
componentHidden(java.awt.event.ComponentEvent ce)
|
void |
componentMoved(java.awt.event.ComponentEvent ce)
|
void |
componentResized(java.awt.event.ComponentEvent ce)
|
void |
componentShown(java.awt.event.ComponentEvent ce)
|
void |
findAndInit(java.util.Iterator it)
Called when the ToolPanel is added to the BeanContext, and when new objects are added to the BeanContext after that. |
void |
findAndInit(java.lang.Object someObj)
|
Tool |
get(java.lang.String key)
Get an item from the tool bar. |
java.util.List |
getAvoidList()
Get the list of strings used by the ToolPanel to figure out which Tools should not be added (in the findAndInit()) method. |
java.beans.beancontext.BeanContext |
getBeanContext()
Method for BeanContextChild interface. |
java.util.List |
getComponentList()
Get the list of strings used by the ToolPanel to figure out which Tools should be added (in the findAndInit()) method and where they should go. |
protected int |
getNextAvailableIndex()
Provides the next available component index for placement, starting at 0. |
protected int |
getNextAvailableIndex(int startAt)
Provides the next available component index for placement, given a starting index. |
java.lang.String |
getPreferredLocation()
MapPanelChild method. |
java.util.Properties |
getProperties(java.util.Properties props)
Method to fill in a Properties object, reflecting the current values of the PropertyConsumer. |
java.util.Properties |
getPropertyInfo(java.util.Properties props)
Method to fill in a Properties object with values reflecting the properties able to be set on this PropertyConsumer. |
java.lang.String |
getPropertyPrefix()
Get the property key prefix that is being used to prepend to the property keys for Properties lookups. |
boolean |
isAutoSpace()
Find out whether spaces are being placed between tools. |
protected int |
keyOnList(java.lang.String key,
java.util.List list)
Figure out if the string key is in the provided list, and provide the location index of it is. |
protected java.lang.StringBuffer |
rebuildListProperty(java.util.List aList)
Take a List of strings, and return a space-separated version. |
void |
remove(java.lang.String key)
Remove a tool with the right key |
void |
removePropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener in_pcl)
Method for BeanContextChild interface. |
void |
removeVetoableChangeListener(java.lang.String propertyName,
java.beans.VetoableChangeListener in_vcl)
Method for BeanContextChild interface. |
void |
setAutoSpace(boolean set)
Set whether spaces are placed between tools. |
void |
setAvoidList(java.util.List list)
Set the list of strings used by the ToolPanel to figure out which Tools should not be added (in the findAndInit()) method. |
void |
setBeanContext(java.beans.beancontext.BeanContext in_bc)
Method for BeanContextChild interface. |
void |
setComponentList(java.util.List list)
Set the list of strings used by the ToolPanel to figure out which Tools should be added (in the findAndInit()) method and where they should go. |
void |
setPreferredLocation(java.lang.String value)
MapPanelChild method. |
void |
setProperties(java.util.Properties props)
Method to set the properties in the PropertyConsumer. |
void |
setProperties(java.lang.String prefix,
java.util.Properties props)
Method to set the properties in the PropertyConsumer. |
void |
setPropertyPrefix(java.lang.String prefix)
Set the property key prefix that should be used by the PropertyConsumer. |
protected void |
setVisibility()
If any of the components are visible, set the ToolPanel to be visible. |
Methods inherited from class javax.swing.JToolBar |
add, addImpl, addSeparator, addSeparator, createActionChangeListener, createActionComponent, getAccessibleContext, getComponentAtIndex, getComponentIndex, getMargin, getOrientation, getUI, getUIClassID, isBorderPainted, isFloatable, isRollover, paintBorder, paramString, setBorderPainted, setFloatable, setLayout, setMargin, setOrientation, setRollover, setUI, updateUI |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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 |
Field Detail |
protected java.util.Hashtable items
protected boolean autoSpace
protected java.lang.String propertyPrefix
public static final java.lang.String ComponentsProperty
public static final java.lang.String AvoidComponentsProperty
protected java.util.List componentList
protected java.util.List avoidList
protected java.awt.GridBagLayout gridbag
protected java.awt.GridBagConstraints c
protected javax.swing.JLabel filler
protected boolean[] usedIndexes
public int MAX_INDEXES
protected java.lang.String preferredLocation
Constructor Detail |
public ToolPanel()
Method Detail |
public void add(java.lang.String key, Tool item)
key
- The key associated with the item.item
- The Tool to add.protected int getNextAvailableIndex()
protected int getNextAvailableIndex(int startAt)
public void add(java.lang.String key, Tool item, int index)
key
- The key associated with the item.item
- The Tool to add.index
- The position index for placement of the tool. -1
puts it at the end, and if the position is greater than
the size, it is placed at the end. This class does not
remember where items were asked to be placed, so later
additions may mess up intended order.public void add(Tool item)
item
- The Tool to add.public void add(Tool item, int index)
item
- The Tool to add.index
- The position to add the Tool. -1 will add it to
the end.public Tool get(java.lang.String key)
key
- The key associated with the item.
public void remove(java.lang.String key)
protected void addSpace()
public void setAutoSpace(boolean set)
public void setPreferredLocation(java.lang.String value)
setPreferredLocation
in interface MapPanelChild
public java.lang.String getPreferredLocation()
getPreferredLocation
in interface MapPanelChild
public boolean isAutoSpace()
public void setComponentList(java.util.List list)
public java.util.List getComponentList()
public void setAvoidList(java.util.List list)
public java.util.List getAvoidList()
public void findAndInit(java.util.Iterator it)
it
- iterator to use to go through the new objects.protected int keyOnList(java.lang.String key, java.util.List list)
key
- the key of the component to check for.list
- the list of keys to check.
public void findAndInit(java.lang.Object someObj)
public void childrenAdded(java.beans.beancontext.BeanContextMembershipEvent bcme)
childrenAdded
in interface java.beans.beancontext.BeanContextMembershipListener
bcme
- the event containing the iterator with new objects.public void childrenRemoved(java.beans.beancontext.BeanContextMembershipEvent bcme)
childrenRemoved
in interface java.beans.beancontext.BeanContextMembershipListener
bcme
- the event containing the iterator with removed
objects.public java.beans.beancontext.BeanContext getBeanContext()
getBeanContext
in interface java.beans.beancontext.BeanContextChild
public void setBeanContext(java.beans.beancontext.BeanContext in_bc) throws java.beans.PropertyVetoException
setBeanContext
in interface java.beans.beancontext.BeanContextChild
in_bc
- the BeanContext.
java.beans.PropertyVetoException
public void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener in_pcl)
addPropertyChangeListener
in interface java.beans.beancontext.BeanContextChild
public void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener in_pcl)
removePropertyChangeListener
in interface java.beans.beancontext.BeanContextChild
public void addVetoableChangeListener(java.lang.String propertyName, java.beans.VetoableChangeListener in_vcl)
addVetoableChangeListener
in interface java.beans.beancontext.BeanContextChild
public void removeVetoableChangeListener(java.lang.String propertyName, java.beans.VetoableChangeListener in_vcl)
removeVetoableChangeListener
in interface java.beans.beancontext.BeanContextChild
public void setPropertyPrefix(java.lang.String prefix)
PropertyConsumer
setPropertyPrefix
in interface PropertyConsumer
prefix
- the prefix String.public java.lang.String getPropertyPrefix()
PropertyConsumer
getPropertyPrefix
in interface PropertyConsumer
public void setProperties(java.util.Properties props)
PropertyConsumer
setProperties
in interface PropertyConsumer
props
- a properties object that the PropertyConsumer
can use to retrieve expected properties it can use for
configuration.public void setProperties(java.lang.String prefix, java.util.Properties props)
PropertyConsumer
setProperties
in interface PropertyConsumer
prefix
- a String used by the PropertyConsumer to prepend
to each property value it wants to look up -
setList.getProperty(prefix.propertyKey). If the prefix
had already been set, then the prefix passed in should
replace that previous value.props
- a Properties object that the PropertyConsumer
can use to retrieve expected properties it can use for
configuration.protected java.lang.StringBuffer rebuildListProperty(java.util.List aList)
public java.util.Properties getProperties(java.util.Properties props)
PropertyConsumer
getProperties
in interface PropertyConsumer
props
- a Properties object to load the PropertyConsumer
properties into. If getList equals null, then a new
Properties object should be created.
public java.util.Properties getPropertyInfo(java.util.Properties props)
PropertyConsumer
getPropertyInfo
in interface PropertyConsumer
props
- a Properties object to load the PropertyConsumer
properties into. If getList equals null, then a new
Properties object should be created.
protected void setVisibility()
public boolean areComponentsVisible()
public void componentHidden(java.awt.event.ComponentEvent ce)
componentHidden
in interface java.awt.event.ComponentListener
public void componentMoved(java.awt.event.ComponentEvent ce)
componentMoved
in interface java.awt.event.ComponentListener
public void componentResized(java.awt.event.ComponentEvent ce)
componentResized
in interface java.awt.event.ComponentListener
public void componentShown(java.awt.event.ComponentEvent ce)
componentShown
in interface java.awt.event.ComponentListener
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |