Class AbstractResourceNavTreeNode
- java.lang.Object
-
- com.inductiveautomation.ignition.designer.navtree.model.AbstractNavTreeNode
-
- com.inductiveautomation.ignition.designer.navtree.model.AbstractResourceNavTreeNode
-
- All Implemented Interfaces:
java.lang.Iterable<AbstractNavTreeNode>,javax.swing.tree.TreeNode
- Direct Known Subclasses:
AbstractTopLevelContainerNode,ClientEventScriptNode,FolderNode,GatewayEventScriptNode,ModuleNode,PipelineNode,ResourceNode,ScriptModuleNode,SessionEventScriptNode,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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.inductiveautomation.ignition.designer.navtree.model.AbstractNavTreeNode
AbstractNavTreeNode.DeleteReason, AbstractNavTreeNode.PopupAction
-
-
Field Summary
Fields Modifier and Type Field Description protected DesignerContextcontextprotected AbstractNavTreeNode.PopupActionexportActionprotected javax.swing.IconinheritedIconprotected javax.swing.ActionoverrideActionprotected static AbstractNavTreeNode.PopupActionoverrideEnabledActionprotected static javax.swing.JCheckBoxMenuItemoverrideEnabledMenuItemprotected static AbstractNavTreeNode.PopupActionprotectedActionprotected static javax.swing.JCheckBoxMenuItemprotectedMenuItemprotected ProjectResourceIdresourceIdprotected ResourcePathresourcePathprotected java.lang.Booleanrestrictedprotected static AbstractNavTreeNode.PopupActionrevertActionprotected static javax.swing.JMenuItemrevertMenuItem-
Fields inherited from class com.inductiveautomation.ignition.designer.navtree.model.AbstractNavTreeNode
bold, children, childrenLoaded, copyAction, copyPathAction, cutAction, deleteAction, depth, icon, italic, log, model, name, parent, pasteAction, renameAction, selectionModel, text, thumbnail, tooltip
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractResourceNavTreeNode(DesignerContext context, ResourcePath path)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBadges(BadgeTreeCellRenderer renderer, boolean selected)Add 'badges' to indicate meta information about this nodeprotected voidaddConcurrentUsersBadges(BadgeTreeCellRenderer renderer, boolean selected)protected voidaddEditActions(javax.swing.JPopupMenu menu)protected voidaddExportMenuItem(javax.swing.JPopupMenu menu)protected voidaddOverrideEnabledMenuItem(javax.swing.JPopupMenu menu)protected voidaddProtectMenuItem(javax.swing.JPopupMenu menu)protected voidaddRevertMenuItem(javax.swing.JPopupMenu menu)protected booleanalterName(java.lang.String newTextValue)booleancanCopy(java.util.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(java.util.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.voidcommitIfOpen()Implement this to commit the resource that is open for editing.java.util.Collection<ResourcePath>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)javax.swing.IcongetIcon()protected java.lang.StringgetInvalidNameErrorMessage(java.lang.String attemptedName)protected java.lang.Iterable<AbstractNavTreeNode.PopupAction>getPopupActions()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.java.util.Optional<ProjectResource>getProjectResource()The ProjectResource that this node representsProjectResourceIdgetResourceId()ResourcePathgetResourcePath()voidinstall(AbstractNavTreeNode parent)booleanisChanged()booleanisEditable()Override this and return true if you want your node's text to be editable.booleanisInherited()True 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 editingbooleanisOverridden()True if this node's resource is present and overriding a resource from a parent project.booleanisOverrideEnabled()protected booleanisProtectedEnabled()booleanisRestricted()Used to display protected Icon for project resources that are able to be protected.protected booleanisValid(java.lang.String name)Override this if you want special naming rules for your node.voidonDoubleClick()Called when this node is double-clicked on.voidonEdit(java.lang.String newTextValue)Called 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 editingvoidrevert()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(javax.swing.tree.TreePath[] paths, java.util.List<AbstractNavTreeNode> selection)Searches for a common edit action handling parent, and initializes each popup action by callingAbstractNavTreeNode.PopupAction.setSelection(AbstractNavTreeNode, AbstractNavTreeNode, List)protected voiduninstall()Called when the node is removed from the tree.-
Methods inherited from class com.inductiveautomation.ignition.designer.navtree.model.AbstractNavTreeNode
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, getDeleteAction, getDepth, getExpandedIcon, getIndex, getModel, getName, getParent, getSelectionModel, getSortOrder, getText, getThumbnail, getTooltip, getWorkspaceName, initPopupMenu, isBold, isEditActionHandler, isItalic, isLeaf, isSelected, isTopLevelNode, isValidName, iterator, loadChildren, newLogger, notifyChildNameChanged, onChildrenSelected, onSelected, pathToRoot, recreate, recreate, refresh, reload, select, select, setBold, setChildren, setIcon, setItalic, setName, setText, setThumbnail, setTooltip, showPopupMenu, toString, uninstallChildren, useThumbnailTooltip, visitIfLoaded
-
-
-
-
Field Detail
-
context
@Nonnull protected final DesignerContext context
-
resourcePath
@Nonnull protected final ResourcePath resourcePath
-
resourceId
@Nonnull protected final ProjectResourceId resourceId
-
inheritedIcon
protected javax.swing.Icon inheritedIcon
-
restricted
protected java.lang.Boolean restricted
-
protectedAction
protected static final AbstractNavTreeNode.PopupAction protectedAction
-
protectedMenuItem
protected static final javax.swing.JCheckBoxMenuItem protectedMenuItem
-
overrideEnabledAction
protected static final AbstractNavTreeNode.PopupAction overrideEnabledAction
-
overrideEnabledMenuItem
protected static final javax.swing.JCheckBoxMenuItem overrideEnabledMenuItem
-
revertAction
protected static final AbstractNavTreeNode.PopupAction revertAction
-
revertMenuItem
protected static final javax.swing.JMenuItem revertMenuItem
-
overrideAction
protected javax.swing.Action overrideAction
-
exportAction
protected final AbstractNavTreeNode.PopupAction exportAction
-
-
Constructor Detail
-
AbstractResourceNavTreeNode
protected AbstractResourceNavTreeNode(@Nonnull DesignerContext context, @Nonnull ResourcePath path)
-
-
Method Detail
-
addBadges
public void addBadges(BadgeTreeCellRenderer renderer, boolean selected)
Description copied from class:AbstractNavTreeNodeAdd 'badges' to indicate meta information about this node- Overrides:
addBadgesin classAbstractNavTreeNode- Parameters:
renderer- the renderer; callBadgeTreeCellRenderer.addBadge(Badge)to add your badge(s)selected- the state of this node
-
addConcurrentUsersBadges
protected void addConcurrentUsersBadges(BadgeTreeCellRenderer renderer, boolean selected)
-
getProjectResource
public java.util.Optional<ProjectResource> getProjectResource()
The ProjectResource that this node represents
-
getResourceId
@Nonnull public ProjectResourceId getResourceId()
-
getResourcePath
@Nonnull public 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:
installin classAbstractNavTreeNode
-
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
protected boolean isValid(java.lang.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.
-
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()
-
onDoubleClick
public void onDoubleClick()
Description copied from class:AbstractNavTreeNodeCalled when this node is double-clicked on.- Overrides:
onDoubleClickin classAbstractNavTreeNode
-
onEdit
public void onEdit(java.lang.String newTextValue)
Description copied from class:AbstractNavTreeNodeCalled after this node has been edited in the tree.- Overrides:
onEditin classAbstractNavTreeNode
-
alterName
protected boolean alterName(java.lang.String newTextValue)
-
getInvalidNameErrorMessage
protected java.lang.String getInvalidNameErrorMessage(java.lang.String attemptedName)
-
getPopupActions
protected java.lang.Iterable<AbstractNavTreeNode.PopupAction> 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
protected void setupEditActions(javax.swing.tree.TreePath[] paths, java.util.List<AbstractNavTreeNode> selection)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
protected void addEditActions(javax.swing.JPopupMenu menu)
- Overrides:
addEditActionsin classAbstractNavTreeNode
-
addExportMenuItem
protected void addExportMenuItem(javax.swing.JPopupMenu menu)
-
addRevertMenuItem
protected void addRevertMenuItem(javax.swing.JPopupMenu menu)
-
addProtectMenuItem
protected void addProtectMenuItem(javax.swing.JPopupMenu menu)
-
addOverrideEnabledMenuItem
protected void addOverrideEnabledMenuItem(javax.swing.JPopupMenu menu)
-
getIcon
public javax.swing.Icon getIcon()
- Overrides:
getIconin classAbstractNavTreeNode
-
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
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 java.util.Collection<ResourcePath> 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)
-
canDelete
public boolean canDelete(java.util.List<AbstractNavTreeNode> selectedChildren)
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
public boolean canCopy(java.util.List<AbstractNavTreeNode> selectedChildren)
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
protected void onResourceModified(ProjectResource 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
-
-