ToolButton deleteBtn = new ToolButton(Console.CONSTANTS.common_label_delete());
deleteBtn.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);
}
});
}
});
deleteBtn.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_delete_serverGroupsView());
toolStrip.addToolButtonRight(deleteBtn);
ToolButton copyBtn = new ToolButton(Console.CONSTANTS.common_label_copy());
copyBtn.addClickHandler(new ClickHandler(){
@Override
public void onClick(ClickEvent clickEvent) {
final ServerGroupRecord serverGroup = getSelectionModel().getSelectedObject();
presenter.launchCopyWizard(serverGroup);
}
});
toolStrip.addToolButtonRight(copyBtn);
// ---------------------------------------------
serverGroupTable = new DefaultCellTable<ServerGroupRecord>(8, new ProvidesKey<ServerGroupRecord>() {
@Override
public Object getKey(ServerGroupRecord item) {
return item.getGroupName()+"_"+item.getProfileName();
}
});
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");
// ---------------------------------------------------
details = new ServerGroupDetails(presenter);
// ---------------------------------------------------
jvmEditor = new JvmEditor(presenter, true, true);
jvmEditor.setAddressCallback(new FormHelpPanel.AddressCallback() {
@Override
public ModelNode getAddress() {
ModelNode address = new ModelNode();
address.add("server-group", "*");
address.add("jvm", "*");
return address;
}
});
propertyEditor = new PropertyEditor(presenter);
// --------------------
MultipleToOneLayout layout = new MultipleToOneLayout()
.setTitle(Console.CONSTANTS.common_label_serverGroupConfigurations())
.setHeadline("Server Groups")
.setDescription(Console.CONSTANTS.common_serverGroups_desc())
.setMaster(Console.MESSAGES.available(Console.CONSTANTS.common_label_serverGroupConfigurations()), serverGroupTable)
.setMasterTools(toolStrip.asWidget())
.addDetail("Attributes", details.asWidget())
.addDetail(Console.CONSTANTS.common_label_virtualMachine(), jvmEditor.asWidget())
.addDetail(Console.CONSTANTS.common_label_systemProperties(), propertyEditor.asWidget());
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);
}
});