ToolButton deleteBtn = new ToolButton(Console.CONSTANTS.common_label_delete());
deleteBtn.addClickHandler(new ClickHandler(){
@Override
public void onClick(ClickEvent clickEvent) {
final Server server = getSelectionModel().getSelectedObject();
Feedback.confirm(
Console.MESSAGES.deleteServerConfig(),
Console.MESSAGES.deleteServerConfigConfirm(server.getName()),
new Feedback.ConfirmationHandler() {
@Override
public void onConfirmation(boolean isConfirmed) {
if(isConfirmed)
presenter.tryDelete(server);
}
});
}
});
deleteBtn.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_delete_serverConfigView());
toolStrip.addToolButtonRight(deleteBtn);
ToolButton copyBtn = new ToolButton(Console.CONSTANTS.common_label_copy());
copyBtn.addClickHandler(new ClickHandler(){
@Override
public void onClick(ClickEvent clickEvent) {
final Server server = getSelectionModel().getSelectedObject();
presenter.onLaunchCopyWizard(server);
}
});
toolStrip.addToolButtonRight(copyBtn);
// ------------------------------------------------------
// Create columns
Column<Server, String> nameColumn = new Column<Server, String>(new TextCell()) {
@Override
public String getValue(Server object) {
return object.getName();
}
};
Column<Server, String> groupColumn = new Column<Server, String>(new TextCell()) {
@Override
public String getValue(Server object) {
return object.getGroup();
}
};
Column<Server, String> startMode = new Column<Server, String>(new TextCell()) {
@Override
public String getValue(Server object) {
return String.valueOf(object.isAutoStart());
}
};
serverConfigTable.addColumn(nameColumn, "Configuration Name");
serverConfigTable.addColumn(groupColumn, Console.CONSTANTS.common_label_serverGroup());
serverConfigTable.addColumn(startMode, "Auto Start?");
// ---------------------
details = new ServerConfigDetails(presenter);
// jvm editor
jvmEditor = new JvmEditor(presenter, true, true);
jvmEditor.setAddressCallback(new FormHelpPanel.AddressCallback() {
@Override
public ModelNode getAddress() {
ModelNode address = new ModelNode();
address.add("host", presenter.getSelectedHost());
address.add("server-config", "*");
address.add("jvm", "*");
return address;
}
});
propertyEditor = new PropertyEditor(presenter, true);
propertyEditor.setOperationAddress("/{selected.host}/server-config=*/system-property=*", "add");
portsView = new PortsView();
// --------------------
MultipleToOneLayout layout = new MultipleToOneLayout()
.setTitle(Console.CONSTANTS.common_label_serverGroupConfigurations())
.setHeadline("Server Configurations")
.setDescription(Console.CONSTANTS.common_serverConfig_desc())
.setMaster(Console.MESSAGES.available(Console.CONSTANTS.common_label_serverConfigs()), serverConfigTable)
.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(serverConfigTable);
serverConfigTable.getSelectionModel().addSelectionChangeHandler(
new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange(SelectionChangeEvent selectionChangeEvent) {
Server server = getSelectionModel().getSelectedObject();
presenter.loadJVMConfiguration(server);
presenter.loadProperties(server);
presenter.loadPorts(server);
}
});