com.ibm.as400.util.html

Class HTMLTreeElement

  • All Implemented Interfaces:
    HTMLTagElement, Serializable
    Direct Known Subclasses:
    FileTreeElement


    public class HTMLTreeElement
    extends Object
    implements HTMLTagElement, 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
    • Constructor Detail

      • HTMLTreeElement

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

        public HTMLTreeElement(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)
      • getCollapsedGif

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

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

        public 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 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 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.
      • 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(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(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(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(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.