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 class
protected static enum
Nested classes/interfaces inherited from class com.inductiveautomation.ignition.designer.navtree.model.AbstractNavTreeNode
AbstractNavTreeNode.DeleteReason, AbstractNavTreeNode.PopupAction
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final DesignerContext
protected static final AbstractNavTreeNode.PopupAction
protected static final JMenuItem
protected final AbstractNavTreeNode.PopupAction
protected Icon
protected BaseAction
protected static final AbstractNavTreeNode.PopupAction
protected static final JCheckBoxMenuItem
protected static final AbstractNavTreeNode.PopupAction
protected static final JCheckBoxMenuItem
protected final ProjectResourceId
protected final ResourcePath
protected Boolean
protected static final AbstractNavTreeNode.PopupAction
protected static final JMenuItem
Fields 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
ConstructorsModifierConstructorDescriptionprotected
AbstractResourceNavTreeNode
(DesignerContext context, ResourcePath path) protected
AbstractResourceNavTreeNode
(DesignerContext context, ResourcePath path, boolean isModuleNode) -
Method Summary
Modifier and TypeMethodDescriptionprotected final void
void
addBadges
(BadgeTreeCellRenderer renderer, boolean selected) Add 'badges' to indicate meta information about this nodeprotected void
addConcurrentUsersBadges
(BadgeTreeCellRenderer renderer, boolean selected) protected void
This method adds a "Discard Override" menu item when the resource is inherited, otherwise it adds a "Delete" menu item.protected void
protected void
addEditActions
(JPopupMenu menu) protected void
addExportMenuItem
(JPopupMenu menu) protected void
addInheritedBadge
(BadgeTreeCellRenderer renderer, boolean selected) protected void
addNotesBadge
(BadgeTreeCellRenderer renderer, boolean selected) protected void
addOverriddenBadge
(BadgeTreeCellRenderer renderer, boolean selected) protected void
protected final void
protected void
addProtectMenuItem
(JPopupMenu menu) protected void
addRevertMenuItem
(JPopupMenu menu) protected boolean
boolean
canCopy
(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.boolean
canDelete
(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.void
Implement this to commit the resource that is open for editing.void
gatherChildrenIds
(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.PopupAction
protected String
protected String
getInvalidNameErrorMessage
(String attemptedName) protected Iterable<AbstractNavTreeNode.PopupAction>
Provide a list ofPopupAction
s 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.selection
andAbstractNavTreeNode.PopupAction.actionHandler
set.The ProjectResource that this node representsprotected static boolean
inherited
(List<AbstractNavTreeNode> nodes) void
install
(AbstractNavTreeNode parent) boolean
boolean
Override this and return true if you want your node's text to be editable.boolean
Override to return true if you want this node to be an edit action handler for its children.boolean
True if this node's resource is inherited from a parent project.boolean
isLocal()
protected boolean
isOpen()
Override this to indicate whether or not this resource is open for editingboolean
True if this node's resource is present and overriding a resource from a parent project.boolean
protected boolean
boolean
Used to display protected Icon for project resources that are able to be protected.protected boolean
Override this if you want special naming rules for your node.protected void
modifyOverrideAction
(BaseAction baseAction) If subclasses need to modify the#overrideAction
they can modify this method.protected static boolean
notInherited
(List<AbstractNavTreeNode> nodes) void
Called when this node is double-clicked on.void
Called after this node has been edited in the tree.protected void
onResourceModified
(ProjectResource resource) AbstractResourceNavTreeNode adds a project listener to listen for changes to this node's resource.protected void
open()
Implement this to open this resource up for editingprotected static boolean
overridden
(List<AbstractNavTreeNode> nodes) override()
void
revert()
void
selectChild
(ResourcePath... ids) In an invoke later, tries to find a child resource-backed node with the given id to select.void
setOverrideEnabled
(boolean enabled) void
setProtected
(boolean prot) void
setRevertedResourcePath
(ResourcePath resourcePath) protected void
setupEditActions
(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 void
Called 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, visitIfLoaded
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods 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:AbstractNavTreeNode
Called when the node is removed from the tree. Override to provide meaningful implementation.- Overrides:
uninstall
in 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:AbstractNavTreeNode
Override this and return true if you want your node's text to be editable. SeeAbstractNavTreeNode.onEdit(String)
- Overrides:
isEditable
in 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:AbstractNavTreeNode
Called when this node is double-clicked on.- Overrides:
onDoubleClick
in classAbstractNavTreeNode
-
onEdit
Description copied from class:AbstractNavTreeNode
Called after this node has been edited in the tree.- Overrides:
onEdit
in classAbstractNavTreeNode
-
alterName
-
getInvalidNameErrorMessage
-
getAdditionalExportIds
-
getPopupActions
Description copied from class:AbstractNavTreeNode
Provide a list ofPopupAction
s 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.selection
andAbstractNavTreeNode.PopupAction.actionHandler
set.- Overrides:
getPopupActions
in classAbstractNavTreeNode
-
setupEditActions
Description copied from class:AbstractNavTreeNode
Searches for a common edit action handling parent, and initializes each popup action by callingAbstractNavTreeNode.PopupAction.setSelection(AbstractNavTreeNode, AbstractNavTreeNode, List)
- Overrides:
setupEditActions
in classAbstractNavTreeNode
-
addEditActions
- Overrides:
addEditActions
in classAbstractNavTreeNode
-
addActionsForInheritedNodes
-
addOverrideOrDiscardOverridesMenuItem
-
modifyOverrideAction
If subclasses need to modify the#overrideAction
they can modify this method. As an example theFolderNode
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
-
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: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 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:AbstractNavTreeNode
Override to return true if you want this node to be an edit action handler for its children.- Overrides:
isEditActionHandler
in classAbstractNavTreeNode
-
canDelete
Description copied from class:AbstractNavTreeNode
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.- Overrides:
canDelete
in classAbstractNavTreeNode
-
canCopy
Description copied from class:AbstractNavTreeNode
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.- Overrides:
canCopy
in 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:
getDeleteAction
in classAbstractNavTreeNode
-
getInheritanceString
-
override