public class FXFocusTraversalPolicy extends AbstractTransactionPolicy<javafx.scene.Node>
FXFocusTraversalPolicy
can be used to assign focus to the next or
previous part in the focus traversal cycle.adaptable
IAdaptable.Bound.Impl<T extends IAdaptable>
Constructor and Description |
---|
FXFocusTraversalPolicy() |
Modifier and Type | Method and Description |
---|---|
protected ITransactionalOperation |
createOperation()
Creates an
ITransactionalOperation that is used to encapsulate
the changes that are applied by this AbstractTransactionPolicy
through its "work" methods. |
protected IContentPart<javafx.scene.Node,? extends javafx.scene.Node> |
findInnerMostContentPart(IContentPart<javafx.scene.Node,? extends javafx.scene.Node> part)
Returns the inner most
IContentPart child within the part
hierarchy of the given IContentPart . |
protected IContentPart<javafx.scene.Node,? extends javafx.scene.Node> |
findNextContentPart(IContentPart<javafx.scene.Node,? extends javafx.scene.Node> current)
Determines the next
IContentPart to which keyboard focus is
assigned, depending on the currently focused IContentPart . |
protected IContentPart<javafx.scene.Node,? extends javafx.scene.Node> |
findPreviousContentPart(IContentPart<javafx.scene.Node,? extends javafx.scene.Node> current)
Determines the previous
IContentPart to which keyboard focus is
assigned, depending on the currently focused IContentPart . |
void |
focusNext()
Assigns focus to the next part in the traversal cycle.
|
void |
focusPrevious()
Assigns focus to the previous part in the traversal cycle.
|
protected ChangeFocusOperation<javafx.scene.Node> |
getChangeFocusOperation()
Returns the
ChangeFocusOperation that is used to change the focus
part. |
protected FXRevealOperation |
getRevealOperation()
Returns the
FXRevealOperation that is used to reveal the focus
part. |
void |
init()
Initializes the policy, so that the policy's "work" methods can be used.
|
protected void |
traverse(boolean backwards)
Traverses the focus forwards or backwards depending on the given flag.
|
checkInitialized, commit, getOperation, isInitialized, locallyExecuteOperation, rollback
adaptableProperty, getAdaptable, getHost, setAdaptable
protected ITransactionalOperation createOperation()
AbstractTransactionPolicy
ITransactionalOperation
that is used to encapsulate
the changes that are applied by this AbstractTransactionPolicy
through its "work" methods. The created operation should allow for
local execution
at each time.createOperation
in class AbstractTransactionPolicy<javafx.scene.Node>
ITransactionalOperation
to encapsulate all applied
changes.protected IContentPart<javafx.scene.Node,? extends javafx.scene.Node> findInnerMostContentPart(IContentPart<javafx.scene.Node,? extends javafx.scene.Node> part)
IContentPart
child within the part
hierarchy of the given IContentPart
. If the given
IContentPart
does not have any IContentPart
children,
then the given IContentPart
is returned.part
- The IContentPart
for which to determine the inner most
IContentPart
child.IContentPart
child within the part
hierarchy of the given IContentPart
.protected IContentPart<javafx.scene.Node,? extends javafx.scene.Node> findNextContentPart(IContentPart<javafx.scene.Node,? extends javafx.scene.Node> current)
IContentPart
to which keyboard focus is
assigned, depending on the currently focused IContentPart
.
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.
current
- The currently focused IContentPart
.IContentPart
to which keyboard focus is
assigned, or null
if no subsequent
IContentPart
could be determined.protected IContentPart<javafx.scene.Node,? extends javafx.scene.Node> findPreviousContentPart(IContentPart<javafx.scene.Node,? extends javafx.scene.Node> current)
IContentPart
to which keyboard focus is
assigned, depending on the currently focused IContentPart
.
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.
current
- The currently focused IContentPart
.IContentPart
to which keyboard focus is
assigned, or null
if no previous
IContentPart
could be determined.public void focusNext()
public void focusPrevious()
protected ChangeFocusOperation<javafx.scene.Node> getChangeFocusOperation()
ChangeFocusOperation
that is used to change the focus
part.ChangeFocusOperation
that is used to change the focus
part.protected FXRevealOperation getRevealOperation()
FXRevealOperation
that is used to reveal the focus
part.FXRevealOperation
that is used to reveal the focus
part.public void init()
AbstractTransactionPolicy
IllegalStateException
. It is safe to call AbstractTransactionPolicy.init()
multiple times in sequence.init
in class AbstractTransactionPolicy<javafx.scene.Node>
protected void traverse(boolean backwards)
backwards
- true
if the focus should be traversed backwards,
otherwise false
.Copyright (c) 2014 itemis AG and others. All rights reserved.