Class Style
- java.lang.Object
-
- org.zkoss.zk.ui.AbstractComponent
-
- 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, AbstractComponent.ForwardInfo, AbstractComponent.TargetInfo
-
-
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
AFTER_CHILD_ADDED, AFTER_CHILD_REMOVED, AFTER_PAGE_ATTACHED, AFTER_PAGE_DETACHED, AFTER_PARENT_CHANGED, CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.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
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, addCallback, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, clone, destroyIndexCacheMap, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, disableHostChanged, enableBindingAnnotation, enableHostChanged, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getCallback, getChildren, getClientAttribute, getClientDataAttribute, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getEventListenerMap, getEventListeners, getExtraCtrl, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getForwards, getId, getIndexCacheMap, getLastChild, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getPropertyAccess, getRedrawCallback, getRoot, getShadowFellowIfAny, getShadowRoots, getShadowVariable, getShadowVariable, getShadowVariable0, getSpaceOwner, getSpecialRendererOutput, getStubonly, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, initIndexCacheMap, insertBefore, invalidate, isDisabledHostChanged, isInitialized, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageAttached, onPageDetached, onParentChanged, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, renderPropertiesOnly, replace, response, response, response, service, service, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setStubonly, setSubBindingAnnotationCount, setTemplate, setVisibleDirectly, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerialize
-
-
-
-
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
-
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 previoussetContent(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 previoussetSrc(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 inAbstractComponent.getClientEvents()
).Note: it doesn't render
AbstractComponent.getWidgetClass()
,AbstractComponent.getUuid()
andAbstractComponent.getMold()
, which are caller's job.- Overrides:
renderProperties
in classAbstractComponent
- Throws:
java.io.IOException
-
setVisible
public boolean setVisible(boolean visible)
Not allowed.- Specified by:
setVisible
in interfaceComponent
- Overrides:
setVisible
in classAbstractComponent
- Returns:
- the previous visibility
-
isChildable
protected boolean isChildable()
Not childable.- Overrides:
isChildable
in classAbstractComponent
-
-