Class AbstractResourceNavTreeNode

    • Field Detail

      • resourcePath

        @Nonnull
        protected final ResourcePath resourcePath
      • inheritedIcon

        protected javax.swing.ImageIcon inheritedIcon
      • restricted

        protected java.lang.Boolean restricted
      • protectedMenuItem

        protected static final javax.swing.JCheckBoxMenuItem protectedMenuItem
      • 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

      • getProjectResource

        public java.util.Optional<ProjectResource> getProjectResource()
        The ProjectResource that this node represents
      • getResourcePath

        @Nonnull
        public ResourcePath getResourcePath()
      • 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 class AbstractNavTreeNode
      • 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()
      • 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.
      • alterName

        protected boolean alterName​(java.lang.String newTextValue)
      • getInvalidNameErrorMessage

        protected java.lang.String getInvalidNameErrorMessage​(java.lang.String attemptedName)
      • 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 class AbstractNavTreeNode
      • addProtectMenuItem

        protected void addProtectMenuItem​(javax.swing.JPopupMenu menu)
      • addOverrideEnabledMenuItem

        protected void addOverrideEnabledMenuItem​(javax.swing.JPopupMenu menu)
      • 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 class AbstractNavTreeNode
      • 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)
      • 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