Java Doc for CSS.java in  » 6.0-JDK-Core » swing » javax » swing » text » html » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » swing » javax.swing.text.html 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.swing.text.html.CSS

CSS
public class CSS implements Serializable(Code)
Defines a set of CSS attributes as a typesafe enumeration. The HTML View implementations use CSS attributes to determine how they will render. This also defines methods to map between CSS/HTML/StyleConstants. Any shorthand properties, such as font, are mapped to the intrinsic properties.

The following describes the CSS properties that are suppored by the rendering engine:

  • font-family
  • font-style
  • font-size (supports relative units)
  • font-weight
  • font
  • color
  • background-color (with the exception of transparent)
  • background-image
  • background-repeat
  • background-position
  • background
  • background-repeat
  • text-decoration (with the exception of blink and overline)
  • vertical-align (only sup and super)
  • text-align (justify is treated as center)
  • margin-top
  • margin-right
  • margin-bottom
  • margin-left
  • margin
  • padding-top
  • padding-right
  • padding-bottom
  • padding-left
  • border-style (only supports inset, outset and none)
  • list-style-type
  • list-style-position
The following are modeled, but currently not rendered.
  • font-variant
  • background-attachment (background always treated as scroll)
  • word-spacing
  • letter-spacing
  • text-indent
  • text-transform
  • line-height
  • border-top-width (this is used to indicate if a border should be used)
  • border-right-width
  • border-bottom-width
  • border-left-width
  • border-width
  • border-top
  • border-right
  • border-bottom
  • border-left
  • border
  • width
  • height
  • float
  • clear
  • display
  • white-space
  • list-style

Note: for the time being we do not fully support relative units, unless noted, so that p { margin-top: 10% } will be treated as if no margin-top was specified.
author:
   Timothy Prinzing
author:
   Scott Violet
version:
   1.74 05/05/07
See Also:   StyleSheet


Inner Class :final public static class Attribute
Inner Class :final static class Value
Inner Class :static class CssValue implements Serializable
Inner Class :static class StringValue extends CssValue
Inner Class :class FontSize extends CssValue
Inner Class :static class FontFamily extends CssValue
Inner Class :static class FontWeight extends CssValue
Inner Class :static class ColorValue extends CssValue
Inner Class :static class BorderStyle extends CssValue
Inner Class :static class LengthValue extends CssValue
Inner Class :static class BorderWidthValue extends LengthValue
Inner Class :static class CssValueMapper extends CssValue
Inner Class :static class BackgroundPosition extends CssValue
Inner Class :static class BackgroundImage extends CssValue
Inner Class :static class LengthUnit implements Serializable
Inner Class :static class ShorthandFontParser
Inner Class :static class ShorthandBackgroundParser
Inner Class :static class ShorthandMarginParser
Inner Class :interface LayoutIterator

Field Summary
static  intbaseFontSizeIndex
    

Constructor Summary
public  CSS()
    

Method Summary
 voidaddInternalCSSValue(MutableAttributeSet attr, CSS.Attribute key, String value)
     Parses the CSS property key with value value placing the result in att.
static  voidcalculateTiledLayout(LayoutIterator iter, int targetSpan)
     Calculate a tiled layout for the given iterator.
static  SizeRequirementscalculateTiledRequirements(LayoutIterator iter, SizeRequirements r)
     Calculate the requirements needed to tile the requirements given by the iterator that would be tiled.
static  StringcolorToHex(Color color)
    
 ObjectcssValueToStyleConstantsValue(StyleConstants key, Object value)
     Converts the passed in CSS value to a StyleConstants value.
public static  Attribute[]getAllAttributeKeys()
     Return the set of all possible CSS attribute keys.
final public static  AttributegetAttribute(String name)
     Translates a string to a CSS.Attribute object.
 intgetBaseFontSize()
     Returns the base font size.
 ColorgetColor(AttributeSet a, CSS.Attribute key)
     Takes a set of attributes and turn it into a color specification.
 ObjectgetCssValue(CSS.Attribute cssAttr, String htmlAttrValue)
     Given a CSS.Attribute object and its corresponding HTML.Attribute's value, this method returns a CssValue object to associate with the CSS attribute.
 FontgetFont(StyleContext sc, AttributeSet a, int defaultSize, StyleSheet ss)
     Returns the font for the values in the passed in AttributeSet.
static  intgetFontSize(AttributeSet attr, int defaultSize, StyleSheet ss)
    
static  intgetIndexOfSize(float pt, int[] sizeMap)
    
static  intgetIndexOfSize(float pt, StyleSheet ss)
    
 ObjectgetInternalCSSValue(CSS.Attribute key, String value)
     Gets the internal CSS representation of value which is a CSS value of the CSS attribute named key.
 floatgetLength(AttributeSet a, CSS.Attribute key, StyleSheet ss)
     Returns the length of the attribute in a with key key.
 floatgetPointSize(String size, StyleSheet ss)
     Returns the size of a font from the passed in string.
 floatgetPointSize(int index, StyleSheet ss)
     Return the point size, given a size index.
static  URLgetURL(URL base, String cssString)
     Returns a URL for the given CSS url string.
final static  ValuegetValue(String name)
     Translates a string to a CSS.Value object.
final static  ColorhexToColor(String value)
     Convert a "#FFFFFF" hex string to a Color.
static  String[]parseStrings(String value)
    
 voidsetBaseFontSize(int sz)
     Sets the base font size.
 voidsetBaseFontSize(String size)
     Sets the base font size from the passed in string.
static  ColorstringToColor(String str)
     Convert a color string such as "RED" or "#NNNNNN" or "rgb(r, g, b)" to a Color.
 AttributestyleConstantsKeyToCSSKey(StyleConstants sc)
     Maps from a StyleConstants to a CSS Attribute.
 ObjectstyleConstantsValueToCSSValue(StyleConstants sc, Object styleValue)
     Maps from a StyleConstants value to a CSS value.
 AttributeSettranslateHTMLToCSS(AttributeSet htmlAttrSet)
     Convert a set of HTML attributes to an equivalent set of CSS attributes.
Parameters:
  AttributeSet - containing the HTML attributes.

Field Detail
baseFontSizeIndex
static int baseFontSizeIndex(Code)




Constructor Detail
CSS
public CSS()(Code)




Method Detail
addInternalCSSValue
void addInternalCSSValue(MutableAttributeSet attr, CSS.Attribute key, String value)(Code)
Parses the CSS property key with value value placing the result in att.



calculateTiledLayout
static void calculateTiledLayout(LayoutIterator iter, int targetSpan)(Code)
Calculate a tiled layout for the given iterator. This should be done collapsing the neighboring margins to be a total of the maximum of the two neighboring margin areas as described in the CSS spec.



calculateTiledRequirements
static SizeRequirements calculateTiledRequirements(LayoutIterator iter, SizeRequirements r)(Code)
Calculate the requirements needed to tile the requirements given by the iterator that would be tiled. The calculation takes into consideration margin and border spacing.



colorToHex
static String colorToHex(Color color)(Code)
Converts a type Color to a hex string in the format "#RRGGBB"



cssValueToStyleConstantsValue
Object cssValueToStyleConstantsValue(StyleConstants key, Object value)(Code)
Converts the passed in CSS value to a StyleConstants value. key identifies the CSS attribute being mapped.



getAllAttributeKeys
public static Attribute[] getAllAttributeKeys()(Code)
Return the set of all possible CSS attribute keys.



getAttribute
final public static Attribute getAttribute(String name)(Code)
Translates a string to a CSS.Attribute object. This will return null if there is no attribute by the given name.
Parameters:
  name - the name of the CSS attribute to fetch thetypesafe enumeration for the CSS.Attribute object,or null if the stringdoesn't represent a valid attribute key



getBaseFontSize
int getBaseFontSize()(Code)
Returns the base font size.



getColor
Color getColor(AttributeSet a, CSS.Attribute key)(Code)
Takes a set of attributes and turn it into a color specification. This might be used to specify things like brighter, more hue, etc. This will return null if there is no value for key.
Parameters:
  key - CSS.Attribute identifying where color is stored.
Parameters:
  a - the set of attributes the color



getCssValue
Object getCssValue(CSS.Attribute cssAttr, String htmlAttrValue)(Code)
Given a CSS.Attribute object and its corresponding HTML.Attribute's value, this method returns a CssValue object to associate with the CSS attribute.
Parameters:
  the - CSS.Attribute
Parameters:
  a - String containing the value associated HTML.Attribtue.



getFont
Font getFont(StyleContext sc, AttributeSet a, int defaultSize, StyleSheet ss)(Code)
Returns the font for the values in the passed in AttributeSet. It is assumed the keys will be CSS.Attribute keys. sc is the StyleContext that will be messaged to get the font once the size, name and style have been determined.



getFontSize
static int getFontSize(AttributeSet attr, int defaultSize, StyleSheet ss)(Code)



getIndexOfSize
static int getIndexOfSize(float pt, int[] sizeMap)(Code)



getIndexOfSize
static int getIndexOfSize(float pt, StyleSheet ss)(Code)



getInternalCSSValue
Object getInternalCSSValue(CSS.Attribute key, String value)(Code)
Gets the internal CSS representation of value which is a CSS value of the CSS attribute named key. The receiver should not modify value, and the first count strings are valid.



getLength
float getLength(AttributeSet a, CSS.Attribute key, StyleSheet ss)(Code)
Returns the length of the attribute in a with key key.



getPointSize
float getPointSize(String size, StyleSheet ss)(Code)
Returns the size of a font from the passed in string.
Parameters:
  size - CSS string describing font size
Parameters:
  baseFontSize - size to use for relative units.



getPointSize
float getPointSize(int index, StyleSheet ss)(Code)
Return the point size, given a size index. Legal HTML index sizes are 1-7.



getURL
static URL getURL(URL base, String cssString)(Code)
Returns a URL for the given CSS url string. If relative, base is used as the parent. If a valid URL can not be found, this will not throw a MalformedURLException, instead null will be returned.



getValue
final static Value getValue(String name)(Code)
Translates a string to a CSS.Value object. This will return null if there is no value by the given name.
Parameters:
  name - the name of the CSS value to fetch thetypesafe enumeration for the CSS.Value object, or null if the stringdoesn't represent a valid CSS value name; this doesnot mean that it doesn't represent a valid CSS value



hexToColor
final static Color hexToColor(String value)(Code)
Convert a "#FFFFFF" hex string to a Color. If the color specification is bad, an attempt will be made to fix it up.



parseStrings
static String[] parseStrings(String value)(Code)
an array of all the strings in valuethat are separated by whitespace.



setBaseFontSize
void setBaseFontSize(int sz)(Code)
Sets the base font size. sz is a CSS value, and is not necessarily the point size. Use getPointSize to determine the point size corresponding to sz.



setBaseFontSize
void setBaseFontSize(String size)(Code)
Sets the base font size from the passed in string.



stringToColor
static Color stringToColor(String str)(Code)
Convert a color string such as "RED" or "#NNNNNN" or "rgb(r, g, b)" to a Color.



styleConstantsKeyToCSSKey
Attribute styleConstantsKeyToCSSKey(StyleConstants sc)(Code)
Maps from a StyleConstants to a CSS Attribute.



styleConstantsValueToCSSValue
Object styleConstantsValueToCSSValue(StyleConstants sc, Object styleValue)(Code)
Maps from a StyleConstants value to a CSS value.



translateHTMLToCSS
AttributeSet translateHTMLToCSS(AttributeSet htmlAttrSet)(Code)
Convert a set of HTML attributes to an equivalent set of CSS attributes.
Parameters:
  AttributeSet - containing the HTML attributes. AttributeSet containing the corresponding CSS attributes.The AttributeSet will be empty if there are no mappingCSS attributes.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.