Skip to content

Commit 11af558

Browse files
authored
Merge pull request #83 from JsonSchema-JavaUI/patch-1.0.2
Patch 1.0.2
2 parents a3df3ff + 8399038 commit 11af558

12 files changed

+23
-18
lines changed

docs/index.md

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ To render a field as a TextField the developer must add the [@TextField](../src/
2020
| pattern | String (regEx) | Reg Ex used to validate the input |
2121
| validationMessage | String | A custom validation error message |
2222
| readOnly | Boolean | Make the field readOnly |
23+
| required | Boolean | Make the field required |
2324
| noTitle | Boolean | Set to true to hide title |
2425
| fieldAddonLeft | String | [Extend form controls](http://getbootstrap.com/components/#input-groups) by adding text on the left side of the Text Field |
2526
| fieldAddonRight | String | [Extend form controls](http://getbootstrap.com/components/#input-groups) by adding text on the right side of the Text Field |
@@ -81,6 +82,7 @@ The given component can be used to fill numeric values, it can be applied to fie
8182
| description | String | A description, can be HTML |
8283
| validationMessage | String | A custom validation error message |
8384
| readOnly | Boolean | Make the field readOnly |
85+
| required | Boolean | Make the field required |
8486
| noTitle | Boolean | Set to true to hide title |
8587
| fieldAddonLeft | String | [Extend form controls](http://getbootstrap.com/components/#input-groups) by adding text on the left side of the Number Field |
8688
| fieldAddonRight | String | [Extend form controls](http://getbootstrap.com/components/#input-groups) by adding text on the right side of the Number Field |
@@ -147,6 +149,7 @@ For some use cases, the developer need to use a encrypted UI input field to fill
147149
| pattern | String (regEx) | Reg Ex used to validate the input |
148150
| validationMessage | String | A custom validation error message |
149151
| readOnly | Boolean | Make the field readOnly |
152+
| required | Boolean | Make the field required |
150153
| noTitle | Boolean | Set to true to hide title |
151154
| fieldAddonLeft | String | [Extend form controls](http://getbootstrap.com/components/#input-groups) by adding text on the left side of the Password Field |
152155
| fieldAddonRight | String | [Extend form controls](http://getbootstrap.com/components/#input-groups) by adding text on the right side of the Password Field |
@@ -190,6 +193,7 @@ The TextArea component is a multiline text field with a border and optional scro
190193
| maxLength | Integer | Max text length |
191194
| validationMessage | String | A custom validation error message |
192195
| readOnly | Boolean | Make the field readOnly |
196+
| required | Boolean | Make the field required |
193197
| noTitle | Boolean | Set to true to hide title |
194198
| fieldAddonLeft | String | [Extend form controls](http://getbootstrap.com/components/#input-groups) by adding text on the left side of the Text Area |
195199
| fieldAddonRight | String | [Extend form controls](http://getbootstrap.com/components/#input-groups) by adding text on the right side of the Text Area |

release.properties

-18
This file was deleted.

src/main/java/io/asfjava/ui/core/form/Number.java

+3
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,7 @@
2424
String validationMessage() default "";
2525

2626
boolean readOnly() default false;
27+
28+
boolean required() default false;
29+
2730
}

src/main/java/io/asfjava/ui/core/form/Password.java

+3
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,7 @@
3030
String validationMessage() default "";
3131

3232
boolean readOnly() default false;
33+
34+
boolean required() default false;
35+
3336
}

src/main/java/io/asfjava/ui/core/form/RadioBox.java

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
String title();
1515

1616
boolean readOnly() default false ;
17+
18+
boolean required() default false;
1719

1820
Class<? extends ValuesContainer> titleMap();
1921

src/main/java/io/asfjava/ui/core/form/TextArea.java

+2
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,6 @@
2828
String validationMessage() default "";
2929

3030
boolean readOnly() default false;
31+
32+
boolean required() default false;
3133
}

src/main/java/io/asfjava/ui/core/form/TextField.java

+3
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,7 @@
3030
String validationMessage() default "";
3131

3232
boolean readOnly() default false;
33+
34+
boolean required() default false;
35+
3336
}

src/main/java/io/asfjava/ui/core/generators/NumberGenerator.java

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public void generate(ObjectNode fieldFormDefinition, Field field) {
1313
Number annotation = field.getAnnotation(Number.class);
1414
fieldFormDefinition.put("key", field.getName());
1515
fieldFormDefinition.put("type", "number");
16+
fieldFormDefinition.put("required", annotation.required());
1617

1718
String title = annotation.title();
1819
if (!title.isEmpty()) {

src/main/java/io/asfjava/ui/core/generators/PasswordGenerator.java

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public void generate(ObjectNode fieldFormDefinition, Field field) {
1313
Password annotation = field.getAnnotation(Password.class);
1414
fieldFormDefinition.put("key", field.getName());
1515
fieldFormDefinition.put("type", "password");
16+
fieldFormDefinition.put("required", annotation.required());
1617

1718
String description = annotation.description();
1819
if (!description.isEmpty()) {

src/main/java/io/asfjava/ui/core/generators/RadioBoxGenerator.java

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public void generate(ObjectNode fieldFormDefinition, Field field) {
2020
fieldFormDefinition.put("key", field.getName());
2121
fieldFormDefinition.put("readOnly", annotation.readOnly());
2222
fieldFormDefinition.put("type", "radios");
23+
fieldFormDefinition.put("required", annotation.required());
2324

2425
JsonNode radioFieldFormDefinition = fieldFormDefinition;
2526

src/main/java/io/asfjava/ui/core/generators/TextAreaGenerator.java

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public void generate(ObjectNode fieldFormDefinition, Field field) {
1313
TextArea annotation = field.getAnnotation(TextArea.class);
1414
fieldFormDefinition.put("key", field.getName());
1515
fieldFormDefinition.put("type", "textarea");
16+
fieldFormDefinition.put("required", annotation.required());
1617

1718
String fieldAddonLeft = annotation.fieldAddonLeft();
1819
if (!fieldAddonLeft.isEmpty()) {

src/main/java/io/asfjava/ui/core/generators/TextFieldGenerator.java

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ public void generate(ObjectNode fieldFormDefinition, Field field) {
1313
TextField annotation = field.getAnnotation(TextField.class);
1414

1515
fieldFormDefinition.put("key", field.getName());
16+
fieldFormDefinition.put("required", annotation.required());
17+
1618
String description = annotation.description();
1719
if (!description.isEmpty()) {
1820
fieldFormDefinition.put("description", description);

0 commit comments

Comments
 (0)