diff --git a/docs/index.md b/docs/index.md index 1f3fc0c..1dd310d 100644 --- a/docs/index.md +++ b/docs/index.md @@ -20,6 +20,7 @@ To render a field as a TextField the developer must add the [@TextField](../src/ | pattern | String (regEx) | Reg Ex used to validate the input | | validationMessage | String | A custom validation error message | | readOnly | Boolean | Make the field readOnly | +| required | Boolean | Make the field required | | noTitle | Boolean | Set to true to hide title | | fieldAddonLeft | String | [Extend form controls](http://getbootstrap.com/components/#input-groups) by adding text on the left side of the Text Field | | 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 | description | String | A description, can be HTML | | validationMessage | String | A custom validation error message | | readOnly | Boolean | Make the field readOnly | +| required | Boolean | Make the field required | | noTitle | Boolean | Set to true to hide title | | fieldAddonLeft | String | [Extend form controls](http://getbootstrap.com/components/#input-groups) by adding text on the left side of the Number Field | | 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 | pattern | String (regEx) | Reg Ex used to validate the input | | validationMessage | String | A custom validation error message | | readOnly | Boolean | Make the field readOnly | +| required | Boolean | Make the field required | | noTitle | Boolean | Set to true to hide title | | fieldAddonLeft | String | [Extend form controls](http://getbootstrap.com/components/#input-groups) by adding text on the left side of the Password Field | | 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 | maxLength | Integer | Max text length | | validationMessage | String | A custom validation error message | | readOnly | Boolean | Make the field readOnly | +| required | Boolean | Make the field required | | noTitle | Boolean | Set to true to hide title | | fieldAddonLeft | String | [Extend form controls](http://getbootstrap.com/components/#input-groups) by adding text on the left side of the Text Area | | fieldAddonRight | String | [Extend form controls](http://getbootstrap.com/components/#input-groups) by adding text on the right side of the Text Area | diff --git a/release.properties b/release.properties deleted file mode 100644 index 42883c0..0000000 --- a/release.properties +++ /dev/null @@ -1,18 +0,0 @@ -#release configuration -#Fri Aug 25 14:18:46 CET 2017 -project.scm.io.sfjava.ui\:sf-java-ui.url=https\://github.com/JsonSchema-JavaUI/sf-java-ui -scm.tagNameFormat=@{project.artifactId}-@{project.version} -scm.tag=sf-java-ui-0.1.3 -pushChanges=false -scm.url=scm\:git\:git@github.com\:JsonSchema-JavaUI/sf-java-ui.git -preparationGoals=clean verify -remoteTagging=true -projectVersionPolicyId=default -scm.commentPrefix=[maven-release-plugin] -project.scm.io.sfjava.ui\:sf-java-ui.connection=scm\:git\:git\://github.com/JsonSchema-JavaUI/sf-java-ui.git -project.dev.io.sfjava.ui\:sf-java-ui=0.1.4-SNAPSHOT -project.rel.io.sfjava.ui\:sf-java-ui=0.1.3 -project.scm.io.sfjava.ui\:sf-java-ui.developerConnection=scm\:git\:git@github.com\:JsonSchema-JavaUI/sf-java-ui.git -exec.snapshotReleasePluginAllowed=false -completedPhase=run-completion-goals -project.scm.io.sfjava.ui\:sf-java-ui.tag=sf-java-ui-0.1.1 diff --git a/src/main/java/io/asfjava/ui/core/form/Number.java b/src/main/java/io/asfjava/ui/core/form/Number.java index daf450f..956db07 100644 --- a/src/main/java/io/asfjava/ui/core/form/Number.java +++ b/src/main/java/io/asfjava/ui/core/form/Number.java @@ -24,4 +24,7 @@ String validationMessage() default ""; boolean readOnly() default false; + + boolean required() default false; + } \ No newline at end of file diff --git a/src/main/java/io/asfjava/ui/core/form/Password.java b/src/main/java/io/asfjava/ui/core/form/Password.java index 8bd036a..3c446f1 100644 --- a/src/main/java/io/asfjava/ui/core/form/Password.java +++ b/src/main/java/io/asfjava/ui/core/form/Password.java @@ -30,4 +30,7 @@ String validationMessage() default ""; boolean readOnly() default false; + + boolean required() default false; + } \ No newline at end of file diff --git a/src/main/java/io/asfjava/ui/core/form/RadioBox.java b/src/main/java/io/asfjava/ui/core/form/RadioBox.java index 40e4c85..f23dcae 100644 --- a/src/main/java/io/asfjava/ui/core/form/RadioBox.java +++ b/src/main/java/io/asfjava/ui/core/form/RadioBox.java @@ -14,6 +14,8 @@ String title(); boolean readOnly() default false ; + + boolean required() default false; Class titleMap(); diff --git a/src/main/java/io/asfjava/ui/core/form/TextArea.java b/src/main/java/io/asfjava/ui/core/form/TextArea.java index d18304f..9eb214d 100644 --- a/src/main/java/io/asfjava/ui/core/form/TextArea.java +++ b/src/main/java/io/asfjava/ui/core/form/TextArea.java @@ -28,4 +28,6 @@ String validationMessage() default ""; boolean readOnly() default false; + + boolean required() default false; } \ No newline at end of file diff --git a/src/main/java/io/asfjava/ui/core/form/TextField.java b/src/main/java/io/asfjava/ui/core/form/TextField.java index 3f4e157..aca8ce8 100644 --- a/src/main/java/io/asfjava/ui/core/form/TextField.java +++ b/src/main/java/io/asfjava/ui/core/form/TextField.java @@ -30,4 +30,7 @@ String validationMessage() default ""; boolean readOnly() default false; + + boolean required() default false; + } diff --git a/src/main/java/io/asfjava/ui/core/generators/NumberGenerator.java b/src/main/java/io/asfjava/ui/core/generators/NumberGenerator.java index 1e4433d..4d76faa 100644 --- a/src/main/java/io/asfjava/ui/core/generators/NumberGenerator.java +++ b/src/main/java/io/asfjava/ui/core/generators/NumberGenerator.java @@ -13,6 +13,7 @@ public void generate(ObjectNode fieldFormDefinition, Field field) { Number annotation = field.getAnnotation(Number.class); fieldFormDefinition.put("key", field.getName()); fieldFormDefinition.put("type", "number"); + fieldFormDefinition.put("required", annotation.required()); String title = annotation.title(); if (!title.isEmpty()) { diff --git a/src/main/java/io/asfjava/ui/core/generators/PasswordGenerator.java b/src/main/java/io/asfjava/ui/core/generators/PasswordGenerator.java index df69b2a..376e2a0 100644 --- a/src/main/java/io/asfjava/ui/core/generators/PasswordGenerator.java +++ b/src/main/java/io/asfjava/ui/core/generators/PasswordGenerator.java @@ -13,6 +13,7 @@ public void generate(ObjectNode fieldFormDefinition, Field field) { Password annotation = field.getAnnotation(Password.class); fieldFormDefinition.put("key", field.getName()); fieldFormDefinition.put("type", "password"); + fieldFormDefinition.put("required", annotation.required()); String description = annotation.description(); if (!description.isEmpty()) { diff --git a/src/main/java/io/asfjava/ui/core/generators/RadioBoxGenerator.java b/src/main/java/io/asfjava/ui/core/generators/RadioBoxGenerator.java index 6b33a3f..511d968 100644 --- a/src/main/java/io/asfjava/ui/core/generators/RadioBoxGenerator.java +++ b/src/main/java/io/asfjava/ui/core/generators/RadioBoxGenerator.java @@ -20,6 +20,7 @@ public void generate(ObjectNode fieldFormDefinition, Field field) { fieldFormDefinition.put("key", field.getName()); fieldFormDefinition.put("readOnly", annotation.readOnly()); fieldFormDefinition.put("type", "radios"); + fieldFormDefinition.put("required", annotation.required()); JsonNode radioFieldFormDefinition = fieldFormDefinition; diff --git a/src/main/java/io/asfjava/ui/core/generators/TextAreaGenerator.java b/src/main/java/io/asfjava/ui/core/generators/TextAreaGenerator.java index c697c73..8e23ad4 100644 --- a/src/main/java/io/asfjava/ui/core/generators/TextAreaGenerator.java +++ b/src/main/java/io/asfjava/ui/core/generators/TextAreaGenerator.java @@ -13,6 +13,7 @@ public void generate(ObjectNode fieldFormDefinition, Field field) { TextArea annotation = field.getAnnotation(TextArea.class); fieldFormDefinition.put("key", field.getName()); fieldFormDefinition.put("type", "textarea"); + fieldFormDefinition.put("required", annotation.required()); String fieldAddonLeft = annotation.fieldAddonLeft(); if (!fieldAddonLeft.isEmpty()) { diff --git a/src/main/java/io/asfjava/ui/core/generators/TextFieldGenerator.java b/src/main/java/io/asfjava/ui/core/generators/TextFieldGenerator.java index 92c35f2..58c1fa1 100644 --- a/src/main/java/io/asfjava/ui/core/generators/TextFieldGenerator.java +++ b/src/main/java/io/asfjava/ui/core/generators/TextFieldGenerator.java @@ -13,6 +13,8 @@ public void generate(ObjectNode fieldFormDefinition, Field field) { TextField annotation = field.getAnnotation(TextField.class); fieldFormDefinition.put("key", field.getName()); + fieldFormDefinition.put("required", annotation.required()); + String description = annotation.description(); if (!description.isEmpty()) { fieldFormDefinition.put("description", description);