public class FXChangeViewportOperation extends AbstractOperation implements ITransactionalOperation
FXChangeViewportOperation
can be used to alter the scroll offset
and the content transformation of an InfiniteCanvas
. It is used by
scroll/pan and zoom policies.Constructor and Description |
---|
FXChangeViewportOperation(InfiniteCanvas canvas)
Creates a new
FXChangeViewportOperation to manipulate the given
InfiniteCanvas . |
FXChangeViewportOperation(InfiniteCanvas canvas,
AffineTransform newContentTransform)
Creates a new
FXChangeViewportOperation to manipulate the given
InfiniteCanvas . |
FXChangeViewportOperation(InfiniteCanvas canvas,
double newHorizontalScrollOffset,
double newVerticalScrollOffset)
Creates a new
FXChangeViewportOperation to manipulate the given
InfiniteCanvas . |
FXChangeViewportOperation(InfiniteCanvas canvas,
double newHorizontalScrollOffset,
double newVerticalScrollOffset,
AffineTransform newContentTransform)
Creates a new
FXChangeViewportOperation to manipulate the given
InfiniteCanvas . |
FXChangeViewportOperation(InfiniteCanvas canvas,
double newHorizontalScrollOffset,
double newVerticalScrollOffset,
double newWidth,
double newHeight,
AffineTransform newContentTransform)
Creates a new
FXChangeViewportOperation to manipulate the given
InfiniteCanvas . |
Modifier and Type | Method and Description |
---|---|
void |
concatenateToNewContentTransform(AffineTransform t)
Concatenates the given
AffineTransform to the
contents transformation that will be applied when executing this
operation. |
IStatus |
execute(IProgressMonitor monitor,
IAdaptable info) |
InfiniteCanvas |
getInfiniteCanvas()
Returns the
InfiniteCanvas that is manipulated by this operation. |
AffineTransform |
getInitialContentTransform()
Returns the contents transformation that will be applied when undoing
this operation.
|
double |
getInitialHeight()
Returns the viewport height that will be applied when undoing this
operation.
|
double |
getInitialHorizontalScrollOffset()
Returns the horizontal translation that will be applied when undoing this
operation.
|
double |
getInitialVerticalScrollOffset()
Returns the vertical translation that will be applied when undoing this
operation.
|
double |
getInitialWidth()
Returns the viewport width that will be applied when undoing this
operation.
|
double |
getNewHeight()
Returns the viewport height that will be applied when executing this
operation.
|
double |
getNewHorizontalScrollOffset()
Returns the horizontal translation that will be applied when executing
this operation.
|
AffineTransform |
getNewTransform()
Returns the contents transformation that will be applied when executing
this operation.
|
double |
getNewVerticalScrollOffset()
Returns the vertical translation that will be applied when executing this
operation.
|
double |
getNewWidth()
Returns the viewport width that will be applied when executing this
operation.
|
boolean |
isContentRelevant()
Returns
true if this ITransactionalOperation is
actually changing model data (instead of only affecting the
visualization). |
boolean |
isNoOp()
Returns
true if this ITransactionalOperation has no
effect (in comparison to its initial state). |
protected void |
readViewport(InfiniteCanvas canvas)
Stores all relevant viewport values in fields, so that they can be
restored later.
|
IStatus |
redo(IProgressMonitor monitor,
IAdaptable info) |
void |
setNewContentTransform(AffineTransform newContentTransform)
Sets the contents transformation that will be applied when executing this
operation to the given value.
|
void |
setNewHeight(double newHeight)
Sets the viewport height that will be applied when executing this
operation to the given value.
|
void |
setNewHorizontalScrollOffset(double horizontalScrollOffset)
Sets the horizontal translation that will be applied when executing this
operation to the given value.
|
void |
setNewVerticalScrollOffset(double verticalScrollOffset)
Sets the vertical translation that will be applied when executing this
operation to the given value.
|
void |
setNewWidth(double newWidth)
Sets the viewport width that will be applied when executing this
operation to the given value.
|
IStatus |
undo(IProgressMonitor monitor,
IAdaptable info) |
addContext, canExecute, canRedo, canUndo, dispose, getContexts, getLabel, hasContext, removeContext, setLabel, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addContext, canExecute, canRedo, canUndo, dispose, getContexts, getLabel, hasContext, removeContext
public FXChangeViewportOperation(InfiniteCanvas canvas)
FXChangeViewportOperation
to manipulate the given
InfiniteCanvas
. The current viewport values are read and used
when undoing this operation.canvas
- The InfiniteCanvas
which is manipulated by this
operation.public FXChangeViewportOperation(InfiniteCanvas canvas, AffineTransform newContentTransform)
FXChangeViewportOperation
to manipulate the given
InfiniteCanvas
. The current viewport values are read and used
when undoing this operation. The given
AffineTransform
will be applied when executing this
operation.canvas
- The InfiniteCanvas
that is manipulated.newContentTransform
- The contents transformation which is applied when executing
this operation.public FXChangeViewportOperation(InfiniteCanvas canvas, double newHorizontalScrollOffset, double newVerticalScrollOffset)
FXChangeViewportOperation
to manipulate the given
InfiniteCanvas
. The current viewport values are read and used
when undoing this operation. The given translation values will be applied
when executing this operation.canvas
- The InfiniteCanvas
that is manipulated.newHorizontalScrollOffset
- The horizontal translation that is applied when executing this
operation.newVerticalScrollOffset
- The vertical translation that is applied when executing this
operation.public FXChangeViewportOperation(InfiniteCanvas canvas, double newHorizontalScrollOffset, double newVerticalScrollOffset, AffineTransform newContentTransform)
FXChangeViewportOperation
to manipulate the given
InfiniteCanvas
. The current viewport values are read and used
when undoing this operation. The given translation values and contents
transformation will be applied when executing this operation.canvas
- The InfiniteCanvas
that is manipulated.newHorizontalScrollOffset
- The horizontal translation that is applied when executing this
operation.newVerticalScrollOffset
- The vertical translation that is applied when executing this
operation.newContentTransform
- The contents transformation which is applied when executing
this operation.public FXChangeViewportOperation(InfiniteCanvas canvas, double newHorizontalScrollOffset, double newVerticalScrollOffset, double newWidth, double newHeight, AffineTransform newContentTransform)
FXChangeViewportOperation
to manipulate the given
InfiniteCanvas
. The current viewport values are read and used
when undoing this operation. The given translation values, dimensions,
and contents transformation will be applied when executing this
operation.canvas
- The InfiniteCanvas
that is manipulated.newHorizontalScrollOffset
- The horizontal translation that is applied when executing this
operation.newVerticalScrollOffset
- The vertical translation that is applied when executing this
operation.newWidth
- The viewport width that is applied when executing this
operation.newHeight
- The viewport height that is applied when executing this
operation.newContentTransform
- The contents transformation which is applied when executing
this operation.public void concatenateToNewContentTransform(AffineTransform t)
AffineTransform
to the
contents transformation that will be applied when executing this
operation.t
- The AffineTransform
which is
concatenated to the transformation that will be applied when
executing this operation.public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
execute
in interface IUndoableOperation
execute
in class AbstractOperation
ExecutionException
public InfiniteCanvas getInfiniteCanvas()
InfiniteCanvas
that is manipulated by this operation.InfiniteCanvas
that is manipulated by this operation.public AffineTransform getInitialContentTransform()
public double getInitialHeight()
public double getInitialHorizontalScrollOffset()
public double getInitialVerticalScrollOffset()
public double getInitialWidth()
public double getNewHeight()
public double getNewHorizontalScrollOffset()
public AffineTransform getNewTransform()
public double getNewVerticalScrollOffset()
public double getNewWidth()
public boolean isContentRelevant()
ITransactionalOperation
true
if this ITransactionalOperation
is
actually changing model data (instead of only affecting the
visualization). Otherwise returns false
. The content
relevancy of an ITransactionalOperation
can be checked to
determine if the execution of the operation will affect the model, for
example, to set an editor's dirty flag.isContentRelevant
in interface ITransactionalOperation
true
if this ITransactionalOperation
is
actually changing model data, otherwise false
.public boolean isNoOp()
ITransactionalOperation
true
if this ITransactionalOperation
has no
effect (in comparison to its initial state). Otherwise returns
false
.isNoOp
in interface ITransactionalOperation
true
if this ITransactionalOperation
has no
effect, otherwise false
.protected void readViewport(InfiniteCanvas canvas)
canvas
- The InfiniteCanvas
from which the values are read.public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
redo
in interface IUndoableOperation
redo
in class AbstractOperation
ExecutionException
public void setNewContentTransform(AffineTransform newContentTransform)
newContentTransform
- The contents transformation to apply when executing this
operation.public void setNewHeight(double newHeight)
newHeight
- The viewport height to apply when executing this operation.public void setNewHorizontalScrollOffset(double horizontalScrollOffset)
horizontalScrollOffset
- The horizontal translation to apply when executing this
operation.public void setNewVerticalScrollOffset(double verticalScrollOffset)
verticalScrollOffset
- The vertical translation to apply when executing this
operation.public void setNewWidth(double newWidth)
newWidth
- The viewport width to apply when executing this operation.public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
undo
in interface IUndoableOperation
undo
in class AbstractOperation
ExecutionException
Copyright (c) 2014 itemis AG and others. All rights reserved.