org.apache.batik.css
Class AbstractViewCSS

java.lang.Object
  |
  +--org.apache.batik.css.AbstractViewCSS
All Implemented Interfaces:
AbstractView, ViewCSS
Direct Known Subclasses:
CommonViewCSS

public abstract class AbstractViewCSS
extends java.lang.Object
implements ViewCSS

This class provides an abstract implementation of the ViewCSS interface.


Field Summary
protected  DocumentView document
          The document of which this object is a view.
protected  MediaList media
          The media to use for cascading.
protected  java.util.List relativeValueResolvers
          The relative value resolvers.
protected  SoftDoublyIndexedTable styles
          The cached computed styles.
protected  CSSStyleSheet userAgentStyleSheet
          The user-agent style sheet.
protected  CSSStyleSheet userStyleSheet
          The user style sheet.
 
Constructor Summary
protected AbstractViewCSS(DocumentView doc)
          creates a new ViewCSS object.
 
Method Summary
protected  void addAuthorStyleSheetProperties(Element e, java.lang.String pe, CSSOMReadOnlyStyleDeclaration rd)
          Adds the author style sheets properties matching the given element and pseudo-element to the given style declaration.
protected  void addInlineStyleProperties(Element e, java.lang.String pe, java.net.URL buri, CSSOMReadOnlyStyleDeclaration rd)
          Adds the inline style properties to the given style declaration.
protected  void addMatchingRules(CSSRuleList l, Element e, java.lang.String pe, java.net.URL buri, CSSOMRuleList rl)
          Adds the style rules that match the given element and pseudo-element to the given rule list.
protected  void addNonCSSPresentationalHints(Element e, java.lang.String pe, java.net.URL buri, CSSOMReadOnlyStyleDeclaration rd)
          Adds the non-CSS presentational hints to the given style declaration.
protected  void addOverrideStyleProperties(Element e, java.lang.String pe, java.net.URL buri, CSSOMReadOnlyStyleDeclaration rd)
          Adds the override style properties to the given style declaration.
 void addRelativeValueResolver(RelativeValueResolver rvr)
          Adds a resolver to the resolver list.
protected  void addUserAgentProperties(Element e, java.lang.String pe, CSSOMReadOnlyStyleDeclaration rd)
          Adds the user-agent style sheets properties matching the given element and pseudo-element to the given style declaration.
protected  void addUserProperties(Element e, java.lang.String pe, CSSOMReadOnlyStyleDeclaration rd)
          Adds the user style sheets properties matching the given element and pseudo-element to the given style declaration.
protected  void computeRelativeValues(Element e, java.lang.String pe, CSSOMReadOnlyStyleDeclaration rd)
          Computes the relative values in the given style declaration for the given element and pseudo-element.
 CSSOMReadOnlyStyleDeclaration computeStyle(Element elt, java.lang.String pseudoElt)
          Computes the cascaded style for the given element and pseudo element.
 void dispose()
          Clears the caches.
 CSSOMReadOnlyStyleDeclaration getCascadedStyle(Element elt, java.lang.String pseudoElt)
          Computes the cascaded style for the given element and pseudo element.
 CSSStyleDeclaration getComputedStyle(Element elt, java.lang.String pseudoElt)
          DOM: Implements ViewCSS.getComputedStyle(Element,String).
 CSSOMReadOnlyStyleDeclaration getComputedStyleInternal(Element elt, java.lang.String pseudoElt)
          Internal version of getComputedStyle().
 DocumentView getDocument()
          DOM: Implements AbstractView.getDocument().
protected  boolean mediaMatch(MediaList ml)
          Whether the given media list matches the media list of this ViewCSS object.
protected  void resolveURI(CSSOMReadOnlyValue value, java.net.URL buri)
          If 'value' is an CSS_URI, resolves the value, relative to the given URI.
protected  void setAuthorProperty(java.lang.String name, CSSStyleDeclaration decl, java.net.URL buri, CSSOMReadOnlyStyleDeclaration dest)
          Sets a author value to a computed style declaration.
 void setComputedStyle(Element elt, java.lang.String pseudoElt, CSSOMReadOnlyStyleDeclaration sd)
          Sets the computed style in the cache in a way it is not collectable.
 void setMedia(java.lang.String mediaText)
          Sets the media to use to compute the styles.
protected  void setUserAgentProperty(java.lang.String name, CSSStyleDeclaration decl, CSSOMReadOnlyStyleDeclaration dest)
          Sets a user-agent value to a computed style declaration.
 void setUserAgentStyleSheet(CSSStyleSheet ss)
          Sets the user-agent style sheet to use for cascading.
protected  void setUserProperty(java.lang.String name, CSSStyleDeclaration decl, CSSOMReadOnlyStyleDeclaration dest)
          Sets a user value to a computed style declaration.
 void setUserStyleSheet(CSSStyleSheet ss)
          Sets the user style sheet to use for cascading.
protected  CSSOMRuleList sortRules(CSSOMRuleList l, Element e, java.lang.String pe)
          Sorts the rules in the given rule list by specificity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

document

protected DocumentView document
The document of which this object is a view.

styles

protected SoftDoublyIndexedTable styles
The cached computed styles.

media

protected MediaList media
The media to use for cascading.

userAgentStyleSheet

protected CSSStyleSheet userAgentStyleSheet
The user-agent style sheet.

userStyleSheet

protected CSSStyleSheet userStyleSheet
The user style sheet.

relativeValueResolvers

protected java.util.List relativeValueResolvers
The relative value resolvers.
Constructor Detail

AbstractViewCSS

protected AbstractViewCSS(DocumentView doc)
creates a new ViewCSS object.
Parameters:
doc - The document view associated with this abstract view.
Method Detail

getDocument

public DocumentView getDocument()
DOM: Implements AbstractView.getDocument().
Specified by:
getDocument in interface AbstractView

getComputedStyle

public CSSStyleDeclaration getComputedStyle(Element elt,
                                            java.lang.String pseudoElt)
DOM: Implements ViewCSS.getComputedStyle(Element,String).
Specified by:
getComputedStyle in interface ViewCSS
Following copied from interface: org.w3c.dom.css.ViewCSS
Parameters:
elt - The element whose style is to be computed. This parameter cannot be null.
pseudoElt - The pseudo-element or null if none.
Returns:
The computed style. The CSSStyleDeclaration is read-only and contains only absolute values.

getComputedStyleInternal

public CSSOMReadOnlyStyleDeclaration getComputedStyleInternal(Element elt,
                                                              java.lang.String pseudoElt)
Internal version of getComputedStyle().

setComputedStyle

public void setComputedStyle(Element elt,
                             java.lang.String pseudoElt,
                             CSSOMReadOnlyStyleDeclaration sd)
Sets the computed style in the cache in a way it is not collectable.

dispose

public void dispose()
Clears the caches.

setMedia

public void setMedia(java.lang.String mediaText)
Sets the media to use to compute the styles.
Parameters:
mediaText - The text representation of the media.

setUserAgentStyleSheet

public void setUserAgentStyleSheet(CSSStyleSheet ss)
Sets the user-agent style sheet to use for cascading.

setUserStyleSheet

public void setUserStyleSheet(CSSStyleSheet ss)
Sets the user style sheet to use for cascading.

addRelativeValueResolver

public void addRelativeValueResolver(RelativeValueResolver rvr)
Adds a resolver to the resolver list.

computeStyle

public CSSOMReadOnlyStyleDeclaration computeStyle(Element elt,
                                                  java.lang.String pseudoElt)
Computes the cascaded style for the given element and pseudo element.

getCascadedStyle

public CSSOMReadOnlyStyleDeclaration getCascadedStyle(Element elt,
                                                      java.lang.String pseudoElt)
Computes the cascaded style for the given element and pseudo element.

computeRelativeValues

protected void computeRelativeValues(Element e,
                                     java.lang.String pe,
                                     CSSOMReadOnlyStyleDeclaration rd)
Computes the relative values in the given style declaration for the given element and pseudo-element.
Parameters:
e - The element to match.
pe - The pseudo-element to match.
rd - The result style declaration.

addUserAgentProperties

protected void addUserAgentProperties(Element e,
                                      java.lang.String pe,
                                      CSSOMReadOnlyStyleDeclaration rd)
Adds the user-agent style sheets properties matching the given element and pseudo-element to the given style declaration.
Parameters:
e - The element to match.
pe - The pseudo-element to match.
rd - The result style declaration.

setUserAgentProperty

protected void setUserAgentProperty(java.lang.String name,
                                    CSSStyleDeclaration decl,
                                    CSSOMReadOnlyStyleDeclaration dest)
Sets a user-agent value to a computed style declaration.
Parameters:
name - The property name.
decl - The style declaration.
dest - The result style declaration.

addUserProperties

protected void addUserProperties(Element e,
                                 java.lang.String pe,
                                 CSSOMReadOnlyStyleDeclaration rd)
Adds the user style sheets properties matching the given element and pseudo-element to the given style declaration.
Parameters:
e - The element to match.
pe - The pseudo-element to match.
rd - The result style declaration.

setUserProperty

protected void setUserProperty(java.lang.String name,
                               CSSStyleDeclaration decl,
                               CSSOMReadOnlyStyleDeclaration dest)
Sets a user value to a computed style declaration.
Parameters:
name - The property name.
decl - The style declaration.
dest - The result style declaration.

addNonCSSPresentationalHints

protected void addNonCSSPresentationalHints(Element e,
                                            java.lang.String pe,
                                            java.net.URL buri,
                                            CSSOMReadOnlyStyleDeclaration rd)
Adds the non-CSS presentational hints to the given style declaration.
Parameters:
e - The element to match.
pe - The pseudo-element to match.
rd - The result style declaration.

addAuthorStyleSheetProperties

protected void addAuthorStyleSheetProperties(Element e,
                                             java.lang.String pe,
                                             CSSOMReadOnlyStyleDeclaration rd)
Adds the author style sheets properties matching the given element and pseudo-element to the given style declaration.
Parameters:
e - The element to match.
pe - The pseudo-element to match.
rd - The result style declaration.

addInlineStyleProperties

protected void addInlineStyleProperties(Element e,
                                        java.lang.String pe,
                                        java.net.URL buri,
                                        CSSOMReadOnlyStyleDeclaration rd)
Adds the inline style properties to the given style declaration.
Parameters:
e - The element to match.
pe - The pseudo-element to match.
buri - The base uri, if any.
rd - The result style declaration.

addOverrideStyleProperties

protected void addOverrideStyleProperties(Element e,
                                          java.lang.String pe,
                                          java.net.URL buri,
                                          CSSOMReadOnlyStyleDeclaration rd)
Adds the override style properties to the given style declaration.
Parameters:
e - The element to match.
pe - The pseudo-element to match.
buri - The base uri, if any.
rd - The result style declaration.

setAuthorProperty

protected void setAuthorProperty(java.lang.String name,
                                 CSSStyleDeclaration decl,
                                 java.net.URL buri,
                                 CSSOMReadOnlyStyleDeclaration dest)
Sets a author value to a computed style declaration.
Parameters:
name - The property name.
decl - The style declaration.
buri - The base uri, if any.
dest - The result style declaration.

resolveURI

protected void resolveURI(CSSOMReadOnlyValue value,
                          java.net.URL buri)
If 'value' is an CSS_URI, resolves the value, relative to the given URI.

addMatchingRules

protected void addMatchingRules(CSSRuleList l,
                                Element e,
                                java.lang.String pe,
                                java.net.URL buri,
                                CSSOMRuleList rl)
Adds the style rules that match the given element and pseudo-element to the given rule list.
Parameters:
l - The input rule list.
e - The element to match.
pe - The pseudo-element to match.
buri - The base uri, if any.
rl - The result rule list.

sortRules

protected CSSOMRuleList sortRules(CSSOMRuleList l,
                                  Element e,
                                  java.lang.String pe)
Sorts the rules in the given rule list by specificity.
Parameters:
l - The rule list. The list is cleared by the methods.
e - The element to match.
pe - The pseudo-element to match.
Returns:
The sorted list.

mediaMatch

protected boolean mediaMatch(MediaList ml)
Whether the given media list matches the media list of this ViewCSS object.


Copyright © 2001 Apache Software Foundation. All Rights Reserved.