Skip to content

Commit e542645

Browse files
committed
add new @index annotation
handle fields order fix #51
1 parent a58cb8a commit e542645

File tree

2 files changed

+115
-100
lines changed

2 files changed

+115
-100
lines changed

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

Lines changed: 101 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -2,93 +2,91 @@
22

33
import java.io.Serializable;
44

5-
import io.asfjava.ui.core.form.CheckBox;
6-
import io.asfjava.ui.core.form.ComboBox;
7-
import io.asfjava.ui.core.form.Number;
5+
import io.asfjava.ui.core.form.Index;
86
import io.asfjava.ui.core.form.Password;
9-
import io.asfjava.ui.core.form.RadioBox;
10-
import io.asfjava.ui.core.form.Tab;
11-
import io.asfjava.ui.core.form.TextArea;
127
import io.asfjava.ui.core.form.TextField;
138

149
public class DemoForm implements Serializable {
1510

16-
17-
@TextField(title = "Pesonal Website",fieldAddonLeft="http://", description = "This is TextField with fieldAddonLeft")
11+
@Index(3)
12+
@TextField(title = "Personal Website")
1813
private String webSite;
19-
20-
@TextField(title = "Your Github Mail",fieldAddonRight="@github.com", description = "This is TextField with fieldAddonRight")
14+
15+
@Index(2)
16+
@TextField(title = "Your Github Mail")
2117
private String gitHub;
22-
23-
// @Tab(title = "Contact", index = 2)
24-
@Password(title = "Password", placeHolder = "Please set you password", description = "This is password")
18+
19+
@Index(4)
20+
@Password(title = "Password")
2521
private String password;
2622

27-
@Tab(title = "Info", index = 1)
28-
@TextField(title = "First Name", placeHolder = "Your first name", description = "This is a description for your first name field")
23+
@Index(0)
24+
@TextField(title = "First Name")
2925
private String firstName;
3026

31-
// @Tab(title = "Info", index = 1)
32-
@TextField(title = "Last Name", placeHolder = "Your last name")
33-
private String lastName;
34-
35-
@Tab(title = "Contact", index = 2)
36-
@TextField(title = "eMail", placeHolder = "Your email", pattern = "^\\S+@\\S+$", validationMessage = "Your mail must be in this format [email protected]", description = "This is Text Field with pattern and validation message")
37-
private String email;
38-
39-
@Tab(title = "Additional Info", index = 3)
40-
@Number(title = "Number of children", placeHolder = "Number of children", description = "This is a number")
41-
private Integer number;
42-
43-
44-
@Tab(title = "Info", index = 1)
45-
@ComboBox(title = "Gender", titleMap = GenderTitleMap.class)
46-
private String gender;
47-
48-
// @Tab(title = "Additional Info", index = 3)
49-
@ComboBox(title = "Currency", values = { "euro", "dollar" })
50-
private String currency;
51-
52-
@Tab(title = "Additional Info", index = 3)
53-
@RadioBox(title = "Civil State", titleMap = CivilStateTitelsMap.class)
54-
private String civilState;
55-
56-
// @Tab(title = "Contact", index = 2)
57-
@TextArea(title = "Address", placeHolder = "Fill your address please", description = "This is textarea")
58-
private String address;
59-
60-
@Tab(title = "Additional Info", index = 3)
61-
@CheckBox(title = "Color", values = { "red", "bleu", "green" }, defaultvalue = "red")
62-
private String color;
63-
64-
public String getFirstName() {
65-
return firstName;
66-
}
27+
// @Tab(title = "Info", index = 1)
28+
// @TextField(title = "Last Name", placeHolder = "Your last name")
29+
// private String lastName;
30+
//
31+
// @Tab(title = "Contact", index = 2)
32+
// @TextField(title = "eMail", placeHolder = "Your email", pattern =
33+
// "^\\S+@\\S+$", validationMessage = "Your mail must be in this format
34+
// [email protected]", description = "This is Text Field with pattern and
35+
// validation message")
36+
// private String email;
37+
//
38+
// @Tab(title = "Additional Info", index = 3)
39+
// @Number(title = "Number of children", placeHolder = "Number of children",
40+
// description = "This is a number")
41+
// private Integer number;
42+
//
43+
//
44+
// @Tab(title = "Info", index = 1)
45+
// @ComboBox(title = "Gender", titleMap = GenderTitleMap.class)
46+
// private String gender;
47+
//
48+
//// @Tab(title = "Additional Info", index = 3)
49+
// @ComboBox(title = "Currency", values = { "euro", "dollar" })
50+
// private String currency;
51+
//
52+
// @Tab(title = "Additional Info", index = 3)
53+
// @RadioBox(title = "Civil State", titleMap = CivilStateTitelsMap.class)
54+
// private String civilState;
55+
//
56+
//// @Tab(title = "Contact", index = 2)
57+
// @TextArea(title = "Address", placeHolder = "Fill your address please",
58+
// description = "This is textarea")
59+
// private String address;
60+
61+
// @Tab(title = "Additional Info", index = 3)
62+
// @CheckBox(title = "Color", values = { "red", "bleu", "green" },
63+
// defaultvalue = "red")
64+
// private String color;
6765

6866
public void setFirstName(String firstName) {
6967
this.firstName = firstName;
7068
}
7169

72-
public String getLastName() {
73-
return lastName;
74-
}
70+
// public String getLastName() {
71+
// return lastName;
72+
// }
73+
//
74+
// public void setEmail(String eMail) {
75+
// this.email = eMail;
76+
// }
77+
//
78+
// public String getEmail() {
79+
// return email;
80+
// }
7581

76-
public void setEmail(String eMail) {
77-
this.email = eMail;
78-
}
79-
80-
public String getEmail() {
81-
return email;
82-
}
83-
8482
public void setGitHub(String github) {
8583
this.gitHub = github;
8684
}
8785

8886
public String getGitHub() {
8987
return gitHub;
9088
}
91-
89+
9290
public void setWebSite(String website) {
9391
this.webSite = website;
9492
}
@@ -97,17 +95,20 @@ public String getWebSite() {
9795
return webSite;
9896
}
9997

100-
public void setLastName(String lastName) {
101-
this.lastName = lastName;
102-
}
103-
104-
public Integer getNumber() {
105-
return number;
106-
}
107-
108-
public void setNumber(Integer number) {
109-
this.number = number;
98+
public String getFirstName() {
99+
return firstName;
110100
}
101+
// public void setLastName(String lastName) {
102+
// this.lastName = lastName;
103+
// }
104+
//
105+
// public Integer getNumber() {
106+
// return number;
107+
// }
108+
//
109+
// public void setNumber(Integer number) {
110+
// this.number = number;
111+
// }
111112

112113
public String getPassword() {
113114
return password;
@@ -117,33 +118,33 @@ public void setPassword(String password) {
117118
this.password = password;
118119
}
119120

120-
public String getGender() {
121-
return gender;
122-
}
123-
124-
public String getAddress() {
125-
return address;
126-
}
127-
128-
public void setAddress(String address) {
129-
this.address = address;
130-
}
131-
132-
public String getCivilState() {
133-
return civilState;
134-
}
135-
136-
public void setCivilState(String civilState) {
137-
this.civilState = civilState;
138-
}
139-
140-
public String getCurrency() {
141-
return currency;
142-
}
143-
144-
public String getColor() {
145-
return color;
146-
}
121+
// public String getGender() {
122+
// return gender;
123+
// }
124+
//
125+
// public String getAddress() {
126+
// return address;
127+
// }
128+
//
129+
// public void setAddress(String address) {
130+
// this.address = address;
131+
// }
132+
//
133+
// public String getCivilState() {
134+
// return civilState;
135+
// }
136+
//
137+
// public void setCivilState(String civilState) {
138+
// this.civilState = civilState;
139+
// }
140+
//
141+
// public String getCurrency() {
142+
// return currency;
143+
// }
144+
145+
// public String getColor() {
146+
// return color;
147+
// }
147148

148149
private static final long serialVersionUID = -5073515619469444978L;
149150
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package io.asfjava.ui.core.form;
2+
3+
import static java.lang.annotation.ElementType.FIELD;
4+
import static java.lang.annotation.RetentionPolicy.RUNTIME;
5+
6+
import java.lang.annotation.Retention;
7+
import java.lang.annotation.Target;
8+
9+
@Retention(RUNTIME)
10+
@Target(FIELD)
11+
public @interface Index {
12+
13+
int value() default Integer.MAX_VALUE;
14+
}

0 commit comments

Comments
 (0)