Class AbstractDesignableWorkspace

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JTabbedPane
com.jidesoft.swing.JideTabbedPane
com.inductiveautomation.ignition.designer.designable.AbstractDesignableWorkspace
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, SwingConstants
Direct Known Subclasses:
AbstractBlockWorkspace, DefaultDesignableWorkspace, StandaloneWorkspace

public abstract class AbstractDesignableWorkspace extends com.jidesoft.swing.JideTabbedPane

This abstract workspace provides the "guts" of workspaces that use a drag-and-drop style interface. This class extends from JideTabbedPane, so multiple drag-and-drop interfaces may be open at once.

Most workspaces that want this functionality should subclass from DefaultDesignableWorkspace instead of this one.

See Also:
  • Field Details

    • DESIGNABLE_CONTAINER_ICON_KEY

      public static final String DESIGNABLE_CONTAINER_ICON_KEY
      See Also:
    • DESIGNTIME_PROPNAME

      public static final String DESIGNTIME_PROPNAME
      See Also:
    • openContainers

      protected transient Map<DesignableContainer,DesignPanel> openContainers
      Holds all of the currently editing containers
    • selectionTool

      protected transient IDesignTool selectionTool
      The standard tool - used for moving, resizing, and marquee selection
    • currentTool

      protected transient IDesignTool currentTool
      The currently selected tool.
    • selectionControl

      protected transient ISelectionControl selectionControl
      The current "selection control" - which is what typically adds handles to the selected components. May be null.
    • listeners

      protected transient List<DesignableWorkspaceListener> listeners
      These listeners are notified when things happen to the designable workspace such as switching selected designable containers.
    • selectedItems

      protected transient List<JComponent> selectedItems
      The currently selected components
    • log

      protected transient LoggerEx log
  • Constructor Details

    • AbstractDesignableWorkspace

      protected AbstractDesignableWorkspace()
  • Method Details

    • setupWorkspaceHomeTab

      protected void setupWorkspaceHomeTab(Icon icon, JComponent welcomePanel)
    • createWorkspaceHomeTab

      protected Optional<JComponent> createWorkspaceHomeTab()
    • openArbitraryTab

      public void openArbitraryTab(JComponent component, Icon icon, String tabText, String toolTipText)
    • newSelectionTool

      protected IDesignTool newSelectionTool()
    • updateStatusBarText

      public void updateStatusBarText(Point location, int inputMask)
    • setStatusMessage

      protected abstract void setStatusMessage(String message)
      Called when the tool or design panel has a status message to display. Should be some sort of passive status display, not a popup.
    • newLogger

      protected LoggerEx newLogger()
    • getSelectionTool

      public IDesignTool getSelectionTool()
    • setSelectedContainer

      public void setSelectedContainer(DesignableContainer container)
      Selects this designable container's tab.
      Parameters:
      container - the container to get the tab for
      Throws:
      IllegalArgumentException - if the container is not open.
    • getSelectedContainer

      public DesignableContainer getSelectedContainer()
      The currently selected designable container, or null if none is selected
    • getSelectedDesignPanel

      @Nullable public DesignPanel getSelectedDesignPanel()
    • getSelectedItems

      public List<JComponent> getSelectedItems()
      Returns the current selection list. (defensive copy)
    • getSelectedItemsCount

      public int getSelectedItemsCount()
      The number of items currently selected
    • setSelectedItems

      public void setSelectedItems(JComponent... newSelection)
      Sets the selection to the components in the list
    • setSelectedItems

      public void setSelectedItems(List<JComponent> newSelection)
      Sets the selection to the items in the list.
    • toggleItemSelection

      public void toggleItemSelection(JComponent... newSelection)
    • isOpen

      public boolean isOpen(DesignableContainer container)
    • isOpen

      public boolean isOpen(ResourcePath resourcePath)
    • getOpenContainerCount

      public int getOpenContainerCount()
    • isDesignTime

      public boolean isDesignTime()
    • isZoomingEnabled

      public boolean isZoomingEnabled()
      Returns whether or not the zoom level of design panels can be altered. Default is always true.
    • setDesignTime

      public void setDesignTime(boolean designing)
    • findDesignableContainer

      public DesignableContainer findDesignableContainer(ResourcePath resourcePath)
      Finds a DesignableContainer that is currently open for editing in this workspace.
      Parameters:
      resourcePath - The resource path of the resource container to look for
      Returns:
      The container with the given id and scope, or null if that resource isn't currently open.
    • getTabToolTip

      @Nullable protected abstract String getTabToolTip(@Nonnull DesignableContainer container)
      Return the tooltip for the tab representing the given container
    • getTabPopupMenu

      @Nullable protected JPopupMenu getTabPopupMenu(@Nonnull DesignableContainer container)
      Return the popup menu to display for a given tab on right click
      Parameters:
      container - a selected container
      Returns:
      the constructed menu (default has close, close others, and close all actions) or null for no menu
    • open

      protected void open(DesignableContainer container)
    • newDesignPanel

      protected DesignPanel newDesignPanel(DesignableContainer container)
    • close

      protected void close(DesignableContainer container)
      Closes the DesignPanel for the given container, if it is open.
    • removeTab

      protected void removeTab(DesignableContainer container)
      Closes the DesignPanel for the given container without saving. Used for reconnect
    • getCurrentTool

      public IDesignTool getCurrentTool()
    • setCurrentTool

      public void setCurrentTool(IDesignTool newTool)
    • onCurrentToolChanged

      protected void onCurrentToolChanged(IDesignTool oldTool, IDesignTool newTool)
      Provides AbstractDesignableWorkspace subclasses a way to be notified when the design tool has been changed.
    • updateSelectionControl

      public void updateSelectionControl()

      Called when the selection changes or the design tool changes (since the ISelectionControl is created by the IDesignTool), or the design tool notifies the system that it has changed itself.

      Allows the currently installed IDesignTool to create a new ISelectionControl (handle set) and install it on the selection.

    • getSelectionControl

      public ISelectionControl getSelectionControl()
    • onBeforeClose

      protected boolean onBeforeClose(DesignableContainer container)
      Provides subclasses a chance to intercept when a tab is closed. Return false to prevent the tab from closing.
    • onClose

      protected void onClose(DesignableContainer container)
      Provides subclasses a chance to handle when a tab is closed
    • onEditorPaint

      public void onEditorPaint(DesignPanel panel, Graphics g)
      Provides subclasses a chance to paint onto each tab's DesignPanel background
    • getEditorBackground

      public Color getEditorBackground()
      The background color for the design panels
    • getGridSettings

      public abstract IGridSettings getGridSettings()
      Returns the settings for the grid/guide/snapping system
    • getSelectionPopupMenu

      public JPopupMenu getSelectionPopupMenu(List<JComponent> component)
      Gives the workspace a chance to provide a popup menu for the currently selected items
    • updateMouseLocation

      public void updateMouseLocation(int x, int y)
      Called when the mouse moves over the design area. Coordinates will be (-1, -1) when the mouse leaves the area.
    • getItemDelegate

      public abstract DesignableDelegate getItemDelegate(DesignableContainer container)
      Called to provide the DesignableDelegate that is appropriate for the given DesignableContainer
    • restrictMovementToParentBounds

      public boolean restrictMovementToParentBounds()
    • getAcceptableDropActions

      public int getAcceptableDropActions(DropTargetDragEvent event)
    • findDropTarget

      public JComponent findDropTarget(List<JComponent> itemsUnderDrop, DropTargetDragEvent event)
      Override to allow dropping onto items
    • handleDrop

      public boolean handleDrop(Object droppedOn, DropTargetDropEvent event)
    • handleDoubleClick

      public void handleDoubleClick(Point p)
      Called when the user double-clicks using the selection tool.
    • handleEditClick

      public void handleEditClick(Point p)
      Called when the user edit-clicks a component (clicks on an already selected component)
    • addDesignableWorkspaceListener

      public void addDesignableWorkspaceListener(DesignableWorkspaceListener listener)
    • removeDesignableWorkspaceListener

      public void removeDesignableWorkspaceListener(DesignableWorkspaceListener listener)
    • paintInteractionLayerLow

      public void paintInteractionLayerLow(Graphics2D g, DesignableContainer c)
    • paintInteractionLayerHigh

      public void paintInteractionLayerHigh(Graphics2D g, DesignableContainer c)