|
|||||||||
| 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.JPanel
y.view.NavigationComponent
public class NavigationComponent
This component provides several controls to navigate inside a graph.
The component consists of two main control groups named navigation controls and zoom controls. The navigation
controls consist of 4 button, that provide a scroll functionality and one button to fi the graph content to the view.
The zoom controls consist of a zoom slider and two buttons to zoom in and zoom out.
One can define the alignment of both control groups to each other using method setOrientation(byte).
The fit content button inside the navigation controls can be disabled using method
setShowFitContentButton(boolean). Furthermor the zoom in and zoom out buttons can be hidden
setShowZoomButtons(boolean).
The step size used for the navigation buttons can be determined using method setScrollStepSize(double). By
default this stepsize is 10 pixels for zoom level 1 and the stepsize will scale with the zoom level. This can be
disabled using method setConsiderZoomLevel(boolean).
When using the scroll buttons of the navigation controls, one can determine the repeat timer delay of those buttons
by setting client property "NavigationComponent.ScrollTimerDelay" JComponent.putClientProperty(Object, Object)
(e.g. to new Integer(30) which is default).
Accordingly the initial timer delay can be set "NavigationComponent.ScrollTimerInitialDelay".
(e.g. to new Integer(300), which is default).
When using the fit content button setShowFitContentButton(boolean) one can determine whether the view
transformation shall be animated or not by settng client property "NavigationComponent.AnimateFitContent". By
default the animation is not enabled. JComponent.putClientProperty(Object, Object) to Boolean.TRUE;
![]() |
![]() |
![]() |
![]() |
| Nested Class Summary | |
|---|---|
protected class |
NavigationComponent.FitContentAction
This action is used for the fit content button of the navigation controls. |
protected class |
NavigationComponent.ZoomAction
This action is used for the zoom buttons of the zoom controls. |
| Nested classes/interfaces inherited from class javax.swing.JPanel |
|---|
JPanel.AccessibleJPanel |
| 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.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
static byte |
ORIENTATION_BOTTOM_TO_TOP
Orientation specifier that is used to determine how the navigation controls and the zoom controls are aligned. |
static byte |
ORIENTATION_LEFT_TO_RIGHT
Orientation specifier that is used to determine how the navigation controls and the zoom controls are aligned. |
static byte |
ORIENTATION_RIGHT_TO_LEFT
Orientation specifier that is used to determine how the navigation controls and the zoom controls are aligned. |
static byte |
ORIENTATION_TOP_TO_BOTTOM
Orientation specifier that is used to determine how the navigation controls and the zoom controls are aligned. |
protected static byte |
SCROLL_DIRECTION_DOWN
|
protected static byte |
SCROLL_DIRECTION_LEFT
|
protected static byte |
SCROLL_DIRECTION_RIGHT
|
protected static byte |
SCROLL_DIRECTION_UP
|
protected Graph2DView |
view
|
| 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 java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
NavigationComponent(Graph2DView view)
|
|
| Method Summary | |
|---|---|
protected JButton |
createFitContentButton()
Creates the button in the middle of the navigation controls. |
protected Icon |
createFitContentIcon()
This method can be overwritten to return a custom icon for the created fit content button createFitContentButton() |
protected JButton |
createScrollButton(byte direction)
|
protected Icon |
createScrollIcon(byte direction)
This method can be overwritten to return a custom icon for the created scroll buttons createScrollButton(byte). |
protected JButton |
createZoomButton(boolean zoomIn)
Creates the buttons above and below the zoom slider. |
protected Icon |
createZoomIcon(boolean zoomIn)
This method can be overwritten to return a custom icon for the created zoom icons createZoomIcon(boolean). |
protected JSlider |
createZoomSlider(byte orientation)
Creates the zoom slider that is used to zoom in and out of the graph. |
byte |
getOrientation()
Returns an orientation specifier that is used to determine how the navigation controls and the zoom controls are aligned. |
double |
getScrollStepSize()
Returns the step size used for the navigation buttons. |
boolean |
isConsiderZoomLevel()
Returns whether the navigation scroll buttons shall take the zoom level into account when scrolling. |
boolean |
isShowFitContentButton()
Whether the fit content button is shown. |
boolean |
isShowNavigationControls()
Whether or not the navigation controls are shown. |
boolean |
isShowZoomButtons()
Whether the zoom in and zoom out buttons are shown. |
boolean |
isShowZoomSlider()
Whether the zoom slider is shown or not. |
protected void |
paintComponent(Graphics g)
|
void |
setConsiderZoomLevel(boolean considerZoomLevel)
Determines whether the navigation scroll buttons shall take the zoom level into account when scrolling. |
void |
setOrientation(byte orientation)
Sets the orientation specifier that is used to determine how the navigation controls and the zoom controls are aligned. |
void |
setScrollStepSize(double stepSize)
Determines the stepsize used for the navigation buttons. |
void |
setShowFitContentButton(boolean showFitContentButton)
Whether the fit content button shall be shown. |
void |
setShowNavigationControls(boolean showNavigationControls)
Determines whether or not the navigation controls are shown. |
void |
setShowZoomButtons(boolean showZoomButtons)
Determines whether the zoom in and zoom out buttons shall be shown. |
void |
setShowZoomSlider(boolean showZoomSlider)
Determines whether the zoom slider shall be shown. |
protected void |
updateComponents()
Will fill the main panel with the components specified by the diverse settings. |
| Methods inherited from class javax.swing.JPanel |
|---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final byte ORIENTATION_TOP_TO_BOTTOM
public static final byte ORIENTATION_LEFT_TO_RIGHT
public static final byte ORIENTATION_BOTTOM_TO_TOP
public static final byte ORIENTATION_RIGHT_TO_LEFT
protected static final byte SCROLL_DIRECTION_UP
protected static final byte SCROLL_DIRECTION_DOWN
protected static final byte SCROLL_DIRECTION_RIGHT
protected static final byte SCROLL_DIRECTION_LEFT
protected final Graph2DView view
| Constructor Detail |
|---|
public NavigationComponent(Graph2DView view)
| Method Detail |
|---|
protected void paintComponent(Graphics g)
paintComponent in class JComponentprotected void updateComponents()
protected JButton createScrollButton(byte direction)
direction - the direction to which the created button shall scroll.
One of SCROLL_DIRECTION_UP, SCROLL_DIRECTION_DOWN, SCROLL_DIRECTION_LEFT,
SCROLL_DIRECTION_RIGHT
createScrollIcon(byte)protected Icon createScrollIcon(byte direction)
createScrollButton(byte).
direction - the direction to which the created button shall scroll.
One of SCROLL_DIRECTION_UP, SCROLL_DIRECTION_DOWN, SCROLL_DIRECTION_LEFT,
SCROLL_DIRECTION_RIGHT.
createScrollButton(byte)protected JButton createFitContentButton()
createFitContentIcon(),
setShowFitContentButton(boolean)protected Icon createFitContentIcon()
createFitContentButton()
createFitContentButton()protected JButton createZoomButton(boolean zoomIn)
zoomIn - whether a zoom in button (true) or a zoom out button (false) shall be created.
createZoomIcon(boolean),
setShowZoomButtons(boolean)protected Icon createZoomIcon(boolean zoomIn)
createZoomIcon(boolean).
zoomIn - whether an icon for a zoom in button (true) or a zoom out button (false) shall be created.
createZoomButton(boolean)protected JSlider createZoomSlider(byte orientation)
orientation - the orientation of the main component, that also is used to determine the slider orientation.
ORIENTATION_LEFT_TO_RIGHT and ORIENTATION_RIGHT_TO_LEFT will usually lead to a horizontal slider,
while ORIENTATION_TOP_TO_BOTTOM and ORIENTATION_BOTTOM_TO_TOP will lead to a vertical slider.
public boolean isShowNavigationControls()
createScrollButton(byte) and a button to fit the content created using createFitContentButton().
By default all navigation controls are shown.
One can specify to not show the fit content button using method showFitContentButton.
public void setShowNavigationControls(boolean showNavigationControls)
createScrollButton(byte) and a button to fit the content created using createFitContentButton().
By default all navigation controls are shown.
One can specify to not show the fit content button using method setShowFitContentButton(boolean).
showNavigationControls - public boolean isShowFitContentButton()
setShowNavigationControls(boolean)public void setShowFitContentButton(boolean showFitContentButton)
showFitContentButton - setShowNavigationControls(boolean)public boolean isShowZoomButtons()
public void setShowZoomButtons(boolean showZoomButtons)
showZoomButtons - public boolean isShowZoomSlider()
public void setShowZoomSlider(boolean showZoomSlider)
showZoomSlider - public double getScrollStepSize()
setConsiderZoomLevel(boolean)public void setScrollStepSize(double stepSize)
stepSize - the stepsize that is used for the navigation buttons. If the zoom level is beeing considered, the
stepsize is taken as the stepsize for zoom level 1.setConsiderZoomLevel(boolean)public byte getOrientation()
ORIENTATION_TOP_TO_BOTTOM (default), ORIENTATION_RIGHT_TO_LEFT,
ORIENTATION_BOTTOM_TO_TOP, ORIENTATION_LEFT_TO_RIGHT.public void setOrientation(byte orientation)
orientation - One of ORIENTATION_TOP_TO_BOTTOM (default), ORIENTATION_RIGHT_TO_LEFT,
ORIENTATION_BOTTOM_TO_TOP, ORIENTATION_LEFT_TO_RIGHT.public boolean isConsiderZoomLevel()
setScrollStepSize(double) will then be increased for zoom levels
smaller than "1" and decreased for zoom levels greater than "1".
public void setConsiderZoomLevel(boolean considerZoomLevel)
setScrollStepSize(double) will then be increased for zoom levels
smaller than "1" and decreased for zoom levels greater than "1".
considerZoomLevel -
| |||