Class ChangeViewportOperation
java.lang.Object
org.eclipse.core.commands.operations.AbstractOperation
org.eclipse.gef.mvc.fx.operations.ChangeViewportOperation
- All Implemented Interfaces:
IUndoableOperation,ITransactionalOperation
The
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 Summary
ConstructorsConstructorDescriptionCreates a newChangeViewportOperationto manipulate the givenInfiniteCanvas.ChangeViewportOperation(InfiniteCanvas canvas, double newHorizontalScrollOffset, double newVerticalScrollOffset) Creates a newChangeViewportOperationto manipulate the givenInfiniteCanvas.ChangeViewportOperation(InfiniteCanvas canvas, double newHorizontalScrollOffset, double newVerticalScrollOffset, double newWidth, double newHeight, AffineTransform newContentTransform) Creates a newChangeViewportOperationto manipulate the givenInfiniteCanvas.ChangeViewportOperation(InfiniteCanvas canvas, double newHorizontalScrollOffset, double newVerticalScrollOffset, AffineTransform newContentTransform) Creates a newChangeViewportOperationto manipulate the givenInfiniteCanvas.ChangeViewportOperation(InfiniteCanvas canvas, AffineTransform newContentTransform) Creates a newChangeViewportOperationto manipulate the givenInfiniteCanvas. -
Method Summary
Modifier and TypeMethodDescriptionvoidConcatenates the givenAffineTransformto the contents transformation that will be applied when executing this operation.execute(IProgressMonitor monitor, IAdaptable info) Returns theInfiniteCanvasthat is manipulated by this operation.Returns the contents transformation that will be applied when undoing this operation.doubleReturns the viewport height that will be applied when undoing this operation.doubleReturns the horizontal translation that will be applied when undoing this operation.doubleReturns the vertical translation that will be applied when undoing this operation.doubleReturns the viewport width that will be applied when undoing this operation.Returns the contents transformation that will be applied when executing this operation.doubleReturns the viewport height that will be applied when executing this operation.doubleReturns the horizontal translation that will be applied when executing this operation.doubleReturns the vertical translation that will be applied when executing this operation.doubleReturns the viewport width that will be applied when executing this operation.booleanReturnstrueif thisITransactionalOperationis actually changing model data (instead of only affecting the visualization).booleanisNoOp()Returnstrueif thisITransactionalOperationhas no effect (in comparison to its initial state).protected voidreadViewport(InfiniteCanvas canvas) Stores all relevant viewport values in fields, so that they can be restored later.redo(IProgressMonitor monitor, IAdaptable info) voidsetInitialContentTransform(AffineTransform initialContentTransform) Sets the initial content transform before applying the new value.voidsetInitialHeight(double initialHeight) Sets the initial height before applying the new value.voidsetInitialHorizontalScrollOffset(double initialHorizontalScrollOffset) Sets the initial horizontal scroll offset before applying the new value.voidsetInitialVerticalScrollOffset(double initialVerticalScrollOffset) Sets the initial vertical scroll offset before applying the new value.voidsetInitialWidth(double initialWidth) Sets the initial width before applying the new value.voidsetNewContentTransform(AffineTransform newContentTransform) Sets the contents transformation that will be applied when executing this operation to the given value.voidsetNewHeight(double newHeight) Sets the viewport height that will be applied when executing this operation to the given value.voidsetNewHorizontalScrollOffset(double newHorizontalScrollOffset) Sets the horizontal translation that will be applied when executing this operation to the given value.voidsetNewVerticalScrollOffset(double newVerticalScrollOffset) Sets the vertical translation that will be applied when executing this operation to the given value.voidsetNewWidth(double newWidth) Sets the viewport width that will be applied when executing this operation to the given value.undo(IProgressMonitor monitor, IAdaptable info) Methods inherited from class org.eclipse.core.commands.operations.AbstractOperation
addContext, canExecute, canRedo, canUndo, dispose, getContexts, getLabel, hasContext, removeContext, setLabel, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.core.commands.operations.IUndoableOperation
addContext, canExecute, canRedo, canUndo, dispose, getContexts, getLabel, hasContext, removeContext
-
Constructor Details
-
ChangeViewportOperation
Creates a newChangeViewportOperationto manipulate the givenInfiniteCanvas. The current viewport values are read and used when undoing this operation.- Parameters:
canvas- TheInfiniteCanvaswhich is manipulated by this operation.
-
ChangeViewportOperation
Creates a newChangeViewportOperationto manipulate the givenInfiniteCanvas. The current viewport values are read and used when undoing this operation. The givenAffineTransformwill be applied when executing this operation.- Parameters:
canvas- TheInfiniteCanvasthat is manipulated.newContentTransform- The contents transformation which is applied when executing this operation.
-
ChangeViewportOperation
public ChangeViewportOperation(InfiniteCanvas canvas, double newHorizontalScrollOffset, double newVerticalScrollOffset) Creates a newChangeViewportOperationto manipulate the givenInfiniteCanvas. The current viewport values are read and used when undoing this operation. The given translation values will be applied when executing this operation.- Parameters:
canvas- TheInfiniteCanvasthat is manipulated.newHorizontalScrollOffset- The horizontal translation that is applied when executing this operation.newVerticalScrollOffset- The vertical translation that is applied when executing this operation.
-
ChangeViewportOperation
public ChangeViewportOperation(InfiniteCanvas canvas, double newHorizontalScrollOffset, double newVerticalScrollOffset, AffineTransform newContentTransform) Creates a newChangeViewportOperationto manipulate the givenInfiniteCanvas. 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.- Parameters:
canvas- TheInfiniteCanvasthat 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.
-
ChangeViewportOperation
public ChangeViewportOperation(InfiniteCanvas canvas, double newHorizontalScrollOffset, double newVerticalScrollOffset, double newWidth, double newHeight, AffineTransform newContentTransform) Creates a newChangeViewportOperationto manipulate the givenInfiniteCanvas. 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.- Parameters:
canvas- TheInfiniteCanvasthat 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.
-
-
Method Details
-
concatenateToNewContentTransform
Concatenates the givenAffineTransformto the contents transformation that will be applied when executing this operation.- Parameters:
t- TheAffineTransformwhich is concatenated to the transformation that will be applied when executing this operation.
-
execute
- Specified by:
executein interfaceIUndoableOperation- Specified by:
executein classAbstractOperation- Throws:
ExecutionException
-
getInfiniteCanvas
Returns theInfiniteCanvasthat is manipulated by this operation.- Returns:
- The
InfiniteCanvasthat is manipulated by this operation.
-
getInitialContentTransform
Returns the contents transformation that will be applied when undoing this operation.- Returns:
- The contents transformation that will be applied when undoing this operation.
-
getInitialHeight
public double getInitialHeight()Returns the viewport height that will be applied when undoing this operation.- Returns:
- The viewport height that will be applied when undoing this operation.
-
getInitialHorizontalScrollOffset
public double getInitialHorizontalScrollOffset()Returns the horizontal translation that will be applied when undoing this operation.- Returns:
- The horizontal translation that will be applied when undoing this operation.
-
getInitialVerticalScrollOffset
public double getInitialVerticalScrollOffset()Returns the vertical translation that will be applied when undoing this operation.- Returns:
- The vertical translation that will be applied when undoing this operation.
-
getInitialWidth
public double getInitialWidth()Returns the viewport width that will be applied when undoing this operation.- Returns:
- The viewport width that will be applied when undoing this operation.
-
getNewContentTransform
Returns the contents transformation that will be applied when executing this operation.- Returns:
- The contents transformation that will be applied when executing this operation.
-
getNewHeight
public double getNewHeight()Returns the viewport height that will be applied when executing this operation.- Returns:
- The viewport height that will be applied when executing this operation.
-
getNewHorizontalScrollOffset
public double getNewHorizontalScrollOffset()Returns the horizontal translation that will be applied when executing this operation.- Returns:
- The horizontal translation that will be applied when executing this operation.
-
getNewVerticalScrollOffset
public double getNewVerticalScrollOffset()Returns the vertical translation that will be applied when executing this operation.- Returns:
- The vertical translation that will be applied when executing this operation.
-
getNewWidth
public double getNewWidth()Returns the viewport width that will be applied when executing this operation.- Returns:
- The viewport width that will be applied when executing this operation.
-
isContentRelevant
public boolean isContentRelevant()Description copied from interface:ITransactionalOperationReturnstrueif thisITransactionalOperationis actually changing model data (instead of only affecting the visualization). Otherwise returnsfalse. The content relevance of anITransactionalOperationcan be checked to determine if the execution of the operation will affect the model, for example, to set an editor's dirty flag.- Specified by:
isContentRelevantin interfaceITransactionalOperation- Returns:
trueif thisITransactionalOperationis actually changing model data, otherwisefalse.
-
isNoOp
public boolean isNoOp()Description copied from interface:ITransactionalOperationReturnstrueif thisITransactionalOperationhas no effect (in comparison to its initial state). Otherwise returnsfalse.- Specified by:
isNoOpin interfaceITransactionalOperation- Returns:
trueif thisITransactionalOperationhas no effect, otherwisefalse.
-
readViewport
Stores all relevant viewport values in fields, so that they can be restored later.- Parameters:
canvas- TheInfiniteCanvasfrom which the values are read.
-
redo
- Specified by:
redoin interfaceIUndoableOperation- Specified by:
redoin classAbstractOperation- Throws:
ExecutionException
-
setInitialContentTransform
Sets the initial content transform before applying the new value.- Parameters:
initialContentTransform- The initialContentTransform to set.
-
setInitialHeight
public void setInitialHeight(double initialHeight) Sets the initial height before applying the new value.- Parameters:
initialHeight- The initialHeight to set.
-
setInitialHorizontalScrollOffset
public void setInitialHorizontalScrollOffset(double initialHorizontalScrollOffset) Sets the initial horizontal scroll offset before applying the new value.- Parameters:
initialHorizontalScrollOffset- The initialHorizontalScrollOffset to set.
-
setInitialVerticalScrollOffset
public void setInitialVerticalScrollOffset(double initialVerticalScrollOffset) Sets the initial vertical scroll offset before applying the new value.- Parameters:
initialVerticalScrollOffset- The initialVerticalScrollOffset to set.
-
setInitialWidth
public void setInitialWidth(double initialWidth) Sets the initial width before applying the new value.- Parameters:
initialWidth- The initialWidth to set.
-
setNewContentTransform
Sets the contents transformation that will be applied when executing this operation to the given value.- Parameters:
newContentTransform- The contents transformation to apply when executing this operation.
-
setNewHeight
public void setNewHeight(double newHeight) Sets the viewport height that will be applied when executing this operation to the given value.- Parameters:
newHeight- The viewport height to apply when executing this operation.
-
setNewHorizontalScrollOffset
public void setNewHorizontalScrollOffset(double newHorizontalScrollOffset) Sets the horizontal translation that will be applied when executing this operation to the given value.- Parameters:
newHorizontalScrollOffset- The horizontal translation to apply when executing this operation.
-
setNewVerticalScrollOffset
public void setNewVerticalScrollOffset(double newVerticalScrollOffset) Sets the vertical translation that will be applied when executing this operation to the given value.- Parameters:
newVerticalScrollOffset- The vertical translation to apply when executing this operation.
-
setNewWidth
public void setNewWidth(double newWidth) Sets the viewport width that will be applied when executing this operation to the given value.- Parameters:
newWidth- The viewport width to apply when executing this operation.
-
undo
- Specified by:
undoin interfaceIUndoableOperation- Specified by:
undoin classAbstractOperation- Throws:
ExecutionException
-