-
Notifications
You must be signed in to change notification settings - Fork 13
Fields
Mateu infers the UI element from the java fields inside a class.
So a String
fields maps to an input element in the UI, an int
field maps to an input element which only allows integers,
a boolean
field maps to a checkbox, and an enum field maps to a radio button and so on.
Mateu does his best to infer the UI from our java code. However, some times we need to change the default behavior for adjusting the UI.
This is the list of supported field types:
Field type | Painted as | Comments |
---|---|---|
String | Text field | A rich text editor will be used by annotating the field with @RichText . Also, @Image will treat you string value as the src attribute for an image element. If you annotate your field with @ValuesProvider or @ValuesProviderMethod a dropdown will be shown. |
int, Integer | Number field | |
float, Float | Number field | |
double, Double | Number field | |
boolean, Boolean | Checkbox | Can paint a radio button or toggle by annotating the field with @UseRadioButtons and @Toggle
|
enum | Dropdown | |
Arrays and collections of basic types | Text field | Values are separated by commas |
Arrays and collections of enums | Check boxes | |
Arrays and collections of objects | Table | |
Maps | Not supported | |
Icon | An icon | More than 600 icons are supported as per today |
Any object | Read only showing the toString result |
Use a button to open an editor |
The field label is inferred from the field name so, for a field named yourBirthDate
, Mateu will create a label saying Your birth date
. You can always set an specific value by using the @Caption
annotation.
Mateu looks for JSR-380 javax standard validation annotations to set validations. The validation happens both at client and at server side, even though not all of them are supported at client side.
This is the list of client side supported validations:
-
@NotNull
,@NotEmpty
-
@Min
,@Max
@Pattern
Mateu does not infer a UI component for every field. If the field is final, transient, if it is injected with @Autowired
or if the field is annotated with @Ignored
Mateu will ignore them.
For limiting the number of possible values that the user can enter for an String, int or double field we can use the @ValuesProviderMethod
annotation and provide the name of a method returning List<Value>
in the same form class. We can also annotate our field with @ValuesProvider
and provide a class implementing the ValuesListProvider
interface.
We can set the number of columns of the form by annotating the class with @FormColumns
or by using the columns
parameter in the @Section
annotation.
We also have several annotations for changing the layout of our form: @Section
, @FieldGroup
, @Tab
, @SameLine
, ...
Basically, a form contains one or more sections, each section contains one or more field groups, each field group contains one or more field lines and each field line contains one or more fields. On top of that the form will layout the field lines in columns which can be set at form level or at section level. Each section belongs to a tab, if used.
Please notice that for sections you can remove the line around by setting the card
parameter to false
.
You can trigger action runs on a value change. For doing that you just need to annotate the field with @CallActionOnChange
and a round trip to the server will happen each time you change that field value.
- Home
- Disclaimer
- See it in action
- User manual (v3)
- UX and IA
- Internals
- Roadmap
- Javadoc
- SonarQube
- Other MDD frameworks
- Thanks