Class InputParameter

java.lang.Object
io.jmix.ui.app.inputdialog.InputParameter

public class InputParameter extends Object
Describes field that can be used in InputDialog.
  • Field Details

    • id

      protected String id
    • caption

      protected String caption
    • requiredMessage

      protected String requiredMessage
    • required

      protected boolean required
    • datatype

      protected Datatype datatype
    • field

      protected Supplier<Field> field
    • defaultValue

      protected Object defaultValue
    • entityClass

      protected Class<?> entityClass
    • enumClass

      protected Class<? extends EnumClass> enumClass
    • timeZone

      protected TimeZone timeZone
    • useUserTimeZone

      protected boolean useUserTimeZone
    • datatypeJavaClass

      protected Class datatypeJavaClass
  • Constructor Details

    • InputParameter

      public InputParameter(String id)
      Parameters:
      id - field id
  • Method Details

    • getId

      public String getId()
      Returns:
      field id
    • withId

      public InputParameter withId(String id)
      Sets field id.
      Parameters:
      id - field id
      Returns:
      input parameter
    • getCaption

      @Nullable public String getCaption()
      Returns:
      field caption
    • withCaption

      public InputParameter withCaption(@Nullable String caption)
      Sets caption to the field.
      Parameters:
      caption - caption
      Returns:
      input parameter
    • isRequired

      public boolean isRequired()
      Returns:
      true if field is required
    • withRequired

      public InputParameter withRequired(boolean required)
      Sets required for the field.
      Parameters:
      required - required option
      Returns:
      input parameter
    • getRequiredMessage

      @Nullable public String getRequiredMessage()
      Returns:
      message that will be shown if the field is not filled and it is isRequired() or null if not set
    • withRequiredMessage

      public InputParameter withRequiredMessage(@Nullable String requiredMessage)
      Sets message that will be shown if the field is not filled and it is isRequired().
      Parameters:
      requiredMessage - message
      Returns:
      input parameter
    • getDatatype

      @Nullable public Datatype getDatatype()
      Returns:
      field Datatype
    • withDatatype

      public InputParameter withDatatype(Datatype datatype)
      Sets datatype to the field. Cannot be used with withEntityClass(Class), withEnumClass(Class) and with predefined static methods.

      Note, it doesn't support custom Datatype. Use withField(Supplier).

      Parameters:
      datatype - datatype
      Returns:
      input parameter
    • withDatatypeJavaClass

      protected InputParameter withDatatypeJavaClass(Class javaClass)
    • getDatatypeJavaClass

      @Nullable protected Class getDatatypeJavaClass()
    • getField

      public Supplier<Field> getField()
      Returns:
      field supplier
    • withField

      public InputParameter withField(Supplier<Field> field)
      Sets field supplier.

      Note, in order to get value from this field you must use an id that is set to the InputParameter, not to the created field.

      Parameters:
      field - supplier
      Returns:
      input parameter
    • getDefaultValue

      @Nullable public Object getDefaultValue()
      Returns:
      default value
    • withDefaultValue

      public InputParameter withDefaultValue(@Nullable Object defaultValue)
      Sets default value to the field.
      Parameters:
      defaultValue - default value
      Returns:
      input parameter
    • getEntityClass

      @Nullable public Class<?> getEntityClass()
      Returns:
      entity class
    • withEntityClass

      public InputParameter withEntityClass(Class<?> entityClass)
      Sets entity class. Cannot be used with withDatatype(Datatype), withEnumClass(Class) and with predefined static methods.
      Parameters:
      entityClass - entity class
      Returns:
      input parameter
    • getEnumClass

      @Nullable public Class<? extends EnumClass> getEnumClass()
      Returns:
      enum class
    • withEnumClass

      public InputParameter withEnumClass(Class<? extends EnumClass> enumClass)
      Sets enum class. Cannot be used with withDatatype(Datatype), withEntityClass(Class) and with predefined static methods.
      Parameters:
      enumClass - enum class
      Returns:
      input parameter
    • getTimeZone

      @Nullable public TimeZone getTimeZone()
      Returns:
      time zone
    • withTimeZone

      public InputParameter withTimeZone(@Nullable TimeZone timeZone)
      Sets time zone to the parameter. InputDialog supports time zones for If time zone not set and isUseUserTimeZone() is false, component will use system time zone.
      Parameters:
      timeZone - time zone to use
      Returns:
      input parameter
      See Also:
    • isUseUserTimeZone

      public boolean isUseUserTimeZone()
      Returns:
      true if the parameter uses user's TimeZone.
    • withUseUserTimeZone

      public InputParameter withUseUserTimeZone(boolean useUserTimeZone)
      Sets to the parameter whether to use user's TimeZone. InputDialog supports time zones for Default value is false. If users' time zone is not used and time zone is not set, component will use system time zone.
      Parameters:
      useUserTimeZone - whether to use user's time zone or not
      Returns:
      input parameter
      See Also:
    • parameter

      public static InputParameter parameter(String id)
      Creates parameter with String type.
      Parameters:
      id - field id
      Returns:
      input parameter
    • stringParameter

      public static InputParameter stringParameter(String id)
      Creates parameter with String type.
      Parameters:
      id - field id
      Returns:
      input parameter
    • intParameter

      public static InputParameter intParameter(String id)
      Creates parameter with Integer type.
      Parameters:
      id - field id
      Returns:
      input parameter
    • doubleParameter

      public static InputParameter doubleParameter(String id)
      Creates parameter with Double type.
      Parameters:
      id - field id
      Returns:
      input parameter
    • bigDecimalParameter

      public static InputParameter bigDecimalParameter(String id)
      Creates parameter with BigDecimal type.
      Parameters:
      id - field id
      Returns:
      input parameter
    • longParameter

      public static InputParameter longParameter(String id)
      Creates parameter with Long type.
      Parameters:
      id - field id
      Returns:
      input parameter
    • dateParameter

      public static InputParameter dateParameter(String id)
      Creates parameter with Date type.
      Parameters:
      id - field id
      Returns:
      input parameter
    • timeParameter

      public static InputParameter timeParameter(String id)
      Creates parameter with Time type.
      Parameters:
      id - field id
      Returns:
      input parameter
    • dateTimeParameter

      public static InputParameter dateTimeParameter(String id)
      Creates parameter with DateTime type. To enable time zones for the component use withUseUserTimeZone(boolean) or withTimeZone(TimeZone).

      If isUseUserTimeZone() is false and time zone is not set, component will use system time zone.

      Parameters:
      id - field id
      Returns:
      input parameter
    • entityParameter

      public static InputParameter entityParameter(String id, Class<?> entityClass)
      Creates parameter with Entity type.
      Parameters:
      id - field id
      entityClass - entity class
      Returns:
      input parameter
    • booleanParameter

      public static InputParameter booleanParameter(String id)
      Creates parameter with Boolean type.
      Parameters:
      id - field id
      Returns:
      input parameter
    • byteArrayParameter

      public static InputParameter byteArrayParameter(String id)
      Creates parameter with byte[] type.
      Parameters:
      id - field id
      Returns:
      input parameter
    • fileParameter

      public static InputParameter fileParameter(String id)
      Creates parameter with FileRef (file reference) type.
      Parameters:
      id - field id
      Returns:
      input parameter
    • enumParameter

      public static InputParameter enumParameter(String id, Class<? extends EnumClass> enumClass)
      Creates parameter with Enum type.
      Parameters:
      id - field id
      enumClass - enum class
      Returns:
      input parameter
    • localDateParameter

      public static InputParameter localDateParameter(String id)
      Creates parameter with LocalDate type.
      Parameters:
      id - field id
      Returns:
      input parameter
    • localTimeParameter

      public static InputParameter localTimeParameter(String id)
      Creates parameter with LocalTime type.
      Parameters:
      id - field id
      Returns:
      input parameter
    • localDateTimeParameter

      public static InputParameter localDateTimeParameter(String id)
      Creates parameter with LocalDateTime type.
      Parameters:
      id - field id
      Returns:
      input parameter
    • offsetDateTimeParameter

      public static InputParameter offsetDateTimeParameter(String id)
      Creates parameter with OffsetDateTime type. To enable time zones for the component use withUseUserTimeZone(boolean) or withTimeZone(TimeZone).

      If isUseUserTimeZone() is false and time zone is not set, component will use system time zone.

      Parameters:
      id - field id
      Returns:
      input parameter
    • offsetTimeParameter

      public static InputParameter offsetTimeParameter(String id)
      Creates parameter with OffsetTime type.
      Parameters:
      id - field id
      Returns:
      input parameter
    • checkNullDatatype

      protected void checkNullDatatype(String message)
    • checkNullEntityClass

      protected void checkNullEntityClass(String message)
    • checkNullEnumClass

      protected void checkNullEnumClass(String message)
    • checkNullDatatypeJavaClass

      protected void checkNullDatatypeJavaClass(String message)
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object