1452: Implement a GUI for StatMan Algorithms Importer

Task-Url: https://support.d4science.org/issues/1452

Added Wiki Link 

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/statistical-algorithms-importer@122332 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2016-01-20 08:51:24 +00:00
parent 7920e8301b
commit 01acfe16d4
4 changed files with 57 additions and 22 deletions

View File

@ -11,6 +11,7 @@ import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.Sessio
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.StatAlgoImporterRibbonEvent; import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.StatAlgoImporterRibbonEvent;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.monitor.StatAlgoImporterMonitor; import org.gcube.portlets.user.statisticalalgorithmsimporter.client.monitor.StatAlgoImporterMonitor;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.project.ProjectManager; import org.gcube.portlets.user.statisticalalgorithmsimporter.client.project.ProjectManager;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.resource.StatAlgoImporterResources;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.rpc.StatAlgoImporterServiceAsync; import org.gcube.portlets.user.statisticalalgorithmsimporter.client.rpc.StatAlgoImporterServiceAsync;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.type.SessionExpiredType; import org.gcube.portlets.user.statisticalalgorithmsimporter.client.type.SessionExpiredType;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.type.StatAlgoImporterRibbonType; import org.gcube.portlets.user.statisticalalgorithmsimporter.client.type.StatAlgoImporterRibbonType;
@ -26,8 +27,12 @@ import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.event.shared.EventBus; import com.google.gwt.event.shared.EventBus;
import com.google.gwt.event.shared.SimpleEventBus; import com.google.gwt.event.shared.SimpleEventBus;
import com.google.gwt.i18n.client.LocaleInfo; import com.google.gwt.i18n.client.LocaleInfo;
import com.google.gwt.resources.client.ResourceCallback;
import com.google.gwt.resources.client.ResourceException;
import com.google.gwt.resources.client.TextResource;
import com.google.gwt.user.client.Cookies; import com.google.gwt.user.client.Cookies;
import com.google.gwt.user.client.Timer; import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.AsyncCallback;
import com.sencha.gxt.widget.core.client.container.BorderLayoutContainer; import com.sencha.gxt.widget.core.client.container.BorderLayoutContainer;
@ -135,7 +140,8 @@ public class StatAlgoImporterController {
String currentLocaleCookie = Cookies.getCookie(LocaleInfo String currentLocaleCookie = Cookies.getCookie(LocaleInfo
.getLocaleCookieName()); .getLocaleCookieName());
Log.debug(Constants.STATISTICAL_ALGORITHMS_IMPORTER_COOKIE + ":" + currentLocaleCookie); Log.debug(Constants.STATISTICAL_ALGORITHMS_IMPORTER_COOKIE + ":"
+ currentLocaleCookie);
LocaleInfo currentLocaleInfo = LocaleInfo.getCurrentLocale(); LocaleInfo currentLocaleInfo = LocaleInfo.getCurrentLocale();
Log.debug("Current Locale:" + currentLocaleInfo.getLocaleName()); Log.debug("Current Locale:" + currentLocaleInfo.getLocaleName());
@ -147,11 +153,13 @@ public class StatAlgoImporterController {
long nowLong = now.getTime(); long nowLong = now.getTime();
nowLong = nowLong + (1000 * 60 * 60 * 24 * 21); nowLong = nowLong + (1000 * 60 * 60 * 24 * 21);
now.setTime(nowLong); now.setTime(nowLong);
String cookieLang = Cookies.getCookie(Constants.STATISTICAL_ALGORITHMS_IMPORTER_COOKIE); String cookieLang = Cookies
.getCookie(Constants.STATISTICAL_ALGORITHMS_IMPORTER_COOKIE);
if (cookieLang != null) { if (cookieLang != null) {
Cookies.removeCookie(Constants.STATISTICAL_ALGORITHMS_IMPORTER_COOKIE); Cookies.removeCookie(Constants.STATISTICAL_ALGORITHMS_IMPORTER_COOKIE);
} }
Cookies.setCookie(Constants.STATISTICAL_ALGORITHMS_IMPORTER_COOKIE, localeName, now); Cookies.setCookie(Constants.STATISTICAL_ALGORITHMS_IMPORTER_COOKIE,
localeName, now);
com.google.gwt.user.client.Window.Location.reload(); com.google.gwt.user.client.Window.Location.reload();
} }
@ -161,9 +169,9 @@ public class StatAlgoImporterController {
String value = com.google.gwt.user.client.Window.Location String value = com.google.gwt.user.client.Window.Location
.getParameter(Constants.STATISTICAL_ALGORITHMS_IMPORTER_ID); .getParameter(Constants.STATISTICAL_ALGORITHMS_IMPORTER_ID);
pm.startProjectManager(value); pm.startProjectManager(value);
} }
// Bind Controller to events on bus // Bind Controller to events on bus
@ -224,18 +232,17 @@ public class StatAlgoImporterController {
} }
}); });
eventBus.addHandler(NewMainCodeEvent.TYPE, eventBus.addHandler(NewMainCodeEvent.TYPE,
new NewMainCodeEvent.NewMainCodeEventHandler() { new NewMainCodeEvent.NewMainCodeEventHandler() {
@Override @Override
public void onSet(NewMainCodeEvent event) { public void onSet(NewMainCodeEvent event) {
Log.debug("Catch SaveNewMainCodeEvent"); Log.debug("Catch SaveNewMainCodeEvent");
doSetNewMainCodeEvent(event); doSetNewMainCodeEvent(event);
} }
}); });
pm.startProjectManager(); pm.startProjectManager();
@ -269,6 +276,7 @@ public class StatAlgoImporterController {
softwarePublish(); softwarePublish();
break; break;
case HELP: case HELP:
showHelp();
break; break;
default: default:
break; break;
@ -276,7 +284,32 @@ public class StatAlgoImporterController {
} }
} }
private void showHelp() {
try {
StatAlgoImporterResources.INSTANCE.wikiLink().getText(
new ResourceCallback<TextResource>() {
public void onError(ResourceException e) {
Log.error("Error retrieving wiki link!: "
+ e.getLocalizedMessage());
UtilsGXT3.alert("Error",
"Error retrieving wiki link!");
}
public void onSuccess(TextResource r) {
String s = r.getText();
Window.open(s,
"Statistical Algorithms Importer Wiki", "");
}
});
} catch (ResourceException e) {
Log.error("Error retrieving wiki link!: " + e.getLocalizedMessage());
UtilsGXT3.alert("Error", "Error retrieving wiki link!");
e.printStackTrace();
}
}
private void doInputReadyCommand(InputReadyEvent event) { private void doInputReadyCommand(InputReadyEvent event) {
switch (inputRequestType) { switch (inputRequestType) {
@ -308,15 +341,12 @@ public class StatAlgoImporterController {
eventBus.fireEvent(inputRequestEvent); eventBus.fireEvent(inputRequestEvent);
Log.debug("SoftwareCreateRequest: " + inputRequestEvent); Log.debug("SoftwareCreateRequest: " + inputRequestEvent);
} }
private void softwarePublish() { private void softwarePublish() {
pm.softwarePublish(); pm.softwarePublish();
} }
private void showCreateProjectDialog() { private void showCreateProjectDialog() {
pm.createProject(); pm.createProject();
@ -338,14 +368,12 @@ public class StatAlgoImporterController {
} }
} }
private void doSetNewMainCodeEvent( private void doSetNewMainCodeEvent(NewMainCodeEvent event) {
NewMainCodeEvent event) {
monitor = new StatAlgoImporterMonitor(); monitor = new StatAlgoImporterMonitor();
pm.setNewMainCode(event,monitor); pm.setNewMainCode(event, monitor);
} }
private void doDeleteItemCommand(DeleteItemEvent event) { private void doDeleteItemCommand(DeleteItemEvent event) {
ItemDescription itemDescription = event.getItemDescription(); ItemDescription itemDescription = event.getItemDescription();

View File

@ -5,6 +5,7 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.client.resource;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ClientBundle; import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.ExternalTextResource;
import com.google.gwt.resources.client.ImageResource; import com.google.gwt.resources.client.ImageResource;
/** /**
@ -21,6 +22,10 @@ public interface StatAlgoImporterResources extends ClientBundle {
@Source("StatAlgoImporter.css") @Source("StatAlgoImporter.css")
StatAlgoImporterCSS srCSS(); StatAlgoImporterCSS srCSS();
@Source("WikiLink.txt")
ExternalTextResource wikiLink();
@Source("help_32.png") @Source("help_32.png")
ImageResource help32(); ImageResource help32();

View File

@ -0,0 +1 @@
http://wiki.gcube-system.org/gcube/Statistical_Algorithms_Importer

View File

@ -0,0 +1 @@
http://wiki.gcube-system.org/gcube/Statistical_Algorithms_Importer