From 74dcc22df4d1a173aec8b73dab8d72ecd6b41424 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Fri, 10 Oct 2014 16:54:43 +0000 Subject: [PATCH] Initial import. git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-map-widget@100624 82a268e6-3cf1-43bd-a215-b396298e98cf --- .project | 36 ++ MapWidgetTDTest-dev.launch | 22 ++ MapWidgetTDTest-prod.launch | 22 ++ pom.xml | 311 ++++++++++++++++++ .../mapwidget/client/MapWidgetConfigCard.java | 178 ++++++++++ .../mapwidget/client/MapWidgetDetailCard.java | 285 ++++++++++++++++ .../MapWidgetOperationInProgressCard.java | 284 ++++++++++++++++ .../user/td/mapwidget/client/MapWidgetTD.java | 43 +++ .../td/mapwidget/client/MapWidgetTDEntry.java | 15 + .../client/grid/ColumnDataGridPanel.java | 179 ++++++++++ .../client/grid/ColumnDataProperties.java | 29 ++ .../user/td/mapwidget/MapWidgetTD.gwt.xml | 27 ++ .../td/mapwidget/client/Messages.properties | 2 + .../mapwidget/client/Messages_fr.properties | 2 + src/main/webapp/MapWidgetTD.css | 34 ++ src/main/webapp/MapWidgetTD.html | 63 ++++ src/main/webapp/WEB-INF/web.xml | 35 ++ .../mapwidget/client/GwtTestMapWidgetTD.java | 83 +++++ .../td/mapwidget/MapWidgetTDJUnit.gwt.xml | 13 + templates/INSTALL | 0 templates/LICENSE | 6 + templates/MAINTAINERS | 1 + templates/README | 48 +++ templates/changelog.xml | 6 + templates/descriptor.xml | 39 +++ templates/profile.xml | 29 ++ templates/svnpath.txt | 1 + 27 files changed, 1793 insertions(+) create mode 100644 .project create mode 100644 MapWidgetTDTest-dev.launch create mode 100644 MapWidgetTDTest-prod.launch create mode 100644 pom.xml create mode 100644 src/main/java/org/gcube/portlets/user/td/mapwidget/client/MapWidgetConfigCard.java create mode 100644 src/main/java/org/gcube/portlets/user/td/mapwidget/client/MapWidgetDetailCard.java create mode 100644 src/main/java/org/gcube/portlets/user/td/mapwidget/client/MapWidgetOperationInProgressCard.java create mode 100644 src/main/java/org/gcube/portlets/user/td/mapwidget/client/MapWidgetTD.java create mode 100644 src/main/java/org/gcube/portlets/user/td/mapwidget/client/MapWidgetTDEntry.java create mode 100644 src/main/java/org/gcube/portlets/user/td/mapwidget/client/grid/ColumnDataGridPanel.java create mode 100644 src/main/java/org/gcube/portlets/user/td/mapwidget/client/grid/ColumnDataProperties.java create mode 100644 src/main/resources/org/gcube/portlets/user/td/mapwidget/MapWidgetTD.gwt.xml create mode 100644 src/main/resources/org/gcube/portlets/user/td/mapwidget/client/Messages.properties create mode 100644 src/main/resources/org/gcube/portlets/user/td/mapwidget/client/Messages_fr.properties create mode 100644 src/main/webapp/MapWidgetTD.css create mode 100644 src/main/webapp/MapWidgetTD.html create mode 100644 src/main/webapp/WEB-INF/web.xml create mode 100644 src/test/java/org/gcube/portlets/user/td/mapwidget/client/GwtTestMapWidgetTD.java create mode 100644 src/test/resources/org/gcube/portlets/user/td/mapwidget/MapWidgetTDJUnit.gwt.xml create mode 100644 templates/INSTALL create mode 100644 templates/LICENSE create mode 100644 templates/MAINTAINERS create mode 100644 templates/README create mode 100644 templates/changelog.xml create mode 100644 templates/descriptor.xml create mode 100644 templates/profile.xml create mode 100644 templates/svnpath.txt diff --git a/.project b/.project new file mode 100644 index 0000000..6d2290e --- /dev/null +++ b/.project @@ -0,0 +1,36 @@ + + + tabular-data-map-widget + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + + diff --git a/MapWidgetTDTest-dev.launch b/MapWidgetTDTest-dev.launch new file mode 100644 index 0000000..8937bfb --- /dev/null +++ b/MapWidgetTDTest-dev.launch @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/MapWidgetTDTest-prod.launch b/MapWidgetTDTest-prod.launch new file mode 100644 index 0000000..f785cdb --- /dev/null +++ b/MapWidgetTDTest-prod.launch @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..81e61e3 --- /dev/null +++ b/pom.xml @@ -0,0 +1,311 @@ + + + + + maven-parent + org.gcube.tools + 1.0.0 + + + + + 4.0.0 + org.gcube.portlets.user + tabular-data-map-widget + 1.0.0-SNAPSHOT + + tabular-data-map-widget + tabular-data-map-widget allows the creation of maps + + + https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-map-widget + + + + + Giancarlo Panichi + g.panichi@isti.cnr.it + CNR Pisa, Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" + + architect + developer + + + + + + ${project.basedir}/distro + ${project.build.directory}/${project.build.finalName} + 2014-09-12 + https://gcube.wiki.gcube-system.org/gcube/index.php + templates + distro + config + + + 2.5.1 + + ${env.KEYS} + + UTF-8 + UTF-8 + + + + + localRun + + + org.slf4j + slf4j-api + compile + + + ch.qos.logback + logback-classic + 1.0.1 + runtime + + + + + + + + + com.google.gwt + gwt-servlet + + + com.google.gwt + gwt-user + + + + + javax.validation + validation-api + 1.0.0.GA + test + + + javax.validation + validation-api + 1.0.0.GA + sources + test + + + + com.sencha.gxt + gxt + 3.0.1 + + + + + + + org.gcube.portlets.user + tabular-data-gwt-service + [2.0.0-SNAPSHOT,3.0.0-SNAPSHOT) + provided + + + + + org.gcube.portlets.user + tabular-data-widget-common-event + [1.0.0-SNAPSHOT,2.0.0-SNAPSHOT) + provided + + + + + org.gcube.portlets.user + tabular-data-monitor-widget + [1.0.0-SNAPSHOT,2.0.0-SNAPSHOT) + provided + + + + + org.gcube.portlets.user + tabular-data-wizard-widget + [1.0.0-SNAPSHOT,2.0.0-SNAPSHOT) + provided + + + + + + com.allen-sauer.gwt.log + gwt-log + 3.2.1 + provided + + + + org.slf4j + slf4j-api + + + + + junit + junit + 4.8.1 + test + + + + + + + + + + ${webappDirectory}/WEB-INF/classes + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.16 + + true + + + + + org.apache.maven.surefire + surefire-junit47 + 2.16 + + + + + + + org.codehaus.mojo + gwt-maven-plugin + ${gwtVersion} + + + + resources + + + + + MapWidgetTD.html + ${webappDirectory} + org.gcube.portlets.user.td.mapwidget.MapWidgetTD + + + + + + maven-resources-plugin + 2.6 + + + copy-profile + process-resources + + copy-resources + + + ${configDirectory} + + + ${templatesDirectory} + + profile.xml + + true + + + + + + copy-distro-resources + process-resources + + copy-resources + + + ${distroDirectory} + + + ${templatesDirectory} + + profile.xml + descriptor.xml + + true + + + + + + + + maven-clean-plugin + 2.5 + + + + ${distroDirectory} + + ** + + false + + + ${configDirectory} + + ** + + false + + + + + + org.apache.maven.plugins + maven-assembly-plugin + 2.2 + + + ${templatesDirectory}/descriptor.xml + + + + + servicearchive + package + + single + + + + + + + + + + + + + org.gcube.distribution + maven-portal-bom + LATEST + pom + import + + + + diff --git a/src/main/java/org/gcube/portlets/user/td/mapwidget/client/MapWidgetConfigCard.java b/src/main/java/org/gcube/portlets/user/td/mapwidget/client/MapWidgetConfigCard.java new file mode 100644 index 0000000..6bf1708 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/mapwidget/client/MapWidgetConfigCard.java @@ -0,0 +1,178 @@ +package org.gcube.portlets.user.td.mapwidget.client; + +import java.util.ArrayList; + +import org.gcube.portlets.user.td.gwtservice.shared.json.JSONExportSession; +import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData; +import org.gcube.portlets.user.td.mapwidget.client.grid.ColumnDataGridPanel; +import org.gcube.portlets.user.td.wizardwidget.client.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; +import com.google.gwt.user.client.ui.HorizontalPanel; +import com.sencha.gxt.core.client.util.Padding; +import com.sencha.gxt.core.client.util.ToggleGroup; +import com.sencha.gxt.widget.core.client.box.AlertMessageBox; +import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer; +import com.sencha.gxt.widget.core.client.event.HideEvent; +import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler; +import com.sencha.gxt.widget.core.client.form.FieldLabel; +import com.sencha.gxt.widget.core.client.form.FormPanel; +import com.sencha.gxt.widget.core.client.form.Radio; +import com.sencha.gxt.widget.core.client.tips.ToolTip; +import com.sencha.gxt.widget.core.client.tips.ToolTipConfig; + +/** + * + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it + * + */ +public class MapWidgetConfigCard extends WizardCard { + + private static final int LABEL_WIDTH = 128; + private static final int LABEL_PAD_WIDTH = 2; + + protected JSONExportSession exportSession; + + + + private Radio viewColumnExportTrue; + private Radio viewColumnExportFalse; + + protected ColumnDataGridPanel jsonColumnGridPanel; + + public MapWidgetConfigCard(final JSONExportSession exportSession) { + super("JSON configuration", ""); + + if (exportSession == null) { + Log.error("JSONExportSession is null"); + } + this.exportSession = exportSession; + + FormPanel panel = createPanel(); + setContent(panel); + + } + + protected FormPanel createPanel() { + FormPanel panel = new FormPanel(); + panel.setLabelWidth(90); + panel.getElement().setPadding(new Padding(5)); + + VerticalLayoutContainer content = new VerticalLayoutContainer(); + panel.add(content); + + // Export View Column + viewColumnExportTrue = new Radio(); + viewColumnExportTrue.setBoxLabel("True"); + viewColumnExportTrue.setValue(true); + + viewColumnExportFalse = new Radio(); + viewColumnExportFalse.setBoxLabel("False"); + + ToggleGroup exportViewColumnGroup = new ToggleGroup(); + exportViewColumnGroup.add(viewColumnExportTrue); + exportViewColumnGroup.add(viewColumnExportFalse); + + HorizontalPanel viewColumnExportPanel = new HorizontalPanel(); + viewColumnExportPanel.add(viewColumnExportTrue); + viewColumnExportPanel.add(viewColumnExportFalse); + + new ToolTip(viewColumnExportPanel, new ToolTipConfig( + "Export View Columns Too")); + FieldLabel fieldViewColumns=new FieldLabel(viewColumnExportPanel, "Export View Columns"); + fieldViewColumns.setLabelWidth(LABEL_WIDTH); + fieldViewColumns.setLabelPad(LABEL_PAD_WIDTH); + content.add(fieldViewColumns); + + // Column Selection Grid + jsonColumnGridPanel = new ColumnDataGridPanel(this); + + jsonColumnGridPanel + .addSelectionHandler(new SelectionHandler() { + + public void onSelection(SelectionEvent event) { + + } + + }); + + content.add(jsonColumnGridPanel); + + return panel; + } + + + + protected boolean getExportViewColumns() { + if(viewColumnExportTrue.getValue()){ + return true; + } else { + return false; + } + } + + @Override + public void setup() { + Log.debug("JSONExportConfigCard Setup"); + Command sayNextCard = new Command() { + + public void execute() { + Log.debug("JSONExportConfigCard Call sayNextCard"); + checkData(); + } + + }; + + getWizardWindow().setNextButtonCommand(sayNextCard); + setEnableBackButton(false); + setEnableNextButton(true); + } + + protected void checkData() { + getWizardWindow().setEnableNextButton(false); + getWizardWindow().setEnableBackButton(false); + AlertMessageBox d; + HideHandler hideHandler = new HideHandler() { + + public void onHide(HideEvent event) { + getWizardWindow().setEnableNextButton(true); + getWizardWindow().setEnableBackButton(false); + + } + }; + + ArrayList columns = jsonColumnGridPanel.getSelectedItems(); + if (columns.size() == 0) { + d = new AlertMessageBox("Attention", "No columns selected"); + d.addHideHandler(hideHandler); + d.setModal(false); + d.show(); + } else { + exportSession.setColumns(columns); + exportSession.setExportViewColumns(getExportViewColumns()); + goNext(); + } + + } + + protected void goNext() { + try { + /*DestinationSelectionCard destCard = new DestinationSelectionCard( + exportSession); + getWizardWindow().addCard(destCard); + getWizardWindow().nextCard();*/ + } catch (Exception e) { + Log.error("sayNextCard :" + e.getLocalizedMessage()); + } + } + + @Override + public void dispose() { + + } + +} diff --git a/src/main/java/org/gcube/portlets/user/td/mapwidget/client/MapWidgetDetailCard.java b/src/main/java/org/gcube/portlets/user/td/mapwidget/client/MapWidgetDetailCard.java new file mode 100644 index 0000000..0bbabf0 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/mapwidget/client/MapWidgetDetailCard.java @@ -0,0 +1,285 @@ +/** + * + */ +package org.gcube.portlets.user.td.mapwidget.client; + +import java.util.ArrayList; +import java.util.Date; + +import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; +import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession; +import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; +import org.gcube.portlets.user.td.gwtservice.shared.licenses.LicenceData; +import org.gcube.portlets.user.td.gwtservice.shared.map.MapCreationSession; +import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData; +import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource; +import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; +import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; +import org.gcube.portlets.user.td.wizardwidget.client.WizardCard; +import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3; + +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.i18n.client.DateTimeFormat; +import com.google.gwt.user.client.Command; +import com.google.gwt.user.client.rpc.AsyncCallback; +import com.google.gwt.user.client.ui.VerticalPanel; +import com.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction; +import com.sencha.gxt.data.client.loader.RpcProxy; +import com.sencha.gxt.data.shared.ListStore; +import com.sencha.gxt.data.shared.loader.ListLoadConfig; +import com.sencha.gxt.data.shared.loader.ListLoadConfigBean; +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.FramedPanel; +import com.sencha.gxt.widget.core.client.box.AlertMessageBox; +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.HideEvent; +import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler; +import com.sencha.gxt.widget.core.client.form.ComboBox; +import com.sencha.gxt.widget.core.client.form.DateField; +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" g.panichi@isti.cnr.it + * + */ +public class MapWidgetDetailCard extends WizardCard { + protected DateTimeFormat sdf = DateTimeFormat.getFormat("yyyy-MM-dd"); + + protected final String TABLEDETAILPANELWIDTH = "100%"; + protected final String TABLEDETAILPANELHEIGHT = "100%"; + protected final String FORMWIDTH = "538px"; + + protected MapCreationSession mapCreationSession; + protected MapWidgetDetailCard thisCard; + + protected VerticalLayoutContainer p; + protected VerticalPanel tableDetailPanel; + + private TextField name; + private TextField userName; + private TextField metaAbstract; + private TextField metaPurpose; + private TextField metaCredits; + private TextField metaKeywords; + + + protected ListLoader> loader; + protected ComboBox comboLicences; + + public MapWidgetDetailCard(final MapCreationSession mapCreationSession) { + super("Tabular Resource Detail", ""); + + this.mapCreationSession = mapCreationSession; + thisCard = this; + + tableDetailPanel = new VerticalPanel(); + + tableDetailPanel.setSpacing(4); + tableDetailPanel.setWidth(TABLEDETAILPANELWIDTH); + tableDetailPanel.setHeight(TABLEDETAILPANELHEIGHT); + + FramedPanel form = new FramedPanel(); + form.setHeadingText("Details"); + form.setWidth(FORMWIDTH); + + FieldSet fieldSet = new FieldSet(); + fieldSet.setHeadingText("Information"); + fieldSet.setCollapsible(false); + form.add(fieldSet); + + p = new VerticalLayoutContainer(); + fieldSet.add(p); + + name = new TextField(); + name.setAllowBlank(false); + name.setEmptyText("Enter a name..."); + name.setValue(mapCreationSession.getName()); + p.add(new FieldLabel(name, "Name"), new VerticalLayoutData(1, -1)); + + userName = new TextField(); + userName.setAllowBlank(false); + userName.setEmptyText("Enter a user name..."); + userName.setValue(mapCreationSession.getUsername()); + p.add(new FieldLabel(userName, "User Name"), new VerticalLayoutData(1, -1)); + + metaAbstract = new TextField(); + metaAbstract.setAllowBlank(false); + metaAbstract.setEmptyText("Enter a abstract..."); + metaAbstract.setValue(""); + p.add(new FieldLabel(metaAbstract, "Abstract"), new VerticalLayoutData(1, -1)); + + metaPurpose = new TextField(); + metaPurpose.setAllowBlank(false); + metaPurpose.setEmptyText("Enter a purpose..."); + metaPurpose.setValue(""); + p.add(new FieldLabel(metaPurpose, "Purpose"), new VerticalLayoutData(1, -1)); + + metaCredits = new TextField(); + metaCredits.setAllowBlank(false); + metaCredits.setEmptyText("Enter credits..."); + metaCredits.setValue(""); + p.add(new FieldLabel(metaCredits, "Credits"), new VerticalLayoutData(1, -1)); + + metaKeywords = new TextField(); + metaKeywords.setAllowBlank(false); + metaKeywords.setEmptyText("Enter keywords..."); + metaKeywords.setValue(""); + p.add(new FieldLabel(metaKeywords, "Keywords"), new VerticalLayoutData(1, -1)); + + + tableDetailPanel.add(form); + + setContent(tableDetailPanel); + + } + + protected void loadData(ListLoadConfig loadConfig, + final AsyncCallback> callback) { + TDGWTServiceAsync.INSTANCE + .getLicences(new AsyncCallback>() { + + public void onFailure(Throwable caught) { + if (caught instanceof TDGWTSessionExpiredException) { + getEventBus() + .fireEvent( + new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { + Log.error("load combo failure:" + + caught.getLocalizedMessage()); + UtilsGXT3.alert("Error", + "Error retrieving licences."); + } + callback.onFailure(caught); + } + + public void onSuccess(ArrayList result) { + Log.trace("loaded " + result.size() + " ColumnData"); + callback.onSuccess(new ListLoadResultBean( + result)); + + } + + }); + + } + + @Override + public void setup() { + Command sayNextCard = new Command() { + + public void execute() { + checkData(); + } + + }; + + getWizardWindow().setNextButtonCommand(sayNextCard); + + Command sayPreviousCard = new Command() { + public void execute() { + try { + getWizardWindow().previousCard(); + getWizardWindow().removeCard(thisCard); + Log.info("Remove CSVTableDetailCard"); + } catch (Exception e) { + Log.error("sayPreviousCard :" + e.getLocalizedMessage()); + } + } + }; + + getWizardWindow().setPreviousButtonCommand(sayPreviousCard); + getWizardWindow().setEnableNextButton(true); + + } + + protected void checkData() { + getWizardWindow().setEnableNextButton(false); + getWizardWindow().setEnableBackButton(false); + AlertMessageBox d; + HideHandler hideHandler = new HideHandler() { + + public void onHide(HideEvent event) { + getWizardWindow().setEnableNextButton(true); + getWizardWindow().setEnableBackButton(false); + + } + }; + + if (name.getValue() == null || name.getValue().isEmpty() + || !name.isValid()) { + d = new AlertMessageBox("Attention!", "Fill in name field"); + d.addHideHandler(hideHandler); + d.show(); + } else { + + name.setReadOnly(true); + goNext(); + + + } + } + + protected void goNext() { + try { + /* + detail= new TabResource(); + detail.setName(name.getCurrentValue()); + detail.setDescription(description.getCurrentValue()); + detail.setRight(rights.getCurrentValue()); + + Date vFrom = validFrom.getCurrentValue(); + if (vFrom == null) { + Log.debug("Valid From is null"); + } else { + try { + detail.setValidFrom(sdf.format(vFrom)); + } catch (Throwable e) { + Log.error("Error parsing Valid From " + + e.getLocalizedMessage()); + } + } + + Date vUntilTo = validUntilTo.getCurrentValue(); + if (vUntilTo == null) { + Log.debug("Valid Until To is null"); + } else { + try { + detail.setValidUntilTo(sdf.format(vUntilTo)); + } catch (Throwable e) { + Log.error("Error parsing Valid Until To " + + e.getLocalizedMessage()); + } + } + + if(comboLicences.getCurrentValue()!=null&& + comboLicences.getCurrentValue().getLicence()!=null && !comboLicences.getCurrentValue().getLicence().isEmpty()){ + detail.setLicence(comboLicences.getCurrentValue().getLicence()); + } + + mapCreationSession.setTabResource(detail); + */ + MapWidgetOperationInProgressCard mapWidgetOperationInProgressCard = new MapWidgetOperationInProgressCard( + mapCreationSession); + getWizardWindow().addCard(mapWidgetOperationInProgressCard); + Log.info("NextCard MapWidgetOperationInProgressCard"); + getWizardWindow().nextCard(); + } catch (Exception e) { + Log.error("sayNextCard :" + e.getLocalizedMessage()); + e.printStackTrace(); + } + } + +} diff --git a/src/main/java/org/gcube/portlets/user/td/mapwidget/client/MapWidgetOperationInProgressCard.java b/src/main/java/org/gcube/portlets/user/td/mapwidget/client/MapWidgetOperationInProgressCard.java new file mode 100644 index 0000000..4ddc84d --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/mapwidget/client/MapWidgetOperationInProgressCard.java @@ -0,0 +1,284 @@ +/** + * + */ +package org.gcube.portlets.user.td.mapwidget.client; + +import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; +import org.gcube.portlets.user.td.gwtservice.shared.json.JSONExportSession; +import org.gcube.portlets.user.td.gwtservice.shared.map.MapCreationSession; +import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException; +import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; +import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog; +import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialogListener; +import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; +import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; +import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; +import org.gcube.portlets.user.td.wizardwidget.client.WizardCard; + +import com.allen_sauer.gwt.log.client.Log; +import com.google.gwt.safehtml.shared.SafeHtmlBuilder; +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.sencha.gxt.core.client.util.Margins; +import com.sencha.gxt.widget.core.client.FramedPanel; +import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData; +import com.sencha.gxt.widget.core.client.container.HtmlLayoutContainer; +import com.sencha.gxt.widget.core.client.container.VBoxLayoutContainer; +import com.sencha.gxt.widget.core.client.container.VBoxLayoutContainer.VBoxLayoutAlign; + +/** + * + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it + * + */ +public class MapWidgetOperationInProgressCard extends WizardCard implements + MonitorDialogListener { + + protected MapWidgetOperationInProgressCard thisCard; + protected MapCreationSession mapCreationSession; + protected TRId newTrId; + protected HtmlLayoutContainer resultField; + + public MapWidgetOperationInProgressCard(final MapCreationSession mapCreationSession) { + super("Operation In Progress", ""); + + this.mapCreationSession = mapCreationSession; + 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, + "Name: "); + description.setText(0, 1, mapCreationSession.getName()); + description.setHTML(1, 0, + "Abstract: "); + description.setText(1, 1, mapCreationSession.getMetaAbstract()); + + description.setHTML(2, 0, + "Purpose: "); + description.setText(2, 1, mapCreationSession.getMetaPurpose()); + + FramedPanel summary = new FramedPanel(); + summary.setHeadingText("Map Creation"); + summary.setWidth(400); + summary.add(description); + operationInProgressPanel.add(summary, new BoxLayoutData(new Margins(20, + 5, 10, 5))); + + resultField = new HtmlLayoutContainer("
"); + + operationInProgressPanel.add(resultField, new BoxLayoutData( + new Margins(10, 5, 10, 5))); + + setContent(operationInProgressPanel); + resultField.setVisible(false); + + } + + public void mapCreation() { + TDGWTServiceAsync.INSTANCE.startMapCreation(mapCreationSession, + new AsyncCallback() { + + public void onSuccess(String taskId) { + openMonitorDialog(taskId); + + } + + public void onFailure(Throwable caught) { + if (caught instanceof TDGWTSessionExpiredException) { + getEventBus() + .fireEvent( + new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { + if (caught instanceof TDGWTIsLockedException) { + Log.error(caught.getLocalizedMessage()); + showErrorAndHide("Error Locked", + caught.getLocalizedMessage(), caught); + } else { + showErrorAndHide("Error in export", + "An error occured in export: " + + caught.getLocalizedMessage(), + caught); + + } + } + } + }); + } + + @Override + public void setup() { + getWizardWindow().setEnableBackButton(false); + setBackButtonVisible(false); + setNextButtonVisible(false); + getWizardWindow().setEnableNextButton(false); + getWizardWindow().setNextButtonToFinish(); + mapCreation(); + } + + // + protected void openMonitorDialog(String taskId) { + MonitorDialog monitorDialog = new MonitorDialog(taskId, getEventBus()); + monitorDialog.addProgressDialogListener(this); + monitorDialog.setBackgroundBtnEnabled(false); + monitorDialog.show(); + } + + @Override + public void operationComplete(TRId trId) { + newTrId = trId; + SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder(); + safeHtmlBuilder + .appendHtmlConstant("
Operation Completed
"); + resultField.setHTML(safeHtmlBuilder.toSafeHtml()); + resultField.setVisible(true); + + Command sayComplete = new Command() { + public void execute() { + try { + getWizardWindow().close(false); + Log.info("fire Complete: " + newTrId); + + getWizardWindow().fireCompleted(newTrId); + + } catch (Exception e) { + Log.error("fire Complete :" + e.getLocalizedMessage()); + } + } + }; + + getWizardWindow().setNextButtonCommand(sayComplete); + + setNextButtonVisible(true); + getWizardWindow().setEnableNextButton(true); + + forceLayout(); + + } + + @Override + public void operationFailed(Throwable caught, String reason, String details) { + SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder(); + safeHtmlBuilder + .appendHtmlConstant("
Operation Failed
"); + resultField.setHTML(safeHtmlBuilder.toSafeHtml()); + resultField.setVisible(true); + if (caught instanceof TDGWTSessionExpiredException) { + getEventBus() + .fireEvent( + new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { + showErrorAndHide("Error in Export", + reason,caught); + } + + forceLayout(); + } + + @Override + public void operationStopped(TRId trId, String reason, String details) { + newTrId = trId; + SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder(); + safeHtmlBuilder + .appendHtmlConstant("
Problems in the Operation
"); + resultField.setHTML(safeHtmlBuilder.toSafeHtml()); + resultField.setVisible(true); + + Command sayComplete = new Command() { + public void execute() { + try { + getWizardWindow().close(false); + Log.info("fire Complete: tabular resource " + + newTrId.getId()); + Log.info("fire Complete: tableId " + newTrId.getTableId()); + + getWizardWindow().fireCompleted(newTrId); + + } catch (Exception e) { + Log.error("fire Complete :" + e.getLocalizedMessage()); + } + } + }; + + getWizardWindow().setNextButtonCommand(sayComplete); + + setNextButtonVisible(true); + getWizardWindow().setEnableNextButton(true); + + forceLayout(); + } + + @Override + public void operationAborted() { + SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder(); + safeHtmlBuilder + .appendHtmlConstant("
Operation Aborted
"); + resultField.setHTML(safeHtmlBuilder.toSafeHtml()); + resultField.setVisible(true); + + Command sayComplete = new Command() { + public void execute() { + try { + getWizardWindow().close(false); + Log.info("fire Aborted"); + + getWizardWindow().fireAborted(); + + } catch (Exception e) { + Log.error("fire Aborted :" + e.getLocalizedMessage()); + } + } + }; + + getWizardWindow().setNextButtonCommand(sayComplete); + + setNextButtonVisible(true); + getWizardWindow().setEnableNextButton(true); + forceLayout(); + + } + + @Override + public void operationPutInBackground() { + SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder(); + safeHtmlBuilder + .appendHtmlConstant("
Operation in Background
"); + resultField.setHTML(safeHtmlBuilder.toSafeHtml()); + resultField.setVisible(true); + + Command sayComplete = new Command() { + public void execute() { + try { + getWizardWindow().close(false); + Log.info("fire Operation In Background"); + + getWizardWindow().firePutInBackground(); + + } catch (Exception e) { + Log.error("fire Operation In Background :" + + e.getLocalizedMessage()); + } + } + }; + + getWizardWindow().setNextButtonCommand(sayComplete); + + setNextButtonVisible(true); + getWizardWindow().setEnableNextButton(true); + forceLayout(); + + } + +} diff --git a/src/main/java/org/gcube/portlets/user/td/mapwidget/client/MapWidgetTD.java b/src/main/java/org/gcube/portlets/user/td/mapwidget/client/MapWidgetTD.java new file mode 100644 index 0000000..b6c74e4 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/mapwidget/client/MapWidgetTD.java @@ -0,0 +1,43 @@ +package org.gcube.portlets.user.td.mapwidget.client; + + + +import org.gcube.portlets.user.td.gwtservice.shared.json.JSONExportSession; +import org.gcube.portlets.user.td.wizardwidget.client.WizardWindow; +import com.google.web.bindery.event.shared.EventBus; + + + +/** + * + * @author giancarlo + * email: g.panichi@isti.cnr.it + * + */ +public class MapWidgetTD extends WizardWindow { + + protected JSONExportSession exportSession; + + + + /** + * + * @param title + * @param eventBus + */ + public MapWidgetTD(String title, EventBus eventBus) { + super(title,eventBus); + + exportSession= new JSONExportSession(); + + MapWidgetConfigCard jsonExportConfigCard=new MapWidgetConfigCard(exportSession); + addCard(jsonExportConfigCard); + jsonExportConfigCard.setup(); + + + } + + + + +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/td/mapwidget/client/MapWidgetTDEntry.java b/src/main/java/org/gcube/portlets/user/td/mapwidget/client/MapWidgetTDEntry.java new file mode 100644 index 0000000..0748078 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/mapwidget/client/MapWidgetTDEntry.java @@ -0,0 +1,15 @@ +package org.gcube.portlets.user.td.mapwidget.client; + +import com.allen_sauer.gwt.log.client.Log; +import com.google.gwt.core.client.EntryPoint; +import com.google.web.bindery.event.shared.SimpleEventBus; + +public class MapWidgetTDEntry implements EntryPoint { + + + public void onModuleLoad() { + SimpleEventBus eventBus=new SimpleEventBus(); + MapWidgetTD exportWizard= new MapWidgetTD("CSVExport",eventBus); + Log.info(exportWizard.getId()); + } +} diff --git a/src/main/java/org/gcube/portlets/user/td/mapwidget/client/grid/ColumnDataGridPanel.java b/src/main/java/org/gcube/portlets/user/td/mapwidget/client/grid/ColumnDataGridPanel.java new file mode 100644 index 0000000..723e682 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/mapwidget/client/grid/ColumnDataGridPanel.java @@ -0,0 +1,179 @@ +package org.gcube.portlets.user.td.mapwidget.client.grid; + +import java.util.ArrayList; +import java.util.List; + +import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; +import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException; +import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; +import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData; +import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; +import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; +import org.gcube.portlets.user.td.wizardwidget.client.WizardCard; + +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.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.core.client.dom.ScrollSupport.ScrollMode; +import com.sencha.gxt.core.client.util.Margins; +import com.sencha.gxt.data.client.loader.RpcProxy; +import com.sencha.gxt.data.shared.ListStore; +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.container.VerticalLayoutContainer; +import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData; +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; + +/** + * + * @author giancarlo + * email: g.panichi@isti.cnr.it + * + */ +public class ColumnDataGridPanel extends ContentPanel implements + HasSelectionHandlers { + //private static final String GRID_WIDTH ="524px"; + private static final String GRID_HEIGHT = "320px"; + protected static final ColumnDataProperties props = GWT + .create(ColumnDataProperties.class); + protected final CheckBoxSelectionModel sm; + + protected final Grid grid; + private WizardCard parent; + + /** + * + * @param parent + */ + public ColumnDataGridPanel(WizardCard parent) { + this.parent=parent; + Log.debug("ColumnDataGridPanel"); + setHeadingText("Columns"); + + ColumnConfig labelCol = new ColumnConfig( + props.label()); + + IdentityValueProvider identity = new IdentityValueProvider(); + + sm = new CheckBoxSelectionModel(identity); + + List> l = new ArrayList>(); + l.add(sm.getColumn()); + l.add(labelCol); + ColumnModel cm = new ColumnModel(l); + + ListStore store = new ListStore(props.id()); + + RpcProxy> proxy = new RpcProxy>() { + + public void load(ListLoadConfig loadConfig, + final AsyncCallback> callback) { + loadData(loadConfig, callback); + } + }; + final ListLoader> loader = new ListLoader>( + proxy); + + loader.setRemoteSort(false); + loader.addLoadHandler(new LoadResultListStoreBinding>( + store) { + }); + + grid = new Grid(store, cm) { + @Override + protected void onAfterFirstAttach() { + super.onAfterFirstAttach(); + Scheduler.get().scheduleDeferred(new ScheduledCommand() { + + public void execute() { + loader.load(); + } + }); + } + }; + + sm.setSelectionMode(SelectionMode.MULTI); + grid.setLoader(loader); + grid.setSelectionModel(sm); + grid.setHeight(GRID_HEIGHT); + //grid.setWidth(GRID_WIDTH); + // grid.getView().setAutoExpandColumn(labelCol); + grid.getView().setStripeRows(true); + grid.getView().setColumnLines(true); + grid.getView().setAutoFill(true); + grid.setBorders(false); + grid.setLoadMask(true); + grid.setColumnReordering(false); + + VerticalLayoutContainer con = new VerticalLayoutContainer(); + con.setScrollMode(ScrollMode.AUTO); + con.add(grid, new VerticalLayoutData(-1, -1, new Margins(0))); + setWidget(con); + + } + + public Grid getGrid() { + return grid; + } + + protected void loadData(ListLoadConfig loadConfig, + final AsyncCallback> callback) { + TDGWTServiceAsync.INSTANCE + .getColumns(new AsyncCallback>() { + + public void onFailure(Throwable caught) { + if (caught instanceof TDGWTSessionExpiredException) { + parent.getEventBus() + .fireEvent( + new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { + if (caught instanceof TDGWTIsLockedException) { + Log.error(caught.getLocalizedMessage()); + parent.showErrorAndHide("Error Locked", + caught.getLocalizedMessage(), caught); + } else { + + Log.error("No load columns: " + + caught.getLocalizedMessage()); + } + } + callback.onFailure(caught); + } + + public void onSuccess(ArrayList result) { + Log.trace("loaded " + result.size() + " columns"); + callback.onSuccess(new ListLoadResultBean( + result)); + sm.selectAll(); + forceLayout(); + } + }); + } + + public ArrayList getSelectedItems() { + return new ArrayList(grid.getSelectionModel() + .getSelectedItems()); + + } + + public HandlerRegistration addSelectionHandler( + SelectionHandler handler) { + return grid.getSelectionModel().addSelectionHandler(handler); + } + +} diff --git a/src/main/java/org/gcube/portlets/user/td/mapwidget/client/grid/ColumnDataProperties.java b/src/main/java/org/gcube/portlets/user/td/mapwidget/client/grid/ColumnDataProperties.java new file mode 100644 index 0000000..d4259e2 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/mapwidget/client/grid/ColumnDataProperties.java @@ -0,0 +1,29 @@ +package org.gcube.portlets.user.td.mapwidget.client.grid; + +import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData; + +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 + * email: g.panichi@isti.cnr.it + * + */ +public interface ColumnDataProperties extends + PropertyAccess { + + @Path("id") + ModelKeyProvider id(); + + ValueProvider label(); + + //ValueProvider typeName(); + + //ValueProvider typeCode(); + + +} diff --git a/src/main/resources/org/gcube/portlets/user/td/mapwidget/MapWidgetTD.gwt.xml b/src/main/resources/org/gcube/portlets/user/td/mapwidget/MapWidgetTD.gwt.xml new file mode 100644 index 0000000..17efc2d --- /dev/null +++ b/src/main/resources/org/gcube/portlets/user/td/mapwidget/MapWidgetTD.gwt.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/org/gcube/portlets/user/td/mapwidget/client/Messages.properties b/src/main/resources/org/gcube/portlets/user/td/mapwidget/client/Messages.properties new file mode 100644 index 0000000..c222555 --- /dev/null +++ b/src/main/resources/org/gcube/portlets/user/td/mapwidget/client/Messages.properties @@ -0,0 +1,2 @@ +sendButton = Send +nameField = Enter your name \ No newline at end of file diff --git a/src/main/resources/org/gcube/portlets/user/td/mapwidget/client/Messages_fr.properties b/src/main/resources/org/gcube/portlets/user/td/mapwidget/client/Messages_fr.properties new file mode 100644 index 0000000..b4a7627 --- /dev/null +++ b/src/main/resources/org/gcube/portlets/user/td/mapwidget/client/Messages_fr.properties @@ -0,0 +1,2 @@ +sendButton = Envoyer +nameField = Entrez votre nom \ No newline at end of file diff --git a/src/main/webapp/MapWidgetTD.css b/src/main/webapp/MapWidgetTD.css new file mode 100644 index 0000000..7aca7ac --- /dev/null +++ b/src/main/webapp/MapWidgetTD.css @@ -0,0 +1,34 @@ +/** Add css rules here for your application. */ + + +/** Example rules used by the template application (remove for your app) */ +h1 { + font-size: 2em; + font-weight: bold; + color: #777777; + margin: 40px 0px 70px; + text-align: center; +} + +.sendButton { + display: block; + font-size: 16pt; +} + +/** Most GWT widgets already have a style name defined */ +.gwt-DialogBox { + width: 400px; +} + +.dialogVPanel { + margin: 5px; +} + +.serverResponseLabelError { + color: red; +} + +/** Set ids using widget.getElement().setId("idOfElement") */ +#closeButton { + margin: 15px 6px 6px; +} diff --git a/src/main/webapp/MapWidgetTD.html b/src/main/webapp/MapWidgetTD.html new file mode 100644 index 0000000..39185d6 --- /dev/null +++ b/src/main/webapp/MapWidgetTD.html @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + Web Application Starter Project + + + + + + + + + + + + + + + + + + + + + + +

Web Application Starter Project

+ + + + + + + + + + + + +
Please enter your name:
+ + diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..49bfdea --- /dev/null +++ b/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,35 @@ + + + + + + + + TDGWTService + org.gcube.portlets.user.td.gwtservice.server.TDGWTServiceImpl + + + + jUnitHostImpl + com.google.gwt.junit.server.JUnitHostImpl + + + + + TDGWTService + MapWidget/TDGWTService + + + + jUnitHostImpl + MapWidget/junithost/* + + + + + MapWidgetTD.html + + + diff --git a/src/test/java/org/gcube/portlets/user/td/mapwidget/client/GwtTestMapWidgetTD.java b/src/test/java/org/gcube/portlets/user/td/mapwidget/client/GwtTestMapWidgetTD.java new file mode 100644 index 0000000..9e26177 --- /dev/null +++ b/src/test/java/org/gcube/portlets/user/td/mapwidget/client/GwtTestMapWidgetTD.java @@ -0,0 +1,83 @@ +package org.gcube.portlets.user.td.mapwidget.client; + +import java.util.ArrayList; + +import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTService; +import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; +import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.junit.client.GWTTestCase; +import com.google.gwt.user.client.rpc.AsyncCallback; +import com.google.gwt.user.client.rpc.ServiceDefTarget; + +/** + * GWT JUnit integration tests must extend GWTTestCase. + * Using "GwtTest*" naming pattern exclude them from running with + * surefire during the test phase. + * + * If you run the tests using the Maven command line, you will have to + * navigate with your browser to a specific url given by Maven. + * See http://mojo.codehaus.org/gwt-maven-plugin/user-guide/testing.html + * for details. + */ +public class GwtTestMapWidgetTD extends GWTTestCase { + + /** + * Must refer to a valid module that sources this class. + */ + public String getModuleName() { + return "org.gcube.portlets.user.mapwidget.MapWidgetTDJUnit"; + } + + /** + * This test will send a request to the server + */ + public void testResource() { + // Create the service that we will test. + TDGWTServiceAsync tdGWTService = GWT.create(TDGWTService.class); + ServiceDefTarget target = (ServiceDefTarget) tdGWTService; + System.out.println(GWT.getModuleBaseURL() + "TDGWTService"); + target.setServiceEntryPoint(GWT.getModuleBaseURL() + "TDGWTService"); + + // Since RPC calls are asynchronous, we will need to wait for a response + // after this test method returns. This line tells the test runner to wait + // up to 7 seconds before timing out. + delayTestFinish(7000); + + // Send a request to the server. + tdGWTService.getTabularResources(new AsyncCallback>() { + + + public void onFailure(Throwable caught) { + // The request resulted in an unexpected error. + fail("Request failure: " + caught.getMessage()); + + } + + + public void onSuccess(ArrayList result) { + // Shows the first three resources. + int i=0; + for(TabResource tr:result){ + i++; + System.out.println(tr.toString()); + if(i>3){ + break; + } + } + + assertTrue(result.size()>0); + + // Now that we have received a response, we need to tell the test runner + // that the test is complete. You must call finishTest() after an + // asynchronous test finishes successfully, or the test will time out. + finishTest(); + + } + }); + + } + + +} diff --git a/src/test/resources/org/gcube/portlets/user/td/mapwidget/MapWidgetTDJUnit.gwt.xml b/src/test/resources/org/gcube/portlets/user/td/mapwidget/MapWidgetTDJUnit.gwt.xml new file mode 100644 index 0000000..1a3a120 --- /dev/null +++ b/src/test/resources/org/gcube/portlets/user/td/mapwidget/MapWidgetTDJUnit.gwt.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + diff --git a/templates/INSTALL b/templates/INSTALL new file mode 100644 index 0000000..e69de29 diff --git a/templates/LICENSE b/templates/LICENSE new file mode 100644 index 0000000..cc51139 --- /dev/null +++ b/templates/LICENSE @@ -0,0 +1,6 @@ +gCube System - License +------------------------------------------------------------ + +The gCube/gCore software is licensed as Free Open Source software conveying to the EUPL (http://ec.europa.eu/idabc/eupl). +The software and documentation is provided by its authors/distributors "as is" and no expressed or +implied warranty is given for its use, quality or fitness for a particular case. \ No newline at end of file diff --git a/templates/MAINTAINERS b/templates/MAINTAINERS new file mode 100644 index 0000000..0bc9be3 --- /dev/null +++ b/templates/MAINTAINERS @@ -0,0 +1 @@ +Giancarlo Panichi (giancarlo.panichi@isti.cnr.it), CNR Pisa, Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" diff --git a/templates/README b/templates/README new file mode 100644 index 0000000..7e3ad55 --- /dev/null +++ b/templates/README @@ -0,0 +1,48 @@ +The gCube System - ${name} +------------------------------------------------------------ + +This work has been supported by the following European projects: iMarine (FP7-INFRASTRUCTURES-2011-2) + +Authors +------- + +Giancarlo Panichi (giancarlo.panichi@isti.cnr.it), CNR Pisa, +Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" + + +Version and Release Date +------------------------ + +v. ${version} (${release.date}) + + +Description +----------- + +${project.description} + + +Download information +-------------------- +Source code is available from SVN: + ${scm.url} + +Binaries can be downloaded from: + http://software.d4science.research-infrastructures.eu/ + + +Documentation +------------- + +${project.description} + +Documentation is available on-line from the Projects Documentation Wiki: + ${wikiurl} + + +Licensing +--------- + +This software is licensed under the terms you may find in the file named "LICENSE" in this directory. + + diff --git a/templates/changelog.xml b/templates/changelog.xml new file mode 100644 index 0000000..07cb684 --- /dev/null +++ b/templates/changelog.xml @@ -0,0 +1,6 @@ + + + First Release + + \ No newline at end of file diff --git a/templates/descriptor.xml b/templates/descriptor.xml new file mode 100644 index 0000000..b978636 --- /dev/null +++ b/templates/descriptor.xml @@ -0,0 +1,39 @@ + + servicearchive + + tar.gz + + / + + + ${distroDirectory} + / + true + + README + LICENSE + INSTALL + MAINTAINERS + changelog.xml + + 755 + + + + + ${distroDirectory}/svnpath.txt + /${artifactId} + + + ${configDirectory}/profile.xml + / + + + target/${build.finalName}.${packaging} + /${artifactId} + + + \ No newline at end of file diff --git a/templates/profile.xml b/templates/profile.xml new file mode 100644 index 0000000..19ed5bc --- /dev/null +++ b/templates/profile.xml @@ -0,0 +1,29 @@ + + + + Service + + ${project.description} + PortletsUser + ${project.name} + ${version} + + + ${project.description} + ${project.name} + ${version} + + ${project.groupId} + ${project.artifactId} + ${project.version} + + library + + ${project.build.finalName}.${project.packaging} + + + + + + + diff --git a/templates/svnpath.txt b/templates/svnpath.txt new file mode 100644 index 0000000..dcd0d22 --- /dev/null +++ b/templates/svnpath.txt @@ -0,0 +1 @@ +${scm.url} \ No newline at end of file