Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c6c3850

Browse files
📝 add demo to password field, number field and textarea docs
1 parent 8728826 commit c6c3850

File tree

6 files changed

+139
-22
lines changed

6 files changed

+139
-22
lines changed

‎demo/src/main/java/io/asfjava/ui/demo/screen/DemoForm.java

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,29 @@
22

33
import java.io.Serializable;
44

5-
import io.asfjava.ui.core.form.TextField;
5+
import io.asfjava.ui.core.form.TextArea;
66

77
public class DemoForm implements Serializable {
88

9-
@TextField(title = "Full Name", minLenght = 3)
10-
private String fullName;
9+
@TextArea(title = "Comment", description = "Add your Comment here", placeHolder = "fill your comment please")
10+
private String comment;
1111

12-
@TextField(title = "Email", pattern = "^\\S+@\\S+$")
13-
private String mail;
12+
@TextArea(title = "Tweet", placeHolder = "This message will be tweeted", maxLenght = 140, validationMessage = Messages.TWEET_VALIDATION)
13+
private String tweet;
1414

15-
@TextField(title = "Repository", fieldAddonLeft = "https://github.com/")
16-
private String githubRepository;
15+
@TextArea(title = "Fill a message", minLenght = 50)
16+
private String message;
1717

18-
@TextField(title = "Github user name", fieldAddonRight = "@Github.com")
19-
private String githubUserName;
20-
21-
public String getMail() {
22-
return mail;
23-
}
24-
25-
public String getFullName() {
26-
return fullName;
18+
public String getComment() {
19+
return comment;
2720
}
2821

29-
public String getGithubRepository() {
30-
return githubRepository;
22+
public String getTweet() {
23+
return tweet;
3124
}
3225

33-
public String getGithubUserName() {
34-
return githubUserName;
26+
public String getMessage() {
27+
return message;
3528
}
3629

3730
private static final long serialVersionUID = -5073515619469444978L;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package io.asfjava.ui.demo.screen;
2+
3+
public final class Messages {
4+
static final String TWEET_VALIDATION = "Twitter limits Tweet length to 140 characters making the definition of a "character" and how they are counted central to any Twitter application";
5+
6+
private Messages() {
7+
}
8+
}

‎docs/images/numberField.png

39.7 KB
Loading[フレーム]

‎docs/images/passwordField.png

18.4 KB
Loading[フレーム]

‎docs/images/textArea.png

54.6 KB
Loading[フレーム]

‎docs/index.md

Lines changed: 118 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ To render a field as a TextField the developer must add the [@TextField](../src/
2424
| fieldAddonLeft | String | [Extend form controls](http://getbootstrap.com/components/#input-groups) by adding text on the left side of the Text Field |
2525
| fieldAddonRight | String | [Extend form controls](http://getbootstrap.com/components/#input-groups) by adding text on the right side of the Text Field |
2626

27-
The code below is an example using the TextField annotation. Feel free to try this code snipet:
27+
The code below is an example using the TextField annotation. Feel free to try this code snippet:
2828

2929
```Java
3030
import java.io.Serializable;
@@ -64,8 +64,9 @@ public class DemoForm implements Serializable {
6464

6565
```
6666

67+
1- Demo TextField
68+
6769
![Demo TextField](images/textField.png)
68-
<center>*1- Demo TextField*</center>
6970

7071

7172

@@ -84,6 +85,54 @@ The given component can be used to fill numeric values, it can be applied to fie
8485
| fieldAddonLeft | String | [Extend form controls](http://getbootstrap.com/components/#input-groups) by adding text on the left side of the Number Field |
8586
| fieldAddonRight | String | [Extend form controls](http://getbootstrap.com/components/#input-groups) by adding text on the right side of the Number Field |
8687

88+
The code below is an example using the Number annotation. Feel free to try this code snippet:
89+
90+
91+
```Java
92+
import java.io.Serializable;
93+
94+
import io.asfjava.ui.core.form.Number;
95+
96+
public class DemoForm implements Serializable {
97+
98+
@Number(title = "Average", description = "This a double")
99+
private Double average;
100+
101+
@Number(title = "Rating", placeHolder = "Rate me")
102+
private short rating;
103+
104+
@Number(title = "USA Phone Number", fieldAddonLeft = "+1")
105+
private Long phone;
106+
107+
@Number(title = "Amount", fieldAddonRight = "$")
108+
private Double amount;
109+
110+
public Double getAverage() {
111+
return average;
112+
}
113+
114+
public short getRating() {
115+
return rating;
116+
}
117+
118+
public Long getPhone() {
119+
return phone;
120+
}
121+
122+
public Double getAmount() {
123+
return amount;
124+
}
125+
126+
}
127+
128+
129+
```
130+
131+
2- Demo NumberField
132+
133+
![Demo NumberField](images/numberField.png)
134+
135+
87136
### PasswordField:
88137

89138
For some use cases, the developer need to use a encrypted UI input field to fill the user value. So he can use [@Password](../src/main/java/io/asfjava/ui/core/form/Password.java).
@@ -102,6 +151,32 @@ For some use cases, the developer need to use a encrypted UI input field to fill
102151
| fieldAddonLeft | String | [Extend form controls](http://getbootstrap.com/components/#input-groups) by adding text on the left side of the Password Field |
103152
| fieldAddonRight | String | [Extend form controls](http://getbootstrap.com/components/#input-groups) by adding text on the right side of the Password Field |
104153

154+
The code below is an example using the Password annotation. Feel free to try this code snippet:
155+
156+
```Java
157+
158+
import java.io.Serializable;
159+
160+
import io.asfjava.ui.core.form.Password;
161+
162+
public class DemoForm implements Serializable {
163+
164+
@Password(title = "Password", description = "Fill your password")
165+
private String password;
166+
167+
public String getPassword() {
168+
return password;
169+
}
170+
171+
}
172+
173+
```
174+
175+
3- Demo PasswordField
176+
177+
![Demo PasswordField](images/passwordField.png)
178+
179+
105180
### TextArea
106181

107182
The TextArea component is a multiline text field with a border and optional scroll bars. To use a this component the developer must use [@TextArea](../src/main/java/io/asfjava/ui/core/form/TextArea.java)
@@ -118,3 +193,44 @@ The TextArea component is a multiline text field with a border and optional scro
118193
| noTitle | Boolean | Set to true to hide title |
119194
| fieldAddonLeft | String | [Extend form controls](http://getbootstrap.com/components/#input-groups) by adding text on the left side of the Text Area |
120195
| fieldAddonRight | String | [Extend form controls](http://getbootstrap.com/components/#input-groups) by adding text on the right side of the Text Area |
196+
197+
The code below is an example using the TextArea annotation. Feel free to try this code snippet:
198+
199+
```Java
200+
201+
import java.io.Serializable;
202+
203+
import io.asfjava.ui.core.form.TextArea;
204+
205+
public class DemoForm implements Serializable {
206+
207+
@TextArea(title = "Comment", description = "Add your Comment here", placeHolder = "fill your comment please")
208+
private String comment;
209+
210+
@TextArea(title = "Tweet", placeHolder = "This message will be tweeted", maxLenght = 140, validationMessage = Messages.TWEET_VALIDATION)
211+
private String tweet;
212+
213+
@TextArea(title = "Fill a message", minLenght = 50)
214+
private String message;
215+
216+
public String getComment() {
217+
return comment;
218+
}
219+
220+
public String getTweet() {
221+
return tweet;
222+
}
223+
224+
public String getMessage() {
225+
return message;
226+
}
227+
228+
private static final long serialVersionUID = -5073515619469444978L;
229+
}
230+
231+
```
232+
233+
4- Demo TextArea
234+
235+
![Demo TextArea](images/textArea.png)
236+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /