Class ActionFactory

java.lang.Object
org.netbeans.api.visual.action.ActionFactory

public final class ActionFactory extends Object
The factory class of all built-in actions. Action creation usually requires some parameter like decorator (cares about the visualization) and provider (cares about the logic of an action).

Instances of the built-in actions could be shared by multiple widgets.

  • Method Details

    • createAcceptAction

      public static WidgetAction createAcceptAction(AcceptProvider provider)
      Creates a accept action with a specified accept logic provider.
      Parameters:
      provider - the accept logic provider
      Returns:
      the accept action
    • createActionMapAction

      public static WidgetAction createActionMapAction()
      Creates an action which handles keys and popup menu. The key-to-action binding is obtained from the InputMap of a view JComponent of a scene. The actions for popup menu are obtained from the ActionMap of a view JComponent of a scene.
      Returns:
      the action-map action
    • createActionMapAction

      public static WidgetAction createActionMapAction(InputMap inputMap, ActionMap actionMap)
      Creates an action which handles keys and popup menu. The key-to-action binding and popup menu items are obtained from specified ActionMap and InputMap.
      Parameters:
      inputMap - the input map
      actionMap - the action map
      Returns:
      the action-map action
    • createAddRemoveControlPointAction

      public static WidgetAction createAddRemoveControlPointAction()
      Creates a add-remove control point action with a default sensitivity. The action is assigned to a FreeConnectionWidget.
      Returns:
      the add-remove control point action
    • createAddRemoveControlPointAction

      public static WidgetAction createAddRemoveControlPointAction(double createSensitivity, double deleteSensitivity)
      Creates a add-remove control point action with a specified sensitivity.
      Parameters:
      createSensitivity - the create sensitivity
      deleteSensitivity - the delete sensitivity
      Returns:
      the add-remove control point action
    • createAddRemoveControlPointAction

      public static WidgetAction createAddRemoveControlPointAction(double createSensitivity, double deleteSensitivity, ConnectionWidget.RoutingPolicy routingPolicy)
      Creates a add-remove control point action with a specified sensitivity.
      Parameters:
      createSensitivity - the create sensitivity
      deleteSensitivity - the delete sensitivity
      routingPolicy - the routing policy that is automatically set to a connection widget with control points modified by this action; if null, then routing policy is not set
      Returns:
      the add-remove control point action
      Since:
      2.9
    • createAlignWithMoveAction

      public static WidgetAction createAlignWithMoveAction(LayerWidget collectionLayer, LayerWidget interractionLayer, AlignWithMoveDecorator decorator)
      Creates a align-with move action.
      Parameters:
      collectionLayer - the layer with objects that the alignment is checked against.
      interractionLayer - the interraction layer where the align-with hint lines are placed
      decorator - the align-with move decorator
      Returns:
      the align-with move action
    • createAlignWithMoveAction

      public static WidgetAction createAlignWithMoveAction(LayerWidget collectionLayer, LayerWidget interractionLayer, AlignWithMoveDecorator decorator, boolean outerBounds)
      Creates a align-with move action.
      Parameters:
      collectionLayer - the layer with objects that the alignment is checked against.
      interractionLayer - the interraction layer where the align-with hint lines are placed
      decorator - the align-with move decorator
      outerBounds - if true, then the align-with is check against whole bounds of widgets in collection layer; if false, then the align-with is check against client area (widget bounds without border insets
      Returns:
      the align-with move action
      Since:
      2.7
    • createAlignWithMoveAction

      public static WidgetAction createAlignWithMoveAction(AlignWithWidgetCollector collector, LayerWidget interractionLayer, AlignWithMoveDecorator decorator)
      Creates a align-with move action.
      Parameters:
      collector - the collector of objects that the alignment is checked against.
      interractionLayer - the interraction layer where the align-with hint lines are placed
      decorator - the align-with move decorator
      Returns:
      the align-with move action
    • createAlignWithMoveAction

      public static WidgetAction createAlignWithMoveAction(AlignWithWidgetCollector collector, LayerWidget interractionLayer, AlignWithMoveDecorator decorator, boolean outerBounds)
      Creates a align-with move action.
      Parameters:
      collector - the collector of objects that the alignment is checked against.
      interractionLayer - the interraction layer where the align-with hint lines are placed
      decorator - the align-with move decorator
      outerBounds - if true, then the align-with is check against whole bounds of widgets in collection layer; if false, then the align-with is check against client area (widget bounds without border insets
      Returns:
      the align-with move action
      Since:
      2.7
    • createAlignWithResizeAction

      public static WidgetAction createAlignWithResizeAction(LayerWidget collectionLayer, LayerWidget interractionLayer, AlignWithMoveDecorator decorator)
      Creates a align-with resize action.
      Parameters:
      collectionLayer - the layer with objects that the alignment is checked against.
      interractionLayer - the interraction layer where the align-with hint lines are placed
      decorator - the align-with move decorator
      Returns:
      the align-with resize action
    • createAlignWithResizeAction

      public static WidgetAction createAlignWithResizeAction(LayerWidget collectionLayer, LayerWidget interractionLayer, AlignWithMoveDecorator decorator, boolean outerBounds)
      Creates a align-with resize action.
      Parameters:
      collectionLayer - the layer with objects that the alignment is checked against.
      interractionLayer - the interraction layer where the align-with hint lines are placed
      decorator - the align-with move decorator
      outerBounds - if true, then the align-with is check against whole bounds of widgets in collection layer; if false, then the align-with is check against client area (widget bounds without border insets
      Returns:
      the align-with resize action
      Since:
      2.7
    • createAlignWithResizeAction

      public static WidgetAction createAlignWithResizeAction(AlignWithWidgetCollector collector, LayerWidget interractionLayer, AlignWithMoveDecorator decorator)
      Creates a align-with resize action.
      Parameters:
      collector - the collector of objects that the alignment is checked against.
      interractionLayer - the interraction layer where the align-with hint lines are placed
      decorator - the align-with move decorator
      Returns:
      the align-with resize action
    • createAlignWithResizeAction

      public static WidgetAction createAlignWithResizeAction(AlignWithWidgetCollector collector, LayerWidget interractionLayer, AlignWithMoveDecorator decorator, boolean outerBounds)
      Creates a align-with resize action.
      Parameters:
      collector - the collector of objects that the alignment is checked against.
      interractionLayer - the interraction layer where the align-with hint lines are placed
      decorator - the align-with move decorator
      outerBounds - if true, then the align-with is check against whole bounds of widgets in collection layer; if false, then the align-with is check against client area (widget bounds without border insets
      Returns:
      the align-with resize action
      Since:
      2.7
    • createConnectAction

      public static WidgetAction createConnectAction(LayerWidget interractionLayer, ConnectProvider provider)
      Creates a connect action with a default decorator.
      Parameters:
      interractionLayer - the interraction layer where the temporary connection is visualization placed.
      provider - the connect logic provider
      Returns:
      the connect action
    • createConnectAction

      public static WidgetAction createConnectAction(ConnectDecorator decorator, LayerWidget interractionLayer, ConnectProvider provider)
      Creates a connect action with a specific decorator.
      Parameters:
      decorator - the connect decorator; if null, then the default decorator is used
      interractionLayer - the interraction layer where the temporary connection is visualization placed.
      provider - the connect logic provider
      Returns:
      the connect action
    • createExtendedConnectAction

      public static WidgetAction createExtendedConnectAction(LayerWidget interractionLayer, ConnectProvider provider)
      Creates an extended connect action with a default decorator. User can invoke the action only with pressed CTRL key.
      Parameters:
      interractionLayer - the interraction layer where the temporary connection is visualization placed.
      provider - the connect logic provider
      Returns:
      the extended connect action
    • createExtendedConnectAction

      public static WidgetAction createExtendedConnectAction(ConnectDecorator decorator, LayerWidget interractionLayer, ConnectProvider provider)
      Creates an extended connect action with a specific decorator. User can invoke the action only with pressed CTRL key.
      Parameters:
      decorator - the connect decorator; if null, then the default decorator is used
      interractionLayer - the interraction layer where the temporary connection is visualization placed.
      provider - the connect logic provider
      Returns:
      the extended connect action
    • createExtendedConnectAction

      public static WidgetAction createExtendedConnectAction(ConnectDecorator decorator, LayerWidget interractionLayer, ConnectProvider provider, int modifiers)
      Creates an extended connect action with a specific decorator which can be invoked only with specified modifiers (usually it is MouseEvent.CTRL_MASK).
      Parameters:
      decorator - the connect decorator; if null, then the default decorator is used
      interractionLayer - the interraction layer where the temporary connection is visualization placed.
      provider - the connect logic provider
      modifiers - the invocation modifiers
      Returns:
      the extended connect action
      Since:
      2.3
    • createEditAction

      public static WidgetAction createEditAction(EditProvider provider)
      Creates an edit action.
      Parameters:
      provider - the edit logic provider.
      Returns:
      the edit action
    • createHoverAction

      public static WidgetAction createHoverAction(HoverProvider provider)
      Creates a hover action using a hover provider. Usually the Scene.createWidgetHoverAction and ObjectScene.createObjectHoverAction methods are used instead of this method.
      Parameters:
      provider - the hover logic provider
      Returns:
      the hover action
    • createHoverAction

      public static WidgetAction createHoverAction(TwoStateHoverProvider provider)
      Creates a hover action using a two-stated hover provider. Usually the Scene.createWidgetHoverAction and ObjectScene.createObjectHoverAction methods are used instead of this method.
      Parameters:
      provider - the two-stated hover logic provider
      Returns:
      the hover action.
    • createInplaceEditorAction

      public static WidgetAction createInplaceEditorAction(TextFieldInplaceEditor editor)
      Creates a text in-place editor action visualized using JTextField.
      Parameters:
      editor - the editor logic
      Returns:
      the in-place editor action
    • createInplaceEditorAction

      public static WidgetAction createInplaceEditorAction(TextFieldInplaceEditor editor, EnumSet<InplaceEditorProvider.ExpansionDirection> expansionDirections)
      Creates a text in-place editor action visualized using JTextField.
      Parameters:
      editor - the editor logic
      expansionDirections - the expansion directions
      Returns:
      the in-place editor action
    • createInplaceEditorAction

      public static <C extends JComponent> WidgetAction createInplaceEditorAction(InplaceEditorProvider<C> provider)
      Creates an in-place editor action for a specific provider.
      Parameters:
      provider - the in-place editor provider
      Returns:
      the in-place editor action
    • createMoveAction

      public static WidgetAction createMoveAction()
      Creates a move action with a default (free) strategy. The action provides movement for a widget where it is assigned.
      Returns:
      the move action
    • createMoveAction

      public static WidgetAction createMoveAction(MoveStrategy strategy, MoveProvider provider)
      Creates a move action with a specified strategy and provider.
      Parameters:
      strategy - the move strategy; if null, then default (free) move strategy is used.
      provider - the move logic provider; if null, then defaual move logic provider is used (provides movement for a widget where it is assigned).
      Returns:
      the move action
    • createFreeMoveControlPointAction

      public static WidgetAction createFreeMoveControlPointAction()
      Creates a move control point (of a connection widget) action with no movement restriction.
      Returns:
      the move control point action
    • createOrthogonalMoveControlPointAction

      public static WidgetAction createOrthogonalMoveControlPointAction()
      Creates a move control point (of a connection widget) action with is used at ConnectionWidget with OrthogonalSearchRouter.
      Returns:
      the move control point action
    • createMoveControlPointAction

      public static WidgetAction createMoveControlPointAction(MoveControlPointProvider provider)
      Creates a move control point (of a connection widget) action with a specified provider.
      Parameters:
      provider - the move control point provider
      Returns:
      the move control point action
    • createMoveControlPointAction

      public static WidgetAction createMoveControlPointAction(MoveControlPointProvider provider, ConnectionWidget.RoutingPolicy routingPolicy)
      Creates a move control point (of a connection widget) action with a specified provider.
      Parameters:
      provider - the move control point provider
      routingPolicy - the routing policy that is automatically set to a connection widget with control points modified by this action; if null, then routing policy is not set
      Returns:
      the move control point action
      Since:
      2.9
    • createPanAction

      public static WidgetAction createPanAction()
      Creates a scene view panning action.
      Returns:
      the pan action
    • createWheelPanAction

      public static WidgetAction createWheelPanAction()
      Creates a scene view panning action using mouse-wheel.
      Returns:
      the wheel pan action
      Since:
      2.7
    • createPopupMenuAction

      public static WidgetAction createPopupMenuAction(PopupMenuProvider provider)
      Creates a popup menu action with a speicied provider.
      Parameters:
      provider - the popup menu provider
      Returns:
      the popup menu action
    • createReconnectAction

      public static WidgetAction createReconnectAction(ReconnectProvider provider)
      Creates a reconnect action with a default decorator.
      Parameters:
      provider - the reconnect logic provider
      Returns:
      the reconnect action
    • createReconnectAction

      public static WidgetAction createReconnectAction(ReconnectDecorator decorator, ReconnectProvider provider)
      Creates a reconnect action with a specific decorator and logic provider.
      Parameters:
      decorator - the reccont decorator
      provider - the reconnect logic provider
      Returns:
      the reconnect action
    • createRectangularSelectAction

      public static WidgetAction createRectangularSelectAction(ObjectScene scene, LayerWidget interractionLayer)
      Creates a rectangular select action for a specified object scene with a default decorator.
      Parameters:
      scene - the object scene which the selection will be controlled by the action
      interractionLayer - the interraction layer where the selection rectangle will be visualized
      Returns:
      the rectangular select action
    • createRectangularSelectAction

      public static WidgetAction createRectangularSelectAction(RectangularSelectDecorator decorator, LayerWidget interractionLayer, RectangularSelectProvider provider)
      Creates a rectangular select action with a specified decorator and logic provider.
      Parameters:
      decorator - the rectangular select decorator
      interractionLayer - the interraction layer where the selection rectangle will be visualized
      provider - the rectangular select logic provider
      Returns:
      the rectangular select action
    • createResizeAction

      public static WidgetAction createResizeAction()
      Creates a resize action with a default (free without any restriction) strategy and default logic provider (the action affect preferredBounds of a widget where it is assigned) default resize control point resolver.
      Returns:
      the resize action
    • createResizeAction

      public static WidgetAction createResizeAction(ResizeStrategy strategy, ResizeProvider provider)
      Creates a resize action with a specified resize strategy and provider and default resize control point resolver.
      Parameters:
      strategy - the resize strategy; if null, then the default (free without any restriction) strategy is used
      provider - the resize logic provider; if null, then the default logic provider is used (the action affect preferredBounds of a widget where it is assigned)
      Returns:
      the resize action
    • createResizeAction

      public static WidgetAction createResizeAction(ResizeStrategy strategy, ResizeControlPointResolver resolver, ResizeProvider provider)
      Creates a resize action with a specified resize strategy and provider.
      Parameters:
      strategy - the resize strategy; if null, then the default (free without any restriction) strategy is used
      resolver - the resize control point resolver; if null, then the default (points are at corners and center of edges) is used
      provider - the resize logic provider; if null, then the default logic provider is used (the action affect preferredBounds of a widget where it is assigned)
      Returns:
      the resize action
    • createSelectAction

      public static WidgetAction createSelectAction(SelectProvider provider, boolean selectOnRightClick)
      Creates a select action. Usually the ObjectScene.createSelectAction method is used instead of this method.
      Parameters:
      provider - the select logic provider
      selectOnRightClick - whether or not to first select the underlying widget with a right-click.
      Returns:
      the select action
    • createSelectAction

      public static WidgetAction createSelectAction(SelectProvider provider)
      Creates a select action. Usually the ObjectScene.createSelectAction method is used instead of this method.
      Parameters:
      provider - the select logic provider
      Returns:
      the select action
    • createContiguousSelectAction

      public static WidgetAction createContiguousSelectAction(ContiguousSelectProvider provider)
      Creates a contiguous select action. Trigger by any left, middle or right mouse-button. If no key-modifier is held, then it behaves as a non-contiguous replace selection. If Shift key-modifier is held, then it behaves as a contiguous replace selection. If Ctrl key-modifier is held, then it behaves as a non-contiguous additive selection. If Ctrl and Shift key-modifiers are held, then it behaves as a contiguous additive selection.
      Parameters:
      provider - the contiguous select logic provider
      Returns:
      the contiguous select action
      Since:
      2.17
    • createSwitchCardAction

      public static WidgetAction createSwitchCardAction(Widget cardLayoutWidget)
      Creates a switch card action with controls an active card of a widget where a card layout is used.
      Parameters:
      cardLayoutWidget - the widget where a card layout is used
      Returns:
      the switch card action
    • createZoomAction

      public static WidgetAction createZoomAction()
      Creates a action that controls a zoom factor of a scene where the action is assigned.
      Returns:
      the zoom action
    • createZoomAction

      public static WidgetAction createZoomAction(double zoomMultiplier, boolean animated)
      Creates a action that controls a zoom factor of a scene where the action is assigned.
      Parameters:
      zoomMultiplier - the zoom multiplier of each zoom step
      animated - if true, then the zoom factor changed is animated
      Returns:
      the zoom action
    • createFreeMoveStrategy

      public static MoveStrategy createFreeMoveStrategy()
      Creates a free (without any restriction) move strategy
      Returns:
      the move strategy
    • createSnapToGridMoveStrategy

      public static MoveStrategy createSnapToGridMoveStrategy(int horizontalGridSize, int verticalGridSize)
      Creates a snap-to-grid move strategy.
      Parameters:
      horizontalGridSize - the horizontal grid size
      verticalGridSize - the vertical grid size
      Returns:
      the move strategy
    • createDefaultMoveProvider

      public static MoveProvider createDefaultMoveProvider()
      Creates a default move provider where the logic controls the preferredLocation of a widget where the action is assigned to.
      Returns:
      the move provider
    • createDefaultAlignWithMoveDecorator

      public static AlignWithMoveDecorator createDefaultAlignWithMoveDecorator()
      Creates a default align-with move decorator.
      Returns:
      the move decorator
    • createFreeMoveControlPointProvider

      public static MoveControlPointProvider createFreeMoveControlPointProvider()
      Creates a free (without any restriction) move control point (of a ConnectionWidget) provider.
      Returns:
      the move control point action
    • createOrthogonalMoveControlPointProvider

      public static MoveControlPointProvider createOrthogonalMoveControlPointProvider()
      Creates a orthogonal move control point provider which is usually used with ConnectionWidget with OrthogonalSearchRouter.
      Returns:
      the move control point provider
    • createDefaultRectangularSelectDecorator

      public static RectangularSelectDecorator createDefaultRectangularSelectDecorator(Scene scene)
      Creates a default rectangular select decorator.
      Parameters:
      scene - the scene where an action is used
      Returns:
      the rectangular select decorator
    • createObjectSceneRectangularSelectProvider

      public static RectangularSelectProvider createObjectSceneRectangularSelectProvider(ObjectScene scene)
      Creates a rectangular select provider which controls a selection of an object scene.
      Parameters:
      scene - the object scene where an action is used
      Returns:
      the rectangular select provider
    • createDefaultConnectDecorator

      public static ConnectDecorator createDefaultConnectDecorator()
      Creates a default connect decorator
      Returns:
      the connect decorator
    • createDefaultReconnectDecorator

      public static ReconnectDecorator createDefaultReconnectDecorator()
      Creates a default reconnect decorator
      Returns:
      the reconnect decorator
    • createFreeResizeStategy

      public static ResizeStrategy createFreeResizeStategy()
      Creates a free (without any restriction) resize strategy
      Returns:
      the resize strategy
    • createDefaultResizeProvider

      public static ResizeProvider createDefaultResizeProvider()
      Creates a default resize provider which controls preferredBounds of a widget where an action is assigned.
      Returns:
      the resize provider
    • createDefaultResizeControlPointResolver

      public static ResizeControlPointResolver createDefaultResizeControlPointResolver()
      Creates a default resize control point resolver which is used in resize action.
      Returns:
      the resize control point resolver
    • createCycleObjectSceneFocusAction

      public static WidgetAction createCycleObjectSceneFocusAction()
      Creates a cycle focus action which switches focused object on a object scene.
      Returns:
      the cycle object scene focus action
    • createCycleFocusAction

      public static WidgetAction createCycleFocusAction(CycleFocusProvider provider)
      Creates a cycle focus action.
      Parameters:
      provider - the cycle focus provider
      Returns:
      the cycle focus action
    • createForwardKeyEventsAction

      public static WidgetAction createForwardKeyEventsAction(Widget forwardToWidget, String forwardToTool)
      This action is used for forwarding key events to another widget. Usually it could be used to forwarding a key event from a node widget to node-label widget when a scene is using process-focused-widget-and-its-parents event processing type.
      Parameters:
      forwardToWidget - the widget to which events are forwarded
      forwardToTool - the tool to which events are forwarded; if null, then default action chain is used
      Returns:
      the forward key events action; assign this action to widget from which the forwarding should be done
    • getInplaceEditorController

      public static InplaceEditorProvider.EditorController getInplaceEditorController(WidgetAction inplaceEditorAction)
      Returns an editor controller for a specified inplace-editor-action created by ActionFactory.createInplaceEditorAction method.
      Parameters:
      inplaceEditorAction - the inplace-editor action
      Returns:
      the editor controller
    • createCenteredZoomAction

      public static WidgetAction createCenteredZoomAction(double zoomMultiplier)
      Creates a action that controls a zoom factor of a scene where the action is assigned. During zooming the view will be centered still.
      Parameters:
      zoomMultiplier - the zoom multiplier
      Returns:
      the zoom action
    • createMouseCenteredZoomAction

      public static WidgetAction createMouseCenteredZoomAction(double zoomMultiplier)
      Creates a action that controls a zoom factor of a scene where the action is assigned. During zooming the view will be centered to the mouse cursor.
      Parameters:
      zoomMultiplier - the zoom multiplier
      Returns:
      the zoom action
      Since:
      2.3