table.addColumn(name, "Name");
table.addColumn(type, "Type");
table.addColumn(size, "Max Threads");
ToolStrip topLevelTools = new ToolStrip();
add = new ToolButton(Console.CONSTANTS.common_label_add(), new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
presenter.launchNewPoolDialoge(currentManager);
}
});
topLevelTools.addToolButtonRight(add);
remove = new ToolButton(Console.CONSTANTS.common_label_remove(), new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
final SingleSelectionModel<WorkmanagerPool> selectionModel = (SingleSelectionModel<WorkmanagerPool>) table.getSelectionModel();
final WorkmanagerPool pool = selectionModel.getSelectedObject();
if (pool.isShortRunning()) {
Console.error(Console.CONSTANTS.subsys_jca_error_pool_removal(),
Console.CONSTANTS.subsys_jca_error_pool_removal_desc());
} else {
Feedback.confirm(
Console.MESSAGES.deleteTitle("Pool Config"),
Console.MESSAGES.deleteConfirm("Pool Config"),
new Feedback.ConfirmationHandler() {
@Override
public void onConfirmation(boolean isConfirmed) {
if (isConfirmed) {
presenter.onRemovePoolConfig(
contextName, pool
);
}
}
});
}
}
});
topLevelTools.addToolButtonRight(remove);
// ---
attributesForm = new Form<WorkmanagerPool>(WorkmanagerPool.class);
attributesForm.setNumColumns(2);
attributesForm.setEnabled(false);
TextBoxItem nameItemAttr = new TextBoxItem("name", "Name");
CheckBoxItem allowCore = new CheckBoxItem ("allowCoreTimeout", "Allow Core Timeout?");
NumberBoxItem keepAliveTimeout = new NumberBoxItem("keepaliveTime", "Keep Alive Timeout") {
{
isRequired = false;
}
};
TextBoxItem threadFactory = new TextBoxItem("threadFactory", "Thread Factory") {
{
isRequired = false;
}
};
ComboBoxItem unit = new ComboBoxItem("keepaliveTimeUnit", "Keepalive Timeout Unit");
unit.setValueMap(new String[] {"DAYS", "HOURS", "MINUTES", "SECONDS", "MILLISECONDS", "NANOSECONDS"});
unit.selectItem(4);
attributesForm.setFields(
nameItemAttr,
keepAliveTimeout, unit,
allowCore, threadFactory
);
// ---
sizingForm = new Form<WorkmanagerPool>(WorkmanagerPool.class);
sizingForm.setNumColumns(2);
sizingForm.setEnabled(false);
TextBoxItem nameItemSizing = new TextBoxItem("name", "Name");
NumberBoxItem maxThreads = new NumberBoxItem("maxThreads", "Max Threads");
NumberBoxItem maxThreadsPerCPU = new NumberBoxItem("coreThreads", "Core threads");
NumberBoxItem queueLength = new NumberBoxItem("queueLength", "Queue Length");
sizingForm.setFields(nameItemSizing,maxThreads, maxThreadsPerCPU, queueLength);
attributesForm.bind(table);
sizingForm.bind(table);
FormToolStrip<WorkmanagerPool> sizingTools = new FormToolStrip<WorkmanagerPool>(
sizingForm,
new FormToolStrip.FormCallback<WorkmanagerPool>() {
@Override
public void onSave(Map<String, Object> changeset) {
presenter.onSavePoolConfig(
contextName,
sizingForm.getEditedEntity(),
changeset
);
}
@Override
public void onDelete(WorkmanagerPool entity) {
}
}
);
sizingTools.providesDeleteOp(false);
FormToolStrip<WorkmanagerPool> attributesTools = new FormToolStrip<WorkmanagerPool>(
attributesForm,
new FormToolStrip.FormCallback<WorkmanagerPool>() {
@Override
public void onSave(Map<String, Object> changeset) {
presenter.onSavePoolConfig(
contextName,
attributesForm.getEditedEntity(),
changeset
);
}
@Override
public void onDelete(WorkmanagerPool entity) {
}
}
);
attributesTools.providesDeleteOp(false);
final FormHelpPanel helpPanel = new FormHelpPanel(
new FormHelpPanel.AddressCallback() {
@Override
public ModelNode getAddress() {
ModelNode address = Baseadress.get();
address.add("subsystem", "jca");
address.add("workmanager", "*");
address.add("short-running-threads", "*");
return address;
}
}, attributesForm
);
Widget attributesPanel = new FormLayout()
.setForm(attributesForm)
.setHelp(helpPanel)
.setTools(attributesTools)
.build();
final FormHelpPanel sizingHelpPanel = new FormHelpPanel(
new FormHelpPanel.AddressCallback() {
@Override
public ModelNode getAddress() {
ModelNode address = Baseadress.get();
address.add("subsystem", "jca");
address.add("workmanager", "*");
address.add("short-running-threads", "*");
return address;
}
}, sizingForm
);
Widget sizingPanel = new FormLayout()
.setForm(sizingForm)
.setHelp(sizingHelpPanel)
.setTools(sizingTools)
.build();
// ---
propertyEditor = new PropertyEditor(presenter, true);
headline = new Label("HEADLINE");
headline.setStyleName("content-header-label");
// ---
Widget panel = new MultipleToOneLayout()
.setPlain(true)
.setHeadlineWidget(headline)
.setTitle("Thread Pool")
.setDescription(Console.CONSTANTS.subsys_jca_threadpool_config_desc())
.setMaster(Console.MESSAGES.available("Thread Pools"), table)
.setMasterTools(topLevelTools.asWidget())
.addDetail("Attributes", attributesPanel)
.addDetail("Sizing", sizingPanel)
.build();
return panel;