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
TheFocusBehaviorcan be registered on anIVisualPartto transfer the focus information from theFocusModelto 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.StringFOCUS_FEEDBACK_PART_FACTORYThe adapter role for the "focus"IFeedbackPartFactory.static java.lang.StringFOCUSED_STYLEDefines the CSS styling that is used to highlight a focused viewer.static java.lang.StringUNFOCUSED_STYLEDefines 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 voidaddAnchoreds(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 voidaddViewerFocusedFeedback()Adds viewer focused feedback.protected voidapplyFocusToVisual()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 voiddoActivate()PostAbstractBehavior.activate()hook that may be overwritten to e.g. register listeners.protected voiddoDeactivate()PreAbstractBehavior.deactivate()hook that may be overwritten to e.g. unregister listeners.protected IFeedbackPartFactorygetFeedbackPartFactory(IViewer viewer)Returns theIFeedbackPartFactorythat should be used for feedback creation.protected FocusModelgetFocusModel()Returns theFocusModelat which thisFocusBehavioris registered for changes.protected voidrefreshFocusFeedback()Refreshes focus feedback, i.e. adds or removes feedback.protected voidremoveViewerFocusedFeedback()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:AbstractBehaviorAdds the given anchoreds as children to the root part and anchors them to the given target parts.- Overrides:
addAnchoredsin 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:AbstractBehaviorPostAbstractBehavior.activate()hook that may be overwritten to e.g. register listeners.- Overrides:
doActivatein classAbstractBehavior
-
doDeactivate
protected void doDeactivate()
Description copied from class:AbstractBehaviorPreAbstractBehavior.deactivate()hook that may be overwritten to e.g. unregister listeners.- Overrides:
doDeactivatein classAbstractBehavior
-
getFeedbackPartFactory
protected IFeedbackPartFactory getFeedbackPartFactory(IViewer viewer)
Description copied from class:AbstractBehaviorReturns theIFeedbackPartFactorythat should be used for feedback creation.- Overrides:
getFeedbackPartFactoryin classAbstractBehavior- Parameters:
viewer- TheIViewerfor which to determine theIFeedbackPartFactoryfor thisIBehavior.- Returns:
- The
IFeedbackPartFactorythat should be used for feedback creation.
-
getFocusModel
protected FocusModel getFocusModel()
Returns theFocusModelat which thisFocusBehavioris registered for changes.- Returns:
- The
FocusModelat which thisFocusBehavioris registered for changes.
-
refreshFocusFeedback
protected void refreshFocusFeedback()
Refreshes focus feedback, i.e. adds or removes feedback.
-
removeViewerFocusedFeedback
protected void removeViewerFocusedFeedback()
Removes viewer focused feedback.
-
-