com.ibm.as400.util.html

Class HTMLTreeElement

  • java.lang.Object
    • com.ibm.as400.util.html.HTMLTreeElement
  • All Implemented Interfaces:
    HTMLTagElement, java.io.Serializable
    Direct Known Subclasses:
    FileTreeElement


    public class HTMLTreeElement
    extends java.lang.Object
    implements HTMLTagElement, java.io.Serializable
    The HTMLTreeElement class represents an hierarchial element within an HTMLTree or other HTMLTreeElements.

    This example creates an HTMLTreeElement object.

      // Create parent HTMLTreeElement.
      HTMLTreeElement parentElement = new HTMLTreeElement();
      parentElement.setTextUrl(new HTMLHyperlink("http://myWebPage", "My Web Page"));
      
      // Create HTMLTreeElement Child.
      HTMLTreeElement childElement = new HTMLTreeElement();
      childElement.setTextUrl(new HTMLHyperlink("http://anotherWebPage", "Another Web Page"));
      parentElement.addElement(childElement);
      
    
      
    Once the elements are added to an HTMLTree object and the elements are expanded, the HTMLTreeElements will look like this:
    - My Web Page
     
    - Another Web Page

    HTMLTreeElement objects generate the following events:

    • ElementEvent - The events fired are:
      • elementAdded
      • elementRemoved
    • PropertyChangeEvent
    See Also:
    HTMLTree, URLParser, Serialized Form
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      void addElement(HTMLTreeElement element)
      Adds a child element to the parent HTMLTreeElement
      void addElementListener(ElementListener listener)
      Adds an addElementListener.
      void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
      Adds a PropertyChangeListener.
      java.lang.String getCollapsedGif()
      Returns the collapsed gif.
      java.lang.String getDocGif()
      Returns the document gif.
      java.lang.String getExpandedGif()
      Returns the expanded gif.
      java.lang.String getFOTag()
      Returns a comment tag.
      HTMLHyperlink getIconUrl()
      Returns the icon URL.
      java.lang.String getTag()
      Returns the HTMLTreeElement tag.
      HTMLTagElement getText()
      Returns the visible text of the HTMLTreeElement.
      HTMLHyperlink getTextUrl()
      Returns the text URL.
      boolean isExpanded()
      Indicates if the HTMLTreeElement is expanded.
      boolean isLeaf()
      Indicates if the HTMLTreeElement is a leaf.
      void removeElement(HTMLTreeElement element)
      Removes a child element from the parent HTMLTreeElement
      void removeElementListener(ElementListener listener)
      Removes this ElementListener from the internal list.
      void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
      Removes the PropertyChangeListener from the internal list.
      void selected(int hashcode)
      Indicates which HTMLTreeElement is selected.
      static void setCollapsedGif(java.lang.String gifUrl)
      Set the gif to use when the HTMLTree is collapsed.
      static void setDocGif(java.lang.String gifUrl)
      Set the gif to use when the element in the tree contains documents or files and not directories.
      void setExpanded(boolean expanded)
      Set the HTMLTreeElement to be expanded.
      static void setExpandedGif(java.lang.String gifUrl)
      Set the gif to use when the HTMLTree is expanded.
      void setIconUrl(HTMLHyperlink iconUrl)
      Set the URL for the expanded/collapsed icon and all the corresponding icons for the elements under this HTMLTreeElement.
      void setText(HTMLTagElement element)
      Set the visible text of the HTMLTreeElement.
      void setText(java.lang.String text)
      Set the visigble test of the HTMLTreeElement.
      void setTextUrl(HTMLHyperlink textUrl)
      Set the URL of the HTMLTreeElement text.
      void sort(boolean sort)
      Sorts the tree elements.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HTMLTreeElement

        public HTMLTreeElement()
        Constructs a default HTMLTreeElement object.
      • HTMLTreeElement

        public HTMLTreeElement(java.lang.String text)
        Constructs an HTMLTreeElement with the specified text.
        Parameters:
        text - The text.
      • HTMLTreeElement

        public HTMLTreeElement(HTMLTagElement text)
        Constructs an HTMLTreeElement with the specified text.
        Parameters:
        text - The text.
      • HTMLTreeElement

        public HTMLTreeElement(HTMLHyperlink textUrl)
        Constructs an HTMLTreeElement with the specified textUrl.
        Parameters:
        textUrl - The HTMLHyperlink.
    >
    • Method Detail

      • addElement

        public void addElement(HTMLTreeElement element)
        Adds a child element to the parent HTMLTreeElement
        Parameters:
        element - The HTMLTreeElement.
      • addElementListener

        public void addElementListener(ElementListener listener)
        Adds an addElementListener. The specified addElementListeners elementAdded method will be called each time a HTMLTreeElement is added. The addElementListener object is added to a list of addElementListeners managed by this HTMLTreeElement. It can be removed with removeElementListener.
        Parameters:
        listener - The ElementListener.
        See Also:
        removeElementListener(com.ibm.as400.util.html.ElementListener)
      • addPropertyChangeListener

        public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
        Adds a PropertyChangeListener. The specified PropertyChangeListener's propertyChange method is called each time the value of any bound property is changed.
        Parameters:
        listener - The PropertyChangeListener.
        See Also:
        removePropertyChangeListener(java.beans.PropertyChangeListener)
      • getCollapsedGif

        public java.lang.String getCollapsedGif()
        Returns the collapsed gif.
        Returns:
        The collapsed gif.
      • getDocGif

        public java.lang.String getDocGif()
        Returns the document gif.
        Returns:
        The document gif.
      • getExpandedGif

        public java.lang.String getExpandedGif()
        Returns the expanded gif.
        Returns:
        The expanded gif.
      • getIconUrl

        public HTMLHyperlink getIconUrl()
        Returns the icon URL.
        Returns:
        The icon URL.
      • getText

        public HTMLTagElement getText()
        Returns the visible text of the HTMLTreeElement.
        Returns:
        text The text.
      • getFOTag

        public java.lang.String getFOTag()
        Returns a comment tag. This method should not be called. There is no XSL-FO support for this class.
        Specified by:
        getFOTag in interface HTMLTagElement
        Returns:
        The comment tag.
      • getTag

        public java.lang.String getTag()
        Returns the HTMLTreeElement tag.
        Specified by:
        getTag in interface HTMLTagElement
        Returns:
        The tag.
      • getTextUrl

        public HTMLHyperlink getTextUrl()
        Returns the text URL.
        Returns:
        The text URL.
      • isExpanded

        public boolean isExpanded()
        Indicates if the HTMLTreeElement is expanded.
        Returns:
        true if expanded, false otherwise.
      • isLeaf

        public boolean isLeaf()
        Indicates if the HTMLTreeElement is a leaf.
        Returns:
        true if the element is a leaf, false otherwise.
      • removeElement

        public void removeElement(HTMLTreeElement element)
        Removes a child element from the parent HTMLTreeElement
        Parameters:
        element - The HTMLTreeElement.
      • removePropertyChangeListener

        public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
        Removes the PropertyChangeListener from the internal list. If the PropertyChangeListener is not on the list, nothing is done.
        Parameters:
        listener - The PropertyChangeListener.
        See Also:
        addPropertyChangeListener(java.beans.PropertyChangeListener)
      • selected

        public void selected(int hashcode)
        Indicates which HTMLTreeElement is selected. The hashcode is used to determine which element within the tree to expand or collapse.
        Parameters:
        hashcode - The hashcode.
      • setCollapsedGif

        public static void setCollapsedGif(java.lang.String gifUrl)
        Set the gif to use when the HTMLTree is collapsed. The gif can be specified with an absolute or relative URL location.
        Parameters:
        gifUrl - The collapsed gif location.
      • setDocGif

        public static void setDocGif(java.lang.String gifUrl)
        Set the gif to use when the element in the tree contains documents or files and not directories. The gif can be specified with an absolute or relative URL location.
        Parameters:
        gifUrl - The document gif location.
      • setExpandedGif

        public static void setExpandedGif(java.lang.String gifUrl)
        Set the gif to use when the HTMLTree is expanded. The gif can be specified with an absolute or relative URL location.
        Parameters:
        gifUrl - The expanded gif location.
      • setExpanded

        public void setExpanded(boolean expanded)
        Set the HTMLTreeElement to be expanded. The default is false.
        Parameters:
        expanded - true if element is expanded; false if collapsed.
      • setIconUrl

        public void setIconUrl(HTMLHyperlink iconUrl)
        Set the URL for the expanded/collapsed icon and all the corresponding icons for the elements under this HTMLTreeElement.
        Parameters:
        iconUrl - The icon url.
      • setText

        public void setText(HTMLTagElement element)
        Set the visible text of the HTMLTreeElement.
        Parameters:
        element - The HTMLTagElement.
      • setText

        public void setText(java.lang.String text)
        Set the visigble test of the HTMLTreeElement.
        Parameters:
        text - The text.
      • setTextUrl

        public void setTextUrl(HTMLHyperlink textUrl)
        Set the URL of the HTMLTreeElement text. Setting the textUrl will replace the viewable text property set with setText().
        Parameters:
        textUrl - The HTMLHyperlink.
      • sort

        public void sort(boolean sort)
        Sorts the tree elements.
        Parameters:
        sort - true if the elements are sorted; false otherwise. The default is true.