Package org.zkoss.zul

Class Bandbox

All Implemented Interfaces:
Serializable, Cloneable, Component, Disable, Readonly, Scope, ComponentCtrl, Constrainted

public class Bandbox extends Textbox
A band box. A bank box consists of an input box (Textbox and a popup window Bandpopup. It is similar to Combobox except the popup window could have any kind of children. For example, you could place a textbox in the popup to let user search particular items.

Default getZclass(): z-bandbox.(since 3.5.0)

Events: onOpen
Developers can listen to the onOpen event and initializes it when OpenEvent.isOpen() is true, and/or clean up if false.

Note: to have better performance, onOpen is sent only if a non-deferrable event listener is registered (see Deferrable).

Author:
tomyeh
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • getDropdown

      public Bandpopup getDropdown()
      Returns the dropdown window belonging to this band box.
    • isAutodrop

      public boolean isAutodrop()
      Returns whether to automatically drop the list if users is changing this text box.

      Default: false.

    • setAutodrop

      public void setAutodrop(boolean autodrop)
      Sets whether to automatically drop the list if users is changing this text box.
    • isButtonVisible

      public boolean isButtonVisible()
      Returns whether the button (on the right of the textbox) is visible.

      Default: true.

    • setButtonVisible

      public void setButtonVisible(boolean visible)
      Sets whether the button (on the right of the textbox) is visible.
    • isOpen

      public boolean isOpen()
      Returns whether this bandbox is open.

      Default: false.

      Since:
      6.0.0
    • setOpen

      public void setOpen(boolean open)
      Sets to display dropdown or close the child. Only works while visible.
      Since:
      3.0.1
    • open

      public void open()
      Drops down the child. The same as setOpen(true).
      Since:
      3.0.1
    • close

      public void close()
      Closes the child if it was dropped down. The same as setOpen(false).
      Since:
      3.0.1
    • setMultiline

      public void setMultiline(boolean multiline)
      Bandbox can't be enabled the multiline functionality.
      Overrides:
      setMultiline in class Textbox
    • setRows

      public void setRows(int rows)
      Bandbox can't be enabled the rows functionality.
      Overrides:
      setRows in class Textbox
    • setIconSclass

      public void setIconSclass(String iconSclass)
      Sets the iconSclass name of this Bandbox.
      Parameters:
      iconSclass - String
      Since:
      8.6.2
    • getIconSclass

      public String getIconSclass()
      Returns the iconSclass name of this Bandbox.
      Returns:
      the iconSclass name
      Since:
      8.6.2
    • getZclass

      public String getZclass()
      Description copied from class: HtmlBasedComponent
      Returns the ZK Cascading Style class for this component. It usually depends on the implementation of the mold (AbstractComponent.getMold()).

      Default: null (the default value depends on element).

      HtmlBasedComponent.setZclass(java.lang.String)) will completely replace the default style of a component. In other words, the default style of a component is associated with the default value of HtmlBasedComponent.getZclass(). Once it is changed, the default style won't be applied at all. If you want to perform small adjustments, use HtmlBasedComponent.setSclass(java.lang.String) instead.

      Overrides:
      getZclass in class Textbox
      See Also:
    • renderProperties

      protected void renderProperties(ContentRenderer renderer) throws IOException
      Description copied from class: HtmlBasedComponent
      Renders the content of this component, excluding the enclosing tags and children.

      See also ZK Client-side Reference: Property Rendering

      Overrides:
      renderProperties in class Textbox
      Throws:
      IOException
    • service

      public void service(AuRequest request, boolean everError)
      Processes an AU request.

      Default: in addition to what are handled by InputElement.service(AuRequest, boolean) service}, it also handles onOpen and onSelect.

      Specified by:
      service in interface ComponentCtrl
      Overrides:
      service in class InputElement
      everError - whether any error ever occurred before processing this request.
      Since:
      5.0.0
      See Also:
    • beforeChildAdded

      public void beforeChildAdded(Component newChild, Component refChild)
      Description copied from class: AbstractComponent
      Default: does nothing.
      Specified by:
      beforeChildAdded in interface ComponentCtrl
      Overrides:
      beforeChildAdded in class AbstractComponent
      Parameters:
      newChild - the child to be added (never null).
      refChild - another child component that the new child will be inserted before it. If null, the new child will be the last child.
      See Also:
    • isChildable

      protected boolean isChildable()
      Childable.
      Overrides:
      isChildable in class InputElement
    • getPopupWidth

      public String getPopupWidth()
      Returns:
      the width of the popup of this component
      Since:
      8.0.3
    • setPopupWidth

      public void setPopupWidth(String popupWidth)
      Sets the width of the popup of this component. If the input is a percentage, the popup width will be calculated by multiplying the width of this component with the percentage. (e.g. if the input string is 130%, and the width of this component is 300px, the popup width will be 390px = 300px * 130%) Others will be set directly.
      Parameters:
      popupWidth - the width of the popup of this component
      Since:
      8.0.3