public DynamicForm getCustomSettingsForm() {
final DashboardPortlet storedPortlet = this.portletWindow.getStoredPortlet();
final Configuration portletConfig = storedPortlet.getConfiguration();
DynamicForm customSettings = new DynamicForm();
EnhancedVLayout page = new EnhancedVLayout();
//build editor form container
final DynamicForm form = new DynamicForm();
form.setMargin(5);
//add label about what configuration affects? redundant?
//add filter operation status type selector
final SelectItem operationStatusSelector = PortletConfigurationEditorComponent
.getOperationStatusEditor(portletConfig);
// //add sort priority selector
// final SelectItem resultSortSelector = PortletConfigurationEditorComponent
// .getResulSortOrderEditor(portletConfig);
//add result count selector
final SelectItem resultCountSelector = PortletConfigurationEditorComponent.getResultCountEditor(portletConfig);
//add range selector
final CustomConfigMeasurementRangeEditor measurementRangeEditor = PortletConfigurationEditorComponent
.getMeasurementRangeEditor(portletConfig);
form.setItems(operationStatusSelector, resultCountSelector);
//submit handler
customSettings.addSubmitValuesHandler(new SubmitValuesHandler() {
@Override
public void onSubmitValues(SubmitValuesEvent event) {
//result count
Configuration updatedConfig = AbstractActivityView.saveResultCounterSettings(resultCountSelector,
portletConfig);
//time range configuration
updatedConfig = AbstractActivityView.saveMeasurementRangeEditorSettings(measurementRangeEditor,
portletConfig);
//operation priority
updatedConfig = AbstractActivityView.saveOperationStatusSelectorSettings(operationStatusSelector,
portletConfig);
//persist and reload portlet
storedPortlet.setConfiguration(updatedConfig);
configure(portletWindow, storedPortlet);
//resynch the config object in the datasource
((GroupOperationsCriteriaDataSource) groupOperations.getDataSource()).setPortletConfig(updatedConfig);
//apply latest settings to the visible result set
refresh();
}
});
form.markForRedraw();
page.addMember(measurementRangeEditor);
page.addMember(form);
customSettings.addChild(page);
return customSettings;
}