org.zkoss.zul
Class Style

java.lang.Object
  extended by org.zkoss.zk.ui.AbstractComponent
      extended by org.zkoss.zul.Style
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Component, Scope, ComponentCtrl

public class Style
extends AbstractComponent

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.

There are two formats when used in a ZUML page:

Method 1: Specify the URL of the CSS file

<style src="my.css"/>
 

Method 2: Specify the CSS directly

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

Note: if the src and content properties are both set, the later one overrides the previous one.

Author:
tomyeh
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent
AbstractComponent.Children
 
Field Summary
 
Fields inherited from interface org.zkoss.zk.ui.Component
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE
 
Fields inherited from interface org.zkoss.zk.ui.sys.ComponentCtrl
CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE
 
Constructor Summary
Style()
           
Style(java.lang.String src)
           
Style(java.lang.String src, java.lang.String media)
           
 
Method Summary
 java.lang.String getContent()
          Returns the content of the style element.
 java.lang.String getMedia()
          Returns the media dependencies for this style sheet.
 java.lang.String getSrc()
          Returns the URI of an external style sheet.
protected  boolean isChildable()
          Not childable.
 boolean isDynamic()
          Deprecated. As of release 5.0.0, it is decided automatically.
protected  void renderProperties(ContentRenderer renderer)
          Called by (ComponentCtrl.redraw(java.io.Writer)) to render the properties, excluding the enclosing tag and children.
 void setContent(java.lang.String content)
          Sets the content of the style element.
 void setDynamic(boolean dynamic)
          Deprecated. As of release 5.0.0, it is decided automatically.
 void setMedia(java.lang.String media)
          Sets the media dependencies for this style sheet.
 void setSrc(java.lang.String src)
          Sets the URI of an external style sheet.
 boolean setVisible(boolean visible)
          Not allowed.
 
Methods inherited from class org.zkoss.zk.ui.AbstractComponent
addAnnotation, addAnnotation, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addScopeListener, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, clone, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableClientUpdate, equals, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getChildren, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getEventListenerMap, getEventListeners, getExtraCtrl, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRoot, getSpaceOwner, getStubonly, getTemplate, getTemplateNames, getUuid, getWidgetAttribute, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasFellow, hasFellow, insertBefore, invalidate, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageAttached, onPageDetached, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeChild, removeEventListener, removeForward, removeForward, removeScopeListener, render, render, render, replace, response, response, response, service, service, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setStubonly, setTemplate, setVisibleDirectly, setWidgetAttribute, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, willPassivate, willPassivate, willSerialize, willSerialize
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Style

public Style()

Style

public Style(java.lang.String src)
Parameters:
src - the URI of an external style sheet.

Style

public Style(java.lang.String src,
             java.lang.String media)
Parameters:
src - the URI of an external style sheet.
media - the media dependencies for the style sheet.
Since:
5.0.3
Method Detail

setDynamic

public void setDynamic(boolean dynamic)
Deprecated. As of release 5.0.0, it is decided automatically.


isDynamic

public boolean isDynamic()
Deprecated. As of release 5.0.0, it is decided automatically.


getSrc

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

Default: null.


setSrc

public 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)

getMedia

public java.lang.String getMedia()
Returns the media dependencies for this style sheet.

Default: null.

Refer to media-depedent style sheet for details.

Since:
5.0.3

setMedia

public void setMedia(java.lang.String media)
Sets the media dependencies for this style sheet.

Refer to media-depedent style sheet for details.

Parameters:
media - the media dependencies for this style sheet
Since:
5.0.3

getContent

public 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.

Deriving class can override this method to return whatever it prefers (ignored if null).

Since:
3.0.0

setContent

public 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.

Since:
3.0.0
See Also:
setSrc(java.lang.String)

renderProperties

protected void renderProperties(ContentRenderer renderer)
                         throws java.io.IOException
Description copied from class: AbstractComponent
Called by (ComponentCtrl.redraw(java.io.Writer)) to render the properties, excluding the enclosing tag and children.

Default: it renders AbstractComponent.getId() if it was assigned, and event names if listened (and listed in AbstractComponent.getClientEvents()).

Note: it doesn't render AbstractComponent.getWidgetClass(), AbstractComponent.getUuid() and AbstractComponent.getMold(), which are caller's job.

Overrides:
renderProperties in class AbstractComponent
Throws:
java.io.IOException

setVisible

public boolean setVisible(boolean visible)
Not allowed.

Specified by:
setVisible in interface Component
Overrides:
setVisible in class AbstractComponent
Returns:
the previous visibility

isChildable

protected boolean isChildable()
Not childable.

Overrides:
isChildable in class AbstractComponent


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