Class AbstractResourceNavTreeNode

java.lang.Object
com.inductiveautomation.ignition.designer.navtree.model.AbstractNavTreeNode
com.inductiveautomation.ignition.designer.navtree.model.AbstractResourceNavTreeNode
All Implemented Interfaces:
Iterable<AbstractNavTreeNode>, TreeNode
Direct Known Subclasses:
AbstractTopLevelContainerNode, ClientScriptNode, FolderNode, PipelineNode, ResourceNode, ScriptModuleNode, SfcNode, StyleClassNavTreeNode

public abstract class AbstractResourceNavTreeNode extends AbstractNavTreeNode
Simple subclass of AbstractNavTreeNode that has some functions for dealing with project resources represented by the node
  • Field Details

  • Constructor Details

    • AbstractResourceNavTreeNode

      protected AbstractResourceNavTreeNode(@NonNull DesignerContext context, @NonNull ResourcePath path)
    • AbstractResourceNavTreeNode

      protected AbstractResourceNavTreeNode(@NonNull DesignerContext context, @NonNull ResourcePath path, boolean isModuleNode)
  • Method Details

    • addBadges

      public void addBadges(BadgeTreeCellRenderer renderer, boolean selected)
      Description copied from class: AbstractNavTreeNode
      Add 'badges' to indicate meta information about this node
      Overrides:
      addBadges in class AbstractNavTreeNode
      Parameters:
      renderer - the renderer; call BadgeTreeCellRenderer.addBadge(Badge) to add your badge(s)
      selected - the state of this node
    • addConcurrentUsersBadges

      protected void addConcurrentUsersBadges(BadgeTreeCellRenderer renderer, boolean selected)
    • addNotesBadge

      protected void addNotesBadge(BadgeTreeCellRenderer renderer, boolean selected)
    • getProjectResource

      public Optional<Resource> getProjectResource()
      The ProjectResource that this node represents
    • getResourceId

      public @NonNull ResourceId getResourceId()
    • getResourcePath

      public @NonNull ResourcePath getResourcePath()
    • setRevertedResourcePath

      public void setRevertedResourcePath(ResourcePath resourcePath)
    • setProtected

      public void setProtected(boolean prot)
    • setOverrideEnabled

      public void setOverrideEnabled(boolean enabled)
    • install

      public void install(AbstractNavTreeNode parent)
      Overrides:
      install in class AbstractNavTreeNode
    • uninstall

      protected void uninstall()
      Description copied from class: AbstractNavTreeNode
      Called when the node is removed from the tree. Override to provide meaningful implementation.
      Overrides:
      uninstall in class AbstractNavTreeNode
    • isOverrideEnabled

      public boolean isOverrideEnabled()
    • isProtectedEnabled

      protected boolean isProtectedEnabled()
    • isValid

      protected boolean isValid(String name)
      Override this if you want special naming rules for your node. Note that project imports assume RESOURCE_NAME_PATTERN is valid for all resource types. Write unit tests for overrides.
      Parameters:
      name - name to evaluate
      Returns:
      true if matches the pattern
    • isInherited

      public boolean isInherited()
      True if this node's resource is inherited from a parent project.
    • isOverridden

      public boolean isOverridden()
      True if this node's resource is present and overriding a resource from a parent project.
    • overridden

      protected static boolean overridden(List<AbstractNavTreeNode> nodes)
    • notInherited

      protected static boolean notInherited(List<AbstractNavTreeNode> nodes)
    • inherited

      protected static boolean inherited(List<AbstractNavTreeNode> nodes)
    • isLocal

      public boolean isLocal()
    • isChanged

      public boolean isChanged()
    • isEditable

      public boolean isEditable()
      Description copied from class: AbstractNavTreeNode
      Override this and return true if you want your node's text to be editable. See AbstractNavTreeNode.onEdit(String)
      Overrides:
      isEditable in class AbstractNavTreeNode
    • isOpen

      protected boolean isOpen()
      Override this to indicate whether or not this resource is open for editing
    • open

      protected void open()
      Implement this to open this resource up for editing
    • commitIfOpen

      public void commitIfOpen()
      Implement this to commit the resource that is open for editing.
    • revert

      public void revert()
    • editDocumentation

      public void editDocumentation()
    • onDoubleClick

      public void onDoubleClick()
      Description copied from class: AbstractNavTreeNode
      Called when this node is double-clicked on.
      Overrides:
      onDoubleClick in class AbstractNavTreeNode
    • onEdit

      public void onEdit(String newTextValue)
      Description copied from class: AbstractNavTreeNode
      Called after this node has been edited in the tree.
      Overrides:
      onEdit in class AbstractNavTreeNode
    • alterName

      protected boolean alterName(String newTextValue)
    • getInvalidNameErrorMessage

      protected String getInvalidNameErrorMessage(String attemptedName)
    • getAdditionalExportIds

      protected List<ResourcePath> getAdditionalExportIds()
    • getPopupActions

      protected Iterable<AbstractNavTreeNode.PopupAction> getPopupActions()
      Description copied from class: AbstractNavTreeNode
      Overrides:
      getPopupActions in class AbstractNavTreeNode
    • setupEditActions

      protected void setupEditActions(TreePath[] paths, List<AbstractNavTreeNode> selection)
      Description copied from class: AbstractNavTreeNode
      Searches for a common edit action handling parent, and initializes each popup action by calling AbstractNavTreeNode.PopupAction.setSelection(AbstractNavTreeNode, AbstractNavTreeNode, List)
      Overrides:
      setupEditActions in class AbstractNavTreeNode
    • addEditActions

      protected void addEditActions(JPopupMenu menu)
      Overrides:
      addEditActions in class AbstractNavTreeNode
    • addActionsForInheritedNodes

      protected final void addActionsForInheritedNodes(JPopupMenu menu)
    • addOverrideOrDiscardOverridesMenuItem

      protected final void addOverrideOrDiscardOverridesMenuItem(JPopupMenu menu)
    • modifyOverrideAction

      protected void modifyOverrideAction(BaseAction baseAction)
      If subclasses need to modify the #overrideAction they can modify this method.

      As an example the FolderNode class needs to modify the general text that's displayed to a more specific text related to use as it relates to the folder, such as turning a singular noun to a plural, since folders can contain more than one items to override.

    • addExportMenuItem

      protected void addExportMenuItem(JPopupMenu menu)
    • addRevertMenuItem

      protected void addRevertMenuItem(JPopupMenu menu)
    • addProtectMenuItem

      protected void addProtectMenuItem(JPopupMenu menu)
    • addOverrideEnabledMenuItem

      protected void addOverrideEnabledMenuItem(JPopupMenu menu)
    • addDocumentationMenuItem

      protected void addDocumentationMenuItem(JPopupMenu menu)
    • addDeleteOrDiscardOverridesMenuItem

      protected void addDeleteOrDiscardOverridesMenuItem(JPopupMenu menu)
      This method adds a "Discard Override" menu item when the resource is inherited, otherwise it adds a "Delete" menu item.
      Parameters:
      menu - The menu to which the "Delete" or "Discard Override" action is added
    • isRestricted

      public boolean isRestricted()
      Description copied from class: AbstractNavTreeNode
      Used to display protected Icon for project resources that are able to be protected. This method is overridden in AbstractProtectableResource to return if the the project resource it contains is actually.
      Overrides:
      isRestricted in class AbstractNavTreeNode
    • selectChild

      public void selectChild(ResourcePath... ids)
      In an invoke later, tries to find a child resource-backed node with the given id to select.
    • gatherChildrenIds

      public Collection<ResourcePath> gatherChildrenIds(ResourceCollection project)
      Returns the id of this resource, or if this is a folder, walks down and finds all resources ids under this folder (but not folders themselves)
    • isEditActionHandler

      public boolean isEditActionHandler()
      Description copied from class: AbstractNavTreeNode
      Override to return true if you want this node to be an edit action handler for its children.
      Overrides:
      isEditActionHandler in class AbstractNavTreeNode
    • canDelete

      public boolean canDelete(List<AbstractNavTreeNode> selectedChildren)
      Description copied from class: AbstractNavTreeNode
      Can this edit action handler handle the delete action, given its current selection? Note that if this and AbstractNavTreeNode.canCopy(java.util.List) both return true, the cut action will also be enabled.
      Overrides:
      canDelete in class AbstractNavTreeNode
    • canCopy

      public boolean canCopy(List<AbstractNavTreeNode> selectedChildren)
      Description copied from class: AbstractNavTreeNode
      Can this edit action handler handle the copy action, given its current selection? Note that if this and AbstractNavTreeNode.canDelete(java.util.List) both return true, the cut action will also be enabled.
      Overrides:
      canCopy in class AbstractNavTreeNode
    • onResourceModified

      protected void onResourceModified(Resource resource)
      AbstractResourceNavTreeNode adds a project listener to listen for changes to this node's resource. When it is modified, this will be invoked. If you override, you should invoke super() because it controls the node's italic state for modified resources
    • addOverriddenBadge

      protected void addOverriddenBadge(BadgeTreeCellRenderer renderer, boolean selected)
    • getDeleteAction

      protected @NonNull AbstractNavTreeNode.PopupAction getDeleteAction()
      Overrides:
      getDeleteAction in class AbstractNavTreeNode
    • addInheritedBadge

      protected void addInheritedBadge(BadgeTreeCellRenderer renderer, boolean selected)
    • getInheritanceString

      protected String getInheritanceString()
    • override