multivalent

Class StyleSheet

public class StyleSheet extends Object implements Cloneable

Map structural name pattern into ContextListener to add to Context's list of active behaviors. This is the superclass for all StyleSheets. It implements a simple style sheet that just uses VObject name and VObject handle as selectors -- no class, id, context, no nested selectors, no textual form (everything set programmatically).

Version: $Revision: 1.6 $ $Date: 2003/06/02 05:10:59 $

See Also: CSS

Field Summary
protected StyleSheetcascade_
Link to lower priority style sheet.
protected Contextcx_
static booleanDEBUG
Map<Object,ContextListener>key2cl_
protected Stringname_
static intPRIORITY_BLOCK
static intPRIORITY_CLASS
static intPRIORITY_ELEMENT
static intPRIORITY_ID
static intPRIORITY_INLINE
protected static ObjectTERMINAL
Constructor Summary
StyleSheet()
Method Summary
voidactivesAdd(List<ContextListener> actives, VObject o, Node parent)
Add all relevant ContextListeners to Context.
voidactivesRemove(List<ContextListener> actives, VObject o, Node parent)
StyleSheetcopy()
protected ContextcreateContext(Toolkit tk)
Create new Context matched to this StyleSheet's ContextListeners.
static inteatSpace(String str, int inx)
Arbitrary behaviors can be associated with styles.
ContextListenerget(Object key)
Low level: hash on object itself.
ContextListenerget(Object key, Node context)
StyleSheetgetCascade()
StyleSheetgetCascade(String name)
ContextgetContext(Graphics2D g, Toolkit tk, Context enclosing)
Return Context matched to this StyleSheet's ContextListeners.
ContextgetContext()
StringgetName()
voidparse(URL url)
Parse external style sheet.
voidparse(String csstxt, URL base)
Parse internal style sheet.
voidput(Object key, ContextListener cl)
Low level: hash on object itself.
voidput(String selector, ContextListener cl)
More sophisticated style sheet implementation can parse selector.
ContextListenerremove(Object key)
ContextListenerremove(String selector)
voidsetAttr(CLGeneral gs, String name, String value)
Parse attribute name-value pair into settings in CLGeneral.
voidsetAttrs(CLGeneral gs, String pairs)
Parse attribute name-value pair into settings in CLGeneral.
voidsetCascade(StyleSheet parent)
voidsetCascade(Document doc)
voidsetName(String name)
LATER Cache last lookup, so faster if have add immediately followed by remove on same args.
voidsetPriority(String selector, CLGeneral cl)
Compute priority of passed selector.
intsize()

Field Detail

cascade_

protected StyleSheet cascade_
Link to lower priority style sheet.

cx_

protected Context cx_

DEBUG

public static final boolean DEBUG

key2cl_

public Map<Object,ContextListener> key2cl_

name_

protected String name_

PRIORITY_BLOCK

public static final int PRIORITY_BLOCK

PRIORITY_CLASS

public static final int PRIORITY_CLASS

PRIORITY_ELEMENT

public static final int PRIORITY_ELEMENT

PRIORITY_ID

public static final int PRIORITY_ID

PRIORITY_INLINE

public static final int PRIORITY_INLINE

TERMINAL

protected static final Object TERMINAL

Constructor Detail

StyleSheet

public StyleSheet()

Method Detail

activesAdd

public void activesAdd(List<ContextListener> actives, VObject o, Node parent)
Add all relevant ContextListeners to Context. After invoking parent cascade, this simple implementation tries VObject's name and handle as selectors. Called directly by Leaf, indirectly by INode through paintBefore.

activesRemove

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

copy

public StyleSheet copy()

createContext

protected Context createContext(Toolkit tk)
Create new Context matched to this StyleSheet's ContextListeners. StyleSheet subclasses should override.

eatSpace

public static int eatSpace(String str, int inx)
Arbitrary behaviors can be associated with styles.

get

public ContextListener get(Object key)
Low level: hash on object itself.

get

public ContextListener get(Object key, Node context)

getCascade

public StyleSheet getCascade()

getCascade

public StyleSheet getCascade(String name)

getContext

public Context getContext(Graphics2D g, Toolkit tk, Context enclosing)
Return Context matched to this StyleSheet's ContextListeners. This context inherits from prevailing: Graphics2D, base_, signals.

getContext

public Context getContext()

getName

public String getName()

parse

public void parse(URL url)
Parse external style sheet.

parse

public void parse(String csstxt, URL base)
Parse internal style sheet. No definition in this simple style sheet -- have to set programmatically.

put

public void put(Object key, ContextListener cl)
Low level: hash on object itself.

put

public void put(String selector, ContextListener cl)
More sophisticated style sheet implementation can parse selector.

remove

public ContextListener remove(Object key)

remove

public ContextListener remove(String selector)

setAttr

public void setAttr(CLGeneral gs, String name, String value)
Parse attribute name-value pair into settings in CLGeneral.

setAttrs

public void setAttrs(CLGeneral gs, String pairs)
Parse attribute name-value pair into settings in CLGeneral.

setCascade

public void setCascade(StyleSheet parent)

setCascade

public void setCascade(Document doc)

setName

public void setName(String name)
LATER Cache last lookup, so faster if have add immediately followed by remove on same args. Invalidated by put. protected String lastvojb_=null, lastcx_=null; protected ContextListener[] lastcl_ = null;

setPriority

public void setPriority(String selector, CLGeneral cl)
Compute priority of passed selector.

size

public int size()