Class InstantUI

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

public class InstantUI extends 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
     
  • Method Summary

    Modifier and Type
    Method
    Description
    createEditUI(PropertyBusinessObject bo, boolean autoCommit)
    Creates editing UI for the given business object
    void
    Excludes the properties from the generated UI
    void
    Excludes the property from the generated UI
    Returns the Binding object for the given container which allows us control over the widgets and their commit status
    Returns the order of the properties or null if they should use their natural order as they were submitted to the index object
    int
    The text field constraint for the property.
    boolean
    Returns true if the property was excluded from the GUI
    void
    The component class used to map this property
    void
    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
    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
    Sets the order of the properties, notice that this can also replace exclude
    void
    Sets the text field constraint for the property explicitly, notice that some constraints are implicit unless set manually e.g.

    Methods inherited from class Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    Modifier and Type
    Method
    Description
    protected Object
     
    boolean
    Indicates whether some other object is "equal to" this one.
    final Class
    Returns the runtime class of an object.
    int
    Returns a hash code value for the object.
    final void
    Wakes up a single thread that is waiting on this object's monitor.
    final void
    Wakes up all threads that are waiting on this object's monitor.
    Returns a string representation of the object.
    final void
    Causes current thread to wait until another thread invokes the method or the method for this object.
    final void
    wait(long timeout)
    Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.
    final void
    wait(long timeout, int nanos)
    Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
  • 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, 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, 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