Interface IStyle

  • All Superinterfaces:
    IAnyGroup<IStyle>, IComponent<IStyle>

    public interface IStyle
    extends IAnyGroup<IStyle>
    Immutable Style component

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

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

    There are two formats when used in a page:

    Method 1: Specify the URL of the CSS file

    IStyle.ofSrc("my.css");

    Method 2: Specify the CSS content directly

    IStyle.of(".mycls {border: 1px outset #777;}");

    Note: if the src and content attributes are both set, the content has higher priority.

    Author:
    katherine
    See Also:
    Style
    • Field Detail

      • DEFAULT

        static final IStyle DEFAULT
        Constant for default attributes of this immutable component.
    • Method Detail

      • getWidgetClass

        default java.lang.String getWidgetClass()
        Returns the client widget class.

        Default: "zul.utl.Style"

        Specified by:
        getWidgetClass in interface IComponent<IStyle>
      • getMedia

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

        Default: null.

        Refer to media-depedent style sheet for details.

      • withMedia

        IStyle withMedia​(@Nullable
                         java.lang.String media)
        Returns a copy of this immutable component with the specified media.

        Sets the media dependencies for this style sheet.

        Refer to media-depedent style sheet for details.

        Parameters:
        media - The media dependencies.

        Default: null.

        Returns:
        A modified copy of the this object
      • getContent

        @Nullable
        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.

      • withContent

        IStyle withContent​(@Nullable
                           java.lang.String content)
        Returns a copy of this immutable component with the specified content.

        Sets the content of the style element. By content we mean the CSS rules that will be sent to the client. Note: if calling this with withSrc(String), the withContent(String) has higher priority.

        Parameters:
        content - The CSS content.

        Default: null.

        Returns:
        A modified copy of the this object
      • getSrc

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

        Default: null.

      • withSrc

        IStyle withSrc​(@Nullable
                       java.lang.String src)
        Returns a copy of this immutable component with the specified src.

        Sets the URI of an external style sheet. Note: if calling this with withContent(String), the withContent(String) has higher priority.

        Parameters:
        src - The style URI.

        Default: null.

        Returns:
        A modified copy of the this object
      • isVisible

        default boolean isVisible()
        Returns false by default.
        Specified by:
        isVisible in interface IComponent<IStyle>
      • of

        static IStyle of​(java.lang.String content)
        Returns the instance with the given content.
        Parameters:
        content - The style content.
      • ofSrc

        static IStyle ofSrc​(java.lang.String src)
        Returns the instance with the given src.
        Parameters:
        src - The style URI.
      • ofId

        static IStyle ofId​(java.lang.String id)
        Returns the instance with the given id.
        Parameters:
        id - The id to identify this component