2014-02-07 10:44:52 +01:00
|
|
|
package org.gcube.portlets.user.td.columnwidget.client.dimension;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Arrays;
|
2014-02-10 19:04:15 +01:00
|
|
|
import java.util.Iterator;
|
2014-02-07 10:44:52 +01:00
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import org.gcube.portlets.user.td.columnwidget.client.resources.ResourceBundle;
|
2014-03-18 13:06:09 +01:00
|
|
|
import org.gcube.portlets.user.td.columnwidget.client.utils.UtilsGXT3;
|
2014-02-26 15:33:39 +01:00
|
|
|
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
2014-02-07 10:44:52 +01:00
|
|
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
2014-03-25 14:56:59 +01:00
|
|
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData;
|
2014-02-26 15:33:39 +01:00
|
|
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.paging.CodelistPagingLoadConfig;
|
|
|
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.paging.CodelistPagingLoadResult;
|
|
|
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.paging.Direction;
|
|
|
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.paging.OrderInfo;
|
2014-02-07 10:44:52 +01:00
|
|
|
|
|
|
|
import com.allen_sauer.gwt.log.client.Log;
|
|
|
|
import com.google.gwt.core.client.GWT;
|
|
|
|
import com.google.gwt.core.client.Scheduler;
|
|
|
|
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
|
|
|
import com.google.gwt.event.dom.client.KeyUpEvent;
|
|
|
|
import com.google.gwt.event.dom.client.KeyUpHandler;
|
|
|
|
import com.google.gwt.event.logical.shared.SelectionEvent;
|
|
|
|
import com.google.gwt.event.logical.shared.SelectionHandler;
|
|
|
|
import com.google.gwt.event.shared.HandlerRegistration;
|
|
|
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
2014-02-26 19:03:05 +01:00
|
|
|
import com.google.web.bindery.event.shared.EventBus;
|
2014-02-07 10:44:52 +01:00
|
|
|
import com.sencha.gxt.core.client.IdentityValueProvider;
|
|
|
|
import com.sencha.gxt.core.client.Style.SelectionMode;
|
|
|
|
import com.sencha.gxt.core.client.resources.ThemeStyles;
|
|
|
|
import com.sencha.gxt.data.client.loader.RpcProxy;
|
|
|
|
import com.sencha.gxt.data.shared.ListStore;
|
2014-02-10 19:04:15 +01:00
|
|
|
import com.sencha.gxt.data.shared.SortDir;
|
|
|
|
import com.sencha.gxt.data.shared.SortInfo;
|
2014-02-07 10:44:52 +01:00
|
|
|
import com.sencha.gxt.data.shared.loader.LoadResultListStoreBinding;
|
|
|
|
import com.sencha.gxt.data.shared.loader.PagingLoadConfig;
|
|
|
|
import com.sencha.gxt.data.shared.loader.PagingLoadResult;
|
|
|
|
import com.sencha.gxt.data.shared.loader.PagingLoadResultBean;
|
|
|
|
import com.sencha.gxt.data.shared.loader.PagingLoader;
|
|
|
|
import com.sencha.gxt.widget.core.client.FramedPanel;
|
|
|
|
import com.sencha.gxt.widget.core.client.Window;
|
|
|
|
import com.sencha.gxt.widget.core.client.button.TextButton;
|
|
|
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
|
|
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
|
|
|
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
|
|
|
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
|
|
|
import com.sencha.gxt.widget.core.client.form.TextField;
|
|
|
|
import com.sencha.gxt.widget.core.client.grid.CheckBoxSelectionModel;
|
|
|
|
import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
|
|
|
|
import com.sencha.gxt.widget.core.client.grid.ColumnModel;
|
|
|
|
import com.sencha.gxt.widget.core.client.grid.Grid;
|
|
|
|
import com.sencha.gxt.widget.core.client.grid.LiveGridView;
|
|
|
|
import com.sencha.gxt.widget.core.client.grid.LiveToolItem;
|
|
|
|
import com.sencha.gxt.widget.core.client.toolbar.LabelToolItem;
|
|
|
|
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
|
|
|
|
2014-04-03 15:30:58 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @author "Giancarlo Panichi"
|
|
|
|
*
|
|
|
|
*/
|
2014-04-02 17:18:19 +02:00
|
|
|
public class CodelistSelectionDialog extends Window {
|
2014-02-07 10:44:52 +01:00
|
|
|
protected static final int WIDTH = 550;
|
|
|
|
protected static final int HEIGHT = 520;
|
|
|
|
protected static final int CACHE_SIZE = 200;
|
2014-02-26 19:03:05 +01:00
|
|
|
|
|
|
|
protected ArrayList<CodelistSelectionListener> listeners;
|
|
|
|
|
2014-02-07 10:44:52 +01:00
|
|
|
private static final TabResourcesProperties properties = GWT
|
|
|
|
.create(TabResourcesProperties.class);
|
|
|
|
|
|
|
|
protected static final ColumnConfig<TabResource, String> nameColumn = new ColumnConfig<TabResource, String>(
|
|
|
|
properties.name(), 50, "Name");
|
|
|
|
protected static final ColumnConfig<TabResource, String> agencyColumn = new ColumnConfig<TabResource, String>(
|
|
|
|
properties.agency(), 50, "Agency");
|
|
|
|
protected static final ColumnConfig<TabResource, String> dateColumn = new ColumnConfig<TabResource, String>(
|
|
|
|
properties.date(), 50, "Date");
|
2014-02-26 19:03:05 +01:00
|
|
|
|
2014-02-26 15:33:39 +01:00
|
|
|
protected EventBus eventBus;
|
2014-02-07 10:44:52 +01:00
|
|
|
protected Grid<TabResource> grid;
|
|
|
|
protected ExtendedLiveGridView liveGridView;
|
2014-02-10 19:04:15 +01:00
|
|
|
protected PagingLoader<PagingLoadConfig, PagingLoadResult<TabResource>> loader;
|
2014-02-26 15:33:39 +01:00
|
|
|
protected String filter;
|
2014-03-04 10:46:45 +01:00
|
|
|
protected boolean firstLoad = true;
|
2014-02-26 19:03:05 +01:00
|
|
|
|
2014-03-25 14:56:59 +01:00
|
|
|
protected TabResource selectedTR;
|
|
|
|
|
2014-02-07 10:44:52 +01:00
|
|
|
protected ResourceBundle res;
|
2014-02-26 19:03:05 +01:00
|
|
|
private TextButton select;
|
|
|
|
|
2014-04-02 17:18:19 +02:00
|
|
|
public CodelistSelectionDialog(EventBus eventBus) {
|
2014-02-07 10:44:52 +01:00
|
|
|
Log.info("Dialog CodelistSelection");
|
2014-04-03 15:30:58 +02:00
|
|
|
this.eventBus = eventBus;
|
|
|
|
listeners = new ArrayList<CodelistSelectionListener>();
|
|
|
|
initWindow();
|
|
|
|
create();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void initWindow(){
|
2014-02-07 10:44:52 +01:00
|
|
|
setWidth(WIDTH);
|
|
|
|
setHeight(HEIGHT);
|
|
|
|
res = ResourceBundle.INSTANCE;
|
|
|
|
setBodyBorder(false);
|
2014-03-04 10:46:45 +01:00
|
|
|
setResizable(false);
|
2014-02-07 10:44:52 +01:00
|
|
|
setHeadingText("Select Codelist");
|
2014-04-03 15:30:58 +02:00
|
|
|
setModal(true);
|
2014-02-26 17:49:31 +01:00
|
|
|
}
|
2014-04-03 15:30:58 +02:00
|
|
|
|
2014-02-26 19:03:05 +01:00
|
|
|
protected void create() {
|
|
|
|
|
2014-03-04 10:46:45 +01:00
|
|
|
final FramedPanel panel = new FramedPanel();
|
2014-02-07 10:44:52 +01:00
|
|
|
panel.setHeaderVisible(false);
|
|
|
|
panel.setBodyBorder(false);
|
|
|
|
|
|
|
|
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
|
|
|
|
|
|
|
// Search
|
|
|
|
ToolBar toolBar = new ToolBar();
|
|
|
|
toolBar.add(new LabelToolItem("Search: "));
|
|
|
|
final TextField searchField = new TextField();
|
|
|
|
toolBar.add(searchField);
|
|
|
|
|
|
|
|
TextButton btnReload = new TextButton();
|
|
|
|
btnReload.setText("Reload");
|
|
|
|
btnReload.setIcon(res.refresh());
|
|
|
|
btnReload.setToolTip("Reload");
|
|
|
|
toolBar.add(btnReload);
|
|
|
|
|
|
|
|
IdentityValueProvider<TabResource> identity = new IdentityValueProvider<TabResource>();
|
|
|
|
final CheckBoxSelectionModel<TabResource> sm = new CheckBoxSelectionModel<TabResource>(
|
|
|
|
identity);
|
|
|
|
|
|
|
|
List<ColumnConfig<TabResource, ?>> columns = Arrays
|
|
|
|
.<ColumnConfig<TabResource, ?>> asList(nameColumn,
|
|
|
|
agencyColumn, dateColumn);
|
2014-02-10 19:04:15 +01:00
|
|
|
|
2014-02-07 10:44:52 +01:00
|
|
|
ColumnModel<TabResource> cm = new ColumnModel<TabResource>(columns);
|
|
|
|
|
|
|
|
final ListStore<TabResource> store = new ListStore<TabResource>(
|
|
|
|
properties.id());
|
2014-02-10 19:04:15 +01:00
|
|
|
|
2014-02-07 10:44:52 +01:00
|
|
|
searchField.addKeyUpHandler(new KeyUpHandler() {
|
|
|
|
|
|
|
|
public void onKeyUp(KeyUpEvent event) {
|
|
|
|
Log.trace("searchTerm: " + searchField.getCurrentValue());
|
2014-02-26 19:03:05 +01:00
|
|
|
filter = searchField.getCurrentValue();
|
|
|
|
if (filter != null && !filter.isEmpty()) {
|
2014-02-26 15:33:39 +01:00
|
|
|
loader.load(0, liveGridView.getCacheSize());
|
|
|
|
}
|
2014-02-07 10:44:52 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
RpcProxy<PagingLoadConfig, PagingLoadResult<TabResource>> proxy = new RpcProxy<PagingLoadConfig, PagingLoadResult<TabResource>>() {
|
|
|
|
|
|
|
|
public void load(PagingLoadConfig loadConfig,
|
|
|
|
final AsyncCallback<PagingLoadResult<TabResource>> callback) {
|
|
|
|
loadData(loadConfig, callback);
|
2014-02-26 19:03:05 +01:00
|
|
|
|
2014-02-07 10:44:52 +01:00
|
|
|
}
|
|
|
|
};
|
2014-02-26 15:33:39 +01:00
|
|
|
loader = new PagingLoader<PagingLoadConfig, PagingLoadResult<TabResource>>(
|
2014-02-07 10:44:52 +01:00
|
|
|
proxy);
|
|
|
|
|
|
|
|
loader.setRemoteSort(true);
|
|
|
|
|
|
|
|
loader.addLoadHandler(new LoadResultListStoreBinding<PagingLoadConfig, TabResource, PagingLoadResult<TabResource>>(
|
|
|
|
store));
|
|
|
|
|
|
|
|
liveGridView = new ExtendedLiveGridView();
|
|
|
|
liveGridView.setForceFit(true);
|
2014-03-04 10:46:45 +01:00
|
|
|
liveGridView.setEmptyText("No Results.");
|
2014-02-07 10:44:52 +01:00
|
|
|
liveGridView.setCacheSize(CACHE_SIZE);
|
2014-03-25 14:56:59 +01:00
|
|
|
|
2014-02-07 10:44:52 +01:00
|
|
|
grid = new Grid<TabResource>(store, cm) {
|
|
|
|
@Override
|
|
|
|
protected void onAfterFirstAttach() {
|
|
|
|
super.onAfterFirstAttach();
|
|
|
|
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
|
|
|
public void execute() {
|
|
|
|
loader.load(0, liveGridView.getCacheSize());
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
sm.setSelectionMode(SelectionMode.SINGLE);
|
|
|
|
grid.setLoader(loader);
|
|
|
|
grid.setSelectionModel(sm);
|
|
|
|
grid.setView(liveGridView);
|
|
|
|
grid.setBorders(false);
|
|
|
|
grid.setLoadMask(true);
|
2014-03-25 14:56:59 +01:00
|
|
|
|
2014-03-04 10:46:45 +01:00
|
|
|
// grid.setColumnReordering(true);
|
|
|
|
|
2014-02-26 19:12:18 +01:00
|
|
|
addSelectionHandler();
|
2014-02-07 10:44:52 +01:00
|
|
|
|
|
|
|
SelectHandler sh = new SelectHandler() {
|
|
|
|
public void onSelect(SelectEvent event) {
|
|
|
|
loader.load();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
btnReload.addSelectHandler(sh);
|
|
|
|
|
|
|
|
ToolBar baseToolBar = new ToolBar();
|
|
|
|
baseToolBar.add(new LiveToolItem(grid));
|
|
|
|
baseToolBar.addStyleName(ThemeStyles.getStyle().borderTop());
|
|
|
|
baseToolBar.getElement().getStyle().setProperty("borderBottom", "none");
|
|
|
|
|
|
|
|
v.add(toolBar, new VerticalLayoutData(-1, -1));
|
|
|
|
v.add(grid, new VerticalLayoutData(1, 1));
|
|
|
|
v.add(baseToolBar, new VerticalLayoutData(1, 25));
|
|
|
|
|
|
|
|
panel.add(v);
|
2014-02-26 19:03:05 +01:00
|
|
|
|
|
|
|
select = new TextButton("Select");
|
|
|
|
select.disable();
|
|
|
|
select.addSelectHandler(new SelectHandler() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onSelect(SelectEvent event) {
|
2014-03-25 14:56:59 +01:00
|
|
|
startSelect();
|
2014-02-26 19:03:05 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
panel.addButton(select);
|
2014-02-07 10:44:52 +01:00
|
|
|
|
|
|
|
add(panel);
|
2014-02-26 17:49:31 +01:00
|
|
|
forceLayout();
|
2014-02-07 10:44:52 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-03-25 14:56:59 +01:00
|
|
|
protected void startSelect() {
|
|
|
|
selectedTR = getSelected();
|
|
|
|
if (selectedTR != null) {
|
|
|
|
TDGWTServiceAsync.INSTANCE.getLastTable(selectedTR.getTrId(),
|
|
|
|
new AsyncCallback<TableData>() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onFailure(Throwable caught) {
|
|
|
|
Log.debug("Attention",
|
|
|
|
"This tabular resource does not have a valid table");
|
|
|
|
UtilsGXT3
|
|
|
|
.alert("Attention",
|
|
|
|
"This tabular resource does not have a valid table");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onSuccess(TableData result) {
|
|
|
|
Log.debug("Retrieve last table: " + result);
|
|
|
|
startFire(result);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
UtilsGXT3
|
|
|
|
.alert("Attention",
|
|
|
|
"Select a codelist!");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void startFire(TableData result) {
|
|
|
|
selectedTR.setTrId(result.getTrId());
|
|
|
|
fireCompleted(selectedTR);
|
|
|
|
}
|
|
|
|
|
2014-02-07 10:44:52 +01:00
|
|
|
protected void loadData(PagingLoadConfig loadConfig,
|
|
|
|
final AsyncCallback<PagingLoadResult<TabResource>> callback) {
|
2014-03-04 10:46:45 +01:00
|
|
|
if (firstLoad) {
|
|
|
|
initLoad(loadConfig, callback);
|
|
|
|
} else {
|
|
|
|
fastLoad(loadConfig, callback);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void fastLoad(PagingLoadConfig loadConfig,
|
|
|
|
final AsyncCallback<PagingLoadResult<TabResource>> callback) {
|
2014-02-26 15:33:39 +01:00
|
|
|
List<? extends SortInfo> sortInfo = loadConfig.getSortInfo();
|
|
|
|
Iterator<? extends SortInfo> iterator = sortInfo.iterator();
|
|
|
|
ArrayList<OrderInfo> listOrderInfo = new ArrayList<OrderInfo>();
|
|
|
|
|
|
|
|
while (iterator.hasNext()) {
|
|
|
|
SortInfo info = iterator.next();
|
|
|
|
OrderInfo ord = new OrderInfo();
|
|
|
|
SortDir sd = info.getSortDir();
|
|
|
|
if (sd.compareTo(SortDir.ASC) == 0) {
|
|
|
|
ord.setDirection(Direction.ASC);
|
2014-02-10 19:04:15 +01:00
|
|
|
} else {
|
2014-02-26 15:33:39 +01:00
|
|
|
ord.setDirection(Direction.DESC);
|
2014-02-10 19:04:15 +01:00
|
|
|
}
|
|
|
|
ord.setField(info.getSortField());
|
|
|
|
listOrderInfo.add(ord);
|
|
|
|
}
|
2014-02-07 10:44:52 +01:00
|
|
|
|
2014-02-26 15:33:39 +01:00
|
|
|
CodelistPagingLoadConfig codelistPagingLoadConfig = new CodelistPagingLoadConfig(
|
|
|
|
loadConfig.getOffset(), loadConfig.getLimit(), listOrderInfo,
|
|
|
|
filter);
|
|
|
|
|
|
|
|
TDGWTServiceAsync.INSTANCE.getCodelistsPagingLoader(
|
|
|
|
codelistPagingLoadConfig,
|
|
|
|
new AsyncCallback<CodelistPagingLoadResult>() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onFailure(Throwable caught) {
|
|
|
|
Log.debug("Error Retrieving Codelist",
|
|
|
|
caught.getMessage());
|
|
|
|
caught.printStackTrace();
|
2014-03-18 13:06:09 +01:00
|
|
|
UtilsGXT3.alert("Error Retrieving Codelist",
|
2014-02-26 15:33:39 +01:00
|
|
|
"Error retrieving codelist on server");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onSuccess(CodelistPagingLoadResult result) {
|
|
|
|
callback.onSuccess(new PagingLoadResultBean<TabResource>(
|
|
|
|
result.getLtr(), result.getTotalLenght(),
|
|
|
|
result.getOffset()));
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2014-02-26 17:49:31 +01:00
|
|
|
}
|
|
|
|
|
2014-03-04 10:46:45 +01:00
|
|
|
protected void initLoad(final PagingLoadConfig loadConfig,
|
|
|
|
final AsyncCallback<PagingLoadResult<TabResource>> callback) {
|
2014-02-26 19:03:05 +01:00
|
|
|
TDGWTServiceAsync.INSTANCE
|
|
|
|
.setCodelistsPagingLoader(new AsyncCallback<Void>() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onFailure(Throwable caught) {
|
|
|
|
Log.debug("Error in setCodelistsPagingLoader",
|
|
|
|
caught.getMessage());
|
|
|
|
caught.printStackTrace();
|
2014-03-25 14:56:59 +01:00
|
|
|
UtilsGXT3
|
|
|
|
.alert("Error Retrieving Codelist",
|
|
|
|
"Error error in retrieving the codelists during the initialization phase!");
|
2014-02-26 19:03:05 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onSuccess(Void result) {
|
2014-03-04 10:46:45 +01:00
|
|
|
firstLoad = false;
|
|
|
|
fastLoad(loadConfig, callback);
|
2014-02-26 19:03:05 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
2014-02-26 17:49:31 +01:00
|
|
|
|
2014-02-07 10:44:52 +01:00
|
|
|
}
|
|
|
|
|
2014-02-26 19:12:18 +01:00
|
|
|
protected HandlerRegistration addSelectionHandler() {
|
2014-02-07 10:44:52 +01:00
|
|
|
SelectionHandler<TabResource> hand = new SelectionHandler<TabResource>() {
|
|
|
|
|
|
|
|
public void onSelection(SelectionEvent<TabResource> event) {
|
2014-02-26 19:03:05 +01:00
|
|
|
select.enable();
|
2014-02-07 10:44:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
return grid.getSelectionModel().addSelectionHandler(hand);
|
|
|
|
}
|
|
|
|
|
2014-02-26 19:03:05 +01:00
|
|
|
protected TabResource getSelected() {
|
2014-02-07 10:44:52 +01:00
|
|
|
return grid.getSelectionModel().getSelectedItem();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected class ExtendedLiveGridView extends LiveGridView<TabResource> {
|
2014-03-04 10:46:45 +01:00
|
|
|
|
2014-03-25 14:56:59 +01:00
|
|
|
// TODO bug in gxt3 3.0.0 fixed in future
|
|
|
|
/*
|
|
|
|
* @Override public void refresh(boolean headerToo) {
|
|
|
|
* preventScrollToTopOnRefresh = true; super.refresh(headerToo); }
|
|
|
|
*
|
|
|
|
* @Override public Point getScrollState() { return new
|
|
|
|
* Point(scroller.getScrollLeft(), liveScroller.getScrollTop()); }
|
|
|
|
*
|
|
|
|
* @Override public void restoreScroll(Point state) { if (state.getX() <
|
|
|
|
* cm.getTotalWidth()) { scroller.setScrollLeft(state.getX()); } if
|
|
|
|
* (state.getY() < totalCount * getCalculatedRowHeight()) {
|
|
|
|
* liveScroller.setScrollTop(state.getY()); } }
|
|
|
|
*/
|
2014-03-04 10:46:45 +01:00
|
|
|
|
2014-02-07 10:44:52 +01:00
|
|
|
};
|
|
|
|
|
2014-02-26 19:03:05 +01:00
|
|
|
/**
|
|
|
|
* {@inheritDoc}
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
protected void initTools() {
|
|
|
|
super.initTools();
|
|
|
|
|
|
|
|
closeBtn.addSelectHandler(new SelectHandler() {
|
|
|
|
|
|
|
|
public void onSelect(SelectEvent event) {
|
|
|
|
fireAborted();
|
|
|
|
hide();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
2014-03-04 10:46:45 +01:00
|
|
|
|
2014-02-26 19:03:05 +01:00
|
|
|
public void addListener(CodelistSelectionListener listener) {
|
|
|
|
listeners.add(listener);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void removeListener(CodelistSelectionListener listener) {
|
|
|
|
listeners.remove(listener);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void fireCompleted(TabResource tabResource) {
|
|
|
|
for (CodelistSelectionListener listener : listeners)
|
|
|
|
listener.selected(tabResource);
|
2014-02-26 19:15:43 +01:00
|
|
|
hide();
|
2014-02-26 19:03:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public void fireAborted() {
|
|
|
|
for (CodelistSelectionListener listener : listeners)
|
|
|
|
listener.aborted();
|
2014-02-26 19:15:43 +01:00
|
|
|
hide();
|
2014-02-26 19:03:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public void fireFailed(String reason, String details) {
|
|
|
|
for (CodelistSelectionListener listener : listeners)
|
|
|
|
listener.failed(reason, details);
|
2014-02-26 19:15:43 +01:00
|
|
|
hide();
|
2014-02-26 19:03:05 +01:00
|
|
|
}
|
|
|
|
|
2014-02-07 10:44:52 +01:00
|
|
|
}
|