this.currentHost = currentHost;
}
Widget asWidget() {
DockLayoutPanel wrapper = new DockLayoutPanel(Style.Unit.PX);
VerticalPanel layout = new VerticalPanel();
layout.setStyleName("window-content");
final Form<Jvm> form = new Form<Jvm>(Jvm.class);
TextBoxItem nameItem = new TextBoxItem("name", Console.CONSTANTS.common_label_name());
HeapBoxItem heapItem = new HeapBoxItem("heapSize", "Heap Size");
HeapBoxItem maxHeapItem = new HeapBoxItem("maxHeapSize", "Max Heap Size");
HeapBoxItem permgen = new HeapBoxItem("permgen", "Permgen Size", false);
HeapBoxItem maxPermgen = new HeapBoxItem("maxPermgen", "Max Permgen Size", false);
heapItem.setValue("64m");
maxHeapItem.setValue("256m");
permgen.setValue("128m");
maxPermgen.setValue("128m");
form.setFields(nameItem, heapItem, maxHeapItem, permgen, maxPermgen);
final FormHelpPanel helpPanel = new FormHelpPanel(
new FormHelpPanel.AddressCallback() {
@Override
public ModelNode getAddress() {
ModelNode address = new ModelNode();
address.add("host", Console.MODULES.getCurrentSelectedHost().getName());
address.add("jvm", "*");
return address;
}
}, form
);
layout.add(helpPanel.asWidget());
layout.add(form.asWidget());
DialogueOptions options = new DialogueOptions(
new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
FormValidation validation = form.validate();
if(!validation.hasErrors())
{
presenter.onCreateJvm(currentHost.getName(), form.getUpdatedEntity());
}
}
},
new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
presenter.closeDialogue();
}
}
);
wrapper.addSouth(options, 35);
wrapper.add(layout);
return wrapper;
}