Package org.eclipse.gef.mvc.fx.policies

# 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
The `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

Constructors
Constructor
Description
`FocusTraversalPolicy()`

## Method Summary

Modifier and Type
Method
Description
`protected ITransactionalOperation`
`createOperation()`
Creates an `ITransactionalOperation` that is used to encapsulate the changes that are applied by this `AbstractPolicy` through its "work" methods.
`protected IContentPart<? extends javafx.scene.Node>`
`findInnerMostContentPart(IContentPart<? extends javafx.scene.Node> part)`
Returns the inner most `IContentPart` child within the part hierarchy of the given `IContentPart`.
`protected IContentPart<? extends javafx.scene.Node>`
`findNextContentPart(IContentPart<? extends javafx.scene.Node> current)`
Determines the next `IContentPart` to which keyboard focus is assigned, depending on the currently focused `IContentPart`.
`protected IContentPart<? extends javafx.scene.Node>`
`findPreviousContentPart(IContentPart<? extends javafx.scene.Node> current)`
Determines the previous `IContentPart` to which keyboard focus is assigned, depending on the currently focused `IContentPart`.
`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 ChangeFocusOperation`
`getChangeFocusOperation()`
Returns the `ChangeFocusOperation` 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`

### Methods inherited from interface org.eclipse.gef.mvc.fx.policies.IPolicy

`getHost`

## Constructor Details

### FocusTraversalPolicy

public FocusTraversalPolicy()

## Method Details

### createOperation

protected ITransactionalOperation createOperation()
Description copied from class: `AbstractPolicy`
Creates an `ITransactionalOperation` that is used to encapsulate the changes that are applied by this `AbstractPolicy` through its "work" methods. The created operation should allow for `local execution` at each time.

Specified by:
  `createOperation` in class `AbstractPolicy`
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 most `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.

Parameters:
  `part` - The `IContentPart` for which to determine the inner most `IContentPart` child.
Returns:
  The inner most `IContentPart` child within the part hierarchy of the given `IContentPart`.

### findNextContentPart

protected IContentPart<? extends javafx.scene.Node> findNextContentPart(IContentPart<? extends javafx.scene.Node> current)
Determines the next `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.

Parameters:
  `current` - The currently focused `IContentPart`.
Returns:
  The next `IContentPart` to which keyboard focus is assigned, or `null` if no subsequent `IContentPart` could be determined.

### findPreviousContentPart

protected IContentPart<? extends javafx.scene.Node> findPreviousContentPart(IContentPart<? extends javafx.scene.Node> current)
Determines the previous `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.

Parameters:
  `current` - The currently focused `IContentPart`.
Returns:
  The previous `IContentPart` to which keyboard focus is assigned, or `null` if no previous `IContentPart` could be determined.

### focusNext

public IContentPart<? extends javafx.scene.Node> focusNext()
Assigns focus to the next part in the traversal cycle. Returns the `IContentPart` to which focus is assigned by the operation of this policy, or `null` if focus is assigned to the viewer.

Returns:
  The `IContentPart` to which focus is assigned by the operation of this policy, or `null` if 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 the `IContentPart` to which focus is assigned by the operation of this policy, or `null` if focus is assigned to the viewer.

Returns:
  The `IContentPart` to which focus is assigned by the operation of this policy, or `null` if focus is assigned to the viewer.

### getChangeFocusOperation

protected ChangeFocusOperation getChangeFocusOperation()
Returns the `ChangeFocusOperation` 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 an `IllegalStateException`, as well as re-initializing before committing or rolling back.

Specified by:
  `init` in interface `IPolicy`
Overrides:
  `init` in class `AbstractPolicy`

### traverse

protected IContentPart<? extends javafx.scene.Node> traverse(boolean backwards)
Traverses the focus forwards or backwards depending on the given flag. Returns the `IContentPart` to which focus is assigned by the operation of this policy, or `null` if focus is assigned to the viewer.

Parameters:
  `backwards` - `true` if the focus should be traversed backwards, otherwise `false`.
Returns:
  The `IContentPart` to which focus is assigned by the operation of this policy, or `null` if focus is assigned to the viewer.