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>>
A component
The 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 ClassesModifier and TypeInterfaceDescriptionstatic classIA.Builder<I extends IAnyGroup>Builds instances of typeIA.static enumInsert AdjacentdirectionforwithDir(Direction)static enumInsert AdjacenttargetforwithTarget(Target)}static classBuilds an updater of typeIAforUiAgent.smartUpdate(Locator, SmartUpdater). -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionReturns a list of component IDs that shall be disabled when the user clicks this anchor.default StringgetDir()Returns thedirection.getHref()Returns the URI that the hyperlink points to.Returns the target frame or window.default StringReturns the client widget class.default booleanReturns whether it is disabled.of(I... children) Returns the instance with the given any group children.Returns the instance with the given any group children.Returns the instance with the given label.Returns the instance with the given id.withAutodisable(String autodisable) Returns a copy ofthisimmutable component with the specifiedautodisable.Returns a copy ofthisimmutable component with the specifieddir.withDir(IA.Direction dir) Returns a copy ofthisimmutable component with the specifieddir.withDisabled(boolean disabled) Returns a copy ofthisimmutable component with the specifieddisabled.Returns a copy ofthisimmutable component with the specifiedhref.withTarget(String target) Returns a copy ofthisimmutable component with the specifiedtarget.withTarget(IA.Target target) Returns a copy ofthisimmutable component with the specifiedtarget.Methods inherited from interface org.zkoss.stateless.sul.IChildable
getChildren, withChildren, withChildrenMethods 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, withWidgetOverridesMethods inherited from interface org.zkoss.stateless.sul.IHtmlBasedComponent
getClientAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getSkeleton, getStyle, getTabindex, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZIndex, isFocus, withClientAction, withDraggable, withDroppable, withFocus, withHeight, withHflex, withLeft, withRenderdefer, withSclass, withSkeleton, withStyle, withTabindex, withTabindex, withTooltiptext, withTop, withVflex, withWidth, withZclass, withZIndexMethods inherited from interface org.zkoss.stateless.sul.ILabelElement
getLabel, withLabelMethods inherited from interface org.zkoss.stateless.sul.ILabelImageElement
getHoverImage, getIconSclass, getIconSclasses, getIconTooltip, getIconTooltips, getImage, isPreloadImage, withHoverImage, withIconSclass, withIconSclasses, withIconTooltip, withIconTooltips, withImage, withPreloadImageMethods inherited from interface org.zkoss.stateless.sul.IXulElement
getContext, getCtrlKeys, getPopup, getTooltip, withContext, withCtrlKeys, withPopup, withTooltip
-
Field Details
-
DEFAULT
Constant for default attributes of this immutable component.
-
-
Method Details
-
getWidgetClass
Returns the client widget class.Default:
"zul.wgt.A"- Specified by:
getWidgetClassin interfaceIComponent<I extends IAnyGroup>- Returns:
-
getDir
Returns thedirection.Default:
"normal". -
withDir
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
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
Returns a copy ofthisimmutable component with the specifieddisabled.Sets whether it is disabled.
- Returns:
- A modified copy of the
thisobject
-
getAutodisable
Returns a list of component IDs that shall be disabled when the user clicks this anchor.Default:
null -
withAutodisable
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
Returns the target frame or window.Note: It is useful only if
href(withHref(java.lang.String)) is specified.Default:
null. -
withTarget
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
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
Returns the URI that the hyperlink points to.Default:
null. Ifnull, the hyperlink has no function unless you specify theIComponent.withAction(ActionHandler). -
withHref
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
Returns the instance with the given label.- Parameters:
label- The label of this anchor component.
-
of
Returns the instance with the given any group children.- Parameters:
children- The children belong to any group- See Also:
-
of
Returns the instance with the given any group children.- Parameters:
children- The children belong to any group- See Also:
-
ofId
Returns the instance with the given id.- Parameters:
id- The id of this anchor component.
-