API Overview API Index Package Overview Direct link to this page
JDK 1.6
  javax.swing.text.html. StyleSheet View Source
Author(s)
Timothy Prinzing
Sunita Mani
Sara Swanson
Jill Nakata
Since
Version
1.91 11/30/05
Serial
Hierarchy
 Object
      StyleContext
          StyleSheet
Implements
Subclasses
Description
public class StyleSheet
  Support for defining the visual characteristics of HTML views being rendered.
See also:   
Constructors
public StyleSheet ()
Construct a StyleSheet
Methods
Hide/Show inherited methods
public AttributeSet addAttribute (AttributeSet old, Object key, Object value) [Overrides StyleContext]
  Adds an attribute to the given set, and returns the new representative set.
public AttributeSet addAttributes (AttributeSet old, AttributeSet attr) [Overrides StyleContext]
  Adds a set of attributes to the element.
public void addChangeListener (ChangeListener l) [Inherited From StyleContext]
  Adds a listener to track when styles are added or removed.
public void addCSSAttribute (MutableAttributeSet attr, Attribute key, String value)
  Adds a CSS attribute to the given set.
public boolean addCSSAttributeFromHTML (MutableAttributeSet attr, Attribute key, String value)
  Adds a CSS attribute to the given set.
public void addRule (String rule)
  Adds a set of rules to the sheet.
pack-private void addRule (String selector, AttributeSet declaration, boolean isLinked)
  Adds a rule into the StyleSheet.
public Style addStyle (String nm, Style parent) [Inherited From StyleContext]
  Adds a new style into the style hierarchy.
public void addStyleSheet (StyleSheet ss)
  Adds the rules from the StyleSheet ss to those of the receiver.
pack-private String cleanSelectorString (String selector)
Returns a string that only has one space between simple selectors, which may be the passed in String.
pack-private AttributeSet convertAttributeSet (AttributeSet a)
Converts a set of attributes (if necessary) so that any attributes that were specified as StyleConstants attributes and have a CSS mapping, will be converted to CSS attributes.
protected MutableAttributeSet createLargeAttributeSet (AttributeSet a) [Overrides StyleContext]
  Creates a large set of attributes that should trade off space for time.
protected SmallAttributeSet createSmallAttributeSet (AttributeSet a) [Overrides StyleContext]
  Creates a compact set of attributes that might be shared.
public Color getBackground (AttributeSet a) [Overrides StyleContext]
  Takes a set of attributes and turn it into a background color specification.
pack-private ImageIcon getBackgroundImage (AttributeSet attr)
Returns the ImageIcon to draw in the background for attr.
public URL getBase ()
  Returns the base.
public BoxPainter getBoxPainter (AttributeSet a)
Fetches the box formatter to use for the given set of CSS attributes.
public ChangeListener getChangeListeners () [Inherited From StyleContext]
  Returns an array of all the ChangeListeners added to this StyleContext with addChangeListener().
protected int getCompressionThreshold () [Inherited From StyleContext]
  Returns the maximum number of key/value pairs to try and compress into unique/immutable sets.
public AttributeSet getDeclaration (String decl)
  Translates a CSS declaration to an AttributeSet that represents the CSS declaration.
publicfinalstatic StyleContext getDefaultStyleContext () [Inherited From StyleContext]
  Returns default AttributeContext shared by all documents that don't bother to define/supply their own context.
public AttributeSet getEmptySet () [Inherited From StyleContext]
  Fetches an empty AttributeSet.
public Font getFont (AttributeSet a) [Overrides StyleContext]
Fetches the font to use for the given set of attributes.
public Font getFont (String family, int style, int size) [Inherited From StyleContext]
  Gets a new font.
public FontMetrics getFontMetrics (Font f) [Inherited From StyleContext]
  Returns font metrics for a font.
public Color getForeground (AttributeSet a) [Overrides StyleContext]
  Takes a set of attributes and turn it into a foreground color specification.
publicstatic int getIndexOfSize (float pt)
public ListPainter getListPainter (AttributeSet a)
Fetches the list formatter to use for the given set of CSS attributes.
public float getPointSize (int index)
Returns the point size, given a size index.
public float getPointSize (String size)
Given a string such as "+2", "-2", or "2", returns a point size value.
public Style getRule (Tag t, Element e)
  Fetches the style to use to render the given type of HTML tag.
public Style getRule (String selector)
  Fetches the rule that best matches the selector given in string form.
pack-private String getSimpleSelectors (String selector)
Returns the simple selectors that comprise selector.
pack-private int getSizeMap ()
pack-privatestatic int getSpecificity (String selector)
  Returns the specificity of the passed in String.
publicstatic Object getStaticAttribute (Object key) [Inherited From StyleContext]
Returns the object previously registered with registerStaticAttributeKey.
publicstatic Object getStaticAttributeKey (Object key) [Inherited From StyleContext]
  Returns the String that key will be registered with
public Style getStyle (String nm) [Inherited From StyleContext]
  Fetches a named style previously added to the document
public Enumeration<Object> getStyleNames () [Inherited From StyleContext]
  Fetches the names of the styles defined.
public StyleSheet getStyleSheets ()
  Returns an array of the linked StyleSheets.
public AttributeSet getViewAttributes (View v)
  Fetches a set of attributes to use in the view for displaying.
public void importStyleSheet (URL url)
  Imports a style sheet from url.
pack-private boolean isW3CLengthUnits ()
public void loadRules (Reader in, URL ref) throws IOException
  Loads a set of rules that have been specified in terms of CSS1 grammar.
public void readAttributes (ObjectInputStream in, MutableAttributeSet a) throws ClassNotFoundException IOException [Inherited From StyleContext]
Context-specific handling of reading in attributes
publicstatic void readAttributeSet (ObjectInputStream in, MutableAttributeSet a) throws ClassNotFoundException IOException [Inherited From StyleContext]
  Reads a set of attributes from the given object input stream that have been previously written out with writeAttributeSet.
pack-private void rebaseSizeMap (int base)
public void reclaim (AttributeSet a) [Inherited From StyleContext]
  Returns a set no longer needed by the MutableAttributeSet implmentation.
publicstatic void registerStaticAttributeKey (Object key) [Inherited From StyleContext]
  Registers an object as a static object that is being used as a key in attribute sets.
public AttributeSet removeAttribute (AttributeSet old, Object key) [Overrides StyleContext]
  Removes an attribute from the set.
public AttributeSet removeAttributes (AttributeSet old, AttributeSet attrs) [Overrides StyleContext]
  Removes a set of attributes.
public AttributeSet removeAttributes (AttributeSet old, Enumeration<Object> names) [Overrides StyleContext]
  Removes a set of attributes for the element.
public void removeChangeListener (ChangeListener l) [Inherited From StyleContext]
  Removes a listener that was tracking styles being added or removed.
public void removeStyle (String nm) [Overrides StyleContext]
  Removes a named style previously added to the document.
public void removeStyleSheet (StyleSheet ss)
  Removes the StyleSheet ss from those of the receiver.
public void setBase (URL base)
  Sets the base.
public void setBaseFontSize (int sz)
Sets the base font size, with valid values between 1 and 7.
public void setBaseFontSize (String size)
  Sets the base font size from the passed in String.
public Color stringToColor (String string)
  Converts a color string such as "RED" or "#NNNNNN" to a Color.
public String toString () [Inherited From StyleContext]
  Converts a StyleContext to a String.
public AttributeSet translateHTMLToCSS (AttributeSet htmlAttrSet)
  Converts a set of HTML attributes to an equivalent set of CSS attributes.
public void writeAttributes (ObjectOutputStream out, AttributeSet a) throws IOException [Inherited From StyleContext]
Context-specific handling of writing out attributes
publicstatic void writeAttributeSet (ObjectOutputStream out, AttributeSet a) throws IOException [Inherited From StyleContext]
  Writes a set of attributes to the given object stream for the purpose of serialization.
Fields
Hide/Show inherited fields
pack-privatefinalstatic int DEFAULT_FONT_SIZE = "3"
publicfinalstatic String DEFAULT_STYLE = "default" [Inherited From StyleContext]
The name given to the default logical style attached to paragraphs.
pack-privatefinalstatic Border noBorder
pack-privatefinalstatic int sizeMapDefault
The HTML/CSS size model has seven slots that one can assign sizes to.
Nested Classes
  StyleSheet.LargeConversionSet
Large set of attributes that does conversion of requests for attributes of type StyleConstants.
  StyleSheet.SmallConversionSet
Small set of attributes that does conversion of requests for attributes of type StyleConstants.
  StyleSheet.BoxPainter
Class to carry out some of the duties of CSS formatting.
  StyleSheet.ListPainter
Class to carry out some of the duties of CSS list formatting.
  StyleSheet.BackgroundImagePainter
Paints the background image.
  StyleSheet.ViewAttributeSet
A subclass of MuxingAttributeSet that translates between CSS and HTML and StyleConstants.
  StyleSheet.ResolvedStyle
A subclass of MuxingAttributeSet that implements Style.
  StyleSheet.SelectorMapping
SelectorMapping contains a specifitiy, as an integer, and an associated Style.
  StyleSheet.CssParser
Default parser for CSS specifications that get loaded into the StyleSheet.
  StyleContext.SmallAttributeSet
This class holds a small number of attributes in an array.
  StyleContext.NamedStyle
A collection of attributes, typically used to represent character and paragraph styles.
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar