Interface IA<I extends IAnyGroup>
-
- All Superinterfaces:
IAnyGroup<IA<I>>
,IChildable<IA<I>,I>
,IChildrenOfInputgroup<IA<I>>
,IComponent<IA<I>>
,IHtmlBasedComponent<IA<I>>
,ILabelElement<IA<I>>
,ILabelImageElement<IA<I>>
,IXulElement<IA<I>>
public interface IA<I extends IAnyGroup> extends ILabelImageElement<IA<I>>, IChildable<IA<I>,I>, IAnyGroup<IA<I>>
ImmutableA
componentThe A component with its
href
attribute, creates a hyperlink to web pages, files, email addresses, locations in the same page, or anything else a URI can address.Support @Action
Name Action Type onFocus Represents an action triggered when a component has received focus. onBlur Represents an action triggered when a component has lost focus.
For example, suppose you wants to create a hyperlink, then you can use the IA components as follows.@
RichletMapping
("/example") public IComponent example() { return IA.of("Visit ZK!").withHref("https://www.zkoss.org"); }- Author:
- katherine
- See Also:
A
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
IA.Builder<I extends IAnyGroup>
Builds instances of typeIA
.static class
IA.Direction
Insert Adjacentdirection
forwithDir(Direction)
static class
IA.Target
Insert Adjacenttarget
forwithTarget(Target)
}static class
IA.Updater
Builds an updater of typeIA
forUiAgent.smartUpdate(Locator, SmartUpdater)
.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.lang.String
getAutodisable()
Returns a list of component IDs that shall be disabled when the user clicks this anchor.default java.lang.String
getDir()
Returns thedirection
.java.lang.String
getHref()
Returns the URI that the hyperlink points to.java.lang.String
getTarget()
Returns the target frame or window.default java.lang.String
getWidgetClass()
Returns the client widget class.default boolean
isDisabled()
Returns whether it is disabled.static <I extends IAnyGroup>
IA<I>of(I... children)
Returns the instance with the given any group children.static <I extends IAnyGroup>
IA<I>of(java.lang.Iterable<? extends I> children)
Returns the instance with the given any group children.static <I extends IAnyGroup>
IA<I>of(java.lang.String label)
Returns the instance with the given label.static <I extends IAnyGroup>
IA<I>ofId(java.lang.String id)
Returns the instance with the given id.IA<I>
withAutodisable(java.lang.String autodisable)
Returns a copy ofthis
immutable component with the specifiedautodisable
.IA<I>
withDir(java.lang.String dir)
Returns a copy ofthis
immutable component with the specifieddir
.default IA<I>
withDir(IA.Direction dir)
Returns a copy ofthis
immutable component with the specifieddir
.IA<I>
withDisabled(boolean disabled)
Returns a copy ofthis
immutable component with the specifieddisabled
.IA<I>
withHref(java.lang.String href)
Returns a copy ofthis
immutable component with the specifiedhref
.IA<I>
withTarget(java.lang.String target)
Returns a copy ofthis
immutable component with the specifiedtarget
.default IA<I>
withTarget(IA.Target target)
Returns a copy ofthis
immutable component with the specifiedtarget
.-
Methods inherited from interface org.zkoss.stateless.sul.IChildable
getChildren, withChildren, withChildren
-
Methods inherited from interface org.zkoss.stateless.sul.IComponent
getAction, getActions, getClientAttributes, getId, getMold, getWidgetListeners, getWidgetOverrides, isVisible, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withActions, withActions, withClientAttribute, withClientAttributes, withId, withMold, withVisible, withWidgetClass, withWidgetListener, withWidgetListeners, withWidgetOverride, withWidgetOverrides
-
Methods inherited from interface org.zkoss.stateless.sul.IHtmlBasedComponent
getClientAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZIndex, isFocus, withClientAction, withDraggable, withDroppable, withFocus, withHeight, withHflex, withLeft, withRenderdefer, withSclass, withStyle, withTabindex, withTabindex, withTooltiptext, withTop, withVflex, withWidth, withZclass, withZIndex
-
Methods inherited from interface org.zkoss.stateless.sul.ILabelElement
getLabel, withLabel
-
Methods inherited from interface org.zkoss.stateless.sul.ILabelImageElement
getHoverImage, getIconSclass, getIconSclasses, getIconTooltip, getIconTooltips, getImage, isPreloadImage, withHoverImage, withIconSclass, withIconSclasses, withIconTooltip, withIconTooltips, withImage, withPreloadImage
-
Methods inherited from interface org.zkoss.stateless.sul.IXulElement
getContext, getCtrlKeys, getPopup, getTooltip, withContext, withCtrlKeys, withPopup, withTooltip
-
-
-
-
Method Detail
-
getWidgetClass
default java.lang.String getWidgetClass()
Returns the client widget class.Default:
"zul.wgt.A"
- Specified by:
getWidgetClass
in interfaceIComponent<I extends IAnyGroup>
- Returns:
-
getDir
default java.lang.String getDir()
Returns thedirection
.Default:
"normal"
.
-
withDir
IA<I> withDir(java.lang.String dir)
Returns a copy ofthis
immutable component with the specifieddir
.Sets the direction to layout with image.
- Parameters:
dir
- Either"normal"
or"reverse"
.- Returns:
- A modified copy of the
this
object
-
withDir
default IA<I> withDir(IA.Direction dir)
Returns a copy ofthis
immutable component with the specifieddir
.Sets the direction to layout with image.
- Parameters:
dir
- EitherIA.Direction.NORMAL
orIA.Direction.REVERSE
.- Returns:
- A modified copy of the
this
object
-
isDisabled
default boolean isDisabled()
Returns whether it is disabled.Default:
false
.
-
withDisabled
IA<I> withDisabled(boolean disabled)
Returns a copy ofthis
immutable component with the specifieddisabled
.Sets whether it is disabled.
- Returns:
- A modified copy of the
this
object
-
getAutodisable
@Nullable java.lang.String getAutodisable()
Returns a list of component IDs that shall be disabled when the user clicks this anchor.Default:
null
-
withAutodisable
IA<I> withAutodisable(@Nullable java.lang.String autodisable)
Returns a copy ofthis
immutable component with the specifiedautodisable
.Sets a list of component IDs that shall be disabled when the user clicks this anchor.
To represent the anchor itself, the developer can specify
self
. For example,@
RichletMapping
("/autodisable") public IComponent autodisable() { return IA.ofId("ok").withLabel("OK").withAutodisable("self,cancel"); }@
RichletMapping
("/autodisable") public IComponent autodisable() { return IA.ofId("ok").withLabel("OK").withAutodisable("ok,cancel"); }The anchor being disabled will be enabled automatically once the client receives a response from the server. In other words, the server doesn't notice if an anchor is disabled with this method.
However, if you prefer to enable them later manually, you can prefix with '+'. For example,
@
RichletMapping
("/autodisable") public IComponent autodisable() { return IHlayout.of( IA.ofId("ok").withLabel("OK(action)").withAutodisable("self,+cancel").withAction(this::control), IA.ofId("cancel").withLabel("CANCEL") ); }Then, you have to enable them manually such as
@
Action
(type = Events.ON_BLUR) public void control() { UiAgent.getCurrent().smartUpdate(Locator.ofId("cancel"), new IA.Updater().disabled(false)); }Default:
null
.- Returns:
- A modified copy of the
this
object
-
getTarget
@Nullable java.lang.String getTarget()
Returns the target frame or window.Note: It is useful only if
href
(withHref(java.lang.String)
) is specified.Default:
null
.
-
withTarget
IA<I> withTarget(@Nullable java.lang.String target)
Returns a copy ofthis
immutable component with the specifiedtarget
.Sets the target frame or window.
- Parameters:
target
- The name of the frame or window to hyperlink.- Returns:
- A modified copy of the
this
object
-
withTarget
default IA<I> withTarget(IA.Target target)
Returns a copy ofthis
immutable component with the specifiedtarget
.Sets the target frame or window.
- Parameters:
target
- TheIA.Target
of the frame or window to hyperlink.- Returns:
- A modified copy of the
this
object
-
getHref
@Nullable java.lang.String getHref()
Returns the URI that the hyperlink points to.Default:
null
. Ifnull
, the hyperlink has no function unless you specify theIComponent.withAction(ActionHandler)
.
-
withHref
IA<I> withHref(@Nullable java.lang.String href)
Returns a copy ofthis
immutable component with the specifiedhref
.Sets the URI that the hyperlink points to. The
href
attribute is not restricted to HTTP-based URLs. For example,@
RichletMapping
("/example") public IComponent example() { return IA.of("Visit ZK!).withHref(https://www.zkoss.org"); } @RichletMapping
("/uri") public IComponent uri() { return IHlayout.of( IA.of("jump to example (slash)).withHref(/essential_components/ia/example"), IA.of("jump to example).withHref(example") ); }- Returns:
- A modified copy of the
this
object
-
of
static <I extends IAnyGroup> IA<I> of(java.lang.String label)
Returns the instance with the given label.- Parameters:
label
- The label of this anchor component.
-
ofId
static <I extends IAnyGroup> IA<I> ofId(java.lang.String id)
Returns the instance with the given id.- Parameters:
id
- The id of this anchor component.
-
of
static <I extends IAnyGroup> IA<I> of(java.lang.Iterable<? extends I> children)
Returns the instance with the given any group children.- Parameters:
children
- The children belong to any group- See Also:
IAnyGroup
-
-