diff --git a/src/main/java/org/gcube/portlets/widgets/githubconnector/client/GitHubConnectorManager.java b/src/main/java/org/gcube/portlets/widgets/githubconnector/client/GitHubConnectorManager.java
index 2e7e53b..bd7b03f 100644
--- a/src/main/java/org/gcube/portlets/widgets/githubconnector/client/GitHubConnectorManager.java
+++ b/src/main/java/org/gcube/portlets/widgets/githubconnector/client/GitHubConnectorManager.java
@@ -2,7 +2,9 @@ package org.gcube.portlets.widgets.githubconnector.client;
import org.gcube.portlets.user.gcubewidgets.client.ClientScopeHelper;
import org.gcube.portlets.widgets.githubconnector.client.util.GWTMessages;
+import org.gcube.portlets.widgets.githubconnector.client.wizard.event.WizardEvent;
+import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
@@ -67,6 +69,26 @@ public class GitHubConnectorManager implements EntryPoint {
private void loadMainPanel() {
GWT.log("GitHubConnectorManager");
+ //Example
+ WizardEvent.WizardEventHandler handler=new WizardEvent.WizardEventHandler() {
+
+ @Override
+ public void onResponse(WizardEvent event) {
+ Log.debug("Wizard Response: "+event.getWizardEventType());
+
+ }
+ };
+
+ GitHubConnectorWizard wizard=new GitHubConnectorWizard("0cfde9e2-a6f0-451f-a048-adbd42d7d57f");
+ wizard.addWizardEventHandler(handler);
+ wizard.show();
+
+
+ /*
+ WaitDialog progressDialog=new WaitDialog();
+ progressDialog.show();
+ */
+
/*
WizardWindow wizardWindow = new WizardWindow("TestWindow");
SimpleWizardCard simple1=new SimpleWizardCard("Test Title 1","Test Footer 1", "This is 1 card");
@@ -78,16 +100,7 @@ public class GitHubConnectorManager implements EntryPoint {
wizardWindow.show();
*/
-
-
- GitHubConnectorWizard wizard=new GitHubConnectorWizard("0cfde9e2-a6f0-451f-a048-adbd42d7d57f");
- wizard.show();
-
-
- /*
- WaitDialog progressDialog=new WaitDialog();
- progressDialog.show();
- */
+
}
/*
diff --git a/src/main/java/org/gcube/portlets/widgets/githubconnector/client/GitHubConnectorRepositorySelectionCard.java b/src/main/java/org/gcube/portlets/widgets/githubconnector/client/GitHubConnectorRepositorySelectionCard.java
index 208ec93..ec7856b 100644
--- a/src/main/java/org/gcube/portlets/widgets/githubconnector/client/GitHubConnectorRepositorySelectionCard.java
+++ b/src/main/java/org/gcube/portlets/widgets/githubconnector/client/GitHubConnectorRepositorySelectionCard.java
@@ -7,6 +7,8 @@ import org.gcube.portlets.widgets.githubconnector.client.rpc.GitHubConnectorServ
import org.gcube.portlets.widgets.githubconnector.client.util.GWTMessages;
import org.gcube.portlets.widgets.githubconnector.client.util.WaitDialog;
import org.gcube.portlets.widgets.githubconnector.client.wizard.WizardCard;
+import org.gcube.portlets.widgets.githubconnector.client.wizard.event.WizardEvent;
+import org.gcube.portlets.widgets.githubconnector.client.wizard.event.WizardEventType;
import org.gcube.portlets.widgets.githubconnector.shared.exception.ExpiredSessionServiceException;
import org.gcube.portlets.widgets.githubconnector.shared.git.data.GitHubRepository;
@@ -102,11 +104,11 @@ public class GitHubConnectorRepositorySelectionCard extends WizardCard {
GWT.log("Error retrieving repositories: "
+ caught.getMessage());
if (caught instanceof ExpiredSessionServiceException) {
- GWTMessages.alert("Error", "Expired Session");
+ showErrorAndHide("Error", "Expired Session");
wiz.sessionExpiredShowDelayed();
} else {
- GWTMessages.alert(
+ showErrorAndHide(
"Error",
"Retrieving repositories: "
+ caught.getLocalizedMessage());
@@ -193,11 +195,11 @@ public class GitHubConnectorRepositorySelectionCard extends WizardCard {
GWT.log("Error in clone repository: "
+ caught.getMessage());
if (caught instanceof ExpiredSessionServiceException) {
- GWTMessages.alert("Error", "Expired Session");
+ showErrorAndHide("Error", "Expired Session");
wiz.sessionExpiredShowDelayed();
} else {
- GWTMessages.alert(
+ showErrorAndHide(
"Error",
"In clone repository: "
+ caught.getLocalizedMessage());
@@ -217,6 +219,8 @@ public class GitHubConnectorRepositorySelectionCard extends WizardCard {
private void goNext() {
try {
GWT.log("NextCard");
+ WizardEvent event=new WizardEvent(WizardEventType.Completed);
+ getWizardWindow().fireEvent(event);
getWizardWindow().close(false);
} catch (Exception e) {
GWT.log("sayNextCard :" + e.getLocalizedMessage());
diff --git a/src/main/java/org/gcube/portlets/widgets/githubconnector/client/wizard/WizardCard.java b/src/main/java/org/gcube/portlets/widgets/githubconnector/client/wizard/WizardCard.java
index f9ae4f8..16c5d0b 100644
--- a/src/main/java/org/gcube/portlets/widgets/githubconnector/client/wizard/WizardCard.java
+++ b/src/main/java/org/gcube/portlets/widgets/githubconnector/client/wizard/WizardCard.java
@@ -217,11 +217,18 @@ public class WizardCard extends SimplePanel {
return (indexPosition>=0)?indexPosition+1:indexPosition;
}
- public void showErrorAndHide(String title, final String message, String details, final Throwable throwable)
+ public void showErrorAndHide(String title, final String message, final Throwable throwable)
{
- wizardWindow.showErrorAndHide(title, message, details, throwable);
+ wizardWindow.showErrorAndHide(title, message, throwable);
}
+ public void showErrorAndHide(String title, final String message)
+ {
+ wizardWindow.showErrorAndHide(title, message);
+ }
+
+
+
public void hideWindow()
{
wizardWindow.hide();
diff --git a/src/main/java/org/gcube/portlets/widgets/githubconnector/client/wizard/WizardListener.java b/src/main/java/org/gcube/portlets/widgets/githubconnector/client/wizard/WizardListener.java
deleted file mode 100644
index 72cd2fb..0000000
--- a/src/main/java/org/gcube/portlets/widgets/githubconnector/client/wizard/WizardListener.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- *
- */
-package org.gcube.portlets.widgets.githubconnector.client.wizard;
-
-
-
-
-/**
- *
- * @author "Giancarlo Panichi"
- * g.panichi@isti.cnr.it
- *
- */
-public interface WizardListener {
-
- /**
- * Called when the wizard is completed without errors
- */
- public void completed(String id);
-
-
- /**
- * Called when the operation is put in background
- */
- public void putInBackground();
-
- /**
- * Called when the wizard has been aborted by the user.
- */
- public void aborted();
-
- /**
- * Called when the something in the wizard is failed.
- * @param title
- * @param message the failure reason.
- * @param details the failure details.
- * @param throwable the exception.
- */
- public void failed(String title, String message, String details, Throwable throwable);
-
-}
diff --git a/src/main/java/org/gcube/portlets/widgets/githubconnector/client/wizard/WizardWindow.java b/src/main/java/org/gcube/portlets/widgets/githubconnector/client/wizard/WizardWindow.java
index e1d0b62..b249301 100644
--- a/src/main/java/org/gcube/portlets/widgets/githubconnector/client/wizard/WizardWindow.java
+++ b/src/main/java/org/gcube/portlets/widgets/githubconnector/client/wizard/WizardWindow.java
@@ -7,6 +7,9 @@ import java.util.ArrayList;
import org.gcube.portlets.widgets.githubconnector.client.resource.GCResources;
import org.gcube.portlets.widgets.githubconnector.client.util.GWTMessages;
+import org.gcube.portlets.widgets.githubconnector.client.wizard.event.WizardEvent;
+import org.gcube.portlets.widgets.githubconnector.client.wizard.event.WizardEventType;
+import org.gcube.portlets.widgets.githubconnector.client.wizard.event.WizardEvent.WizardEventHandler;
import com.google.gwt.core.client.Callback;
import com.google.gwt.core.client.GWT;
@@ -38,13 +41,12 @@ import com.google.gwt.user.client.ui.Widget;
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it
*
*/
-public class WizardWindow extends DialogBox {
+public class WizardWindow extends DialogBox implements WizardEvent.HasWizardEventHandler {
private HandlerRegistration resizeHandlerRegistration;
protected boolean WIZARD_RESIZABLE = false;
protected boolean WIZARD_COLLAPSIBLE = true;
- protected ArrayList listeners;
protected EventBus eventBus;
protected String title;
@@ -93,7 +95,6 @@ public class WizardWindow extends DialogBox {
initHandler();
addToolIcon();
- listeners = new ArrayList();
deckPanel = new DeckPanel();
backButton = new Button("