public class StyleSheet extends javax.swing.text.StyleContext
| Modifier and Type | Class and Description |
|---|---|
static class |
StyleSheet.BoxPainter
This class carries out some of the duties of CSS formatting.
|
static class |
StyleSheet.ListPainter
This class carries out some of the CSS list formatting duties.
|
| Constructor and Description |
|---|
StyleSheet()
Constructs a StyleSheet.
|
| Modifier and Type | Method and Description |
|---|---|
javax.swing.text.AttributeSet |
addAttribute(javax.swing.text.AttributeSet old,
java.lang.Object key,
java.lang.Object value)
Adds an attribute to the given set and returns a new set.
|
javax.swing.text.AttributeSet |
addAttributes(javax.swing.text.AttributeSet old,
javax.swing.text.AttributeSet attr)
Adds a set of attributes to the element.
|
void |
addCSSAttribute(javax.swing.text.MutableAttributeSet attr,
CSS.Attribute key,
java.lang.String value)
Adds a CSS attribute to the given set.
|
boolean |
addCSSAttributeFromHTML(javax.swing.text.MutableAttributeSet attr,
CSS.Attribute key,
java.lang.String value)
Adds a CSS attribute to the given set.
|
void |
addRule(java.lang.String rule)
Adds a set of rules to the sheet.
|
void |
addStyleSheet(StyleSheet ss)
Adds the rules from ss to those of the receiver. ss's rules will
override the old rules.
|
protected javax.swing.text.MutableAttributeSet |
createLargeAttributeSet(javax.swing.text.AttributeSet a)
Creates a large set of attributes.
|
protected javax.swing.text.StyleContext.SmallAttributeSet |
createSmallAttributeSet(javax.swing.text.AttributeSet a)
Creates a compact set of attributes that might be shared.
|
java.awt.Color |
getBackground(javax.swing.text.AttributeSet a)
Takes a set of attributes and turns it into a background
color specification.
|
java.net.URL |
getBase()
Gets the base url.
|
StyleSheet.BoxPainter |
getBoxPainter(javax.swing.text.AttributeSet a)
Gets the box formatter to use for the given set of CSS attributes.
|
javax.swing.text.AttributeSet |
getDeclaration(java.lang.String decl)
Translates a CSS declaration into an AttributeSet.
|
java.awt.Font |
getFont(javax.swing.text.AttributeSet a)
Gets the font to use for the given set.
|
java.awt.Color |
getForeground(javax.swing.text.AttributeSet a)
Takes a set of attributes and turns it into a foreground
color specification.
|
static int |
getIndexOfSize(float pt)
TODO
|
StyleSheet.ListPainter |
getListPainter(javax.swing.text.AttributeSet a)
Gets the list formatter to use for the given set of CSS attributes.
|
float |
getPointSize(int index)
Gets the point size, given a size index.
|
float |
getPointSize(java.lang.String size)
Given the string of the size, returns the point size value.
|
javax.swing.text.Style |
getRule(HTML.Tag t,
javax.swing.text.Element e)
Gets the style used to render the given tag.
|
javax.swing.text.Style |
getRule(java.lang.String selector)
Gets the rule that best matches the selector. selector is a space
separated String of element names.
|
StyleSheet[] |
getStyleSheets()
Returns an array of the linked StyleSheets.
|
javax.swing.text.AttributeSet |
getViewAttributes(javax.swing.text.View v)
Gets a set of attributes to use in the view.
|
void |
importStyleSheet(java.net.URL url)
Imports a style sheet from the url.
|
void |
loadRules(java.io.Reader in,
java.net.URL ref)
Loads a set of rules that have been specified in terms of CSS grammar.
|
javax.swing.text.AttributeSet |
removeAttribute(javax.swing.text.AttributeSet old,
java.lang.Object key)
Removes an attribute from the set.
|
javax.swing.text.AttributeSet |
removeAttributes(javax.swing.text.AttributeSet old,
javax.swing.text.AttributeSet attrs)
Removes an attribute from the set.
|
javax.swing.text.AttributeSet |
removeAttributes(javax.swing.text.AttributeSet old,
java.util.Enumeration<?> names)
Removes a set of attributes for the element.
|
void |
removeStyle(java.lang.String nm)
Removes a style previously added.
|
void |
removeStyleSheet(StyleSheet ss)
Removes ss from those of the receiver
|
void |
setBase(java.net.URL base)
Sets the base url.
|
void |
setBaseFontSize(int sz)
Sets the base font size between 1 and 7.
|
void |
setBaseFontSize(java.lang.String size)
Sets the base font size from the String.
|
java.awt.Color |
stringToColor(java.lang.String colorName)
Convert the color string represenation into java.awt.Color.
|
javax.swing.text.AttributeSet |
translateHTMLToCSS(javax.swing.text.AttributeSet htmlAttrSet)
Converts a set of HTML attributes to an equivalent set of CSS attributes.
|
addChangeListener, addStyle, getChangeListeners, getCompressionThreshold, getDefaultStyleContext, getEmptySet, getFont, getFontMetrics, getStaticAttribute, getStaticAttributeKey, getStyle, getStyleNames, readAttributes, readAttributeSet, reclaim, registerStaticAttributeKey, removeChangeListener, toString, writeAttributes, writeAttributeSetpublic StyleSheet()
public javax.swing.text.Style getRule(HTML.Tag t, javax.swing.text.Element e)
t - - the tag to translate to visual attributese - - the element representing the tagpublic javax.swing.text.Style getRule(java.lang.String selector)
selector - - the element names separated by spacespublic void addRule(java.lang.String rule)