pluginManager.getServerPluginConfigurationDefinition(pluginKey, new AsyncCallback<ConfigurationDefinition>() {
public void onSuccess(ConfigurationDefinition def) {
if (def != null) {
EnhancedVLayout layout = new EnhancedVLayout();
ToolStrip buttons = new ToolStrip();
buttons.setWidth100();
buttons.setExtraSpace(10);
buttons.setMembersMargin(5);
buttons.setLayoutMargin(5);
final IButton saveButtonPC = new EnhancedIButton(MSG.common_button_save(), ButtonColor.BLUE);
final IButton resetButtonPC = new EnhancedIButton(MSG.common_button_reset(), ButtonColor.RED);
Configuration config = plugin.getPluginConfiguration();
final ConfigurationEditor editorPC = new ConfigurationEditor(def, config);
editorPC.setOverflow(Overflow.AUTO);
editorPC.addPropertyValueChangeListener(new PropertyValueChangeListener() {
public void propertyValueChanged(PropertyValueChangeEvent event) {
if (event.isInvalidPropertySetChanged()) {
Map<String, String> invalidPropertyNames = event.getInvalidPropertyNames();
if (invalidPropertyNames.isEmpty()) {
saveButtonPC.enable();
} else {
saveButtonPC.disable();
}
}
}
});
resetButtonPC.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
editorPC.reset();
}
});
saveButtonPC.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
if (!editorPC.validate()) {
Message msg = new Message(MSG.view_admin_plugins_serverConfig_badSettings(),
Severity.Warning, EnumSet.of(Message.Option.Transient));
CoreGUI.getMessageCenter().notify(msg);
return;
}
pluginManager.updateServerPluginConfiguration(pluginKey, editorPC.getConfiguration(),
new AsyncCallback<Void>() {
public void onSuccess(Void result) {
Message m = new Message(MSG.view_admin_plugins_serverConfig_settingsSaved());
CoreGUI.getMessageCenter().notify(m);
}
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError(
MSG.view_admin_plugins_serverConfig_saveFailed(), caught);
}
});
}
});
buttons.addMember(saveButtonPC);
buttons.addMember(resetButtonPC);
layout.addMember(buttons);
layout.addMember(editorPC);
SectionStackSection section = new SectionStackSection(MSG.view_admin_plugins_serverConfig());
section.setExpanded(false);