org.jplot2d.env
Class PlotEnvironment
- java.lang.Object
-
- org.jplot2d.env.Environment
-
- org.jplot2d.env.PlotEnvironment
-
- Direct Known Subclasses:
- RenderEnvironment
public class PlotEnvironment extends Environment
This Environment can host a plot instance and provide undo/redo ability.
-
-
Constructor Summary
Constructors Constructor and Description PlotEnvironment(boolean threadSafe)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleancanRedo()Returnstrueif undo is possible.booleancanUndo()Returnstrueif undo is possible.NotifiergetNotifier()Returns the notifier of this environment.PlotgetPlot()PlotgetPlotAt(java.awt.geom.Point2D dp)Return the most inner plot that contains the given location.PComponentgetSelectableCompnentAt(java.awt.geom.Point2D dp)Return the top selectable component at the given location.intgetUndoLevels()Returns the maximum number of reversible operations.voidredo()Undo the last change.voidsetNotifier(Notifier notifier)Sets the notifier of this environment.voidsetPlot(Plot plot)Sets a plot to this environment.voidsetPlot(Plot plot, Notifier notifier)Sets a plot to this environment.voidsetUndoLevels(int levels)Sets the maximum number of reversible operations.voidundo()Undo the last change.-
Methods inherited from class org.jplot2d.env.Environment
addElementChangeListener, beginBatch, endBatch, endBatch, getCommandLogger, getElementChangeListeners, getProxy, removeElementChangeListener, setCommandLogger
-
-
-
-
Method Detail
-
setPlot
public void setPlot(Plot plot)
Sets a plot to this environment. The plot must hosted by a dummy environment. All notices are logged to java logging facilities.- Parameters:
plot-
-
setPlot
public void setPlot(Plot plot, Notifier notifier)
Sets a plot to this environment. The plot must hosted by a dummy environment.- Parameters:
plot-notifier- the notifier to receive and process notices
-
getPlot
public Plot getPlot()
-
getNotifier
public Notifier getNotifier()
Returns the notifier of this environment. The notifier will receive notices during command execution and process all notices at once when command finished.- Returns:
- the notifier of this environment
-
setNotifier
public void setNotifier(Notifier notifier)
Sets the notifier of this environment. The notifier will receive notices during command execution and process all notices at once when command finished.- Parameters:
notifier- the notifier to be used in this environment
-
getUndoLevels
public int getUndoLevels()
Returns the maximum number of reversible operations.- Returns:
- the maximum number of reversible operations
-
setUndoLevels
public void setUndoLevels(int levels)
Sets the maximum number of reversible operations.- Parameters:
levels- the maximum number of reversible operations
-
canUndo
public boolean canUndo()
Returnstrueif undo is possible.- Returns:
-
canRedo
public boolean canRedo()
Returnstrueif undo is possible.- Returns:
-
undo
public void undo()
Undo the last change. If there is nothing to undo, an exception is thrown.
-
redo
public void redo()
Undo the last change. If there is nothing to undo, an exception is thrown.
-
getSelectableCompnentAt
public PComponent getSelectableCompnentAt(java.awt.geom.Point2D dp)
Return the top selectable component at the given location.- Parameters:
dp- the device point relative to top-left corner.- Returns:
-
getPlotAt
public Plot getPlotAt(java.awt.geom.Point2D dp)
Return the most inner plot that contains the given location.- Parameters:
dp- the device point relative to top-left corner.- Returns:
-
-
DMelt 3.0 © DataMelt by jWork.ORG