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 Details

    • DEFAULT

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

    • getWidgetClass

      default String getWidgetClass()
      Returns the client widget class.

      Default: "zul.utl.Style"

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

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

      Default: null.

      Refer to media-depedent style sheet for details.

    • withMedia

      IStyle withMedia(@Nullable 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 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 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 String getSrc()
      Returns the URI of an external style sheet.

      Default: null.

    • withSrc

      IStyle withSrc(@Nullable 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(String content)
      Returns the instance with the given content.
      Parameters:
      content - The style content.
    • ofSrc

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

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