Class FocusTraversalPolicy
- java.lang.Object
-
- org.eclipse.gef.common.adapt.IAdaptable.Bound.Impl<IVisualPart<? extends javafx.scene.Node>>
-
- org.eclipse.gef.mvc.fx.policies.AbstractPolicy
-
- org.eclipse.gef.mvc.fx.policies.FocusTraversalPolicy
-
- All Implemented Interfaces:
IAdaptable.Bound<IVisualPart<? extends javafx.scene.Node>>,IPolicy
public class FocusTraversalPolicy extends AbstractPolicy
TheFocusTraversalPolicycan be used to assign focus to the next or previous part in the focus traversal cycle.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.gef.common.adapt.IAdaptable.Bound
IAdaptable.Bound.Impl<T extends IAdaptable>
-
-
Constructor Summary
Constructors Constructor Description FocusTraversalPolicy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ITransactionalOperationcreateOperation()Creates anITransactionalOperationthat is used to encapsulate the changes that are applied by thisAbstractPolicythrough its "work" methods.protected IContentPart<? extends javafx.scene.Node>findInnerMostContentPart(IContentPart<? extends javafx.scene.Node> part)Returns the inner mostIContentPartchild within the part hierarchy of the givenIContentPart.protected IContentPart<? extends javafx.scene.Node>findNextContentPart(IContentPart<? extends javafx.scene.Node> current)Determines the nextIContentPartto which keyboard focus is assigned, depending on the currently focusedIContentPart.protected IContentPart<? extends javafx.scene.Node>findPreviousContentPart(IContentPart<? extends javafx.scene.Node> current)Determines the previousIContentPartto which keyboard focus is assigned, depending on the currently focusedIContentPart.IContentPart<? extends javafx.scene.Node>focusNext()Assigns focus to the next part in the traversal cycle.IContentPart<? extends javafx.scene.Node>focusPrevious()Assigns focus to the previous part in the traversal cycle.protected ChangeFocusOperationgetChangeFocusOperation()Returns theChangeFocusOperationthat is used to change the focus part.voidinit()Initializes the policy, so that the policy's "work" methods can be used.protected IContentPart<? extends javafx.scene.Node>traverse(boolean backwards)Traverses the focus forwards or backwards depending on the given flag.-
Methods inherited from class org.eclipse.gef.mvc.fx.policies.AbstractPolicy
checkInitialized, commit, getOperation, isInitialized, locallyExecuteOperation, rollback
-
Methods inherited from class org.eclipse.gef.common.adapt.IAdaptable.Bound.Impl
adaptableProperty, getAdaptable, setAdaptable
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.gef.common.adapt.IAdaptable.Bound
adaptableProperty, getAdaptable, setAdaptable
-
-
-
-
Method Detail
-
createOperation
protected ITransactionalOperation createOperation()
Description copied from class:AbstractPolicyCreates anITransactionalOperationthat is used to encapsulate the changes that are applied by thisAbstractPolicythrough its "work" methods. The created operation should allow forlocal executionat each time.- Specified by:
createOperationin classAbstractPolicy- Returns:
- A new
ITransactionalOperationto encapsulate all applied changes.
-
findInnerMostContentPart
protected IContentPart<? extends javafx.scene.Node> findInnerMostContentPart(IContentPart<? extends javafx.scene.Node> part)
Returns the inner mostIContentPartchild within the part hierarchy of the givenIContentPart. If the givenIContentPartdoes not have anyIContentPartchildren, then the givenIContentPartis returned.- Parameters:
part- TheIContentPartfor which to determine the inner mostIContentPartchild.- Returns:
- The inner most
IContentPartchild within the part hierarchy of the givenIContentPart.
-
findNextContentPart
protected IContentPart<? extends javafx.scene.Node> findNextContentPart(IContentPart<? extends javafx.scene.Node> current)
Determines the nextIContentPartto which keyboard focus is assigned, depending on the currently focusedIContentPart.The first content part child of the given focus part is returned as the next part if a content part child is available.
The next content part sibling of the given focus part is returned as the next part if a content part sibling is available. When one sibling list ends, the search continues with the parent's siblings until it reaches the root of the hierarchy.
If the next content part cannot be determined,
nullis returned.- Parameters:
current- The currently focusedIContentPart.- Returns:
- The next
IContentPartto which keyboard focus is assigned, ornullif no subsequentIContentPartcould be determined.
-
findPreviousContentPart
protected IContentPart<? extends javafx.scene.Node> findPreviousContentPart(IContentPart<? extends javafx.scene.Node> current)
Determines the previousIContentPartto which keyboard focus is assigned, depending on the currently focusedIContentPart.At first, the previous content part sibling of the given focus part is determined. If a siblings list ends, the search continues with the parent's siblings.
The inner most content part child of the previous content part sibling is returned as the previous content part, or
nullif no previous content part sibling could be found.- Parameters:
current- The currently focusedIContentPart.- Returns:
- The previous
IContentPartto which keyboard focus is assigned, ornullif no previousIContentPartcould be determined.
-
focusNext
public IContentPart<? extends javafx.scene.Node> focusNext()
Assigns focus to the next part in the traversal cycle. Returns theIContentPartto which focus is assigned by the operation of this policy, ornullif focus is assigned to the viewer.- Returns:
- The
IContentPartto which focus is assigned by the operation of this policy, ornullif focus is assigned to the viewer.
-
focusPrevious
public IContentPart<? extends javafx.scene.Node> focusPrevious()
Assigns focus to the previous part in the traversal cycle. Returns theIContentPartto which focus is assigned by the operation of this policy, ornullif focus is assigned to the viewer.- Returns:
- The
IContentPartto which focus is assigned by the operation of this policy, ornullif focus is assigned to the viewer.
-
getChangeFocusOperation
protected ChangeFocusOperation getChangeFocusOperation()
Returns theChangeFocusOperationthat is used to change the focus part.- Returns:
- The
ChangeFocusOperationthat is used to change the focus part.
-
init
public void init()
Description copied from class:AbstractPolicyInitializes the policy, so that the policy's "work" methods can be used. Calling a "work" method while the policy is not initialized will result in anIllegalStateException, as well as re-initializing before committing or rolling back.- Specified by:
initin interfaceIPolicy- Overrides:
initin classAbstractPolicy
-
traverse
protected IContentPart<? extends javafx.scene.Node> traverse(boolean backwards)
Traverses the focus forwards or backwards depending on the given flag. Returns theIContentPartto which focus is assigned by the operation of this policy, ornullif focus is assigned to the viewer.- Parameters:
backwards-trueif the focus should be traversed backwards, otherwisefalse.- Returns:
- The
IContentPartto which focus is assigned by the operation of this policy, ornullif focus is assigned to the viewer.
-
-