Interface IStyle
-
- All Superinterfaces:
IAnyGroup<IStyle>
,IComponent<IStyle>
public interface IStyle extends IAnyGroup<IStyle>
ImmutableStyle
componentThe 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
andcontent
attributes are both set, thecontent
has higher priority.- Author:
- katherine
- See Also:
Style
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
IStyle.Builder
Builds instances of typeIStyle
.static class
IStyle.Updater
Builds an updater of typeIStyle
forUiAgent.smartUpdate(Locator, SmartUpdater)
.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default 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.default java.lang.String
getWidgetClass()
Returns the client widget class.default boolean
isVisible()
Returns false by default.static IStyle
of(java.lang.String content)
Returns the instance with the given content.static IStyle
ofId(java.lang.String id)
Returns the instance with the given id.static IStyle
ofSrc(java.lang.String src)
Returns the instance with the given src.IStyle
withContent(java.lang.String content)
Returns a copy ofthis
immutable component with the specifiedcontent
.IStyle
withMedia(java.lang.String media)
Returns a copy ofthis
immutable component with the specifiedmedia
.IStyle
withSrc(java.lang.String src)
Returns a copy ofthis
immutable component with the specifiedsrc
.-
Methods inherited from interface org.zkoss.stateless.sul.IComponent
getAction, getActions, getClientAttributes, getId, getMold, getWidgetListeners, getWidgetOverrides, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withActions, withActions, withClientAttribute, withClientAttributes, withId, withMold, withVisible, withWidgetClass, withWidgetListener, withWidgetListeners, withWidgetOverride, withWidgetOverrides
-
-
-
-
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 interfaceIComponent<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 ofthis
immutable component with the specifiedmedia
.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 ofthis
immutable component with the specifiedcontent
.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)
, thewithContent(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 ofthis
immutable component with the specifiedsrc
.Sets the URI of an external style sheet. Note: if calling this with
withContent(String)
, thewithContent(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 interfaceIComponent<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
-
-