Class Actions

java.lang.Object
org.opentrafficsim.editor.Actions

public class Actions extends Object
This class houses all the actions that are made available on the editor. They can be bound to a component with a key-stroke using bind(JComponent, int, Action), or they can be programmatically invoked using invoke(Action).

Copyright (c) 2026-2026 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.

Author:
Wouter Schakel
  • Constructor Details

    • Actions

      public Actions(OtsEditor editor, JTable attributesTable)
      Constructor.
      Parameters:
      editor - editor
      attributesTable - attributes table
  • Method Details

    • setTreeTable

      public void setTreeTable(de.javagl.treetable.JTreeTable treeTable)
      Sets a new tree table as a new file is created or loaded.
      Parameters:
      treeTable - tree table
    • getNodeActions

      public NodeActions getNodeActions()
      Returns the node actions.
      Returns:
      node actions
    • bind

      public static void bind(JComponent component, int state, Action action)
      Binds a key stroke to an action on the component. The key stroke is taken from the action's Action.ACCELERATOR_KEY value.
      Parameters:
      component - component
      state - int, for example JComponent.WHEN_FOCUSED
      action - action
    • invoke

      public static void invoke(Action action)
      Invoke action programmatically. If the action is disabled it will be ignored.
      Parameters:
      action - action to invoke
    • documentListener

      public static DocumentListener documentListener(Runnable runnable)
      Returns a document listener that executes the runnable on any change.
      Parameters:
      runnable - runnable to run on any change
      Returns:
      document listener that executes the runnable on any change
    • showTreeNodeDescription

      public Action showTreeNodeDescription()
      Action to show the description of a tree node. Ignored of the node does not have a description.
      Returns:
      action to show the description of a tree node
    • showTreeNodeInvalid

      public Action showTreeNodeInvalid()
      Action to show the invalid message on a tree node. Ignored if the node is valid.
      Returns:
      action to show the invalid message on a tree node
    • showAttributeDescription

      public Action showAttributeDescription()
      Action to show the description of a tree node. Ignored of the node does not have a description.
      Returns:
      action to show the description of a tree node
    • showAttributeInvalid

      public Action showAttributeInvalid()
      Action to show the invalid message on an attribute. Ignored if the attribute is valid.
      Returns:
      action to show the invalid message on an attribute
    • addNode

      public Action addNode()
      Action to add node.
      Returns:
      action to add node
    • duplicateNode

      public Action duplicateNode()
      Action to duplicate node.
      Returns:
      action to duplicate node
    • deleteNode

      public Action deleteNode()
      Action to delete node.
      Returns:
      action to delete node
    • copyNode

      public Action copyNode()
      Action to copy node.
      Returns:
      action to copy node
    • cutNode

      public Action cutNode()
      Action to cut node.
      Returns:
      action to cut node
    • insertNode

      public Action insertNode()
      Action to insert node.
      Returns:
      action to insert node
    • pasteNode

      public Action pasteNode()
      Action to paste node.
      Returns:
      action to paste node
    • revolveNode

      public Action revolveNode()
      Action to revolve node.
      Returns:
      action to revolve node
    • collapseAll

      public Action collapseAll()
      Action to collapse all.
      Returns:
      action to collapse all
    • expandOrCollapseNode

      public Action expandOrCollapseNode()
      Action to expand or collapse node.
      Returns:
      action to expand or collapse node
    • moveNodeUp

      public Action moveNodeUp()
      Action to move node up.
      Returns:
      action to move node up
    • moveNodeDown

      public Action moveNodeDown()
      Action to move node down.
      Returns:
      action to move node down