| java.lang.Object org.wings.plaf.css.Utils
Utils | final public class Utils (Code) | | Utils.java
Helper class that collects static methods usable from CGs.
author: Michael Reinsch |
Method Summary | |
public static SStringBuilder | appendCSSComponentInlineColorStyle(SStringBuilder styleString, SComponent component) Append a inline CSS style definition for the passed component of the aspect foreground- and background color. | public static SStringBuilder | appendCSSComponentInlineFontStyle(SStringBuilder styleString, SComponent component) Append a inline CSS style definition for the passed component of the aspect font properties. | public static void | appendCSSInlineFullSize(SStringBuilder pSStringBuilder, SComponent pComponent) Prints a HTML style attribute with widht/height of 100% if the passed dimension defines a height or width..
Sample: style="width:100%;"
This is typicall needed to stretch inner HTML element to expand to the full dimenstion defined
on an outer, sized HTML element. | public static SStringBuilder | appendCSSInlineSize(SStringBuilder styleString, SComponent component) Appends a CSS inline style string for the preferred size of the passed component to the passed stringbuffer. | public static String | appendSuffixesToWords(String words, String wordSuffix) Takes a string, tokenizes it and appends the wordSuffix on each word.
Parameters: words - A list of words, may be null . Parameters: wordSuffix - A suffix string to append to each word modified string (i.e. | public static void | attribute(Device d, String attr, String value) Prints an mandatory attribute. | public static int | calculateHorizontalOversize(SComponent component, boolean percentageUnitOnly) | public static int | calculateVerticalOversize(SComponent component, boolean percentageUnitOnly) | public static String | collectJavaScriptListenerCode(SComponent component, String javascriptEventType) Renders inline the javascript code attached to the passed javascipt event type
on the component. | public static Link | createExternalizedCSSHeader(String cssClassPath) Load a Stylesheet document from the classpath. | public static Link | createExternalizedCSSHeaderFromProperty(String cssResourceProperty) Load a Stylesheet document that comes with wingS by a property. | public static Script | createExternalizedJSHeader(String jsClassPath) Load a Javascript library from the classpath. | public static Script | createExternalizedJSHeaderFromProperty(String jsResourceProperty) Load a Javascript library that comes with wingS by a property. | public static SStringBuilder | createInlineStylesForInsets(Insets insets) Converts a hgap/vgap in according inline css padding style. | public static SStringBuilder | createInlineStylesForInsets(SStringBuilder styles, Insets insets) Converts a hgap/vgap in according inline css padding style. | public static void | encodeJS(Device d, Object o) | public static String | event(SComponent component) Returns the according event ID for the given component. | public static SStringBuilder | generateCSSComponentInlineStyle(SComponent component) | public static SStringBuilder | generateCSSInlineBorder(SStringBuilder styles, int borderSize) | public static String | getInlineStyles(SComponent component) | final public static boolean | hasDimension(SComponent component) | public static boolean | hasInsets(Insets insets) | public static SStringBuilder | inlineStyles(Style tabAreaStyle) | public static boolean | isMSIE(SComponent component) | public static boolean | isMSIE() | public static SStringBuilder | joinStyles(SComponent component, SStringBuilder styleString) Prepends the component style class set on the component to the existing style string. | public static String | joinStyles(SComponent component, String styleString) Prepends the component style class set on the component to the existing style string. | public static Renderable | listToJsArray(List list) | public static String | loadScript(String path) loads a script from disk through the classloader. | public static void | main(String argv) | public static Renderable | mapToJsObject(Map map) | public static String | nonBreakingSpaces(String text) prints a String. | public static void | optAttribute(Device d, String attr, SStringBuilder value) Prints an optional attribute. | public static void | optAttribute(Device d, char[] attributeName, String value) Prints an optional attribute. | public static void | optAttribute(Device d, String attributeName, String value) Prints an optional attribute. | public static void | optAttribute(Device d, String attr, Color value) Prints an optional attribute. | public static void | optAttribute(Device d, String attr, Renderable r) Prints an optional, renderable attribute. | public static void | optAttribute(Device d, char[] attributeName, int value) Prints an optional attribute. | public static void | optAttribute(Device d, String attributeName, int value) Prints an optional attribute. | public static void | optAttribute(Device d, String attr, SDimension value) Prints an optional attribute. | public static void | optAttributes(Device d, Map attributes) Prints all optional attributes that are contained in the
Map . | public static void | optFullSize(Device device, SComponent component) | public static void | printButtonEnd(Device device, boolean enabled) | public static void | printButtonStart(Device device, SComponent eventTarget, String eventValue, boolean b, boolean showAsFormComponent) | public static void | printButtonStart(Device device, SComponent component, String eventValue, boolean enabled, boolean formComponent, String cssClassName) | public static void | printCSSInlineFullSize(Device device, SDimension preferredSize) Prints a HTML style attribute with widht/height of 100% if the passed dimension defines a height or width..
Sample: style="width:100%;"
This is typicall needed to stretch inner HTML element to expand to the full dimenstion defined
on an outer, sized HTML element. | public static void | printClickability(Device device, SComponent component, String eventValue, boolean enabled, boolean formComponent) | public static Device | printDebug(Device d, char[] s) Helper method for CGs to print out debug information in output stream. | public static Device | printDebug(Device d, String s) Helper method for CGs to print out debug information in output stream. | public static Device | printDebugNewline(Device d, SComponent currentComponent) Prints a hierarchical idented newline if debug mode is enabled. | public static void | printDivHorizontalAlignment(Device d, int align) HTML allows 4 values for the horizontal align property of a div element. | public static void | printDivVerticalAlignment(Device d, int align) HTML allows 4 values for the vertical align property of a div element. | public static Device | printInlineStylesForInsets(Device device, Insets insets) Converts a hgap/vgap in according inline css padding style. | public static Device | printNewline(Device d, SComponent currentComponent) Prints a hierarchical idented newline. | public static Device | printNewline(Device d, SComponent currentComponent, int offset) Prints a hierarchical idented newline. | public static void | printTableCellAlignment(Device d, SComponent c, int defaultHorizontal, int defaultVertical) Renders the alignment commands for a table cell (horzontal and vertical). | public static void | quote(Device d, String s, boolean quoteNewline, boolean quoteSpaces, boolean quoteApostroph) Writes an {X|HT}ML quoted string according to RFC 1866. | public static void | renderContainer(Device d, SContainer c) Renders a container using its Layout manager or fallback just one after another. | public static String | toColorString(int rgb) | public static String | toColorString(java.awt.Color c) | public static void | write(Device d, String s) writes the given String to the device. | public static void | write(Device d, Color c) writes the given java.awt.Color to the device. | public static void | write(Device d, Renderable r) | public static void | writeAllAttributes(Device device, SComponent component) | public static void | writeContextMenu(Device device, SComponent component) Write JS code for context menus. | public static void | writeEvents(Device device, SComponent c, String[] suppressScriptListenerTypes) Render inline event listeners attached to the passed component exlucding types of suppressed listeners
Parameters: device - output device Parameters: c - component to retrieve listeners from Parameters: suppressScriptListenerTypes - Array of String i.e. | public static void | writeQuoted(Device d, String s, boolean quoteNewline) writes the given String to the device. | public static void | writeRaw(Device d, String s) | public static void | writeTooltipMouseOver(Device device, SComponent component) Write Tooltip code. | public static int | writeWithoutHTML(Device device, String htmlWrappedText) Writes text to the device without any HTML tag content.
Parameters: device - The output device to use for quoting Parameters: htmlWrappedText - The text which may contain HTML to strip. |
CSS_DEBUG_FIREBUGLITE | final public static String CSS_DEBUG_FIREBUGLITE(Code) | | |
CSS_YUI_ASSETS_CALENDAR | final public static String CSS_YUI_ASSETS_CALENDAR(Code) | | |
CSS_YUI_ASSETS_CONTAINER | final public static String CSS_YUI_ASSETS_CONTAINER(Code) | | |
HEADER_LOADED_CALLBACK | final public static String HEADER_LOADED_CALLBACK(Code) | | |
HTML_DEBUG_FIREBUGLITE | final public static String HTML_DEBUG_FIREBUGLITE(Code) | | |
IMG_DEBUG_FIREBUGLITE_ERROR | final public static String IMG_DEBUG_FIREBUGLITE_ERROR(Code) | | |
IMG_DEBUG_FIREBUGLITE_INFO | final public static String IMG_DEBUG_FIREBUGLITE_INFO(Code) | | |
IMG_DEBUG_FIREBUGLITE_WARN | final public static String IMG_DEBUG_FIREBUGLITE_WARN(Code) | | |
IMG_YUI_ASSETS_SPRITE | final public static String IMG_YUI_ASSETS_SPRITE(Code) | | |
JS_DEBUG_FIREBUGLITE | final public static String JS_DEBUG_FIREBUGLITE(Code) | | |
JS_ETC_MENU | final public static String JS_ETC_MENU(Code) | | Lookup keys for other resources
|
JS_ETC_WZ_TOOLTIP | final public static String JS_ETC_WZ_TOOLTIP(Code) | | |
JS_WINGS_ALL | final public static String JS_WINGS_ALL(Code) | | Lookup keys for wings resources
|
JS_WINGS_ALL_DEBUG | final public static String JS_WINGS_ALL_DEBUG(Code) | | |
JS_YUI_ANIMATION | final public static String JS_YUI_ANIMATION(Code) | | Lookup keys for yui resources
|
JS_YUI_ANIMATION_DEBUG | final public static String JS_YUI_ANIMATION_DEBUG(Code) | | |
JS_YUI_AUTOCOMPLETE | final public static String JS_YUI_AUTOCOMPLETE(Code) | | |
JS_YUI_CALENDAR | final public static String JS_YUI_CALENDAR(Code) | | |
JS_YUI_COLORPICKER | final public static String JS_YUI_COLORPICKER(Code) | | |
JS_YUI_CONNECTION | final public static String JS_YUI_CONNECTION(Code) | | |
JS_YUI_CONNECTION_DEBUG | final public static String JS_YUI_CONNECTION_DEBUG(Code) | | |
JS_YUI_CONTAINER | final public static String JS_YUI_CONTAINER(Code) | | |
JS_YUI_CONTAINER_CORE | final public static String JS_YUI_CONTAINER_CORE(Code) | | |
JS_YUI_CONTAINER_DEBUG | final public static String JS_YUI_CONTAINER_DEBUG(Code) | | |
JS_YUI_DOM_DEBUG | final public static String JS_YUI_DOM_DEBUG(Code) | | |
JS_YUI_DRAGDROP | final public static String JS_YUI_DRAGDROP(Code) | | |
JS_YUI_DRAGDROP_DEBUG | final public static String JS_YUI_DRAGDROP_DEBUG(Code) | | |
JS_YUI_ELEMENT_DEBUG | final public static String JS_YUI_ELEMENT_DEBUG(Code) | | |
JS_YUI_EVENT_DEBUG | final public static String JS_YUI_EVENT_DEBUG(Code) | | |
JS_YUI_HISTORY | final public static String JS_YUI_HISTORY(Code) | | |
JS_YUI_IMAGELOADER | final public static String JS_YUI_IMAGELOADER(Code) | | |
JS_YUI_TABVIEW | final public static String JS_YUI_TABVIEW(Code) | | |
JS_YUI_TEST_CORE | final public static String JS_YUI_TEST_CORE(Code) | | |
JS_YUI_TREEVIEW | final public static String JS_YUI_TREEVIEW(Code) | | |
JS_YUI_UTILITIES | final public static String JS_YUI_UTILITIES(Code) | | |
JS_YUI_YAHOO_DEBUG | final public static String JS_YUI_YAHOO_DEBUG(Code) | | |
JS_YUI_YAHOO_DOM_EVENT | final public static String JS_YUI_YAHOO_DOM_EVENT(Code) | | |
JS_YUI_YUILOADER_DOM_EVENT | final public static String JS_YUI_YUILOADER_DOM_EVENT(Code) | | |
PRINT_DEBUG | final public static boolean PRINT_DEBUG(Code) | | Print debug information in generated HTML
|
PRINT_PRETTY | final public static boolean PRINT_PRETTY(Code) | | |
hexDigits | final protected static char[] hexDigits(Code) | | |
appendCSSComponentInlineColorStyle | public static SStringBuilder appendCSSComponentInlineColorStyle(SStringBuilder styleString, SComponent component)(Code) | | Append a inline CSS style definition for the passed component of the aspect foreground- and background color.
Parameters: styleString - SStringBuilder to append to Parameters: component - Component to use as style source The passed styleString |
appendCSSComponentInlineFontStyle | public static SStringBuilder appendCSSComponentInlineFontStyle(SStringBuilder styleString, SComponent component)(Code) | | Append a inline CSS style definition for the passed component of the aspect font properties.
Parameters: styleString - SStringBuilder to append to Parameters: component - Component to use as style source The passed styleString |
appendCSSInlineFullSize | public static void appendCSSInlineFullSize(SStringBuilder pSStringBuilder, SComponent pComponent)(Code) | | Prints a HTML style attribute with widht/height of 100% if the passed dimension defines a height or width..
Sample: style="width:100%;"
This is typicall needed to stretch inner HTML element to expand to the full dimenstion defined
on an outer, sized HTML element. Otherwise the component would appear to small (as size is applied only
on the invisible outer limiting element)
Parameters: pSStringBuilder - buffer to append to Parameters: pComponent - preferredSize trigger dimension |
appendCSSInlineSize | public static SStringBuilder appendCSSInlineSize(SStringBuilder styleString, SComponent component)(Code) | | Appends a CSS inline style string for the preferred size of the passed component to the passed stringbuffer.
Sample: width:100%;heigth=15px"
|
appendSuffixesToWords | public static String appendSuffixesToWords(String words, String wordSuffix)(Code) | | Takes a string, tokenizes it and appends the wordSuffix on each word.
Parameters: words - A list of words, may be null . Parameters: wordSuffix - A suffix string to append to each word modified string (i.e. "slayout myclass","_box" gets "slayout_box myclass_box" ). |
attribute | public static void attribute(Device d, String attr, String value) throws IOException(Code) | | Prints an mandatory attribute. If the String value has a content
(value != null && value.length > 0), the attrib is added otherwise
it is left out
|
calculateHorizontalOversize | public static int calculateHorizontalOversize(SComponent component, boolean percentageUnitOnly)(Code) | | |
calculateVerticalOversize | public static int calculateVerticalOversize(SComponent component, boolean percentageUnitOnly)(Code) | | |
collectJavaScriptListenerCode | public static String collectJavaScriptListenerCode(SComponent component, String javascriptEventType)(Code) | | Renders inline the javascript code attached to the passed javascipt event type
on the component. Used to allow usage of javascript events by the framework
as well as by the application itself.
For an example: See the wingS.request.sendEvent() .
Parameters: component - The component wearing the event handler Parameters: javascriptEventType - the event type declared in JavaScriptEvent javascript code fragment n the form of ,new Array(function(){...},function(){...}) |
createExternalizedCSSHeader | public static Link createExternalizedCSSHeader(String cssClassPath)(Code) | | Load a Stylesheet document from the classpath.
Parameters: cssClassPath - A classpath to the .css-file A Link reference to the desired stylesheet addable as header |
createExternalizedCSSHeaderFromProperty | public static Link createExternalizedCSSHeaderFromProperty(String cssResourceProperty)(Code) | | Load a Stylesheet document that comes with wingS by a property. Check CSS_XXX constants.
Parameters: cssResourceProperty - A property lookup key, preferably by a constant in this utility class A Link reference to the desired stylesheet addable as header |
createExternalizedJSHeader | public static Script createExternalizedJSHeader(String jsClassPath)(Code) | | Load a Javascript library from the classpath.
Parameters: jsClassPath - A classpath to the .js-file A script reference to the desired script addable as header |
createExternalizedJSHeaderFromProperty | public static Script createExternalizedJSHeaderFromProperty(String jsResourceProperty)(Code) | | Load a Javascript library that comes with wingS by a property. Check JS_XXX constants.
Parameters: jsResourceProperty - A property lookup key, preferably by a constant in this utility class A script reference to the desired script addable as header |
createInlineStylesForInsets | public static SStringBuilder createInlineStylesForInsets(Insets insets)(Code) | | Converts a hgap/vgap in according inline css padding style.
Parameters: insets - The insets to generate CSS padding declaration Empty or filled stringbuffer with padding declaration |
createInlineStylesForInsets | public static SStringBuilder createInlineStylesForInsets(SStringBuilder styles, Insets insets)(Code) | | Converts a hgap/vgap in according inline css padding style.
Parameters: styles - Appender to append inset style. Parameters: insets - The insets to generate CSS padding declaration Empty or filled stringbuffer with padding declaration |
event | public static String event(SComponent component)(Code) | | Returns the according event ID for the given component.
|
generateCSSComponentInlineStyle | public static SStringBuilder generateCSSComponentInlineStyle(SComponent component)(Code) | | Generates a SStringBuilder containing inlined CSS styles for the following properties of a SComponent:
- Preffered Size
- Font
- Background- and Foregroud color.
Parameters: component - Component to grab parameters from. |
hasDimension | final public static boolean hasDimension(SComponent component)(Code) | | |
hasInsets | public static boolean hasInsets(Insets insets)(Code) | | Parameters: insets - The inset param to test true if any valid inset greater zero is set |
isMSIE | public static boolean isMSIE(SComponent component)(Code) | | true if current browser is microsoft exploder |
isMSIE | public static boolean isMSIE()(Code) | | true if current browser is microsoft exploder |
joinStyles | public static SStringBuilder joinStyles(SComponent component, SStringBuilder styleString)(Code) | | Prepends the component style class set on the component to the existing style string.
Parameters: component - Component may be null and may have a null style string. Parameters: styleString - The style string to append |
joinStyles | public static String joinStyles(SComponent component, String styleString)(Code) | | Prepends the component style class set on the component to the existing style string.
Parameters: component - Component may be null and may have a null style string. Parameters: styleString - The style string to append |
loadScript | public static String loadScript(String path)(Code) | | loads a script from disk through the classloader.
Parameters: path - the path where the script can be found the script as a String |
nonBreakingSpaces | public static String nonBreakingSpaces(String text)(Code) | | prints a String. Substitutes spaces with nbsp's
|
optAttribute | public static void optAttribute(Device d, String attr, SStringBuilder value) throws IOException(Code) | | Prints an optional attribute. If the String value has a content
(value != null && value.length > 0), the attrib is added otherwise
it is left out
|
optAttribute | public static void optAttribute(Device d, char[] attributeName, String value) throws IOException(Code) | | Prints an optional attribute. If the String value has a content
(value != null && value.length > 0), the attrib is added otherwise
it is left out
|
optAttribute | public static void optAttribute(Device d, String attributeName, String value) throws IOException(Code) | | Prints an optional attribute. If the String value has a content
(value != null && value.length > 0), the attrib is added otherwise
it is left out
|
optAttribute | public static void optAttribute(Device d, String attr, Color value) throws IOException(Code) | | Prints an optional attribute. If the String value has a content
(value != null && value.length > 0), the attrib is added otherwise
it is left out
|
optAttribute | public static void optAttribute(Device d, char[] attributeName, int value) throws IOException(Code) | | Prints an optional attribute. If the integer value is greater than 0,
the attrib is added otherwise it is left out
|
optAttribute | public static void optAttribute(Device d, String attributeName, int value) throws IOException(Code) | | Prints an optional attribute. If the integer value is greater than 0,
the attrib is added otherwise it is left out
|
optAttribute | public static void optAttribute(Device d, String attr, SDimension value) throws IOException(Code) | | Prints an optional attribute. If the dimension value not equals null
the attrib is added otherwise it is left out
|
optAttributes | public static void optAttributes(Device d, Map attributes) throws IOException(Code) | | Prints all optional attributes that are contained in the
Map . The keys of the map should be instances
of String and the values one of the following
classes.
- org.wings.util.SStringBuilder
- java.lang.String
- java.awt.Color
- org.wings.Renderable
- java.lang.Integer
- org.wings.SDimension
Parameters: d - The device to print the optional attributes. Parameters: attributes - The optional attributes. The key is the attributename and the value is the attribute value. throws: IOException - The exception maybe thrown if an error occurswhile trying to write to device. |
printCSSInlineFullSize | public static void printCSSInlineFullSize(Device device, SDimension preferredSize) throws IOException(Code) | | Prints a HTML style attribute with widht/height of 100% if the passed dimension defines a height or width..
Sample: style="width:100%;"
This is typicall needed to stretch inner HTML element to expand to the full dimenstion defined
on an outer, sized HTML element. Otherwise the component would appear to small (as size is applied only
on the invisible outer limiting element)
Parameters: device - Device to print to Parameters: preferredSize - trigger dimension |
printDivHorizontalAlignment | public static void printDivHorizontalAlignment(Device d, int align) throws IOException(Code) | | HTML allows 4 values for the horizontal align property of a div element.
Parameters: d - Output Parameters: align - Please refer SConstants throws: IOException - |
printDivVerticalAlignment | public static void printDivVerticalAlignment(Device d, int align) throws IOException(Code) | | HTML allows 4 values for the vertical align property of a div element.
Parameters: d - Output Parameters: align - Please refer SConstants throws: IOException - |
printInlineStylesForInsets | public static Device printInlineStylesForInsets(Device device, Insets insets) throws IOException(Code) | | Converts a hgap/vgap in according inline css padding style.
Parameters: device - Appender to append inset style. Parameters: insets - The insets to generate CSS padding declaration Empty or filled stringbuffer with padding declaration |
printNewline | public static Device printNewline(Device d, SComponent currentComponent) throws IOException(Code) | | Prints a hierarchical idented newline. For each surrounding container of the passed component one ident level.
|
printNewline | public static Device printNewline(Device d, SComponent currentComponent, int offset) throws IOException(Code) | | Prints a hierarchical idented newline. For each surrounding container of the passed component one ident level.
|
printTableCellAlignment | public static void printTableCellAlignment(Device d, SComponent c, int defaultHorizontal, int defaultVertical) throws IOException(Code) | | Renders the alignment commands for a table cell (horzontal and vertical).
To ensure a consistent behaviour you have to pass the default alignment applied for SConstants.NO_ALIGN .
Parameters: defaultHorizontal - default horizontal alignment to use is not aligned Parameters: defaultVertical - default vertical alignment to use if component is not aligned |
quote | public static void quote(Device d, String s, boolean quoteNewline, boolean quoteSpaces, boolean quoteApostroph) throws IOException(Code) | | Writes an {X|HT}ML quoted string according to RFC 1866.
'"', '<', '>', '&' become '"', '<', '>', '&'
Parameters: d - The device to print out on Parameters: s - the String to print Parameters: quoteNewline - should newlines be transformed into <br> tags Parameters: quoteSpaces - should spaces be transformed into   chars Parameters: quoteApostroph - Quote apostroph ' by \' throws: IOException - |
renderContainer | public static void renderContainer(Device d, SContainer c) throws IOException(Code) | | Renders a container using its Layout manager or fallback just one after another.
|
toColorString | public static String toColorString(int rgb)(Code) | | |
write | public static void write(Device d, String s) throws IOException(Code) | | writes the given String to the device. The string is quoted, i.e.
for all special characters in *ML, their appropriate entity is
returned.
If the String starts with '', the content is regarded being
HTML-code and is written as is (without the tag).
|
write | public static void write(Device d, Color c) throws IOException(Code) | | writes the given java.awt.Color to the device. Speed optimized;
character conversion avoided.
|
writeContextMenu | public static void writeContextMenu(Device device, SComponent component) throws IOException(Code) | | Write JS code for context menus. Common implementaton for MSIE and gecko.
|
writeEvents | public static void writeEvents(Device device, SComponent c, String[] suppressScriptListenerTypes) throws IOException(Code) | | Render inline event listeners attached to the passed component exlucding types of suppressed listeners
Parameters: device - output device Parameters: c - component to retrieve listeners from Parameters: suppressScriptListenerTypes - Array of String i.e. new String[] { JavaScriptEvent.ON_CLICK } ) |
writeQuoted | public static void writeQuoted(Device d, String s, boolean quoteNewline) throws IOException(Code) | | writes the given String to the device. The string is quoted, i.e.
for all special characters in *ML, their appropriate entity is
returned.
If the String starts with '', the content is regarded being
HTML-code and is written as is (without the tag).
It is possible to define the quoteNewline behavoiur
|
writeWithoutHTML | public static int writeWithoutHTML(Device device, String htmlWrappedText) throws IOException(Code) | | Writes text to the device without any HTML tag content.
Parameters: device - The output device to use for quoting Parameters: htmlWrappedText - The text which may contain HTML to strip. The amount of characters written to the ouput device throws: IOException - |
|
|