|
|||||||||
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
skrueger.geotools.MapPaneToolBar
public class MapPaneToolBar
A toolbar to control an JMapPane
(Atlas visualization). This contains
two types of buttons. A group of tools for the mouse actions on the
map represented by JToggleButtons
, where only one tool
can be activated every time. And some (general) actions, represented
by normal JButtons
.
Nested Class Summary | |
---|---|
static class |
MapPaneToolBar.MapPaneToolBarAction
Extends the AbstractAction with maintaining an ID and the
MapPaneToolBar the actions controls. |
Nested classes/interfaces inherited from class javax.swing.JToolBar |
---|
JToolBar.AccessibleJToolBar, JToolBar.Separator |
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 | |
---|---|
static int |
ACTION_CHARTS
|
static int |
ACTION_ZOOM_BACK
Constant for the action "Zoom back" (130). |
static int |
ACTION_ZOOM_FORWARD
Constant for the action "Zoom forward" (140). |
protected ArrayList<Envelope> |
lastZooms
A List to remember the last Envelopes that have been watched. |
protected JMapPane |
mapPane
Holds the JMapPane this tool bar controls. |
protected JMapPaneListener |
mapPaneListener
Listener to sniff the zoom actions on the map. |
static ResourceProvider |
RESOURCE
|
protected int |
selectedTool
Tool currently selected |
static int |
SEPERATOR0
|
static int |
SEPERATOR1
|
static int |
TOOL_INFO
Constant for the tool "Info" (20). |
static int |
TOOL_PAN
Constant for the tool "Panning" (10). |
static int |
TOOL_SELECTION_ADD
Constant for the tool "Selection add" which adds the features to the Selection (220). |
static int |
TOOL_SELECTION_CLEAR
Constant for the tool "Selection Reset" which clears the selection (240). |
static int |
TOOL_SELECTION_REMOVE
Constant for the tool "Selection subtract" which removes the selected features from the selection (230). |
static int |
TOOL_SELECTION_SET
Constant for the tool "Select" which sets the Selection to the selected features (210). |
static int |
TOOL_ZOOMIN
Constant for the tool "Zoom In" (110). |
static int |
TOOL_ZOOMOUT
Constant for the tool "Zoom Out" (120). |
protected SortedMap<Integer,JComponent> |
toolAndActionButtons
Holds the tool buttons of the tool bar. |
protected ButtonGroup |
toolButtonGroup
Controls that only one tool button is activated. |
protected boolean |
zoomBackForwardButtonInAction
|
protected int |
zoomBackIndex
Holds the index to the current element in lastZooms . |
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 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 | |
---|---|
MapPaneToolBar()
Creates a new toolbar. |
|
MapPaneToolBar(JMapPane mapPane)
Creates a new tool bar. |
Method Summary | |
---|---|
void |
addAction(MapPaneToolBar.MapPaneToolBarAction buttonAction)
Adds an action to the tool bar and resets the toolbar GUI. |
void |
addAction(MapPaneToolBar.MapPaneToolBarAction buttonAction,
boolean resetToolBar)
Adds an action to the tool bar. |
void |
addJComponent(JComponent component,
int id,
boolean resetToolBar)
Adds any JComponent to the tool bar. |
void |
addSeparator(int id,
JToolBar.Separator separator)
|
void |
addTool(MapPaneToolBar.MapPaneToolBarAction buttonAction)
Adds a tool to the tool bar and resets the toolbar GUI. |
void |
addTool(MapPaneToolBar.MapPaneToolBarAction buttonAction,
boolean resetToolBar)
Adds a tool to the tool bar. |
JButton |
getActionButton(int action)
Returns the button for a specific action. |
AbstractButton |
getButton(int id)
Returns the button for a specific tool or action. |
int |
getMaxToolID()
Returns the maximum ID of tools. |
int |
getMinToolID()
Returns the minimum ID of tools. |
int |
getSelectedTool()
Returns the selected tool. |
JToggleButton |
getToolButton(int tool)
Returns the button for a specific tool. |
protected void |
init()
Calls initToolsAndActions() and #initActions() and then
puts all tool buttons and all actions buttons to the tool bar. |
void |
initToolBar()
Clears the GUI of all components and adds all tool and action buttons to the tool bar. |
protected void |
initToolsAndActions()
Creates the tool buttons and action buttons and seperators, adds them to toolAndActionButtons and finally creates a button group for all
tools. |
boolean |
isButtonEnabled(int id)
Checks whether a tool is activated. |
boolean |
isButtonIDUsed(int id)
Checks whether a ID is already used for a tool or action. |
protected void |
performActionButton(int action,
ActionEvent e)
Performs the action of an action button. |
void |
performToolButton(int tool,
ActionEvent e)
Performs the activation of a tool. |
void |
print(Graphics g)
Nuetzlich wenn die Componente gedruckt (z.B. wenn ein Screenshot gemacht wird) wird. |
static String |
R(String key,
Object... values)
|
JComponent |
removeId(int id)
|
void |
setAllActionsEnabled(boolean enabled,
boolean hideOnDisable)
Sets the activation for all actions. |
void |
setAllToolsEnabled(boolean enabled,
boolean hideOnDisable)
Sets the activation for all tools. |
void |
setButtonEnabled(int id,
boolean enabled)
Sets whether a tool or action is activated or not. |
void |
setButtonEnabled(int id,
boolean enabled,
boolean hideOnDisable)
Sets whether a tool or action is activated or not. |
void |
setMapPane(JMapPane mapPane)
Sets the JMapPane controlled by this tool bar. |
void |
setSelectedTool(Integer tool)
Sets the selected tool. |
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 java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static ResourceProvider RESOURCE
public static final int TOOL_PAN
public static final int TOOL_INFO
public static final int SEPERATOR0
public static final int TOOL_ZOOMIN
public static final int TOOL_ZOOMOUT
public static final int ACTION_ZOOM_BACK
public static final int ACTION_ZOOM_FORWARD
public static final int SEPERATOR1
public static final int TOOL_SELECTION_CLEAR
public static final int TOOL_SELECTION_SET
public static final int TOOL_SELECTION_ADD
public static final int TOOL_SELECTION_REMOVE
public static final int ACTION_CHARTS
protected int selectedTool
protected SortedMap<Integer,JComponent> toolAndActionButtons
protected ButtonGroup toolButtonGroup
protected JMapPane mapPane
JMapPane
this tool bar controls.
protected ArrayList<Envelope> lastZooms
protected int zoomBackIndex
lastZooms
.
protected JMapPaneListener mapPaneListener
protected boolean zoomBackForwardButtonInAction
Constructor Detail |
---|
public MapPaneToolBar()
setMapPane(JMapPane)
is called!
public MapPaneToolBar(JMapPane mapPane)
mapPane
- JMapPane
the tool bar controlsMethod Detail |
---|
public static String R(String key, Object... values)
public void setMapPane(JMapPane mapPane)
JMapPane
controlled by this tool bar.
mapPane
- JMapPane
to control (if null
this tool bar
controls NOTHING!)protected void init()
initToolsAndActions()
and #initActions()
and then
puts all tool buttons and all actions buttons to the tool bar.
protected void initToolsAndActions()
toolAndActionButtons
and finally creates a button group for all
tools. So sub-classes which override this method should FIRST add their
new tool buttons to toolAndActionButtons
before calling super.initTools()
.
public void initToolBar()
public void performToolButton(int tool, ActionEvent e)
tool
- the tool to activatee
- the event of the buttonpublic JComponent removeId(int id)
id
- The ID of the Component to remove. The change will not be
visible until initToolBar()
is called.
null
or the component that has been removed.protected void performActionButton(int action, ActionEvent e)
tool
- the actione
- the event of the buttonpublic void addTool(MapPaneToolBar.MapPaneToolBarAction buttonAction, boolean resetToolBar)
buttonAction
- action for the toggle buttonresetToolBar
- indicates whether the toolbar GUI is reset after adding the
button (if adding several actions it useful only to reset the
GUI for the last added tool)public void addTool(MapPaneToolBar.MapPaneToolBarAction buttonAction)
buttonAction
- action for the toggle buttonpublic void addAction(MapPaneToolBar.MapPaneToolBarAction buttonAction, boolean resetToolBar)
buttonAction
- action for the buttonresetToolBar
- indicates whether the toolbar GUI is reset after adding the
button (if adding several actions it useful only to reset the
GUI for the last added tool)public void addJComponent(JComponent component, int id, boolean resetToolBar)
component
- A JComponent
that shall be addedid
- The ID associaded with the JComponent
resetToolBar
- indicates whether the toolbar GUI is reset after adding the
button (if adding several actions it useful only to reset the
GUI for the last added tool)public void addSeparator(int id, JToolBar.Separator separator)
public void addAction(MapPaneToolBar.MapPaneToolBarAction buttonAction)
buttonAction
- action for the toggle buttonpublic AbstractButton getButton(int id)
id
- the constant for any button in the MapPaneToolBar
JButton
if id
specifies an
action button or
JToogleButton
if id
specifies a
tool buttonpublic JToggleButton getToolButton(int tool)
tool
- the constant for a toolpublic JButton getActionButton(int action)
action
- the constant an actionpublic void setSelectedTool(Integer tool)
tool
- ID of the toolpublic int getSelectedTool()
public void setButtonEnabled(int id, boolean enabled)
id
- tool or actionIDenabled
- if true
the tool becomes availablepublic void setButtonEnabled(int id, boolean enabled, boolean hideOnDisable)
id
- tool or actionIDenabled
- if true
the tool becomes availablehideOnDisable
- if true
the button is also hidden if enabled
is false
public boolean isButtonIDUsed(int id)
tool
- tool IDpublic boolean isButtonEnabled(int id)
tool
- tool ID
false
if an unknown ID is specifiedpublic void setAllToolsEnabled(boolean enabled, boolean hideOnDisable)
enabled
- if true
all tools becomes availablehideOnDisable
- if true
the buttons are also hidden if enabled
is false
public void setAllActionsEnabled(boolean enabled, boolean hideOnDisable)
enabled
- if true
all actions becomes availablehideOnDisable
- if true
the buttons are also hidden if enabled
is false
public int getMaxToolID()
public int getMinToolID()
public void print(Graphics g)
print
in class JComponent
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |