1 | package de.dass_it.vanhelsing.gui;
|
---|
2 |
|
---|
3 | import java.util.*;
|
---|
4 |
|
---|
5 | import de.dass_it.vanhelsing.gui.ValidationItem.*;
|
---|
6 |
|
---|
7 |
|
---|
8 |
|
---|
9 | public class Validation {
|
---|
10 | private HashMap<String, ValidationItem> properties;
|
---|
11 |
|
---|
12 | public Validation(){
|
---|
13 | buildValidation();
|
---|
14 | }
|
---|
15 |
|
---|
16 | public String getRenderer(String s){
|
---|
17 | return properties.get(s).getRenderer();
|
---|
18 | }
|
---|
19 |
|
---|
20 | public String getDataType(String s){
|
---|
21 | return properties.get(s).getDataType();
|
---|
22 | }
|
---|
23 |
|
---|
24 | public boolean getNecessary(String s){
|
---|
25 | return properties.get(s).getNecessary();
|
---|
26 | }
|
---|
27 |
|
---|
28 | public void buildValidation(){
|
---|
29 | String type2 = "de.dass_it.vanhelsing.gui.items.ClientItem";
|
---|
30 | //Name, Typ, ?Referenz, ?Muss/Default, ?Defaultwert
|
---|
31 |
|
---|
32 | /*name, store_name, 0, ITEM_REQUIRED, 0},
|
---|
33 | adress, store_str, 0, ITEM_REQUIRED, 0},
|
---|
34 | fdport, store_pint32, 0, ITEM_DEFAULT, 9102},
|
---|
35 | password, store_password, 0, ITEM_REQUIRED, 0},
|
---|
36 | catalog, store_res, R_CATALOG, ITEM_REQUIRED, 0}, */
|
---|
37 | ValidationItem vi = new ValidationItem();
|
---|
38 | properties = new HashMap<String, ValidationItem>();
|
---|
39 | //name
|
---|
40 | vi.setDataType("string");
|
---|
41 | vi.setNecessary(true);
|
---|
42 | vi.setRenderer("inputText");
|
---|
43 | properties.put(type2+":"+"name", vi);
|
---|
44 | //adress
|
---|
45 | vi = new ValidationItem();
|
---|
46 | vi.setDataType("string");
|
---|
47 | vi.setNecessary(true);
|
---|
48 | vi.setRenderer("inputText");
|
---|
49 | properties.put(type2+":"+"adress", vi);
|
---|
50 | //fdport
|
---|
51 | vi = new ValidationItem();
|
---|
52 | vi.setDataType("int");
|
---|
53 | vi.setNecessary(true);
|
---|
54 | vi.setRenderer("inputText");
|
---|
55 | vi.setDefaultValue("9102");
|
---|
56 | properties.put(type2+":"+"fdport", vi);
|
---|
57 | //password
|
---|
58 | vi = new ValidationItem();
|
---|
59 | vi.setDataType("string");
|
---|
60 | vi.setNecessary(true);
|
---|
61 | vi.setRenderer("inputText");
|
---|
62 | properties.put(type2+":"+"password", vi);
|
---|
63 | //catalog
|
---|
64 | vi = new ValidationItem();
|
---|
65 | vi.setDataType("string");
|
---|
66 | vi.setNecessary(true);
|
---|
67 | vi.setRenderer("selectOneMenu");
|
---|
68 | properties.put(type2+":"+"catalog", vi);
|
---|
69 | }
|
---|
70 | }
|
---|