dataSourceTable.addColumn(nameColumn, "Name");
dataSourceTable.addColumn(jndiNameColumn, "JNDI");
dataSourceTable.addColumn(statusColumn, "Enabled?");
vpanel.add(new ContentGroupLabel(Console.CONSTANTS.subsys_jca_dataSource_registered()));
vpanel.add(dataSourceTable);
// -----------
details = new XADataSourceDetails(presenter);
propertyEditor = new PropertyEditor(this,true);
propertyEditor.setHelpText(Console.CONSTANTS.subsys_jca_dataSource_xaprop_help());
final SingleSelectionModel<XADataSource> selectionModel = new SingleSelectionModel<XADataSource>();
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange(SelectionChangeEvent event) {
XADataSource dataSource = selectionModel.getSelectedObject();
details.setSelectedRecord(dataSource);
//propertyEditor.setProperties(dataSource.getName(), dataSource.getProperties());
presenter.loadXAProperties(dataSource.getName());
}
});
dataSourceTable.setSelectionModel(selectionModel);
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler () {
@Override
public void onSelectionChange(SelectionChangeEvent event) {
XADataSource selectedObject = ((SingleSelectionModel<XADataSource>) dataSourceTable.getSelectionModel()).getSelectedObject();
presenter.loadPoolConfig(true, selectedObject.getName());
}
});
TabPanel bottomPanel = new TabPanel();
bottomPanel.setStyleName("default-tabpanel");
bottomPanel.add(details.asWidget(), "Attributes");
final FormToolStrip.FormCallback<XADataSource> xaCallback = new FormToolStrip.FormCallback<XADataSource>() {
@Override
public void onSave(Map<String, Object> changeset) {
DataSource ds = getCurrentSelection();
presenter.onSaveXADetails(ds.getName(), changeset);
}
@Override
public void onDelete(XADataSource entity) {
// n/a
}
};
final FormToolStrip.FormCallback<DataSource> dsCallback = new FormToolStrip.FormCallback<DataSource>() {
@Override
public void onSave(Map<String, Object> changeset) {
DataSource ds = getCurrentSelection();
presenter.onSaveXADetails(ds.getName(), changeset);
}
@Override
public void onDelete(DataSource entity) {
// n/a
}
};
connectionEditor = new XADataSourceConnection(xaCallback);
connectionEditor.getForm().bind(dataSourceTable);
bottomPanel.add(connectionEditor.asWidget(), "Connection");
securityEditor = new DataSourceSecurityEditor(dsCallback);
securityEditor.getForm().bind(dataSourceTable);
bottomPanel.add(securityEditor.asWidget(), "Security");
bottomPanel.add(propertyEditor.asWidget(), "Properties");
propertyEditor.setAllowEditProps(false);
poolConfig = new PoolConfigurationView(new PoolManagement() {
@Override
public void onSavePoolConfig(String parentName, Map<String, Object> changeset) {
presenter.onSavePoolConfig(parentName, changeset, true);
}
@Override
public void onResetPoolConfig(String parentName, PoolConfig entity) {
presenter.onDeletePoolConfig(parentName, entity, true);
}
@Override
public void onDoFlush(String editedName) {
presenter.onDoFlush(true, editedName);
}
});
bottomPanel.add(poolConfig.asWidget(), "Pool");
validationEditor = new DataSourceValidationEditor(dsCallback);
validationEditor.getForm().bind(dataSourceTable);
bottomPanel.add(validationEditor.asWidget(), "Validation");
bottomPanel.selectTab(0);
vpanel.add(new ContentGroupLabel("XA Datasource"));
vpanel.add(bottomPanel);
return layout;
}