*/
static class FieldProvider implements IFieldGroupProvider {
@Override
public FieldGroup getFieldGroup() {
final FieldGroup group = new FieldGroup("Test Fields");
final Map<String, String> data = new LinkedHashMap<String, String>();
data.put("valueA", "Key1");
data.put("valueB", "Key2");
data.put("valueC", "Key3");
data.put("valueD", "Key4");
data.put("valueE", "Key5");
data.put("valueF", "Key6");
data.put("valueG", "Key7");
data.put("valueH", "Key8");
data.put("valueI", "Key9");
data.put("valueJ", "Key10");
IFieldWidget<String> sfw;
IFieldWidget<Boolean> bfw;
IFieldWidget<Date> dfw;
IFieldWidget<TestEnum> efw;
IFieldWidget<Collection<String>> cfw;
sfw = FieldFactory.ftext("ftext", "ftext", "TextField", "TextField", 8);
sfw.setValue("ival");
sfw.setRequired(true);
group.addField(sfw);
sfw = FieldFactory.ftextarea("ftextarea", "ftextarea", "Textarea", "Textarea", 5, 10);
sfw.setValue("ival");
sfw.setRequired(true);
group.addField(sfw);
sfw = FieldFactory.fpassword("fpassword", "fpassword", "Password", "Password", 8);
sfw.setValue("ival");
sfw.setRequired(true);
group.addField(sfw);
dfw = FieldFactory.fdate("fdate", "fdate", "DateField", "DateField", GlobalFormat.DATE);
dfw.setValue(new Date());
dfw.setRequired(true);
group.addField(dfw);
bfw = FieldFactory.fcheckbox("fcheckbox", "fcheckbox", "Checkbox", "Checkbox");
bfw.setValue(Boolean.TRUE);
bfw.setRequired(true);
group.addField(bfw);
sfw = FieldFactory.fselect("fselect", "fselect", "Select", "Select", data);
sfw.setValue("valueC");
sfw.setRequired(true);
group.addField(sfw);
cfw = FieldFactory.fmultiselect("fmultiselect", "fmultiselect", "Multi-select", "Multi-select", data);
final ArrayList<String> ival = new ArrayList<String>();
ival.add("valueA");
ival.add("valueE");
ival.add("valueJ");
cfw.setValue(ival);
cfw.setRequired(true);
group.addField(cfw);
sfw =
FieldFactory.fradiogroup("fradiogroup", "fradiogroup", "Radio Group", "Radio Group", data, new GridRenderer(
3, GridStyles.GRID));
sfw.setValue("valueB");
sfw.setRequired(true);
group.addField(sfw);
sfw = FieldFactory.fsuggest("fsuggest", "fsuggest", "Suggest", "Suggest", data);
sfw.setValue("valueB");
sfw.setRequired(true);
group.addField(sfw);
efw =
FieldFactory.fenumradio("fenumradio", "fenumradio", "Enum Radio", "Enum Radio", TestEnum.class,
new GridRenderer(3, GridStyles.GRID));
efw.setValue(TestEnum.ENUM_7);
efw.setRequired(true);
group.addField(efw);
return group;
}