public class MapFrame extends JPanel implements Destroyable, MainLayerManager.ActiveLayerChangeListener, LayerManager.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 |
JPanel.AccessibleJPanel
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
MapFrame(ViewportData viewportData)
Constructs a new
MapFrame . |
Modifier and Type | Method and Description |
---|---|
void |
activeOrEditLayerChanged(MainLayerManager.ActiveLayerChangeEvent e)
Called whenever the active or edit layer changed.
|
void |
addMapMode(IconToggleButton b)
Adds a new map mode button
|
static void |
addMapModeChangeListener(MapFrame.MapModeChangeListener listener)
Adds a mapMode change listener
|
IconToggleButton |
addToggleDialog(ToggleDialog dlg)
Adds a new toggle dialog to the left button list.
|
IconToggleButton |
addToggleDialog(ToggleDialog dlg,
boolean isExpert)
Call this to add new toggle dialogs to the left button-list
|
void |
addTopPanel(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(Container panel)
Fill the given panel by adding all necessary components to the different
locations.
|
protected static void |
fireMapModeChanged(MapMode oldMapMode,
MapMode newMapMode) |
Action |
getDefaultButtonAction()
Gets the action of the default (first) map mode
|
private MapMode |
getLastMapMode(Layer newLayer) |
<T extends ToggleDialog> |
getToggleDialog(Class<T> type)
Replies the instance of a toggle dialog of type
type managed by this map frame |
<T> T |
getTopPanel(Class<T> type)
Find panel on top of MapView by class
|
void |
initializeDialogsPane()
Open all ToggleDialogs that have their preferences property set.
|
void |
layerAdded(LayerManager.LayerAddEvent e)
Notifies this listener that a layer has been added.
|
void |
layerOrderChanged(LayerManager.LayerOrderChangeEvent e)
Notifies this listener that the order of layers was changed.
|
void |
layerRemoving(LayerManager.LayerRemoveEvent e)
Notifies this listener that a layer was just 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 |
removeToggleDialog(ToggleDialog dlg)
Call this to remove existing toggle dialog from the left button-list
|
void |
removeTopPanel(Class<?> type)
Remove panel from top of MapView by class
|
boolean |
selectDrawTool(boolean onlyIfModeless)
Enables the draw tool
|
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)
Enables the select tool
|
boolean |
selectZoomTool(boolean onlyIfModeless)
Enables the zoom tool
|
void |
setDialogsPanelVisible(boolean visible)
Shows or hides the side dialog panel
|
void |
setVisible(boolean aFlag)
Fires an property changed event "visible".
|
void |
validateToolBarsVisibility()
Validate the visibility of all tool bars and hide the ones that should be hidden
|
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 static final int DEF_TOGGLE_DLG_WIDTH
private static final IntegerProperty TOGGLE_DIALOGS_WIDTH
public static final BooleanProperty MODELESS
public static final BooleanProperty TOOLBAR_VISIBLE
public static final BooleanProperty SIDE_TOOLBAR_VISIBLE
public final transient AdvancedKeyPressDetector keyDetector
private JComponent sideToolBar
private final ButtonGroup toolBarActionsGroup
private final JToolBar toolBarActions
private final JToolBar toolBarToggle
private final List<ToggleDialog> allDialogs
private final List<IconToggleButton> allDialogButtons
public final List<IconToggleButton> allMapModeButtons
private final MapFrame.ListAllButtonsAction listAllDialogsAction
private final MapFrame.ListAllButtonsAction listAllMapModesAction
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 final DeleteAction mapModeDelete
public final SelectLassoAction mapModeSelectLasso
private final transient Map<Layer,MapMode> lastMapMode
public MapStatus statusLine
private final JSplitPane splitPane
private final DialogsPanel dialogsPanel
private static final CopyOnWriteArrayList<MapFrame.MapModeChangeListener> mapModeChangeListeners
private transient AbstractProperty.ValueChangeListener<Boolean> sidetoolbarPreferencesChangedListener
public MapFrame(ViewportData viewportData)
MapFrame
.viewportData
- the initial viewport of the map. Can be null, then
the viewport is derived from the layer data.public boolean selectSelectTool(boolean onlyIfModeless)
onlyIfModeless
- Only enable if modeless mode is activetrue
if it is selectedpublic boolean selectDrawTool(boolean onlyIfModeless)
onlyIfModeless
- Only enable if modeless mode is activetrue
if it is selectedpublic boolean selectZoomTool(boolean onlyIfModeless)
onlyIfModeless
- Only enable if modeless mode is activetrue
if it is selectedpublic void destroy()
destroy
in interface Destroyable
public Action getDefaultButtonAction()
public void initializeDialogsPane()
public IconToggleButton addToggleDialog(ToggleDialog dlg)
dlg
- The dialogpublic 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 removeToggleDialog(ToggleDialog dlg)
dlg
- The toggle dialog. It must be already in the list.public void addMapMode(IconToggleButton b)
b
- The map mode button with a MapMode
action.public void setVisible(boolean aFlag)
setVisible
in class 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(Container panel)
panel
- The container to fill. Must have a BorderLayout.public void validateToolBarsVisibility()
public <T extends ToggleDialog> T getToggleDialog(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)
visible
- The new visibilitypublic void rememberToggleDialogWidth()
public void removeTopPanel(Class<?> type)
type
- type of panelpublic <T> T getTopPanel(Class<T> type)
T
- typetype
- type of panelpublic void addTopPanel(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 activeOrEditLayerChanged(MainLayerManager.ActiveLayerChangeEvent e)
MainLayerManager.ActiveLayerChangeListener
You can be sure that this layer is still contained in this set.
Listeners are called in the EDT thread and you can manipulate the layer manager in the current thread.
activeOrEditLayerChanged
in interface MainLayerManager.ActiveLayerChangeListener
e
- The change event.private MapMode getLastMapMode(Layer newLayer)
public void layerAdded(LayerManager.LayerAddEvent e)
LayerManager.LayerChangeListener
Listeners are called in the EDT thread. You should not do blocking or long-running tasks in this method.
layerAdded
in interface LayerManager.LayerChangeListener
e
- The new added layer eventpublic void layerRemoving(LayerManager.LayerRemoveEvent e)
LayerManager.LayerChangeListener
Listeners are called in the EDT thread after the layer was removed.
Use LayerManager.LayerRemoveEvent.scheduleRemoval(Collection)
to remove more layers.
You should not do blocking or long-running tasks in this method.
layerRemoving
in interface LayerManager.LayerChangeListener
e
- The layer to be removed (as event)public void layerOrderChanged(LayerManager.LayerOrderChangeEvent e)
LayerManager.LayerChangeListener
Listeners are called in the EDT thread. You should not do blocking or long-running tasks in this method.
layerOrderChanged
in interface LayerManager.LayerChangeListener
e
- The order change event.