Package org.eclipse.gef.mvc.fx.behaviors
Class FocusBehavior
- java.lang.Object
-
- org.eclipse.gef.mvc.fx.behaviors.AbstractBehavior
-
- org.eclipse.gef.mvc.fx.behaviors.FocusBehavior
-
- All Implemented Interfaces:
IActivatable
,IAdaptable.Bound<IVisualPart<? extends javafx.scene.Node>>
,IBehavior
public class FocusBehavior extends AbstractBehavior
TheFocusBehavior
can be registered on anIVisualPart
to transfer the focus information from theFocusModel
to the part's visualization. It will assign keyboard focus to the visualization if the part is focused, and it will display focus feedback around the visualization to indicate that the part has focus.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.gef.common.adapt.IAdaptable.Bound
IAdaptable.Bound.Impl<T extends IAdaptable>
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
FOCUS_FEEDBACK_PART_FACTORY
The adapter role for the "focus"IFeedbackPartFactory
.static java.lang.String
FOCUSED_STYLE
Defines the CSS styling that is used to highlight a focused viewer.static java.lang.String
UNFOCUSED_STYLE
Defines the default CSS styling for theInfiniteCanvas
: no background, no border.-
Fields inherited from interface org.eclipse.gef.common.activate.IActivatable
ACTIVE_PROPERTY
-
-
Constructor Summary
Constructors Constructor Description FocusBehavior()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addAnchoreds(java.util.Collection<? extends IVisualPart<? extends javafx.scene.Node>> targets, java.util.List<? extends IVisualPart<? extends javafx.scene.Node>> anchoreds)
Adds the given anchoreds as children to the root part and anchors them to the given target parts.protected void
addViewerFocusedFeedback()
Adds viewer focused feedback.protected void
applyFocusToVisual()
Transfers the keyboard focus to JavaFX, i.e. callsNode.requestFocus()
on the visual of the focus part, or on the root visual if no part is focused.protected void
doActivate()
PostAbstractBehavior.activate()
hook that may be overwritten to e.g. register listeners.protected void
doDeactivate()
PreAbstractBehavior.deactivate()
hook that may be overwritten to e.g. unregister listeners.protected IFeedbackPartFactory
getFeedbackPartFactory(IViewer viewer)
Returns theIFeedbackPartFactory
that should be used for feedback creation.protected FocusModel
getFocusModel()
Returns theFocusModel
at which thisFocusBehavior
is registered for changes.protected void
refreshFocusFeedback()
Refreshes focus feedback, i.e. adds or removes feedback.protected void
removeViewerFocusedFeedback()
Removes viewer focused feedback.-
Methods inherited from class org.eclipse.gef.mvc.fx.behaviors.AbstractBehavior
activate, activeProperty, adaptableProperty, addAnchoreds, addFeedback, addFeedback, addHandles, addHandles, clearFeedback, clearHandles, deactivate, getAdaptable, getFeedback, getFeedback, getFeedbackPartFactory, getFeedbackPerTargetSet, getHandlePartFactory, getHandlePartFactory, getHandles, getHandles, getHandlesPerTargetSet, getHost, hasFeedback, hasFeedback, hasHandles, hasHandles, isActive, removeAnchoreds, removeFeedback, removeFeedback, removeFeedback, removeHandles, removeHandles, removeHandles, setAdaptable, updateHandles, updateHandles
-
-
-
-
Field Detail
-
UNFOCUSED_STYLE
public static final java.lang.String UNFOCUSED_STYLE
Defines the default CSS styling for theInfiniteCanvas
: no background, no border.- See Also:
- Constant Field Values
-
FOCUSED_STYLE
public static final java.lang.String FOCUSED_STYLE
Defines the CSS styling that is used to highlight a focused viewer.- See Also:
- Constant Field Values
-
FOCUS_FEEDBACK_PART_FACTORY
public static final java.lang.String FOCUS_FEEDBACK_PART_FACTORY
The adapter role for the "focus"IFeedbackPartFactory
.- See Also:
- Constant Field Values
-
-
Method Detail
-
addAnchoreds
protected void addAnchoreds(java.util.Collection<? extends IVisualPart<? extends javafx.scene.Node>> targets, java.util.List<? extends IVisualPart<? extends javafx.scene.Node>> anchoreds)
Description copied from class:AbstractBehavior
Adds the given anchoreds as children to the root part and anchors them to the given target parts.- Overrides:
addAnchoreds
in classAbstractBehavior
- Parameters:
targets
- The anchorages for the anchoreds.anchoreds
- The anchored (feedback or handle) parts.
-
addViewerFocusedFeedback
protected void addViewerFocusedFeedback()
Adds viewer focused feedback.
-
applyFocusToVisual
protected void applyFocusToVisual()
Transfers the keyboard focus to JavaFX, i.e. callsNode.requestFocus()
on the visual of the focus part, or on the root visual if no part is focused.
-
doActivate
protected void doActivate()
Description copied from class:AbstractBehavior
PostAbstractBehavior.activate()
hook that may be overwritten to e.g. register listeners.- Overrides:
doActivate
in classAbstractBehavior
-
doDeactivate
protected void doDeactivate()
Description copied from class:AbstractBehavior
PreAbstractBehavior.deactivate()
hook that may be overwritten to e.g. unregister listeners.- Overrides:
doDeactivate
in classAbstractBehavior
-
getFeedbackPartFactory
protected IFeedbackPartFactory getFeedbackPartFactory(IViewer viewer)
Description copied from class:AbstractBehavior
Returns theIFeedbackPartFactory
that should be used for feedback creation.- Overrides:
getFeedbackPartFactory
in classAbstractBehavior
- Parameters:
viewer
- TheIViewer
for which to determine theIFeedbackPartFactory
for thisIBehavior
.- Returns:
- The
IFeedbackPartFactory
that should be used for feedback creation.
-
getFocusModel
protected FocusModel getFocusModel()
Returns theFocusModel
at which thisFocusBehavior
is registered for changes.- Returns:
- The
FocusModel
at which thisFocusBehavior
is registered for changes.
-
refreshFocusFeedback
protected void refreshFocusFeedback()
Refreshes focus feedback, i.e. adds or removes feedback.
-
removeViewerFocusedFeedback
protected void removeViewerFocusedFeedback()
Removes viewer focused feedback.
-
-