Class TextViewHTMLContainer
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class TextViewHTMLContainer

public abstract class netscape.application.TextViewHTMLContainer
    extends netscape.application.TextViewHTMLElement
{
    /* Constructors
     */
    public TextViewHTMLContainer();

    /* Methods
     */
    public boolean appliesAttributesToChildren();
    public Hashtable attributes();
    public Hashtable attributesForContents(Hashtable, Hashtable, TextView);
    public Hashtable attributesForPrefix(Hashtable, Hashtable, TextView);
    public Hashtable attributesForSuffix(Hashtable, Hashtable, TextView);
    public Object[] children();
    public Vector childrenVector();
    public void cleanupContext(Hashtable);
    public String marker();
    public String prefix(Hashtable, char);
    public void setupContext(Hashtable);
    public String string(Hashtable);
    public String suffix(Hashtable, char);
    public String toString();
}
Instances of this class are used to store containers like STRONG or LI If you need to add some support for another container, subclass TextViewHTMLContainer and use TextView.setHTMLContainerClass() to tell TextView to use your subclass.

Constructors

.TextViewHTMLContainer

  public TextViewHTMLContainer()

Methods

.prefix

  public String prefix(Hashtable context,
                       char lastChar)
You can override this method to return what string should prefix the container. This method is usualy used to add extra characters like carriage returns. For example, Headers always start with a cariage return. This method for an header should return a cariage return. context is the context lastchar is the last character added to the textView. It is often useful to check if lastChar is '\n' before adding another '\n' The default implementation returns nothing.

.suffix

  public String suffix(Hashtable context,
                       char lastChar)
You can override this method to return what string should suffix the container. This method is usualy used to add extra characters like carriage returns. For example, Headers always end with a cariage return. This method for an header should return a cariage return. context is the context lastchar is the last character added to the textView. It is often useful to check if lastChar is '\n' before adding another '\n' The default implementation returns nothing.

.setupContext

  public void setupContext(Hashtable context)
Setup the context for children. Override this method and add or change any key if you want to add some state for children. The default implementation does nothing.

.cleanupContext

  public void cleanupContext(Hashtable context)
Cleanup the context. If you have added some state in setupContext, you should override this method and remove any state added during setupContext() The default implementation does nothing

.attributesForPrefix

  public Hashtable attributesForPrefix(Hashtable context,
                                       Hashtable initialAttributes,
                                       TextView textView)
Compute the TextView attributes for the prefix according to the context and initial attributes. Return the new attributes. The default implementation returns initialAttributes . If you need to change the attributes, you should clone initialAttributes and return a new hashtable. textView is the TextView for which the HTML is parsed.

.attributesForContents

  public Hashtable attributesForContents(Hashtable context,
                                         Hashtable initialAttributes,
                                         TextView textView)
Compute the TextView attributes for the container contents according to the context and initial attributes. Return the new attributes. The default implementation returns initialAttributes If you need to change the attributes, you should clone initialAttributes and return a new hashtable. textView is the TextView for which the HTML is parsed.

.attributesForSuffix

  public Hashtable attributesForSuffix(Hashtable context,
                                       Hashtable initialAttributes,
                                       TextView textView)
Compute the TextView attributes for the suffix according to the context and initial attributes. Return the new attributes. The default implementation returns initialAttributes If you need to change the attributes, you should clone initialAttributes and return a new hashtable. textView is the TextView for which the HTML is parsed.

.string

  public String string(Hashtable context)
Return the string for all children. The default implementation concatenates all children's strings and will fill the lengths cache with the appropriate lengths. The lengths cache is used to speedup the attributes setting phase. You need to override this method only when implementating markers producing attachment like Tables and TextArea. In this case you want to return TextView.TEXT_ATTACHMENT_STRING.
Overrides:
string in class TextViewHTMLElement

.children

  public Object[] children()
Return the children for this container.

.childrenVector

  public Vector childrenVector()
Convenience to return the children for this container inside a Vector.

.marker

  public String marker()
Return the marker for this container

.attributes

  public Hashtable attributes()
Return the HTML attributes in an hashtable. Ex: for ... will produce an hashtable with one key "FOO" (note upper case) with a value "1" as a string

.appliesAttributesToChildren

  public boolean appliesAttributesToChildren()
Return true if this marker should applies contents attributes to children. False if attributes should be applied to the result of string(contents). The default value is true. Override this method and return false, if you are implementing a container that replaces its children with a TextAttachment.

.toString

  public String toString()
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index

Copyright © 1997 Netscape Communications Corporation. All rights reserved
Please send any comments or corrections to ifcfeedback@netscape.com
HTML generated on 21 Oct 1997