Package org.zkoss.zul

Class Style

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, org.zkoss.zk.ui.Component, org.zkoss.zk.ui.ext.Scope, org.zkoss.zk.ui.sys.ComponentCtrl

    public class Style
    extends org.zkoss.zk.ui.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

        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_SCOPE
      • Fields 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 
      Constructor Description
      Style()  
      Style​(java.lang.String src)  
      Style​(java.lang.String src, java.lang.String media)  
    • 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​(org.zkoss.zk.ui.sys.ContentRenderer renderer)  
      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
      • Methods inherited from class java.lang.Object

        equals, 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

      • getSrc

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

        Default: null.

      • 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​(org.zkoss.zk.ui.sys.ContentRenderer renderer)
                                 throws java.io.IOException
        Overrides:
        renderProperties in class org.zkoss.zk.ui.AbstractComponent
        Throws:
        java.io.IOException
      • setVisible

        public boolean setVisible​(boolean visible)
        Not allowed.
        Specified by:
        setVisible in interface org.zkoss.zk.ui.Component
        Overrides:
        setVisible in class org.zkoss.zk.ui.AbstractComponent
      • isChildable

        protected boolean isChildable()
        Not childable.
        Overrides:
        isChildable in class org.zkoss.zk.ui.AbstractComponent