1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
/* ------------------------------------ JavaOnTracks Thibaut Colar tcolar-jot AT colar DOT net Artistic Licence 2.0 http://www.javaontracks.net ------------------------------------ */ package net.jot.web.forms.ui; import net.jot.web.forms.JOTFormConst; /** * Generic form field, use subclasses instead such as JOTFormTextField * * Note: clonable, watch if adding mutable fields later @author thibautc */ public abstract class JOTFormField implements Cloneable { protected String name = ""; protected String description = ""; protected int type = JOTFormConst.UNDEFINED; protected String defaultValue = ""; /** * If set to false, the save() method will NOT save this field * Use to have a form field that you don't want to save (or not as part of the save() method at least) */ protected boolean saveAutomatically = true; /** * set this String to some (html format)text to be chown when help about this formElement is requested. * If not null, a "help" icon will show next to the field (for generated forms), which when clicked shows the help text. */ private String help = null; public String getHelp() { return help; } public void setHelp(String help) { this.help = help; } public String getDefaultValue() { return defaultValue; } /** The form value if non exists yet @param defaultValue */ public void setDefaultValue(String defaultValue) { this.defaultValue = defaultValue; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public int getType() { return type; } public void setType(int fieldType) { this.type = fieldType; } public String getName() { return name; } public void setName(String name) { this.name = name; } public boolean isSaveAutomatically() { return saveAutomatically; } /** If false, then that particular field won't be saved. @param saveAutomatically */ public void setSaveAutomatically(boolean saveAutomatically) { this.saveAutomatically = saveAutomatically; } public Object clone() throws CloneNotSupportedException { return super.clone(); } }