public abstract class AbstractNavigator extends Object implements Navigator
fireCenterChanged(NavigationEvent)
and
fireZoomChanged(NavigationEvent)
to notify listeners of changes to
the center or zoom level. To avoid loop states these methods must only be
called if a value has really been changed.Modifier and Type | Field and Description |
---|---|
static double |
DEFAULT_ZOOM_FACTOR
Default zoom factor.
|
static double |
DEFAULT_ZOOM_MAX
Default maximum of zoom factor.
|
static double |
DEFAULT_ZOOM_MIN
Default minimum of zoom factor.
|
Constructor and Description |
---|
AbstractNavigator()
Initializes a new instance that is responsible for zooming and panning
the axes with the specified names of the specified plot.
|
Modifier and Type | Method and Description |
---|---|
void |
addNavigationListener(NavigationListener l)
Adds the specified listener object that gets notified on changes to
navigation information like panning or zooming.
|
void |
centerChanged(NavigationEvent<PointND<? extends Number>> event)
A method that gets called after the center of an object in a connected
PlotNavigator has changed. |
void |
connect(Navigator navigator)
Couples the actions of the current and the specified navigator.
|
void |
disconnect(Navigator navigator)
Decouples the actions of the current and the connected specified
navigator.
|
protected void |
fireCenterChanged(NavigationEvent<PointND<? extends Number>> event)
Notifies all navigation listeners that the center of one or more
components have been changed.
|
protected void |
fireZoomChanged(NavigationEvent<Double> event)
Notifies all navigation listeners that the zoom level of all components
has been changed.
|
NavigationDirection |
getDirection()
Returns the current direction of the components that will be taken into
account for zooming and panning.
|
double |
getZoomFactor()
Returns the factor which is used to change the zoom level on
zoom in/out actions.
|
double |
getZoomMax()
Returns the minimal zoom factor.
|
double |
getZoomMin()
Returns the minimal zoom factor.
|
boolean |
isPannable()
Returns whether the associated object can be panned.
|
boolean |
isZoomable()
Returns whether the associated object can be zoomed.
|
void |
removeNavigationListener(NavigationListener l)
Removes the specified listener object, i.e. it doesn't get notified on
changes to navigation information like panning or zooming.
|
void |
setDirection(NavigationDirection direction)
Sets the direction of the components that will be taken into account for
zooming and panning.
|
void |
setPannable(boolean pannable)
Sets whether the associated object can be panned.
|
void |
setZoomable(boolean zoomable)
Sets whether the associated object can be zoomed.
|
void |
setZoomFactor(double factor)
Sets the factor which should be used to change the zoom level on
zoom in/out actions.
|
void |
setZoomMax(double max)
Sets the maximal zoom factor.
|
void |
setZoomMin(double min)
Sets the minimal zoom factor.
|
void |
zoomChanged(NavigationEvent<Double> event)
A method that gets called after the zoom level of an object in a
connected
PlotNavigator has changed. |
void |
zoomIn()
Increases the current zoom level by the specified zoom factor.
|
void |
zoomOut()
Decreases the current zoom level by the specified zoom factor.
|
public static final double DEFAULT_ZOOM_FACTOR
public static final double DEFAULT_ZOOM_MIN
public static final double DEFAULT_ZOOM_MAX
public AbstractNavigator()
public boolean isZoomable()
isZoomable
in interface Navigator
true
if the object can be zoomed,
false
otherwise.public void setZoomable(boolean zoomable)
setZoomable
in interface Navigator
zoomable
- A value that tells whether it should be possible to zoom
the associated object.public void zoomIn()
zoomIn
in interface Navigator
Navigator.isZoomable()
,
Navigator.setZoomable(boolean)
public void zoomOut()
zoomOut
in interface Navigator
Navigator.isZoomable()
,
Navigator.setZoomable(boolean)
public boolean isPannable()
isPannable
in interface Navigator
true
if the object can be panned,
false
otherwise.public void setPannable(boolean pannable)
setPannable
in interface Navigator
pannable
- A value that tells whether it should be possible to pan
the associated object.public double getZoomFactor()
getZoomFactor
in interface Navigator
public void setZoomFactor(double factor)
setZoomFactor
in interface Navigator
factor
- The new zoom factor.public double getZoomMin()
getZoomMin
in interface Navigator
public void setZoomMin(double min)
setZoomMin
in interface Navigator
min
- New minimal zoom factor.public double getZoomMax()
getZoomMax
in interface Navigator
public void setZoomMax(double max)
setZoomMax
in interface Navigator
max
- New maximal zoom factor.public void addNavigationListener(NavigationListener l)
addNavigationListener
in interface Navigator
l
- Listener objectpublic void removeNavigationListener(NavigationListener l)
removeNavigationListener
in interface Navigator
l
- Listener objectpublic NavigationDirection getDirection()
getDirection
in interface Navigator
public void setDirection(NavigationDirection direction)
setDirection
in interface Navigator
direction
- Direction.public void connect(Navigator navigator)
public void disconnect(Navigator navigator)
disconnect
in interface Navigator
navigator
- Navigator to be bound to this instance.public void centerChanged(NavigationEvent<PointND<? extends Number>> event)
PlotNavigator
has changed.centerChanged
in interface NavigationListener
event
- An object describing the change event.public void zoomChanged(NavigationEvent<Double> event)
PlotNavigator
has changed.zoomChanged
in interface NavigationListener
event
- An object describing the change event.protected void fireCenterChanged(NavigationEvent<PointND<? extends Number>> event)
event
- An object describing the change event.protected void fireZoomChanged(NavigationEvent<Double> event)
event
- An object describing the change event.Copyright © 2009-2013. All Rights Reserved.