Class FocusTraversalPolicy
- All Implemented Interfaces:
IAdaptable.Bound<IVisualPart<? extends javafx.scene.Node>>
,IPolicy
FocusTraversalPolicy
can be used to assign focus to the next or
previous part in the focus traversal cycle.-
Property Summary
Properties inherited from class org.eclipse.gef.common.adapt.IAdaptable.Bound.Impl
adaptable
Properties inherited from interface org.eclipse.gef.common.adapt.IAdaptable.Bound
adaptable
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.gef.common.adapt.IAdaptable.Bound
IAdaptable.Bound.Impl<T extends IAdaptable>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected ITransactionalOperation
Creates anITransactionalOperation
that is used to encapsulate the changes that are applied by thisAbstractPolicy
through its "work" methods.protected IContentPart<? extends javafx.scene.Node>
findInnerMostContentPart
(IContentPart<? extends javafx.scene.Node> part) Returns the inner mostIContentPart
child within the part hierarchy of the givenIContentPart
.protected IContentPart<? extends javafx.scene.Node>
findNextContentPart
(IContentPart<? extends javafx.scene.Node> current) Determines the nextIContentPart
to 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 previousIContentPart
to which keyboard focus is assigned, depending on the currently focusedIContentPart
.IContentPart<? extends javafx.scene.Node>
Assigns focus to the next part in the traversal cycle.IContentPart<? extends javafx.scene.Node>
Assigns focus to the previous part in the traversal cycle.protected ChangeFocusOperation
Returns theChangeFocusOperation
that is used to change the focus part.void
init()
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
-
Constructor Details
-
FocusTraversalPolicy
public FocusTraversalPolicy()
-
-
Method Details
-
createOperation
Description copied from class:AbstractPolicy
Creates anITransactionalOperation
that is used to encapsulate the changes that are applied by thisAbstractPolicy
through its "work" methods. The created operation should allow forlocal execution
at each time.- Specified by:
createOperation
in classAbstractPolicy
- Returns:
- A new
ITransactionalOperation
to encapsulate all applied changes.
-
findInnerMostContentPart
protected IContentPart<? extends javafx.scene.Node> findInnerMostContentPart(IContentPart<? extends javafx.scene.Node> part) Returns the inner mostIContentPart
child within the part hierarchy of the givenIContentPart
. If the givenIContentPart
does not have anyIContentPart
children, then the givenIContentPart
is returned.- Parameters:
part
- TheIContentPart
for which to determine the inner mostIContentPart
child.- Returns:
- The inner most
IContentPart
child within the part hierarchy of the givenIContentPart
.
-
findNextContentPart
protected IContentPart<? extends javafx.scene.Node> findNextContentPart(IContentPart<? extends javafx.scene.Node> current) Determines the nextIContentPart
to 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,
null
is returned.- Parameters:
current
- The currently focusedIContentPart
.- Returns:
- The next
IContentPart
to which keyboard focus is assigned, ornull
if no subsequentIContentPart
could be determined.
-
findPreviousContentPart
protected IContentPart<? extends javafx.scene.Node> findPreviousContentPart(IContentPart<? extends javafx.scene.Node> current) Determines the previousIContentPart
to 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
null
if no previous content part sibling could be found.- Parameters:
current
- The currently focusedIContentPart
.- Returns:
- The previous
IContentPart
to which keyboard focus is assigned, ornull
if no previousIContentPart
could be determined.
-
focusNext
Assigns focus to the next part in the traversal cycle. Returns theIContentPart
to which focus is assigned by the operation of this policy, ornull
if focus is assigned to the viewer.- Returns:
- The
IContentPart
to which focus is assigned by the operation of this policy, ornull
if focus is assigned to the viewer.
-
focusPrevious
Assigns focus to the previous part in the traversal cycle. Returns theIContentPart
to which focus is assigned by the operation of this policy, ornull
if focus is assigned to the viewer.- Returns:
- The
IContentPart
to which focus is assigned by the operation of this policy, ornull
if focus is assigned to the viewer.
-
getChangeFocusOperation
Returns theChangeFocusOperation
that is used to change the focus part.- Returns:
- The
ChangeFocusOperation
that is used to change the focus part.
-
init
public void init()Description copied from class:AbstractPolicy
Initializes 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:
init
in interfaceIPolicy
- Overrides:
init
in classAbstractPolicy
-
traverse
Traverses the focus forwards or backwards depending on the given flag. Returns theIContentPart
to which focus is assigned by the operation of this policy, ornull
if focus is assigned to the viewer.- Parameters:
backwards
-true
if the focus should be traversed backwards, otherwisefalse
.- Returns:
- The
IContentPart
to which focus is assigned by the operation of this policy, ornull
if focus is assigned to the viewer.
-