refs:3772: SAI - Create a github project importer
https://support.d4science.org/issues/3772 Added usage example git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/github-connector@129144 82a268e6-3cf1-43bd-a215-b396298e98cfmaster
parent
95f5eeb637
commit
e8d96e5d75
@ -1,42 +0,0 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.githubconnector.client.wizard;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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);
|
||||
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
package org.gcube.portlets.widgets.githubconnector.client.wizard.event;
|
||||
|
||||
import com.google.gwt.event.shared.EventHandler;
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
import com.google.gwt.event.shared.HandlerRegistration;
|
||||
import com.google.gwt.event.shared.HasHandlers;
|
||||
|
||||
/**
|
||||
* Wizard Event
|
||||
*
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class WizardEvent extends GwtEvent<WizardEvent.WizardEventHandler> {
|
||||
|
||||
public static Type<WizardEventHandler> TYPE = new Type<WizardEventHandler>();
|
||||
private WizardEventType wizardEventType;
|
||||
private String errorMessage;
|
||||
private Exception exception;
|
||||
|
||||
public interface WizardEventHandler extends EventHandler {
|
||||
void onResponse(WizardEvent event);
|
||||
}
|
||||
|
||||
public interface HasWizardEventHandler extends HasHandlers {
|
||||
public HandlerRegistration addWizardEventHandler(
|
||||
WizardEventHandler handler);
|
||||
}
|
||||
|
||||
public WizardEvent(WizardEventType wizardEventType) {
|
||||
this.wizardEventType = wizardEventType;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dispatch(WizardEventHandler handler) {
|
||||
handler.onResponse(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type<WizardEventHandler> getAssociatedType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static Type<WizardEventHandler> getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static void fire(HasHandlers source, WizardEvent deleteItemEvent) {
|
||||
source.fireEvent(deleteItemEvent);
|
||||
}
|
||||
|
||||
public WizardEventType getWizardEventType() {
|
||||
return wizardEventType;
|
||||
}
|
||||
|
||||
public void setWizardEventType(WizardEventType wizardEventType) {
|
||||
this.wizardEventType = wizardEventType;
|
||||
}
|
||||
|
||||
public String getErrorMessage() {
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
public void setErrorMessage(String errorMessage) {
|
||||
this.errorMessage = errorMessage;
|
||||
}
|
||||
|
||||
public Exception getException() {
|
||||
return exception;
|
||||
}
|
||||
|
||||
public void setException(Exception exception) {
|
||||
this.exception = exception;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WizardEvent [wizardEventType=" + wizardEventType
|
||||
+ ", errorMessage=" + errorMessage + ", exception=" + exception
|
||||
+ "]";
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package org.gcube.portlets.widgets.githubconnector.client.wizard.event;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public enum WizardEventType {
|
||||
Completed("Completed"), Failed("Failed"), Aborted("Aborted"), Background(
|
||||
"Background");
|
||||
|
||||
/**
|
||||
* @param text
|
||||
*/
|
||||
private WizardEventType(final String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
private final String id;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public static WizardEventType getTypeFromId(String id) {
|
||||
if (id == null || id.isEmpty())
|
||||
return null;
|
||||
|
||||
for (WizardEventType type : values()) {
|
||||
if (type.id.compareToIgnoreCase(id) == 0) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<WizardEventType> asList() {
|
||||
List<WizardEventType> list = Arrays.asList(values());
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue