|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.inet.html.css.Styles
public class Styles
This class represents the complete style sheet of a website, including all linked style information.
Nested Class Summary | |
---|---|
static class |
Styles.StyleSheetEntry
Simple data container for style sheet entries |
Constructor Summary | |
---|---|
Styles(java.lang.String filename)
Creates a new style container |
|
Styles(java.lang.String filename,
Styles base)
Creates a new style container, copies all styles from base to this container |
Method Summary | |
---|---|
void |
addInitialRule(java.lang.String selectors,
javax.swing.text.AttributeSet attrs,
java.lang.String fileName)
Adds an initial rule with several attributes to this container. |
void |
addRule(java.lang.String selectors,
javax.swing.text.AttributeSet attrs,
java.lang.Object source,
boolean skipIfKnown,
boolean isInline)
Adds a rule with several attributes to this container |
void |
clear()
Removes all rules from this styles. |
void |
compile()
THIS FUNCTION SHOULD BE USED ONLY FOR THE LOWEST-PRIO STYLESHEET! |
java.util.List<Selector> |
createMatchList(javax.swing.text.Element targetElement,
HTML.Tag tag)
Creates a list of all selectors, that match the element. |
java.lang.Object |
getClassName(java.lang.Object identifier)
Returns the generated class name for an identifier. |
com.inet.html.parser.converter.AttributeValue |
getCssAttribute(javax.swing.text.Element elemAttrs,
CSS.Attribute searchAttr,
boolean important)
Search an AttributValue in the styles for the described element. |
com.inet.html.parser.converter.AttributeValue |
getCssAttribute(javax.swing.text.Element elemAttrs,
CSS.Attribute searchAttr,
boolean important,
java.util.List<Selector> matchList)
Search an AttributValue in the styles for the described element. |
javax.swing.text.MutableAttributeSet |
getDefaultSet(java.lang.Object tag)
Returns the default set, which applies to any element with the given tag |
java.util.Set<CSS.Attribute> |
getDescribedAttributes()
Returns a list of all CSS attributes described by the matchlists of this stylesheet. |
java.util.List<Styles.StyleSheetEntry> |
getEntries(java.lang.Object sourceIdentifier)
Returns all entries of a CSS source. |
int |
getInitialCount()
This is the number of attribute sets, which where defined by the base style sheet given in the constructor. |
java.lang.String |
getName()
Returns the internal name of this stylesheet, may be null |
int |
getRuleCount()
Get the count of added Rules. |
java.util.List<java.lang.Object> |
getSourceIdentifiers()
Returns a list of all known source identifiers |
boolean |
isCompiled()
Returns true, if the selectors were compiled |
boolean |
isExternal(java.lang.Object identifier)
Checks, if the source referenced by the identifier is an external source. |
java.lang.Object |
register(java.lang.Object source,
boolean isInline,
boolean isForeign)
Registers a new style source, required to add rules of this source to the document |
void |
setResolver(CSSChangeListener resolver)
Set the resolver of this stylesheet. |
void |
updateIndex()
Checks and updates the class generator index. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Styles(java.lang.String filename)
filename
- The name for this stylesheet (currently not used)public Styles(java.lang.String filename, Styles base)
base
to this container
filename
- The name for this stylesheet (currently not used)base
- the base styles to copyMethod Detail |
---|
public void addInitialRule(java.lang.String selectors, javax.swing.text.AttributeSet attrs, java.lang.String fileName)
selectors
- String with one or more comma separated selectorsattrs
- the referenced attribute setfileName
- the name of an external CSS file or nullpublic java.lang.Object register(java.lang.Object source, boolean isInline, boolean isForeign)
source
- the source identifierisInline
- set to true, if the styles are part of the STYLE elementisForeign
- set to true, if the styles were pasted into the current document
public void updateIndex()
public void addRule(java.lang.String selectors, javax.swing.text.AttributeSet attrs, java.lang.Object source, boolean skipIfKnown, boolean isInline)
selectors
- String with one or more comma separated selectorsattrs
- the referenced attribute setsource
- the source identifier, may be an URI or any other identifiable objectskipIfKnown
- if there is already an equal selector with an equal set of attributes
the current selector will NOT be added, although it would have a higher priority. This can
be used to avoid duplicate style-entries on insertsisInline
- this has to be set to true, if the style is part of the STYLE element of the primary document.
Only these styles will be checked for auto generates classes!public int getRuleCount()
#addRule(String, AttributeSet, String)
public java.util.List<java.lang.Object> getSourceIdentifiers()
public boolean isExternal(java.lang.Object identifier)
identifier
- the identifier to check
public java.util.List<Styles.StyleSheetEntry> getEntries(java.lang.Object sourceIdentifier)
sourceIdentifier
- the identifier of the source
public com.inet.html.parser.converter.AttributeValue getCssAttribute(javax.swing.text.Element elemAttrs, CSS.Attribute searchAttr, boolean important)
elemAttrs
- the attributes that descibed the elementsearchAttr
- The attribute to search forimportant
- if true, the important selectors will be checkt, if false the normal selectors will be checked
public com.inet.html.parser.converter.AttributeValue getCssAttribute(javax.swing.text.Element elemAttrs, CSS.Attribute searchAttr, boolean important, java.util.List<Selector> matchList)
elemAttrs
- the attributes that described the elementsearchAttr
- The attribute to search forimportant
- if true, the important selectors will be checked, if false the normal selectors will be checkedmatchList
- A list of selectors, which match this element
public java.util.List<Selector> createMatchList(javax.swing.text.Element targetElement, HTML.Tag tag)
targetElement
- the element to matchtag
- is passed for performance, it eqals to targetElement.getAttributes().getAttribute(
StyleConstants.NameAttribute ) and can be null if the type is another
public void clear()
public java.lang.String getName()
public int getInitialCount()
public void setResolver(CSSChangeListener resolver)
resolver
- the current resolver or nullpublic void compile()
public boolean isCompiled()
public java.util.Set<CSS.Attribute> getDescribedAttributes()
public javax.swing.text.MutableAttributeSet getDefaultSet(java.lang.Object tag)
tag
- the tag of the element
public java.lang.Object getClassName(java.lang.Object identifier)
identifier
- the identifier
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |