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>>
ImmutableAcomponentThe A component with its
hrefattribute, 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 classIA.Builder<I extends IAnyGroup>Builds instances of typeIA.static classIA.DirectionInsert AdjacentdirectionforwithDir(Direction)static classIA.TargetInsert AdjacenttargetforwithTarget(Target)}static classIA.UpdaterBuilds an updater of typeIAforUiAgent.smartUpdate(Locator, SmartUpdater).
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.lang.StringgetAutodisable()Returns a list of component IDs that shall be disabled when the user clicks this anchor.default java.lang.StringgetDir()Returns thedirection.java.lang.StringgetHref()Returns the URI that the hyperlink points to.java.lang.StringgetTarget()Returns the target frame or window.default java.lang.StringgetWidgetClass()Returns the client widget class.default booleanisDisabled()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 ofthisimmutable component with the specifiedautodisable.IA<I>withDir(java.lang.String dir)Returns a copy ofthisimmutable component with the specifieddir.default IA<I>withDir(IA.Direction dir)Returns a copy ofthisimmutable component with the specifieddir.IA<I>withDisabled(boolean disabled)Returns a copy ofthisimmutable component with the specifieddisabled.IA<I>withHref(java.lang.String href)Returns a copy ofthisimmutable component with the specifiedhref.IA<I>withTarget(java.lang.String target)Returns a copy ofthisimmutable component with the specifiedtarget.default IA<I>withTarget(IA.Target target)Returns a copy ofthisimmutable 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:
getWidgetClassin 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 ofthisimmutable component with the specifieddir.Sets the direction to layout with image.
- Parameters:
dir- Either"normal"or"reverse".- Returns:
- A modified copy of the
thisobject
-
withDir
default IA<I> withDir(IA.Direction dir)
Returns a copy ofthisimmutable component with the specifieddir.Sets the direction to layout with image.
- Parameters:
dir- EitherIA.Direction.NORMALorIA.Direction.REVERSE.- Returns:
- A modified copy of the
thisobject
-
isDisabled
default boolean isDisabled()
Returns whether it is disabled.Default:
false.
-
withDisabled
IA<I> withDisabled(boolean disabled)
Returns a copy ofthisimmutable component with the specifieddisabled.Sets whether it is disabled.
- Returns:
- A modified copy of the
thisobject
-
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 ofthisimmutable 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,
is the same as@RichletMapping("/autodisable") public IComponent autodisable() { return IA.ofId("ok").withLabel("OK").withAutodisable("self,cancel"); }
that will disable both the ok and cancel anchor when a user clicks it.@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
thisobject
-
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 ofthisimmutable 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
thisobject
-
withTarget
default IA<I> withTarget(IA.Target target)
Returns a copy ofthisimmutable component with the specifiedtarget.Sets the target frame or window.
- Parameters:
target- TheIA.Targetof the frame or window to hyperlink.- Returns:
- A modified copy of the
thisobject
-
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 ofthisimmutable component with the specifiedhref.Sets the URI that the hyperlink points to. The
hrefattribute is not restricted to HTTP-based URLs. For example,
If the URI starts with "/", ZK will encode it with the application's context path. Otherwise, the path is relative to the path given by Desktop.getDirectory().@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
thisobject
-
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.
-
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
-
of
static <I extends IAnyGroup> IA<I> of(I... children)
Returns the instance with the given any group children.- Parameters:
children- The children belong to any group- See Also:
IAnyGroup
-
-