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
,SfcNode
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 DesignerContext
context
protected javax.swing.ImageIcon
inheritedIcon
protected javax.swing.Action
overrideAction
protected static AbstractNavTreeNode.PopupAction
overrideEnabledAction
protected static javax.swing.JCheckBoxMenuItem
overrideEnabledMenuItem
protected static AbstractNavTreeNode.PopupAction
protectedAction
protected static javax.swing.JCheckBoxMenuItem
protectedMenuItem
protected ProjectResourceId
resourceId
protected ResourcePath
resourcePath
protected java.lang.Boolean
restricted
-
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 protected
AbstractResourceNavTreeNode(DesignerContext context, ResourcePath path)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addBadges(BadgeTreeCellRenderer renderer, boolean selected)
Add 'badges' to indicate meta information about this nodeprotected void
addConcurrentUsersBadges(BadgeTreeCellRenderer renderer, boolean selected)
protected void
addEditActions(javax.swing.JPopupMenu menu)
protected void
addOverrideEnabledMenuItem(javax.swing.JPopupMenu menu)
protected void
addProtectMenuItem(javax.swing.JPopupMenu menu)
protected boolean
alterName(java.lang.String newTextValue)
boolean
canCopy(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.boolean
canDelete(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.void
commitIfOpen()
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.Icon
getIcon()
protected java.lang.String
getInvalidNameErrorMessage(java.lang.String attemptedName)
protected java.lang.Iterable<AbstractNavTreeNode.PopupAction>
getPopupActions()
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.java.util.Optional<ProjectResource>
getProjectResource()
The ProjectResource that this node representsProjectResourceId
getResourceId()
ResourcePath
getResourcePath()
void
install(AbstractNavTreeNode parent)
boolean
isChanged()
boolean
isEditable()
Override this and return true if you want your node's text to be editable.boolean
isInherited()
boolean
isLocal()
protected boolean
isOpen()
Override this to indicate whether or not this resource is open for editingboolean
isOverrideEnabled()
protected boolean
isProtectedEnabled()
boolean
isRestricted()
Used to display protected Icon for project resources that are able to be protected.protected boolean
isValid(java.lang.String name)
Override this if you want special naming rules for your node.void
onDoubleClick()
Called when this node is double-clicked on.void
onEdit(java.lang.String newTextValue)
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 editingvoid
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)
protected void
setupEditActions(javax.swing.tree.TreePath[] paths, java.util.List<AbstractNavTreeNode> selection)
Searches for a common edit action handling parent, and if one exists, sets up the edit actions appropriately.protected void
uninstall()
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.ImageIcon 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
-
overrideAction
protected javax.swing.Action overrideAction
-
-
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:AbstractNavTreeNode
Add 'badges' to indicate meta information about this node- Overrides:
addBadges
in 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()
-
setProtected
public void setProtected(boolean prot)
-
setOverrideEnabled
public void setOverrideEnabled(boolean enabled)
-
install
public void install(AbstractNavTreeNode parent)
- Overrides:
install
in classAbstractNavTreeNode
-
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
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()
-
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.
-
onDoubleClick
public void onDoubleClick()
Description copied from class:AbstractNavTreeNode
Called when this node is double-clicked on.- Overrides:
onDoubleClick
in classAbstractNavTreeNode
-
onEdit
public void onEdit(java.lang.String newTextValue)
Description copied from class:AbstractNavTreeNode
Called after this node has been edited in the tree.- Overrides:
onEdit
in 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: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
protected void setupEditActions(javax.swing.tree.TreePath[] paths, java.util.List<AbstractNavTreeNode> selection)
Description copied from class:AbstractNavTreeNode
Searches for a common edit action handling parent, and if one exists, sets up the edit actions appropriately. If not, disables them.- Overrides:
setupEditActions
in classAbstractNavTreeNode
-
addEditActions
protected void addEditActions(javax.swing.JPopupMenu menu)
- Overrides:
addEditActions
in classAbstractNavTreeNode
-
addProtectMenuItem
protected void addProtectMenuItem(javax.swing.JPopupMenu menu)
-
addOverrideEnabledMenuItem
protected void addOverrideEnabledMenuItem(javax.swing.JPopupMenu menu)
-
getIcon
public javax.swing.Icon getIcon()
- Overrides:
getIcon
in classAbstractNavTreeNode
-
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
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: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
public boolean canCopy(java.util.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 andAbstractNavTreeNode.canDelete(java.util.List)
both return true, the cut action will also be enabled.- Overrides:
canCopy
in 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
-
-