Class ViewNode
- java.lang.Object
-
- com.inductiveautomation.ignition.designer.navtree.model.AbstractNavTreeNode
-
- com.inductiveautomation.ignition.designer.navtree.model.AbstractResourceNavTreeNode
-
- com.inductiveautomation.ignition.designer.tabbedworkspace.ResourceNode
-
- com.inductiveautomation.perspective.designer.workspace.nav.ViewNode
-
- All Implemented Interfaces:
java.lang.Iterable<AbstractNavTreeNode>
,javax.swing.tree.TreeNode
public class ViewNode extends ResourceNode
Created by carlg on 6/6/2017.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.inductiveautomation.ignition.designer.navtree.model.AbstractNavTreeNode
AbstractNavTreeNode.DeleteReason, AbstractNavTreeNode.PopupAction
-
-
Field Summary
-
Fields inherited from class com.inductiveautomation.ignition.designer.tabbedworkspace.ResourceNode
workspace
-
Fields inherited from class com.inductiveautomation.ignition.designer.navtree.model.AbstractResourceNavTreeNode
context, exportAction, inheritedIcon, overrideAction, overrideEnabledAction, overrideEnabledMenuItem, protectedAction, protectedMenuItem, resourceId, resourcePath, restricted, revertAction, revertMenuItem
-
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 Constructor Description ViewNode(DesignerContext context, ViewWorkspace workspace, ProjectResource resource)
-
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 nodeboolean
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.boolean
canPaste(java.util.List<AbstractNavTreeNode> selectedChildren, java.awt.datatransfer.Transferable data)
Can this action handler handle a paste given the data flavors currently available in the clipboard? data may be null.boolean
confirmDelete(java.util.List<? extends AbstractNavTreeNode> selectedChildren)
Used to confirm the delete.java.awt.datatransfer.Transferable
doCopy(java.util.List<? extends AbstractNavTreeNode> selectedChildren)
Called when the copy action is performed.java.awt.datatransfer.Transferable
doCut(java.util.List<? extends AbstractNavTreeNode> selectedChildren)
Called when the cut action is performed.void
doDelete(java.util.List<? extends AbstractNavTreeNode> selectedChildren, AbstractNavTreeNode.DeleteReason reason)
Called when the delete action is performed, if confirmDelete returned trueboolean
doPaste(java.util.List<? extends AbstractNavTreeNode> selectedChildren, java.awt.datatransfer.Transferable clipboardContents, boolean isDrop)
Called when the paste action is performedprotected void
initPopupMenu(javax.swing.JPopupMenu menu, javax.swing.tree.TreePath[] paths, java.util.List<AbstractNavTreeNode> selection, int modifiers)
Default implementation calls setupEditActions(), and then addEditActions()boolean
isEditActionHandler()
Override to return true if you want this node to be an edit action handler for its children.protected java.util.List<AbstractNavTreeNode>
loadChildren()
Called before this node responds from any of the children-related TreeNode functions, if a list of children wasn't already set.void
onChildrenSelected(java.util.List<javax.swing.tree.TreePath> paths)
Called when child nodes (deep) are selected under this node.protected void
onEditorClosed(ResourceEditor editor)
protected void
onEditorOpened(ResourceEditor resourceEditor)
protected void
onResourceModified(ProjectResource resource)
AbstractResourceNavTreeNode adds a project listener to listen for changes to this node's resource.void
onSelected()
Called when this node is selected in the treevoid
onSelectionChanged(SelectionChangeEvent event)
Listens to when the selection is changed in the editorprotected void
uninstall()
Called when the node is removed from the tree.-
Methods inherited from class com.inductiveautomation.ignition.designer.tabbedworkspace.ResourceNode
closeAndCommit, commitIfOpen, getProjectResource, install, isOpen, onEditorSelected, onEditorUnselected, open, setIcon
-
Methods inherited from class com.inductiveautomation.ignition.designer.navtree.model.AbstractResourceNavTreeNode
addConcurrentUsersBadges, addEditActions, addExportMenuItem, addOverrideEnabledMenuItem, addProtectMenuItem, addRevertMenuItem, alterName, gatherChildrenIds, getIcon, getInvalidNameErrorMessage, getPopupActions, getResourceId, getResourcePath, isChanged, isEditable, isInherited, isLocal, isOverridden, isOverrideEnabled, isProtectedEnabled, isRestricted, isValid, onDoubleClick, onEdit, revert, selectChild, setOverrideEnabled, setProtected, setupEditActions
-
Methods inherited from class com.inductiveautomation.ignition.designer.navtree.model.AbstractNavTreeNode
canDrag, canDrop, checkChildren, children, createResourceCopy, debug, debug, dispatchSelectionEvent, expand, expandAndSelect, findChild, findCommonEditActionHandler, findDropHandler, findEditActionHandler, forceChildrenReload, getAllowsChildren, getChildAt, getChildCount, getClipboard, getDeleteAction, getDepth, getExpandedIcon, getIndex, getModel, getName, getParent, getSelectionModel, getSortOrder, getText, getThumbnail, getTooltip, getWorkspaceName, isBold, isItalic, isLeaf, isSelected, isTopLevelNode, isValidName, iterator, newLogger, notifyChildNameChanged, pathToRoot, recreate, recreate, refresh, reload, select, select, setBold, setChildren, setItalic, setName, setText, setThumbnail, setTooltip, showPopupMenu, toString, uninstallChildren, useThumbnailTooltip, visitIfLoaded
-
-
-
-
Constructor Detail
-
ViewNode
public ViewNode(DesignerContext context, ViewWorkspace workspace, ProjectResource resource)
-
-
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 classAbstractResourceNavTreeNode
- Parameters:
renderer
- the renderer; callBadgeTreeCellRenderer.addBadge(Badge)
to add your badge(s)selected
- the state of this node
-
onResourceModified
protected void onResourceModified(ProjectResource resource)
Description copied from class:AbstractResourceNavTreeNode
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- Overrides:
onResourceModified
in classAbstractResourceNavTreeNode
-
onSelectionChanged
public void onSelectionChanged(SelectionChangeEvent event)
Listens to when the selection is changed in the editor
-
onSelected
public void onSelected()
Description copied from class:AbstractNavTreeNode
Called when this node is selected in the tree- Overrides:
onSelected
in classResourceNode
-
onChildrenSelected
public void onChildrenSelected(java.util.List<javax.swing.tree.TreePath> paths)
Description copied from class:AbstractNavTreeNode
Called when child nodes (deep) are selected under this node.- Overrides:
onChildrenSelected
in classAbstractNavTreeNode
- Parameters:
paths
- the children selected when the parent node is selected
-
loadChildren
@Nullable protected java.util.List<AbstractNavTreeNode> loadChildren()
Description copied from class:AbstractNavTreeNode
Called before this node responds from any of the children-related TreeNode functions, if a list of children wasn't already set. Override to use lazy child loading.- Overrides:
loadChildren
in classAbstractNavTreeNode
-
onEditorOpened
protected void onEditorOpened(ResourceEditor resourceEditor)
- Overrides:
onEditorOpened
in classResourceNode
-
onEditorClosed
protected void onEditorClosed(ResourceEditor editor)
- Overrides:
onEditorClosed
in classResourceNode
-
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 classResourceNode
-
initPopupMenu
protected void initPopupMenu(javax.swing.JPopupMenu menu, javax.swing.tree.TreePath[] paths, java.util.List<AbstractNavTreeNode> selection, int modifiers)
Description copied from class:AbstractNavTreeNode
Default implementation calls setupEditActions(), and then addEditActions()- Overrides:
initPopupMenu
in classAbstractNavTreeNode
-
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
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 classAbstractResourceNavTreeNode
-
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 classAbstractResourceNavTreeNode
-
canPaste
public boolean canPaste(java.util.List<AbstractNavTreeNode> selectedChildren, java.awt.datatransfer.Transferable data)
Description copied from class:AbstractNavTreeNode
Can this action handler handle a paste given the data flavors currently available in the clipboard? data may be null.- Overrides:
canPaste
in classAbstractNavTreeNode
-
doDelete
public void doDelete(java.util.List<? extends AbstractNavTreeNode> selectedChildren, AbstractNavTreeNode.DeleteReason reason)
Description copied from class:AbstractNavTreeNode
Called when the delete action is performed, if confirmDelete returned true- Overrides:
doDelete
in classAbstractNavTreeNode
-
doCopy
public java.awt.datatransfer.Transferable doCopy(java.util.List<? extends AbstractNavTreeNode> selectedChildren)
Description copied from class:AbstractNavTreeNode
Called when the copy action is performed.- Overrides:
doCopy
in classAbstractNavTreeNode
- Returns:
- the current selection as a
Transferable
, or null if the copy failed. Will be added to the system clipboard.
-
doCut
public java.awt.datatransfer.Transferable doCut(java.util.List<? extends AbstractNavTreeNode> selectedChildren)
Description copied from class:AbstractNavTreeNode
Called when the cut action is performed.- Overrides:
doCut
in classAbstractNavTreeNode
- Returns:
- the current selection as a
Transferable
, or null if the cut failed. Will be added to the system clipboard.
-
doPaste
public boolean doPaste(java.util.List<? extends AbstractNavTreeNode> selectedChildren, java.awt.datatransfer.Transferable clipboardContents, boolean isDrop)
Description copied from class:AbstractNavTreeNode
Called when the paste action is performed- Overrides:
doPaste
in classAbstractNavTreeNode
clipboardContents
- The current contents of the clipboard to paste.isDrop
- Indicates whether this paste originated from a drop action. If false, originated from a keyboard or menu paste shortcut.- Returns:
- whether or not the paste successfully completed.
-
confirmDelete
public boolean confirmDelete(java.util.List<? extends AbstractNavTreeNode> selectedChildren)
Description copied from class:AbstractNavTreeNode
Used to confirm the delete. If true is returned, doDelete will be called.- Overrides:
confirmDelete
in classAbstractNavTreeNode
-
-