Map<String, PropertyDefinition> propertyDefinitions = new HashMap<String, PropertyDefinition>();
configDef.setPropertyDefinitions(propertyDefinitions);
int orderIndex = 0;
PropertyDefinitionSimple simplePropDef;
simplePropDef = createStringPropDef1();
addPropertyDefinition(configDef, simplePropDef, orderIndex++);
simplePropDef = createStringPropDef2();
addPropertyDefinition(configDef, simplePropDef, orderIndex++);
simplePropDef = new PropertyDefinitionSimple("LongString", "a Long String simple prop", false,
PropertySimpleType.LONG_STRING);
simplePropDef.setDisplayName(simplePropDef.getName());
addPropertyDefinition(configDef, simplePropDef, orderIndex++);
simplePropDef = new PropertyDefinitionSimple("Password", "a Password simple prop", false,
PropertySimpleType.PASSWORD);
simplePropDef.setDisplayName(simplePropDef.getName());
addPropertyDefinition(configDef, simplePropDef, orderIndex++);
simplePropDef = createBooleanPropDef();
addPropertyDefinition(configDef, simplePropDef, orderIndex++);
simplePropDef = createIntegerPropDef();
addPropertyDefinition(configDef, simplePropDef, orderIndex++);
simplePropDef = createLongPropDef();
addPropertyDefinition(configDef, simplePropDef, orderIndex++);
simplePropDef = new PropertyDefinitionSimple("Float", "a Float simple prop", false, PropertySimpleType.FLOAT);
simplePropDef.setDisplayName(simplePropDef.getName());
addPropertyDefinition(configDef, simplePropDef, orderIndex++);
simplePropDef = new PropertyDefinitionSimple("StringEnum1",
"a String enum prop with <=5 items - should be rendered as radio buttons", false,
PropertySimpleType.STRING);
simplePropDef.setDisplayName(simplePropDef.getName());
defaultConfiguration.put(new PropertySimple("StringEnum1", "NJ"));
ArrayList<PropertyDefinitionEnumeration> propDefEnums = new ArrayList<PropertyDefinitionEnumeration>();
propDefEnums.add(new PropertyDefinitionEnumeration("NY", "NY"));
propDefEnums.add(new PropertyDefinitionEnumeration("NJ", "NJ"));
propDefEnums.add(new PropertyDefinitionEnumeration("PA", "PA"));
simplePropDef.setEnumeratedValues(propDefEnums, false);
addPropertyDefinition(configDef, simplePropDef, orderIndex++);
simplePropDef = new PropertyDefinitionSimple("StringEnum2",
"a String enum prop with >5 items - should be rendered as a popup menu", false, PropertySimpleType.STRING);
simplePropDef.setDisplayName(simplePropDef.getName());
defaultConfiguration.put(new PropertySimple("StringEnum2", "blue"));
propDefEnums = new ArrayList<PropertyDefinitionEnumeration>();
propDefEnums.add(new PropertyDefinitionEnumeration("red", "red"));
propDefEnums.add(new PropertyDefinitionEnumeration("orange", "orange"));
propDefEnums.add(new PropertyDefinitionEnumeration("yellow", "yellow"));
propDefEnums.add(new PropertyDefinitionEnumeration("green", "green"));
propDefEnums.add(new PropertyDefinitionEnumeration("blue", "blue"));
propDefEnums.add(new PropertyDefinitionEnumeration("purple", "purple"));
simplePropDef.setEnumeratedValues(propDefEnums, false);
addPropertyDefinition(configDef, simplePropDef, orderIndex++);
PropertyDefinitionMap mapPropDef = new PropertyDefinitionMap("MapOfSimples", "a map of simples", false);
mapPropDef.put(createStringPropDef1());
mapPropDef.put(createStringPropDef2());
mapPropDef.put(createBooleanPropDef());
mapPropDef.put(createIntegerPropDef());
mapPropDef.setDisplayName(mapPropDef.getName());
addPropertyDefinition(configDef, mapPropDef, orderIndex++);
PropertyDefinitionMap openMapPropDef = new PropertyDefinitionMap("OpenMapOfSimples", "an open map of simples",
false);
openMapPropDef.setDisplayName(openMapPropDef.getName());
addPropertyDefinition(configDef, openMapPropDef, orderIndex++);
PropertyDefinitionMap readOnlyOpenMapPropDef = new PropertyDefinitionMap("ReadOnlyOpenMapOfSimples",
"a read-only open map of simples", false);
readOnlyOpenMapPropDef.setDisplayName(readOnlyOpenMapPropDef.getName());
readOnlyOpenMapPropDef.setReadOnly(true);
addPropertyDefinition(configDef, readOnlyOpenMapPropDef, orderIndex++);
PropertyDefinitionList listOfSimplesPropDef = new PropertyDefinitionList("ListOfSimples",
"a list of Integer simples", true, new PropertyDefinitionSimple("integer", "an integer", false,
PropertySimpleType.INTEGER));
listOfSimplesPropDef.setDisplayName(listOfSimplesPropDef.getName());
listOfSimplesPropDef.setMax(listOfSimplesPropDef.getMax());
listOfSimplesPropDef.setMin(listOfSimplesPropDef.getMin());
addPropertyDefinition(configDef, listOfSimplesPropDef, orderIndex++);
PropertyDefinitionMap mapInListPropDef =
new PropertyDefinitionMap("MapOfSimplesInList", "a map of simples in a list", false);
mapInListPropDef.put(createStringPropDef1());
mapInListPropDef.put(createStringPropDef2());
mapInListPropDef.put(createBooleanPropDef());
mapInListPropDef.put(createIntegerPropDef());
mapInListPropDef.setDisplayName(mapInListPropDef.getName());
PropertyDefinitionList listPropDef = new PropertyDefinitionList("ListOfMaps", "a list of maps", true,
mapInListPropDef);
listPropDef.setDisplayName(listPropDef.getName());
addPropertyDefinition(configDef, listPropDef, orderIndex++);
PropertyDefinitionMap mapInReadOnlyListPropDef =
new PropertyDefinitionMap("MapOfSimplesInReadOnlyList", "a map of simples in a list", false);
PropertyDefinitionSimple propDef = createStringPropDef1();
propDef.setReadOnly(true);
mapInReadOnlyListPropDef.put(propDef);
propDef = createStringPropDef2();
propDef.setReadOnly(true);
mapInReadOnlyListPropDef.put(propDef);
propDef = createBooleanPropDef();
propDef.setReadOnly(true);
mapInReadOnlyListPropDef.put(propDef);
propDef = createIntegerPropDef();
propDef.setReadOnly(true);
mapInReadOnlyListPropDef.put(propDef);
mapInReadOnlyListPropDef.setDisplayName(mapInReadOnlyListPropDef.getName());
PropertyDefinitionList readOnlyListPropDef = new PropertyDefinitionList("ReadOnlyListOfMaps",
"a read-only list of maps", true, mapInReadOnlyListPropDef);
readOnlyListPropDef.setDisplayName(readOnlyListPropDef.getName());
readOnlyListPropDef.setReadOnly(true);
addPropertyDefinition(configDef, readOnlyListPropDef, orderIndex++);
PropertyGroupDefinition propertyGroupDefinition = new PropertyGroupDefinition("myGroup");
propertyGroupDefinition.setDisplayName(propertyGroupDefinition.getName());
propertyGroupDefinition.setDescription("this is an example group");
PropertyDefinitionSimple myString = new PropertyDefinitionSimple("myString1", "my little string", true,
PropertySimpleType.STRING);
myString.setDisplayName(myString.getName());
myString.setSummary(true);
addPropertyDefinition(configDef, myString, orderIndex++);
myString.setPropertyGroupDefinition(propertyGroupDefinition);
PropertyDefinitionSimple myString2 = new PropertyDefinitionSimple("myString2", "my other little string", true,
PropertySimpleType.STRING);
myString2.setDisplayName(myString2.getName());
myString2.setSummary(true);
addPropertyDefinition(configDef, myString2, orderIndex++);
myString2.setPropertyGroupDefinition(propertyGroupDefinition);
PropertyGroupDefinition propertyGroupDefinition2 = new PropertyGroupDefinition("myGroup2");
propertyGroupDefinition2.setDisplayName(propertyGroupDefinition2.getName());
propertyGroupDefinition2.setDescription("this is another example group");
PropertyDefinitionSimple myString3 = new PropertyDefinitionSimple("myString3", "my third string", true,
PropertySimpleType.STRING);
myString3.setDisplayName((myString3.getName()));
myString3.setSummary(true);
addPropertyDefinition(configDef, myString3, orderIndex++);
myString3.setPropertyGroupDefinition(propertyGroupDefinition2);
PropertyDefinitionSimple enumExample = new PropertyDefinitionSimple("myEnum",
"a grouped enum prop with <=5 items", false, PropertySimpleType.STRING);
enumExample.setDisplayName(enumExample.getName());
defaultConfiguration.put(new PropertySimple("myEnum", "Burlington"));
ArrayList<PropertyDefinitionEnumeration> myEnums = new ArrayList<PropertyDefinitionEnumeration>();
myEnums.add(new PropertyDefinitionEnumeration("Burlington", "Burlington"));
myEnums.add(new PropertyDefinitionEnumeration("Camden", "Camden"));
myEnums.add(new PropertyDefinitionEnumeration("Gloucester", "Gloucester"));
enumExample.setEnumeratedValues(myEnums, false);
addPropertyDefinition(configDef, enumExample, orderIndex++);
enumExample.setPropertyGroupDefinition(propertyGroupDefinition2);
return configDef;
}