public class MapFrame extends javax.swing.JPanel implements Destroyable, MapView.LayerChangeListener
Modifier and Type | Class and Description |
---|---|
(package private) class |
MapFrame.ListAllButtonsAction |
static interface |
MapFrame.MapModeChangeListener
Interface to notify listeners of the change of the mapMode.
|
private class |
MapFrame.SideToolbarPopupMenu |
javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
private java.util.List<IconToggleButton> |
allDialogButtons |
private java.util.List<ToggleDialog> |
allDialogs |
java.util.List<IconToggleButton> |
allMapModeButtons |
ConflictDialog |
conflictDialog
Conflict dialog
|
static int |
DEF_TOGGLE_DLG_WIDTH
Default width of the toggle dialog area.
|
private DialogsPanel |
dialogsPanel |
FilterDialog |
filterDialog
Filter dialog
|
AdvancedKeyPressDetector |
keyDetector
This object allows to detect key press and release events
|
private java.util.Map<Layer,MapMode> |
lastMapMode |
private javax.swing.JPanel |
leftPanel |
private MapFrame.ListAllButtonsAction |
listAllDialogsAction |
private MapFrame.ListAllButtonsAction |
listAllMapModesAction |
private javax.swing.JButton |
listAllMapModesButton |
private javax.swing.JButton |
listAllToggleDialogsButton |
MapMode |
mapMode
The current mode, this frame operates.
|
private static java.util.concurrent.CopyOnWriteArrayList<MapFrame.MapModeChangeListener> |
mapModeChangeListeners
the mapMode listeners
|
DrawAction |
mapModeDraw
Draw mode
|
private java.util.List<MapMode> |
mapModes |
SelectAction |
mapModeSelect
Select mode
|
LassoModeAction |
mapModeSelectLasso
Select Lasso mode
|
ZoomAction |
mapModeZoom
Zoom mode
|
MapPaintDialog |
mapPaintDialog
Map paint dialog
|
MapView |
mapView
The view control displayed.
|
NotesDialog |
noteDialog
Notes dialog
|
PropertiesDialog |
propertiesDialog
Properties dialog
|
RelationListDialog |
relationListDialog
Relation list dialog
|
SelectionListDialog |
selectionListDialog
Selection list dialog
|
private javax.swing.JComponent |
sideToolBar
The toolbar with the action icons.
|
private Preferences.PreferenceChangedListener |
sidetoolbarPreferencesChangedListener |
private javax.swing.JSplitPane |
splitPane
The split pane with the mapview (leftPanel) and toggle dialogs (dialogsPanel).
|
MapStatus |
statusLine
The status line below the map
|
private javax.swing.JToolBar |
toolBarActions |
private javax.swing.ButtonGroup |
toolBarActionsGroup |
private javax.swing.JToolBar |
toolBarToggle |
ValidatorDialog |
validatorDialog
Validator dialog
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
MapFrame(javax.swing.JPanel contentPane,
ViewportData viewportData)
Constructs a new
MapFrame . |
Modifier and Type | Method and Description |
---|---|
void |
activeLayerChange(Layer oldLayer,
Layer newLayer)
Notifies this listener that the active layer has changed.
|
void |
addMapMode(IconToggleButton b) |
static void |
addMapModeChangeListener(MapFrame.MapModeChangeListener listener)
Adds a mapMode change listener
|
IconToggleButton |
addToggleDialog(ToggleDialog dlg) |
IconToggleButton |
addToggleDialog(ToggleDialog dlg,
boolean isExpert)
Call this to add new toggle dialogs to the left button-list
|
void |
addTopPanel(java.awt.Component c)
Add component
c on top of MapView |
void |
destroy()
Called as some kind of destructor when the last layer has been removed.
|
void |
fillPanel(java.awt.Container panel)
Fill the given panel by adding all necessary components to the different
locations.
|
protected static void |
fireMapModeChanged(MapMode oldMapMode,
MapMode newMapMode) |
javax.swing.Action |
getDefaultButtonAction() |
private MapMode |
getLastMapMode(Layer newLayer) |
<T> T |
getToggleDialog(java.lang.Class<T> type)
Replies the instance of a toggle dialog of type
type managed by this map frame |
<T> T |
getTopPanel(java.lang.Class<T> type)
Find panel on top of MapView by class
|
void |
initializeDialogsPane()
Open all ToggleDialogs that have their preferences property set.
|
void |
layerAdded(Layer newLayer)
Notifies this listener that a layer has been added.
|
void |
layerRemoved(Layer oldLayer)
Notifies this listener that a layer has been removed.
|
void |
rememberToggleDialogWidth()
Remember the current width of the (possibly resized) toggle dialog area
|
static void |
removeMapModeChangeListener(MapFrame.MapModeChangeListener listener)
Removes a mapMode change listener
|
void |
removeTopPanel(java.lang.Class<?> type)
Remove panel from top of MapView by class
|
boolean |
selectDrawTool(boolean onlyIfModeless) |
boolean |
selectMapMode(MapMode newMapMode)
Change the operating map mode for the view.
|
boolean |
selectMapMode(MapMode newMapMode,
Layer newLayer)
Another version of the selectMapMode for changing layer action.
|
boolean |
selectSelectTool(boolean onlyIfModeless) |
boolean |
selectZoomTool(boolean onlyIfModeless) |
void |
setDialogsPanelVisible(boolean visible) |
void |
setVisible(boolean aFlag)
Fires an property changed event "visible".
|
void |
validateToolBarsVisibility() |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
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, unregisterKeyboardAction, update
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
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, 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, transferFocusBackward, transferFocusUpCycle
public final MapView mapView
Accessing this is discouraged. Use the LayerManager
to access map data.
public final transient AdvancedKeyPressDetector keyDetector
private javax.swing.JComponent sideToolBar
private final javax.swing.ButtonGroup toolBarActionsGroup
private final javax.swing.JToolBar toolBarActions
private final javax.swing.JToolBar toolBarToggle
private final java.util.List<ToggleDialog> allDialogs
private final java.util.List<IconToggleButton> allDialogButtons
public final java.util.List<IconToggleButton> allMapModeButtons
private final MapFrame.ListAllButtonsAction listAllDialogsAction
private final MapFrame.ListAllButtonsAction listAllMapModesAction
private final javax.swing.JButton listAllToggleDialogsButton
private final javax.swing.JButton listAllMapModesButton
public final ConflictDialog conflictDialog
public final FilterDialog filterDialog
public final RelationListDialog relationListDialog
public final ValidatorDialog validatorDialog
public final SelectionListDialog selectionListDialog
public final PropertiesDialog propertiesDialog
public final MapPaintDialog mapPaintDialog
public final NotesDialog noteDialog
public final SelectAction mapModeSelect
public final DrawAction mapModeDraw
public final ZoomAction mapModeZoom
public LassoModeAction mapModeSelectLasso
private final transient java.util.Map<Layer,MapMode> lastMapMode
public MapStatus statusLine
private final javax.swing.JSplitPane splitPane
private final javax.swing.JPanel leftPanel
private final DialogsPanel dialogsPanel
public static final int DEF_TOGGLE_DLG_WIDTH
private static final java.util.concurrent.CopyOnWriteArrayList<MapFrame.MapModeChangeListener> mapModeChangeListeners
private transient Preferences.PreferenceChangedListener sidetoolbarPreferencesChangedListener
public MapFrame(javax.swing.JPanel contentPane, ViewportData viewportData)
MapFrame
.contentPane
- The content pane used to register shortcuts in its
InputMap
and ActionMap
viewportData
- the initial viewport of the map. Can be null, then
the viewport is derived from the layer data.public boolean selectSelectTool(boolean onlyIfModeless)
public boolean selectDrawTool(boolean onlyIfModeless)
public boolean selectZoomTool(boolean onlyIfModeless)
public void destroy()
destroy
in interface Destroyable
public javax.swing.Action getDefaultButtonAction()
public void initializeDialogsPane()
public IconToggleButton addToggleDialog(ToggleDialog dlg)
public IconToggleButton addToggleDialog(ToggleDialog dlg, boolean isExpert)
dlg
- The toggle dialog. It must not be in the list already.isExpert
- true
if it's reserved to expert modepublic void addMapMode(IconToggleButton b)
public void setVisible(boolean aFlag)
setVisible
in class javax.swing.JComponent
aFlag
- true
if display should be visiblepublic boolean selectMapMode(MapMode newMapMode)
newMapMode
- The new mode to set.true
if mode is really selectedpublic boolean selectMapMode(MapMode newMapMode, Layer newLayer)
newMapMode
- The new mode to set.newLayer
- newly selected layertrue
if mode is really selectedpublic void fillPanel(java.awt.Container panel)
panel
- The container to fill. Must have a BorderLayout.public void validateToolBarsVisibility()
public <T> T getToggleDialog(java.lang.Class<T> type)
type
managed by this map frameT
- toggle dialog typetype
- the class of the toggle dialog, i.e. UserListDialog.classtype
managed by this
map frame; null, if no such dialog existspublic void setDialogsPanelVisible(boolean visible)
public void rememberToggleDialogWidth()
public void removeTopPanel(java.lang.Class<?> type)
type
- type of panelpublic <T> T getTopPanel(java.lang.Class<T> type)
T
- typetype
- type of panelpublic void addTopPanel(java.awt.Component c)
c
on top of MapViewc
- componentpublic static void addMapModeChangeListener(MapFrame.MapModeChangeListener listener)
listener
- the listener. Ignored if null or already registered.public static void removeMapModeChangeListener(MapFrame.MapModeChangeListener listener)
listener
- the listener. Ignored if null or already registered.protected static void fireMapModeChanged(MapMode oldMapMode, MapMode newMapMode)
public void activeLayerChange(Layer oldLayer, Layer newLayer)
MapView.LayerChangeListener
activeLayerChange
in interface MapView.LayerChangeListener
oldLayer
- The previous active layernewLayer
- The new activer layerprivate MapMode getLastMapMode(Layer newLayer)
public void layerAdded(Layer newLayer)
MapView.LayerChangeListener
layerAdded
in interface MapView.LayerChangeListener
newLayer
- The new added layerpublic void layerRemoved(Layer oldLayer)
MapView.LayerChangeListener
layerRemoved
in interface MapView.LayerChangeListener
oldLayer
- The old removed layer