# Class InstantUI

java.lang.Object
com.codename1.properties.InstantUI

public class InstantUI extends java.lang.Object
Instant UI generates a user interface for editing a property business object based on common conventions and settings within the properties. UI's are automatically bound and work seamlessly. Important: These UI's are subject to change, e.g. a generated UI might not have validation for a specific property in one build and might introduce it in an update. We try to generate great UI's seamlessly and some improvements might break functionality.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `InstantUI()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Container`
  `createEditUI(PropertyBusinessObject bo, boolean autoCommit)`
  Creates editing UI for the given business object
  `void`
  `excludeProperties(PropertyBase... exclude)`
  Excludes the properties from the generated UI
  `void`
  `excludeProperty(PropertyBase exclude)`
  Excludes the property from the generated UI
  `UiBinding.Binding`
  `getBindings(Container cnt)`
  Returns the Binding object for the given container which allows us control over the widgets and their commit status
  `PropertyBase[]`
  `getOrder()`
  Returns the order of the properties or null if they should use their natural order as they were submitted to the index object
  `int`
  `getTextFieldConstraint(PropertyBase p)`
  The text field constraint for the property.
  `boolean`
  `isExcludedProperty(PropertyBase exclude)`
  Returns true if the property was excluded from the GUI
  `void`
  `setComponentClass(PropertyBase p, java.lang.Class cmpCls)`
  The component class used to map this property
  `void`
  `setMultiChoiceLabels(PropertyBase p, String... labels)`
  A property that's a multi-choice can use this API to define the options used e.g.: `iui.setMultiChoiceLabels(c.gender, "Male", "Female", "Undefined"); iui.setMultiChoiceValues(c.gender, "M", "F", "U");`
  `void`
  `setMultiChoiceValues(PropertyBase p, java.lang.Object... values)`
  A property that's a multi-choice can use this API to define the options used, notice that this API won't work correctly without `java.lang.String...)`
  `void`
  `setOrder(PropertyBase... order)`
  Sets the order of the properties, notice that this can also replace exclude
  `void`
  `setTextFieldConstraint(PropertyBase p, int cons)`
  Sets the text field constraint for the property explicitly, notice that some constraints are implicit unless set manually e.g.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### InstantUI

    public InstantUI()

- ## Method Details

  - ### excludeProperty

    public void excludeProperty(PropertyBase exclude)

    Excludes the property from the generated UI

    ###### Parameters

    - `exclude`: the property to exclude

  - ### excludeProperties

    public void excludeProperties(PropertyBase... exclude)

    Excludes the properties from the generated UI

    ###### Parameters

    - `exclude`: the properties to exclude

  - ### isExcludedProperty

    public boolean isExcludedProperty(PropertyBase exclude)

    Returns true if the property was excluded from the GUI

    ###### Parameters

    - `exclude`: the property

    ###### Returns

    true if the property was excluded from the GUI

  - ### setMultiChoiceLabels

    public void setMultiChoiceLabels(PropertyBase p, String... labels)

    A property that's a multi-choice can use this API to define the options used e.g.: `iui.setMultiChoiceLabels(c.gender, "Male", "Female", "Undefined"); iui.setMultiChoiceValues(c.gender, "M", "F", "U");`

    ###### Parameters

    - `p`: the property

    - `labels`: label for each option

  - ### setMultiChoiceValues

    public void setMultiChoiceValues(PropertyBase p, java.lang.Object... values)

    A property that's a multi-choice can use this API to define the options used, notice that this API won't work correctly without `java.lang.String...)`

    ###### Parameters

    - `p`: the property

    - `values`: actual values used for each label

  - ### setComponentClass

    public void setComponentClass(PropertyBase p, java.lang.Class cmpCls)

    The component class used to map this property

    ###### Parameters

    - `p`: the property

    - `cmpCls`: class of the component e.g. `Button.class`

  - ### setTextFieldConstraint

    public void setTextFieldConstraint(PropertyBase p, int cons)

    Sets the text field constraint for the property explicitly, notice that some constraints are implicit unless set manually e.g. numeric for numbers or password for fields with password in the name

    ###### Parameters

    - `p`: the property

    - `cons`: the text field constraint

  - ### getTextFieldConstraint

    public int getTextFieldConstraint(PropertyBase p)

    The text field constraint for the property. notice that some constraints are implicit unless set manually e.g. numeric for numbers or password for fields with password in the name

    ###### Parameters

    - `p`: the property

    ###### Returns

    the constraint matching this property

  - ### getOrder

    public PropertyBase[] getOrder()

    Returns the order of the properties or null if they should use their natural order as they were submitted to the index object

    ###### Returns

    the property order

  - ### setOrder

    public void setOrder(PropertyBase... order)

    Sets the order of the properties, notice that this can also replace exclude

    ###### Parameters

    - `order`: the order of the properties

  - ### createEditUI

    public Container createEditUI(PropertyBusinessObject bo, boolean autoCommit)

    Creates editing UI for the given business object

    ###### Parameters

    - `bo`: the business object

    - `autoCommit`: true if the bindings used should be auto-committed

    ###### Returns

    a UI container that can be used to edit the business object

  - ### getBindings

    public UiBinding.Binding getBindings(Container cnt)

    Returns the Binding object for the given container which allows us control over the widgets and their commit status

    ###### Parameters

    - `cnt`: the container returned by the `#createUI(boolean)` method

    ###### Returns

    a binding object