vpanel.add(new ContentDescription(Console.CONSTANTS.subsys_jca_dataSources_desc()));
dataSourceTable = new DatasourceTable();
vpanel.add(new ContentGroupLabel(Console.MESSAGES.available("Datasources")));
vpanel.add(topLevelTools.asWidget());
vpanel.add(dataSourceTable.asWidget());
// -----------
details = new DataSourceDetails(presenter);
details.bind(dataSourceTable.getCellTable());
SingleSelectionModel<DataSource> selectionModel =
(SingleSelectionModel<DataSource>)dataSourceTable.getCellTable().getSelectionModel();
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler () {
@Override
public void onSelectionChange(SelectionChangeEvent event) {
DataSource selectedObject = ((SingleSelectionModel<DataSource>) dataSourceTable.getCellTable().getSelectionModel()).getSelectedObject();
presenter.loadPoolConfig(false, selectedObject.getName());
presenter.onLoadConnectionProperties(selectedObject.getName());
}
});
// -----------------
TabPanel bottomPanel = new TabPanel();
bottomPanel.setStyleName("default-tabpanel");
bottomPanel.add(details.asWidget(), "Attributes");
// -----------------
final FormToolStrip.FormCallback<DataSource> formCallback = new FormToolStrip.FormCallback<DataSource>() {
@Override
public void onSave(Map<String, Object> changeset) {
DataSource ds = getCurrentSelection();
presenter.onSaveDSDetails(ds.getName(), changeset);
}
@Override
public void onDelete(DataSource entity) {
// n/a
}
};
connectionEditor = new DataSourceConnectionEditor(presenter, formCallback);
connectionEditor.getForm().bind(dataSourceTable.getCellTable());
bottomPanel.add(connectionEditor.asWidget(), "Connection");
securityEditor = new DataSourceSecurityEditor(formCallback);
securityEditor.getForm().bind(dataSourceTable.getCellTable());
bottomPanel.add(securityEditor.asWidget(), "Security");
// -----------------
connectionProps = new ConnectionProperties(presenter);
bottomPanel.add(connectionProps.asWidget(), "Properties");
// -----------------
poolConfig = new PoolConfigurationView(new PoolManagement() {
@Override
public void onSavePoolConfig(String parentName, Map<String, Object> changeset) {
presenter.onSavePoolConfig(parentName, changeset, false);
}
@Override
public void onResetPoolConfig(String parentName, PoolConfig entity) {
presenter.onDeletePoolConfig(parentName, entity, false);
}
@Override
public void onDoFlush(String editedName) {
if(getCurrentSelection().isEnabled())
presenter.onDoFlush(false, editedName);
else
Console.error(Console.CONSTANTS.subsys_jca_error_datasource_notenabled());
}
});
bottomPanel.add(poolConfig.asWidget(), "Pool");
poolConfig.getForm().bind(dataSourceTable.getCellTable());
// ----
validationEditor = new DataSourceValidationEditor(formCallback);
validationEditor.getForm().bind(dataSourceTable.getCellTable());
bottomPanel.add(validationEditor.asWidget(), "Validation");
// ----
timeoutEditor = new DataSourceTimeoutEditor<DataSource>(formCallback, false);
timeoutEditor.getForm().bind(dataSourceTable.getCellTable());
bottomPanel.add(timeoutEditor.asWidget(), "Timeouts");
bottomPanel.selectTab(0);
// -----------------
vpanel.add(new ContentGroupLabel(Console.CONSTANTS.common_label_selection()));
// --
ClickHandler disableHandler = new ClickHandler() {
@Override
public void onClick(ClickEvent event) {