}
public DynamicForm getCustomSettingsForm() {
final DynamicForm form = new DynamicForm();
final DashboardPortlet storedPortlet = portletWindow.getStoredPortlet();
// combobox for number of recently added resources to display on the dashboard
final SelectItem maximumRecentlyAddedComboBox = new SelectItem(RECENTLY_ADDED_SHOW_MAX);
maximumRecentlyAddedComboBox.setTitle(MSG.common_title_show());
maximumRecentlyAddedComboBox.setHint("<nobr><b> " + MSG.view_portlet_recentlyAdded_setting_addedPlatforms()
+ "</b></nobr>");
//spinder 9/3/10: the following is required workaround to disable editability of combobox.
maximumRecentlyAddedComboBox.setType("selection");
//define acceptable values for display amount
String[] acceptableDisplayValues = { "5", "10", "15", "20", "30", unlimitedString };
maximumRecentlyAddedComboBox.setValueMap(acceptableDisplayValues);
//set width of dropdown display region
maximumRecentlyAddedComboBox.setWidth(100);
int configuredValue = populateConfigurationValue(storedPortlet, RECENTLY_ADDED_SHOW_MAX, defaultValue);
String selectedValue = configuredValue == unlimited ? unlimitedString : String.valueOf(configuredValue);
//prepopulate the combobox with the previously stored selection
maximumRecentlyAddedComboBox.setDefaultValue(selectedValue);
// second combobox for timeframe for problem resources search.
final SelectItem maximumTimeRecentlyAddedComboBox = new SelectItem(RECENTLY_ADDED_SHOW_HRS);
maximumTimeRecentlyAddedComboBox.setTitle("Over ");
maximumTimeRecentlyAddedComboBox.setHint("<nobr><b> " + MSG.common_unit_hours() + " </b></nobr>");
//spinder 9/3/10: the following is required workaround to disable editability of combobox.
maximumTimeRecentlyAddedComboBox.setType("selection");
//define acceptable values for display amount
String[] acceptableTimeValues = { "1", "4", "8", "24", "48", unlimitedString };
maximumTimeRecentlyAddedComboBox.setValueMap(acceptableTimeValues);
maximumTimeRecentlyAddedComboBox.setWidth(100);
configuredValue = populateConfigurationValue(storedPortlet, RECENTLY_ADDED_SHOW_HRS, defaultValue);
selectedValue = configuredValue == unlimited ? unlimitedString : String.valueOf(configuredValue);
//prepopulate the combobox with the previously stored selection
maximumTimeRecentlyAddedComboBox.setDefaultValue(selectedValue);
// insert fields
form.setFields(maximumRecentlyAddedComboBox, maximumTimeRecentlyAddedComboBox);
// submit handler
form.addSubmitValuesHandler(new SubmitValuesHandler() {
@Override
public void onSubmitValues(SubmitValuesEvent event) {
String value = (String) form.getValue(RECENTLY_ADDED_SHOW_MAX);
if (value != null) {
// convert display string to stored integer if necessary
value = unlimitedString.equals(value) ? String.valueOf(unlimited) : value;
storedPortlet.getConfiguration().put(new PropertySimple(RECENTLY_ADDED_SHOW_MAX, value));
}
value = (String) form.getValue(RECENTLY_ADDED_SHOW_HRS);
if (value != null) {
// convert display string to stored integer if necessary
value = unlimitedString.equals(value) ? String.valueOf(unlimited) : value;
storedPortlet.getConfiguration().put(new PropertySimple(RECENTLY_ADDED_SHOW_HRS, value));
}
configure(portletWindow, storedPortlet);
redraw();