From 2f731634faca0fd05d9d1fc3f8a54ebc8f4ef76b Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Tue, 29 Oct 2013 12:05:16 +0000 Subject: [PATCH] Initial import. git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-wizard-widget@84545 82a268e6-3cf1-43bd-a215-b396298e98cf --- WizardTest-dev.launch | 22 + WizardTest-prod.launch | 22 + pom.xml | 287 +++++++++++ .../wizardwidget/client/SimpleWizardCard.java | 35 ++ .../td/wizardwidget/client/WizardCard.java | 275 +++++++++++ .../td/wizardwidget/client/WizardEntry.java | 18 + .../wizardwidget/client/WizardListener.java | 35 ++ .../td/wizardwidget/client/WizardWindow.java | 458 ++++++++++++++++++ .../client/dataresource/ResourceBundle.java | 31 ++ .../client/dataresource/WizardCSS.java | 41 ++ .../client/util/ErrorMessageBox.java | 67 +++ .../td/wizardwidget/client/util/Format.java | 37 ++ .../wizardwidget/client/util/NOPCallBack.java | 24 + .../user/td/wizardwidget/Wizard.gwt.xml | 29 ++ .../wizardwidget/client/Messages.properties | 2 + .../client/Messages_fr.properties | 2 + .../dataresource/resources/WizardTD.css | 40 ++ .../client/dataresource/resources/accept.png | Bin 0 -> 781 bytes .../dataresource/resources/arrow-refresh.png | Bin 0 -> 984 bytes .../resources/arrow-refresh_16.png | Bin 0 -> 572 bytes .../resources/arrow-refresh_32.png | Bin 0 -> 1182 bytes .../client/dataresource/resources/error.png | Bin 0 -> 701 bytes .../dataresource/resources/information.png | Bin 0 -> 778 bytes .../client/dataresource/resources/loading.gif | Bin 0 -> 771 bytes src/main/webapp/WEB-INF/web.xml | 35 ++ src/main/webapp/Wizard.css | 34 ++ src/main/webapp/Wizard.html | 50 ++ .../td/wizardwidget/client/GwtTestWizard.java | 84 ++++ .../user/td/wizardwidget/WizardJUnit.gwt.xml | 13 + templates/INSTALL | 0 templates/LICENSE | 6 + templates/MAINTAINERS | 1 + templates/README | 40 ++ templates/changelog.xml | 6 + templates/descriptor.xml | 39 ++ templates/profile.xml | 29 ++ templates/svnpath.txt | 1 + 37 files changed, 1763 insertions(+) create mode 100644 WizardTest-dev.launch create mode 100644 WizardTest-prod.launch create mode 100644 pom.xml create mode 100644 src/main/java/org/gcube/portlets/user/td/wizardwidget/client/SimpleWizardCard.java create mode 100644 src/main/java/org/gcube/portlets/user/td/wizardwidget/client/WizardCard.java create mode 100644 src/main/java/org/gcube/portlets/user/td/wizardwidget/client/WizardEntry.java create mode 100644 src/main/java/org/gcube/portlets/user/td/wizardwidget/client/WizardListener.java create mode 100644 src/main/java/org/gcube/portlets/user/td/wizardwidget/client/WizardWindow.java create mode 100644 src/main/java/org/gcube/portlets/user/td/wizardwidget/client/dataresource/ResourceBundle.java create mode 100644 src/main/java/org/gcube/portlets/user/td/wizardwidget/client/dataresource/WizardCSS.java create mode 100644 src/main/java/org/gcube/portlets/user/td/wizardwidget/client/util/ErrorMessageBox.java create mode 100644 src/main/java/org/gcube/portlets/user/td/wizardwidget/client/util/Format.java create mode 100644 src/main/java/org/gcube/portlets/user/td/wizardwidget/client/util/NOPCallBack.java create mode 100644 src/main/resources/org/gcube/portlets/user/td/wizardwidget/Wizard.gwt.xml create mode 100644 src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/Messages.properties create mode 100644 src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/Messages_fr.properties create mode 100644 src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/dataresource/resources/WizardTD.css create mode 100644 src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/dataresource/resources/accept.png create mode 100644 src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/dataresource/resources/arrow-refresh.png create mode 100644 src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/dataresource/resources/arrow-refresh_16.png create mode 100644 src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/dataresource/resources/arrow-refresh_32.png create mode 100644 src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/dataresource/resources/error.png create mode 100644 src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/dataresource/resources/information.png create mode 100644 src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/dataresource/resources/loading.gif create mode 100644 src/main/webapp/WEB-INF/web.xml create mode 100644 src/main/webapp/Wizard.css create mode 100644 src/main/webapp/Wizard.html create mode 100644 src/test/java/org/gcube/portlets/user/td/wizardwidget/client/GwtTestWizard.java create mode 100644 src/test/resources/org/gcube/portlets/user/td/wizardwidget/WizardJUnit.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/WizardTest-dev.launch b/WizardTest-dev.launch new file mode 100644 index 0000000..a1c44df --- /dev/null +++ b/WizardTest-dev.launch @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/WizardTest-prod.launch b/WizardTest-prod.launch new file mode 100644 index 0000000..c896829 --- /dev/null +++ b/WizardTest-prod.launch @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..0c1528c --- /dev/null +++ b/pom.xml @@ -0,0 +1,287 @@ + + + + + maven-parent + org.gcube.tools + 1.0.0 + + + + + + 4.0.0 + org.gcube.portlets.user + tabular-data-wizard-widget + 1.0.0-SNAPSHOT + + tabular-data-wizard-widget + tabular-data-wizard-widget allows the creation of wizard for tabular data portlet + + + https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-wizard-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} + 2013-10-18 + templates + distro + config + + + 2.5.1 + + ${env.GLOBUS_LOCATION} + + 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 + 1.0.0-SNAPSHOT + + + + + + + com.allen-sauer.gwt.log + gwt-log + + + + 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 + + + + + Wizard.html + ${webappDirectory} + org.gcube.portlets.user.td.wizardwidget.Wizard + + + + + + 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/wizardwidget/client/SimpleWizardCard.java b/src/main/java/org/gcube/portlets/user/td/wizardwidget/client/SimpleWizardCard.java new file mode 100644 index 0000000..fb9811d --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/wizardwidget/client/SimpleWizardCard.java @@ -0,0 +1,35 @@ +/** + * + */ +package org.gcube.portlets.user.td.wizardwidget.client; + +import com.google.gwt.user.client.ui.HTML; +import com.sencha.gxt.widget.core.client.ContentPanel; + +/** + * + * @author "Giancarlo Panichi" + * g.panichi@isti.cnr.it + * + */ +public class SimpleWizardCard extends WizardCard { + + /** + * Create a new simple wizard card. + * @param title the card title. + * @param footer the card footer. + * @param content the card content. + */ + public SimpleWizardCard(String title, String footer, String content) { + super(title, footer); + + ContentPanel contentPanel = new ContentPanel(); + contentPanel.setHeaderVisible(false); + HTML htmlContent = new HTML(content); + htmlContent.setStyleName("wizard-simple-content"); + contentPanel.add(htmlContent); + + setContent(contentPanel); + } + +} diff --git a/src/main/java/org/gcube/portlets/user/td/wizardwidget/client/WizardCard.java b/src/main/java/org/gcube/portlets/user/td/wizardwidget/client/WizardCard.java new file mode 100644 index 0000000..72d19aa --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/wizardwidget/client/WizardCard.java @@ -0,0 +1,275 @@ +/** + * + */ +package org.gcube.portlets.user.td.wizardwidget.client; + +import org.gcube.portlets.user.td.wizardwidget.client.dataresource.ResourceBundle; + +import com.allen_sauer.gwt.log.client.Log; + +import com.google.gwt.user.client.ui.HTML; +import com.sencha.gxt.widget.core.client.Component; +import com.sencha.gxt.widget.core.client.ContentPanel; +import com.sencha.gxt.widget.core.client.container.BorderLayoutContainer; +import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler; + +/** + * + * @author "Giancarlo Panichi" + * g.panichi@isti.cnr.it + * + */ +public class WizardCard extends BorderLayoutContainer { + + private WizardWindow wizardWindow; + protected ContentPanel titlePanel; + protected ContentPanel footerPanel; + protected boolean calculateFooter = false; + protected HTML titleHtml; + protected HTML footerHtml; + + final protected ResourceBundle res=ResourceBundle.INSTANCE; + + /** + * Creates a new wizard card. + * The footer is automatically calculated. + * @param title the card title. + */ + public WizardCard(String title) { + this(title,""); + calculateFooter = true; + } + + /** + * Creates a new wizard card. + * @param title the card title. + * @param footer the card footer. + */ + public WizardCard(String title, String footer) { + Log.info(title); + res.wizardCSS().ensureInjected(); + + //add the title panel + titlePanel = new ContentPanel(); + titlePanel.setHeight(30); + titlePanel.setBodyStyle("background-color:#C3D9FF"); + titlePanel.setHeaderVisible(false); + + titleHtml = new HTML(title); + titleHtml.setStylePrimaryName(res.wizardCSS().getWizardTitle()); + titlePanel.add(titleHtml); + + setNorthWidget(titlePanel, new BorderLayoutData(30)); + + //add the footer panel + footerPanel = new ContentPanel(); + footerPanel.setHeight(30); + footerPanel.setBodyStyle("background-color:#CDEB8B"); + footerPanel.setHeaderVisible(false); + + footerHtml = new HTML(footer); + footerHtml.setStylePrimaryName(res.wizardCSS().getWizardFooter()); + footerPanel.add(footerHtml); + + setSouthWidget(footerPanel, new BorderLayoutData(30)); + + } + + + /** + * {@inheritDoc} + */ + public void setTitle(String title) + { + titleHtml.setHTML("

"+title+"

"); + } + + /** + * Sets the card footer. + * @param footer the footer. + */ + public void setFooter(String footer) + { + footerHtml.setHTML("

"+footer+"

"); + } + + /** + * Sets the card content. + * @param content the card content. + */ + public void setContent(Component content) + { + setCenterWidget(content); + } + + /** + * Sets the card content. + * @param content the card content. + */ + public void setContent(com.google.gwt.user.client.ui.Panel content) + { + setCenterWidget(content); + } + + /** + * Enables the next button. + * @param enable true to enable it, false otherwise. + */ + public void setEnableNextButton(boolean enable) + { + if (wizardWindow!=null){ + wizardWindow.setEnableNextButton(enable); + } + } + + /** + * Enables the back button. + * @param enable true to enable the button, false otherwise. + */ + public void setEnableBackButton(boolean enable) + { + if (wizardWindow!=null){ + wizardWindow.setEnableBackButton(enable); + } + } + + /** + * Sets the next button label. + * @param text the button label. + */ + public void setNextButtonText(String text) + { + if (wizardWindow!=null){ + wizardWindow.setNextButtonText(text); + } + } + + /** + * Sets the back button label. + * @param text the button label. + */ + + public void setBackButtonText(String text) + { + if (wizardWindow!=null){ + wizardWindow.setBackButtonText(text); + } + } + + + /** + * Visible the next button. + * @param visible true to show the button, false otherwise. + */ + public void setNextButtonVisible(boolean visible) + { + if (wizardWindow!=null){ + wizardWindow.setNextButtonVisible(visible); + } + } + + /** + * Visible the back button. + * @param visible true to show the button, false otherwise. + */ + public void setBackButtonVisible(boolean visible) + { + if (wizardWindow!=null){ + wizardWindow.setBackButtonVisible(visible); + } + } + + + public void setNextButtonToFinish() + { + if (wizardWindow!=null){ + wizardWindow.setNextButtonToFinish(); + } + } + + /** + * Sets the WizardWindow for this import card. + * @param wizardWindow the WizardWindow. + */ + protected void setWizardWindow(WizardWindow wizardWindow) + { + this.wizardWindow = wizardWindow; + if (calculateFooter) { + StringBuilder footer = new StringBuilder(); + footer.append("Step "); + footer.append(getCardPosition()); + footer.append(" of "); + footer.append(getCardSize()); + setFooter(footer.toString()); + } + } + + /** + * Returns the current wizard window. + * @return the wizard window. + */ + protected WizardWindow getWizardWindow() + { + if (wizardWindow==null) throw new IllegalStateException("No Wizard Window setup"); + return wizardWindow; + } + + public void addToWindowTitle(String toAdd) + { + wizardWindow.setTitle(wizardWindow.getOriginalTitle()+toAdd); + } + + /** + * Called before the card is showed. + */ + public void setup() + { + } + + /** + * Called when the card is disposed. + */ + public void dispose() + {} + + /** + * Add a listener to the next button. + * @param listener the listener to add. + */ + public void addNextButtonListener(SelectHandler listener) + { + if (wizardWindow!=null){ + wizardWindow.addNextButtonListener(listener); + } + } + + /** + * Gets the number of cards in the wizard window. + * @return the number of cards. + */ + public int getCardSize() + { + return getWizardWindow().getCardStackSize(); + } + + /** + * Returns this card position on card list. + * @return the card position on the card stack. + */ + public int getCardPosition() + { + int indexPosition = getWizardWindow().getCardStack().indexOf(this); + return (indexPosition>=0)?indexPosition+1:indexPosition; + } + + public void showErrorAndHide(String title, final String failureReason, final String failureDetails, final Throwable throwable) + { + wizardWindow.showErrorAndHide(title, failureReason, failureDetails, throwable); + } + + public void hideWindow() + { + wizardWindow.hide(); + } + +} diff --git a/src/main/java/org/gcube/portlets/user/td/wizardwidget/client/WizardEntry.java b/src/main/java/org/gcube/portlets/user/td/wizardwidget/client/WizardEntry.java new file mode 100644 index 0000000..854c369 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/wizardwidget/client/WizardEntry.java @@ -0,0 +1,18 @@ +package org.gcube.portlets.user.td.wizardwidget.client; + +import com.allen_sauer.gwt.log.client.Log; +import com.google.gwt.core.client.EntryPoint; + + +public class WizardEntry implements EntryPoint { + + @Override + public void onModuleLoad() { + + + WizardWindow wizardWindow = new WizardWindow("TestWindow"); + + Log.info("Window Id: " + wizardWindow.getId()); + + } +} diff --git a/src/main/java/org/gcube/portlets/user/td/wizardwidget/client/WizardListener.java b/src/main/java/org/gcube/portlets/user/td/wizardwidget/client/WizardListener.java new file mode 100644 index 0000000..aea2077 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/wizardwidget/client/WizardListener.java @@ -0,0 +1,35 @@ +/** + * + */ +package org.gcube.portlets.user.td.wizardwidget.client; + +import org.gcube.portlets.user.td.gwtservice.shared.TRId; + + +/** + * + * @author "Giancarlo Panichi" + * g.panichi@isti.cnr.it + * + */ +public interface WizardListener { + + /** + * Called when the wizard is completed without errors + */ + public void completed(TRId id); + + /** + * Called when the wizard has been aborted by the user. + */ + public void aborted(); + + /** + * Called when the something in the wizard is failed. + * @param throwable the exception or null. + * @param reason the failure reason or null. + * @param details the failure details or null. + */ + public void failed(Throwable throwable, String reason, String details); + +} diff --git a/src/main/java/org/gcube/portlets/user/td/wizardwidget/client/WizardWindow.java b/src/main/java/org/gcube/portlets/user/td/wizardwidget/client/WizardWindow.java new file mode 100644 index 0000000..a16e752 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/wizardwidget/client/WizardWindow.java @@ -0,0 +1,458 @@ +/** + * + */ +package org.gcube.portlets.user.td.wizardwidget.client; + +import java.util.ArrayList; + +import org.gcube.portlets.user.td.wizardwidget.client.util.ErrorMessageBox; +import org.gcube.portlets.user.td.gwtservice.shared.TRId; + +import com.allen_sauer.gwt.log.client.Log; +import com.google.gwt.core.client.Callback; +import com.google.gwt.user.client.Command; +import com.google.gwt.user.client.ui.Widget; +import com.google.web.bindery.event.shared.SimpleEventBus; +import com.sencha.gxt.core.client.resources.ThemeStyles; +import com.sencha.gxt.widget.core.client.Dialog; +import com.sencha.gxt.widget.core.client.Window; +import com.sencha.gxt.widget.core.client.button.TextButton; +import com.sencha.gxt.widget.core.client.container.CardLayoutContainer; +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.toolbar.FillToolItem; +import com.sencha.gxt.widget.core.client.toolbar.ToolBar; + +/** + * + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it + * + */ +public class WizardWindow extends Window { + + protected final String WIZARDWIDTH = "640px"; + protected final String WIZARDHEIGHT = "480px"; + protected final boolean WIZARRESIZABLE = false; + protected final boolean WIZARDCOLLAPSIBLE = true; + protected final String BUTTONBACKLABEL="Back"; + protected final String BUTTONNEXTLABEL="Next"; + protected final String BUTTONFINISHLABEL="Finish"; + + + protected ArrayList cardStack = new ArrayList(); + + protected TextButton backButton; + + protected TextButton nextButton; + + protected String originalTitle; + + protected boolean checkBeforeClose = true; + + protected boolean nextCardFinish = false; + + protected Command nextButtonAction = null; + + protected Command previousButtonAction = null; + + protected CardLayoutContainer cardContainer; + + protected ArrayList listeners; + + protected SimpleEventBus eventBus; + + /** + * Create a new Wizard Window with the specified title. + * + * @param title + * the wizard window title. + */ + public WizardWindow(String title) { + super(); + this.eventBus = new SimpleEventBus(); + Log.info(title); + // setModal(true); + setResizable(WIZARRESIZABLE); + setCollapsible(WIZARDCOLLAPSIBLE); + setWidth(WIZARDWIDTH); + setHeight(WIZARDHEIGHT); + + listeners = new ArrayList(); + + setHeadingText(title); + this.originalTitle = title; + + VerticalLayoutContainer container = new VerticalLayoutContainer(); + + cardContainer = new CardLayoutContainer(); + container.add(cardContainer, new VerticalLayoutData(1, 1)); + + ToolBar toolbar = new ToolBar(); + toolbar.addStyleName(ThemeStyles.getStyle().borderTop()); + + backButton = new TextButton(BUTTONBACKLABEL); + backButton.setEnabled(false); + backButton.setTabIndex(1001); + toolbar.add(backButton); + toolbar.add(new FillToolItem()); + + nextButton = new TextButton(BUTTONNEXTLABEL); + nextButton.setTabIndex(1000); + toolbar.add(nextButton); + + toolbar.setLayoutData(new VerticalLayoutData(1, -1)); + container.add(toolbar); + + SelectHandler selectionHandler = new SelectHandler() { + + @Override + public void onSelect(SelectEvent event) { + TextButton button = (TextButton) event.getSource(); + String btnID = button.getId(); + + if (btnID.equals(backButton.getId())) { + + if (previousButtonAction != null) + previousButtonAction.execute(); + else + previousCard(); + } else { + + if (nextButtonAction != null) + nextButtonAction.execute(); + else + nextCard(); + } + + } + }; + + backButton.addSelectHandler(selectionHandler); + nextButton.addSelectHandler(selectionHandler); + + setWidget(container); + } + + + /** + * {@inheritDoc} + */ + @Override + protected void initTools() { + super.initTools(); + + closeBtn.addSelectHandler(new SelectHandler() { + + @Override + public void onSelect(SelectEvent event) { + fireAborted(); + hide(); + } + }); + + } + + public void addListener(WizardListener listener) { + listeners.add(listener); + } + + public void removeListener(WizardListener listener) { + listeners.remove(listener); + } + + /** + * Shows the next available card. + */ + public void nextCard() { + + Widget activeItem = cardContainer.getActiveWidget(); + + if (activeItem instanceof WizardCard) + ((WizardCard) activeItem).dispose(); + + int cardPos = cardStack.indexOf(activeItem); + + // NEXT -> + + nextButton.setEnabled(true); + backButton.setEnabled(true); + + int newPos = cardPos + 1; + + if (newPos == 0) { + // we are moving forward from the first card + backButton.setEnabled(false); + } + + nextButtonAction = null; + previousButtonAction = null; + Log.info("cardStack size:" + cardStack.size()); + WizardCard card = cardStack.get(newPos); + cardContainer.setActiveWidget(card); + doLayout(); + if (card instanceof WizardCard) + ((WizardCard) card).setup(); + } + + /** + * Shows the previous available card. + */ + public void previousCard() { + Widget activeItem = cardContainer.getActiveWidget(); + + if (activeItem instanceof WizardCard) + ((WizardCard) activeItem).dispose(); + + int cardPos = cardStack.indexOf(activeItem); + + // BACK <- + + nextButton.setEnabled(true); + backButton.setEnabled(true); + + int newPos = cardPos - 1; + + if (newPos == 0) { + backButton.setEnabled(false); + } + + nextButtonAction = null; + previousButtonAction = null; + + WizardCard card = cardStack.get(newPos); + cardContainer.setActiveWidget(card); + doLayout(); + if (card instanceof WizardCard) + ((WizardCard) card).setup(); + } + + /** + * Returns the number of available cards. + * + * @return + */ + public int getCardStackSize() { + return cardStack.size(); + } + + /** + * Returns the current active card. + * + * @return + */ + public int getCurrentCard() { + return cardStack.indexOf(cardContainer.getActiveWidget()); + } + + public boolean checkBeforeClose() { + return true; + } + + public void close(boolean check) { + checkBeforeClose = check; + hide(); + } + + /** + * Sets the label of next button to "Finish" value and add a close command + * to it. + */ + public void setNextButtonToFinish() { + nextButton.setText(BUTTONFINISHLABEL); + nextButtonAction = new Command() { + + public void execute() { + close(false); + } + }; + } + + /** + * Set the command for the next button. + * + * @param command + * the command to execute. + */ + public void setNextButtonCommand(Command command) { + nextButtonAction = command; + } + + /** + * Set the command for the previous button. + * + * @param command + * the command to execute. + */ + public void setPreviousButtonCommand(Command command) { + previousButtonAction = command; + } + + /** + * {@inheritDoc} + */ + @Override + public void show() { + super.show(); + + Widget activeItem = cardContainer.getActiveWidget(); + + if (activeItem instanceof WizardCard) + ((WizardCard) activeItem).setup(); + } + + /** + * Set the card list. + * + * @param cards + */ + public void setCards(ArrayList cards) { + for (WizardCard card : cards) { + addCard(card); + } + } + + /** + * Adds a card to this wizard. + * + * @param card + * the card to add. + */ + public void addCard(WizardCard card) { + card.setWizardWindow(this); + cardContainer.add(card); + cardStack.add(card); + } + + /** + * Remove a card to this wizard. + * + * @param card + * the card to add. + */ + public void removeCard(WizardCard card) { + cardContainer.remove(card); + cardStack.remove(card); + } + + /** + * Enables the next button on the wizard. + * + * @param enable + * true to enable the next button, + * false otherwise. + */ + public void setEnableNextButton(boolean enable) { + nextButton.setEnabled(enable); + } + + /** + * Enables the back button on the wizard. + * + * @param enable + * true to enable the back button, + * false otherwise. + */ + public void setEnableBackButton(boolean enable) { + backButton.setEnabled(enable); + } + + /** + * Sets the next button label. + * + * @param text + * the button label. + */ + protected void setNextButtonText(String text) { + nextButton.setText(text); + + } + + /** + * Sets the back button label. + * + * @param text + * the button label. + */ + protected void setBackButtonText(String text) { + backButton.setText(text); + } + + /** + * Sets visible next button. + * + * @param visible + */ + protected void setNextButtonVisible(boolean visible) { + nextButton.setVisible(visible); + } + + /** + * Sets visible back button. + * + * @param visible + */ + protected void setBackButtonVisible(boolean visible) { + backButton.setVisible(visible); + } + + /** + * Add a listener to the next button. + * + * @param listener + * the listener to add. + */ + protected void addNextButtonListener(SelectHandler listener) { + nextButton.addSelectHandler(listener); + } + + /** + * @return the originalTitle + */ + public String getOriginalTitle() { + return originalTitle; + } + + /** + * Returns the card list. + * + * @return teh card list. + */ + public ArrayList getCardStack() { + return cardStack; + } + + public void showErrorAndHide(String title, final String failureReason, + final String failureDetails, final Throwable throwable) { + ErrorMessageBox.showError(title, failureReason, failureDetails, + new Callback() { + + @Override + public void onSuccess(Dialog result) { + } + + @Override + public void onFailure(Void reason) { + hide(); + fireFailed(throwable, failureReason, failureDetails); + } + }); + } + + public void fireCompleted(TRId id) { + for (WizardListener listener : listeners) + listener.completed(id); + } + + public void fireAborted() { + for (WizardListener listener : listeners) + listener.aborted(); + } + + public void fireFailed(Throwable throwable, String reason, String details) { + for (WizardListener listener : listeners) + listener.failed(throwable, reason, details); + } +} diff --git a/src/main/java/org/gcube/portlets/user/td/wizardwidget/client/dataresource/ResourceBundle.java b/src/main/java/org/gcube/portlets/user/td/wizardwidget/client/dataresource/ResourceBundle.java new file mode 100644 index 0000000..a2f15dc --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/wizardwidget/client/dataresource/ResourceBundle.java @@ -0,0 +1,31 @@ +package org.gcube.portlets.user.td.wizardwidget.client.dataresource; + + +import com.google.gwt.core.client.GWT; +import com.google.gwt.resources.client.ClientBundle; +import com.google.gwt.resources.client.ImageResource; + +/** + * + * @author "Giancarlo Panichi" + * g.panichi@isti.cnr.it + * + */ +public interface ResourceBundle extends ClientBundle { + + public static final ResourceBundle INSTANCE=GWT.create(ResourceBundle.class); + + @Source("resources/Wizard.css") + WizardCSS wizardCSS(); + + @Source("resources/arrow-refresh.png") + ImageResource refresh(); + + @Source("resources/arrow-refresh_16.png") + ImageResource refresh16(); + + + @Source("resources/arrow-refresh_32.png") + ImageResource refresh32(); +} + \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/td/wizardwidget/client/dataresource/WizardCSS.java b/src/main/java/org/gcube/portlets/user/td/wizardwidget/client/dataresource/WizardCSS.java new file mode 100644 index 0000000..857dfde --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/wizardwidget/client/dataresource/WizardCSS.java @@ -0,0 +1,41 @@ +/** + * + */ +package org.gcube.portlets.user.td.wizardwidget.client.dataresource; + +import com.google.gwt.resources.client.CssResource; + +/** + * + * @author "Giancarlo Panichi" + * g.panichi@isti.cnr.it + * + */ +public interface WizardCSS extends CssResource { + + @ClassName("wizard-title") + public String getWizardTitle(); + + @ClassName("wizard-footer") + public String getWizardFooter(); + + @ClassName("source-selection-hover") + public String getSourceSelectionHover(); + +// @ClassName("column-excluded") +// public String getColumnExcluded(); + + @ClassName("importSelection-sources") + public String getImportSelectionSources(); + + @ClassName("importSelection-source") + public String getImportSelectionSource(); + + @ClassName("sdmxRegistryUrlStyle") + public String getSDMXRegistryUrlStyle(); + + @ClassName("sdmxRegistryUrlInputStyle") + public String getSDMXRegistryUrlInputStyle(); + + +} diff --git a/src/main/java/org/gcube/portlets/user/td/wizardwidget/client/util/ErrorMessageBox.java b/src/main/java/org/gcube/portlets/user/td/wizardwidget/client/util/ErrorMessageBox.java new file mode 100644 index 0000000..842b2ef --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/wizardwidget/client/util/ErrorMessageBox.java @@ -0,0 +1,67 @@ +/** + * + */ +package org.gcube.portlets.user.td.wizardwidget.client.util; + +import com.google.gwt.core.client.Callback; +import com.google.gwt.user.client.ui.Label; +import com.sencha.gxt.widget.core.client.Dialog; +import com.sencha.gxt.widget.core.client.Dialog.PredefinedButton; +import com.sencha.gxt.widget.core.client.box.MessageBox; +import com.sencha.gxt.widget.core.client.event.HideEvent; +import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler; + +/** + * + * @author "Giancarlo Panichi" + * g.panichi@isti.cnr.it + * + */ +public class ErrorMessageBox { + + + private static final String DETAILS = "Details"; + + + public static void showError(String title, String failureReason, final String failureDetails) + { + showError(title, failureReason, failureDetails, new NOPCallBack()); + } + + public static void showError(String title, String failureReason, final String failureDetails, final Callback callback) + { + final MessageBox box = new MessageBox(title); + box.setMessage(failureReason); + box.addHideHandler(new HideHandler() { + + @Override + public void onHide(HideEvent event) { + Dialog dialog = (Dialog) event.getSource(); + + if (dialog.getHideButton().getText().equals(DETAILS)){ + //box.close(); + showErrorDetails("Error details", failureDetails); + } else callback.onSuccess(dialog); + } + }); + + box.show(); + } + + public static void showErrorDetails(String title, String failureDetails) + { + final Dialog simple = new Dialog(); + simple.setHeadingText(title); + simple.setPredefinedButtons(PredefinedButton.OK); + simple.setBodyStyleName("pad-text"); + + + simple.add(new Label("
"+failureDetails+"
")); + + simple.setHideOnButtonClick(true); + simple.setWidth(400); + simple.setHeight(400); + simple.show(); + } + +} diff --git a/src/main/java/org/gcube/portlets/user/td/wizardwidget/client/util/Format.java b/src/main/java/org/gcube/portlets/user/td/wizardwidget/client/util/Format.java new file mode 100644 index 0000000..2257a19 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/wizardwidget/client/util/Format.java @@ -0,0 +1,37 @@ +/** + * + */ +package org.gcube.portlets.user.td.wizardwidget.client.util; + +/** + * + * @author "Giancarlo Panichi" + * g.panichi@isti.cnr.it + * + */ +public class Format { + + /** + * Converts a file size into a {@link String} representation adding the misure unit. + * @param size the file size. + * @return the textual representation. + */ + public static String fileSize(long size) { + StringBuilder text = new StringBuilder(); + if (size < 1024) { + text.append(size); + text.append(" bytes"); + } else if (size < 1048576) { + text.append(Math.round(((size * 10) / 1024)) / 10); + text.append(" KB"); + } else if (size < 1073741824) { + text.append(Math.round(((size * 10) / 1048576)) / 10); + text.append(" MB"); + } else { + text.append(Math.round(((size * 10) / 1073741824)) / 10); + text.append(" GB"); + } + return text.toString(); + } + +} diff --git a/src/main/java/org/gcube/portlets/user/td/wizardwidget/client/util/NOPCallBack.java b/src/main/java/org/gcube/portlets/user/td/wizardwidget/client/util/NOPCallBack.java new file mode 100644 index 0000000..1bdf853 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/wizardwidget/client/util/NOPCallBack.java @@ -0,0 +1,24 @@ +/** + * + */ +package org.gcube.portlets.user.td.wizardwidget.client.util; + +import com.google.gwt.core.client.Callback; + +/** + * + * @author "Giancarlo Panichi" + * g.panichi@isti.cnr.it + * + * @param + * @param + */ +public class NOPCallBack implements Callback { + + @Override + public void onFailure(F reason) {} + + @Override + public void onSuccess(T result) {} + +} diff --git a/src/main/resources/org/gcube/portlets/user/td/wizardwidget/Wizard.gwt.xml b/src/main/resources/org/gcube/portlets/user/td/wizardwidget/Wizard.gwt.xml new file mode 100644 index 0000000..6b9dcc1 --- /dev/null +++ b/src/main/resources/org/gcube/portlets/user/td/wizardwidget/Wizard.gwt.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/Messages.properties b/src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/Messages.properties new file mode 100644 index 0000000..c222555 --- /dev/null +++ b/src/main/resources/org/gcube/portlets/user/td/wizardwidget/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/wizardwidget/client/Messages_fr.properties b/src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/Messages_fr.properties new file mode 100644 index 0000000..b4a7627 --- /dev/null +++ b/src/main/resources/org/gcube/portlets/user/td/wizardwidget/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/resources/org/gcube/portlets/user/td/wizardwidget/client/dataresource/resources/WizardTD.css b/src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/dataresource/resources/WizardTD.css new file mode 100644 index 0000000..0b7b6b9 --- /dev/null +++ b/src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/dataresource/resources/WizardTD.css @@ -0,0 +1,40 @@ +@CHARSET "UTF-8"; + + +.wizard-title { + padding: 5px; + font-weight: bold; + font-size: small; + background-color: #C3D9FF; +} + +.wizard-footer { + padding: 5px; + font-weight: bold; + font-size: small; + text-align: right; + background-color: #CDEB8B +} + +.source-selection-hover:hover { + cursor: pointer; +} + + + +.column-excluded { + background-color: #e6e0da !important; + color: #bfa698; +} + +.importSelection-sources { + padding: 30px; + display: block; + margin-top: 20px; + +} + +.importSelection-source { + padding-bottom: 20px; +} + diff --git a/src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/dataresource/resources/accept.png b/src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/dataresource/resources/accept.png new file mode 100644 index 0000000000000000000000000000000000000000..89c8129a490b329f3165f32fa0781701aab417ea GIT binary patch literal 781 zcmV+o1M>WdP)4-QibtN)VXQDpczE`xXAkUjh%RI>;okxb7K@0kpyQ1k_Y(|Oe7$m(^ zNYX>mI||sUbmn+c3<&FnE=4u#()KBS^SH8e)Qs5i!#lY=$-1gbH6VluzU=m=EP78&5vQ z-?+fFP-G2l&l_QzYealK$;1Rl?FkzXR&Jv@fBPNjCr#AYRyJ7UJQ0v#?)7Ott=>3`#-pV!7>9}>Q1jL)H6h&gkP@3nI=+F3nA~M>u#(n* z8T!#8oEw&-mED4!h4s!N@Jo3S7N&Q6%6l3}nlcd~X@>;uelvPsSkXIgg~e+^T1zSf z3SNj(5%jK~i8@b;CUK~zYIrIlZ3n^hRbpD)RhwCR#1VXW(%d`-I>>z|=Ff~+(+wRqKm zxKd=`D$4N6I|qXEs*0$HhzR2FLM(VwHWy0Y$L`dkBp9fHDb0i*R>r1Ax%+CjGn%?$hHJ%1Cc=3 zRH70ir-xgL7>zoQpFR3CwDFuxJqRuLkqnRmAwex5iAQ6PA-8%9spX^vjri1wY3rT> zubdq_U{gLLIp}qJ5%h+z!@UC(fe1kjh!7%zy^$XHy*{Ltl1MJ4EM=(p^of}*BI^R< z-;E8z=9JIv51Ww~qMcC)1R?@~1Eok^-`zI3m_%|RX;Cvi{n|zm4*-mR^Flvt`%KWc zEA+sg0k{lTd+@q%k_~I%aT@#c4tGarpnCuY9JnTtD`Ziu6r8gcfI^4>LSj$28$PcW z$;BjY+`M5yux0fC;5k0^{9#fK^>rVB0RsY}P$^(;VGhM|5hNjWR=8eh3U+n|v5>jh z5)J?!p>Z_e?LyEOgg~IQ!e#3+Dz!?Dns2!2`f_so%yNCwvmYOR{g0*8L?)kU2?qd= z1`k1iKl2tyV72rQDzyrz<;|~O{Px|3StQzlJ2lYKb6c$-U&uqWvwf1#HT6ZaB$92x zfhG@abBug4Y}Tlr`To@(K5aDq)H_e~RBQH9eU1LB-5pOmaHUlOS|*##sVe&zDcBv^ zjX#LMuK6?UcI!zi|Vg#praE9A3BJxKo?p6*zpFa->pKQ2;dU$MK48>{*W{(N# zwO8%501(<4LL?G}VHh9;%2v2CHwTc3-`<=5af`raI3e(R{pi2HzoAvIu1_h2i@#jL zoz>O6LA(sCTgBa|paK_N8ef!+0izi#n zZxk*6$ulQsEhvenvl&aIvETnM0RWgeHEU^c#i_;Gj=;Z(m8-)-a!ZQ<0000k}@P)!zsI^oFu^eLtRk2V!i)n@$RxIgIMoHpcTS{|^*cF_{n60zQX00O7z z>L;lelMMptr&pq7df8B*_fWJaiY*;oP)dP9PzVtLg>Z^4+(k#vPQ3ar;+vQ~)45(Q z%?)hdGZ^XK0fLYUv6f5`2nl*rwHNr-y^z|L3d^WEayap3bO(k@ES3CnK z%sca_HH^l7q~U{75O?!B@3jg5!?%v<)3=AEC7_);p%3eJaDM@v$~&2NCw$ld0000< KMNUMnLSTYm0R)}^ literal 0 HcmV?d00001 diff --git a/src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/dataresource/resources/arrow-refresh_32.png b/src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/dataresource/resources/arrow-refresh_32.png new file mode 100644 index 0000000000000000000000000000000000000000..f3521ea5e0d148384d82c3cba4376972090af7f6 GIT binary patch literal 1182 zcmV;P1Y!G$P)wK~z|UwU%8>TXh)5pK}h{F>r;#a2qh7O*95Kj84sVVF)0>j3^p4 z+l*P3Eir0LTz2J!<8Y-HvXPiwPGd;)!W+UC21FUogb~TIiJNG@z%fz>w6Ox~fS&j9 zq93%-(+`60&1wHVeSgpYJ@0v+Kd?n{?7O!1&HPW@DgiX8zuo<6&LXxPhL`+uFTI{=s0ET(5DM0+0|3RW)->y1X^LMNzi6%mh zaL+wATz6f7fsXz&!@8M(JOGF`TtT(1IvGylVK{`T*(vxJ{dn;3!CC`~#6L%NN;DmK zIVU&(CT!i#wJy1XDI_V6P48>^{5k7tSZfwB&QVyQ zC<>l*Jdrdd@Bi(KG`L7#Ry~jix0l;7Ffw3j$%#WsRW;N-y&q*e%i;qrY#10C`VpZ} zC>&PRnv4}#50B4^H1K>&K1xeUVXv~ovdxk-UA-PRLZJ{K{CfP0@q1}2U%2{A+r%9-)=6PIEb&5ZB7;vIH0S1EyDpq>PZt;Go^ zAoH_9IBZ~fIfVIuAKu9++`M%Q{&_zr{8ym7HGcm0?nF+;x1hQ6C7r_dno0*8d+h*- zD_8r?EqUVsHY^6e(kS|kXxS6Pv;wj44E{B2Z`!N)|MAz8fX!-y)9XwJUlI|okYkES zS6I_N__g!)x4zN&#Z>vT_JW4b4(TFncU0No^t$l#*FO))9Z>% wu`P<6%;?&uqdEm0*?7VK8i&pv(6=hre}=nUJq4NLMgRZ+07*qoM6N<$f|YC_5&!@I literal 0 HcmV?d00001 diff --git a/src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/dataresource/resources/error.png b/src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/dataresource/resources/error.png new file mode 100644 index 0000000000000000000000000000000000000000..c37bd062e60c3b38fc82e4d1f236a8ac2fae9d8c GIT binary patch literal 701 zcmV;u0z&N#0$9Ug7g~-`rQ^qx~m@y2OU8A z#zh~=7n#Z$Z*fx-GOtDf07cgx0suCz_W(2~Y(0tf@FX@P6EPuM_dgn$vj9LucO)%W zw%HgMW>=#oL>nZ>M&NEf08>)#)k<{$fCT_r>rPi=BV=hFh6WS^qqze>C6Ek}o{M5% za|@JGowu0t{&hgNzySHZxy@LTNh);YzZ2zSp_ zl$^T&Dnc|NLb&RD_!4>pt@VHdP)ZGER%5ZmWEe$lryR&y;2u^3cOkO4#6c%-(EY6a{600000NkvXXu0mjfxS2AI literal 0 HcmV?d00001 diff --git a/src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/dataresource/resources/information.png b/src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/dataresource/resources/information.png new file mode 100644 index 0000000000000000000000000000000000000000..12cd1aef900803abba99b26920337ec01ad5c267 GIT binary patch literal 778 zcmV+l1NHogP)BVme|mWaqy4$_pJm?y9KM{-*hp?1+Ey3e-CEDooTa!B;e(Q>TSF?bj>5At13y1p zriN3w3x~5SfZj{@J4M{kp{?=M_Lh2bV+5LH)Q)5W!-ePA$RgE1@5f1cyHki0Y}JyVEYZF(LD$xXlt$7A5CgE@ zpV-&l%vf;=5kZ2-2gi@Y6J&=cuwt>!vJ^#(&n|LcZyUzi6Duj$$hJ1s*HD-#;k-w@ zpdrwAuoDG_N2bvb07G$Zk*?Hc)JLtW4yqOnic_$zO7NZ#l>Fm){;fE?b$IbOaX2fe z0la4g0Dfw2xk7Wi7NapVD8YMPCZu?A1QCK*67dgsvRKBLFtrM>?$%&_lD1882mzdO zWPdw5KWw6IT`m1b_8=lS5jt8D3=RDa=&jWzR-)S@56WMslZ~mKu1)-wpXB>rNBQ>N zU#K`#1B&v|_AQK;7I~B}OdGiUT9LX>f0xm6<;LeP!=vFjPsUQF*wCJ*dO)4YBypgdiuF!=i@6Zyi7F|q#K zz?tlSZULa@t1D?$e;f@b36&N!V2mjOHw|* ~NwO_yO%;SvZ5MdNYf|QNy-I*%yJaj+uTdt+qbZ z4E`Fzb8m}I&!N8OKmWEcCmrLs^Hs&3i)mt@hQVdcqghkaBs*D}tG_lKew4?rTjzIZ z9tSone1TS+TR7tu^CunG)Y7Jg#sw#)sG9C!c0I%LEzP)9;hqRf&)s$D8d5Db{TBs% zgl0~5QQ91luq4Q9tJgt4QLbaxZvAaKeCM9!oy85dg4k>TdBSVqjHub_PG=PO&J-rx z7oYTuF+kH|tG-UK+EkUhDjYx?zW?T|lx>+aOQm zzL$v$zBLo4Cj=G&tw{H}dW?tlTkS)SY4<#NS92z*EY-MMB6Ftp`R=*=*Ev7cS+X%W zMCur^FdlokL}1Y+&aasU2J4#EOuNlnb9CmqgLCGTSY!1BD42pkHY^XidQ5=>YQx%` z*%Pm9D!CkBu&tMWm(%-ejACVWGS2RX5=QOJ$1*tr7F}F+*-OA+Ly&Isg|AEuUYicA z#%IG6kPXkHt{zk2M6zK@Vu^4Q(1zE$?yY6M!^&jQ+2^E?!p7{g*|X6}vuRC3p@jk0 W117c83?+LXEZI4G$p&LV25SKE>nb+@ literal 0 HcmV?d00001 diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..311f062 --- /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 + tdgwtservice/TDGWTService + + + jUnitHostImpl + TDInformationManagerWidgets/junithost/* + + + + + + Wizard.html + + + diff --git a/src/main/webapp/Wizard.css b/src/main/webapp/Wizard.css new file mode 100644 index 0000000..7aca7ac --- /dev/null +++ b/src/main/webapp/Wizard.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/Wizard.html b/src/main/webapp/Wizard.html new file mode 100644 index 0000000..14c327a --- /dev/null +++ b/src/main/webapp/Wizard.html @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + Web Application Starter Project + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/java/org/gcube/portlets/user/td/wizardwidget/client/GwtTestWizard.java b/src/test/java/org/gcube/portlets/user/td/wizardwidget/client/GwtTestWizard.java new file mode 100644 index 0000000..6675d3c --- /dev/null +++ b/src/test/java/org/gcube/portlets/user/td/wizardwidget/client/GwtTestWizard.java @@ -0,0 +1,84 @@ +package org.gcube.portlets.user.td.wizardwidget.client; + + +import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTService; +import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.junit.client.GWTTestCase; +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 GwtTestWizard extends GWTTestCase { + + /** + * Must refer to a valid module that sources this class. + */ + public String getModuleName() { + return "org.gcube.portlets.user.td.information.WizardJUnit"; + } + + + /** + * This test will send a request to the server + */ + public void testWizard() { + // Create the service that we will test. + TDGWTServiceAsync tdGXTService = TDGWTServiceAsync.INSTANCE; + ServiceDefTarget target = (ServiceDefTarget) tdGXTService; + 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 10 seconds before timing out. + delayTestFinish(2000); + finishTest(); + + // Send a request to the server. + /*try { + TDGXTServiceAsync.INSTANCE.getTabResource( + new AsyncCallback() { + + + @Override + public void onSuccess(TabResource result) { + assertTrue(result!=null); + System.out.println(result); + // 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(); + } + + @Override + public void onFailure(Throwable caught) { + // The request resulted in an unexpected error. + fail("Request failure: " + caught.getMessage()); + + + + } + + }); + } catch (TDGXTServiceException e) { + System.out.println("Error in comunications: "+e.getLocalizedMessage()); + e.printStackTrace(); + } + */ + + + } + + + +} diff --git a/src/test/resources/org/gcube/portlets/user/td/wizardwidget/WizardJUnit.gwt.xml b/src/test/resources/org/gcube/portlets/user/td/wizardwidget/WizardJUnit.gwt.xml new file mode 100644 index 0000000..9485045 --- /dev/null +++ b/src/test/resources/org/gcube/portlets/user/td/wizardwidget/WizardJUnit.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..48c3f9f --- /dev/null +++ b/templates/README @@ -0,0 +1,40 @@ +The gCube System - ${project.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. ${project.version} (${release.date}) + +Description +----------- + +${project.description} + +Download information +-------------------- +Source code URL: ${scm.url} + + +Documentation +------------- + +${project.description} + + +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..a87dfa1 --- /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..ffa3274 --- /dev/null +++ b/templates/profile.xml @@ -0,0 +1,29 @@ + + + + Service + + ${project.description} + PortletsUser + ${project.name} + 1.0.0 + + + ${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