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,ClientEventScriptNode,FolderNode,GatewayEventScriptNode,ModuleNode,PipelineNode,ResourceNode,ScriptModuleNode,SessionEventScriptNode,SfcNode,StyleClassNavTreeNode
Simple subclass of AbstractNavTreeNode that has some functions for dealing with project resources represented by the
node
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classprotected static enumNested classes/interfaces inherited from class com.inductiveautomation.ignition.designer.navtree.model.AbstractNavTreeNode
AbstractNavTreeNode.DeleteReason, AbstractNavTreeNode.PopupAction -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final DesignerContextprotected static final AbstractNavTreeNode.PopupActionprotected static final JMenuItemprotected final AbstractNavTreeNode.PopupActionprotected Iconprotected BaseActionprotected static final AbstractNavTreeNode.PopupActionprotected static final JCheckBoxMenuItemprotected static final AbstractNavTreeNode.PopupActionprotected static final JCheckBoxMenuItemprotected final ProjectResourceIdprotected final ResourcePathprotected Booleanprotected static final AbstractNavTreeNode.PopupActionprotected static final JMenuItemFields inherited from class com.inductiveautomation.ignition.designer.navtree.model.AbstractNavTreeNode
bold, children, childrenLoaded, copyAction, copyPathAction, cutAction, deleteAction, depth, discardOverridesAction, icon, italic, log, model, name, parent, pasteAction, renameAction, selectionModel, text, thumbnail, tooltip -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractResourceNavTreeNode(DesignerContext context, ResourcePath path) protectedAbstractResourceNavTreeNode(DesignerContext context, ResourcePath path, boolean isModuleNode) -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidvoidaddBadges(BadgeTreeCellRenderer renderer, boolean selected) Add 'badges' to indicate meta information about this nodeprotected voidaddConcurrentUsersBadges(BadgeTreeCellRenderer renderer, boolean selected) protected voidThis method adds a "Discard Override" menu item when the resource is inherited, otherwise it adds a "Delete" menu item.protected voidprotected voidaddEditActions(JPopupMenu menu) protected voidaddExportMenuItem(JPopupMenu menu) protected voidaddInheritedBadge(BadgeTreeCellRenderer renderer, boolean selected) protected voidaddNotesBadge(BadgeTreeCellRenderer renderer, boolean selected) protected voidaddOverriddenBadge(BadgeTreeCellRenderer renderer, boolean selected) protected voidprotected final voidprotected voidaddProtectMenuItem(JPopupMenu menu) protected voidaddRevertMenuItem(JPopupMenu menu) protected booleanbooleancanCopy(List<AbstractNavTreeNode> selectedChildren) Can this edit action handler handle the copy action, given its current selection? Note that if this andAbstractNavTreeNode.canDelete(java.util.List)both return true, the cut action will also be enabled.booleancanDelete(List<AbstractNavTreeNode> selectedChildren) Can this edit action handler handle the delete action, given its current selection? Note that if this andAbstractNavTreeNode.canCopy(java.util.List)both return true, the cut action will also be enabled.voidImplement this to commit the resource that is open for editing.voidgatherChildrenIds(Project 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)protected List<ResourcePath>protected AbstractNavTreeNode.PopupActionprotected Stringprotected StringgetInvalidNameErrorMessage(String attemptedName) protected Iterable<AbstractNavTreeNode.PopupAction>Provide a list ofPopupActions that will be set up byAbstractNavTreeNode.setupEditActions(javax.swing.tree.TreePath[], java.util.List<com.inductiveautomation.ignition.designer.navtree.model.AbstractNavTreeNode>); that is, will have theirAbstractNavTreeNode.PopupAction.selectionandAbstractNavTreeNode.PopupAction.actionHandlerset.The ProjectResource that this node representsprotected static booleaninherited(List<AbstractNavTreeNode> nodes) voidinstall(AbstractNavTreeNode parent) booleanbooleanOverride this and return true if you want your node's text to be editable.booleanOverride to return true if you want this node to be an edit action handler for its children.booleanTrue if this node's resource is inherited from a parent project.booleanisLocal()protected booleanisOpen()Override this to indicate whether or not this resource is open for editingbooleanTrue if this node's resource is present and overriding a resource from a parent project.booleanprotected booleanbooleanUsed to display protected Icon for project resources that are able to be protected.protected booleanOverride this if you want special naming rules for your node.protected voidmodifyOverrideAction(BaseAction baseAction) If subclasses need to modify the#overrideActionthey can modify this method.protected static booleannotInherited(List<AbstractNavTreeNode> nodes) voidCalled when this node is double-clicked on.voidCalled after this node has been edited in the tree.protected voidonResourceModified(ProjectResource resource) AbstractResourceNavTreeNode adds a project listener to listen for changes to this node's resource.protected voidopen()Implement this to open this resource up for editingprotected static booleanoverridden(List<AbstractNavTreeNode> nodes) override()voidrevert()voidselectChild(ResourcePath... ids) In an invoke later, tries to find a child resource-backed node with the given id to select.voidsetOverrideEnabled(boolean enabled) voidsetProtected(boolean prot) voidsetRevertedResourcePath(ResourcePath resourcePath) protected voidsetupEditActions(TreePath[] paths, List<AbstractNavTreeNode> selection) Searches for a common edit action handling parent, and initializes each popup action by callingAbstractNavTreeNode.PopupAction.setSelection(AbstractNavTreeNode, AbstractNavTreeNode, List)protected voidCalled when the node is removed from the tree.Methods inherited from class com.inductiveautomation.ignition.designer.navtree.model.AbstractNavTreeNode
addEditActions, canDrag, canDrop, canPaste, checkChildren, children, confirmDelete, createResourceCopy, debug, debug, dispatchSelectionEvent, doCopy, doCut, doDelete, doPaste, expand, expandAndSelect, findChild, findCommonEditActionHandler, findDropHandler, findEditActionHandler, forceChildrenReload, getAllowsChildren, getChildAt, getChildCount, getClipboard, getDepth, getExpandedIcon, getIcon, getIndex, getModel, getName, getParent, getSelectionModel, getSortOrder, getText, getThumbnail, getTooltip, getWorkspaceName, initPopupMenu, isBold, isItalic, isLeaf, isModuleNode, isSelected, isTopLevelNode, isValidName, iterator, loadChildren, newLogger, notifyChildNameChanged, onChildrenSelected, onSelected, pathToRoot, performOnAllChildren, recreate, recreate, refresh, reload, select, select, setBold, setChildren, setIcon, setItalic, setName, setText, setThumbnail, setTooltip, showPopupMenu, toString, uninstallChildren, useThumbnailTooltip, visitIfLoadedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
context
-
resourcePath
-
resourceId
-
inheritedIcon
-
restricted
-
protectedAction
-
protectedMenuItem
-
overrideEnabledAction
-
overrideEnabledMenuItem
-
revertAction
-
revertMenuItem
-
editDocumentationAction
-
editDocumentationMenuItem
-
overrideAction
-
exportAction
-
-
Constructor Details
-
AbstractResourceNavTreeNode
-
AbstractResourceNavTreeNode
protected AbstractResourceNavTreeNode(@Nonnull DesignerContext context, @Nonnull ResourcePath path, boolean isModuleNode)
-
-
Method Details
-
getProjectResource
The ProjectResource that this node represents -
getResourceId
-
getResourcePath
-
setRevertedResourcePath
-
setProtected
public void setProtected(boolean prot) -
setOverrideEnabled
public void setOverrideEnabled(boolean enabled) -
uninstall
protected void uninstall()Description copied from class:AbstractNavTreeNodeCalled when the node is removed from the tree. Override to provide meaningful implementation.- Overrides:
uninstallin classAbstractNavTreeNode
-
isOverrideEnabled
public boolean isOverrideEnabled() -
isProtectedEnabled
protected boolean isProtectedEnabled() -
isValid
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
-
notInherited
-
inherited
-
isLocal
public boolean isLocal() -
isChanged
public boolean isChanged() -
isEditable
public boolean isEditable()Description copied from class:AbstractNavTreeNodeOverride this and return true if you want your node's text to be editable. SeeAbstractNavTreeNode.onEdit(String)- Overrides:
isEditablein classAbstractNavTreeNode
-
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:AbstractNavTreeNodeCalled when this node is double-clicked on.- Overrides:
onDoubleClickin classAbstractNavTreeNode
-
onEdit
Description copied from class:AbstractNavTreeNodeCalled after this node has been edited in the tree.- Overrides:
onEditin classAbstractNavTreeNode
-
alterName
-
getInvalidNameErrorMessage
-
getAdditionalExportIds
-
getPopupActions
Description copied from class:AbstractNavTreeNodeProvide a list ofPopupActions that will be set up byAbstractNavTreeNode.setupEditActions(javax.swing.tree.TreePath[], java.util.List<com.inductiveautomation.ignition.designer.navtree.model.AbstractNavTreeNode>); that is, will have theirAbstractNavTreeNode.PopupAction.selectionandAbstractNavTreeNode.PopupAction.actionHandlerset.- Overrides:
getPopupActionsin classAbstractNavTreeNode
-
setupEditActions
Description copied from class:AbstractNavTreeNodeSearches for a common edit action handling parent, and initializes each popup action by callingAbstractNavTreeNode.PopupAction.setSelection(AbstractNavTreeNode, AbstractNavTreeNode, List)- Overrides:
setupEditActionsin classAbstractNavTreeNode
-
addEditActions
- Overrides:
addEditActionsin classAbstractNavTreeNode
-
addActionsForInheritedNodes
-
addOverrideOrDiscardOverridesMenuItem
-
modifyOverrideAction
If subclasses need to modify the#overrideActionthey can modify this method. As an example theFolderNodeclass 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
-
addRevertMenuItem
-
addProtectMenuItem
-
addOverrideEnabledMenuItem
-
addDocumentationMenuItem
-
addDeleteOrDiscardOverridesMenuItem
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:AbstractNavTreeNodeUsed 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:
isRestrictedin classAbstractNavTreeNode
-
selectChild
In an invoke later, tries to find a child resource-backed node with the given id to select. -
gatherChildrenIds
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:AbstractNavTreeNodeOverride to return true if you want this node to be an edit action handler for its children.- Overrides:
isEditActionHandlerin classAbstractNavTreeNode
-
canDelete
Description copied from class:AbstractNavTreeNodeCan this edit action handler handle the delete action, given its current selection? Note that if this andAbstractNavTreeNode.canCopy(java.util.List)both return true, the cut action will also be enabled.- Overrides:
canDeletein classAbstractNavTreeNode
-
canCopy
Description copied from class:AbstractNavTreeNodeCan this edit action handler handle the copy action, given its current selection? Note that if this andAbstractNavTreeNode.canDelete(java.util.List)both return true, the cut action will also be enabled.- Overrides:
canCopyin classAbstractNavTreeNode
-
onResourceModified
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 -
getDeleteAction
- Overrides:
getDeleteActionin classAbstractNavTreeNode
-
getInheritanceString
-
override