ClickHandler clickHandler = new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
final DataSource currentSelection = details.getCurrentSelection();
if(currentSelection!=null)
{
Feedback.confirm(
Console.MESSAGES.deleteTitle("datasource"),
Console.MESSAGES.deleteConfirm("datasource "+currentSelection.getName()),
new Feedback.ConfirmationHandler() {
@Override
public void onConfirmation(boolean isConfirmed) {
if (isConfirmed) {
presenter.onDelete(currentSelection);
}
}
});
}
}
};
ToolButton deleteBtn = new ToolButton(Console.CONSTANTS.common_label_delete());
deleteBtn.addClickHandler(clickHandler);
topLevelTools.addToolButtonRight(deleteBtn);
layout.add(topLevelTools);
// ----
VerticalPanel vpanel = new VerticalPanel();
vpanel.setStyleName("rhs-content-panel");
ScrollPanel scroll = new ScrollPanel(vpanel);
layout.add(scroll);
layout.setWidgetTopHeight(topLevelTools, 0, Style.Unit.PX, 30, Style.Unit.PX);
layout.setWidgetTopHeight(scroll, 30, Style.Unit.PX, 100, Style.Unit.PCT);
// ---
HorizontalPanel horzPanel = new HorizontalPanel();
horzPanel.getElement().setAttribute("style", "width:100%;");
Image image = new Image(Icons.INSTANCE.database());
horzPanel.add(image);
horzPanel.add(new ContentHeaderLabel(Console.CONSTANTS.subsys_jca_dataSource_configurations()));
image.getElement().getParentElement().setAttribute("width", "25");
vpanel.add(horzPanel);
dataSourceTable = new DatasourceTable();
vpanel.add(new ContentGroupLabel(Console.CONSTANTS.subsys_jca_dataSource_registered()));
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());
}
});
// -----------------