use of com.github.bordertech.wcomponents.TestLookupTable in project wcomponents by BorderTech.
the class TestApp method createRow.
/**
* Creates a search result row.
*
* @param rowIndex the row index.
* @param name the row name.
* @param detailsSize the description text size.
* @return a search result BO with the given attributes.
*/
public SearchResultRowBO createRow(final int rowIndex, final String name, final String detailsSize) {
SearchResultRowBO row = new SearchResultRowBO();
row.setName(name + " " + (rowIndex + 1));
int n;
List dayOfWeekList = new TestLookupTable().getTable(TestLookupTable.DAY_OF_WEEK_TABLE);
n = RAND.nextInt(dayOfWeekList.size());
row.setCountry((TestLookupTable.TableEntry) dayOfWeekList.get(n));
row.setTicked(Boolean.valueOf(RAND.nextBoolean()));
row.setHappy(Boolean.valueOf(RAND.nextBoolean()));
List<String> animals = new ArrayList<>();
for (int i = RAND.nextInt(4); i > 0; --i) {
n = RAND.nextInt(SearchResultRowBO.ANIMAL_OPTIONS.length);
String animal = SearchResultRowBO.ANIMAL_OPTIONS[n];
if (!animals.contains(animal)) {
animals.add(animal);
}
}
row.setAnimals(animals);
if (SearchCriteriaPage.SMALL.equals(detailsSize)) {
row.setDesc("Small");
} else if (SearchCriteriaPage.MEDIUM.equals(detailsSize)) {
row.setDesc("Medium blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah.");
} else if (SearchCriteriaPage.LARGE.equals(detailsSize)) {
row.setDesc("Large blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah." + " More blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah." + " More blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah.");
} else if (SearchCriteriaPage.HUGE.equals(detailsSize)) {
row.setDesc("Huge blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah." + " More blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah." + " More blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah." + " More blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah." + " More blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah." + " More blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah.");
} else {
row.setDesc("Blah blah blah...");
}
return row;
}
Aggregations