|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Class Summary | |
CssRule | This is a helper class for building a StyleSheet by adding rules to it. |
HtmlFormat | This is a helper class for StyleSheet, and assists with HTML generation for web browsers that don't support CSS. |
JBrowCaps | This class wraps StyleSheet to adapt it to PrayerWell's environment. |
JBrowCapsTag | Seriously in need of optimization! |
JBrowCapsTagExtraInfo | This class is only called at translation time and for page validation. The translation time call
is the important one. Sample usage: |
StyleSheet | The StyleSheet class breaks down a CSS style sheet into equivalent HTML for older browsers and stores the style sheet rules as a HashMap of HashMaps. For any given browser capability, this class builds a separate HashMap (e.g. |
This is a package that reads a CSS1 or CSS2 stylesheet, parses out the HTML tags, and builds a set of HashMaps containing equivalent HTML for browsers of different capbility. This allows older browsers to render a page as closely as possible to the rendering performed by newer, more capable browers, without necessitating recoding all the HTML for different browsers. This also provides for a single stylesheet being able to drive browsers by different manufacturers. More detail can be found at the bottom of the package overview page, after this paragraph repeats.
This package has been released as open source under the LGPL license.
One of the classes (BrowserDetector
)
is taken from org.apache.turbine.util
.
This package contains classes that implement a browser-independant method of supporting style sheets. Even older browsers, that can't recognize style sheets, or non-HTML browsers such as NTT DoCoMo's i-mode phones can receive suitably rendered markup through the use of this class.
The top-level class is StyleSheet
, which drives the other
supporting classes. The StyleSheet class reads a CSS1 or CSS2 style sheet and calls methods in
the CssRule class to parse it. A hashmap is built for every type of browser that is to be
supported. Each entry in the hashmaps contains the markup necessary to render a tag.
The classes JBrowCapsTag
and
JBrowCapsTagExtraInfo
implement custom JSP tags to
drive the classes from JSP pages instead of imbedding ugly Java code.
A higher level class is useful to customize the raw capability for a particular application (see AppStyleSheet).
The 'magic' involves a translation performed by the HtmlFormat class in this package. Edit this class to provide support for more tags and to support more browsers.
<h1>
and
<p>
.
<h1>
and
<H1>
will be stored as two separate entries in the HashTable, with undesirable
results. The author suggests the use of lower case tag names.
display
rule values: block
and
inline
(the default). When a rule specifies display:block
, the
rendered output from the tag will be placed on its own line (like <h1>
);
conversely rules specifying display:inline
will be embedded in flowing text, like
<b>
. For browsers that support CSS, <div>
and
<span>
tags are used to implement display:block
and
display:inline
, respectively.
Tag | CSS Rule (read from file) |
cssTrue | cssFalse |
---|---|---|---|
h1 | margin-top:1em; |
<h1> ... </h1> |
<b><font size=6> ... </font></b> |
.error | border:solid thin red; |
<div class=error> ... </div> | <p><font size=3 color=red> ... </font></p> |
.small | font-size:8pt |
<span class=small> ... </span> | <font size=2> ... </font> |
The StyleSheet class supports embedded C-style comments in stylesheets.
Still to do:
em
and ex
font sizes won't give the proper result since there is no
way to determine the browser's current element's font size.
border
,
border-color
, border-width
, background-image
,
font
, border*
, height
,
list-style*
, margin*
, padding*
.
background
, background-attachment
, background-position
,
background-repeat
, border-bottom
, border-bottom-width
,
border-left
, border-left-width
, border-right
,
border-right-width
, border-top
, border-top-width
,
letter-spacing
, line-height
, text-decoration
,
text-transform
, word-spacing
.
|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |