diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/CommonMessages.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/CommonMessages.java
new file mode 100644
index 0000000..7a70b4a
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/CommonMessages.java
@@ -0,0 +1,24 @@
+package org.gcube.portlets.user.statisticalalgorithmsimporter.client;
+
+import com.google.gwt.i18n.client.Messages;
+
+/**
+ *
+ * @author giancarlo email: g.panichi@isti.cnr.it
+ *
+ */
+public interface CommonMessages extends Messages {
+
+ //
+ @DefaultMessage("Attention")
+ String attention();
+
+ @DefaultMessage("Error")
+ String error();
+
+ @DefaultMessage("No Main Code set!")
+ String attentionNoMainCodeSet();
+
+
+}
\ No newline at end of file
diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/StatAlgoImporterController.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/StatAlgoImporterController.java
index 012caa4..e02bd58 100644
--- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/StatAlgoImporterController.java
+++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/StatAlgoImporterController.java
@@ -6,6 +6,7 @@ import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.Delete
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.InputReadyEvent;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.InputRequestEvent;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.MainCodeSetEvent;
+import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.NewMainCodeEvent;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.SessionExpiredEvent;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.StatAlgoImporterRibbonEvent;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.monitor.StatAlgoImporterMonitor;
@@ -46,12 +47,11 @@ public class StatAlgoImporterController {
private StatAlgoImporterMonitor monitor;
private enum InputRequestType {
- Save,
- SoftwareCreate;
+ Save, SoftwareCreate;
}
+
private InputRequestType inputRequestType;
-
-
+
public StatAlgoImporterController() {
eventBus = new SimpleEventBus();
pm = new ProjectManager(eventBus);
@@ -135,7 +135,7 @@ public class StatAlgoImporterController {
String currentLocaleCookie = Cookies.getCookie(LocaleInfo
.getLocaleCookieName());
- Log.debug(Constants.STATRUNNER_LANG_COOKIE + ":" + currentLocaleCookie);
+ Log.debug(Constants.STATISTICAL_ALGORITHMS_IMPORTER_COOKIE + ":" + currentLocaleCookie);
LocaleInfo currentLocaleInfo = LocaleInfo.getCurrentLocale();
Log.debug("Current Locale:" + currentLocaleInfo.getLocaleName());
@@ -147,17 +147,23 @@ public class StatAlgoImporterController {
long nowLong = now.getTime();
nowLong = nowLong + (1000 * 60 * 60 * 24 * 21);
now.setTime(nowLong);
- String cookieLang = Cookies.getCookie(Constants.STATRUNNER_LANG_COOKIE);
+ String cookieLang = Cookies.getCookie(Constants.STATISTICAL_ALGORITHMS_IMPORTER_COOKIE);
if (cookieLang != null) {
- Cookies.removeCookie(Constants.STATRUNNER_LANG_COOKIE);
+ Cookies.removeCookie(Constants.STATISTICAL_ALGORITHMS_IMPORTER_COOKIE);
}
- Cookies.setCookie(Constants.STATRUNNER_LANG_COOKIE, localeName, now);
+ Cookies.setCookie(Constants.STATISTICAL_ALGORITHMS_IMPORTER_COOKIE, localeName, now);
com.google.gwt.user.client.Window.Location.reload();
}
//
public void restoreUISession() {
checkLocale();
+
+ String value = com.google.gwt.user.client.Window.Location
+ .getParameter(Constants.STATISTICAL_ALGORITHMS_IMPORTER_ID);
+
+ pm.startProjectManager(value);
+
}
// Bind Controller to events on bus
@@ -218,6 +224,19 @@ public class StatAlgoImporterController {
}
});
+
+ eventBus.addHandler(NewMainCodeEvent.TYPE,
+ new NewMainCodeEvent.NewMainCodeEventHandler() {
+
+ @Override
+ public void onSet(NewMainCodeEvent event) {
+ Log.debug("Catch SaveNewMainCodeEvent");
+ doSetNewMainCodeEvent(event);
+
+ }
+
+
+ });
pm.startProjectManager();
@@ -255,38 +274,39 @@ public class StatAlgoImporterController {
}
private void doInputReadyCommand(InputReadyEvent event) {
- switch(inputRequestType){
+ switch (inputRequestType) {
case Save:
pm.saveProject(event.getInputData(), monitor);
break;
case SoftwareCreate:
pm.createSofware(event.getInputData(), monitor);
- break;
+ break;
default:
break;
-
+
}
-
+
}
-
+
private void projectSaveRequest() {
- monitor= new StatAlgoImporterMonitor();
- inputRequestType=InputRequestType.Save;
+ monitor = new StatAlgoImporterMonitor();
+ inputRequestType = InputRequestType.Save;
InputRequestEvent inputRequestEvent = new InputRequestEvent();
eventBus.fireEvent(inputRequestEvent);
Log.debug("ProjectSaveRequest: " + inputRequestEvent);
}
-
+
private void softwareCreateRequest() {
- monitor= new StatAlgoImporterMonitor();
- inputRequestType=InputRequestType.SoftwareCreate;
+ monitor = new StatAlgoImporterMonitor();
+ inputRequestType = InputRequestType.SoftwareCreate;
InputRequestEvent inputRequestEvent = new InputRequestEvent();
eventBus.fireEvent(inputRequestEvent);
Log.debug("SoftwareCreateRequest: " + inputRequestEvent);
-
}
-
+
+
+
private void showCreateProjectDialog() {
pm.createProject();
@@ -300,9 +320,7 @@ public class StatAlgoImporterController {
private void showAddResourceDialog() {
pm.addResource();
}
-
-
-
+
private void doMainCodeSetCommand(MainCodeSetEvent event) {
ItemDescription itemDescription = event.getItemDescription();
if (itemDescription != null && itemDescription.getId() != null) {
@@ -310,6 +328,14 @@ public class StatAlgoImporterController {
}
}
+
+ private void doSetNewMainCodeEvent(
+ NewMainCodeEvent event) {
+ monitor = new StatAlgoImporterMonitor();
+ pm.setNewMainCode(event,monitor);
+
+ }
+
private void doDeleteItemCommand(DeleteItemEvent event) {
ItemDescription itemDescription = event.getItemDescription();
@@ -319,9 +345,6 @@ public class StatAlgoImporterController {
}
-
-
-
@SuppressWarnings("unused")
private void showCodeUploadDialog() {
CodeUploadDialog codeUploadDialog = new CodeUploadDialog(eventBus);
diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/codeparser/CodeParser.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/codeparser/CodeParser.java
index 3c5b567..9bba1c6 100644
--- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/codeparser/CodeParser.java
+++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/codeparser/CodeParser.java
@@ -2,7 +2,7 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.client.codeparser;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.DataType;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.IOType;
-import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.SelectedRowsVariables;
+import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InputOutputVariables;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.regexp.shared.RegExp;
@@ -24,8 +24,8 @@ public class CodeParser {
}
- public SelectedRowsVariables parse(String parameter, IOType ioType) {
- SelectedRowsVariables selectedRowsVariables = null;
+ public InputOutputVariables parse(String parameter, IOType ioType) {
+ InputOutputVariables selectedRowsVariables = null;
if (parameter == null) {
return null;
@@ -40,7 +40,7 @@ public class CodeParser {
defaultValue = defaultValue.substring(0,
defaultValue.length() - 1);
- selectedRowsVariables = new SelectedRowsVariables(
+ selectedRowsVariables = new InputOutputVariables(
varDescription[0].trim(), varDescription[0].trim(),
defaultValue, checkDataType(varDescription[1].trim()),
ioType, parameter);
@@ -53,7 +53,7 @@ public class CodeParser {
if (defaultValue.endsWith("\""))
defaultValue = defaultValue.substring(0,
defaultValue.length() - 1);
- selectedRowsVariables = new SelectedRowsVariables(
+ selectedRowsVariables = new InputOutputVariables(
varDescription[0].trim(), varDescription[0].trim(),
defaultValue, checkDataType(varDescription[1].trim()),
ioType, parameter);
diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/event/NewMainCodeEvent.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/event/NewMainCodeEvent.java
new file mode 100644
index 0000000..3a40295
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/event/NewMainCodeEvent.java
@@ -0,0 +1,73 @@
+package org.gcube.portlets.user.statisticalalgorithmsimporter.client.event;
+
+import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.workspace.ItemDescription;
+
+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;
+
+/**
+ * Main Code Set Event
+ *
+ *
+ * @author "Giancarlo Panichi" g.panichi@isti.cnr.it
+ *
+ */
+public class NewMainCodeEvent extends
+ GwtEvent {
+
+ public static Type TYPE = new Type();
+ private ItemDescription file;
+ private String code;
+
+ public interface NewMainCodeEventHandler extends EventHandler {
+ void onSet(NewMainCodeEvent event);
+ }
+
+ public interface HasSaveNewMainCodeEventHandler extends HasHandlers {
+ public HandlerRegistration addSaveNewMainCodeEventHandler(
+ NewMainCodeEventHandler handler);
+ }
+
+ public NewMainCodeEvent(ItemDescription file, String code) {
+ this.file = file;
+ this.code = code;
+ }
+
+ @Override
+ protected void dispatch(NewMainCodeEventHandler handler) {
+ handler.onSet(this);
+ }
+
+ @Override
+ public Type getAssociatedType() {
+ return TYPE;
+ }
+
+ public static Type getType() {
+ return TYPE;
+ }
+
+ public static void fire(HasHandlers source,
+ NewMainCodeEvent saveNewMainCodeEvent) {
+ source.fireEvent(saveNewMainCodeEvent);
+ }
+
+ public ItemDescription getFile() {
+ return file;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ @Override
+ public String toString() {
+ return "NewMainCodeEvent [file=" + file + ", code=" + code + "]";
+ }
+
+
+
+}
diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/event/NewSelectedRowsVariableEvent.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/event/NewSelectedRowsVariableEvent.java
index 961ae4a..d44c350 100644
--- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/event/NewSelectedRowsVariableEvent.java
+++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/event/NewSelectedRowsVariableEvent.java
@@ -1,6 +1,6 @@
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.event;
-import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.SelectedRowsVariables;
+import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InputOutputVariables;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
@@ -20,7 +20,7 @@ public class NewSelectedRowsVariableEvent
GwtEvent {
public static Type TYPE = new Type();
- private SelectedRowsVariables selectedRowsVariable;
+ private InputOutputVariables selectedRowsVariable;
public interface NewSelectedRowsVariableEventHandler extends EventHandler {
void onNewVariable(NewSelectedRowsVariableEvent event);
@@ -32,7 +32,7 @@ public class NewSelectedRowsVariableEvent
}
public NewSelectedRowsVariableEvent(
- SelectedRowsVariables selectedRowsVariable) {
+ InputOutputVariables selectedRowsVariable) {
this.selectedRowsVariable = selectedRowsVariable;
}
@@ -55,7 +55,7 @@ public class NewSelectedRowsVariableEvent
source.fireEvent(newSelectedRowsVariableEvent);
}
- public SelectedRowsVariables getSelectedRowsVariable() {
+ public InputOutputVariables getSelectedRowsVariable() {
return selectedRowsVariable;
}
diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/maindata/CodeEditMessages.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/maindata/CodeEditMessages.java
new file mode 100644
index 0000000..512f456
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/maindata/CodeEditMessages.java
@@ -0,0 +1,52 @@
+package org.gcube.portlets.user.statisticalalgorithmsimporter.client.maindata;
+
+import com.google.gwt.i18n.client.Messages;
+
+/**
+ *
+ * @author giancarlo email: g.panichi@isti.cnr.it
+ *
+ */
+public interface CodeEditMessages extends Messages {
+
+ //
+ @DefaultMessage("Save")
+ String btnSaveText();
+
+ @DefaultMessage("Save")
+ String btnSaveToolTip();
+
+ @DefaultMessage("Input")
+ String btnAddInputText();
+
+ @DefaultMessage("Add input variable from code")
+ String btnAddInputToolTip();
+
+ @DefaultMessage("Output")
+ String btnAddOutputText();
+
+ @DefaultMessage("Add output variable from code")
+ String btnAddOutputToolTip();
+
+ @DefaultMessage("Code:")
+ String mainCodeFiledLabel();
+
+ @DefaultMessage("Select parameter in the code!")
+ String attentionSelectParameterInTheCode();
+
+ @DefaultMessage("No valid selected row, change selection and try again!")
+ String attentionNoValidSelectedRow();
+
+ @DefaultMessage("Code Saved")
+ String codeSavedHead();
+
+ @DefaultMessage("Code is saved!")
+ String codeSaved();
+
+ @DefaultMessage("Attention invalid file name for Main Code!")
+ String attentionInvalidFileNameForMainCode();
+
+
+
+}
\ No newline at end of file
diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/maindata/CodeEditPanel.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/maindata/CodeEditPanel.java
index 3c8e22b..86454a8 100644
--- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/maindata/CodeEditPanel.java
+++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/maindata/CodeEditPanel.java
@@ -2,8 +2,10 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.client.maindata;
import java.util.ArrayList;
+import org.gcube.portlets.user.statisticalalgorithmsimporter.client.CommonMessages;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.codeparser.CodeParser;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.NewSelectedRowsVariableEvent;
+import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.NewMainCodeEvent;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.SessionExpiredEvent;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.resource.StatAlgoImporterResources;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.rpc.StatAlgoImporterServiceAsync;
@@ -12,22 +14,31 @@ import org.gcube.portlets.user.statisticalalgorithmsimporter.client.utils.UtilsG
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.code.CodeData;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterSessionExpiredException;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.IOType;
-import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.SelectedRowsVariables;
+import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InputOutputVariables;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
+import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.workspace.ItemDescription;
import com.allen_sauer.gwt.log.client.Log;
+import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.sencha.gxt.cell.core.client.ButtonCell.ButtonScale;
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.widget.core.client.ContentPanel;
+import com.sencha.gxt.widget.core.client.Dialog.PredefinedButton;
+import com.sencha.gxt.widget.core.client.box.PromptMessageBox;
import com.sencha.gxt.widget.core.client.button.TextButton;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
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.DialogHideEvent;
+import com.sencha.gxt.widget.core.client.event.DialogHideEvent.DialogHideHandler;
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.form.TextField;
+import com.sencha.gxt.widget.core.client.toolbar.LabelToolItem;
+import com.sencha.gxt.widget.core.client.toolbar.SeparatorToolItem;
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
import edu.ycp.cs.dh.acegwt.client.ace.AceEditor;
@@ -51,15 +62,20 @@ public class CodeEditPanel extends ContentPanel {
private TextButton btnSave;
private TextButton btnAddInput;
private TextButton btnAddOutput;
+ private Project project;
+ private TextField mainCodeField;
+ private CodeEditMessages msgs;
+ private CommonMessages msgsCommon;
public CodeEditPanel(Project project, EventBus eventBus) {
super();
Log.debug("CodeEditPanel");
this.eventBus = eventBus;
-
- // msgs = GWT.create(ServiceCategoryMessages.class);
+ this.project = project;
+ this.msgs = GWT.create(CodeEditMessages.class);
+ this.msgsCommon = GWT.create(CommonMessages.class);
init();
- create(project);
+ create();
}
@@ -72,12 +88,12 @@ public class CodeEditPanel extends ContentPanel {
}
- private void create(Project project) {
- btnSave = new TextButton("Save");
+ private void create() {
+ btnSave = new TextButton(msgs.btnSaveText());
btnSave.setIcon(StatAlgoImporterResources.INSTANCE.save16());
btnSave.setScale(ButtonScale.SMALL);
btnSave.setIconAlign(IconAlign.LEFT);
- btnSave.setToolTip("Save");
+ btnSave.setToolTip(msgs.btnSaveToolTip());
btnSave.addSelectHandler(new SelectHandler() {
@Override
@@ -87,11 +103,11 @@ public class CodeEditPanel extends ContentPanel {
});
- btnAddInput = new TextButton("Input");
+ btnAddInput = new TextButton(msgs.btnAddInputText());
btnAddInput.setIcon(StatAlgoImporterResources.INSTANCE.add16());
btnAddInput.setScale(ButtonScale.SMALL);
btnAddInput.setIconAlign(IconAlign.LEFT);
- btnAddInput.setToolTip("Add input variable from code");
+ btnAddInput.setToolTip(msgs.btnAddInputToolTip());
btnAddInput.addSelectHandler(new SelectHandler() {
@Override
@@ -102,11 +118,11 @@ public class CodeEditPanel extends ContentPanel {
});
btnAddInput.disable();
- btnAddOutput = new TextButton("Output");
+ btnAddOutput = new TextButton(msgs.btnAddOutputText());
btnAddOutput.setIcon(StatAlgoImporterResources.INSTANCE.add16());
btnAddOutput.setScale(ButtonScale.SMALL);
btnAddOutput.setIconAlign(IconAlign.LEFT);
- btnAddOutput.setToolTip("Add output variable from code");
+ btnAddOutput.setToolTip(msgs.btnAddOutputToolTip());
btnAddOutput.addSelectHandler(new SelectHandler() {
@Override
@@ -117,10 +133,17 @@ public class CodeEditPanel extends ContentPanel {
});
btnAddOutput.disable();
+ mainCodeField = new TextField();
+ mainCodeField.setEmptyText("");
+ mainCodeField.setReadOnly(true);
+
ToolBar toolBar = new ToolBar();
toolBar.add(btnSave, new BoxLayoutData(new Margins(0)));
toolBar.add(btnAddInput, new BoxLayoutData(new Margins(0)));
toolBar.add(btnAddOutput, new BoxLayoutData(new Margins(0)));
+ toolBar.add(new SeparatorToolItem());
+ toolBar.add(new LabelToolItem(msgs.mainCodeFiledLabel()));
+ toolBar.add(mainCodeField, new BoxLayoutData(new Margins(0)));
editor = new AceEditor();
@@ -132,7 +155,14 @@ public class CodeEditPanel extends ContentPanel {
editor.startEditor();
editor.setShowPrintMargin(false);
- if (project != null && project.getMainCode() != null) {
+ if (project != null && project.getMainCode() != null
+ && project.getMainCode().getItemDescription() != null) {
+ if (project.getMainCode().getItemDescription().getName() != null) {
+ mainCodeField.setValue(project.getMainCode()
+ .getItemDescription().getName());
+ } else {
+ mainCodeField.setValue("");
+ }
loadCode();
}
@@ -158,20 +188,22 @@ public class CodeEditPanel extends ContentPanel {
Log.debug("Save Variable: " + ioType + ", " + parameter);
if (parameter == null) {
Log.debug("No text selected");
- UtilsGXT3.alert("Attention", "Select parameter in the code!");
+ UtilsGXT3.alert(msgsCommon.attention(),
+ msgs.attentionSelectParameterInTheCode());
} else {
- createSelectedRowVariable(parameter, ioType);
+ createInputOutputVariable(parameter, ioType);
}
}
- private void createSelectedRowVariable(String parameter, IOType ioType) {
+ private void createInputOutputVariable(String parameter, IOType ioType) {
CodeParser codeParser = new CodeParser();
- SelectedRowsVariables selectedRowsVariable = codeParser.parse(
- parameter, ioType);
+ InputOutputVariables selectedRowsVariable = codeParser.parse(parameter,
+ ioType);
if (selectedRowsVariable == null) {
Log.debug("No valid selection, change selection and try again!");
- UtilsGXT3.alert("Attention", "No valid selected row, change selection and try again!");
+ UtilsGXT3.alert(msgsCommon.attention(),
+ msgs.attentionNoValidSelectedRow());
} else {
NewSelectedRowsVariableEvent newSelectedRowsVariableEvent = new NewSelectedRowsVariableEvent(
selectedRowsVariable);
@@ -181,33 +213,42 @@ public class CodeEditPanel extends ContentPanel {
}
protected void saveCode() {
- String code = editor.getText();
- StatAlgoImporterServiceAsync.INSTANCE.saveCode(code,
- new AsyncCallback() {
+ if (project != null && project.getMainCode() != null
+ && project.getMainCode().getItemDescription() != null) {
+ String code = editor.getText();
+ StatAlgoImporterServiceAsync.INSTANCE.saveCode(code,
+ new AsyncCallback() {
+
+ @Override
+ public void onFailure(Throwable caught) {
+ if (caught instanceof StatAlgoImporterSessionExpiredException) {
+ eventBus.fireEvent(new SessionExpiredEvent(
+ SessionExpiredType.EXPIREDONSERVER));
+ } else {
+ Log.error("Error on save code: "
+ + caught.getLocalizedMessage());
+ UtilsGXT3.alert(msgsCommon.error(),
+ caught.getLocalizedMessage());
+ }
+ caught.printStackTrace();
- @Override
- public void onFailure(Throwable caught) {
- if (caught instanceof StatAlgoImporterSessionExpiredException) {
- eventBus.fireEvent(new SessionExpiredEvent(
- SessionExpiredType.EXPIREDONSERVER));
- } else {
- Log.error("Error on save code: "
- + caught.getLocalizedMessage());
- UtilsGXT3.alert("Error",
- caught.getLocalizedMessage());
}
- caught.printStackTrace();
- }
+ @Override
+ public void onSuccess(Void result) {
+ Log.debug("Code is saved!");
+ UtilsGXT3.info(msgs.codeSavedHead(),
+ msgs.codeSaved());
+ }
- @Override
- public void onSuccess(Void result) {
- Log.debug("Code is saved!");
- UtilsGXT3.info("Code Saved", "Code is saved!");
- }
-
- });
+ });
+ } else {
+ saveNewMainCode();
+ // Log.debug("Attention no Main Code Set!");
+ // UtilsGXT3.alert(msgsCommon.attention(),
+ // msgsCommon.attentionNoMainCodeSet());
+ }
}
private void loadCode() {
@@ -221,7 +262,7 @@ public class CodeEditPanel extends ContentPanel {
} else {
Log.error("Error retrieving code: "
+ caught.getLocalizedMessage());
- UtilsGXT3.alert("Error",
+ UtilsGXT3.alert(msgsCommon.error(),
caught.getLocalizedMessage());
}
caught.printStackTrace();
@@ -254,8 +295,19 @@ public class CodeEditPanel extends ContentPanel {
}
public void codeUpdate(Project project) {
- if (project != null && project.getMainCode() != null) {
+ this.project = project;
+ if (project != null && project.getMainCode() != null
+ && project.getMainCode().getItemDescription() != null) {
+ if (project.getMainCode().getItemDescription().getName() != null) {
+ mainCodeField.setValue(project.getMainCode()
+ .getItemDescription().getName());
+ } else {
+ mainCodeField.setValue("");
+ }
loadCode();
+ } else {
+ editor.setText("");
+ mainCodeField.setValue("");
}
}
@@ -308,4 +360,48 @@ public class CodeEditPanel extends ContentPanel {
return selectedText;
}
+ private void saveNewMainCode() {
+ final PromptMessageBox messageBox = new PromptMessageBox("Main Code",
+ "File name:");
+ // First option: Listening for the hide event and then figuring which
+ // button was pressed.
+ messageBox.addDialogHideHandler(new DialogHideHandler() {
+ @Override
+ public void onDialogHide(DialogHideEvent event) {
+ if (event.getHideButton() == PredefinedButton.OK) {
+ } else {
+ }
+ }
+ });
+
+ // Second option: Listen for a button click
+ messageBox.getButton(PredefinedButton.OK).addSelectHandler(
+ new SelectHandler() {
+ @Override
+ public void onSelect(SelectEvent event) {
+ String fileName = messageBox.getTextField()
+ .getCurrentValue();
+ if (fileName != null && !fileName.isEmpty()) {
+ saveNewMainCodeOnServer(fileName);
+ } else {
+ Log.debug("Attention invalid file name for Main Code!");
+ UtilsGXT3.alert(msgsCommon.attention(),
+ msgs.attentionInvalidFileNameForMainCode());
+ }
+
+ }
+ });
+ messageBox.show();
+ }
+
+ private void saveNewMainCodeOnServer(String fileName){
+ ItemDescription file=new ItemDescription();
+ file.setName(fileName);
+ String code = editor.getText();
+ NewMainCodeEvent saveNewMainCodeEvent=new NewMainCodeEvent(file, code);
+ eventBus.fireEvent(saveNewMainCodeEvent);
+ Log.debug("Fired: "+saveNewMainCodeEvent);
+
+ }
+
}
diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/project/ProjectManager.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/project/ProjectManager.java
index 4929fbc..ee41550 100644
--- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/project/ProjectManager.java
+++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/project/ProjectManager.java
@@ -5,6 +5,7 @@ import java.util.Arrays;
import java.util.List;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.ProjectStatusEvent;
+import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.NewMainCodeEvent;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.SessionExpiredEvent;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.monitor.StatAlgoImporterMonitor;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.rpc.StatAlgoImporterServiceAsync;
@@ -288,7 +289,8 @@ public class ProjectManager {
});
}
- public void saveProject(InputData inputData, final StatAlgoImporterMonitor monitor) {
+ public void saveProject(InputData inputData,
+ final StatAlgoImporterMonitor monitor) {
Log.debug("Save Project: " + inputData);
StatAlgoImporterServiceAsync.INSTANCE.saveProject(inputData,
@@ -313,12 +315,13 @@ public class ProjectManager {
caught.getLocalizedMessage());
}
caught.printStackTrace();
-
+
}
});
}
- public void createSofware(InputData inputData, final StatAlgoImporterMonitor monitor) {
+ public void createSofware(InputData inputData,
+ final StatAlgoImporterMonitor monitor) {
Log.debug("Create Software: " + inputData);
StatAlgoImporterServiceAsync.INSTANCE.createSoftware(inputData,
@@ -329,7 +332,7 @@ public class ProjectManager {
monitor.hide();
fireProjectStatusSoftwareCreatedEvent();
UtilsGXT3.info("Create Software", "Software Created!");
-
+
}
@Override
@@ -414,7 +417,38 @@ public class ProjectManager {
});
}
+
+ public void setNewMainCode(NewMainCodeEvent newMainCodeEvent, final StatAlgoImporterMonitor monitor){
+ StatAlgoImporterServiceAsync.INSTANCE.setNewMainCode(newMainCodeEvent.getFile(),newMainCodeEvent.getCode(),
+ new AsyncCallback() {
+ @Override
+ public void onFailure(Throwable caught) {
+ monitor.hide();
+ if (caught instanceof StatAlgoImporterSessionExpiredException) {
+ eventBus.fireEvent(new SessionExpiredEvent(
+ SessionExpiredType.EXPIREDONSERVER));
+ } else {
+ Log.error("Error on save new main code: "
+ + caught.getLocalizedMessage());
+ UtilsGXT3.alert("Error",
+ caught.getLocalizedMessage());
+ }
+ caught.printStackTrace();
+
+ }
+
+ @Override
+ public void onSuccess(ItemDescription itemDescription) {
+ project.setMainCode(new MainCode(itemDescription));
+ fireProjectStatusMainCodeSetEvent();
+ monitor.hide();
+ }
+
+ });
+ }
+
+
public void deleteItem(ItemDescription itemDescription) {
StatAlgoImporterServiceAsync.INSTANCE.deleteResourceOnProject(
itemDescription, new AsyncCallback() {
@@ -488,14 +522,13 @@ public class ProjectManager {
eventBus.fireEvent(projectStatusEvent);
Log.debug("ProjectStatusEvent fired! " + projectStatusEvent);
}
-
+
protected void fireProjectStatusSoftwareCreatedEvent() {
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
ProjectStatusEventType.SOFTWARE_CREATED, project);
eventBus.fireEvent(projectStatusEvent);
Log.debug("ProjectStatusEvent fired! " + projectStatusEvent);
}
-
protected void fireProjectStatusStartEvent() {
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
@@ -504,4 +537,31 @@ public class ProjectManager {
Log.debug("ProjectStatusEvent fired! " + projectStatusEvent);
}
+ public void startProjectManager(String value) {
+
+ StatAlgoImporterServiceAsync.INSTANCE.restoreUISession(value,
+ new AsyncCallback() {
+
+ public void onFailure(Throwable caught) {
+ if (caught instanceof StatAlgoImporterSessionExpiredException) {
+ eventBus.fireEvent(new SessionExpiredEvent(
+ SessionExpiredType.EXPIREDONSERVER));
+ } else {
+ UtilsGXT3.alert("Error",
+ caught.getLocalizedMessage());
+
+ }
+ }
+
+ public void onSuccess(Project p) {
+ if (p != null) {
+ project = p;
+ fireProjectStatusOpenEvent();
+ }
+ }
+
+ });
+
+ }
+
}
diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/properties/EnvironmentVariablesProperties.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/properties/GlobalVariablesProperties.java
similarity index 55%
rename from src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/properties/EnvironmentVariablesProperties.java
rename to src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/properties/GlobalVariablesProperties.java
index 3dff0d0..5e85312 100644
--- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/properties/EnvironmentVariablesProperties.java
+++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/properties/GlobalVariablesProperties.java
@@ -1,6 +1,6 @@
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties;
-import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.EnvironmentVariables;
+import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.GlobalVariables;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.DataType;
import com.sencha.gxt.core.client.ValueProvider;
@@ -13,16 +13,16 @@ import com.sencha.gxt.data.shared.PropertyAccess;
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it
*
*/
-public interface EnvironmentVariablesProperties extends
- PropertyAccess {
+public interface GlobalVariablesProperties extends
+ PropertyAccess {
- ModelKeyProvider id();
+ ModelKeyProvider id();
- ValueProvider name();
+ ValueProvider name();
- ValueProvider description();
+ ValueProvider description();
- ValueProvider dataType();
+ ValueProvider dataType();
- ValueProvider defaultValue();
+ ValueProvider defaultValue();
}
diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/properties/SelectedRowsVariablesProperties.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/properties/InputOutputVariablesProperties.java
similarity index 52%
rename from src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/properties/SelectedRowsVariablesProperties.java
rename to src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/properties/InputOutputVariablesProperties.java
index 0b30541..73c9740 100644
--- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/properties/SelectedRowsVariablesProperties.java
+++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/properties/InputOutputVariablesProperties.java
@@ -1,7 +1,7 @@
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.IOType;
-import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.SelectedRowsVariables;
+import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InputOutputVariables;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.DataType;
import com.sencha.gxt.core.client.ValueProvider;
@@ -14,22 +14,22 @@ import com.sencha.gxt.data.shared.PropertyAccess;
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it
*
*/
-public interface SelectedRowsVariablesProperties extends
- PropertyAccess {
+public interface InputOutputVariablesProperties extends
+ PropertyAccess {
- ModelKeyProvider id();
+ ModelKeyProvider id();
- ValueProvider name();
+ ValueProvider name();
- ValueProvider description();
+ ValueProvider description();
- ValueProvider dataType();
+ ValueProvider dataType();
- ValueProvider defaultValue();
+ ValueProvider defaultValue();
- ValueProvider ioType();
+ ValueProvider ioType();
- ValueProvider sourceSelection();
+ ValueProvider sourceSelection();
}
diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/properties/DeployableVREProperties.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/properties/RequestedVREProperties.java
similarity index 63%
rename from src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/properties/DeployableVREProperties.java
rename to src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/properties/RequestedVREProperties.java
index 623d498..602a296 100644
--- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/properties/DeployableVREProperties.java
+++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/properties/RequestedVREProperties.java
@@ -1,6 +1,6 @@
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties;
-import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.DeployableVRE;
+import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.RequestedVRE;
import com.sencha.gxt.core.client.ValueProvider;
import com.sencha.gxt.data.shared.ModelKeyProvider;
@@ -12,12 +12,12 @@ import com.sencha.gxt.data.shared.PropertyAccess;
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it
*
*/
-public interface DeployableVREProperties extends PropertyAccess {
+public interface RequestedVREProperties extends PropertyAccess {
- ModelKeyProvider id();
+ ModelKeyProvider id();
- ValueProvider name();
+ ValueProvider name();
- ValueProvider description();
+ ValueProvider description();
}
diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/rpc/StatAlgoImporterService.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/rpc/StatAlgoImporterService.java
index 7f7e6c0..a6ae848 100644
--- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/rpc/StatAlgoImporterService.java
+++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/rpc/StatAlgoImporterService.java
@@ -64,8 +64,16 @@ public interface StatAlgoImporterService extends RemoteService {
public void saveCode(String code) throws StatAlgoImporterServiceException;
- public void createSoftware(InputData inputData) throws StatAlgoImporterServiceException;
+ public void createSoftware(InputData inputData)
+ throws StatAlgoImporterServiceException;
- public String getUriFromResolver(ItemDescription itemDescription) throws StatAlgoImporterServiceException;
+ public String getPublicLink(ItemDescription itemDescription)
+ throws StatAlgoImporterServiceException;
+
+ public Project restoreUISession(String value)
+ throws StatAlgoImporterServiceException;
+
+ public ItemDescription setNewMainCode(ItemDescription itemDescription, String code)
+ throws StatAlgoImporterServiceException;
}
diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/rpc/StatAlgoImporterServiceAsync.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/rpc/StatAlgoImporterServiceAsync.java
index bf0fc1c..4950453 100644
--- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/rpc/StatAlgoImporterServiceAsync.java
+++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/rpc/StatAlgoImporterServiceAsync.java
@@ -54,10 +54,14 @@ public interface StatAlgoImporterServiceAsync {
AsyncCallback asyncCallback);
void saveCode(String code, AsyncCallback asyncCallback);
+
+ void setNewMainCode(ItemDescription itemDescription, String code, AsyncCallback asyncCallback);
void createSoftware(InputData inputData, AsyncCallback callback);
- void getUriFromResolver(ItemDescription itemDescription,
+ void getPublicLink(ItemDescription itemDescription,
AsyncCallback asyncCallback);
+ void restoreUISession(String value, AsyncCallback asyncCallback);
+
}
diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/explorer/ExplorerProjectPanel.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/explorer/ExplorerProjectPanel.java
index e06bb6a..68aeb51 100644
--- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/explorer/ExplorerProjectPanel.java
+++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/explorer/ExplorerProjectPanel.java
@@ -119,9 +119,11 @@ public class ExplorerProjectPanel extends ContentPanel {
create(event);
break;
case MAIN_CODE_SET:
+ reloadWSResourceExplorerPanel();
break;
case SOFTWARE_CREATED:
reloadWSResourceExplorerPanel();
+ break;
default:
break;
}
@@ -354,8 +356,8 @@ public class ExplorerProjectPanel extends ContentPanel {
selectedItem.getId(), selectedItem.getName(),
selectedItem.getOwner(), selectedItem.getPath(),
selectedItem.getType().name());
-
- StatAlgoImporterServiceAsync.INSTANCE.getUriFromResolver(
+
+ StatAlgoImporterServiceAsync.INSTANCE.getPublicLink(
itemDescription, new AsyncCallback() {
@Override
diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/EnvironmentVariablesPanel.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/GlobalVariablesPanel.java
similarity index 58%
rename from src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/EnvironmentVariablesPanel.java
rename to src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/GlobalVariablesPanel.java
index 7f371e6..7b82961 100644
--- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/EnvironmentVariablesPanel.java
+++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/GlobalVariablesPanel.java
@@ -4,10 +4,10 @@ import java.util.ArrayList;
import java.util.List;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties.DataTypePropertiesCombo;
-import org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties.EnvironmentVariablesProperties;
+import org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties.GlobalVariablesProperties;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.resource.StatAlgoImporterResources;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.DataType;
-import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.EnvironmentVariables;
+import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.GlobalVariables;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
import com.allen_sauer.gwt.log.client.Log;
@@ -56,13 +56,13 @@ import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it
*
*/
-public class EnvironmentVariablesPanel extends ContentPanel {
+public class GlobalVariablesPanel extends ContentPanel {
@SuppressWarnings("unused")
private EventBus eventBus;
- private ListStore storeEnvironmentVariable;
- private Grid gridEnvironmentVariable;
- private GridRowEditing gridEnvironmentVariableEditing;
+ private ListStore storeGlobalVariable;
+ private Grid gridGlobalVariable;
+ private GridRowEditing gridGlobalVariableEditing;
private TextButton btnAdd;
private boolean addStatus;
private int seq = 0;
@@ -75,9 +75,9 @@ public class EnvironmentVariablesPanel extends ContentPanel {
SafeHtml format(String value);
}
- public EnvironmentVariablesPanel(Project project, EventBus eventBus) {
+ public GlobalVariablesPanel(Project project, EventBus eventBus) {
super();
- Log.debug("EnvironmentVariablesPanel");
+ Log.debug("GlobalVariablesPanel");
this.eventBus = eventBus;
// msgs = GWT.create(ServiceCategoryMessages.class);
@@ -99,18 +99,18 @@ public class EnvironmentVariablesPanel extends ContentPanel {
private void create(Project project) {
// Grid
- EnvironmentVariablesProperties props = GWT
- .create(EnvironmentVariablesProperties.class);
+ GlobalVariablesProperties props = GWT
+ .create(GlobalVariablesProperties.class);
- ColumnConfig nameColumn = new ColumnConfig(
+ ColumnConfig nameColumn = new ColumnConfig(
props.name(), 100, "Name");
// nameColumn.setMenuDisabled(true);
- ColumnConfig descriptionColumn = new ColumnConfig(
+ ColumnConfig descriptionColumn = new ColumnConfig(
props.description(), 100, "Description");
// descriptionColumn.setMenuDisabled(true);
- ColumnConfig inputTypeColumn = new ColumnConfig(
+ ColumnConfig inputTypeColumn = new ColumnConfig(
props.dataType(), 100, "Type");
// inputTypeColumn.setMenuDisabled(true);
inputTypeColumn.setCell(new AbstractCell() {
@@ -124,53 +124,53 @@ public class EnvironmentVariablesPanel extends ContentPanel {
}
});
- ColumnConfig defaultValueColumn = new ColumnConfig(
+ ColumnConfig defaultValueColumn = new ColumnConfig(
props.defaultValue(), 100, "Default");
// defaColumn.setMenuDisabled(true);
- ArrayList> l = new ArrayList>();
+ ArrayList> l = new ArrayList>();
l.add(nameColumn);
l.add(descriptionColumn);
l.add(inputTypeColumn);
l.add(defaultValueColumn);
- ColumnModel columns = new ColumnModel(l);
+ ColumnModel columns = new ColumnModel(l);
- storeEnvironmentVariable = new ListStore(props.id());
+ storeGlobalVariable = new ListStore(props.id());
if (project != null && project.getInputData() != null
- && project.getInputData().getListSelectedRows() != null) {
- storeEnvironmentVariable.addAll(project.getInputData()
- .getListEnvironmentVariables());
- seq = project.getInputData().getListEnvironmentVariables().size();
+ && project.getInputData().getListGlobalVariables() != null) {
+ storeGlobalVariable.addAll(project.getInputData()
+ .getListGlobalVariables());
+ seq = project.getInputData().getListGlobalVariables().size();
}
- final GridSelectionModel sm = new GridSelectionModel();
+ final GridSelectionModel sm = new GridSelectionModel();
sm.setSelectionMode(SelectionMode.SINGLE);
- gridEnvironmentVariable = new Grid(
- storeEnvironmentVariable, columns);
- gridEnvironmentVariable.setSelectionModel(sm);
- gridEnvironmentVariable.getView().setStripeRows(true);
- gridEnvironmentVariable.getView().setColumnLines(true);
- gridEnvironmentVariable.getView().setAutoExpandColumn(nameColumn);
- gridEnvironmentVariable.getView().setAutoFill(true);
- gridEnvironmentVariable.setBorders(false);
- gridEnvironmentVariable.setColumnReordering(false);
+ gridGlobalVariable = new Grid(
+ storeGlobalVariable, columns);
+ gridGlobalVariable.setSelectionModel(sm);
+ gridGlobalVariable.getView().setStripeRows(true);
+ gridGlobalVariable.getView().setColumnLines(true);
+ gridGlobalVariable.getView().setAutoExpandColumn(nameColumn);
+ gridGlobalVariable.getView().setAutoFill(true);
+ gridGlobalVariable.setBorders(false);
+ gridGlobalVariable.setColumnReordering(false);
/*
- * GridDragSource ds = new
- * GridDragSource( gridEnvironmentVariable);
+ * GridDragSource ds = new
+ * GridDragSource( gridGlobalVariable);
* ds.addDragStartHandler(new DndDragStartHandler() {
*
* @Override public void onDragStart(DndDragStartEvent event) {
*
- * @SuppressWarnings("unchecked") ArrayList
- * draggingSelection = (ArrayList) event
+ * @SuppressWarnings("unchecked") ArrayList
+ * draggingSelection = (ArrayList) event
* .getData(); Log.debug("Start Drag: " + draggingSelection);
*
- * } }); GridDropTarget dt = new
- * GridDropTarget( gridEnvironmentVariable);
+ * } }); GridDropTarget dt = new
+ * GridDropTarget( gridGlobalVariable);
* dt.setFeedback(Feedback.BOTH); dt.setAllowSelfAsSource(true);
*/
@@ -191,26 +191,26 @@ public class EnvironmentVariablesPanel extends ContentPanel {
comboInputType.setTriggerAction(TriggerAction.ALL);
addHandlersForComboInputType(inputTypePropertiesCombo.label());
- gridEnvironmentVariableEditing = new GridRowEditing(
- gridEnvironmentVariable);
- gridEnvironmentVariableEditing.addEditor(nameColumn, new TextField());
- gridEnvironmentVariableEditing.addEditor(descriptionColumn,
+ gridGlobalVariableEditing = new GridRowEditing(
+ gridGlobalVariable);
+ gridGlobalVariableEditing.addEditor(nameColumn, new TextField());
+ gridGlobalVariableEditing.addEditor(descriptionColumn,
new TextField());
- gridEnvironmentVariableEditing.addEditor(inputTypeColumn,
+ gridGlobalVariableEditing.addEditor(inputTypeColumn,
comboInputType);
- gridEnvironmentVariableEditing.addEditor(defaultValueColumn,
+ gridGlobalVariableEditing.addEditor(defaultValueColumn,
new TextField());
btnAdd = new TextButton("Add");
btnAdd.setIcon(StatAlgoImporterResources.INSTANCE.add16());
btnAdd.setScale(ButtonScale.SMALL);
btnAdd.setIconAlign(IconAlign.LEFT);
- btnAdd.setToolTip("Add Environment Variable");
+ btnAdd.setToolTip("Add Global Variable");
btnAdd.addSelectHandler(new SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
- addEnvironmentVariable(event);
+ addGlobalVariable(event);
}
});
@@ -218,78 +218,78 @@ public class EnvironmentVariablesPanel extends ContentPanel {
TextButton btnDelete = new TextButton("Delete");
btnDelete.addSelectHandler(new SelectEvent.SelectHandler() {
public void onSelect(SelectEvent event) {
- GridCell cell = gridEnvironmentVariableEditing.getActiveCell();
+ GridCell cell = gridGlobalVariableEditing.getActiveCell();
int rowIndex = cell.getRow();
- gridEnvironmentVariableEditing.cancelEditing();
+ gridGlobalVariableEditing.cancelEditing();
- storeEnvironmentVariable.remove(rowIndex);
- storeEnvironmentVariable.commitChanges();
+ storeGlobalVariable.remove(rowIndex);
+ storeGlobalVariable.commitChanges();
- gridEnvironmentVariableEditing.getCancelButton().setVisible(
+ gridGlobalVariableEditing.getCancelButton().setVisible(
true);
btnAdd.setEnabled(true);
if (addStatus) {
addStatus = false;
}
- List listSelected=storeEnvironmentVariable.getAll();
- List listNewSelected= new ArrayList();
+ List listSelected=storeGlobalVariable.getAll();
+ List listNewSelected= new ArrayList();
for(int i=0; i() {
+ gridGlobalVariableEditing
+ .addBeforeStartEditHandler(new BeforeStartEditHandler() {
@Override
public void onBeforeStartEdit(
- BeforeStartEditEvent event) {
+ BeforeStartEditEvent event) {
editingBeforeStart(event);
}
});
- gridEnvironmentVariableEditing
- .addCancelEditHandler(new CancelEditHandler() {
+ gridGlobalVariableEditing
+ .addCancelEditHandler(new CancelEditHandler() {
@Override
public void onCancelEdit(
- CancelEditEvent event) {
- storeEnvironmentVariable.rejectChanges();
+ CancelEditEvent event) {
+ storeGlobalVariable.rejectChanges();
btnAdd.setEnabled(true);
}
});
- gridEnvironmentVariableEditing
- .addCompleteEditHandler(new CompleteEditHandler() {
+ gridGlobalVariableEditing
+ .addCompleteEditHandler(new CompleteEditHandler() {
@Override
public void onCompleteEdit(
- CompleteEditEvent event) {
+ CompleteEditEvent event) {
try {
if (addStatus) {
addStatus = false;
}
- storeEnvironmentVariable.commitChanges();
+ storeGlobalVariable.commitChanges();
- gridEnvironmentVariableEditing.getCancelButton()
+ gridGlobalVariableEditing.getCancelButton()
.setVisible(true);
btnAdd.setEnabled(true);
@@ -309,14 +309,14 @@ public class EnvironmentVariablesPanel extends ContentPanel {
vlc.setScrollMode(ScrollMode.NONE);
vlc.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
- vlc.add(gridEnvironmentVariable, new VerticalLayoutData(1, 1,
+ vlc.add(gridGlobalVariable, new VerticalLayoutData(1, 1,
new Margins(0)));
add(vlc, new MarginData(new Margins(0)));
}
- private void editingBeforeStart(BeforeStartEditEvent event) {
+ private void editingBeforeStart(BeforeStartEditEvent event) {
// TODO Auto-generated method stub
}
@@ -326,23 +326,23 @@ public class EnvironmentVariablesPanel extends ContentPanel {
}
- private void addEnvironmentVariable(SelectEvent event) {
+ private void addGlobalVariable(SelectEvent event) {
try {
seq++;
- EnvironmentVariables newEnvironmentVariable = new EnvironmentVariables(seq, "",
+ GlobalVariables newGlobalVariable = new GlobalVariables(seq, "",
"", "", DataType.STRING);
- Log.debug("New Environment Variable: " + newEnvironmentVariable);
- gridEnvironmentVariableEditing.cancelEditing();
+ Log.debug("New Global Variable: " + newGlobalVariable);
+ gridGlobalVariableEditing.cancelEditing();
addStatus = true;
- gridEnvironmentVariableEditing.getCancelButton().setVisible(false);
- storeEnvironmentVariable.add(newEnvironmentVariable);
- int row = storeEnvironmentVariable.indexOf(newEnvironmentVariable);
+ gridGlobalVariableEditing.getCancelButton().setVisible(false);
+ storeGlobalVariable.add(newGlobalVariable);
+ int row = storeGlobalVariable.indexOf(newGlobalVariable);
storeComboInputType.clear();
storeComboInputType.addAll(DataType.asList());
storeComboInputType.commitChanges();
- gridEnvironmentVariableEditing.startEditing(new GridCell(row, 0));
+ gridGlobalVariableEditing.startEditing(new GridCell(row, 0));
} catch (Throwable e) {
e.printStackTrace();
}
@@ -350,28 +350,28 @@ public class EnvironmentVariablesPanel extends ContentPanel {
public void update(Project project) {
if (project != null && project.getInputData() != null
- && project.getInputData().getListSelectedRows() != null) {
- storeEnvironmentVariable.clear();
- storeEnvironmentVariable.addAll(project.getInputData().getListEnvironmentVariables());
- storeEnvironmentVariable.commitChanges();
- seq = project.getInputData().getListEnvironmentVariables().size();
+ && project.getInputData().getListGlobalVariables() != null) {
+ storeGlobalVariable.clear();
+ storeGlobalVariable.addAll(project.getInputData().getListGlobalVariables());
+ storeGlobalVariable.commitChanges();
+ seq = project.getInputData().getListGlobalVariables().size();
} else {
- storeEnvironmentVariable.clear();
- storeEnvironmentVariable.commitChanges();
+ storeGlobalVariable.clear();
+ storeGlobalVariable.commitChanges();
seq=0;
}
}
- public ArrayList getEnvironmentVariables() {
- ArrayList listEnviromentVarialbles = new ArrayList<>(
- gridEnvironmentVariable.getStore().getAll());
- return listEnviromentVarialbles;
+ public ArrayList getGlobalVariables() {
+ ArrayList listGlobalVarialbles = new ArrayList<>(
+ gridGlobalVariable.getStore().getAll());
+ return listGlobalVarialbles;
}
public void setMainCode(Project project) {
- storeEnvironmentVariable.clear();
- storeEnvironmentVariable.commitChanges();
+ storeGlobalVariable.clear();
+ storeGlobalVariable.commitChanges();
seq = 0;
forceLayout();
diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/SelectedRowsPanel.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/InputOutputVariablesPanel.java
similarity index 59%
rename from src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/SelectedRowsPanel.java
rename to src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/InputOutputVariablesPanel.java
index d875643..cacb267 100644
--- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/SelectedRowsPanel.java
+++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/InputOutputVariablesPanel.java
@@ -5,11 +5,11 @@ import java.util.List;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties.DataTypePropertiesCombo;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties.IOTypePropertiesCombo;
-import org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties.SelectedRowsVariablesProperties;
+import org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties.InputOutputVariablesProperties;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.resource.StatAlgoImporterResources;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.DataType;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.IOType;
-import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.SelectedRowsVariables;
+import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InputOutputVariables;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
import com.allen_sauer.gwt.log.client.Log;
@@ -54,17 +54,17 @@ import com.sencha.gxt.widget.core.client.grid.editing.GridRowEditing;
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it
*
*/
-public class SelectedRowsPanel extends ContentPanel {
+public class InputOutputVariablesPanel extends ContentPanel {
@SuppressWarnings("unused")
private EventBus eventBus;
- private ListStore storeSelectedRows;
- private Grid gridSelectedRows;
+ private ListStore storeInputOutputVariables;
+ private Grid gridInputOutputVariables;
private ListStore storeComboDataType;
private ComboBox comboDataType;
private ListStore storeComboIOType;
private ComboBox comboIOType;
- private GridRowEditing gridSelectedRowsEditing;
+ private GridRowEditing gridInputOutputVariablesEditing;
private TextButton btnAdd;
private boolean addStatus;
private int seq = 0;
@@ -79,9 +79,9 @@ public class SelectedRowsPanel extends ContentPanel {
SafeHtml format(String value);
}
- public SelectedRowsPanel(Project project, EventBus eventBus) {
+ public InputOutputVariablesPanel(Project project, EventBus eventBus) {
super();
- Log.debug("SelectedRowsPanel");
+ Log.debug("InputOutputVariablesPanel");
this.eventBus = eventBus;
// msgs = GWT.create(ServiceCategoryMessages.class);
@@ -103,25 +103,25 @@ public class SelectedRowsPanel extends ContentPanel {
private void create(Project project) {
if (project != null && project.getInputData() != null
- && project.getInputData().getListSelectedRows() != null) {
- seq = project.getInputData().getListSelectedRows().size();
+ && project.getInputData().getListInputOutputVariables() != null) {
+ seq = project.getInputData().getListInputOutputVariables().size();
} else {
seq = 0;
}
// Grid
- SelectedRowsVariablesProperties props = GWT
- .create(SelectedRowsVariablesProperties.class);
+ InputOutputVariablesProperties props = GWT
+ .create(InputOutputVariablesProperties.class);
- ColumnConfig nameColumn = new ColumnConfig(
+ ColumnConfig nameColumn = new ColumnConfig(
props.name(), 100, "Name");
// nameColumn.setMenuDisabled(true);
- ColumnConfig descriptionColumn = new ColumnConfig(
+ ColumnConfig descriptionColumn = new ColumnConfig(
props.description(), 100, "Description");
// descriptionColumn.setMenuDisabled(true);
- ColumnConfig dataTypeColumn = new ColumnConfig(
+ ColumnConfig dataTypeColumn = new ColumnConfig(
props.dataType(), 100, "Type");
// inputTypeColumn.setMenuDisabled(true);
dataTypeColumn.setCell(new AbstractCell() {
@@ -135,11 +135,11 @@ public class SelectedRowsPanel extends ContentPanel {
}
});
- ColumnConfig defaultValueColumn = new ColumnConfig(
+ ColumnConfig defaultValueColumn = new ColumnConfig(
props.defaultValue(), 100, "Default");
// defaColumn.setMenuDisabled(true);
- ColumnConfig ioTypeColumn = new ColumnConfig(
+ ColumnConfig ioTypeColumn = new ColumnConfig(
props.ioType(), 100, "I/O");
// inputTypeColumn.setMenuDisabled(true);
ioTypeColumn.setCell(new AbstractCell() {
@@ -153,58 +153,58 @@ public class SelectedRowsPanel extends ContentPanel {
}
});
- ArrayList> l = new ArrayList>();
+ ArrayList> l = new ArrayList>();
l.add(nameColumn);
l.add(descriptionColumn);
l.add(dataTypeColumn);
l.add(defaultValueColumn);
l.add(ioTypeColumn);
- ColumnModel columns = new ColumnModel(
+ ColumnModel columns = new ColumnModel(
l);
- storeSelectedRows = new ListStore(props.id());
+ storeInputOutputVariables = new ListStore(props.id());
/*
- * ArrayList list = new ArrayList<>(); for (int i
- * = 0; i < 10; i++) { list.add(new SelectedRowsVariables(i, "Test" + i,
+ * ArrayList list = new ArrayList<>(); for (int i
+ * = 0; i < 10; i++) { list.add(new InputOutputVariablesVariables(i, "Test" + i,
* "Desc", "defaultValue", InputType.STRING)); }
*
* storeEnvironmentVariable.addAll(list);
*/
if (project != null && project.getInputData() != null
- && project.getInputData().getListSelectedRows() != null) {
- storeSelectedRows.addAll(project.getInputData()
- .getListSelectedRows());
+ && project.getInputData().getListInputOutputVariables() != null) {
+ storeInputOutputVariables.addAll(project.getInputData()
+ .getListInputOutputVariables());
}
- final GridSelectionModel sm = new GridSelectionModel();
+ final GridSelectionModel sm = new GridSelectionModel();
sm.setSelectionMode(SelectionMode.SINGLE);
- gridSelectedRows = new Grid(storeSelectedRows,
+ gridInputOutputVariables = new Grid(storeInputOutputVariables,
columns);
- gridSelectedRows.setSelectionModel(sm);
- gridSelectedRows.getView().setStripeRows(true);
- gridSelectedRows.getView().setColumnLines(true);
- gridSelectedRows.getView().setAutoExpandColumn(nameColumn);
- gridSelectedRows.getView().setAutoFill(true);
- gridSelectedRows.setBorders(false);
- gridSelectedRows.setColumnReordering(false);
+ gridInputOutputVariables.setSelectionModel(sm);
+ gridInputOutputVariables.getView().setStripeRows(true);
+ gridInputOutputVariables.getView().setColumnLines(true);
+ gridInputOutputVariables.getView().setAutoExpandColumn(nameColumn);
+ gridInputOutputVariables.getView().setAutoFill(true);
+ gridInputOutputVariables.setBorders(false);
+ gridInputOutputVariables.setColumnReordering(false);
/*
- * GridDragSource ds = new
- * GridDragSource( gridEnvironmentVariable);
+ * GridDragSource ds = new
+ * GridDragSource( gridEnvironmentVariable);
* ds.addDragStartHandler(new DndDragStartHandler() {
*
* @Override public void onDragStart(DndDragStartEvent event) {
*
- * @SuppressWarnings("unchecked") ArrayList
- * draggingSelection = (ArrayList) event
+ * @SuppressWarnings("unchecked") ArrayList
+ * draggingSelection = (ArrayList) event
* .getData(); Log.debug("Start Drag: " + draggingSelection);
*
- * } }); GridDropTarget dt = new
- * GridDropTarget( gridEnvironmentVariable);
+ * } }); GridDropTarget dt = new
+ * GridDropTarget( gridEnvironmentVariable);
* dt.setFeedback(Feedback.BOTH); dt.setAllowSelfAsSource(true);
*/
@@ -249,24 +249,24 @@ public class SelectedRowsPanel extends ContentPanel {
//
- gridSelectedRowsEditing = new GridRowEditing(
- gridSelectedRows);
- gridSelectedRowsEditing.addEditor(nameColumn, new TextField());
- gridSelectedRowsEditing.addEditor(descriptionColumn, new TextField());
- gridSelectedRowsEditing.addEditor(dataTypeColumn, comboDataType);
- gridSelectedRowsEditing.addEditor(defaultValueColumn, new TextField());
+ gridInputOutputVariablesEditing = new GridRowEditing(
+ gridInputOutputVariables);
+ gridInputOutputVariablesEditing.addEditor(nameColumn, new TextField());
+ gridInputOutputVariablesEditing.addEditor(descriptionColumn, new TextField());
+ gridInputOutputVariablesEditing.addEditor(dataTypeColumn, comboDataType);
+ gridInputOutputVariablesEditing.addEditor(defaultValueColumn, new TextField());
- gridSelectedRowsEditing.addEditor(ioTypeColumn, comboIOType);
+ gridInputOutputVariablesEditing.addEditor(ioTypeColumn, comboIOType);
btnAdd = new TextButton();
btnAdd.setIcon(StatAlgoImporterResources.INSTANCE.add16());
// btnAdd.setIconAlign(IconAlign.);
- btnAdd.setToolTip("Add Environment Variable");
+ btnAdd.setToolTip("Add Input/Output Variable");
btnAdd.addSelectHandler(new SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
- addSelectedRow(event);
+ addInputOutputVariable(event);
}
});
@@ -274,77 +274,77 @@ public class SelectedRowsPanel extends ContentPanel {
TextButton btnDelete = new TextButton("Delete");
btnDelete.addSelectHandler(new SelectEvent.SelectHandler() {
public void onSelect(SelectEvent event) {
- GridCell cell = gridSelectedRowsEditing.getActiveCell();
+ GridCell cell = gridInputOutputVariablesEditing.getActiveCell();
int rowIndex = cell.getRow();
- gridSelectedRowsEditing.cancelEditing();
+ gridInputOutputVariablesEditing.cancelEditing();
- storeSelectedRows.remove(rowIndex);
- storeSelectedRows.commitChanges();
+ storeInputOutputVariables.remove(rowIndex);
+ storeInputOutputVariables.commitChanges();
- gridSelectedRowsEditing.getCancelButton().setVisible(true);
+ gridInputOutputVariablesEditing.getCancelButton().setVisible(true);
btnAdd.setEnabled(true);
if (addStatus) {
addStatus = false;
}
- List listSelected=storeSelectedRows.getAll();
- List listNewSelected= new ArrayList();
- for(int i=0; i listIOVariables=storeInputOutputVariables.getAll();
+ List listNewIOVariables= new ArrayList();
+ for(int i=0; i() {
+ gridInputOutputVariablesEditing
+ .addBeforeStartEditHandler(new BeforeStartEditHandler() {
@Override
public void onBeforeStartEdit(
- BeforeStartEditEvent event) {
+ BeforeStartEditEvent event) {
editingBeforeStart(event);
}
});
- gridSelectedRowsEditing
- .addCancelEditHandler(new CancelEditHandler() {
+ gridInputOutputVariablesEditing
+ .addCancelEditHandler(new CancelEditHandler() {
@Override
public void onCancelEdit(
- CancelEditEvent event) {
- storeSelectedRows.rejectChanges();
+ CancelEditEvent event) {
+ storeInputOutputVariables.rejectChanges();
btnAdd.setEnabled(true);
}
});
- gridSelectedRowsEditing
- .addCompleteEditHandler(new CompleteEditHandler() {
+ gridInputOutputVariablesEditing
+ .addCompleteEditHandler(new CompleteEditHandler() {
@Override
public void onCompleteEdit(
- CompleteEditEvent event) {
+ CompleteEditEvent event) {
try {
if (addStatus) {
addStatus = false;
}
- storeSelectedRows.commitChanges();
+ storeInputOutputVariables.commitChanges();
- gridSelectedRowsEditing.getCancelButton()
+ gridInputOutputVariablesEditing.getCancelButton()
.setVisible(true);
btnAdd.setEnabled(true);
@@ -364,14 +364,14 @@ public class SelectedRowsPanel extends ContentPanel {
vlc.setScrollMode(ScrollMode.NONE);
// vlc.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
- vlc.add(gridSelectedRows, new VerticalLayoutData(1, 1, new Margins(0)));
+ vlc.add(gridInputOutputVariables, new VerticalLayoutData(1, 1, new Margins(0)));
add(vlc, new MarginData(new Margins(0)));
}
private void editingBeforeStart(
- BeforeStartEditEvent event) {
+ BeforeStartEditEvent event) {
// TODO Auto-generated method stub
}
@@ -386,18 +386,18 @@ public class SelectedRowsPanel extends ContentPanel {
}
- public void addNewSelectedRowsVariable(
- SelectedRowsVariables selectedRowsVariable) {
+ public void addNewInputOutputVariables(
+ InputOutputVariables inputOutputVariable) {
try {
Log.debug("Current Seq: " + seq);
seq++;
- selectedRowsVariable.setId(seq);
- Log.debug("New Selected Rows Variable: " + selectedRowsVariable);
- storeSelectedRows.add(selectedRowsVariable);
- storeSelectedRows.commitChanges();
+ inputOutputVariable.setId(seq);
+ Log.debug("New Input/Output Variable: " + inputOutputVariable);
+ storeInputOutputVariables.add(inputOutputVariable);
+ storeInputOutputVariables.commitChanges();
- if (gridSelectedRowsEditing.isEditing()) {
- gridSelectedRowsEditing.cancelEditing();
+ if (gridInputOutputVariablesEditing.isEditing()) {
+ gridInputOutputVariablesEditing.cancelEditing();
}
forceLayout();
} catch (Throwable e) {
@@ -406,18 +406,18 @@ public class SelectedRowsPanel extends ContentPanel {
}
}
- private void addSelectedRow(SelectEvent event) {
+ private void addInputOutputVariable(SelectEvent event) {
try {
Log.debug("Current Seq: " + seq);
seq++;
- SelectedRowsVariables newSelectedRowsVariable = new SelectedRowsVariables(
+ InputOutputVariables newInputOutputVariablesVariable = new InputOutputVariables(
seq, "", "", "", DataType.STRING, IOType.INPUT, "");
- Log.debug("New Selected Rows Variable: " + newSelectedRowsVariable);
- gridSelectedRowsEditing.cancelEditing();
+ Log.debug("New Input/Output Variable: " + newInputOutputVariablesVariable);
+ gridInputOutputVariablesEditing.cancelEditing();
addStatus = true;
- gridSelectedRowsEditing.getCancelButton().setVisible(false);
- storeSelectedRows.add(newSelectedRowsVariable);
- int row = storeSelectedRows.indexOf(newSelectedRowsVariable);
+ gridInputOutputVariablesEditing.getCancelButton().setVisible(false);
+ storeInputOutputVariables.add(newInputOutputVariablesVariable);
+ int row = storeInputOutputVariables.indexOf(newInputOutputVariablesVariable);
storeComboDataType.clear();
storeComboDataType.addAll(DataType.asList());
@@ -427,39 +427,39 @@ public class SelectedRowsPanel extends ContentPanel {
storeComboIOType.addAll(IOType.asList());
storeComboIOType.commitChanges();
- gridSelectedRowsEditing.startEditing(new GridCell(row, 0));
+ gridInputOutputVariablesEditing.startEditing(new GridCell(row, 0));
} catch (Throwable e) {
e.printStackTrace();
}
}
public void update(Project project) {
- Log.debug("Update Selected Rows: " + project);
+ Log.debug("Update Input/Output Variables: " + project);
if (project != null && project.getInputData() != null
- && project.getInputData().getListSelectedRows() != null) {
- storeSelectedRows.clear();
- storeSelectedRows.addAll(project.getInputData()
- .getListSelectedRows());
- storeSelectedRows.commitChanges();
- seq = project.getInputData().getListSelectedRows().size();
+ && project.getInputData().getListInputOutputVariables() != null) {
+ storeInputOutputVariables.clear();
+ storeInputOutputVariables.addAll(project.getInputData()
+ .getListInputOutputVariables());
+ storeInputOutputVariables.commitChanges();
+ seq = project.getInputData().getListInputOutputVariables().size();
} else {
- storeSelectedRows.clear();
- storeSelectedRows.commitChanges();
+ storeInputOutputVariables.clear();
+ storeInputOutputVariables.commitChanges();
seq=0;
}
}
- public ArrayList getSelectedRows() {
- ArrayList listEnviromentVarialbles = new ArrayList<>(
- gridSelectedRows.getStore().getAll());
- return listEnviromentVarialbles;
+ public ArrayList getInputOutputVariables() {
+ ArrayList listInputOutputVarialbles = new ArrayList<>(
+ gridInputOutputVariables.getStore().getAll());
+ return listInputOutputVarialbles;
}
public void setMainCode(Project project) {
- storeSelectedRows.clear();
- storeSelectedRows.commitChanges();
+ storeInputOutputVariables.clear();
+ storeInputOutputVariables.commitChanges();
seq = 0;
forceLayout();
diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/InputVariableMessages.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/InputVariableMessages.java
index 421098c..e6bc20b 100644
--- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/InputVariableMessages.java
+++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/InputVariableMessages.java
@@ -11,11 +11,11 @@ import com.google.gwt.i18n.client.Messages;
public interface InputVariableMessages extends Messages {
//
- @DefaultMessage("Selected Rows")
- String selectedRows();
+ @DefaultMessage("Input/Output")
+ String inputOutputVariables();
- @DefaultMessage("Enviroment Variables")
- String environmentVariables();
+ @DefaultMessage("Global Variables")
+ String globalVariables();
@DefaultMessage("Interpreter")
String interpreterInfo();
diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/InputVariablePanel.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/InputVariablePanel.java
index 7e4f342..7ca3f46 100644
--- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/InputVariablePanel.java
+++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/InputVariablePanel.java
@@ -3,7 +3,7 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools.input
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.InputRequestEvent;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.NewSelectedRowsVariableEvent;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.ProjectStatusEvent;
-import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.SelectedRowsVariables;
+import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InputOutputVariables;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
import com.allen_sauer.gwt.log.client.Log;
@@ -97,7 +97,7 @@ public class InputVariablePanel extends ContentPanel {
}
protected void addNewSelectedRowsVariable(
- SelectedRowsVariables selectedRowsVariable) {
+ InputOutputVariables selectedRowsVariable) {
inputVariableTabPanel.addSelectedRowsVariable(selectedRowsVariable);
}
diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/InputVariableTabPanel.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/InputVariableTabPanel.java
index 9624ea3..852e6fe 100644
--- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/InputVariableTabPanel.java
+++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/InputVariableTabPanel.java
@@ -1,7 +1,7 @@
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools.input;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.InputReadyEvent;
-import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.SelectedRowsVariables;
+import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InputOutputVariables;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.InputData;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
@@ -22,8 +22,8 @@ import com.sencha.gxt.widget.core.client.TabPanel;
public class InputVariableTabPanel extends TabPanel {
private InputVariableMessages msgs;
private EventBus eventBus;
- private EnvironmentVariablesPanel enviromentVariablesPanel;
- private SelectedRowsPanel selectedRowsPanel;
+ private GlobalVariablesPanel globalVariablesPanel;
+ private InputOutputVariablesPanel inputOutputVariablesPanel;
private InterpreterInfoPanel interpreterInfoPanel;
private ProjectInfoPanel projectInfoPanel;
@@ -48,8 +48,8 @@ public class InputVariableTabPanel extends TabPanel {
public void startTabs(Project project) {
Log.debug("Start InputVariable Tabs");
- addEnvironmentVariablesPanel(project);
- addSelectedRowsPanel(project);
+ addGlobalVariablesPanel(project);
+ addInputOutputVariablesPanel(project);
addInterpreterInfoPanel(project);
addProjectInfoPanel(project);
setActiveWidget(getWidget(0));
@@ -77,8 +77,8 @@ public class InputVariableTabPanel extends TabPanel {
//
public void setMainCode(Project project) {
try {
- enviromentVariablesPanel.setMainCode(project);
- selectedRowsPanel.setMainCode(project);
+ globalVariablesPanel.setMainCode(project);
+ inputOutputVariablesPanel.setMainCode(project);
forceLayout();
} catch (Throwable e) {
@@ -91,8 +91,8 @@ public class InputVariableTabPanel extends TabPanel {
public void updateTabs(Project project) {
try {
- enviromentVariablesPanel.update(project);
- selectedRowsPanel.update(project);
+ globalVariablesPanel.update(project);
+ inputOutputVariablesPanel.update(project);
interpreterInfoPanel.update(project);
projectInfoPanel.update(project);
forceLayout();
@@ -105,14 +105,14 @@ public class InputVariableTabPanel extends TabPanel {
public void requestInput() {
InputData inputData = new InputData();
- if (enviromentVariablesPanel != null) {
- inputData.setListEnvironmentVariables(enviromentVariablesPanel
- .getEnvironmentVariables());
+ if (globalVariablesPanel != null) {
+ inputData.setListGlobalVariables(globalVariablesPanel
+ .getGlobalVariables());
}
- if (selectedRowsPanel != null) {
- inputData.setListSelectedRows(selectedRowsPanel
- .getSelectedRows());
+ if (inputOutputVariablesPanel != null) {
+ inputData.setListInputOutputVariables(inputOutputVariablesPanel
+ .getInputOutputVariables());
}
if (interpreterInfoPanel != null) {
@@ -134,24 +134,24 @@ public class InputVariableTabPanel extends TabPanel {
}
// Add
- private void addSelectedRowsPanel(Project project) {
- TabItemConfig selectedRowsPanelItemConf = new TabItemConfig(
- msgs.selectedRows(), false);
+ private void addInputOutputVariablesPanel(Project project) {
+ TabItemConfig inputOutputPanelItemConf = new TabItemConfig(
+ msgs.inputOutputVariables(), false);
- selectedRowsPanel = new SelectedRowsPanel(project, eventBus);
- selectedRowsPanel.setHeaderVisible(false);
- add(selectedRowsPanel, selectedRowsPanelItemConf);
+ inputOutputVariablesPanel = new InputOutputVariablesPanel(project, eventBus);
+ inputOutputVariablesPanel.setHeaderVisible(false);
+ add(inputOutputVariablesPanel, inputOutputPanelItemConf);
}
- private void addEnvironmentVariablesPanel(Project project) {
- TabItemConfig enviromentVariablePanelItemConf = new TabItemConfig(
- msgs.environmentVariables(), false);
+ private void addGlobalVariablesPanel(Project project) {
+ TabItemConfig globalVariablePanelItemConf = new TabItemConfig(
+ msgs.globalVariables(), false);
- enviromentVariablesPanel = new EnvironmentVariablesPanel(project,
+ globalVariablesPanel = new GlobalVariablesPanel(project,
eventBus);
- enviromentVariablesPanel.setHeaderVisible(false);
- add(enviromentVariablesPanel, enviromentVariablePanelItemConf);
+ globalVariablesPanel.setHeaderVisible(false);
+ add(globalVariablesPanel, globalVariablePanelItemConf);
}
private void addInterpreterInfoPanel(Project project) {
@@ -176,9 +176,9 @@ public class InputVariableTabPanel extends TabPanel {
public void addSelectedRowsVariable(
- SelectedRowsVariables selectedRowsVariable) {
- setActiveWidget(selectedRowsPanel);
- selectedRowsPanel.addNewSelectedRowsVariable(selectedRowsVariable);
+ InputOutputVariables inputOutputVariable) {
+ setActiveWidget(inputOutputVariablesPanel);
+ inputOutputVariablesPanel.addNewInputOutputVariables(inputOutputVariable);
}
diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/InterpreterInfoPanel.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/InterpreterInfoPanel.java
index 3ed71ef..fe79744 100644
--- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/InterpreterInfoPanel.java
+++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/InterpreterInfoPanel.java
@@ -82,17 +82,7 @@ public class InterpreterInfoPanel extends ContentPanel {
}
private void create(Project project) {
- if (project != null
- && project.getInputData() != null
- && project.getInputData().getInterpreterInfo() != null
- && project.getInputData().getInterpreterInfo()
- .getInterpreterPackagesInfo() != null) {
- seq = project.getInputData().getInterpreterInfo()
- .getInterpreterPackagesInfo().size();
- } else {
- seq = 0;
- }
-
+
// Grid
InterpreterPackageInfoProperties props = GWT
.create(InterpreterPackageInfoProperties.class);
@@ -130,6 +120,10 @@ public class InterpreterInfoPanel extends ContentPanel {
.getInterpreterPackagesInfo() != null) {
storeInterpreterPackageInfo.addAll(project.getInputData()
.getInterpreterInfo().getInterpreterPackagesInfo());
+ seq = project.getInputData().getInterpreterInfo()
+ .getInterpreterPackagesInfo().size();
+ } else {
+ seq = 0;
}
final GridSelectionModel sm = new GridSelectionModel();
@@ -349,6 +343,8 @@ public class InterpreterInfoPanel extends ContentPanel {
interpreterVersion.setValue(project.getInputData()
.getInterpreterInfo().getVersion());
+ } else {
+ interpreterVersion.clear();
}
if (project.getInputData().getInterpreterInfo()
@@ -358,7 +354,7 @@ public class InterpreterInfoPanel extends ContentPanel {
storeInterpreterPackageInfo.addAll(project.getInputData()
.getInterpreterInfo().getInterpreterPackagesInfo());
storeInterpreterPackageInfo.commitChanges();
- seq = project.getInputData().getListSelectedRows().size();
+ seq = project.getInputData().getInterpreterInfo().getInterpreterPackagesInfo().size();
} else {
seq = 0;
}
diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/ProjectInfoPanel.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/ProjectInfoPanel.java
index 84e0fdb..5be7763 100644
--- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/ProjectInfoPanel.java
+++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/ProjectInfoPanel.java
@@ -3,9 +3,9 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools.input
import java.util.ArrayList;
import java.util.List;
-import org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties.DeployableVREProperties;
+import org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties.RequestedVREProperties;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.resource.StatAlgoImporterResources;
-import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.DeployableVRE;
+import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.RequestedVRE;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.ProjectInfo;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
@@ -56,11 +56,11 @@ public class ProjectInfoPanel extends ContentPanel {
@SuppressWarnings("unused")
private EventBus eventBus;
- private TextField packageName;
- private TextField packageDescription;
- private ListStore storeDeployableVRE;
- private Grid gridDeployableVRE;
- private GridRowEditing gridDeployableVREEditing;
+ private TextField algorithmName;
+ private TextField algorithmDescription;
+ private ListStore storeRequestedVRE;
+ private Grid gridRequestedVRE;
+ private GridRowEditing gridRequestedVREEditing;
private TextButton btnAdd;
private boolean addStatus;
private int seq = 0;
@@ -89,86 +89,87 @@ public class ProjectInfoPanel extends ContentPanel {
private void create(Project project) {
- packageName = new TextField();
- packageName.setAllowBlank(false);
- packageName.addValidator(new RegExValidator("^[a-zA-Z0-9]*$", "Attention only characters a-z,A-Z,0-9 are allowed"));
- packageName.setEmptyText("Enter name...");
- packageName.addChangeHandler(new ChangeHandler() {
-
+ algorithmName = new TextField();
+ algorithmName.setAllowBlank(false);
+ algorithmName.addValidator(new RegExValidator("^[a-zA-Z0-9_]*$",
+ "Attention only characters a-z,A-Z,0-9 are allowed"));
+ algorithmName.setEmptyText("Enter name...");
+ algorithmName.addChangeHandler(new ChangeHandler() {
+
@Override
public void onChange(ChangeEvent event) {
- packageName.validate();
-
+ algorithmName.validate();
+
}
});
-
- FieldLabel packageNameLabel = new FieldLabel(packageName, "Name");
-
- packageDescription = new TextField();
- packageDescription.setAllowBlank(false);
- packageDescription.setEmptyText("Enter description...");
- FieldLabel projectDescriptionLabel = new FieldLabel(packageDescription,
- "Description");
-
- if (project != null && project.getInputData() != null
- && project.getInputData().getProjectInfo() != null) {
- if (project.getInputData().getProjectInfo().getPackageName() != null) {
- packageName.setValue(project.getInputData().getProjectInfo()
- .getPackageName());
- }
- if (project.getInputData().getProjectInfo().getPackageDescription() != null) {
- packageDescription.setValue(project.getInputData()
- .getProjectInfo().getPackageDescription());
- }
+ FieldLabel packageNameLabel = new FieldLabel(algorithmName, "Name");
- }
+ algorithmDescription = new TextField();
+ algorithmDescription.setAllowBlank(false);
+ algorithmDescription.setEmptyText("Enter description...");
+ FieldLabel projectDescriptionLabel = new FieldLabel(
+ algorithmDescription, "Description");
// Grid
- DeployableVREProperties props = GWT
- .create(DeployableVREProperties.class);
+ RequestedVREProperties props = GWT
+ .create(RequestedVREProperties.class);
- ColumnConfig nameColumn = new ColumnConfig(
+ ColumnConfig nameColumn = new ColumnConfig(
props.name(), 100, "Name");
// nameColumn.setMenuDisabled(true);
- ColumnConfig descriptionColumn = new ColumnConfig(
+ ColumnConfig descriptionColumn = new ColumnConfig(
props.description(), 100, "Description");
// descriptionColumn.setMenuDisabled(true);
- ArrayList> l = new ArrayList>();
+ ArrayList> l = new ArrayList>();
l.add(nameColumn);
l.add(descriptionColumn);
- ColumnModel columns = new ColumnModel(l);
+ ColumnModel columns = new ColumnModel(l);
- storeDeployableVRE = new ListStore(props.id());
+ storeRequestedVRE = new ListStore(props.id());
+
+ if (project != null && project.getInputData() != null
+ && project.getInputData().getProjectInfo() != null) {
+
+ if (project.getInputData().getProjectInfo().getAlgorithmName() != null) {
+ algorithmName.setValue(project.getInputData().getProjectInfo()
+ .getAlgorithmName());
+ }
+ if (project.getInputData().getProjectInfo()
+ .getAlgorithmDescription() != null) {
+ algorithmDescription.setValue(project.getInputData()
+ .getProjectInfo().getAlgorithmDescription());
+ }
+
+ if (project.getInputData().getProjectInfo().getListRequestedVRE() != null) {
+ storeRequestedVRE.addAll(project.getInputData()
+ .getProjectInfo().getListRequestedVRE());
+ seq = project.getInputData().getProjectInfo()
+ .getListRequestedVRE().size();
+ }
- if (project != null && project.getInputData() != null && project.getInputData().getProjectInfo()!=null
- && project.getInputData().getProjectInfo().getListDeployableVRE() != null) {
- storeDeployableVRE.addAll(project.getInputData().getProjectInfo()
- .getListDeployableVRE());
- seq = project.getInputData().getProjectInfo()
- .getListDeployableVRE().size();
}
- final GridSelectionModel sm = new GridSelectionModel();
+ final GridSelectionModel sm = new GridSelectionModel();
sm.setSelectionMode(SelectionMode.SINGLE);
- gridDeployableVRE = new Grid(storeDeployableVRE, columns);
- gridDeployableVRE.setSelectionModel(sm);
- gridDeployableVRE.getView().setStripeRows(true);
- gridDeployableVRE.getView().setColumnLines(true);
- gridDeployableVRE.getView().setAutoExpandColumn(nameColumn);
- gridDeployableVRE.getView().setAutoFill(true);
- gridDeployableVRE.setBorders(false);
- gridDeployableVRE.setColumnReordering(false);
+ gridRequestedVRE = new Grid(storeRequestedVRE, columns);
+ gridRequestedVRE.setSelectionModel(sm);
+ gridRequestedVRE.getView().setStripeRows(true);
+ gridRequestedVRE.getView().setColumnLines(true);
+ gridRequestedVRE.getView().setAutoExpandColumn(nameColumn);
+ gridRequestedVRE.getView().setAutoFill(true);
+ gridRequestedVRE.setBorders(false);
+ gridRequestedVRE.setColumnReordering(false);
// EDITING //
- gridDeployableVREEditing = new GridRowEditing(
- gridDeployableVRE);
- gridDeployableVREEditing.addEditor(nameColumn, new TextField());
- gridDeployableVREEditing.addEditor(descriptionColumn, new TextField());
+ gridRequestedVREEditing = new GridRowEditing