ToolButton delete = new ToolButton(Console.CONSTANTS.common_label_delete());
delete.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);
}
});
}
});
toolStrip.addToolButtonRight(delete);
layout.add(toolStrip);
// ---
VerticalPanel panel = new VerticalPanel();
panel.setStyleName("rhs-content-panel");
ScrollPanel scrollPanel = new ScrollPanel(panel);
layout.add(scrollPanel);
layout.setWidgetTopHeight(titleBar, 0, Style.Unit.PX, 28, Style.Unit.PX);
layout.setWidgetTopHeight(toolStrip, 28, Style.Unit.PX, 30, Style.Unit.PX);
layout.setWidgetTopHeight(scrollPanel, 58, Style.Unit.PX, 100, Style.Unit.PCT);
// ------------------------------------------------------
// table
panel.add(new ContentHeaderLabel("Available Server Configurations"));
panel.add(new ContentDescription("A server configuration does specify the overall configuration of a server. A server configuration can be started and perform work. Server configurations belong to server groups."));
serverConfigTable = new DefaultCellTable<Server>(10);
serverConfigProvider = new ListDataProvider<Server>();
serverConfigProvider.addDataDisplay(serverConfigTable);
// 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();
}
};
serverConfigTable.addColumn(nameColumn, "Configuration Name");
serverConfigTable.addColumn(groupColumn, Console.CONSTANTS.common_label_serverGroup());
panel.add(serverConfigTable);
DefaultPager pager = new DefaultPager();
pager.setDisplay(serverConfigTable);
panel.add(pager);
// ---------------------
TabPanel bottomLayout = new TabPanel();
bottomLayout.addStyleName("default-tabpanel");
// details
details = new ServerConfigDetails(presenter);
bottomLayout.add(details.asWidget(), "Attributes");
details.bind(serverConfigTable);
// jvm editor
jvmEditor = new JvmEditor(presenter);
jvmEditor.setAddressCallback(new FormHelpPanel.AddressCallback() {
@Override
public ModelNode getAddress() {
ModelNode address = new ModelNode();
address.add("host", presenter.getSelectedHost());
address.add("server-config", "TODO"); // TODO
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 this server.");
bottomLayout.add(propertyEditor.asWidget(), Console.CONSTANTS.common_label_systemProperties());
propertyEditor.setAllowEditProps(false);
portsView = new PortsView();
bottomLayout.add(portsView.asWidget(), "Ports");
// ------------
panel.add(new ContentGroupLabel("Server Configuration"));
panel.add(bottomLayout);
bottomLayout.selectTab(0);
// --------------------
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);
}
});