|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel com.bbn.openmap.gui.OMComponentPanel com.bbn.openmap.gui.BasicMapPanel
public class BasicMapPanel
The BasicMapPanel is a MapPanel and OMComponentPanel that is the heart of the OpenMap application framework. It can be used in a application or applet. The Panel has a BorderLayout, and creates a MapBean for its center area. It creates a MapHandler to use to hold all of its OpenMap components, and uses the PropertyHandler given to it in its constructor to create and configure all of the application components. The best way to add components to the MapPanel is to get the MapHandler from it and add components to that. The BasicMapPanel also adds itself to its MapHandler, so when the PropertyHandler adds MapPanelChildren components to the MapHandler, the BasicMapPanel is able to find them via the findAndInit method. By default, the BasicMapPanel looks for MapPanelChildren and asks them for where they would prefer to be located (BorderLayout.NORTH, BorderLayout.SOUTH, BorderLayout.EAST, BorderLayout.WEST). If you extend this component, though, other components could be found via that same findAndInit method.
If a property prefix is set on this MapPanel, that property prefix can be used to designate MapPanelChild objects for this MapPanel. The setName variable should be set to true, and the children's parent name should match whatever property prefix is given to the panel.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
javax.swing.JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
static java.util.logging.Logger |
logger
|
protected MapBean |
mapBean
|
protected MapHandler |
mapHandler
|
protected MenuList |
menuList
|
protected PropertyHandler |
propertyHandler
|
static java.lang.String |
SET_NAME_PROPERTY
|
protected boolean |
setName
|
Fields inherited from class com.bbn.openmap.gui.OMComponentPanel |
---|
beanContextChildSupport, i18n, isolated, orientation, propertyPrefix, windowSupport |
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.PropertyConsumer |
---|
EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
BasicMapPanel()
Creates an empty MapPanel that creates its own empty PropertyHandler. |
|
BasicMapPanel(boolean delayCreation)
Create a MapPanel with the option of delaying the search for properties until the create() call is made. |
|
BasicMapPanel(PropertyHandler propertyHandler)
Create a MapPanel that configures itself with the properties contained in the PropertyHandler provided. |
|
BasicMapPanel(PropertyHandler propertyHandler,
boolean delayCreation)
Create a MapPanel that configures itself with properties contained in the PropertyHandler provided, and with the option of delaying the search for properties until the create() call is made. |
Method Summary | |
---|---|
protected void |
addMapBeanToPanel(MapBean map)
Position the map bean in this panel according to the layout manger. |
void |
addMapComponent(java.lang.Object mapComponent)
Adds a component to the map bean context. |
protected void |
addMapPanelChild(MapPanelChild mpc)
Add a child to the MapPanel. |
void |
addProperties(java.util.Properties p)
Add in the properties from the given Properties object. |
void |
addProperties(java.lang.String propFile)
Add in the properties from the given source, which can be a resource, file or URL. |
void |
addProperties(java.net.URL urlToProperties)
Add in the properties from the given URL. |
void |
addProperty(java.lang.String property,
java.lang.String value)
Add (or overwrite) a property to the current properties |
void |
appendProperty(java.lang.String property,
java.util.Properties src)
Append the given property into the current properties |
void |
appendProperty(java.lang.String property,
java.lang.String value)
Append the given property into the current properties |
void |
create()
The method that triggers setLayout() and createComponents() to be called. |
protected void |
createComponents()
The constructor calls this method that creates the MapHandler and MapBean, and then tells the PropertyHandler to create the components described in its properties. |
protected java.awt.LayoutManager |
createLayoutManager()
The constructor calls this method that sets the LayoutManager for this MapPanel. |
static MapBean |
createMapBean()
A static method that creates a MapBean with it's projection set to the values set in the Environment. |
static MapBean |
createMapBean(Projection proj,
javax.swing.border.Border border)
A static method that creates a MapBean and sets its projection and border to the values given. |
void |
dispose()
Sets the MapBean variable to null and removes all children. |
void |
findAndInit(java.lang.Object someObj)
The BasicMapPanel looks for MapPanelChild components, finds out from them where they prefer to be placed, and adds them. |
void |
findAndUndo(java.lang.Object someObj)
The MapPanel looks for MapPanelChild components and removes them from itself. |
MapBean |
getMapBean()
MapPanel method. |
java.lang.Object |
getMapComponent(java.lang.String prefix)
Find the object with the given prefix by looking it up in the prefix librarian in the MapHandler. |
java.lang.Object |
getMapComponentByType(java.lang.Class<?> c)
Given a Class, find the object in the MapHandler. |
java.util.Collection<?> |
getMapComponentsByType(java.lang.Class<?> c)
Get all of the mapComponents that are of the given class type. |
MapHandler |
getMapHandler()
MapPanel method. |
javax.swing.JMenu |
getMapMenu()
MapPanel method. |
javax.swing.JMenuBar |
getMapMenuBar()
MapPanel method. |
java.util.Properties |
getProperties()
Get the current properties. |
PropertyHandler |
getPropertyHandler()
Get the PropertyHandler containing properties used to configure the panel, creating it if it doesn't exist. |
boolean |
isSetName()
|
void |
prependProperty(java.lang.String property,
java.util.Properties src)
Prepend the given property into the current properties |
void |
prependProperty(java.lang.String property,
java.lang.String value)
Prepend the given property into the current properties |
boolean |
removeMapComponent(java.lang.Object mapComponent)
Remove a component from the map bean context. |
void |
removeMarker(java.lang.String property,
java.lang.String marker)
remove a marker from a space delimited set of properties. |
boolean |
removeProperty(java.lang.String property)
Remove an existing property if it exists. |
void |
setMapBean(MapBean bean)
Set the map bean used in this map panel, replace the map bean in the MapHandler if there isn't already one, or if the policy allows replacement. |
void |
setProperties(java.lang.String prefix,
java.util.Properties props)
Sets the properties in the PropertyHandler managed by this BasicMapPanel. |
void |
setPropertyHandler(PropertyHandler handler)
Set the PropertyHandler containing the properties used to configure this panel. |
void |
setSetName(boolean setName)
|
Methods inherited from class com.bbn.openmap.gui.OMComponentPanel |
---|
addVetoableChangeListener, childrenAdded, childrenRemoved, findAndInit, fireVetoableChange, getBeanContext, getOrientation, getProperties, getPropertyInfo, getPropertyPrefix, getWindowSupport, isIsolated, removeVetoableChangeListener, setBeanContext, setIsolated, setOrientation, setProperties, setPropertyPrefix, setWindowSupport |
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, 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, 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 |
Methods inherited from interface java.beans.beancontext.BeanContextChild |
---|
addPropertyChangeListener, removePropertyChangeListener |
Field Detail |
---|
public static java.util.logging.Logger logger
public static final java.lang.String SET_NAME_PROPERTY
protected MapHandler mapHandler
protected MapBean mapBean
protected PropertyHandler propertyHandler
protected MenuList menuList
protected boolean setName
Constructor Detail |
---|
public BasicMapPanel()
public BasicMapPanel(boolean delayCreation)
create()
call is made.
delayCreation
- true to let the MapPanel know that the artful
programmer will call create()
public BasicMapPanel(PropertyHandler propertyHandler)
public BasicMapPanel(PropertyHandler propertyHandler, boolean delayCreation)
create()
call is made.
delayCreation
- true to let the MapPanel know that the artful
programmer will call create()
Method Detail |
---|
public void setProperties(java.lang.String prefix, java.util.Properties props)
setProperties
in interface PropertyConsumer
setProperties
in class OMComponentPanel
prefix
- property prefix for scoping properties for this panelprops
- the properties to search for properties in.public void create()
protected java.awt.LayoutManager createLayoutManager()
protected void addMapBeanToPanel(MapBean map)
protected void createComponents()
public MapBean getMapBean()
getMapBean
in interface MapPanel
public void setMapBean(MapBean bean)
MultipleSoloMapComponentException
- if there is already a map bean
in the map handler and the policy is to reject duplicates (since
the MapBean is a SoloMapComponent).public PropertyHandler getPropertyHandler()
public void setPropertyHandler(PropertyHandler handler)
public MapHandler getMapHandler()
getMapHandler
in interface MapPanel
public javax.swing.JMenuBar getMapMenuBar()
getMapMenuBar
in interface MapPanel
public javax.swing.JMenu getMapMenu()
getMapMenu
in interface MapPanel
public void addMapComponent(java.lang.Object mapComponent)
mapComponent
available to the map layers and other
components.
addMapComponent
in interface MapPanel
mapComponent
- a component to be added to the map bean context
MultipleSoloMapComponentException
- if mapComponent is a
SoloMapComponent and another instance already exists and the
policy is a reject policy.public boolean removeMapComponent(java.lang.Object mapComponent)
mapComponent
- a component to be removed to the map bean context
public java.lang.Object getMapComponentByType(java.lang.Class<?> c)
public java.util.Collection<?> getMapComponentsByType(java.lang.Class<?> c)
public java.lang.Object getMapComponent(java.lang.String prefix)
public void findAndInit(java.lang.Object someObj)
findAndInit
in interface LightMapHandlerChild
findAndInit
in class OMComponentPanel
protected void addMapPanelChild(MapPanelChild mpc)
public void findAndUndo(java.lang.Object someObj)
findAndUndo
in interface LightMapHandlerChild
findAndUndo
in class OMComponentPanel
public void dispose()
dispose
in interface MapPanel
public static MapBean createMapBean()
public static MapBean createMapBean(Projection proj, javax.swing.border.Border border)
public java.util.Properties getProperties()
public boolean removeProperty(java.lang.String property)
public void addProperty(java.lang.String property, java.lang.String value)
public void addProperties(java.net.URL urlToProperties)
public void addProperties(java.lang.String propFile) throws java.net.MalformedURLException
MalformedURLException
- if propFile doesn't resolve properly.public void removeMarker(java.lang.String property, java.lang.String marker)
public void addProperties(java.util.Properties p)
public void appendProperty(java.lang.String property, java.util.Properties src)
public void appendProperty(java.lang.String property, java.lang.String value)
public void prependProperty(java.lang.String property, java.util.Properties src)
public void prependProperty(java.lang.String property, java.lang.String value)
public boolean isSetName()
public void setSetName(boolean setName)
setName
- whether the property prefix provided in setProperties will
be set on the MapPanel. If it is, then when MapPanelChild objects
are found in the MapHandler, they will only be added if the names
match.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |