Class Tree

    • Field Detail

      • MAX_ITEMS

        public static final int MAX_ITEMS
        the maximum number of array/list elements to show.
        See Also:
        Constant Field Values
      • m_Object

        protected transient Object m_Object
        the current object.
      • m_SearchString

        protected String m_SearchString
        the search string.
      • m_SearchPattern

        protected Pattern m_SearchPattern
        the search pattern.
      • m_IsRegExp

        protected boolean m_IsRegExp
        whether the search is using a regular expression.
    • Constructor Detail

      • Tree

        public Tree()
        Initializes the tree.
    • Method Detail

      • buildTree

        protected void buildTree​(Object root)
        Builds the tree from the given object.
        Parameters:
        root - the object to build the tree from, null for empty tree
      • matches

        protected boolean matches​(String label)
        Checks the label against the current search setup.
        Parameters:
        label - the label to check
        Returns:
        true if a match and should be added
      • setObject

        public void setObject​(Object value)
        Sets the object to display.
        Parameters:
        value - the object
      • getObject

        public Object getObject()
        Returns the object currently displayed.
        Returns:
        the object
      • selectPropertyPath

        protected boolean selectPropertyPath​(Node parent,
                                             String[] path,
                                             int index)
        Attempts to select the specified property path.
        Parameters:
        parent - the parent node
        path - the path to select (and open in the tree)
        index - the index in the path array
        Returns:
        true if successfully selected
      • selectPropertyPath

        public boolean selectPropertyPath​(String[] path)
        Attempts to select the specified property path.
        Parameters:
        path - the path to select (and open in the tree)
        Returns:
        true if successfully selected
      • search

        public void search​(String search,
                           boolean isRegExp)
        Initiates the search.
        Parameters:
        search - the search string
        isRegExp - whether the search is using a regular expression
      • getFileChooser

        protected ObjectExporterFileChooser getFileChooser​(Class cls)
        Returns the file chooser to use.
        Parameters:
        cls - the class that the exporters must be able to handle, null for all
        Returns:
        the file chooser
      • canEdit

        protected boolean canEdit​(Object obj)
        Returns whether the object can be edited.
        Parameters:
        obj - the object to check
        Returns:
        true if editable
      • showPopup

        protected void showPopup​(MouseEvent e)
        Brings up a popup menu.
        Parameters:
        e - the mouse event that triggered the popup menu
      • copyToClipboard

        protected void copyToClipboard​(Object obj)
        Copies the object's string plain text rendering to the clipboard.
        Parameters:
        obj - the object to copy
      • export

        protected void export​(Object obj)
        Exports the object to a file.
        Parameters:
        obj - the object to export
      • inspect

        protected void inspect​(String[] path,
                               Object obj)
        Inspects the object in a separate dialog.
        Parameters:
        path - the property path
        obj - the object to inspect
      • treeExpanded

        public void treeExpanded​(TreeExpansionEvent event)
        Called whenever an item in the tree has been expanded.
        Specified by:
        treeExpanded in interface TreeExpansionListener
        Parameters:
        event - a TreeExpansionEvent containing a TreePath object for the expanded node
      • treeCollapsed

        public void treeCollapsed​(TreeExpansionEvent event)
        Called whenever an item in the tree has been collapsed.
        Specified by:
        treeCollapsed in interface TreeExpansionListener
        Parameters:
        event - a TreeExpansionEvent containing a TreePath object for the collapsed node