instance.setOptionSelected("four");
instance.setOptionSelected("five");
// composite two text fields
Composite composite = list.addItem().addComposite("compositeA");
composite.setLabel("Composite (two text fields)");
composite.enableAddOperation();
composite.enableDeleteOperation();
if (help)
{
composite.setHelp("This field is composed of two text fields, fill them both in.");
}
if (error)
{
composite.addError("Just the composite is in error.");
}
text = composite.addText("firstA");
if (help)
{
text.setHelp("This is helpful text.");
}
text.addInstance().setValue("1, Raw A");
text.addInstance().setValue("2, Raw A");
text.addInstance().setValue("3, Raw A");
text = composite.addText("secondA");
if (help)
{
text.setHelp("This is helpful text.");
}
text.addInstance().setValue("1, Raw B");
text.addInstance().setValue("2, Raw B");
text.addInstance().setValue("3, Raw B");
// composite select & text fields
composite = list.addItem().addComposite("compositeB");
composite.setLabel("Composite (select & text fields)");
composite.enableAddOperation();
composite.enableDeleteOperation();
if (help)
{
composite.setHelp("This field is composed of a select and text field, select one and type the other.");
}
select = composite.addSelect("selectB");
if (help)
{
select.setHelp("Me, me, me..... select me!");
}
if (error)
{
select.addError("The composite elements are in error.");
}
select.addOption("one","uno");
select.addOption("two","dos");
select.addOption("three","tres");
select.addOption("four","cuatro");
select.addOption("five","cinco");
select.setOptionSelected("one");
select.addInstance().addOptionValue("one");
select.addInstance().addOptionValue("two");
select.addInstance().addOptionValue("three");
text = composite.addText("TextB");
if (help)
{
text.setHelp("Yay, yet another text field");
}
if (error)
{
text.addError("The composite elements are in error.");
}
text.addInstance().setValue("1, Raw B");
text.addInstance().setValue("2, Raw B");
text.addInstance().setValue("3, Raw B");
composite.addInstance().setInterpretedValue("One interpreted.");
composite.addInstance().setInterpretedValue("Two interpreted.");
composite.addInstance().setInterpretedValue("Three interpreted.");
// Composite (date)
composite = list.addItem().addComposite("composite-date");
composite.setLabel("Composite (date)");
composite.enableAddOperation();
composite.enableDeleteOperation();
if (help)
{
composite.setHelp("The date when something happened.");
}
if (error)
{
composite.setHelp("The composite is in error.");
}
text = composite.addText("day");
if (help)
{
text.setHelp("day");
}
if (error)
{
text.setHelp("The first text field is in error.");
}
text.setSize(4,2);
text.addInstance().setValue("1");
text.addInstance().setValue("2");
text.addInstance().setValue("3");
text.addInstance().setValue("4");
text.addInstance().setValue("5");
select = composite.addSelect("month");
if (error)
{
select.setHelp("The select box is in error.");
}
select.addOption("","(Select Month)");
select.addOption(1,"January");
select.addOption(2,"Feburary");
select.addOption(3,"March");
select.addOption(4,"April");
select.addOption(5,"May");
select.addOption(6,"June");
select.addOption(7,"July");
select.addOption(8,"August");
select.addOption(9,"September");
select.addOption(10,"August");
select.addOption(11,"October");
select.addOption(12,"November");
select.addOption(13,"December");
select.addInstance().setOptionSelected(1);
select.addInstance().setOptionSelected(2);
select.addInstance().setOptionSelected(3);
select.addInstance().setOptionSelected(4);
select.addInstance().setOptionSelected(5);
text = composite.addText("year");
text.setSize(4,4);
if (help)
{
text.setHelp("year");
}