Removed behaviors not supported
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-sdmx-import-widget@115563 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
298766a17e
commit
4c560d8e6b
|
@ -53,37 +53,43 @@ import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi"
|
* @author "Giancarlo Panichi" <a
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CodelistSelectionPanel extends ContentPanel implements HasSelectionHandlers<Codelist> {
|
public class CodelistSelectionPanel extends ContentPanel implements
|
||||||
|
HasSelectionHandlers<Codelist> {
|
||||||
|
|
||||||
private static final CodelistProperties properties = GWT.create(CodelistProperties.class);
|
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> nameColumn = new ColumnConfig<Codelist, String>(
|
||||||
protected static final ColumnConfig<Codelist, String> agencyIdColumn = new ColumnConfig<Codelist, String>(properties.agencyId(), 50, "Agency Id");
|
properties.name(), 50, "Name");
|
||||||
protected static final ColumnConfig<Codelist, String> versionColumn = new ColumnConfig<Codelist, String>(properties.version(), 50, "Version");
|
protected static final ColumnConfig<Codelist, String> agencyIdColumn = new ColumnConfig<Codelist, String>(
|
||||||
protected static final ColumnConfig<Codelist, String> descriptionColumn = new ColumnConfig<Codelist, String>(properties.description(), 50, "Description");
|
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 Grid<Codelist> grid;
|
||||||
protected ResourceBundle res;
|
protected ResourceBundle res;
|
||||||
|
|
||||||
private WizardCard parent;
|
private WizardCard parent;
|
||||||
|
|
||||||
|
public CodelistSelectionPanel(WizardCard parent, ResourceBundle res) {
|
||||||
public CodelistSelectionPanel(WizardCard parent,ResourceBundle res)
|
this.parent = parent;
|
||||||
{
|
this.res = res;
|
||||||
this.parent=parent;
|
|
||||||
this.res=res;
|
|
||||||
setHeaderVisible(false);
|
setHeaderVisible(false);
|
||||||
//new Resizable(this, Dir.E, Dir.SE, Dir.S);
|
buildPanel(properties.key(), Arrays.<ColumnConfig<Codelist, ?>> asList(
|
||||||
buildPanel(properties.key(), Arrays.<ColumnConfig<Codelist, ?>>asList(nameColumn, agencyIdColumn, versionColumn, descriptionColumn), nameColumn);
|
nameColumn, agencyIdColumn, versionColumn, descriptionColumn),
|
||||||
|
nameColumn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void buildPanel(ModelKeyProvider<Codelist> keyProvider, List<ColumnConfig<Codelist, ?>> columns, ColumnConfig<Codelist, ?> autoexpandColumn)
|
protected void buildPanel(ModelKeyProvider<Codelist> keyProvider,
|
||||||
{
|
List<ColumnConfig<Codelist, ?>> columns,
|
||||||
|
ColumnConfig<Codelist, ?> autoexpandColumn) {
|
||||||
|
|
||||||
ToolBar toolBar = new ToolBar();
|
ToolBar toolBar = new ToolBar();
|
||||||
toolBar.add(new LabelToolItem("Search: "));
|
toolBar.add(new LabelToolItem("Search: "));
|
||||||
|
@ -91,33 +97,35 @@ public class CodelistSelectionPanel extends ContentPanel implements HasSelection
|
||||||
toolBar.add(searchField);
|
toolBar.add(searchField);
|
||||||
|
|
||||||
TextButton btnReload = new TextButton();
|
TextButton btnReload = new TextButton();
|
||||||
//btnReload.setText("Reload");
|
// btnReload.setText("Reload");
|
||||||
btnReload.setIcon(res.refresh16());
|
btnReload.setIcon(res.refresh16());
|
||||||
btnReload.setToolTip("Reload");
|
btnReload.setToolTip("Reload");
|
||||||
toolBar.add(btnReload);
|
toolBar.add(btnReload);
|
||||||
|
|
||||||
|
|
||||||
IdentityValueProvider<Codelist> identity = new IdentityValueProvider<Codelist>();
|
IdentityValueProvider<Codelist> identity = new IdentityValueProvider<Codelist>();
|
||||||
final CheckBoxSelectionModel<Codelist> sm = new CheckBoxSelectionModel<Codelist>(identity);
|
final CheckBoxSelectionModel<Codelist> sm = new CheckBoxSelectionModel<Codelist>(
|
||||||
|
identity);
|
||||||
|
|
||||||
ColumnModel<Codelist> cm = new ColumnModel<Codelist>(columns);
|
ColumnModel<Codelist> cm = new ColumnModel<Codelist>(columns);
|
||||||
|
|
||||||
final ExtendedListStore<Codelist> store = new ExtendedListStore<Codelist>(keyProvider);
|
final ExtendedListStore<Codelist> store = new ExtendedListStore<Codelist>(
|
||||||
|
keyProvider);
|
||||||
|
|
||||||
searchField.addKeyUpHandler(new KeyUpHandler() {
|
searchField.addKeyUpHandler(new KeyUpHandler() {
|
||||||
|
|
||||||
|
|
||||||
public void onKeyUp(KeyUpEvent event) {
|
public void onKeyUp(KeyUpEvent event) {
|
||||||
Log.trace("searchTerm: "+searchField.getCurrentValue());
|
Log.trace("searchTerm: " + searchField.getCurrentValue());
|
||||||
store.applyFilters();
|
store.applyFilters();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
store.addFilter(new StoreFilter<Codelist>() {
|
store.addFilter(new StoreFilter<Codelist>() {
|
||||||
|
|
||||||
public boolean select(Store<Codelist> store, Codelist parent, Codelist item) {
|
public boolean select(Store<Codelist> store, Codelist parent,
|
||||||
|
Codelist item) {
|
||||||
String searchTerm = searchField.getCurrentValue();
|
String searchTerm = searchField.getCurrentValue();
|
||||||
if (searchTerm == null) return true;
|
if (searchTerm == null)
|
||||||
|
return true;
|
||||||
return CodelistSelectionPanel.this.select(item, searchTerm);
|
return CodelistSelectionPanel.this.select(item, searchTerm);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -126,17 +134,19 @@ public class CodelistSelectionPanel extends ContentPanel implements HasSelection
|
||||||
|
|
||||||
RpcProxy<ListLoadConfig, ListLoadResult<Codelist>> proxy = new RpcProxy<ListLoadConfig, ListLoadResult<Codelist>>() {
|
RpcProxy<ListLoadConfig, ListLoadResult<Codelist>> proxy = new RpcProxy<ListLoadConfig, ListLoadResult<Codelist>>() {
|
||||||
|
|
||||||
|
public void load(ListLoadConfig loadConfig,
|
||||||
public void load(ListLoadConfig loadConfig, final AsyncCallback<ListLoadResult<Codelist>> callback) {
|
final AsyncCallback<ListLoadResult<Codelist>> callback) {
|
||||||
loadData(loadConfig, callback);
|
loadData(loadConfig, callback);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
final ListLoader<ListLoadConfig, ListLoadResult<Codelist>> loader = new ListLoader<ListLoadConfig, ListLoadResult<Codelist>>(proxy);
|
final ListLoader<ListLoadConfig, ListLoadResult<Codelist>> loader = new ListLoader<ListLoadConfig, ListLoadResult<Codelist>>(
|
||||||
|
proxy);
|
||||||
|
|
||||||
loader.setRemoteSort(false);
|
loader.setRemoteSort(false);
|
||||||
loader.addLoadHandler(new LoadResultListStoreBinding<ListLoadConfig, Codelist, ListLoadResult<Codelist>>(store));
|
loader.addLoadHandler(new LoadResultListStoreBinding<ListLoadConfig, Codelist, ListLoadResult<Codelist>>(
|
||||||
|
store));
|
||||||
|
|
||||||
grid = new Grid<Codelist>(store, cm){
|
grid = new Grid<Codelist>(store, cm) {
|
||||||
@Override
|
@Override
|
||||||
protected void onAfterFirstAttach() {
|
protected void onAfterFirstAttach() {
|
||||||
super.onAfterFirstAttach();
|
super.onAfterFirstAttach();
|
||||||
|
@ -173,20 +183,34 @@ public class CodelistSelectionPanel extends ContentPanel implements HasSelection
|
||||||
setWidget(con);
|
setWidget(con);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected boolean select(Codelist item, String searchTerm) {
|
protected boolean select(Codelist item, String searchTerm) {
|
||||||
if (item.getName()!=null && item.getName().toLowerCase().contains(searchTerm.toLowerCase())) return true;
|
if (item.getName() != null
|
||||||
if (item.getAgencyId()!=null &&item.getAgencyId().toLowerCase().contains(searchTerm.toLowerCase())) return true;
|
&& item.getName().toLowerCase()
|
||||||
if (item.getVersion()!=null && item.getVersion().toLowerCase().contains(searchTerm.toLowerCase())) return true;
|
.contains(searchTerm.toLowerCase()))
|
||||||
if (item.getDescription()!=null && item.getDescription().toLowerCase().contains(searchTerm.toLowerCase())) return true;
|
return true;
|
||||||
if (item.getId()!=null &&item.getId().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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void loadData(ListLoadConfig loadConfig,
|
||||||
protected void loadData(ListLoadConfig loadConfig, final AsyncCallback<ListLoadResult<Codelist>> callback) {
|
final AsyncCallback<ListLoadResult<Codelist>> callback) {
|
||||||
TDGWTServiceAsync.INSTANCE.getCodelists(new AsyncCallback<ArrayList<Codelist>>() {
|
TDGWTServiceAsync.INSTANCE
|
||||||
|
.getCodelists(new AsyncCallback<ArrayList<Codelist>>() {
|
||||||
|
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
if (caught instanceof TDGWTSessionExpiredException) {
|
if (caught instanceof TDGWTSessionExpiredException) {
|
||||||
|
@ -198,25 +222,22 @@ public class CodelistSelectionPanel extends ContentPanel implements HasSelection
|
||||||
Log.error("No codelists retrieved");
|
Log.error("No codelists retrieved");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
callback.onFailure(caught);
|
callback.onFailure(caught);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSuccess(ArrayList<Codelist> result) {
|
public void onSuccess(ArrayList<Codelist> result) {
|
||||||
Log.trace("loaded "+result.size()+" codelists");
|
Log.trace("loaded " + result.size() + " codelists");
|
||||||
callback.onSuccess(new ListLoadResultBean<Codelist>(result));
|
callback.onSuccess(new ListLoadResultBean<Codelist>(
|
||||||
|
result));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HandlerRegistration addSelectionHandler(
|
||||||
public HandlerRegistration addSelectionHandler(SelectionHandler<Codelist> handler) {
|
SelectionHandler<Codelist> handler) {
|
||||||
return grid.getSelectionModel().addSelectionHandler(handler);
|
return grid.getSelectionModel().addSelectionHandler(handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Codelist getSelectedItem() {
|
public Codelist getSelectedItem() {
|
||||||
return grid.getSelectionModel().getSelectedItem();
|
return grid.getSelectionModel().getSelectedItem();
|
||||||
}
|
}
|
||||||
|
@ -227,12 +248,10 @@ public class CodelistSelectionPanel extends ContentPanel implements HasSelection
|
||||||
super(keyProvider);
|
super(keyProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void applyFilters()
|
public void applyFilters() {
|
||||||
{
|
|
||||||
super.applyFilters();
|
super.applyFilters();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,8 @@ import com.google.gwt.user.client.Command;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi"
|
* @author "Giancarlo Panichi" <a
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class SDMXCodelistSelectionCard extends WizardCard {
|
public class SDMXCodelistSelectionCard extends WizardCard {
|
||||||
|
@ -23,50 +23,52 @@ public class SDMXCodelistSelectionCard extends WizardCard {
|
||||||
protected SDMXCodelistSelectionCard thisCard;
|
protected SDMXCodelistSelectionCard thisCard;
|
||||||
protected SDMXImportSession importSession;
|
protected SDMXImportSession importSession;
|
||||||
protected CodelistSelectionPanel codelistSelectionPanel;
|
protected CodelistSelectionPanel codelistSelectionPanel;
|
||||||
protected Codelist selectedCodelist=null;
|
protected Codelist selectedCodelist = null;
|
||||||
|
|
||||||
public SDMXCodelistSelectionCard(final SDMXImportSession importSession) {
|
public SDMXCodelistSelectionCard(final SDMXImportSession importSession) {
|
||||||
super("SDMX Codelist selection", "");
|
super("SDMX Codelist selection", "");
|
||||||
|
|
||||||
this.importSession = importSession;
|
this.importSession = importSession;
|
||||||
thisCard=this;
|
thisCard = this;
|
||||||
|
|
||||||
this.codelistSelectionPanel=new CodelistSelectionPanel(thisCard,res);
|
this.codelistSelectionPanel = new CodelistSelectionPanel(thisCard, res);
|
||||||
|
|
||||||
codelistSelectionPanel.addSelectionHandler(new SelectionHandler<Codelist>() {
|
|
||||||
|
|
||||||
|
codelistSelectionPanel
|
||||||
|
.addSelectionHandler(new SelectionHandler<Codelist>() {
|
||||||
|
|
||||||
public void onSelection(SelectionEvent<Codelist> event) {
|
public void onSelection(SelectionEvent<Codelist> event) {
|
||||||
importSession.setSelectedCodelist(codelistSelectionPanel.getSelectedItem());
|
importSession
|
||||||
|
.setSelectedCodelist(codelistSelectionPanel
|
||||||
|
.getSelectedItem());
|
||||||
getWizardWindow().setEnableNextButton(true);
|
getWizardWindow().setEnableNextButton(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
setContent(codelistSelectionPanel);
|
setContent(codelistSelectionPanel);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setup(){
|
public void setup() {
|
||||||
Command sayNextCard = new Command() {
|
Command sayNextCard = new Command() {
|
||||||
|
|
||||||
public void execute() {
|
public void execute() {
|
||||||
|
try {
|
||||||
SDMXTableDetailCard sdmxTableDetailCard = new SDMXTableDetailCard(
|
SDMXTableDetailCard sdmxTableDetailCard = new SDMXTableDetailCard(
|
||||||
importSession);
|
importSession);
|
||||||
getWizardWindow()
|
getWizardWindow().addCard(sdmxTableDetailCard);
|
||||||
.addCard(sdmxTableDetailCard);
|
|
||||||
Log.info("NextCard SDMXTableDetailCard");
|
Log.info("NextCard SDMXTableDetailCard");
|
||||||
getWizardWindow().nextCard();
|
getWizardWindow().nextCard();
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
getWizardWindow().setNextButtonCommand(sayNextCard);
|
getWizardWindow().setNextButtonCommand(sayNextCard);
|
||||||
|
|
||||||
|
|
||||||
Command sayPreviousCard = new Command() {
|
Command sayPreviousCard = new Command() {
|
||||||
public void execute() {
|
public void execute() {
|
||||||
try {
|
try {
|
||||||
|
@ -81,6 +83,9 @@ public class SDMXCodelistSelectionCard extends WizardCard {
|
||||||
|
|
||||||
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
|
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
|
||||||
getWizardWindow().setEnableNextButton(false);
|
getWizardWindow().setEnableNextButton(false);
|
||||||
|
getWizardWindow().setEnableBackButton(false);
|
||||||
|
setBackButtonVisible(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,44 +1,53 @@
|
||||||
package org.gcube.portlets.user.td.sdmximportwidget.client;
|
package org.gcube.portlets.user.td.sdmximportwidget.client;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.document.CodelistDocument;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportSession;
|
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.wizardwidget.client.WizardWindow;
|
import org.gcube.portlets.user.td.wizardwidget.client.WizardWindow;
|
||||||
|
|
||||||
import com.google.web.bindery.event.shared.EventBus;
|
import com.google.web.bindery.event.shared.EventBus;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entry point classes define <code>onModuleLoad()</code>.
|
* Entry point classes define <code>onModuleLoad()</code>.
|
||||||
*/
|
*/
|
||||||
public class SDMXImportWizardTD extends WizardWindow {
|
public class SDMXImportWizardTD extends WizardWindow {
|
||||||
|
|
||||||
protected SDMXImportSession importSession;
|
private SDMXImportSession importSession;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The id of the {@link CSVTarget} to use.
|
* The id of the {@link CSVTarget} to use.
|
||||||
|
*
|
||||||
* @param targetId
|
* @param targetId
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public SDMXImportWizardTD(String title,EventBus eventBus) {
|
public SDMXImportWizardTD(String title, EventBus eventBus) {
|
||||||
super(title,eventBus);
|
super(title, eventBus);
|
||||||
setWidth(550);
|
setWidth(550);
|
||||||
setHeight(520);
|
setHeight(520);
|
||||||
|
|
||||||
importSession= new SDMXImportSession();
|
importSession = new SDMXImportSession();
|
||||||
|
|
||||||
|
// For multiple sources
|
||||||
|
/*
|
||||||
|
* SDMXDocumentSelectionCard sdmxdocumentSelection= new
|
||||||
|
* SDMXDocumentSelectionCard(importSession);
|
||||||
|
* addCard(sdmxdocumentSelection);
|
||||||
|
*
|
||||||
|
* SourceSelectionCard sourceSelection= new
|
||||||
|
* SourceSelectionCard(importSession); addCard(sourceSelection);
|
||||||
|
*/
|
||||||
|
|
||||||
SDMXDocumentSelectionCard sdmxdocumentSelection= new SDMXDocumentSelectionCard(importSession);
|
final SDMXRegistrySource sdmxRegistrySource = SDMXRegistrySource.INSTANCE;
|
||||||
addCard(sdmxdocumentSelection);
|
importSession.setSource(sdmxRegistrySource);
|
||||||
|
|
||||||
SourceSelectionCard sourceSelection= new SourceSelectionCard(importSession);
|
|
||||||
addCard(sourceSelection);
|
|
||||||
|
|
||||||
|
final CodelistDocument codelist = CodelistDocument.INSTANCE;
|
||||||
|
importSession.setSDMXDocument(codelist);
|
||||||
|
|
||||||
|
SDMXCodelistSelectionCard sdmxCodelistSelectionCard = new SDMXCodelistSelectionCard(
|
||||||
|
importSession);
|
||||||
|
addCard(sdmxCodelistSelectionCard);
|
||||||
|
sdmxCodelistSelectionCard.setup();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -256,7 +256,9 @@ public class SDMXTableDetailCard extends WizardCard {
|
||||||
};
|
};
|
||||||
|
|
||||||
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
|
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
|
||||||
|
setBackButtonVisible(true);
|
||||||
getWizardWindow().setEnableNextButton(true);
|
getWizardWindow().setEnableNextButton(true);
|
||||||
|
getWizardWindow().setEnableBackButton(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue