multivalent.std.adaptor

Class CSS

public class CSS extends StyleSheet

Cascading Style Sheet (CSS) reader, with some CSS2.

For now, minimal support. Supported: &64;import { :; } such as

		<STYLE>
			.c1 { color:yellow; }
			.c2 { color:red; }
			.c3 { color:orange; }
		</STYLE>
		
Not supported: nested selectors and everything else.

CSS has many attributes, which should be carried along in the graphics context. When asked about an attribute (even for its own use), a node looks at its local attributes, then the gc's, then the default. But for now we just hardcode a couple special cases.

NOT supported: reference by LINK, contextual selectors: e.g, "OL OL", "H1.c1" pseudo classes, pseudo elements: e.g., "A:visited", "P:first-line", ... display property (which can be used to render XML directly, as it declares elements to be "block"/structural or "inline"/span) properties other than font and color

Since CSS is used by other specs, such as SVG, maybe just parse into name-value pairs and let clients put into native data types, if desired. general font/general color/underline/rest of Context properties

Version: $Revision: 1.8 $ $Date: 2002/10/29 17:48:12 $

See Also: CSSGeneral CSSContext

Field Summary
protected static intBACKGROUND
protected static intBACKGROUND_ATTACHMENT
protected static intBACKGROUND_COLOR
protected static intBACKGROUND_IMAGE
protected static intBACKGROUND_POSITION
protected static intBACKGROUND_REPEAT
protected static intBORDER
protected static intBORDER_BOTTOM
protected static intBORDER_BOTTOM_WIDTH
protected static intBORDER_COLOR
protected static intBORDER_LEFT
protected static intBORDER_LEFT_WIDTH
protected static intBORDER_RIGHT
protected static intBORDER_RIGHT_WIDTH
protected static intBORDER_STYLE
protected static intBORDER_TOP
protected static intBORDER_TOP_WIDTH
protected static intBORDER_WIDTH
protected static intCLEAR
protected static intCOLOR
protected static intDISPLAY
protected static intELIDE
protected static intEND_CSS
protected static intEND_CSS2
protected static intFLOAT
protected static intFONT
protected static intFONT_FAMILY
protected static intFONT_SIZE
protected static intFONT_STYLE
protected static intFONT_VARIANT
protected static intFONT_WEIGHT
protected static intHEIGHT
protected static Map<String,Integer>keyword2int_
protected static intLETTER_SPACING
protected static intLINE_HEIGHT
protected static intLIST_STYLE
protected static intLIST_STYLE_IMAGE
protected static intLIST_STYLE_POSITION
protected static intLIST_STYLE_TYPE
protected static intMARGIN
protected static intMARGIN_BOTTOM
protected static intMARGIN_LEFT
protected static intMARGIN_RIGHT
protected static intMARGIN_TOP
protected static intPADDING
protected static intPADDING_BOTTOM
protected static intPADDING_LEFT
protected static intPADDING_RIGHT
protected static intPADDING_TOP
protected static intSTART_CSS
protected static intSTART_CSS2
protected static intTEXT_ALIGN
protected static intTEXT_DECORATION
protected static intTEXT_INDENT
protected static intTEXT_TRANSFORM
protected static intVERTICAL_ALIGN
protected static intVISIBILITY
protected static intWHITE_SPACE
protected static intWIDTH
protected static intWORD_SPACING
Method Summary
voidactivesAdd(List<ContextListener> actives, VObject o, Node parent)
voidactivesRemove(List<ContextListener> actives, VObject o, Node parent)
protected ContextcreateContext(Toolkit tk)
intgetBorderColors(String vals)
Returns count.
intgetBorderWidth(String val)
intgetBorderWidths(String vals)
Returns count.
intgetLength(String val)
intgetLengths(String vals)
Returns count.
voidparse(String csstxt, URL base)
Parse stylesheet to hash of selector - CSSGeneral.
voidsetAttr(CSSGeneral gs, String name, String value)
Convert passed attribute name and value into setting in CSSGeneral.
voidsetAttrs(CSSGeneral gs, String pairs)
Parse list of attribute name-value pairs into settings in CSSGeneral.
voidsetPriority(String selector, CLGeneral cl)

Field Detail

BACKGROUND

protected static final int BACKGROUND

BACKGROUND_ATTACHMENT

protected static final int BACKGROUND_ATTACHMENT

BACKGROUND_COLOR

protected static final int BACKGROUND_COLOR

BACKGROUND_IMAGE

protected static final int BACKGROUND_IMAGE

BACKGROUND_POSITION

protected static final int BACKGROUND_POSITION

BACKGROUND_REPEAT

protected static final int BACKGROUND_REPEAT

BORDER

protected static final int BORDER

BORDER_BOTTOM

protected static final int BORDER_BOTTOM

BORDER_BOTTOM_WIDTH

protected static final int BORDER_BOTTOM_WIDTH

BORDER_COLOR

protected static final int BORDER_COLOR

BORDER_LEFT

protected static final int BORDER_LEFT

BORDER_LEFT_WIDTH

protected static final int BORDER_LEFT_WIDTH

BORDER_RIGHT

protected static final int BORDER_RIGHT

BORDER_RIGHT_WIDTH

protected static final int BORDER_RIGHT_WIDTH

BORDER_STYLE

protected static final int BORDER_STYLE

BORDER_TOP

protected static final int BORDER_TOP

BORDER_TOP_WIDTH

protected static final int BORDER_TOP_WIDTH

BORDER_WIDTH

protected static final int BORDER_WIDTH

CLEAR

protected static final int CLEAR

COLOR

protected static final int COLOR

DISPLAY

protected static final int DISPLAY

ELIDE

protected static final int ELIDE

END_CSS

protected static final int END_CSS

END_CSS2

protected static final int END_CSS2

FLOAT

protected static final int FLOAT

FONT

protected static final int FONT

FONT_FAMILY

protected static final int FONT_FAMILY

FONT_SIZE

protected static final int FONT_SIZE

FONT_STYLE

protected static final int FONT_STYLE

FONT_VARIANT

protected static final int FONT_VARIANT

FONT_WEIGHT

protected static final int FONT_WEIGHT

HEIGHT

protected static final int HEIGHT

keyword2int_

protected static Map<String,Integer> keyword2int_

LETTER_SPACING

protected static final int LETTER_SPACING

LINE_HEIGHT

protected static final int LINE_HEIGHT

LIST_STYLE

protected static final int LIST_STYLE

LIST_STYLE_IMAGE

protected static final int LIST_STYLE_IMAGE

LIST_STYLE_POSITION

protected static final int LIST_STYLE_POSITION

LIST_STYLE_TYPE

protected static final int LIST_STYLE_TYPE

MARGIN

protected static final int MARGIN

MARGIN_BOTTOM

protected static final int MARGIN_BOTTOM

MARGIN_LEFT

protected static final int MARGIN_LEFT

MARGIN_RIGHT

protected static final int MARGIN_RIGHT

MARGIN_TOP

protected static final int MARGIN_TOP

PADDING

protected static final int PADDING

PADDING_BOTTOM

protected static final int PADDING_BOTTOM

PADDING_LEFT

protected static final int PADDING_LEFT

PADDING_RIGHT

protected static final int PADDING_RIGHT

PADDING_TOP

protected static final int PADDING_TOP

START_CSS

protected static final int START_CSS

START_CSS2

protected static final int START_CSS2

TEXT_ALIGN

protected static final int TEXT_ALIGN

TEXT_DECORATION

protected static final int TEXT_DECORATION

TEXT_INDENT

protected static final int TEXT_INDENT

TEXT_TRANSFORM

protected static final int TEXT_TRANSFORM

VERTICAL_ALIGN

protected static final int VERTICAL_ALIGN

VISIBILITY

protected static final int VISIBILITY

WHITE_SPACE

protected static final int WHITE_SPACE

WIDTH

protected static final int WIDTH

WORD_SPACING

protected static final int WORD_SPACING

Method Detail

activesAdd

public void activesAdd(List<ContextListener> actives, VObject o, Node parent)

activesRemove

public void activesRemove(List<ContextListener> actives, VObject o, Node parent)

createContext

protected Context createContext(Toolkit tk)

getBorderColors

public int getBorderColors(String vals)
Returns count.

getBorderWidth

public int getBorderWidth(String val)

getBorderWidths

public int getBorderWidths(String vals)
Returns count.

getLength

public int getLength(String val)

getLengths

public int getLengths(String vals)
Returns count.

parse

public void parse(String csstxt, URL base)
Parse stylesheet to hash of selector - CSSGeneral.

setAttr

public void setAttr(CSSGeneral gs, String name, String value)
Convert passed attribute name and value into setting in CSSGeneral. CSSGeneral has space overhead, but have limited number of style sheet specs per document. Method also used to process STYLE attribute in arbitrary tags (which means that all HTML tags must be Generic*). Subclass CSSGeneral to handle CSS2.

setAttrs

public void setAttrs(CSSGeneral gs, String pairs)
Parse list of attribute name-value pairs into settings in CSSGeneral.

setPriority

public void setPriority(String selector, CLGeneral cl)