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>>
Immutable 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
  • Field Details

    • DEFAULT

      static final IA<IAnyGroup> DEFAULT
      Constant for default attributes of this immutable component.
  • Method Details

    • getWidgetClass

      default String getWidgetClass()
      Returns the client widget class.

      Default: "zul.wgt.A"

      Specified by:
      getWidgetClass in interface IComponent<I extends IAnyGroup>
      Returns:
    • getDir

      default String getDir()
      Returns the direction.

      Default: "normal".

    • withDir

      IA<I> withDir(String dir)
      Returns a copy of this immutable component with the specified dir.

      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 of this immutable component with the specified dir.

      Sets the direction to layout with image.

      Parameters:
      dir - Either IA.Direction.NORMAL or IA.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 of this immutable component with the specified disabled.

      Sets whether it is disabled.

      Returns:
      A modified copy of the this object
    • getAutodisable

      @Nullable 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 String autodisable)
      Returns a copy of this immutable component with the specified autodisable.

      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");
       }
       
       
      is the same as
       @RichletMapping("/autodisable")
       public IComponent autodisable() {
           return IA.ofId("ok").withLabel("OK").withAutodisable("ok,cancel");
       }
       
       
      that will disable both the ok and cancel anchor when a user clicks it.

      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 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 String target)
      Returns a copy of this immutable component with the specified target.

      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 of this immutable component with the specified target.

      Sets the target frame or window.

      Parameters:
      target - The IA.Target of the frame or window to hyperlink.
      Returns:
      A modified copy of the this object
    • getHref

      @Nullable String getHref()
      Returns the URI that the hyperlink points to.

      Default: null. If null, the hyperlink has no function unless you specify the IComponent.withAction(ActionHandler).

    • withHref

      IA<I> withHref(@Nullable String href)
      Returns a copy of this immutable component with the specified href.

      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")
           );
       }
       
       
      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().
      Returns:
      A modified copy of the this object
    • of

      static <I extends IAnyGroup> IA<I> of(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(Iterable<? extends I> children)
      Returns the instance with the given any group children.
      Parameters:
      children - The children belong to any group
      See Also:
    • 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:
    • ofId

      static <I extends IAnyGroup> IA<I> ofId(String id)
      Returns the instance with the given id.
      Parameters:
      id - The id of this anchor component.