public class ChangeViewportOperation extends org.eclipse.core.commands.operations.AbstractOperation implements ITransactionalOperation
ChangeViewportOperation
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 |
---|
ChangeViewportOperation(InfiniteCanvas canvas)
Creates a new
ChangeViewportOperation to manipulate the given
InfiniteCanvas . |
ChangeViewportOperation(InfiniteCanvas canvas,
AffineTransform newContentTransform)
Creates a new
ChangeViewportOperation to manipulate the given
InfiniteCanvas . |
ChangeViewportOperation(InfiniteCanvas canvas,
double newHorizontalScrollOffset,
double newVerticalScrollOffset)
Creates a new
ChangeViewportOperation to manipulate the given
InfiniteCanvas . |
ChangeViewportOperation(InfiniteCanvas canvas,
double newHorizontalScrollOffset,
double newVerticalScrollOffset,
AffineTransform newContentTransform)
Creates a new
ChangeViewportOperation to manipulate the given
InfiniteCanvas . |
ChangeViewportOperation(InfiniteCanvas canvas,
double newHorizontalScrollOffset,
double newVerticalScrollOffset,
double newWidth,
double newHeight,
AffineTransform newContentTransform)
Creates a new
ChangeViewportOperation 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. |
org.eclipse.core.runtime.IStatus |
execute(org.eclipse.core.runtime.IProgressMonitor monitor,
org.eclipse.core.runtime.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.
|
AffineTransform |
getNewContentTransform()
Returns the contents transformation that will be applied when executing
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.
|
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.
|
org.eclipse.core.runtime.IStatus |
redo(org.eclipse.core.runtime.IProgressMonitor monitor,
org.eclipse.core.runtime.IAdaptable info) |
void |
setInitialContentTransform(AffineTransform initialContentTransform)
Sets the initial content transform before applying the new value.
|
void |
setInitialHeight(double initialHeight)
Sets the initial height before applying the new value.
|
void |
setInitialHorizontalScrollOffset(double initialHorizontalScrollOffset)
Sets the initial horizontal scroll offset before applying the new value.
|
void |
setInitialVerticalScrollOffset(double initialVerticalScrollOffset)
Sets the initial vertical scroll offset before applying the new value.
|
void |
setInitialWidth(double initialWidth)
Sets the initial width before applying the new value.
|
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 newHorizontalScrollOffset)
Sets the horizontal translation that will be applied when executing this
operation to the given value.
|
void |
setNewVerticalScrollOffset(double newVerticalScrollOffset)
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.
|
org.eclipse.core.runtime.IStatus |
undo(org.eclipse.core.runtime.IProgressMonitor monitor,
org.eclipse.core.runtime.IAdaptable info) |
addContext, canExecute, canRedo, canUndo, dispose, getContexts, getLabel, hasContext, removeContext, setLabel, toString
public ChangeViewportOperation(InfiniteCanvas canvas)
ChangeViewportOperation
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 ChangeViewportOperation(InfiniteCanvas canvas, AffineTransform newContentTransform)
ChangeViewportOperation
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 ChangeViewportOperation(InfiniteCanvas canvas, double newHorizontalScrollOffset, double newVerticalScrollOffset)
ChangeViewportOperation
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 ChangeViewportOperation(InfiniteCanvas canvas, double newHorizontalScrollOffset, double newVerticalScrollOffset, AffineTransform newContentTransform)
ChangeViewportOperation
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 ChangeViewportOperation(InfiniteCanvas canvas, double newHorizontalScrollOffset, double newVerticalScrollOffset, double newWidth, double newHeight, AffineTransform newContentTransform)
ChangeViewportOperation
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 org.eclipse.core.runtime.IStatus execute(org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException
execute
in interface org.eclipse.core.commands.operations.IUndoableOperation
execute
in class org.eclipse.core.commands.operations.AbstractOperation
org.eclipse.core.commands.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 AffineTransform getNewContentTransform()
public double getNewHeight()
public double getNewHorizontalScrollOffset()
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
relevance 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 org.eclipse.core.runtime.IStatus redo(org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException
redo
in interface org.eclipse.core.commands.operations.IUndoableOperation
redo
in class org.eclipse.core.commands.operations.AbstractOperation
org.eclipse.core.commands.ExecutionException
public void setInitialContentTransform(AffineTransform initialContentTransform)
initialContentTransform
- The initialContentTransform to set.public void setInitialHeight(double initialHeight)
initialHeight
- The initialHeight to set.public void setInitialHorizontalScrollOffset(double initialHorizontalScrollOffset)
initialHorizontalScrollOffset
- The initialHorizontalScrollOffset to set.public void setInitialVerticalScrollOffset(double initialVerticalScrollOffset)
initialVerticalScrollOffset
- The initialVerticalScrollOffset to set.public void setInitialWidth(double initialWidth)
initialWidth
- The initialWidth to set.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 newHorizontalScrollOffset)
newHorizontalScrollOffset
- The horizontal translation to apply when executing this
operation.public void setNewVerticalScrollOffset(double newVerticalScrollOffset)
newVerticalScrollOffset
- 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 org.eclipse.core.runtime.IStatus undo(org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException
undo
in interface org.eclipse.core.commands.operations.IUndoableOperation
undo
in class org.eclipse.core.commands.operations.AbstractOperation
org.eclipse.core.commands.ExecutionException
Copyright (c) 2014, 2016 itemis AG and others. All rights reserved.