Class Style
- All Implemented Interfaces:
Serializable,Cloneable,org.zkoss.zk.ui.Component,org.zkoss.zk.ui.ext.Scope,org.zkoss.zk.ui.sys.ComponentCtrl
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:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent
org.zkoss.zk.ui.AbstractComponent.Children, org.zkoss.zk.ui.AbstractComponent.ForwardInfo, org.zkoss.zk.ui.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_SCOPEFields inherited from interface org.zkoss.zk.ui.sys.ComponentCtrl
AFTER_CHILD_ADDED, AFTER_CHILD_REMOVED, AFTER_CLONED, AFTER_PAGE_ATTACHED, AFTER_PAGE_DETACHED, AFTER_PARENT_CHANGED, CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the content of the style element.getMedia()Returns the media dependencies for this style sheet.getSrc()Returns the URI of an external style sheet.protected booleanNot childable.protected voidrenderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) voidsetContent(String content) Sets the content of the style element.voidSets the media dependencies for this style sheet.voidSets the URI of an external style sheet.booleansetVisible(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, getStubonlyDescendants, 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, setStubonlyDescendants, 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 Details
-
Style
public Style() -
Style
- Parameters:
src- the URI of an external style sheet.
-
Style
- Parameters:
src- the URI of an external style sheet.media- the media dependencies for the style sheet.- Since:
- 5.0.3
-
-
Method Details
-
getSrc
Returns the URI of an external style sheet.Default: null.
-
setSrc
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:
-
getMedia
Returns the media dependencies for this style sheet.Default: null.
Refer to media-depedent style sheet for details.
- Since:
- 5.0.3
-
setMedia
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
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
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:
-
renderProperties
- Overrides:
renderPropertiesin classorg.zkoss.zk.ui.AbstractComponent- Throws:
IOException
-
setVisible
public boolean setVisible(boolean visible) Not allowed.- Specified by:
setVisiblein interfaceorg.zkoss.zk.ui.Component- Overrides:
setVisiblein classorg.zkoss.zk.ui.AbstractComponent
-
isChildable
protected boolean isChildable()Not childable.- Overrides:
isChildablein classorg.zkoss.zk.ui.AbstractComponent
-