org.zkoss.zul.api
Interface Style

All Known Implementing Classes:
Style

public interface Style

The style component used to specify CSS styles for the owner desktop.

Note: a style component can appear anywhere in a ZUML page, but it affects all components in the same desktop.

Note: If isDynamic() is false, the HTML STYLE or LINK tag is generated to represent this component. Due to IE's limitation, there is no effect if the style component is added or removed dynamically and if isDynamic() is false.

If isDynamic() is true, this component can be added and removed dynamically and the rules will be attached and detached accordingly. Note: in this case, the link is generated when this component is initialized at the client, so the style will be loaded to the client after all components are initialized.

There are three formats when used in a ZUML page:

Method 1: Specify the URL of the CSS file

 <code><style src="my.css"/>
 </code>
 

Method 2: Specify the CSS directly

 <code><style>
 .mycls {
  border: 1px outset #777;
 }
 </style>
 </code>
 

Method 3: Specify the CSS by use of the content property (setContent(java.lang.String) ).

 <code><style>
 <attribute name="content">
 .mycls {
  border: 1px outset #777;
 }
 </attribute>
 </style>
 </code>
 

Note: if the src and content properties are both set, the content property is ignored.

Since:
3.5.2
Author:
tomyeh

Method Summary
 java.lang.String getContent()
          Returns the content of the style element.
 java.lang.String getSrc()
          Returns the URI of an external style sheet.
 boolean isDynamic()
          Returns whether to load an external Style Sheet dynamically.
 void setContent(java.lang.String content)
          Sets the content of the style element.
 void setDynamic(boolean dynamic)
          Sets whether to load an external Style Sheet dynamically.
 void setSrc(java.lang.String src)
          Sets the URI of an external style sheet.
 

Method Detail

setDynamic

void setDynamic(boolean dynamic)
Sets whether to load an external Style Sheet dynamically.

Default: false.

See Also:
isDynamic()

isDynamic

boolean isDynamic()
Returns whether to load an external Style Sheet dynamically. If false, a HTML STYLE or LINK tag is generated to represent the content or the src.

Due to IE's limitation, there is no effect if the style component is added or removed dynamically and if isDynamic() is false.

If isDynamic() is true, this component can be added and removed dynamically and the rules will be attached and detached accordingly. Note: in this case, the HTML LINK tag is generated when this component is initialized at the client, so the style will be loaded to the client after all components are initialized.

Default: false.


getSrc

java.lang.String getSrc()
Returns the URI of an external style sheet.

Default: null.


setSrc

void setSrc(java.lang.String src)
Sets the URI of an external style sheet.

Calling this method implies setContent(null). In other words, the last invocation of setSrc(java.lang.String) overrides the previous setContent(java.lang.String), if any.

Parameters:
src - the URI of an external style sheet
See Also:
setContent(java.lang.String)

getContent

java.lang.String getContent()
Returns the content of the style element. By content we mean the CSS rules that will be sent to the client.

Default: null.


setContent

void setContent(java.lang.String content)
Sets the content of the style element. By content we mean the CSS rules that will be sent to the client.

Calling this method implies setSrc(null). In other words, the last invocation of setContent(java.lang.String) overrides the previous setSrc(java.lang.String), if any.

See Also:
setSrc(java.lang.String)


Copyright © 2005-2009 Potix Corporation. All Rights Reserved. SourceForge.net Logo