Remove useless dirs
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-sdmx-import-widget@84087 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
e9fa7bc605
commit
ff453c77a3
|
@ -1,34 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.gcube.portlets.user.sdmximportwizardtd.client;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.Agencies;
|
|
||||||
|
|
||||||
import com.google.gwt.editor.client.Editor.Path;
|
|
||||||
import com.sencha.gxt.core.client.ValueProvider;
|
|
||||||
import com.sencha.gxt.data.shared.LabelProvider;
|
|
||||||
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
|
||||||
import com.sencha.gxt.data.shared.PropertyAccess;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author "Giancarlo Panichi"
|
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public interface AgenciesProperties extends PropertyAccess<Agencies> {
|
|
||||||
|
|
||||||
@Path("id")
|
|
||||||
ModelKeyProvider<Agencies> key();
|
|
||||||
|
|
||||||
LabelProvider<Agencies> nameLabel();
|
|
||||||
|
|
||||||
ValueProvider<Agencies, String> name();
|
|
||||||
ValueProvider<Agencies, String> description();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.gcube.portlets.user.sdmximportwizardtd.client;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.Codelist;
|
|
||||||
|
|
||||||
import com.google.gwt.editor.client.Editor.Path;
|
|
||||||
import com.sencha.gxt.core.client.ValueProvider;
|
|
||||||
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
|
||||||
import com.sencha.gxt.data.shared.PropertyAccess;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author "Giancarlo Panichi"
|
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public interface CodelistProperties extends PropertyAccess<Codelist> {
|
|
||||||
|
|
||||||
@Path("id")
|
|
||||||
ModelKeyProvider<Codelist> key();
|
|
||||||
|
|
||||||
ValueProvider<Codelist, String> name();
|
|
||||||
ValueProvider<Codelist, String> agencyId();
|
|
||||||
ValueProvider<Codelist, String> version();
|
|
||||||
ValueProvider<Codelist, String> description();
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,231 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.gcube.portlets.user.sdmximportwizardtd.client;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.Codelist;
|
|
||||||
import org.gcube.portlets.user.td.sdmximportwidget.client.dataresource.ResourceBundle;
|
|
||||||
|
|
||||||
|
|
||||||
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.HasSelectionHandlers;
|
|
||||||
import com.google.gwt.event.logical.shared.SelectionHandler;
|
|
||||||
import com.google.gwt.event.shared.HandlerRegistration;
|
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
|
||||||
import com.sencha.gxt.core.client.IdentityValueProvider;
|
|
||||||
import com.sencha.gxt.core.client.Style.SelectionMode;
|
|
||||||
import com.sencha.gxt.data.client.loader.RpcProxy;
|
|
||||||
import com.sencha.gxt.data.shared.ListStore;
|
|
||||||
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
|
||||||
import com.sencha.gxt.data.shared.Store;
|
|
||||||
import com.sencha.gxt.data.shared.Store.StoreFilter;
|
|
||||||
import com.sencha.gxt.data.shared.loader.ListLoadConfig;
|
|
||||||
import com.sencha.gxt.data.shared.loader.ListLoadResult;
|
|
||||||
import com.sencha.gxt.data.shared.loader.ListLoadResultBean;
|
|
||||||
import com.sencha.gxt.data.shared.loader.ListLoader;
|
|
||||||
import com.sencha.gxt.data.shared.loader.LoadResultListStoreBinding;
|
|
||||||
import com.sencha.gxt.widget.core.client.ContentPanel;
|
|
||||||
import com.sencha.gxt.widget.core.client.Resizable;
|
|
||||||
import com.sencha.gxt.widget.core.client.Resizable.Dir;
|
|
||||||
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.toolbar.LabelToolItem;
|
|
||||||
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author "Giancarlo Panichi"
|
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class CodelistSelectionPanel extends ContentPanel implements HasSelectionHandlers<Codelist> {
|
|
||||||
|
|
||||||
private static final CodelistProperties properties = GWT.create(CodelistProperties.class);
|
|
||||||
|
|
||||||
protected static final ColumnConfig<Codelist, String> nameColumn = new ColumnConfig<Codelist, String>(properties.name(), 50, "Name");
|
|
||||||
protected static final ColumnConfig<Codelist, String> agencyIdColumn = new ColumnConfig<Codelist, String>(properties.agencyId(), 50, "Agency Id");
|
|
||||||
protected static final ColumnConfig<Codelist, String> versionColumn = new ColumnConfig<Codelist, String>(properties.version(), 50, "Version");
|
|
||||||
protected static final ColumnConfig<Codelist, String> descriptionColumn = new ColumnConfig<Codelist, String>(properties.description(), 50, "Description");
|
|
||||||
|
|
||||||
protected Grid<Codelist> grid;
|
|
||||||
protected ResourceBundle res;
|
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public CodelistSelectionPanel(ResourceBundle res)
|
|
||||||
{
|
|
||||||
this.res=res;
|
|
||||||
setHeaderVisible(false);
|
|
||||||
new Resizable(this, Dir.E, Dir.SE, Dir.S);
|
|
||||||
buildPanel(properties.key(), Arrays.<ColumnConfig<Codelist, ?>>asList(nameColumn, agencyIdColumn, versionColumn, descriptionColumn), nameColumn);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected void buildPanel(ModelKeyProvider<Codelist> keyProvider, List<ColumnConfig<Codelist, ?>> columns, ColumnConfig<Codelist, ?> autoexpandColumn)
|
|
||||||
{
|
|
||||||
|
|
||||||
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_16());
|
|
||||||
btnReload.setToolTip("Reload");
|
|
||||||
toolBar.add(btnReload);
|
|
||||||
|
|
||||||
|
|
||||||
IdentityValueProvider<Codelist> identity = new IdentityValueProvider<Codelist>();
|
|
||||||
final CheckBoxSelectionModel<Codelist> sm = new CheckBoxSelectionModel<Codelist>(identity);
|
|
||||||
|
|
||||||
ColumnModel<Codelist> cm = new ColumnModel<Codelist>(columns);
|
|
||||||
|
|
||||||
final ExtendedListStore<Codelist> store = new ExtendedListStore<Codelist>(keyProvider);
|
|
||||||
|
|
||||||
searchField.addKeyUpHandler(new KeyUpHandler() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onKeyUp(KeyUpEvent event) {
|
|
||||||
Log.trace("searchTerm: "+searchField.getCurrentValue());
|
|
||||||
store.applyFilters();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
store.addFilter(new StoreFilter<Codelist>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean select(Store<Codelist> store, Codelist parent, Codelist item) {
|
|
||||||
String searchTerm = searchField.getCurrentValue();
|
|
||||||
if (searchTerm == null) return true;
|
|
||||||
return CodelistSelectionPanel.this.select(item, searchTerm);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
store.setEnableFilters(true);
|
|
||||||
|
|
||||||
RpcProxy<ListLoadConfig, ListLoadResult<Codelist>> proxy = new RpcProxy<ListLoadConfig, ListLoadResult<Codelist>>() {
|
|
||||||
|
|
||||||
|
|
||||||
public void load(ListLoadConfig loadConfig, final AsyncCallback<ListLoadResult<Codelist>> callback) {
|
|
||||||
loadData(loadConfig, callback);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
final ListLoader<ListLoadConfig, ListLoadResult<Codelist>> loader = new ListLoader<ListLoadConfig, ListLoadResult<Codelist>>(proxy);
|
|
||||||
|
|
||||||
loader.setRemoteSort(false);
|
|
||||||
loader.addLoadHandler(new LoadResultListStoreBinding<ListLoadConfig, Codelist, ListLoadResult<Codelist>>(store));
|
|
||||||
|
|
||||||
grid = new Grid<Codelist>(store, cm){
|
|
||||||
@Override
|
|
||||||
protected void onAfterFirstAttach() {
|
|
||||||
super.onAfterFirstAttach();
|
|
||||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
|
||||||
@Override
|
|
||||||
public void execute() {
|
|
||||||
loader.load();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
sm.setSelectionMode(SelectionMode.SINGLE);
|
|
||||||
grid.setLoader(loader);
|
|
||||||
grid.setSelectionModel(sm);
|
|
||||||
grid.getView().setAutoExpandColumn(autoexpandColumn);
|
|
||||||
grid.getView().setStripeRows(true);
|
|
||||||
grid.getView().setColumnLines(true);
|
|
||||||
grid.getView().setAutoFill(true);
|
|
||||||
grid.setBorders(false);
|
|
||||||
grid.setLoadMask(true);
|
|
||||||
grid.setColumnReordering(true);
|
|
||||||
|
|
||||||
SelectHandler sh = new SelectHandler() {
|
|
||||||
@Override
|
|
||||||
public void onSelect(SelectEvent event) {
|
|
||||||
loader.load();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
btnReload.addSelectHandler(sh);
|
|
||||||
|
|
||||||
VerticalLayoutContainer con = new VerticalLayoutContainer();
|
|
||||||
con.add(toolBar, new VerticalLayoutData(1, -1));
|
|
||||||
con.add(grid, new VerticalLayoutData(1, 1));
|
|
||||||
setWidget(con);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected boolean select(Codelist item, String searchTerm) {
|
|
||||||
if (item.getName()!=null && item.getName().toLowerCase().contains(searchTerm.toLowerCase())) return true;
|
|
||||||
if (item.getAgencyId()!=null &&item.getAgencyId().toLowerCase().contains(searchTerm.toLowerCase())) return true;
|
|
||||||
if (item.getVersion()!=null && item.getVersion().toLowerCase().contains(searchTerm.toLowerCase())) return true;
|
|
||||||
if (item.getDescription()!=null && item.getDescription().toLowerCase().contains(searchTerm.toLowerCase())) return true;
|
|
||||||
if (item.getId()!=null &&item.getId().toLowerCase().contains(searchTerm.toLowerCase())) return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected void loadData(ListLoadConfig loadConfig, final AsyncCallback<ListLoadResult<Codelist>> callback) {
|
|
||||||
TDGWTServiceAsync.INSTANCE.getCodelists(new AsyncCallback<ArrayList<Codelist>>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
callback.onFailure(caught);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(ArrayList<Codelist> result) {
|
|
||||||
Log.trace("loaded "+result.size()+" codelists");
|
|
||||||
callback.onSuccess(new ListLoadResultBean<Codelist>(result));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HandlerRegistration addSelectionHandler(SelectionHandler<Codelist> handler) {
|
|
||||||
return grid.getSelectionModel().addSelectionHandler(handler);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Codelist getSelectedItem() {
|
|
||||||
return grid.getSelectionModel().getSelectedItem();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected class ExtendedListStore<M> extends ListStore<M> {
|
|
||||||
|
|
||||||
public ExtendedListStore(ModelKeyProvider<? super M> keyProvider) {
|
|
||||||
super(keyProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void applyFilters()
|
|
||||||
{
|
|
||||||
super.applyFilters();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,29 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.gcube.portlets.user.sdmximportwizardtd.client;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.Dataset;
|
|
||||||
|
|
||||||
import com.google.gwt.editor.client.Editor.Path;
|
|
||||||
import com.sencha.gxt.core.client.ValueProvider;
|
|
||||||
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
|
||||||
import com.sencha.gxt.data.shared.PropertyAccess;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public interface DatasetProperties extends PropertyAccess<Dataset> {
|
|
||||||
|
|
||||||
@Path("id")
|
|
||||||
ModelKeyProvider<Dataset> key();
|
|
||||||
|
|
||||||
ValueProvider<Dataset, String> name();
|
|
||||||
ValueProvider<Dataset, String> agencyId();
|
|
||||||
ValueProvider<Dataset, String> version();
|
|
||||||
ValueProvider<Dataset, String> description();
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,203 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.gcube.portlets.user.sdmximportwizardtd.client;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.Dataset;
|
|
||||||
|
|
||||||
|
|
||||||
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.HasSelectionHandlers;
|
|
||||||
import com.google.gwt.event.logical.shared.SelectionHandler;
|
|
||||||
import com.google.gwt.event.shared.HandlerRegistration;
|
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
|
||||||
import com.sencha.gxt.core.client.IdentityValueProvider;
|
|
||||||
import com.sencha.gxt.data.client.loader.RpcProxy;
|
|
||||||
import com.sencha.gxt.data.shared.ListStore;
|
|
||||||
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
|
||||||
import com.sencha.gxt.data.shared.Store;
|
|
||||||
import com.sencha.gxt.data.shared.Store.StoreFilter;
|
|
||||||
import com.sencha.gxt.data.shared.loader.ListLoadConfig;
|
|
||||||
import com.sencha.gxt.data.shared.loader.ListLoadResult;
|
|
||||||
import com.sencha.gxt.data.shared.loader.ListLoadResultBean;
|
|
||||||
import com.sencha.gxt.data.shared.loader.ListLoader;
|
|
||||||
import com.sencha.gxt.data.shared.loader.LoadResultListStoreBinding;
|
|
||||||
import com.sencha.gxt.widget.core.client.ContentPanel;
|
|
||||||
import com.sencha.gxt.widget.core.client.Resizable;
|
|
||||||
import com.sencha.gxt.widget.core.client.Resizable.Dir;
|
|
||||||
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.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.toolbar.LabelToolItem;
|
|
||||||
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author "Giancarlo Panichi"
|
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class DatasetSelectionPanel extends ContentPanel implements HasSelectionHandlers<Dataset> {
|
|
||||||
|
|
||||||
private static final DatasetProperties properties = GWT.create(DatasetProperties.class);
|
|
||||||
|
|
||||||
protected static final ColumnConfig<Dataset, String> nameColumn = new ColumnConfig<Dataset, String>(properties.name(), 50, "Name");
|
|
||||||
protected static final ColumnConfig<Dataset, String> agencyIdColumn = new ColumnConfig<Dataset, String>(properties.agencyId(), 50, "Agency Id");
|
|
||||||
protected static final ColumnConfig<Dataset, String> versionColumn = new ColumnConfig<Dataset, String>(properties.version(), 50, "Version");
|
|
||||||
protected static final ColumnConfig<Dataset, String> descriptionColumn = new ColumnConfig<Dataset, String>(properties.description(), 50, "Description");
|
|
||||||
|
|
||||||
protected Grid<Dataset> grid;
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public DatasetSelectionPanel()
|
|
||||||
{
|
|
||||||
setHeaderVisible(false);
|
|
||||||
new Resizable(this, Dir.E, Dir.SE, Dir.S);
|
|
||||||
buildPanel(properties.key(), Arrays.<ColumnConfig<Dataset, ?>>asList(nameColumn, agencyIdColumn, versionColumn, descriptionColumn), nameColumn);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected void buildPanel(ModelKeyProvider<Dataset> keyProvider, List<ColumnConfig<Dataset, ?>> columns, ColumnConfig<Dataset, ?> autoexpandColumn)
|
|
||||||
{
|
|
||||||
|
|
||||||
ToolBar toolBar = new ToolBar();
|
|
||||||
toolBar.add(new LabelToolItem("Search: "));
|
|
||||||
final TextField searchField = new TextField();
|
|
||||||
toolBar.add(searchField);
|
|
||||||
|
|
||||||
IdentityValueProvider<Dataset> identity = new IdentityValueProvider<Dataset>();
|
|
||||||
final CheckBoxSelectionModel<Dataset> sm = new CheckBoxSelectionModel<Dataset>(identity);
|
|
||||||
|
|
||||||
ColumnModel<Dataset> cm = new ColumnModel<Dataset>(columns);
|
|
||||||
|
|
||||||
final ExtendedListStore<Dataset> store = new ExtendedListStore<Dataset>(keyProvider);
|
|
||||||
|
|
||||||
searchField.addKeyUpHandler(new KeyUpHandler() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onKeyUp(KeyUpEvent event) {
|
|
||||||
Log.trace("searchTerm: "+searchField.getCurrentValue());
|
|
||||||
store.applyFilters();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
store.addFilter(new StoreFilter<Dataset>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean select(Store<Dataset> store, Dataset parent, Dataset item) {
|
|
||||||
String searchTerm = searchField.getCurrentValue();
|
|
||||||
if (searchTerm == null) return true;
|
|
||||||
return DatasetSelectionPanel.this.select(item, searchTerm);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
store.setEnableFilters(true);
|
|
||||||
|
|
||||||
RpcProxy<ListLoadConfig, ListLoadResult<Dataset>> proxy = new RpcProxy<ListLoadConfig, ListLoadResult<Dataset>>() {
|
|
||||||
|
|
||||||
|
|
||||||
public void load(ListLoadConfig loadConfig, final AsyncCallback<ListLoadResult<Dataset>> callback) {
|
|
||||||
loadData(loadConfig, callback);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
final ListLoader<ListLoadConfig, ListLoadResult<Dataset>> loader = new ListLoader<ListLoadConfig, ListLoadResult<Dataset>>(proxy);
|
|
||||||
|
|
||||||
loader.setRemoteSort(false);
|
|
||||||
loader.addLoadHandler(new LoadResultListStoreBinding<ListLoadConfig, Dataset, ListLoadResult<Dataset>>(store));
|
|
||||||
|
|
||||||
grid = new Grid<Dataset>(store, cm){
|
|
||||||
@Override
|
|
||||||
protected void onAfterFirstAttach() {
|
|
||||||
super.onAfterFirstAttach();
|
|
||||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
|
||||||
@Override
|
|
||||||
public void execute() {
|
|
||||||
loader.load();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
grid.setLoader(loader);
|
|
||||||
grid.setSelectionModel(sm);
|
|
||||||
grid.getView().setAutoExpandColumn(autoexpandColumn);
|
|
||||||
grid.getView().setStripeRows(true);
|
|
||||||
grid.getView().setColumnLines(true);
|
|
||||||
grid.getView().setAutoFill(true);
|
|
||||||
grid.setBorders(false);
|
|
||||||
grid.setLoadMask(true);
|
|
||||||
|
|
||||||
grid.setColumnReordering(true);
|
|
||||||
|
|
||||||
VerticalLayoutContainer con = new VerticalLayoutContainer();
|
|
||||||
con.add(toolBar, new VerticalLayoutData(1, -1));
|
|
||||||
con.add(grid, new VerticalLayoutData(1, 1));
|
|
||||||
setWidget(con);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected boolean select(Dataset item, String searchTerm) {
|
|
||||||
if (item.getName()!=null && item.getName().toLowerCase().contains(searchTerm.toLowerCase())) return true;
|
|
||||||
if (item.getAgencyId()!=null &&item.getAgencyId().toLowerCase().contains(searchTerm.toLowerCase())) return true;
|
|
||||||
if (item.getId()!=null &&item.getId().toLowerCase().contains(searchTerm.toLowerCase())) return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected void loadData(ListLoadConfig loadConfig, final AsyncCallback<ListLoadResult<Dataset>> callback) {
|
|
||||||
TDGWTServiceAsync.INSTANCE.getDatasets(new AsyncCallback<ArrayList<Dataset>>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
callback.onFailure(caught);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(ArrayList<Dataset> result) {
|
|
||||||
Log.trace("loaded "+result.size()+" datasets");
|
|
||||||
callback.onSuccess(new ListLoadResultBean<Dataset>(result));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HandlerRegistration addSelectionHandler(SelectionHandler<Dataset> handler) {
|
|
||||||
return grid.getSelectionModel().addSelectionHandler(handler);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public List<Dataset> getSelectedItems() {
|
|
||||||
return grid.getSelectionModel().getSelectedItems();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected class ExtendedListStore<M> extends ListStore<M> {
|
|
||||||
|
|
||||||
public ExtendedListStore(ModelKeyProvider<? super M> keyProvider) {
|
|
||||||
super(keyProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void applyFilters()
|
|
||||||
{
|
|
||||||
super.applyFilters();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,87 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.gcube.portlets.user.sdmximportwizardtd.client;
|
|
||||||
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.Codelist;
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportSession;
|
|
||||||
import org.gcube.portlets.user.td.sdmximportwidget.client.general.WizardCard;
|
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
|
||||||
import com.google.gwt.event.logical.shared.SelectionEvent;
|
|
||||||
import com.google.gwt.event.logical.shared.SelectionHandler;
|
|
||||||
import com.google.gwt.user.client.Command;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author "Giancarlo Panichi"
|
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class SDMXCodelistSelectionCard extends WizardCard {
|
|
||||||
|
|
||||||
protected SDMXCodelistSelectionCard thisCard;
|
|
||||||
protected SDMXImportSession importSession;
|
|
||||||
protected CodelistSelectionPanel codelistSelectionPanel;
|
|
||||||
protected Codelist selectedCodelist=null;
|
|
||||||
public SDMXCodelistSelectionCard(final SDMXImportSession importSession) {
|
|
||||||
super("SDMX Codelist selection", "");
|
|
||||||
|
|
||||||
this.importSession = importSession;
|
|
||||||
thisCard=this;
|
|
||||||
|
|
||||||
this.codelistSelectionPanel=new CodelistSelectionPanel(res);
|
|
||||||
|
|
||||||
codelistSelectionPanel.addSelectionHandler(new SelectionHandler<Codelist>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSelection(SelectionEvent<Codelist> event) {
|
|
||||||
importSession.setSelectedCodelist(codelistSelectionPanel.getSelectedItem());
|
|
||||||
getWizardWindow().setEnableNextButton(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
setContent(codelistSelectionPanel);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setup(){
|
|
||||||
Command sayNextCard = new Command() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute() {
|
|
||||||
SDMXTableDetailCard sdmxTableDetailCard = new SDMXTableDetailCard(
|
|
||||||
importSession);
|
|
||||||
getWizardWindow()
|
|
||||||
.addCard(sdmxTableDetailCard);
|
|
||||||
Log.info("NextCard SDMXTableDetailCard");
|
|
||||||
getWizardWindow().nextCard();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
getWizardWindow().setNextButtonCommand(sayNextCard);
|
|
||||||
|
|
||||||
|
|
||||||
Command sayPreviousCard = new Command() {
|
|
||||||
public void execute() {
|
|
||||||
try {
|
|
||||||
getWizardWindow().previousCard();
|
|
||||||
getWizardWindow().removeCard(thisCard);
|
|
||||||
Log.info("Remove SDMXCodelistSelectionCard");
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.error("sayPreviousCard :" + e.getLocalizedMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
|
|
||||||
getWizardWindow().setEnableNextButton(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,57 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.gcube.portlets.user.sdmximportwizardtd.client;
|
|
||||||
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportSession;
|
|
||||||
import org.gcube.portlets.user.td.sdmximportwidget.client.general.WizardCard;
|
|
||||||
|
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
|
||||||
import com.google.gwt.user.client.Command;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author "Giancarlo Panichi"
|
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class SDMXDatasetSelectionCard extends WizardCard {
|
|
||||||
|
|
||||||
protected SDMXDatasetSelectionCard thisCard;
|
|
||||||
protected SDMXImportSession importSession;
|
|
||||||
protected DatasetSelectionPanel datasetSelectionPanel;
|
|
||||||
|
|
||||||
public SDMXDatasetSelectionCard(final SDMXImportSession importSession) {
|
|
||||||
super("SDMX Dataset selection", "");
|
|
||||||
|
|
||||||
this.importSession = importSession;
|
|
||||||
|
|
||||||
thisCard=this;
|
|
||||||
|
|
||||||
this.datasetSelectionPanel=new DatasetSelectionPanel();
|
|
||||||
|
|
||||||
setContent(datasetSelectionPanel);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setup(){
|
|
||||||
Command sayPreviousCard = new Command() {
|
|
||||||
public void execute() {
|
|
||||||
try {
|
|
||||||
getWizardWindow().previousCard();
|
|
||||||
getWizardWindow().removeCard(thisCard);
|
|
||||||
Log.info("Remove SDMXDatasetSelectionCard");
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.error("sayPreviousCard :" + e.getLocalizedMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,100 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.gcube.portlets.user.sdmximportwizardtd.client;
|
|
||||||
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.document.CodelistDocument;
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.document.DatasetDocument;
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportSession;
|
|
||||||
import org.gcube.portlets.user.td.sdmximportwidget.client.general.WizardCard;
|
|
||||||
|
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
|
||||||
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
|
||||||
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
|
||||||
import com.google.gwt.user.client.ui.HasValue;
|
|
||||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
|
||||||
import com.sencha.gxt.core.client.util.ToggleGroup;
|
|
||||||
import com.sencha.gxt.widget.core.client.form.Radio;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author "Giancarlo Panichi"
|
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class SDMXDocumentSelectionCard extends WizardCard {
|
|
||||||
|
|
||||||
protected final SDMXImportSession importSession;
|
|
||||||
|
|
||||||
final CodelistDocument codelist= CodelistDocument.INSTANCE;
|
|
||||||
final DatasetDocument dataset= DatasetDocument.INSTANCE;
|
|
||||||
|
|
||||||
public SDMXDocumentSelectionCard(final SDMXImportSession importSession) {
|
|
||||||
super("SDMX document selection", "");
|
|
||||||
|
|
||||||
this.importSession = importSession;
|
|
||||||
//Default
|
|
||||||
importSession.setSDMXDocument(codelist);
|
|
||||||
|
|
||||||
VerticalPanel documentSelectionPanel = new VerticalPanel();
|
|
||||||
documentSelectionPanel.setStylePrimaryName(res.sdmxImportCss().getImportSelectionSources());
|
|
||||||
|
|
||||||
Radio radioCodelist = new Radio();
|
|
||||||
|
|
||||||
radioCodelist.setBoxLabel("<p style='display:inline-table;'><b>"+codelist.getName()+"</b><br>"+codelist.getDescription()+"</p>");
|
|
||||||
radioCodelist.setValue(true);
|
|
||||||
radioCodelist.setName(codelist.getName());
|
|
||||||
radioCodelist.setStylePrimaryName(res.sdmxImportCss().getImportSelectionSource());
|
|
||||||
|
|
||||||
|
|
||||||
Radio radioDataSet = new Radio();
|
|
||||||
radioDataSet.setBoxLabel("<p style='display:inline-table;'><b>"+dataset.getName()+"</b><br>"+dataset.getDescription()+"</p>");
|
|
||||||
radioDataSet.setName(dataset.getName());
|
|
||||||
radioDataSet.setStylePrimaryName(res.sdmxImportCss().getImportSelectionSource());
|
|
||||||
radioDataSet.disable();
|
|
||||||
|
|
||||||
documentSelectionPanel.add(radioCodelist);
|
|
||||||
documentSelectionPanel.add(radioDataSet);
|
|
||||||
|
|
||||||
|
|
||||||
// we can set name on radios or use toggle group
|
|
||||||
ToggleGroup toggle = new ToggleGroup();
|
|
||||||
toggle.add(radioCodelist);
|
|
||||||
toggle.add(radioDataSet);
|
|
||||||
|
|
||||||
toggle.addValueChangeHandler(new ValueChangeHandler<HasValue<Boolean>>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onValueChange(ValueChangeEvent<HasValue<Boolean>> event) {
|
|
||||||
try {
|
|
||||||
ToggleGroup group = (ToggleGroup) event.getSource();
|
|
||||||
Radio radio = (Radio) group.getValue();
|
|
||||||
Log.info("Document Selected:" + radio.getName());
|
|
||||||
if (radio.getName().compareTo(codelist.getName()) == 0) {
|
|
||||||
importSession.setSDMXDocument(codelist);
|
|
||||||
} else {
|
|
||||||
if (radio.getName().compareTo(dataset.getName()) == 0) {
|
|
||||||
importSession.setSDMXDocument(dataset);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.error("ToggleGroup: onValueChange " + e.getLocalizedMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
setContent(documentSelectionPanel);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,42 +0,0 @@
|
||||||
package org.gcube.portlets.user.sdmximportwizardtd.client;
|
|
||||||
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportSession;
|
|
||||||
import org.gcube.portlets.user.td.sdmximportwidget.client.general.WizardWindow;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Entry point classes define <code>onModuleLoad()</code>.
|
|
||||||
*/
|
|
||||||
public class SDMXImportWizardTD extends WizardWindow {
|
|
||||||
|
|
||||||
protected SDMXImportSession importSession;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The id of the {@link CSVTarget} to use.
|
|
||||||
* @param targetId
|
|
||||||
*/
|
|
||||||
|
|
||||||
public SDMXImportWizardTD(String title) {
|
|
||||||
super(title);
|
|
||||||
setWidth(550);
|
|
||||||
setHeight(520);
|
|
||||||
|
|
||||||
importSession= new SDMXImportSession();
|
|
||||||
|
|
||||||
|
|
||||||
SDMXDocumentSelectionCard sdmxdocumentSelection= new SDMXDocumentSelectionCard(importSession);
|
|
||||||
addCard(sdmxdocumentSelection);
|
|
||||||
|
|
||||||
SourceSelectionCard sourceSelection= new SourceSelectionCard(importSession);
|
|
||||||
addCard(sourceSelection);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
package org.gcube.portlets.user.sdmximportwizardtd.client;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
|
||||||
import com.google.gwt.core.client.EntryPoint;
|
|
||||||
|
|
||||||
public class SDMXImportWizardTDEntry implements EntryPoint {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onModuleLoad() {
|
|
||||||
SDMXImportWizardTD importWizard= new SDMXImportWizardTD("SDMXImport");
|
|
||||||
Log.info(importWizard.getId());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,203 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.gcube.portlets.user.sdmximportwizardtd.client;
|
|
||||||
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.TRId;
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportSession;
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.source.SDMXRegistrySource;
|
|
||||||
import org.gcube.portlets.user.td.sdmximportwidget.client.general.WizardCard;
|
|
||||||
import org.gcube.portlets.user.td.sdmximportwidget.client.progress.ImportProgressBarUpdater;
|
|
||||||
import org.gcube.portlets.user.td.sdmximportwidget.client.progress.OperationProgressListener;
|
|
||||||
import org.gcube.portlets.user.td.sdmximportwidget.client.progress.OperationProgressUpdater;
|
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
|
||||||
import com.google.gwt.user.client.Command;
|
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
|
||||||
import com.google.gwt.user.client.ui.FlexTable;
|
|
||||||
import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
|
|
||||||
import com.google.gwt.user.client.ui.HasVerticalAlignment;
|
|
||||||
import com.sencha.gxt.core.client.util.Margins;
|
|
||||||
import com.sencha.gxt.widget.core.client.FramedPanel;
|
|
||||||
import com.sencha.gxt.widget.core.client.ProgressBar;
|
|
||||||
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
|
|
||||||
import com.sencha.gxt.widget.core.client.container.VBoxLayoutContainer;
|
|
||||||
import com.sencha.gxt.widget.core.client.container.VBoxLayoutContainer.VBoxLayoutAlign;
|
|
||||||
|
|
||||||
//import com.allen_sauer.gwt.log.client.Log;
|
|
||||||
//import com.google.gwt.user.client.Command;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author "Giancarlo Panichi" <a
|
|
||||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class SDMXOperationInProgressCard extends WizardCard implements
|
|
||||||
OperationProgressListener {
|
|
||||||
|
|
||||||
public static final int STATUS_POLLING_DELAY = 1000;
|
|
||||||
protected SDMXOperationInProgressCard thisCard;
|
|
||||||
protected SDMXImportSession importSession;
|
|
||||||
protected OperationProgressUpdater progressUpdater;
|
|
||||||
|
|
||||||
public SDMXOperationInProgressCard(final SDMXImportSession importSession) {
|
|
||||||
super("Operation In Progress", "");
|
|
||||||
|
|
||||||
this.importSession = importSession;
|
|
||||||
thisCard = this;
|
|
||||||
|
|
||||||
VBoxLayoutContainer operationInProgressPanel = new VBoxLayoutContainer();
|
|
||||||
operationInProgressPanel.setVBoxLayoutAlign(VBoxLayoutAlign.CENTER);
|
|
||||||
|
|
||||||
final FlexTable description = new FlexTable();
|
|
||||||
FlexCellFormatter cellFormatter = description.getFlexCellFormatter();
|
|
||||||
description.setCellSpacing(10);
|
|
||||||
description.setCellPadding(4);
|
|
||||||
description.setBorderWidth(0);
|
|
||||||
|
|
||||||
// display:block;vertical-align:text-top;
|
|
||||||
description.setHTML(0, 0,
|
|
||||||
"<span style=\"font-weight:bold;\";>Document: </span>");
|
|
||||||
description.setText(0, 1, importSession.getSDMXDocument().getName());
|
|
||||||
description.setHTML(1, 0,
|
|
||||||
"<span style=\"font-weight:bold;\";>Source: </span>");
|
|
||||||
description.setText(1, 1, importSession.getSource().getName());
|
|
||||||
|
|
||||||
if (importSession.getSource().getId().compareTo("SDMXRegistry") == 0) {
|
|
||||||
description.setHTML(2, 0,
|
|
||||||
"<span style=\"font-weight:bold;\";>Url: </span>");
|
|
||||||
description
|
|
||||||
.setText(
|
|
||||||
2,
|
|
||||||
1,
|
|
||||||
((SDMXRegistrySource) importSession.getSource())
|
|
||||||
.getUrl() == null ? "Internal"
|
|
||||||
: ((SDMXRegistrySource) importSession
|
|
||||||
.getSource()).getUrl());
|
|
||||||
if (importSession.getSDMXDocument().getId().compareTo("codelist") == 0) {
|
|
||||||
cellFormatter.setVerticalAlignment(3, 0,
|
|
||||||
HasVerticalAlignment.ALIGN_TOP);
|
|
||||||
description
|
|
||||||
.setHTML(3, 0,
|
|
||||||
"<span style=\"font-weight:bold;\";>Codelist Selected: </span>");
|
|
||||||
final FlexTable codelistDescription = new FlexTable();
|
|
||||||
codelistDescription.setBorderWidth(0);
|
|
||||||
codelistDescription.setCellPadding(4);
|
|
||||||
codelistDescription.setCellSpacing(10);
|
|
||||||
|
|
||||||
codelistDescription
|
|
||||||
.setHTML(0, 0,
|
|
||||||
"<span style=\"text-decoration:underline;margin-right:5px;\";>Id: </span>");
|
|
||||||
codelistDescription.setText(0, 1, importSession
|
|
||||||
.getSelectedCodelist().getId());
|
|
||||||
codelistDescription
|
|
||||||
.setHTML(1, 0,
|
|
||||||
"<span style=\"text-decoration:underline;margin-right:5px;\";>Name: </span>");
|
|
||||||
codelistDescription.setText(1, 1, importSession
|
|
||||||
.getSelectedCodelist().getName());
|
|
||||||
codelistDescription
|
|
||||||
.setHTML(2, 0,
|
|
||||||
"<span style=\"text-decoration:underline;margin-right:5px;\";>Agency: </span>");
|
|
||||||
codelistDescription.setText(2, 1, importSession
|
|
||||||
.getSelectedCodelist().getAgencyId());
|
|
||||||
codelistDescription
|
|
||||||
.setHTML(3, 0,
|
|
||||||
"<span style=\"text-decoration:underline;margin-right:5px;\";>Version: </span>");
|
|
||||||
codelistDescription.setText(3, 1, importSession
|
|
||||||
.getSelectedCodelist().getVersion());
|
|
||||||
|
|
||||||
description.setWidget(3, 1, codelistDescription);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FramedPanel summary = new FramedPanel();
|
|
||||||
summary.setHeadingText("Import Summary");
|
|
||||||
summary.setWidth(400);
|
|
||||||
summary.add(description);
|
|
||||||
operationInProgressPanel.add(summary, new BoxLayoutData(new Margins(20,
|
|
||||||
5, 10, 5)));
|
|
||||||
|
|
||||||
ProgressBar progressBar = new ProgressBar();
|
|
||||||
operationInProgressPanel.add(progressBar, new BoxLayoutData(
|
|
||||||
new Margins(10, 5, 10, 5)));
|
|
||||||
|
|
||||||
progressUpdater = new OperationProgressUpdater();
|
|
||||||
progressUpdater.addListener(new ImportProgressBarUpdater(progressBar));
|
|
||||||
|
|
||||||
progressUpdater.addListener(this);
|
|
||||||
|
|
||||||
setContent(operationInProgressPanel);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void importSDMX() {
|
|
||||||
TDGWTServiceAsync.INSTANCE.importSDMXClientLibraryRequest(
|
|
||||||
importSession, new AsyncCallback<Void>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(Void result) {
|
|
||||||
progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
showErrorAndHide("Error in importSDMX",
|
|
||||||
"An error occured in importSDMX", "", caught);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setup() {
|
|
||||||
getWizardWindow().setEnableBackButton(false);
|
|
||||||
setBackButtonVisible(false);
|
|
||||||
setNextButtonVisible(false);
|
|
||||||
getWizardWindow().setEnableNextButton(false);
|
|
||||||
getWizardWindow().setNextButtonToFinish();
|
|
||||||
importSDMX();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void operationInitializing() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void operationUpdate(float elaborated) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void operationComplete(final TRId trId) {
|
|
||||||
// final String tableId,final String tableResourceId) {
|
|
||||||
|
|
||||||
Command sayComplete = new Command() {
|
|
||||||
public void execute() {
|
|
||||||
try {
|
|
||||||
getWizardWindow().close(false);
|
|
||||||
Log.info("fire Complete: tabular resource " + trId.getId());
|
|
||||||
Log.info("fire Complete: tableId " + trId.getTableId());
|
|
||||||
|
|
||||||
getWizardWindow().fireCompleted(trId);
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.error("fire Complete :" + e.getLocalizedMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
getWizardWindow().setNextButtonCommand(sayComplete);
|
|
||||||
|
|
||||||
setNextButtonVisible(true);
|
|
||||||
getWizardWindow().setEnableNextButton(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void operationFailed(Throwable caught, String reason,
|
|
||||||
String failureDetails) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,210 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.gcube.portlets.user.sdmximportwizardtd.client;
|
|
||||||
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportSession;
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.source.SDMXRegistrySource;
|
|
||||||
import org.gcube.portlets.user.td.sdmximportwidget.client.general.WizardCard;
|
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
|
||||||
import com.google.gwt.dom.client.Element;
|
|
||||||
import com.google.gwt.dom.client.NodeList;
|
|
||||||
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
|
||||||
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
|
||||||
import com.google.gwt.user.client.Command;
|
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
|
||||||
import com.google.gwt.user.client.ui.HasValue;
|
|
||||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
|
||||||
import com.sencha.gxt.core.client.util.ToggleGroup;
|
|
||||||
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.form.FieldLabel;
|
|
||||||
import com.sencha.gxt.widget.core.client.form.Radio;
|
|
||||||
import com.sencha.gxt.widget.core.client.form.TextField;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author "Giancarlo Panichi" <a
|
|
||||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class SDMXRegistrySelectionCard extends WizardCard {
|
|
||||||
|
|
||||||
protected SDMXImportSession importSession;
|
|
||||||
protected SDMXRegistrySelectionCard thisCard;
|
|
||||||
|
|
||||||
final TextField url = new TextField();
|
|
||||||
|
|
||||||
public SDMXRegistrySelectionCard(final SDMXImportSession importSession) {
|
|
||||||
super("SDMX Registry selection", "");
|
|
||||||
|
|
||||||
this.importSession = importSession;
|
|
||||||
thisCard = this;
|
|
||||||
|
|
||||||
VerticalPanel registrySelectionPanel = new VerticalPanel();
|
|
||||||
registrySelectionPanel.setStylePrimaryName(res.sdmxImportCss()
|
|
||||||
.getImportSelectionSources());
|
|
||||||
|
|
||||||
Radio radioStandardRegistry = new Radio();
|
|
||||||
|
|
||||||
radioStandardRegistry
|
|
||||||
.setBoxLabel("<p style='display:inline-table;'><b>Internal SDMX Registry</b>"
|
|
||||||
+ "<br>Select this if you want use the Internal Registry</p>");
|
|
||||||
radioStandardRegistry.setValue(true);
|
|
||||||
radioStandardRegistry.setName("Default");
|
|
||||||
radioStandardRegistry.setStylePrimaryName(res.sdmxImportCss()
|
|
||||||
.getImportSelectionSource());
|
|
||||||
|
|
||||||
Radio radioUrlRegistry = new Radio();
|
|
||||||
radioUrlRegistry
|
|
||||||
.setBoxLabel("<p style='display:inline-table;'><b>Another SDMX Registry</b><br><SPAN id='SDMXRegistryUrl'></SPAN></p>");
|
|
||||||
radioUrlRegistry.setName("Url");
|
|
||||||
radioUrlRegistry.setStylePrimaryName(res.sdmxImportCss()
|
|
||||||
.getImportSelectionSource());
|
|
||||||
|
|
||||||
url.setName("sdmxRegistryUrlInpuntField");
|
|
||||||
url.setId("sdmxRegistryUrlInputFieldId");
|
|
||||||
url.setStylePrimaryName(res.sdmxImportCss()
|
|
||||||
.getSDMXRegistryUrlInputStyle());
|
|
||||||
|
|
||||||
final VerticalLayoutContainer vcontainer = new VerticalLayoutContainer();
|
|
||||||
vcontainer.add(new FieldLabel(url, "URL"), new VerticalLayoutData(-1,
|
|
||||||
-1));
|
|
||||||
vcontainer.setStylePrimaryName(res.sdmxImportCss()
|
|
||||||
.getSDMXRegistryUrlStyle());
|
|
||||||
vcontainer.setVisible(false);
|
|
||||||
|
|
||||||
NodeList<Element> nodel = radioUrlRegistry.getElement()
|
|
||||||
.getElementsByTagName("SPAN");
|
|
||||||
Element span = nodel.getItem(0);
|
|
||||||
span.appendChild(vcontainer.getElement());
|
|
||||||
|
|
||||||
registrySelectionPanel.add(radioStandardRegistry);
|
|
||||||
registrySelectionPanel.add(radioUrlRegistry);
|
|
||||||
|
|
||||||
// we can set name on radios or use toggle group
|
|
||||||
ToggleGroup toggle = new ToggleGroup();
|
|
||||||
toggle.add(radioStandardRegistry);
|
|
||||||
toggle.add(radioUrlRegistry);
|
|
||||||
|
|
||||||
toggle.addValueChangeHandler(new ValueChangeHandler<HasValue<Boolean>>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onValueChange(ValueChangeEvent<HasValue<Boolean>> event) {
|
|
||||||
try {
|
|
||||||
ToggleGroup group = (ToggleGroup) event.getSource();
|
|
||||||
Radio radio = (Radio) group.getValue();
|
|
||||||
Log.info("Registry Selected:" + radio.getName());
|
|
||||||
if (radio.getName().compareTo("Url") == 0) {
|
|
||||||
vcontainer.setVisible(true);
|
|
||||||
NodeList<Element> nodel = radio.getElement()
|
|
||||||
.getElementsByTagName("SPAN");
|
|
||||||
Element span = nodel.getItem(0);
|
|
||||||
span.appendChild(vcontainer.getElement());
|
|
||||||
|
|
||||||
Log.info("SDMXRegistry Url");
|
|
||||||
Log.info("Input value: " + url.getCurrentValue());
|
|
||||||
SDMXRegistrySource r = ((SDMXRegistrySource) importSession
|
|
||||||
.getSource());
|
|
||||||
r.setUrl(null);
|
|
||||||
Log.info("" + importSession.getSource());
|
|
||||||
} else {
|
|
||||||
vcontainer.setVisible(false);
|
|
||||||
Log.info("SDMXRegistry Default");
|
|
||||||
SDMXRegistrySource r = ((SDMXRegistrySource) importSession
|
|
||||||
.getSource());
|
|
||||||
r.setUrl(null);
|
|
||||||
Log.info("Input value: " + url.getCurrentValue());
|
|
||||||
Log.info("" + importSession.getSource());
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.error("ToggleGroup: onValueChange "
|
|
||||||
+ e.getLocalizedMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
setContent(registrySelectionPanel);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setup() {
|
|
||||||
Command sayNextCard = new Command() {
|
|
||||||
public void execute() {
|
|
||||||
try {
|
|
||||||
Log.info("Input value: " + url.getCurrentValue());
|
|
||||||
if (importSession.getSource() instanceof SDMXRegistrySource) {
|
|
||||||
((SDMXRegistrySource) importSession.getSource())
|
|
||||||
.setUrl(url.getCurrentValue());
|
|
||||||
|
|
||||||
TDGWTServiceAsync.INSTANCE.setSDMXSession(
|
|
||||||
importSession, new AsyncCallback<Void>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
Log.error("SDMXImportSession do not stored "
|
|
||||||
+ caught.getLocalizedMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(Void result) {
|
|
||||||
Log.info("SDMXImportSession stored");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (importSession.getSDMXDocument().getId()
|
|
||||||
.compareTo("codelist") == 0) {
|
|
||||||
SDMXCodelistSelectionCard sdmxCodelistSelectionCard = new SDMXCodelistSelectionCard(
|
|
||||||
importSession);
|
|
||||||
getWizardWindow()
|
|
||||||
.addCard(sdmxCodelistSelectionCard);
|
|
||||||
Log.info("NextCard SDMXCodelistSelectionCard");
|
|
||||||
getWizardWindow().nextCard();
|
|
||||||
} else {
|
|
||||||
if (importSession.getSDMXDocument().getId()
|
|
||||||
.compareTo("dataset") == 0) {
|
|
||||||
SDMXDatasetSelectionCard sdmxDatasetSelectionCard = new SDMXDatasetSelectionCard(
|
|
||||||
importSession);
|
|
||||||
getWizardWindow().addCard(
|
|
||||||
sdmxDatasetSelectionCard);
|
|
||||||
Log.info("NextCard SDMXDatasetSelectionCard");
|
|
||||||
getWizardWindow().nextCard();
|
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Log.error("There is a problem in source selection.Expected SDMXRegistrySource, and found"
|
|
||||||
+ importSession.getSource());
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.error("sayNextCard :" + e.getLocalizedMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
getWizardWindow().setNextButtonCommand(sayNextCard);
|
|
||||||
|
|
||||||
Command sayPreviousCard = new Command() {
|
|
||||||
public void execute() {
|
|
||||||
try {
|
|
||||||
getWizardWindow().previousCard();
|
|
||||||
getWizardWindow().removeCard(thisCard);
|
|
||||||
Log.info("Remove SDMXRegistrySelectionCard");
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.error("sayNextCard :" + e.getLocalizedMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,328 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.gcube.portlets.user.sdmximportwizardtd.client;
|
|
||||||
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.TabResource;
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportSession;
|
|
||||||
import org.gcube.portlets.user.td.sdmximportwidget.client.general.WizardCard;
|
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
|
||||||
import com.google.gwt.core.client.GWT;
|
|
||||||
import com.google.gwt.user.client.Command;
|
|
||||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
|
||||||
import com.sencha.gxt.widget.core.client.FramedPanel;
|
|
||||||
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.FieldLabel;
|
|
||||||
import com.sencha.gxt.widget.core.client.form.FieldSet;
|
|
||||||
import com.sencha.gxt.widget.core.client.form.TextArea;
|
|
||||||
import com.sencha.gxt.widget.core.client.form.TextField;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author "Giancarlo Panichi"
|
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class SDMXTableDetailCard extends WizardCard {
|
|
||||||
|
|
||||||
protected SDMXImportSession importSession;
|
|
||||||
protected SDMXTableDetailCard thisCard;
|
|
||||||
|
|
||||||
protected static final AgenciesProperties agenciesProperties = GWT.create(AgenciesProperties.class);
|
|
||||||
protected VerticalLayoutContainer p = new VerticalLayoutContainer();
|
|
||||||
protected VerticalPanel tableDetailPanel;
|
|
||||||
|
|
||||||
protected TextField name;
|
|
||||||
protected TextArea description;
|
|
||||||
protected TextArea rights;
|
|
||||||
protected TextField agencyName;
|
|
||||||
|
|
||||||
protected TextButton checkButton;
|
|
||||||
|
|
||||||
//protected ComboBox<Agencies> combo=null;
|
|
||||||
|
|
||||||
TabResource detail=new TabResource();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public SDMXTableDetailCard(final SDMXImportSession importSession) {
|
|
||||||
super("SDMX Table Detail", "");
|
|
||||||
|
|
||||||
this.importSession = importSession;
|
|
||||||
thisCard=this;
|
|
||||||
|
|
||||||
|
|
||||||
tableDetailPanel = new VerticalPanel();
|
|
||||||
|
|
||||||
tableDetailPanel.setSpacing(4);
|
|
||||||
tableDetailPanel.setWidth("100%");
|
|
||||||
tableDetailPanel.setHeight("100%");
|
|
||||||
|
|
||||||
|
|
||||||
FramedPanel form2 = new FramedPanel();
|
|
||||||
form2.setHeadingText("Details");
|
|
||||||
//form2.setWidth(350);
|
|
||||||
|
|
||||||
FieldSet fieldSet = new FieldSet();
|
|
||||||
fieldSet.setHeadingText("Information");
|
|
||||||
fieldSet.setCollapsible(false);
|
|
||||||
form2.add(fieldSet);
|
|
||||||
|
|
||||||
//VerticalLayoutContainer p = new VerticalLayoutContainer();
|
|
||||||
fieldSet.add(p);
|
|
||||||
|
|
||||||
name = new TextField();
|
|
||||||
name.setAllowBlank(false);
|
|
||||||
name.setEmptyText("Enter a name...");
|
|
||||||
name.setValue(importSession.getSelectedCodelist().getName());
|
|
||||||
p.add(new FieldLabel(name, "Name"), new VerticalLayoutData(1, -1));
|
|
||||||
|
|
||||||
|
|
||||||
description = new TextArea();
|
|
||||||
description.setAllowBlank(false);
|
|
||||||
description.setEmptyText("Enter a description...");
|
|
||||||
description.setValue(importSession.getSelectedCodelist().getDescription());
|
|
||||||
p.add(new FieldLabel(description, "Description"), new VerticalLayoutData(1, -1));
|
|
||||||
|
|
||||||
rights = new TextArea();
|
|
||||||
rights.setEmptyText("Enter rights...");
|
|
||||||
rights.setAllowBlank(false);
|
|
||||||
p.add(new FieldLabel(rights, "Rights"), new VerticalLayoutData(1, -1));
|
|
||||||
|
|
||||||
/*
|
|
||||||
ListStore<Agencies> agenciesStore = new ListStore<Agencies>(agenciesProperties.key());
|
|
||||||
|
|
||||||
RpcProxy<PagingLoadConfig, PagingLoadResult<Agencies>> proxy = new RpcProxy<PagingLoadConfig, PagingLoadResult<Agencies>>() {
|
|
||||||
|
|
||||||
|
|
||||||
public void load(PagingLoadConfig loadConfig, final AsyncCallback<PagingLoadResult<Agencies>> callback) {
|
|
||||||
loadData(loadConfig, callback);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
final PagingLoader<PagingLoadConfig, PagingLoadResult<Agencies>> loader = new PagingLoader<PagingLoadConfig, PagingLoadResult<Agencies>>(proxy);
|
|
||||||
|
|
||||||
loader.setRemoteSort(false);
|
|
||||||
loader.addLoadHandler(new LoadResultListStoreBinding<PagingLoadConfig, Agencies, PagingLoadResult<Agencies>>(agenciesStore));
|
|
||||||
|
|
||||||
//agenciesStore.addAll(TestData.getStates());
|
|
||||||
|
|
||||||
combo = new ComboBox<Agencies>(agenciesStore, agenciesProperties.nameLabel());
|
|
||||||
addHandlersForEventObservation(combo, agenciesProperties.nameLabel());
|
|
||||||
|
|
||||||
combo.setLoader(loader);
|
|
||||||
combo.setEmptyText("Enter Agency...");
|
|
||||||
combo.setTriggerAction(TriggerAction.ALL);
|
|
||||||
combo.setAllowBlank(false);
|
|
||||||
combo.setForceSelection(true);
|
|
||||||
combo.setVisible(true);
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
//HorizontalLayoutContainer agenciesSelect= selectAgencies();
|
|
||||||
//p.add(new FieldLabel(combo, "Agencies"), new VerticalLayoutData(1, -1));
|
|
||||||
|
|
||||||
/*FieldLabel comboLabel=new FieldLabel(combo, "");
|
|
||||||
comboLabel.setLabelSeparator("");
|
|
||||||
p.add(comboLabel, new VerticalLayoutData(1, -1));
|
|
||||||
*/
|
|
||||||
|
|
||||||
agencyName = new TextField();
|
|
||||||
agencyName.setVisible(true);
|
|
||||||
agencyName.setEmptyText("Enter Agency...");
|
|
||||||
agencyName.setValue(importSession.getSelectedCodelist().getAgencyId());
|
|
||||||
FieldLabel agencyNameLabel=new FieldLabel(agencyName, "Agency");
|
|
||||||
agencyNameLabel.setLabelSeparator("");
|
|
||||||
p.add(agencyNameLabel, new VerticalLayoutData(1, -1));
|
|
||||||
|
|
||||||
checkButton = new TextButton("Save");
|
|
||||||
checkButton.addSelectHandler(new SelectHandler() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSelect(SelectEvent event) {
|
|
||||||
checkData();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
form2.addButton(checkButton);
|
|
||||||
|
|
||||||
tableDetailPanel.add(form2);
|
|
||||||
|
|
||||||
setContent(tableDetailPanel);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void checkData() {
|
|
||||||
if (name.getValue() == null || name.getValue().isEmpty()
|
|
||||||
|| description.getValue() == null
|
|
||||||
|| description.getValue().isEmpty()
|
|
||||||
|| rights.getValue() == null || rights.getValue().isEmpty()
|
|
||||||
|| agencyName.getValue() == null || agencyName.getValue().isEmpty()
|
|
||||||
) {
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
name.setReadOnly(true);
|
|
||||||
description.setReadOnly(true);
|
|
||||||
rights.setReadOnly(true);
|
|
||||||
agencyName.setReadOnly(true);
|
|
||||||
checkButton.disable();
|
|
||||||
getWizardWindow().setEnableNextButton(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*protected void loadData(PagingLoadConfig loadConfig, final AsyncCallback<PagingLoadResult<Agencies>> callback) {
|
|
||||||
TDGXTServiceAsync.INSTANCE.getAgencies(new AsyncCallback<List<Agencies>>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
callback.onFailure(caught);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(List<Agencies> result) {
|
|
||||||
Log.trace("loaded "+result.size()+" agencies");
|
|
||||||
for(int i=0; i<result.size(); i++){
|
|
||||||
Agencies ag=result.get(i);
|
|
||||||
//if(ag.getId().compareTo())
|
|
||||||
}
|
|
||||||
|
|
||||||
callback.onSuccess(new PagingLoadResultBean<Agencies>(result, result.size(), 0));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper to add handlers to observe events that occur on each combobox
|
|
||||||
|
|
||||||
private <T> void addHandlersForEventObservation(final ComboBox<T> combo, final LabelProvider<T> labelProvider) {
|
|
||||||
combo.addValueChangeHandler(new ValueChangeHandler<T>() {
|
|
||||||
@Override
|
|
||||||
public void onValueChange(ValueChangeEvent<T> event) {
|
|
||||||
|
|
||||||
Info.display("Value Changed", "New value: "
|
|
||||||
+ (event.getValue() == null ? combo.getValue() : labelProvider.getLabel(event.getValue()) + "!"));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
combo.addSelectionHandler(new SelectionHandler<T>() {
|
|
||||||
@Override
|
|
||||||
public void onSelection(SelectionEvent<T> event) {
|
|
||||||
Info.display("Agency Selected", "You selected "
|
|
||||||
+ (event.getSelectedItem() == null ? combo.getValue() : labelProvider.getLabel(event.getSelectedItem()) + "!"));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setup(){
|
|
||||||
Command sayNextCard = new Command() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute() {
|
|
||||||
detail.setName(name.getCurrentValue());
|
|
||||||
//detail.setAgency(combo.getSelectedText());
|
|
||||||
detail.setAgency(agencyName.getCurrentValue());
|
|
||||||
detail.setDescription(description.getCurrentValue());
|
|
||||||
detail.setRight(rights.getCurrentValue());
|
|
||||||
|
|
||||||
importSession.setTabResource(detail);
|
|
||||||
SDMXOperationInProgressCard sdmxOperationInProgressCard = new SDMXOperationInProgressCard(
|
|
||||||
importSession);
|
|
||||||
getWizardWindow()
|
|
||||||
.addCard(sdmxOperationInProgressCard);
|
|
||||||
Log.info("NextCard SDMXOperationInProgressCard");
|
|
||||||
getWizardWindow().nextCard();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
getWizardWindow().setNextButtonCommand(sayNextCard);
|
|
||||||
|
|
||||||
|
|
||||||
Command sayPreviousCard = new Command() {
|
|
||||||
public void execute() {
|
|
||||||
try {
|
|
||||||
getWizardWindow().previousCard();
|
|
||||||
getWizardWindow().removeCard(thisCard);
|
|
||||||
Log.info("Remove SDMXTableDetailCard");
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.error("sayPreviousCard :" + e.getLocalizedMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
|
|
||||||
getWizardWindow().setEnableNextButton(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
private HorizontalLayoutContainer selectAgencies(){
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
HorizontalLayoutContainer documentSelectionPanel = new HorizontalLayoutContainer();
|
|
||||||
|
|
||||||
Radio radioAgenciesAlready = new Radio();
|
|
||||||
|
|
||||||
radioAgenciesAlready.setBoxLabel("Present");
|
|
||||||
radioAgenciesAlready.setValue(true);
|
|
||||||
radioAgenciesAlready.setName("Agencies");
|
|
||||||
|
|
||||||
Radio radioAgencyNew = new Radio();
|
|
||||||
radioAgencyNew.setBoxLabel("New");
|
|
||||||
radioAgencyNew.setName("AgencyNew");
|
|
||||||
|
|
||||||
|
|
||||||
documentSelectionPanel.add(radioAgenciesAlready);
|
|
||||||
documentSelectionPanel.add(radioAgencyNew);
|
|
||||||
|
|
||||||
|
|
||||||
ToggleGroup toggle = new ToggleGroup();
|
|
||||||
toggle.add(radioAgenciesAlready);
|
|
||||||
toggle.add(radioAgencyNew);
|
|
||||||
|
|
||||||
toggle.addValueChangeHandler(new ValueChangeHandler<HasValue<Boolean>>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onValueChange(ValueChangeEvent<HasValue<Boolean>> event) {
|
|
||||||
try {
|
|
||||||
ToggleGroup group = (ToggleGroup) event.getSource();
|
|
||||||
Radio radio = (Radio) group.getValue();
|
|
||||||
Log.info("Document Selected:" + radio.getName());
|
|
||||||
if (radio.getName().compareTo("AgencyNew") == 0) {
|
|
||||||
//agencyName.setVisible(true);
|
|
||||||
//combo.setVisible(false);
|
|
||||||
//
|
|
||||||
} else {
|
|
||||||
if (radio.getName().compareTo("Agency") == 0) {
|
|
||||||
//agencyName.setVisible(false);
|
|
||||||
//combo.setVisible(true);
|
|
||||||
//
|
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.error("ToggleGroup: onValueChange " + e.getLocalizedMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return documentSelectionPanel;
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
|
@ -1,152 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.gcube.portlets.user.sdmximportwizardtd.client;
|
|
||||||
|
|
||||||
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportSession;
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.source.FileSource;
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.source.SDMXRegistrySource;
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.source.WorkspaceSource;
|
|
||||||
import org.gcube.portlets.user.td.sdmximportwidget.client.general.WizardCard;
|
|
||||||
|
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
|
||||||
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
|
||||||
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
|
||||||
import com.google.gwt.user.client.Command;
|
|
||||||
import com.google.gwt.user.client.ui.HasValue;
|
|
||||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
|
||||||
import com.sencha.gxt.core.client.util.ToggleGroup;
|
|
||||||
import com.sencha.gxt.widget.core.client.form.Radio;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author "Giancarlo Panichi"
|
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class SourceSelectionCard extends WizardCard {
|
|
||||||
|
|
||||||
protected final SDMXImportSession importSession;
|
|
||||||
|
|
||||||
final SDMXRegistrySource sdmxRegistrySource= SDMXRegistrySource.INSTANCE;
|
|
||||||
final FileSource fileSource= FileSource.INSTANCE;
|
|
||||||
final WorkspaceSource workspaceSource=WorkspaceSource.INSTANCE;
|
|
||||||
|
|
||||||
|
|
||||||
public SourceSelectionCard(final SDMXImportSession importSession) {
|
|
||||||
super("SDMX source selection", "");
|
|
||||||
|
|
||||||
this.importSession = importSession;
|
|
||||||
//Default
|
|
||||||
importSession.setSource(sdmxRegistrySource);
|
|
||||||
|
|
||||||
VerticalPanel sourceSelectionPanel = new VerticalPanel();
|
|
||||||
sourceSelectionPanel.setStylePrimaryName(res.sdmxImportCss().getImportSelectionSources());
|
|
||||||
|
|
||||||
Radio radioSDMXRegistrySource = new Radio();
|
|
||||||
|
|
||||||
radioSDMXRegistrySource.setBoxLabel("<p style='display:inline-table;'><b>"+sdmxRegistrySource.getName()+"</b><br>"+sdmxRegistrySource.getDescription()+"</p>");
|
|
||||||
radioSDMXRegistrySource.setValue(true);
|
|
||||||
radioSDMXRegistrySource.setName(sdmxRegistrySource.getName());
|
|
||||||
radioSDMXRegistrySource.setStylePrimaryName(res.sdmxImportCss().getImportSelectionSource());
|
|
||||||
|
|
||||||
Radio radioWorkspaceSource = new Radio();
|
|
||||||
radioWorkspaceSource.setBoxLabel("<p style='display:inline-table;'><b>"+workspaceSource.getName()+"</b><br>"+workspaceSource.getDescription()+"</p>");
|
|
||||||
radioWorkspaceSource.setName(workspaceSource.getName());
|
|
||||||
radioWorkspaceSource.setStylePrimaryName(res.sdmxImportCss().getImportSelectionSource());
|
|
||||||
radioWorkspaceSource.disable();
|
|
||||||
|
|
||||||
Radio radioFileSource = new Radio();
|
|
||||||
radioFileSource.setBoxLabel("<p style='display:inline-table;'><b>"+fileSource.getName()+"</b><br>"+fileSource.getDescription()+"</p>");
|
|
||||||
radioFileSource.setName(fileSource.getName());
|
|
||||||
radioFileSource.setStylePrimaryName(res.sdmxImportCss().getImportSelectionSource());
|
|
||||||
radioFileSource.disable();
|
|
||||||
|
|
||||||
sourceSelectionPanel.add(radioSDMXRegistrySource);
|
|
||||||
sourceSelectionPanel.add(radioWorkspaceSource);
|
|
||||||
sourceSelectionPanel.add(radioFileSource);
|
|
||||||
|
|
||||||
|
|
||||||
// we can set name on radios or use toggle group
|
|
||||||
ToggleGroup toggle = new ToggleGroup();
|
|
||||||
toggle.add(radioSDMXRegistrySource);
|
|
||||||
toggle.add(radioWorkspaceSource);
|
|
||||||
toggle.add(radioFileSource);
|
|
||||||
|
|
||||||
toggle.addValueChangeHandler(new ValueChangeHandler<HasValue<Boolean>>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onValueChange(ValueChangeEvent<HasValue<Boolean>> event) {
|
|
||||||
try {
|
|
||||||
ToggleGroup group = (ToggleGroup) event.getSource();
|
|
||||||
Radio radio = (Radio) group.getValue();
|
|
||||||
Log.info("Source Selected:" + radio.getName());
|
|
||||||
if (radio.getName().compareTo(sdmxRegistrySource.getName()) == 0) {
|
|
||||||
importSession.setSource(sdmxRegistrySource);
|
|
||||||
} else {
|
|
||||||
if (radio.getName().compareTo(workspaceSource.getName()) == 0) {
|
|
||||||
importSession.setSource(workspaceSource);
|
|
||||||
} else {
|
|
||||||
if (radio.getName().compareTo(fileSource.getName()) == 0) {
|
|
||||||
importSession.setSource(fileSource);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.error("ToggleGroup: onValueChange " + e.getLocalizedMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
setContent(sourceSelectionPanel);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setup(){
|
|
||||||
Command sayNextCard = new Command() {
|
|
||||||
public void execute() {
|
|
||||||
try {
|
|
||||||
String sourceId = importSession.getSource().getId();
|
|
||||||
if (sourceId == null || sourceId.isEmpty()) {
|
|
||||||
Log.error("SDMX Import Source Id: " + sourceId);
|
|
||||||
} else {
|
|
||||||
if (sourceId.compareTo("SDMXRegistry") == 0) {
|
|
||||||
SDMXRegistrySelectionCard sdmxRegistrySelectionCard = new SDMXRegistrySelectionCard(
|
|
||||||
importSession);
|
|
||||||
getWizardWindow()
|
|
||||||
.addCard(sdmxRegistrySelectionCard);
|
|
||||||
Log.info("NextCard SDMXRegistrySelectionCard");
|
|
||||||
getWizardWindow().nextCard();
|
|
||||||
} else {
|
|
||||||
if (sourceId.compareTo("File") == 0) {
|
|
||||||
|
|
||||||
} else {
|
|
||||||
if (sourceId.compareTo("Workspace") == 0) {
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.error("sayNextCard :" + e.getLocalizedMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
getWizardWindow().setNextButtonCommand(sayNextCard);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue