ToolButton delete = new ToolButton(Console.CONSTANTS.common_label_delete());
delete.addClickHandler(new ClickHandler(){
@Override
public void onClick(ClickEvent clickEvent) {
final ServerGroupRecord serverGroup = getSelectionModel().getSelectedObject();
Feedback.confirm(
Console.MESSAGES.deleteServerGroup(),
Console.MESSAGES.deleteServerGroupConfirm(serverGroup.getGroupName()),
new Feedback.ConfirmationHandler() {
@Override
public void onConfirmation(boolean isConfirmed) {
if (isConfirmed)
presenter.onDeleteGroup(serverGroup);
}
});
}
});
toolStrip.addToolButtonRight(delete);
layout.add(toolStrip);
// ----
panel = new VerticalPanel();
panel.setStyleName("rhs-content-panel");
ScrollPanel scroll = new ScrollPanel(panel);
layout.add(scroll);
layout.setWidgetTopHeight(titleBar, 0, Style.Unit.PX, 40, Style.Unit.PX);
layout.setWidgetTopHeight(toolStrip, 40, Style.Unit.PX, 30, Style.Unit.PX);
layout.setWidgetTopHeight(scroll, 70, Style.Unit.PX, 100, Style.Unit.PCT);
// ---------------------------------------------
panel.add(new ContentHeaderLabel("Available Server Group Configurations"));
panel.add(new ContentDescription("A Server Group does specify a common management policy for a set of servers. Server Groups are associated with profiles."));
serverGroupTable = new DefaultCellTable<ServerGroupRecord>(10);
serverGroupProvider = new ListDataProvider<ServerGroupRecord>();
serverGroupProvider.addDataDisplay(serverGroupTable);
// Create columns
Column<ServerGroupRecord, String> nameColumn = new Column<ServerGroupRecord, String>(new TextCell()) {
@Override
public String getValue(ServerGroupRecord object) {
return object.getGroupName();
}
};
Column<ServerGroupRecord, String> profileColumn = new Column<ServerGroupRecord, String>(new TextCell()) {
@Override
public String getValue(ServerGroupRecord object) {
return object.getProfileName();
}
};
serverGroupTable.addColumn(nameColumn, "Group Name");
serverGroupTable.addColumn(profileColumn, "Profile");
panel.add(serverGroupTable);
DefaultPager pager = new DefaultPager();
pager.setDisplay(serverGroupTable);
panel.add(pager);
// ---------------------------------------------------
details =new ServerGroupDetails(presenter);
// ---------------------------------------------------
TabPanel bottomLayout = new TabPanel();
bottomLayout.addStyleName("default-tabpanel");
bottomLayout.add(details.asWidget(), "Attributes");
jvmEditor = new JvmEditor(presenter);
jvmEditor.setAddressCallback(new FormHelpPanel.AddressCallback() {
@Override
public ModelNode getAddress() {
ModelNode address = new ModelNode();
address.add("server-group", getSelectionModel().getSelectedObject().getGroupName());
address.add("jvm", "*");
return address;
}
});
bottomLayout .add(jvmEditor.asWidget(), Console.CONSTANTS.common_label_virtualMachine());
propertyEditor = new PropertyEditor(presenter);
propertyEditor.setHelpText("A system property to set on all servers in this server-group.");
bottomLayout.add(propertyEditor.asWidget(), Console.CONSTANTS.common_label_systemProperties());
propertyEditor.setAllowEditProps(false);
bottomLayout.selectTab(0);
panel.add(new ContentGroupLabel("Server Group"));
panel.add(bottomLayout);
details.bind(serverGroupTable);
// --------------------
serverGroupTable.getSelectionModel().addSelectionChangeHandler(
new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange(SelectionChangeEvent selectionChangeEvent) {
ServerGroupRecord group = getSelectionModel().getSelectedObject();
presenter.loadJVMConfiguration(group);
presenter.loadProperties(group);
}
});