javax.swing.text.html

Class HTML


public class HTML
extends Object

Constants used in the HTMLDocument. These are basically tag and attribute definitions.

Nested Class Summary

static class
HTML.Attribute
Typesafe enumeration representing an HTML attribute.
static class
HTML.Tag
Typesafe enumeration for an HTML tag.
static class
HTML.UnknownTag

Field Summary

static String
NULL_ATTRIBUTE_VALUE

Method Summary

static HTML.Attribute[]
getAllAttributeKeys()
Returns the set of HTML attributes recognized.
static HTML.Tag[]
getAllTags()
Returns the set of actual HTML tags that are recognized by the default HTML reader.
static HTML.Attribute
getAttributeKey(String attName)
Fetches an attribute constant for a well-known attribute name (i.e.
static int
getIntegerAttributeValue(AttributeSet attr, HTML.Attribute key, int def)
Fetches an integer attribute value.
static HTML.Tag
getTag(String tagName)
Fetches a tag constant for a well-known tag name (i.e.

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

NULL_ATTRIBUTE_VALUE

public static final String NULL_ATTRIBUTE_VALUE
Field Value:
"#DEFAULT"
Usages and Demos :

View More Examples of HTML.NULL_ATTRIBUTE_VALUE
   1:   {
   2:     Object value = HTML.NULL_ATTRIBUTE_VALUE;
   3: 
   4:     Element e = (Element) dtd.elementHash.get(element.toLowerCase());
   5:     if (e != null)

View Full Code Here

Method Details

getAllAttributeKeys

public static HTML.Attribute[] getAllAttributeKeys()
Returns the set of HTML attributes recognized.
Returns:
the set of HTML attributes recognized

getAllTags

public static HTML.Tag[] getAllTags()
Returns the set of actual HTML tags that are recognized by the default HTML reader. This set does not include tags that are manufactured by the reader.
Usages and Demos :

View More Examples of getAllTags()
   1: import javax.swing.text.html.*;
   2: 
   3:         ...
   4:   
   5:     HTML.Tag[] list = HTML.getAllTags();
   6:     for (int i = 0; i < list.length; i++) {
   7:       System.out.println((i+1) + ": " + list[i]);
   8:     }

View Full Code Here
   1: import javax.swing.text.SimpleAttributeSet;
   2: import javax.swing.text.html.HTML;
   3: 
   4:         ...
   5:         parent = newParent;
   6:         HTML.Tag[] tagList = HTML.getAllTags();
   7:         for(int i = 0; i < tagList.length; i++)
   8:         ...
   9:         sa.addAttribute("id", idString);
  10:         parent.getExtendedHtmlDoc().replaceAttributes(element, sa, HTML.Tag.LI);
  11:         parent.refreshOnUpdate();
  12:         ...
  13:         sa = removeAttributeByKey(sa, "id");
  14:         parent.getExtendedHtmlDoc().replaceAttributes(element, sa, HTML.Tag.LI);

View Full Code Here
   1: import javax.swing.text.SimpleAttributeSet;
   2: import javax.swing.text.html.HTML;
   3: 
   4:         ...
   5:         parent = newParent;
   6:         HTML.Tag[] tagList = HTML.getAllTags();
   7:         for(int i = 0; i < tagList.length; i++)
   8:         ...
   9:         sa.addAttribute("id", idString);
  10:         parent.getExtendedHtmlDoc().replaceAttributes(element, sa, HTML.Tag.LI);
  11:         parent.refreshOnUpdate();
  12:         ...
  13:         sa = removeAttributeByKey(sa, "id");
  14:         parent.getExtendedHtmlDoc().replaceAttributes(element, sa, HTML.Tag.LI);

View Full Code Here
   1: package com.holub.ui.HTML;
   2: 
   3:         ...
   4: 
   5: import com.holub.ui.HTML.TagBehavior;
   6:         ...
   7: import com.holub.ui.HTML.FilterFactory;
   8: 
   9:         ...
  10:     public static final boolean isStandardHTMLtag(String tag)
  11:     {    HTML.Tag[] allTags = HTML.getAllTags();

View Full Code Here

getAttributeKey

public static HTML.Attribute getAttributeKey(String attName)
Fetches an attribute constant for a well-known attribute name (i.e. one of the attributes in the set {FACE, COMMENT, SIZE, COLOR, CLEAR, BACKGROUND, BGCOLOR, TEXT, LINK, VLINK, ALINK, WIDTH, HEIGHT, ALIGN, NAME, HREF, REL, REV, TITLE, TARGET, SHAPE, COORDS, ISMAP, NOHREF, ALT, ID, SRC, HSPACE, VSPACE, USEMAP, LOWSRC, CODEBASE, CODE, ARCHIVE, VALUE, VALUETYPE, TYPE, CLASS, STYLE, LANG, DIR, DECLARE, CLASSID, DATA, CODETYPE, STANDBY, BORDER, SHAPES, NOSHADE, COMPACT, START, ACTION, METHOD, ENCTYPE, CHECKED, MAXLENGTH, MULTIPLE, SELECTED, ROWS, COLS, DUMMY, CELLSPACING, CELLPADDING, VALIGN, HALIGN, NOWRAP, ROWSPAN, COLSPAN, PROMPT, HTTPEQUIV, CONTENT, LANGUAGE, VERSION, N, FRAMEBORDER, MARGINWIDTH, MARGINHEIGHT, SCROLLING, NORESIZE, MEDIA, ENDTAG}). If the given name does not represent one of the well-known attributes, then null will be returned.
Parameters:
attName - the String requested
Returns:
the Attribute corresponding to attName
Usages and Demos :

View More Examples of getAttributeKey(String attName)
   1: package org.apache.jetspeed.rewriter.html;
   2: 
   3:         ...
   4: import javax.swing.text.MutableAttributeSet;
   5: import javax.swing.text.html.HTML;
   6:         ...
   7: import javax.swing.text.html.HTML.Attribute;
   8: 
   9:         ...
  10:     {
  11:         Attribute att = HTML.getAttributeKey(qName.toLowerCase());        

View Full Code Here
   1: 
   2: package gnu.javax.swing.text.html.parser;
   3: 
   4:         ...
   5: import javax.swing.text.SimpleAttributeSet;
   6: import javax.swing.text.html.HTML;
   7: 
   8:         ...
   9: 
  10:     key = HTML.getAttributeKey((String) key);
  11:     v = super.getAttribute(key);
  12:         ...
  13:           {
  14:             HTML.Attribute hKey = HTML.getAttributeKey((String) key);

View Full Code Here

getIntegerAttributeValue

public static int getIntegerAttributeValue(AttributeSet attr,
                                           HTML.Attribute key,
                                           int def)
Fetches an integer attribute value. Attribute values are stored as a string, and this is a convenience method to convert to an actual integer.
Parameters:
attr - the set of attributes to use to try to fetch a value
key - the key to use to fetch the value
def - the default value to use if the attribute isn't defined or there is an error converting to an integer

getTag

public static HTML.Tag getTag(String tagName)
Fetches a tag constant for a well-known tag name (i.e. one of the tags in the set {A, ADDRESS, APPLET, AREA, B, BASE, BASEFONT, BIG, BLOCKQUOTE, BODY, BR, CAPTION, CENTER, CITE, CODE, DD, DFN, DIR, DIV, DL, DT, EM, FONT, FORM, FRAME, FRAMESET, H1, H2, H3, H4, H5, H6, HEAD, HR, HTML, I, IMG, INPUT, ISINDEX, KBD, LI, LINK, MAP, MENU, META, NOBR, NOFRAMES, OBJECT, OL, OPTION, P, PARAM, PRE, SAMP, SCRIPT, SELECT, SMALL, SPAN, STRIKE, S, STRONG, STYLE, SUB, SUP, TABLE, TD, TEXTAREA, TH, TITLE, TR, TT, U, UL, VAR}. If the given name does not represent one of the well-known tags, then null will be returned.
Parameters:
tagName - the String name requested
Returns:
a tag constant corresponding to the tagName, or null if not found
Usages and Demos :

View More Examples of getTag(String tagName)
   1: import javax.swing.text.MutableAttributeSet;
   2: import javax.swing.text.html.HTML;
   3:         ...
   4: import javax.swing.text.html.HTML.Tag;
   5:         ...
   6: import javax.swing.text.html.HTMLEditorKit.ParserCallback;
   7: 
   8:         ...
   9:                 String tagName = (String) valueObject;
  10:                 HTML.Tag tag = HTML.getTag(tagName.toLowerCase());

View Full Code Here
   1: import javax.swing.text.*;
   2: import javax.swing.text.html.*;
   3: import java.util.*;
   4:         ...
   5:     public String getContentType() {
   6:     return "text/html";
   7:     }
   8:         ...
   9:         try {
  10:                 Class c = Class.forName("javax.swing.text.html.parser.ParserDelegator");
  11:                 defaultParser = (HTMLEditorKit.Parser) c.newInstance();
  12:         ...
  13:         tagMap.put(HTML.Tag.META, new MetaAction());
  14:         HTML.Tag tag = HTML.getTag("NOBR");

View Full Code Here