Class Select

java.lang.Object
io.mindspice.simplypages.core.HtmlTag
io.mindspice.simplypages.components.forms.Select
All Implemented Interfaces:
Component

public class Select extends HtmlTag
Select/dropdown control with mutable option list.

Mutable and not thread-safe. Options and attributes are accumulated on this instance. Mutate within a request-scoped flow. For reuse, stop mutating and render as a stable structure with per-request slot/context values.

  • Constructor Details

    • Select

      public Select(String name)
      Creates a select element.
      Parameters:
      name - form field name
  • Method Details

    • create

      public static Select create(String name)
      Creates a select element.
      Parameters:
      name - form field name
      Returns:
      new select
    • withId

      public Select withId(String id)
      Sets id attribute.
      Overrides:
      withId in class HtmlTag
      Parameters:
      id - element id
      Returns:
      this select
    • multiple

      public Select multiple()
      Enables multi-select behavior.
      Returns:
      this select
    • required

      public Select required()
      Marks select required.
      Returns:
      this select
    • disabled

      public Select disabled()
      Marks select disabled.
      Returns:
      this select
    • withSize

      public Select withSize(int size)
      Sets number of visible options.
      Parameters:
      size - visible row count
      Returns:
      this select
    • addOption

      public Select addOption(String value, String label)
      Appends one unselected option.
      Parameters:
      value - option value
      label - option label
      Returns:
      this select
    • addOption

      public Select addOption(String value, String label, boolean selected)
      Appends one option.
      Parameters:
      value - option value
      label - option label
      selected - initial selected flag
      Returns:
      this select
    • addOptions

      public Select addOptions(List<String> values)
      Appends options where value and label are identical.
      Parameters:
      values - option value/label list
      Returns:
      this select
    • withClass

      public Select withClass(String className)
      Appends class token(s).
      Overrides:
      withClass in class HtmlTag
      Parameters:
      className - class token(s)
      Returns:
      this select
    • getChildrenStream

      protected Stream<Component> getChildrenStream()
      Renders children plus options appended in insertion order.
      Overrides:
      getChildrenStream in class HtmlTag
      Returns:
      children stream
    • withWidth

      public Select withWidth(String width)
      Sets inline width style.
      Overrides:
      withWidth in class HtmlTag
      Parameters:
      width - CSS width value
      Returns:
      this select
    • withMaxWidth

      public Select withMaxWidth(String maxWidth)
      Sets inline max-width style.
      Overrides:
      withMaxWidth in class HtmlTag
      Parameters:
      maxWidth - CSS max-width value
      Returns:
      this select
    • withMinWidth

      public Select withMinWidth(String minWidth)
      Sets inline min-width style.
      Overrides:
      withMinWidth in class HtmlTag
      Parameters:
      minWidth - CSS min-width value
      Returns:
      this select