use of com.manydesigns.elements.options.DefaultSelectionProvider in project Portofino by ManyDesigns.
the class SelectFieldTest method setUp.
@Override
@BeforeMethod
public void setUp() throws Exception {
super.setUp();
myText = null;
selectionProvider = new DefaultSelectionProvider("selectionProvider");
for (int i = 0; i < valuesArray.length; i++) {
selectionProvider.appendRow(valuesArray[i], labelsArray[i], true);
}
selectionModel = selectionProvider.createSelectionModel();
selectionProvider2 = new DefaultSelectionProvider("selectionProvider");
for (int i = 0; i < valuesArray2.length; i++) {
selectionProvider2.appendRow(valuesArray2[i], labelsArray2[i], true);
}
selectionModel2 = selectionProvider2.createSelectionModel();
selectionProvider3 = new DefaultSelectionProvider("selectionProvider");
selectionProvider3.appendRow("value1", "label1", true);
selectionProvider3.appendRow("value2", "label2", false);
selectionModel3 = selectionProvider3.createSelectionModel();
}
use of com.manydesigns.elements.options.DefaultSelectionProvider in project Portofino by ManyDesigns.
the class SelectFieldTest3 method setUp.
@Override
@BeforeMethod
public void setUp() throws Exception {
super.setUp();
selectionProvider = new DefaultSelectionProvider("selectionProvider");
for (int i = 0; i < valuesArray.length; i++) {
selectionProvider.appendRow(valuesArray[i], labelsArray[i], true);
}
selectionModel = selectionProvider.createSelectionModel();
}
use of com.manydesigns.elements.options.DefaultSelectionProvider in project Portofino by ManyDesigns.
the class SelectionProviderLogic method createSelectionProvider.
public static DefaultSelectionProvider createSelectionProvider(String name, Collection objects, PropertyAccessor[] propertyAccessors, @Nullable TextFormat[] textFormats) {
DefaultSelectionProvider selectionProvider = new DefaultSelectionProvider(name, propertyAccessors.length);
for (Object current : objects) {
OptionProvider.Option option = getOption(name, propertyAccessors, textFormats, current);
selectionProvider.appendOption(option);
}
return selectionProvider;
}
use of com.manydesigns.elements.options.DefaultSelectionProvider in project Portofino by ManyDesigns.
the class SelectionProviderLogic method createSelectionProvider.
public static DefaultSelectionProvider createSelectionProvider(String name, Class[] fieldTypes, Collection<Object[]> objects) {
DefaultSelectionProvider selectionProvider = new DefaultSelectionProvider(name, fieldTypes.length);
for (Object[] valueAndLabel : objects) {
OptionProvider.Option option = getOption(fieldTypes, valueAndLabel);
selectionProvider.appendOption(option);
}
return selectionProvider;
}
use of com.manydesigns.elements.options.DefaultSelectionProvider in project Portofino by ManyDesigns.
the class SelectField method createValuesSelectionProvider.
public SelectionProvider createValuesSelectionProvider(PropertyAccessor accessor, Object[] values, String[] labels) {
DefaultSelectionProvider selectionProvider = new DefaultSelectionProvider(accessor.getName(), 1);
for (int i = 0; i < values.length; i++) {
Object convertedValue = OgnlUtils.convertValue(values[i], accessor.getType());
selectionProvider.appendRow(convertedValue, getText(labels[i]), true);
}
return selectionProvider;
}
Aggregations