- java.lang.Object
-
- org.jfree.chart.swing.DefaultSelectionZoomStrategy
-
- All Implemented Interfaces:
Serializable,SelectionZoomStrategy
public class DefaultSelectionZoomStrategy extends Object implements SelectionZoomStrategy
This implementation can be extended to override default behavior.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_ZOOM_TRIGGER_DISTANCEThe minimum size required to perform a zoom on a rectangleprotected Point2DzoomPointThe zoom rectangle starting point (selected by the user with a mouse click).protected Rectangle2DzoomRectangleThe zoom rectangle (selected by the user with the mouse).
-
Constructor Summary
Constructors Constructor Description DefaultSelectionZoomStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddrawZoomRectangle(Graphics2D g2, boolean xor)Draws zoom rectangle (if present).booleangetFillZoomRectangle()Returns the flag that controls whether or not the zoom rectangle is filled when drawn.PaintgetZoomFillPaint()Returns the zoom rectangle fill paint.PaintgetZoomOutlinePaint()Returns the zoom rectangle outline paint.Point2DgetZoomPoint()The zoom rectangle starting point (selected by the user with a mouse click).Rectangle2DgetZoomRectangle(boolean hZoom, boolean vZoom, Rectangle2D screenDataArea)Creates and returns current zoom rectangleintgetZoomTriggerDistance()Returns the zoom trigger distance.booleanisActivated()If controller currently tracking zoom rectanglevoidreset()Removes zoom rectanglevoidsetFillZoomRectangle(boolean flag)A flag that controls how the zoom rectangle is drawn.voidsetZoomFillPaint(Paint paint)Sets the zoom rectangle fill paint.voidsetZoomOutlinePaint(Paint paint)Sets the zoom rectangle outline paint.voidsetZoomPoint(Point2D zoomPoint)voidsetZoomTriggerDistance(int distance)Sets the zoom trigger distance.voidupdateZoomRectangleSelection(MouseEvent e, boolean hZoom, boolean vZoom, Rectangle2D scaledDataArea)Updates zoom rectangle with new mouse position
-
-
-
Field Detail
-
DEFAULT_ZOOM_TRIGGER_DISTANCE
public static final int DEFAULT_ZOOM_TRIGGER_DISTANCE
The minimum size required to perform a zoom on a rectangle- See Also:
- Constant Field Values
-
zoomPoint
protected Point2D zoomPoint
The zoom rectangle starting point (selected by the user with a mouse click). This is a point on the screen, not the chart (which may have been scaled up or down to fit the panel).
-
zoomRectangle
protected transient Rectangle2D zoomRectangle
The zoom rectangle (selected by the user with the mouse).
-
-
Constructor Detail
-
DefaultSelectionZoomStrategy
public DefaultSelectionZoomStrategy()
-
-
Method Detail
-
isActivated
public boolean isActivated()
Description copied from interface:SelectionZoomStrategyIf controller currently tracking zoom rectangle- Specified by:
isActivatedin interfaceSelectionZoomStrategy- Returns:
trueif zoomRectangle exists for this controller andfalseotherwise
-
getZoomPoint
public Point2D getZoomPoint()
Description copied from interface:SelectionZoomStrategyThe zoom rectangle starting point (selected by the user with a mouse click). This is a point on the screen, not the chart (which may have been scaled up or down to fit the panel).- Specified by:
getZoomPointin interfaceSelectionZoomStrategy
-
setZoomPoint
public void setZoomPoint(Point2D zoomPoint)
- Specified by:
setZoomPointin interfaceSelectionZoomStrategy
-
setZoomTriggerDistance
public void setZoomTriggerDistance(int distance)
Description copied from interface:SelectionZoomStrategySets the zoom trigger distance. This controls how far the mouse must move before a zoom action is triggered.- Specified by:
setZoomTriggerDistancein interfaceSelectionZoomStrategy- Parameters:
distance- the distance (in Java2D units).
-
getZoomTriggerDistance
public int getZoomTriggerDistance()
Description copied from interface:SelectionZoomStrategyReturns the zoom trigger distance. This controls how far the mouse must move before a zoom action is triggered.- Specified by:
getZoomTriggerDistancein interfaceSelectionZoomStrategy- Returns:
- The distance (in Java2D units).
-
getZoomOutlinePaint
public Paint getZoomOutlinePaint()
Description copied from interface:SelectionZoomStrategyReturns the zoom rectangle outline paint.- Specified by:
getZoomOutlinePaintin interfaceSelectionZoomStrategy- Returns:
- The zoom rectangle outline paint (never
null). - See Also:
SelectionZoomStrategy.setZoomOutlinePaint(java.awt.Paint),SelectionZoomStrategy.setFillZoomRectangle(boolean)
-
setZoomOutlinePaint
public void setZoomOutlinePaint(Paint paint)
Description copied from interface:SelectionZoomStrategySets the zoom rectangle outline paint.- Specified by:
setZoomOutlinePaintin interfaceSelectionZoomStrategy- Parameters:
paint- the paint (nullnot permitted).- See Also:
SelectionZoomStrategy.getZoomOutlinePaint(),SelectionZoomStrategy.getFillZoomRectangle()
-
getZoomFillPaint
public Paint getZoomFillPaint()
Description copied from interface:SelectionZoomStrategyReturns the zoom rectangle fill paint.- Specified by:
getZoomFillPaintin interfaceSelectionZoomStrategy- Returns:
- The zoom rectangle fill paint (never
null). - See Also:
SelectionZoomStrategy.setZoomFillPaint(Paint),SelectionZoomStrategy.setFillZoomRectangle(boolean)
-
setZoomFillPaint
public void setZoomFillPaint(Paint paint)
Description copied from interface:SelectionZoomStrategySets the zoom rectangle fill paint.- Specified by:
setZoomFillPaintin interfaceSelectionZoomStrategy- Parameters:
paint- the paint (nullnot permitted).- See Also:
SelectionZoomStrategy.getZoomFillPaint(),SelectionZoomStrategy.getFillZoomRectangle()
-
getFillZoomRectangle
public boolean getFillZoomRectangle()
Description copied from interface:SelectionZoomStrategyReturns the flag that controls whether or not the zoom rectangle is filled when drawn.- Specified by:
getFillZoomRectanglein interfaceSelectionZoomStrategy- Returns:
- A boolean.
-
setFillZoomRectangle
public void setFillZoomRectangle(boolean flag)
Description copied from interface:SelectionZoomStrategyA flag that controls how the zoom rectangle is drawn.- Specified by:
setFillZoomRectanglein interfaceSelectionZoomStrategy- Parameters:
flag-trueinstructs to fill the rectangle on zoom, otherwise it will be outlined.
-
updateZoomRectangleSelection
public void updateZoomRectangleSelection(MouseEvent e, boolean hZoom, boolean vZoom, Rectangle2D scaledDataArea)
Description copied from interface:SelectionZoomStrategyUpdates zoom rectangle with new mouse position- Specified by:
updateZoomRectangleSelectionin interfaceSelectionZoomStrategy- Parameters:
e- mouse eventhZoom- if horizontal zoom allowedvZoom- if vertical zoom allowedscaledDataArea- plot area in screen coordinates
-
getZoomRectangle
public Rectangle2D getZoomRectangle(boolean hZoom, boolean vZoom, Rectangle2D screenDataArea)
Description copied from interface:SelectionZoomStrategyCreates and returns current zoom rectangle- Specified by:
getZoomRectanglein interfaceSelectionZoomStrategy- Parameters:
hZoom- if horizontal zoom acceptablevZoom- if vertical zoom acceptablescreenDataArea- rectangle that describes plot on the screen- Returns:
- rectangle in java2d screen coordinates selected by user
-
reset
public void reset()
Description copied from interface:SelectionZoomStrategyRemoves zoom rectangle- Specified by:
resetin interfaceSelectionZoomStrategy
-
drawZoomRectangle
public void drawZoomRectangle(Graphics2D g2, boolean xor)
Description copied from interface:SelectionZoomStrategyDraws zoom rectangle (if present). The drawing is performed in XOR mode, therefore when this method is called twice in a row, the second call will completely restore the state of the canvas.- Specified by:
drawZoomRectanglein interfaceSelectionZoomStrategy- Parameters:
g2- the graphics device.xor- use XOR for drawing?
-
-