1452: Implement a GUI for StatMan Algorithms Importer
Task-Url: https://support.d4science.org/issues/1452 Added Main Code drag and drop git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/statistical-algorithms-importer@122283 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
0e4a66f5a6
commit
7702d2c37d
|
@ -0,0 +1,24 @@
|
|||
package org.gcube.portlets.user.statisticalalgorithmsimporter.client;
|
||||
|
||||
import com.google.gwt.i18n.client.Messages;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public interface CommonMessages extends Messages {
|
||||
|
||||
//
|
||||
@DefaultMessage("Attention")
|
||||
String attention();
|
||||
|
||||
@DefaultMessage("Error")
|
||||
String error();
|
||||
|
||||
@DefaultMessage("No Main Code set!")
|
||||
String attentionNoMainCodeSet();
|
||||
|
||||
|
||||
}
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class NewMainCodeEvent extends
|
||||
GwtEvent<NewMainCodeEvent.NewMainCodeEventHandler> {
|
||||
|
||||
public static Type<NewMainCodeEventHandler> TYPE = new Type<NewMainCodeEventHandler>();
|
||||
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<NewMainCodeEventHandler> getAssociatedType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static Type<NewMainCodeEventHandler> 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 + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -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<NewSelectedRowsVariableEvent.NewSelectedRowsVariableEventHandler> {
|
||||
|
||||
public static Type<NewSelectedRowsVariableEventHandler> TYPE = new Type<NewSelectedRowsVariableEventHandler>();
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.maindata;
|
||||
|
||||
import com.google.gwt.i18n.client.Messages;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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();
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -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<Void>() {
|
||||
if (project != null && project.getMainCode() != null
|
||||
&& project.getMainCode().getItemDescription() != null) {
|
||||
String code = editor.getText();
|
||||
StatAlgoImporterServiceAsync.INSTANCE.saveCode(code,
|
||||
new AsyncCallback<Void>() {
|
||||
|
||||
@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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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<ItemDescription>() {
|
||||
|
||||
@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<Void>() {
|
||||
|
@ -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<Project>() {
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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</a>
|
||||
*
|
||||
*/
|
||||
public interface EnvironmentVariablesProperties extends
|
||||
PropertyAccess<EnvironmentVariables> {
|
||||
public interface GlobalVariablesProperties extends
|
||||
PropertyAccess<GlobalVariables> {
|
||||
|
||||
ModelKeyProvider<EnvironmentVariables> id();
|
||||
ModelKeyProvider<GlobalVariables> id();
|
||||
|
||||
ValueProvider<EnvironmentVariables, String> name();
|
||||
ValueProvider<GlobalVariables, String> name();
|
||||
|
||||
ValueProvider<EnvironmentVariables, String> description();
|
||||
ValueProvider<GlobalVariables, String> description();
|
||||
|
||||
ValueProvider<EnvironmentVariables, DataType> dataType();
|
||||
ValueProvider<GlobalVariables, DataType> dataType();
|
||||
|
||||
ValueProvider<EnvironmentVariables, String> defaultValue();
|
||||
ValueProvider<GlobalVariables, String> defaultValue();
|
||||
}
|
|
@ -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</a>
|
||||
*
|
||||
*/
|
||||
public interface SelectedRowsVariablesProperties extends
|
||||
PropertyAccess<SelectedRowsVariables> {
|
||||
public interface InputOutputVariablesProperties extends
|
||||
PropertyAccess<InputOutputVariables> {
|
||||
|
||||
ModelKeyProvider<SelectedRowsVariables> id();
|
||||
ModelKeyProvider<InputOutputVariables> id();
|
||||
|
||||
ValueProvider<SelectedRowsVariables, String> name();
|
||||
ValueProvider<InputOutputVariables, String> name();
|
||||
|
||||
ValueProvider<SelectedRowsVariables, String> description();
|
||||
ValueProvider<InputOutputVariables, String> description();
|
||||
|
||||
ValueProvider<SelectedRowsVariables, DataType> dataType();
|
||||
ValueProvider<InputOutputVariables, DataType> dataType();
|
||||
|
||||
ValueProvider<SelectedRowsVariables, String> defaultValue();
|
||||
ValueProvider<InputOutputVariables, String> defaultValue();
|
||||
|
||||
ValueProvider<SelectedRowsVariables, IOType> ioType();
|
||||
ValueProvider<InputOutputVariables, IOType> ioType();
|
||||
|
||||
ValueProvider<SelectedRowsVariables, String> sourceSelection();
|
||||
ValueProvider<InputOutputVariables, String> sourceSelection();
|
||||
|
||||
|
||||
}
|
|
@ -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</a>
|
||||
*
|
||||
*/
|
||||
public interface DeployableVREProperties extends PropertyAccess<DeployableVRE> {
|
||||
public interface RequestedVREProperties extends PropertyAccess<RequestedVRE> {
|
||||
|
||||
ModelKeyProvider<DeployableVRE> id();
|
||||
ModelKeyProvider<RequestedVRE> id();
|
||||
|
||||
ValueProvider<DeployableVRE, String> name();
|
||||
ValueProvider<RequestedVRE, String> name();
|
||||
|
||||
ValueProvider<DeployableVRE, String> description();
|
||||
ValueProvider<RequestedVRE, String> description();
|
||||
|
||||
}
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -54,10 +54,14 @@ public interface StatAlgoImporterServiceAsync {
|
|||
AsyncCallback<Project> asyncCallback);
|
||||
|
||||
void saveCode(String code, AsyncCallback<Void> asyncCallback);
|
||||
|
||||
void setNewMainCode(ItemDescription itemDescription, String code, AsyncCallback<ItemDescription> asyncCallback);
|
||||
|
||||
void createSoftware(InputData inputData, AsyncCallback<Void> callback);
|
||||
|
||||
void getUriFromResolver(ItemDescription itemDescription,
|
||||
void getPublicLink(ItemDescription itemDescription,
|
||||
AsyncCallback<String> asyncCallback);
|
||||
|
||||
void restoreUISession(String value, AsyncCallback<Project> asyncCallback);
|
||||
|
||||
}
|
||||
|
|
|
@ -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<String>() {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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</a>
|
||||
*
|
||||
*/
|
||||
public class EnvironmentVariablesPanel extends ContentPanel {
|
||||
public class GlobalVariablesPanel extends ContentPanel {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private EventBus eventBus;
|
||||
private ListStore<EnvironmentVariables> storeEnvironmentVariable;
|
||||
private Grid<EnvironmentVariables> gridEnvironmentVariable;
|
||||
private GridRowEditing<EnvironmentVariables> gridEnvironmentVariableEditing;
|
||||
private ListStore<GlobalVariables> storeGlobalVariable;
|
||||
private Grid<GlobalVariables> gridGlobalVariable;
|
||||
private GridRowEditing<GlobalVariables> 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<EnvironmentVariables, String> nameColumn = new ColumnConfig<EnvironmentVariables, String>(
|
||||
ColumnConfig<GlobalVariables, String> nameColumn = new ColumnConfig<GlobalVariables, String>(
|
||||
props.name(), 100, "Name");
|
||||
// nameColumn.setMenuDisabled(true);
|
||||
|
||||
ColumnConfig<EnvironmentVariables, String> descriptionColumn = new ColumnConfig<EnvironmentVariables, String>(
|
||||
ColumnConfig<GlobalVariables, String> descriptionColumn = new ColumnConfig<GlobalVariables, String>(
|
||||
props.description(), 100, "Description");
|
||||
// descriptionColumn.setMenuDisabled(true);
|
||||
|
||||
ColumnConfig<EnvironmentVariables, DataType> inputTypeColumn = new ColumnConfig<EnvironmentVariables, DataType>(
|
||||
ColumnConfig<GlobalVariables, DataType> inputTypeColumn = new ColumnConfig<GlobalVariables, DataType>(
|
||||
props.dataType(), 100, "Type");
|
||||
// inputTypeColumn.setMenuDisabled(true);
|
||||
inputTypeColumn.setCell(new AbstractCell<DataType>() {
|
||||
|
@ -124,53 +124,53 @@ public class EnvironmentVariablesPanel extends ContentPanel {
|
|||
}
|
||||
});
|
||||
|
||||
ColumnConfig<EnvironmentVariables, String> defaultValueColumn = new ColumnConfig<EnvironmentVariables, String>(
|
||||
ColumnConfig<GlobalVariables, String> defaultValueColumn = new ColumnConfig<GlobalVariables, String>(
|
||||
props.defaultValue(), 100, "Default");
|
||||
// defaColumn.setMenuDisabled(true);
|
||||
|
||||
ArrayList<ColumnConfig<EnvironmentVariables, ?>> l = new ArrayList<ColumnConfig<EnvironmentVariables, ?>>();
|
||||
ArrayList<ColumnConfig<GlobalVariables, ?>> l = new ArrayList<ColumnConfig<GlobalVariables, ?>>();
|
||||
l.add(nameColumn);
|
||||
l.add(descriptionColumn);
|
||||
l.add(inputTypeColumn);
|
||||
l.add(defaultValueColumn);
|
||||
|
||||
ColumnModel<EnvironmentVariables> columns = new ColumnModel<EnvironmentVariables>(l);
|
||||
ColumnModel<GlobalVariables> columns = new ColumnModel<GlobalVariables>(l);
|
||||
|
||||
storeEnvironmentVariable = new ListStore<EnvironmentVariables>(props.id());
|
||||
storeGlobalVariable = new ListStore<GlobalVariables>(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<EnvironmentVariables> sm = new GridSelectionModel<EnvironmentVariables>();
|
||||
final GridSelectionModel<GlobalVariables> sm = new GridSelectionModel<GlobalVariables>();
|
||||
sm.setSelectionMode(SelectionMode.SINGLE);
|
||||
|
||||
gridEnvironmentVariable = new Grid<EnvironmentVariables>(
|
||||
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<GlobalVariables>(
|
||||
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<EnvironmentVariables> ds = new
|
||||
* GridDragSource<EnvironmentVariables>( gridEnvironmentVariable);
|
||||
* GridDragSource<GlobalVariables> ds = new
|
||||
* GridDragSource<GlobalVariables>( gridGlobalVariable);
|
||||
* ds.addDragStartHandler(new DndDragStartHandler() {
|
||||
*
|
||||
* @Override public void onDragStart(DndDragStartEvent event) {
|
||||
*
|
||||
* @SuppressWarnings("unchecked") ArrayList<EnvironmentVariables>
|
||||
* draggingSelection = (ArrayList<EnvironmentVariables>) event
|
||||
* @SuppressWarnings("unchecked") ArrayList<GlobalVariables>
|
||||
* draggingSelection = (ArrayList<GlobalVariables>) event
|
||||
* .getData(); Log.debug("Start Drag: " + draggingSelection);
|
||||
*
|
||||
* } }); GridDropTarget<EnvironmentVariables> dt = new
|
||||
* GridDropTarget<EnvironmentVariables>( gridEnvironmentVariable);
|
||||
* } }); GridDropTarget<GlobalVariables> dt = new
|
||||
* GridDropTarget<GlobalVariables>( 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<EnvironmentVariables>(
|
||||
gridEnvironmentVariable);
|
||||
gridEnvironmentVariableEditing.addEditor(nameColumn, new TextField());
|
||||
gridEnvironmentVariableEditing.addEditor(descriptionColumn,
|
||||
gridGlobalVariableEditing = new GridRowEditing<GlobalVariables>(
|
||||
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<EnvironmentVariables> listSelected=storeEnvironmentVariable.getAll();
|
||||
List<EnvironmentVariables> listNewSelected= new ArrayList<EnvironmentVariables>();
|
||||
List<GlobalVariables> listSelected=storeGlobalVariable.getAll();
|
||||
List<GlobalVariables> listNewSelected= new ArrayList<GlobalVariables>();
|
||||
for(int i=0; i<listSelected.size(); i++){
|
||||
EnvironmentVariables var=listSelected.get(i);
|
||||
GlobalVariables var=listSelected.get(i);
|
||||
var.setId(i);
|
||||
listNewSelected.add(var);
|
||||
}
|
||||
|
||||
storeEnvironmentVariable.clear();
|
||||
storeEnvironmentVariable.addAll(listNewSelected);
|
||||
storeEnvironmentVariable.commitChanges();
|
||||
storeGlobalVariable.clear();
|
||||
storeGlobalVariable.addAll(listNewSelected);
|
||||
storeGlobalVariable.commitChanges();
|
||||
|
||||
seq=listNewSelected.size();
|
||||
Log.debug("Current Seq: "+seq);
|
||||
|
||||
}
|
||||
});
|
||||
ButtonBar buttonBar = gridEnvironmentVariableEditing.getButtonBar();
|
||||
ButtonBar buttonBar = gridGlobalVariableEditing.getButtonBar();
|
||||
buttonBar.add(btnDelete);
|
||||
|
||||
gridEnvironmentVariableEditing
|
||||
.addBeforeStartEditHandler(new BeforeStartEditHandler<EnvironmentVariables>() {
|
||||
gridGlobalVariableEditing
|
||||
.addBeforeStartEditHandler(new BeforeStartEditHandler<GlobalVariables>() {
|
||||
|
||||
@Override
|
||||
public void onBeforeStartEdit(
|
||||
BeforeStartEditEvent<EnvironmentVariables> event) {
|
||||
BeforeStartEditEvent<GlobalVariables> event) {
|
||||
editingBeforeStart(event);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
gridEnvironmentVariableEditing
|
||||
.addCancelEditHandler(new CancelEditHandler<EnvironmentVariables>() {
|
||||
gridGlobalVariableEditing
|
||||
.addCancelEditHandler(new CancelEditHandler<GlobalVariables>() {
|
||||
|
||||
@Override
|
||||
public void onCancelEdit(
|
||||
CancelEditEvent<EnvironmentVariables> event) {
|
||||
storeEnvironmentVariable.rejectChanges();
|
||||
CancelEditEvent<GlobalVariables> event) {
|
||||
storeGlobalVariable.rejectChanges();
|
||||
btnAdd.setEnabled(true);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
gridEnvironmentVariableEditing
|
||||
.addCompleteEditHandler(new CompleteEditHandler<EnvironmentVariables>() {
|
||||
gridGlobalVariableEditing
|
||||
.addCompleteEditHandler(new CompleteEditHandler<GlobalVariables>() {
|
||||
|
||||
@Override
|
||||
public void onCompleteEdit(
|
||||
CompleteEditEvent<EnvironmentVariables> event) {
|
||||
CompleteEditEvent<GlobalVariables> 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<EnvironmentVariables> event) {
|
||||
private void editingBeforeStart(BeforeStartEditEvent<GlobalVariables> 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<EnvironmentVariables> getEnvironmentVariables() {
|
||||
ArrayList<EnvironmentVariables> listEnviromentVarialbles = new ArrayList<>(
|
||||
gridEnvironmentVariable.getStore().getAll());
|
||||
return listEnviromentVarialbles;
|
||||
public ArrayList<GlobalVariables> getGlobalVariables() {
|
||||
ArrayList<GlobalVariables> listGlobalVarialbles = new ArrayList<>(
|
||||
gridGlobalVariable.getStore().getAll());
|
||||
return listGlobalVarialbles;
|
||||
}
|
||||
|
||||
public void setMainCode(Project project) {
|
||||
storeEnvironmentVariable.clear();
|
||||
storeEnvironmentVariable.commitChanges();
|
||||
storeGlobalVariable.clear();
|
||||
storeGlobalVariable.commitChanges();
|
||||
seq = 0;
|
||||
forceLayout();
|
||||
|
|
@ -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</a>
|
||||
*
|
||||
*/
|
||||
public class SelectedRowsPanel extends ContentPanel {
|
||||
public class InputOutputVariablesPanel extends ContentPanel {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private EventBus eventBus;
|
||||
private ListStore<SelectedRowsVariables> storeSelectedRows;
|
||||
private Grid<SelectedRowsVariables> gridSelectedRows;
|
||||
private ListStore<InputOutputVariables> storeInputOutputVariables;
|
||||
private Grid<InputOutputVariables> gridInputOutputVariables;
|
||||
private ListStore<DataType> storeComboDataType;
|
||||
private ComboBox<DataType> comboDataType;
|
||||
private ListStore<IOType> storeComboIOType;
|
||||
private ComboBox<IOType> comboIOType;
|
||||
private GridRowEditing<SelectedRowsVariables> gridSelectedRowsEditing;
|
||||
private GridRowEditing<InputOutputVariables> 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<SelectedRowsVariables, String> nameColumn = new ColumnConfig<SelectedRowsVariables, String>(
|
||||
ColumnConfig<InputOutputVariables, String> nameColumn = new ColumnConfig<InputOutputVariables, String>(
|
||||
props.name(), 100, "Name");
|
||||
// nameColumn.setMenuDisabled(true);
|
||||
|
||||
ColumnConfig<SelectedRowsVariables, String> descriptionColumn = new ColumnConfig<SelectedRowsVariables, String>(
|
||||
ColumnConfig<InputOutputVariables, String> descriptionColumn = new ColumnConfig<InputOutputVariables, String>(
|
||||
props.description(), 100, "Description");
|
||||
// descriptionColumn.setMenuDisabled(true);
|
||||
|
||||
ColumnConfig<SelectedRowsVariables, DataType> dataTypeColumn = new ColumnConfig<SelectedRowsVariables, DataType>(
|
||||
ColumnConfig<InputOutputVariables, DataType> dataTypeColumn = new ColumnConfig<InputOutputVariables, DataType>(
|
||||
props.dataType(), 100, "Type");
|
||||
// inputTypeColumn.setMenuDisabled(true);
|
||||
dataTypeColumn.setCell(new AbstractCell<DataType>() {
|
||||
|
@ -135,11 +135,11 @@ public class SelectedRowsPanel extends ContentPanel {
|
|||
}
|
||||
});
|
||||
|
||||
ColumnConfig<SelectedRowsVariables, String> defaultValueColumn = new ColumnConfig<SelectedRowsVariables, String>(
|
||||
ColumnConfig<InputOutputVariables, String> defaultValueColumn = new ColumnConfig<InputOutputVariables, String>(
|
||||
props.defaultValue(), 100, "Default");
|
||||
// defaColumn.setMenuDisabled(true);
|
||||
|
||||
ColumnConfig<SelectedRowsVariables, IOType> ioTypeColumn = new ColumnConfig<SelectedRowsVariables, IOType>(
|
||||
ColumnConfig<InputOutputVariables, IOType> ioTypeColumn = new ColumnConfig<InputOutputVariables, IOType>(
|
||||
props.ioType(), 100, "I/O");
|
||||
// inputTypeColumn.setMenuDisabled(true);
|
||||
ioTypeColumn.setCell(new AbstractCell<IOType>() {
|
||||
|
@ -153,58 +153,58 @@ public class SelectedRowsPanel extends ContentPanel {
|
|||
}
|
||||
});
|
||||
|
||||
ArrayList<ColumnConfig<SelectedRowsVariables, ?>> l = new ArrayList<ColumnConfig<SelectedRowsVariables, ?>>();
|
||||
ArrayList<ColumnConfig<InputOutputVariables, ?>> l = new ArrayList<ColumnConfig<InputOutputVariables, ?>>();
|
||||
l.add(nameColumn);
|
||||
l.add(descriptionColumn);
|
||||
l.add(dataTypeColumn);
|
||||
l.add(defaultValueColumn);
|
||||
l.add(ioTypeColumn);
|
||||
|
||||
ColumnModel<SelectedRowsVariables> columns = new ColumnModel<SelectedRowsVariables>(
|
||||
ColumnModel<InputOutputVariables> columns = new ColumnModel<InputOutputVariables>(
|
||||
l);
|
||||
|
||||
storeSelectedRows = new ListStore<SelectedRowsVariables>(props.id());
|
||||
storeInputOutputVariables = new ListStore<InputOutputVariables>(props.id());
|
||||
|
||||
/*
|
||||
* ArrayList<SelectedRowsVariables> list = new ArrayList<>(); for (int i
|
||||
* = 0; i < 10; i++) { list.add(new SelectedRowsVariables(i, "Test" + i,
|
||||
* ArrayList<InputOutputVariablesVariables> 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<SelectedRowsVariables> sm = new GridSelectionModel<SelectedRowsVariables>();
|
||||
final GridSelectionModel<InputOutputVariables> sm = new GridSelectionModel<InputOutputVariables>();
|
||||
sm.setSelectionMode(SelectionMode.SINGLE);
|
||||
|
||||
gridSelectedRows = new Grid<SelectedRowsVariables>(storeSelectedRows,
|
||||
gridInputOutputVariables = new Grid<InputOutputVariables>(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<SelectedRowsVariables> ds = new
|
||||
* GridDragSource<SelectedRowsVariables>( gridEnvironmentVariable);
|
||||
* GridDragSource<InputOutputVariablesVariables> ds = new
|
||||
* GridDragSource<InputOutputVariablesVariables>( gridEnvironmentVariable);
|
||||
* ds.addDragStartHandler(new DndDragStartHandler() {
|
||||
*
|
||||
* @Override public void onDragStart(DndDragStartEvent event) {
|
||||
*
|
||||
* @SuppressWarnings("unchecked") ArrayList<SelectedRowsVariables>
|
||||
* draggingSelection = (ArrayList<SelectedRowsVariables>) event
|
||||
* @SuppressWarnings("unchecked") ArrayList<InputOutputVariablesVariables>
|
||||
* draggingSelection = (ArrayList<InputOutputVariablesVariables>) event
|
||||
* .getData(); Log.debug("Start Drag: " + draggingSelection);
|
||||
*
|
||||
* } }); GridDropTarget<SelectedRowsVariables> dt = new
|
||||
* GridDropTarget<SelectedRowsVariables>( gridEnvironmentVariable);
|
||||
* } }); GridDropTarget<InputOutputVariablesVariables> dt = new
|
||||
* GridDropTarget<InputOutputVariablesVariables>( gridEnvironmentVariable);
|
||||
* dt.setFeedback(Feedback.BOTH); dt.setAllowSelfAsSource(true);
|
||||
*/
|
||||
|
||||
|
@ -249,24 +249,24 @@ public class SelectedRowsPanel extends ContentPanel {
|
|||
|
||||
//
|
||||
|
||||
gridSelectedRowsEditing = new GridRowEditing<SelectedRowsVariables>(
|
||||
gridSelectedRows);
|
||||
gridSelectedRowsEditing.addEditor(nameColumn, new TextField());
|
||||
gridSelectedRowsEditing.addEditor(descriptionColumn, new TextField());
|
||||
gridSelectedRowsEditing.addEditor(dataTypeColumn, comboDataType);
|
||||
gridSelectedRowsEditing.addEditor(defaultValueColumn, new TextField());
|
||||
gridInputOutputVariablesEditing = new GridRowEditing<InputOutputVariables>(
|
||||
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<SelectedRowsVariables> listSelected=storeSelectedRows.getAll();
|
||||
List<SelectedRowsVariables> listNewSelected= new ArrayList<SelectedRowsVariables>();
|
||||
for(int i=0; i<listSelected.size(); i++){
|
||||
SelectedRowsVariables var=listSelected.get(i);
|
||||
List<InputOutputVariables> listIOVariables=storeInputOutputVariables.getAll();
|
||||
List<InputOutputVariables> listNewIOVariables= new ArrayList<InputOutputVariables>();
|
||||
for(int i=0; i<listIOVariables.size(); i++){
|
||||
InputOutputVariables var=listIOVariables.get(i);
|
||||
var.setId(i);
|
||||
listNewSelected.add(var);
|
||||
listNewIOVariables.add(var);
|
||||
}
|
||||
|
||||
storeSelectedRows.clear();
|
||||
storeSelectedRows.addAll(listNewSelected);
|
||||
storeSelectedRows.commitChanges();
|
||||
storeInputOutputVariables.clear();
|
||||
storeInputOutputVariables.addAll(listNewIOVariables);
|
||||
storeInputOutputVariables.commitChanges();
|
||||
|
||||
seq=listNewSelected.size();
|
||||
seq=listNewIOVariables.size();
|
||||
Log.debug("Current Seq: "+seq);
|
||||
|
||||
}
|
||||
});
|
||||
ButtonBar buttonBar = gridSelectedRowsEditing.getButtonBar();
|
||||
ButtonBar buttonBar = gridInputOutputVariablesEditing.getButtonBar();
|
||||
buttonBar.add(btnDelete);
|
||||
|
||||
gridSelectedRowsEditing
|
||||
.addBeforeStartEditHandler(new BeforeStartEditHandler<SelectedRowsVariables>() {
|
||||
gridInputOutputVariablesEditing
|
||||
.addBeforeStartEditHandler(new BeforeStartEditHandler<InputOutputVariables>() {
|
||||
|
||||
@Override
|
||||
public void onBeforeStartEdit(
|
||||
BeforeStartEditEvent<SelectedRowsVariables> event) {
|
||||
BeforeStartEditEvent<InputOutputVariables> event) {
|
||||
editingBeforeStart(event);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
gridSelectedRowsEditing
|
||||
.addCancelEditHandler(new CancelEditHandler<SelectedRowsVariables>() {
|
||||
gridInputOutputVariablesEditing
|
||||
.addCancelEditHandler(new CancelEditHandler<InputOutputVariables>() {
|
||||
|
||||
@Override
|
||||
public void onCancelEdit(
|
||||
CancelEditEvent<SelectedRowsVariables> event) {
|
||||
storeSelectedRows.rejectChanges();
|
||||
CancelEditEvent<InputOutputVariables> event) {
|
||||
storeInputOutputVariables.rejectChanges();
|
||||
btnAdd.setEnabled(true);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
gridSelectedRowsEditing
|
||||
.addCompleteEditHandler(new CompleteEditHandler<SelectedRowsVariables>() {
|
||||
gridInputOutputVariablesEditing
|
||||
.addCompleteEditHandler(new CompleteEditHandler<InputOutputVariables>() {
|
||||
|
||||
@Override
|
||||
public void onCompleteEdit(
|
||||
CompleteEditEvent<SelectedRowsVariables> event) {
|
||||
CompleteEditEvent<InputOutputVariables> 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<SelectedRowsVariables> event) {
|
||||
BeforeStartEditEvent<InputOutputVariables> 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<SelectedRowsVariables> getSelectedRows() {
|
||||
ArrayList<SelectedRowsVariables> listEnviromentVarialbles = new ArrayList<>(
|
||||
gridSelectedRows.getStore().getAll());
|
||||
return listEnviromentVarialbles;
|
||||
public ArrayList<InputOutputVariables> getInputOutputVariables() {
|
||||
ArrayList<InputOutputVariables> listInputOutputVarialbles = new ArrayList<>(
|
||||
gridInputOutputVariables.getStore().getAll());
|
||||
return listInputOutputVarialbles;
|
||||
}
|
||||
|
||||
public void setMainCode(Project project) {
|
||||
storeSelectedRows.clear();
|
||||
storeSelectedRows.commitChanges();
|
||||
storeInputOutputVariables.clear();
|
||||
storeInputOutputVariables.commitChanges();
|
||||
seq = 0;
|
||||
forceLayout();
|
||||
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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<InterpreterPackageInfo> sm = new GridSelectionModel<InterpreterPackageInfo>();
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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<DeployableVRE> storeDeployableVRE;
|
||||
private Grid<DeployableVRE> gridDeployableVRE;
|
||||
private GridRowEditing<DeployableVRE> gridDeployableVREEditing;
|
||||
private TextField algorithmName;
|
||||
private TextField algorithmDescription;
|
||||
private ListStore<RequestedVRE> storeRequestedVRE;
|
||||
private Grid<RequestedVRE> gridRequestedVRE;
|
||||
private GridRowEditing<RequestedVRE> 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<DeployableVRE, String> nameColumn = new ColumnConfig<DeployableVRE, String>(
|
||||
ColumnConfig<RequestedVRE, String> nameColumn = new ColumnConfig<RequestedVRE, String>(
|
||||
props.name(), 100, "Name");
|
||||
// nameColumn.setMenuDisabled(true);
|
||||
|
||||
ColumnConfig<DeployableVRE, String> descriptionColumn = new ColumnConfig<DeployableVRE, String>(
|
||||
ColumnConfig<RequestedVRE, String> descriptionColumn = new ColumnConfig<RequestedVRE, String>(
|
||||
props.description(), 100, "Description");
|
||||
// descriptionColumn.setMenuDisabled(true);
|
||||
|
||||
ArrayList<ColumnConfig<DeployableVRE, ?>> l = new ArrayList<ColumnConfig<DeployableVRE, ?>>();
|
||||
ArrayList<ColumnConfig<RequestedVRE, ?>> l = new ArrayList<ColumnConfig<RequestedVRE, ?>>();
|
||||
l.add(nameColumn);
|
||||
l.add(descriptionColumn);
|
||||
|
||||
ColumnModel<DeployableVRE> columns = new ColumnModel<DeployableVRE>(l);
|
||||
ColumnModel<RequestedVRE> columns = new ColumnModel<RequestedVRE>(l);
|
||||
|
||||
storeDeployableVRE = new ListStore<DeployableVRE>(props.id());
|
||||
storeRequestedVRE = new ListStore<RequestedVRE>(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<DeployableVRE> sm = new GridSelectionModel<DeployableVRE>();
|
||||
final GridSelectionModel<RequestedVRE> sm = new GridSelectionModel<RequestedVRE>();
|
||||
sm.setSelectionMode(SelectionMode.SINGLE);
|
||||
|
||||
gridDeployableVRE = new Grid<DeployableVRE>(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<RequestedVRE>(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<DeployableVRE>(
|
||||
gridDeployableVRE);
|
||||
gridDeployableVREEditing.addEditor(nameColumn, new TextField());
|
||||
gridDeployableVREEditing.addEditor(descriptionColumn, new TextField());
|
||||
gridRequestedVREEditing = new GridRowEditing<RequestedVRE>(
|
||||
gridRequestedVRE);
|
||||
gridRequestedVREEditing.addEditor(nameColumn, new TextField());
|
||||
gridRequestedVREEditing.addEditor(descriptionColumn, new TextField());
|
||||
|
||||
btnAdd = new TextButton("Add");
|
||||
btnAdd.setIcon(StatAlgoImporterResources.INSTANCE.add16());
|
||||
|
@ -179,7 +180,7 @@ public class ProjectInfoPanel extends ContentPanel {
|
|||
|
||||
@Override
|
||||
public void onSelect(SelectEvent event) {
|
||||
addDeployableVRE(event);
|
||||
addRequestedVRE(event);
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -187,77 +188,77 @@ public class ProjectInfoPanel extends ContentPanel {
|
|||
TextButton btnDelete = new TextButton("Delete");
|
||||
btnDelete.addSelectHandler(new SelectEvent.SelectHandler() {
|
||||
public void onSelect(SelectEvent event) {
|
||||
GridCell cell = gridDeployableVREEditing.getActiveCell();
|
||||
GridCell cell = gridRequestedVREEditing.getActiveCell();
|
||||
int rowIndex = cell.getRow();
|
||||
|
||||
gridDeployableVREEditing.cancelEditing();
|
||||
gridRequestedVREEditing.cancelEditing();
|
||||
|
||||
storeDeployableVRE.remove(rowIndex);
|
||||
storeDeployableVRE.commitChanges();
|
||||
storeRequestedVRE.remove(rowIndex);
|
||||
storeRequestedVRE.commitChanges();
|
||||
|
||||
gridDeployableVREEditing.getCancelButton().setVisible(true);
|
||||
gridRequestedVREEditing.getCancelButton().setVisible(true);
|
||||
btnAdd.setEnabled(true);
|
||||
if (addStatus) {
|
||||
addStatus = false;
|
||||
}
|
||||
|
||||
List<DeployableVRE> listSelected = storeDeployableVRE.getAll();
|
||||
List<DeployableVRE> listNewSelected = new ArrayList<DeployableVRE>();
|
||||
List<RequestedVRE> listSelected = storeRequestedVRE.getAll();
|
||||
List<RequestedVRE> listNewSelected = new ArrayList<RequestedVRE>();
|
||||
for (int i = 0; i < listSelected.size(); i++) {
|
||||
DeployableVRE var = listSelected.get(i);
|
||||
RequestedVRE var = listSelected.get(i);
|
||||
var.setId(i);
|
||||
listNewSelected.add(var);
|
||||
}
|
||||
|
||||
storeDeployableVRE.clear();
|
||||
storeDeployableVRE.addAll(listNewSelected);
|
||||
storeDeployableVRE.commitChanges();
|
||||
storeRequestedVRE.clear();
|
||||
storeRequestedVRE.addAll(listNewSelected);
|
||||
storeRequestedVRE.commitChanges();
|
||||
|
||||
seq = listNewSelected.size();
|
||||
Log.debug("Current Seq: " + seq);
|
||||
|
||||
}
|
||||
});
|
||||
ButtonBar buttonBar = gridDeployableVREEditing.getButtonBar();
|
||||
ButtonBar buttonBar = gridRequestedVREEditing.getButtonBar();
|
||||
buttonBar.add(btnDelete);
|
||||
|
||||
gridDeployableVREEditing
|
||||
.addBeforeStartEditHandler(new BeforeStartEditHandler<DeployableVRE>() {
|
||||
gridRequestedVREEditing
|
||||
.addBeforeStartEditHandler(new BeforeStartEditHandler<RequestedVRE>() {
|
||||
|
||||
@Override
|
||||
public void onBeforeStartEdit(
|
||||
BeforeStartEditEvent<DeployableVRE> event) {
|
||||
BeforeStartEditEvent<RequestedVRE> event) {
|
||||
editingBeforeStart(event);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
gridDeployableVREEditing
|
||||
.addCancelEditHandler(new CancelEditHandler<DeployableVRE>() {
|
||||
gridRequestedVREEditing
|
||||
.addCancelEditHandler(new CancelEditHandler<RequestedVRE>() {
|
||||
|
||||
@Override
|
||||
public void onCancelEdit(
|
||||
CancelEditEvent<DeployableVRE> event) {
|
||||
storeDeployableVRE.rejectChanges();
|
||||
CancelEditEvent<RequestedVRE> event) {
|
||||
storeRequestedVRE.rejectChanges();
|
||||
btnAdd.setEnabled(true);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
gridDeployableVREEditing
|
||||
.addCompleteEditHandler(new CompleteEditHandler<DeployableVRE>() {
|
||||
gridRequestedVREEditing
|
||||
.addCompleteEditHandler(new CompleteEditHandler<RequestedVRE>() {
|
||||
|
||||
@Override
|
||||
public void onCompleteEdit(
|
||||
CompleteEditEvent<DeployableVRE> event) {
|
||||
CompleteEditEvent<RequestedVRE> event) {
|
||||
try {
|
||||
if (addStatus) {
|
||||
addStatus = false;
|
||||
}
|
||||
storeDeployableVRE.commitChanges();
|
||||
storeRequestedVRE.commitChanges();
|
||||
|
||||
gridDeployableVREEditing.getCancelButton()
|
||||
gridRequestedVREEditing.getCancelButton()
|
||||
.setVisible(true);
|
||||
btnAdd.setEnabled(true);
|
||||
|
||||
|
@ -269,7 +270,7 @@ public class ProjectInfoPanel extends ContentPanel {
|
|||
});
|
||||
|
||||
// /
|
||||
FieldLabel deployableVRELabel = new FieldLabel(null, "Deployable VRE");
|
||||
FieldLabel requestedVRELabel = new FieldLabel(null, "Requested VREs");
|
||||
|
||||
ToolBar toolBar = new ToolBar();
|
||||
toolBar.add(btnAdd, new BoxLayoutData(new Margins(0)));
|
||||
|
@ -281,9 +282,10 @@ public class ProjectInfoPanel extends ContentPanel {
|
|||
vlc.add(packageNameLabel, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
vlc.add(projectDescriptionLabel, new VerticalLayoutData(1, -1,
|
||||
new Margins(0)));
|
||||
vlc.add(deployableVRELabel, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
vlc.add(requestedVRELabel, new VerticalLayoutData(1, -1,
|
||||
new Margins(0)));
|
||||
vlc.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
vlc.add(gridDeployableVRE, new VerticalLayoutData(1, 1, new Margins(0)));
|
||||
vlc.add(gridRequestedVRE, new VerticalLayoutData(1, 1, new Margins(0)));
|
||||
|
||||
add(vlc, new MarginData(new Margins(0)));
|
||||
}
|
||||
|
@ -293,72 +295,73 @@ public class ProjectInfoPanel extends ContentPanel {
|
|||
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().getAlgorithmName() != null) {
|
||||
algorithmName.setValue(project.getInputData().getProjectInfo()
|
||||
.getAlgorithmName());
|
||||
} else {
|
||||
packageName.clear();
|
||||
algorithmName.clear();
|
||||
}
|
||||
if (project.getInputData().getProjectInfo().getPackageDescription() != null) {
|
||||
packageDescription.setValue(project.getInputData()
|
||||
.getProjectInfo().getPackageDescription());
|
||||
if (project.getInputData().getProjectInfo()
|
||||
.getAlgorithmDescription() != null) {
|
||||
algorithmDescription.setValue(project.getInputData()
|
||||
.getProjectInfo().getAlgorithmDescription());
|
||||
} else {
|
||||
packageDescription.clear();
|
||||
algorithmDescription.clear();
|
||||
}
|
||||
|
||||
if (project.getInputData().getProjectInfo().getListDeployableVRE() != null) {
|
||||
storeDeployableVRE.clear();
|
||||
storeDeployableVRE.addAll(project.getInputData()
|
||||
.getProjectInfo().getListDeployableVRE());
|
||||
storeDeployableVRE.commitChanges();
|
||||
if (project.getInputData().getProjectInfo().getListRequestedVRE() != null) {
|
||||
storeRequestedVRE.clear();
|
||||
storeRequestedVRE.addAll(project.getInputData()
|
||||
.getProjectInfo().getListRequestedVRE());
|
||||
storeRequestedVRE.commitChanges();
|
||||
seq = project.getInputData().getProjectInfo()
|
||||
.getListDeployableVRE().size();
|
||||
.getListRequestedVRE().size();
|
||||
|
||||
} else {
|
||||
storeDeployableVRE.clear();
|
||||
storeDeployableVRE.commitChanges();
|
||||
storeRequestedVRE.clear();
|
||||
storeRequestedVRE.commitChanges();
|
||||
seq = 0;
|
||||
}
|
||||
|
||||
} else {
|
||||
packageName.clear();
|
||||
packageDescription.clear();
|
||||
storeDeployableVRE.clear();
|
||||
storeDeployableVRE.commitChanges();
|
||||
algorithmName.clear();
|
||||
algorithmDescription.clear();
|
||||
storeRequestedVRE.clear();
|
||||
storeRequestedVRE.commitChanges();
|
||||
seq = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void editingBeforeStart(BeforeStartEditEvent<DeployableVRE> event) {
|
||||
private void editingBeforeStart(BeforeStartEditEvent<RequestedVRE> event) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
private void addDeployableVRE(SelectEvent event) {
|
||||
private void addRequestedVRE(SelectEvent event) {
|
||||
try {
|
||||
seq++;
|
||||
DeployableVRE newEnvironmentVariable = new DeployableVRE(seq, "",
|
||||
RequestedVRE newRequestedVRE = new RequestedVRE(seq, "",
|
||||
"");
|
||||
Log.debug("New DeployableVRE: " + newEnvironmentVariable);
|
||||
gridDeployableVREEditing.cancelEditing();
|
||||
Log.debug("New RequestedVRE: " + newRequestedVRE);
|
||||
gridRequestedVREEditing.cancelEditing();
|
||||
addStatus = true;
|
||||
gridDeployableVREEditing.getCancelButton().setVisible(false);
|
||||
storeDeployableVRE.add(newEnvironmentVariable);
|
||||
int row = storeDeployableVRE.indexOf(newEnvironmentVariable);
|
||||
gridRequestedVREEditing.getCancelButton().setVisible(false);
|
||||
storeRequestedVRE.add(newRequestedVRE);
|
||||
int row = storeRequestedVRE.indexOf(newRequestedVRE);
|
||||
|
||||
gridDeployableVREEditing.startEditing(new GridCell(row, 0));
|
||||
gridRequestedVREEditing.startEditing(new GridCell(row, 0));
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public ProjectInfo getProjectInfo() {
|
||||
String name = packageName.getCurrentValue();
|
||||
String description = packageDescription.getCurrentValue();
|
||||
ArrayList<DeployableVRE> listDeployableVRE = new ArrayList<>(
|
||||
gridDeployableVRE.getStore().getAll());
|
||||
return new ProjectInfo(name, description, listDeployableVRE);
|
||||
String name = algorithmName.getCurrentValue();
|
||||
String description = algorithmDescription.getCurrentValue();
|
||||
ArrayList<RequestedVRE> listRequestedVRE = new ArrayList<>(
|
||||
gridRequestedVRE.getStore().getAll());
|
||||
return new ProjectInfo(name, description, listRequestedVRE);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,8 @@ import org.gcube.portlets.user.statisticalalgorithmsimporter.client.rpc.StatAlgo
|
|||
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.file.CodeReader;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.generator.ProjectBuilder;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.storage.FilesStorage;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.storage.MainCodeSave;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.storage.ProjectArchiver;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.uriresolver.UriResolverSMIClient;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.code.CodeData;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterServiceException;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.file.FileUploadMonitor;
|
||||
|
@ -78,6 +78,27 @@ public class StatAlgoImporterServiceImpl extends RemoteServiceServlet implements
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Project restoreUISession(String value)
|
||||
throws StatAlgoImporterServiceException {
|
||||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
SessionUtil.getAslSession(session);
|
||||
logger.debug("restoreUISession(): "+value);
|
||||
Project project = SessionUtil.getProjectSession(session);
|
||||
return project;
|
||||
} catch (StatAlgoImporterServiceException e) {
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
} catch (Throwable e) {
|
||||
logger.error("getCode(): " + e.getLocalizedMessage(), e);
|
||||
e.printStackTrace();
|
||||
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -354,6 +375,39 @@ public class StatAlgoImporterServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemDescription setNewMainCode(ItemDescription fileDescription, String code)
|
||||
throws StatAlgoImporterServiceException {
|
||||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||
logger.debug("saveCode(): itemDescription" + fileDescription+", code:"+code);
|
||||
Project project = SessionUtil.getProjectSession(session);
|
||||
if (project != null && project.getProjectFolder()!=null&&project.getProjectFolder().getItemDescription()!=null) {
|
||||
MainCodeSave mainCodeSave=new MainCodeSave();
|
||||
ItemDescription mainCodeItemDescription=mainCodeSave.save(aslSession, fileDescription, code,project);
|
||||
MainCode mainCode=new MainCode(mainCodeItemDescription);
|
||||
project.setMainCode(mainCode);
|
||||
SessionUtil.setProjectSession(session, project);
|
||||
return mainCodeItemDescription;
|
||||
} else {
|
||||
throw new StatAlgoImporterServiceException("No project open!");
|
||||
}
|
||||
|
||||
|
||||
} catch (StatAlgoImporterServiceException e) {
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
} catch (Throwable e) {
|
||||
logger.error("saveCode(): " + e.getLocalizedMessage(), e);
|
||||
e.printStackTrace();
|
||||
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void createSoftware(InputData inputData) throws StatAlgoImporterServiceException {
|
||||
|
@ -384,24 +438,29 @@ public class StatAlgoImporterServiceImpl extends RemoteServiceServlet implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getUriFromResolver(ItemDescription itemDescription)
|
||||
public String getPublicLink(ItemDescription itemDescription)
|
||||
throws StatAlgoImporterServiceException {
|
||||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||
logger.debug("GetUriFromResolver(): "+itemDescription);
|
||||
UriResolverSMIClient resolver=new UriResolverSMIClient();
|
||||
String link=resolver.resolve(itemDescription, aslSession);
|
||||
logger.debug("GetPublicLink(): "+itemDescription);
|
||||
FilesStorage filesStorage=new FilesStorage();
|
||||
String link=filesStorage.getPublicLink(aslSession.getUsername(),itemDescription.getId());
|
||||
|
||||
return link;
|
||||
} catch (StatAlgoImporterServiceException e) {
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
} catch (Throwable e) {
|
||||
logger.error("getUriFromResolver(): " + e.getLocalizedMessage(), e);
|
||||
logger.error("getPublicLink(): " + e.getLocalizedMessage(), e);
|
||||
e.printStackTrace();
|
||||
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -10,9 +10,9 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterServiceException;
|
||||
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.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.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -45,7 +45,7 @@ public class AlgorithmGenerator {
|
|||
|
||||
try {
|
||||
Path tempFile = Files.createTempFile(project.getInputData()
|
||||
.getProjectInfo().getPackageName(), EXTENTION_JAVA);
|
||||
.getProjectInfo().getAlgorithmNameToClassName(), EXTENTION_JAVA);
|
||||
|
||||
List<String> lines = createJavaCode();
|
||||
Files.write(tempFile, lines, Charset.defaultCharset(),
|
||||
|
@ -80,7 +80,7 @@ public class AlgorithmGenerator {
|
|||
"import org.gcube.dataanalysis.executor.rscripts.generic.GenericRScript;",
|
||||
"", "public class "
|
||||
+ project.getInputData().getProjectInfo()
|
||||
.getPackageName()
|
||||
.getAlgorithmNameToClassName()
|
||||
+ " extends GenericRScript {", "",
|
||||
|
||||
" public static enum operators {",
|
||||
|
@ -88,20 +88,20 @@ public class AlgorithmGenerator {
|
|||
" };", "", " @Override",
|
||||
" public String getDescription() {", " return \""
|
||||
+ project.getInputData().getProjectInfo()
|
||||
.getPackageDescription() + "\";", " }", "",
|
||||
.getAlgorithmDescription() + "\";", " }", "",
|
||||
" protected void initVariables(){",
|
||||
" mainScriptName=\"" + mainScriptRelativePath + "\";",
|
||||
" packageURL=\"" + packageUrl + "\";",
|
||||
" environmentalvariables = new ArrayList<String>();"));
|
||||
|
||||
for (EnvironmentVariables envVariable : project.getInputData()
|
||||
.getListEnvironmentVariables()) {
|
||||
for (GlobalVariables envVariable : project.getInputData()
|
||||
.getListGlobalVariables()) {
|
||||
code.add(" environmentalvariables.add(\"" + envVariable.getName()
|
||||
+ "\");");
|
||||
}
|
||||
|
||||
for (SelectedRowsVariables selVariable : project.getInputData()
|
||||
.getListSelectedRows()) {
|
||||
for (InputOutputVariables selVariable : project.getInputData()
|
||||
.getListInputOutputVariables()) {
|
||||
switch (selVariable.getIoType()) {
|
||||
case INPUT:
|
||||
code.add(" inputvariables.add(\"" + selVariable.getName()
|
||||
|
@ -137,8 +137,8 @@ public class AlgorithmGenerator {
|
|||
|
||||
private void createInputParameters(ArrayList<String> code) {
|
||||
|
||||
for (SelectedRowsVariables selVariable : project.getInputData()
|
||||
.getListSelectedRows()) {
|
||||
for (InputOutputVariables selVariable : project.getInputData()
|
||||
.getListInputOutputVariables()) {
|
||||
if (selVariable.getIoType().compareTo(IOType.INPUT) == 0) {
|
||||
switch (selVariable.getDataType()) {
|
||||
case BOOLEAN:
|
||||
|
@ -208,8 +208,8 @@ public class AlgorithmGenerator {
|
|||
*/
|
||||
|
||||
private void createOutputParameters(ArrayList<String> code) {
|
||||
for (SelectedRowsVariables selVariable : project.getInputData()
|
||||
.getListSelectedRows()) {
|
||||
for (InputOutputVariables selVariable : project.getInputData()
|
||||
.getListInputOutputVariables()) {
|
||||
if (selVariable.getIoType().compareTo(IOType.OUTPUT) == 0) {
|
||||
switch (selVariable.getDataType()) {
|
||||
case BOOLEAN:
|
||||
|
|
|
@ -9,7 +9,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterServiceException;
|
||||
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.InterpreterPackageInfo;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -22,7 +22,8 @@ import org.slf4j.LoggerFactory;
|
|||
*
|
||||
*/
|
||||
public class InfoGenerator {
|
||||
private static final String EXTENTION_TXT = ".txt";
|
||||
private static final String INFO_NAME = "Info";
|
||||
private static final String INFO_EXTENTION = ".txt";
|
||||
public static final Logger logger = LoggerFactory
|
||||
.getLogger(InfoGenerator.class);
|
||||
|
||||
|
@ -38,13 +39,12 @@ public class InfoGenerator {
|
|||
return "IntegrationInfoGenerator [project=" + project + "]";
|
||||
}
|
||||
|
||||
public Path createIntegrationInfo() throws StatAlgoImporterServiceException {
|
||||
public Path createInfo() throws StatAlgoImporterServiceException {
|
||||
|
||||
try {
|
||||
Path tempFile = Files.createTempFile(project.getInputData()
|
||||
.getProjectInfo().getPackageName(), EXTENTION_TXT);
|
||||
Path tempFile = Files.createTempFile(INFO_NAME, INFO_EXTENTION);
|
||||
|
||||
List<String> lines = createInfo();
|
||||
List<String> lines = createInfoData();
|
||||
Files.write(tempFile, lines, Charset.defaultCharset(),
|
||||
StandardOpenOption.WRITE);
|
||||
logger.debug(tempFile.toString());
|
||||
|
@ -59,35 +59,39 @@ public class InfoGenerator {
|
|||
|
||||
}
|
||||
|
||||
private List<String> createInfo() {
|
||||
private List<String> createInfoData() {
|
||||
ArrayList<String> infos = new ArrayList<String>();
|
||||
if (project.getInputData() != null) {
|
||||
if (project.getInputData().getProjectInfo() != null) {
|
||||
if (project.getInputData().getProjectInfo().getPackageName() != null) {
|
||||
infos.add("Package Name: "
|
||||
if (project.getInputData().getProjectInfo().getAlgorithmName() != null) {
|
||||
infos.add("Algorithm Name: "
|
||||
+ project.getInputData().getProjectInfo()
|
||||
.getPackageName());
|
||||
.getAlgorithmNameToUpper());
|
||||
infos.add("Class Name: org.gcube.dataanalysis.executor.rscripts."+ project.getInputData().getProjectInfo()
|
||||
.getAlgorithmNameToUpper());
|
||||
|
||||
} else {
|
||||
infos.add("Package Name: ");
|
||||
infos.add("Algorithm Name: ");
|
||||
infos.add("Class Name: ");
|
||||
}
|
||||
infos.add("");
|
||||
if (project.getInputData().getProjectInfo().getPackageDescription() != null) {
|
||||
infos.add("Package Description: "
|
||||
if (project.getInputData().getProjectInfo().getAlgorithmDescription() != null) {
|
||||
infos.add("Algorithm Description: "
|
||||
+ project.getInputData().getProjectInfo()
|
||||
.getPackageDescription());
|
||||
.getAlgorithmDescription());
|
||||
} else {
|
||||
infos.add("Package Description: ");
|
||||
infos.add("Algorithm Description: ");
|
||||
}
|
||||
infos.add("");
|
||||
|
||||
if (project.getInputData().getProjectInfo()
|
||||
.getListDeployableVRE() != null
|
||||
.getListRequestedVRE() != null
|
||||
&& project.getInputData().getProjectInfo()
|
||||
.getListDeployableVRE().size() > 0) {
|
||||
.getListRequestedVRE().size() > 0) {
|
||||
infos.add("Deployable VRE:");
|
||||
for (DeployableVRE deployableVRE : project.getInputData()
|
||||
.getProjectInfo().getListDeployableVRE()) {
|
||||
infos.add("" + deployableVRE.getName() + ", " + deployableVRE.getDescription());
|
||||
for (RequestedVRE deployableVRE : project.getInputData()
|
||||
.getProjectInfo().getListRequestedVRE()) {
|
||||
infos.add("" + deployableVRE.getName() + " " + deployableVRE.getDescription());
|
||||
}
|
||||
infos.add("");
|
||||
}
|
||||
|
|
|
@ -94,9 +94,9 @@ public class ProjectBuilder {
|
|||
"Attention No Project Information Set!");
|
||||
}
|
||||
|
||||
if (project.getInputData().getProjectInfo().getPackageName() == null) {
|
||||
if (project.getInputData().getProjectInfo().getAlgorithmName() == null) {
|
||||
throw new StatAlgoImporterServiceException(
|
||||
"Attention No Project Class Name Set!");
|
||||
"Attention No Algorithm Name Set!");
|
||||
}
|
||||
|
||||
if (project.getMainCode() == null) {
|
||||
|
@ -133,7 +133,7 @@ public class ProjectBuilder {
|
|||
algorithmItem = filesStorage.createItemOnWorkspace(aslSession
|
||||
.getUsername(), Files.newInputStream(algorithmJava,
|
||||
StandardOpenOption.READ), project.getInputData()
|
||||
.getProjectInfo().getPackageName()
|
||||
.getProjectInfo().getAlgorithmNameToClassName()
|
||||
+ ALGORITHM_EXTENTION, ALGORITHM_DESCRIPTION,
|
||||
ALGORITHM_MIMETYPE, project.getProjectTarget()
|
||||
.getTargetFolder().getId());
|
||||
|
@ -207,7 +207,7 @@ public class ProjectBuilder {
|
|||
try {
|
||||
projectPackageItem = filesStorage.createItemOnWorkspace(
|
||||
aslSession.getUsername(), inputStream, project
|
||||
.getInputData().getProjectInfo().getPackageName()
|
||||
.getInputData().getProjectInfo().getAlgorithmNameToClassName()
|
||||
+ PROJECT_PACKAGE_EXTENTION,
|
||||
PROJECT_PACKAGE_DESCRIPTION, PROJECT_PACKAGE_MIMETYPE,
|
||||
targetFolder.getId());
|
||||
|
@ -242,7 +242,7 @@ public class ProjectBuilder {
|
|||
throws StatAlgoImporterServiceException {
|
||||
InfoGenerator integrationInfoGenerator = new InfoGenerator(
|
||||
project);
|
||||
infoTXT = integrationInfoGenerator.createIntegrationInfo();
|
||||
infoTXT = integrationInfoGenerator.createInfo();
|
||||
|
||||
FilesStorage filesStorage = new FilesStorage();
|
||||
WorkspaceItem infoItem;
|
||||
|
@ -297,7 +297,7 @@ public class ProjectBuilder {
|
|||
storage.downloadInputFile(ECOLOGICAL_ENGINE_SMART_EXECUTOR_JAR_URL,
|
||||
ecologicalEngineSmartExecutorJar);
|
||||
Path algorithmTempFile = new File(tempDirectory.toFile(), project
|
||||
.getInputData().getProjectInfo().getPackageName()
|
||||
.getInputData().getProjectInfo().getAlgorithmNameToClassName()
|
||||
+ ALGORITHM_EXTENTION).toPath();
|
||||
Files.copy(algorithmJava, algorithmTempFile);
|
||||
Path infoTempFile = new File(tempDirectory.toFile(),
|
||||
|
@ -322,7 +322,7 @@ public class ProjectBuilder {
|
|||
}
|
||||
|
||||
private void copyJarOnWorkspace(Path tempDirectory) throws StatAlgoImporterServiceException {
|
||||
Path codeJar=Paths.get(tempDirectory.toString(),project.getInputData().getProjectInfo().getPackageName()
|
||||
Path codeJar=Paths.get(tempDirectory.toString(),project.getInputData().getProjectInfo().getAlgorithmNameToClassName()
|
||||
+ JAR_EXTENTION);
|
||||
|
||||
FilesStorage filesStorage = new FilesStorage();
|
||||
|
@ -331,7 +331,7 @@ public class ProjectBuilder {
|
|||
try {
|
||||
codeJarItem = filesStorage.createItemOnWorkspace(aslSession
|
||||
.getUsername(), Files.newInputStream(codeJar,
|
||||
StandardOpenOption.READ), project.getInputData().getProjectInfo().getPackageName()
|
||||
StandardOpenOption.READ), project.getInputData().getProjectInfo().getAlgorithmNameToClassName()
|
||||
+ JAR_EXTENTION, CODE_JAR_DESCRIPTION,
|
||||
CODE_JAR_MIMETYPE, project.getProjectTarget()
|
||||
.getTargetFolder().getId());
|
||||
|
@ -369,7 +369,7 @@ public class ProjectBuilder {
|
|||
|
||||
ProcessBuilder pb = new ProcessBuilder("javac", "-cp",
|
||||
tempDirectory.toAbsolutePath().toString() + "/*", project
|
||||
.getInputData().getProjectInfo().getPackageName()
|
||||
.getInputData().getProjectInfo().getAlgorithmNameToClassName()
|
||||
+ ALGORITHM_EXTENTION);
|
||||
pb.directory(tempDirectory.toFile());
|
||||
Path logTXT = new File(tempDirectory.toFile(), LOG_TXT).toPath();
|
||||
|
@ -398,7 +398,7 @@ public class ProjectBuilder {
|
|||
List<String> commands = new ArrayList<>();
|
||||
commands.add("jar");
|
||||
commands.add("-cvf");
|
||||
commands.add(project.getInputData().getProjectInfo().getPackageName()
|
||||
commands.add(project.getInputData().getProjectInfo().getAlgorithmNameToClassName()
|
||||
+ JAR_EXTENTION);
|
||||
|
||||
DirectoryStream<Path> directoryStream = Files
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
package org.gcube.portlets.user.statisticalalgorithmsimporter.server.social;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.framework.core.session.ASLSession;
|
||||
import org.gcube.applicationsupportlayer.social.ApplicationNotificationsManager;
|
||||
import org.gcube.applicationsupportlayer.social.NotificationsManager;
|
||||
import org.gcube.common.homelibrary.util.WorkspaceUtil;
|
||||
import org.gcube.portal.databook.shared.NotificationType;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.Constants;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* TDMNotification notification sharing TR, templates or rules
|
||||
*
|
||||
* @author giancarlo email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class AlgorithmNotification extends Thread {
|
||||
private static Logger logger = LoggerFactory
|
||||
.getLogger(AlgorithmNotification.class);
|
||||
private ASLSession aslSession;
|
||||
private NotificationType notificationType;
|
||||
private Project project;
|
||||
|
||||
public AlgorithmNotification(ASLSession aslSession, Project project) {
|
||||
this.aslSession = aslSession;
|
||||
this.project = project;
|
||||
//this.notificationType = NotificationType.SAI_ALGORITHM_PUBLICATION;
|
||||
|
||||
}
|
||||
|
||||
public void run() {
|
||||
algorithmPublicationNotify();
|
||||
|
||||
}
|
||||
|
||||
private void algorithmPublicationNotify() {
|
||||
NotificationsManager nm = new ApplicationNotificationsManager(
|
||||
aslSession, Constants.APPLICATION_ID);
|
||||
/*
|
||||
List<String> members = Arrays.asList("gianpaolo.coro",
|
||||
"giancarlo.panichi", "roberto.cirillo");
|
||||
for (String member : members) {
|
||||
try {
|
||||
nm.notifyAlgorithmPublicationRequest(
|
||||
member,
|
||||
project.getInputData().getProjectInfo()
|
||||
.getAlgorithmName(),
|
||||
new String(
|
||||
Constants.STATISTICAL_ALGORITHMS_IMPORTER_JAR_PUBLIC_LINK
|
||||
+ "="
|
||||
+ project.getProjectTarget()
|
||||
.getCodeJar().getPublicLink()));
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Error in the notification(Type: "
|
||||
+ notificationType
|
||||
+ " - "
|
||||
+ aslSession.getUsername()
|
||||
+ " ="
|
||||
+ "Algorithm [AlgorithmName="
|
||||
+ project.getInputData().getProjectInfo()
|
||||
.getAlgorithmName()
|
||||
+ ", JarPublicLink="
|
||||
+ project.getProjectTarget().getCodeJar()
|
||||
.getPublicLink() + "] to " + member + "): "
|
||||
+ e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -22,6 +22,7 @@ import org.gcube.common.homelibrary.home.workspace.exceptions.ItemNotFoundExcept
|
|||
import org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException;
|
||||
import org.gcube.common.homelibrary.home.workspace.exceptions.WrongDestinationException;
|
||||
import org.gcube.common.homelibrary.home.workspace.exceptions.WrongItemTypeException;
|
||||
import org.gcube.common.homelibrary.home.workspace.folder.FolderItem;
|
||||
import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalFile;
|
||||
import org.gcube.common.homelibrary.util.zip.ZipUtil;
|
||||
import org.gcube.contentmanager.storageclient.model.protocol.smp.SMPUrl;
|
||||
|
@ -46,6 +47,52 @@ public class FilesStorage {
|
|||
public static final Logger logger = LoggerFactory
|
||||
.getLogger(FilesStorage.class);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param user
|
||||
* User
|
||||
* @param itemId
|
||||
* Item id
|
||||
* @return Public link
|
||||
* @throws StatAlgoImporterServiceException
|
||||
*/
|
||||
public String getPublicLink(String user, String itemId)
|
||||
throws StatAlgoImporterServiceException {
|
||||
Workspace ws;
|
||||
try {
|
||||
ws = HomeLibrary.getUserWorkspace(user);
|
||||
|
||||
WorkspaceItem workSpaceItem = ws.getItem(itemId);
|
||||
if (workSpaceItem.isFolder()) {
|
||||
throw new StatAlgoImporterServiceException(
|
||||
"Attention this is a folder!");
|
||||
}
|
||||
|
||||
if (workSpaceItem instanceof FolderItem) {
|
||||
return workSpaceItem.getPublicLink(true);
|
||||
} else {
|
||||
throw new StatAlgoImporterServiceException(
|
||||
"Attention no public link for this item!");
|
||||
}
|
||||
|
||||
} catch (WorkspaceFolderNotFoundException | InternalErrorException
|
||||
| HomeNotFoundException | ItemNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param user
|
||||
* User
|
||||
* @param itemId
|
||||
* Item id
|
||||
* @param folderId
|
||||
* Folder id
|
||||
* @throws StatAlgoImporterServiceException
|
||||
*/
|
||||
public void copyItemOnFolder(String user, String itemId, String folderId)
|
||||
throws StatAlgoImporterServiceException {
|
||||
Workspace ws;
|
||||
|
@ -71,6 +118,14 @@ public class FilesStorage {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param user
|
||||
* User
|
||||
* @param itemId
|
||||
* Item id
|
||||
* @throws StatAlgoImporterServiceException
|
||||
*/
|
||||
public void deleteItemOnFolder(String user, String itemId)
|
||||
throws StatAlgoImporterServiceException {
|
||||
Workspace ws;
|
||||
|
@ -90,6 +145,14 @@ public class FilesStorage {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param user
|
||||
* User
|
||||
* @param folderId
|
||||
* Foler id
|
||||
* @throws StatAlgoImporterServiceException
|
||||
*/
|
||||
public void deleteTargetFolder(String user, String folderId)
|
||||
throws StatAlgoImporterServiceException {
|
||||
Workspace ws;
|
||||
|
@ -120,6 +183,15 @@ public class FilesStorage {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param user
|
||||
* User
|
||||
* @param folderId
|
||||
* Destination folder id
|
||||
* @return Folder
|
||||
* @throws StatAlgoImporterServiceException
|
||||
*/
|
||||
public WorkspaceFolder createTargetFolder(String user, String folderId)
|
||||
throws StatAlgoImporterServiceException {
|
||||
Workspace ws;
|
||||
|
@ -147,6 +219,16 @@ public class FilesStorage {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param user
|
||||
* user
|
||||
* @param inputStream
|
||||
* input stream
|
||||
* @param folderId
|
||||
* destination folder
|
||||
* @throws StatAlgoImporterServiceException
|
||||
*/
|
||||
public void saveStatisticalAlgorithmProject(String user,
|
||||
InputStream inputStream, String folderId)
|
||||
throws StatAlgoImporterServiceException {
|
||||
|
@ -183,6 +265,22 @@ public class FilesStorage {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param user
|
||||
* user
|
||||
* @param inputStream
|
||||
* input stream
|
||||
* @param name
|
||||
* item name
|
||||
* @param description
|
||||
* item description
|
||||
* @param mimeType
|
||||
* item mimetype
|
||||
* @param folderId
|
||||
* destination folder
|
||||
* @throws StatAlgoImporterServiceException
|
||||
*/
|
||||
public void saveItemOnWorkspace(String user, InputStream inputStream,
|
||||
String name, String description, String mimeType, String folderId)
|
||||
throws StatAlgoImporterServiceException {
|
||||
|
@ -216,6 +314,23 @@ public class FilesStorage {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param user
|
||||
* User
|
||||
* @param inputStream
|
||||
* Input stream
|
||||
* @param name
|
||||
* Item name
|
||||
* @param description
|
||||
* Item description
|
||||
* @param mimeType
|
||||
* Item mimetype
|
||||
* @param folderId
|
||||
* Destination folder
|
||||
* @return Workspace item
|
||||
* @throws StatAlgoImporterServiceException
|
||||
*/
|
||||
public WorkspaceItem createItemOnWorkspace(String user,
|
||||
InputStream inputStream, String name, String description,
|
||||
String mimeType, String folderId)
|
||||
|
@ -246,6 +361,12 @@ public class FilesStorage {
|
|||
|
||||
/**
|
||||
*
|
||||
* @param user
|
||||
* User
|
||||
* @param folderId
|
||||
* Folder id
|
||||
* @return Input stream
|
||||
* @throws StatAlgoImporterServiceException
|
||||
*/
|
||||
public InputStream retrieveProjectItemOnWorkspace(String user,
|
||||
String folderId) throws StatAlgoImporterServiceException {
|
||||
|
@ -279,6 +400,12 @@ public class FilesStorage {
|
|||
|
||||
/**
|
||||
*
|
||||
* @param user
|
||||
* User
|
||||
* @param itemId
|
||||
* Item id
|
||||
* @return Input stream
|
||||
* @throws StatAlgoImporterServiceException
|
||||
*/
|
||||
public InputStream retrieveItemOnWorkspace(String user, String itemId)
|
||||
throws StatAlgoImporterServiceException {
|
||||
|
@ -307,7 +434,7 @@ public class FilesStorage {
|
|||
* User
|
||||
* @param remotePath
|
||||
* File path on storage
|
||||
* @return InputStream back to read the file
|
||||
* @return Input stream back to read the file
|
||||
* @throws StatAlgoImporterServiceException
|
||||
*/
|
||||
public InputStream retrieveImputStream(String user, WorkspaceItem wi)
|
||||
|
|
|
@ -0,0 +1,106 @@
|
|||
package org.gcube.portlets.user.statisticalalgorithmsimporter.server.storage;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
|
||||
import org.gcube.application.framework.core.session.ASLSession;
|
||||
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
|
||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterServiceException;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.workspace.ItemDescription;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class MainCodeSave {
|
||||
private static final String ALGORITHM_DESCRIPTION = "Algorithm";
|
||||
private static final String ALGORITHM_MIMETYPE = "text/plain";
|
||||
|
||||
public static final Logger logger = LoggerFactory
|
||||
.getLogger(MainCodeSave.class);
|
||||
|
||||
public MainCodeSave() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param aslSession
|
||||
* @param file description of destination file
|
||||
* @param code code to insert in the file
|
||||
* @param project
|
||||
* @return
|
||||
* @throws StatAlgoImporterServiceException
|
||||
*/
|
||||
public ItemDescription save(ASLSession aslSession, ItemDescription file,
|
||||
String code, Project project)
|
||||
throws StatAlgoImporterServiceException {
|
||||
Path tempFile = createTempFile(file, code);
|
||||
ItemDescription mainCode = saveInWorkspace(tempFile, aslSession, file,
|
||||
project);
|
||||
return mainCode;
|
||||
}
|
||||
|
||||
private Path createTempFile(ItemDescription file, String code)
|
||||
throws StatAlgoImporterServiceException {
|
||||
try {
|
||||
Path tempFile = Files.createTempFile(file.getName(), "");
|
||||
|
||||
Files.write(tempFile, code.getBytes(), StandardOpenOption.WRITE);
|
||||
logger.debug(tempFile.toString());
|
||||
|
||||
return tempFile;
|
||||
|
||||
} catch (IOException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new StatAlgoImporterServiceException(e.getLocalizedMessage(),
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
private ItemDescription saveInWorkspace(Path tempFile,
|
||||
ASLSession aslSession, ItemDescription file, Project project)
|
||||
throws StatAlgoImporterServiceException {
|
||||
FilesStorage filesStorage = new FilesStorage();
|
||||
WorkspaceItem mainCodeItem;
|
||||
|
||||
try {
|
||||
mainCodeItem = filesStorage.createItemOnWorkspace(
|
||||
aslSession.getUsername(),
|
||||
Files.newInputStream(tempFile, StandardOpenOption.READ),
|
||||
file.getName(), ALGORITHM_DESCRIPTION, ALGORITHM_MIMETYPE,
|
||||
project.getProjectFolder().getItemDescription().getId());
|
||||
} catch (IOException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new StatAlgoImporterServiceException(e.getLocalizedMessage(),
|
||||
e);
|
||||
}
|
||||
|
||||
ItemDescription mainCode;
|
||||
try {
|
||||
mainCode = new ItemDescription(mainCodeItem.getId(),
|
||||
mainCodeItem.getName(), mainCodeItem.getOwner()
|
||||
.getPortalLogin(), mainCodeItem.getPath(),
|
||||
mainCodeItem.getType().name());
|
||||
} catch (InternalErrorException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
|
||||
|
||||
}
|
||||
|
||||
return mainCode;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -9,15 +9,16 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.shared;
|
|||
public class Constants {
|
||||
|
||||
public static final String APPLICATION_ID = "org.gcube.portlets.user.statisticalalgorithmsimporter.server.portlet.StatAlgoImporterPortlet";
|
||||
public static final String STATRUNNER_ID = "StatRunnerId";
|
||||
public static final String STATRUNNER_LANG_COOKIE = "StatRunnerLangCookie";
|
||||
public static final String STATRUNNER_LANG = "StatRunnerLang";
|
||||
public static final String STATISTICAL_ALGORITHMS_IMPORTER_ID = "SAIId";
|
||||
public static final String STATISTICAL_ALGORITHMS_IMPORTER_COOKIE = "SAILangCookie";
|
||||
public static final String STATISTICAL_ALGORITHMS_IMPORTER_LANG = "SAILang";
|
||||
public final static String DEFAULT_USER = "giancarlo.panichi";
|
||||
//public final static String DEFAULT_SCOPE = "/gcube/devNext";
|
||||
public final static String DEFAULT_SCOPE = "/gcube/devsec/devVRE";
|
||||
public static final String FILE_UPLOADED_FIELD = "FileUploadedField";
|
||||
public static final String STATISTICAL_ALGORITHMS_IMPORTER_JAR_PUBLIC_LINK = "JarPublicLink";
|
||||
|
||||
|
||||
|
||||
|
||||
public static final String FILE_UPLOADED_FIELD = "fileUploadedField";
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import java.io.Serializable;
|
|||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class EnvironmentVariables implements Serializable {
|
||||
public class GlobalVariables implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -2519686355634242523L;
|
||||
private int id;
|
||||
|
@ -17,7 +17,7 @@ public class EnvironmentVariables implements Serializable {
|
|||
private String defaultValue;
|
||||
private DataType dataType;
|
||||
|
||||
public EnvironmentVariables() {
|
||||
public GlobalVariables() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ public class EnvironmentVariables implements Serializable {
|
|||
* @param defaultValue
|
||||
* @param dataType
|
||||
*/
|
||||
public EnvironmentVariables(int id, String name, String description,
|
||||
public GlobalVariables(int id, String name, String description,
|
||||
String defaultValue, DataType dataType) {
|
||||
super();
|
||||
this.id = id;
|
||||
|
@ -81,10 +81,12 @@ public class EnvironmentVariables implements Serializable {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EnvironmentVariables [id=" + id + ", name=" + name
|
||||
return "GlobalVariables [id=" + id + ", name=" + name
|
||||
+ ", description=" + description + ", defaultValue="
|
||||
+ defaultValue + ", dataType=" + dataType + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -8,7 +8,7 @@ import java.io.Serializable;
|
|||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class SelectedRowsVariables implements Serializable {
|
||||
public class InputOutputVariables implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -2519686355634242523L;
|
||||
private int id;
|
||||
|
@ -19,11 +19,11 @@ public class SelectedRowsVariables implements Serializable {
|
|||
private IOType ioType;
|
||||
private String sourceSelection;
|
||||
|
||||
public SelectedRowsVariables() {
|
||||
public InputOutputVariables() {
|
||||
super();
|
||||
}
|
||||
|
||||
public SelectedRowsVariables(String name, String description,
|
||||
public InputOutputVariables(String name, String description,
|
||||
String defaultValue, DataType dataType, IOType ioType,
|
||||
String sourceSelection){
|
||||
super();
|
||||
|
@ -36,7 +36,7 @@ public class SelectedRowsVariables implements Serializable {
|
|||
}
|
||||
|
||||
|
||||
public SelectedRowsVariables(int id, String name, String description,
|
||||
public InputOutputVariables(int id, String name, String description,
|
||||
String defaultValue, DataType dataType, IOType ioType,
|
||||
String sourceSelection) {
|
||||
super();
|
||||
|
@ -107,7 +107,7 @@ public class SelectedRowsVariables implements Serializable {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SelectedRowsVariables [id=" + id + ", name=" + name
|
||||
return "InputOutputVariables [id=" + id + ", name=" + name
|
||||
+ ", description=" + description + ", defaultValue="
|
||||
+ defaultValue + ", dataType=" + dataType + ", ioType="
|
||||
+ ioType + ", sourceSelection=" + sourceSelection + "]";
|
||||
|
@ -115,4 +115,5 @@ public class SelectedRowsVariables implements Serializable {
|
|||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -12,51 +12,61 @@ import java.util.ArrayList;
|
|||
public class ProjectInfo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 7304965177776383842L;
|
||||
private String packageName;
|
||||
private String packageDescription;
|
||||
private ArrayList<DeployableVRE> listDeployableVRE;
|
||||
private String algorithmName;
|
||||
private String algorithmDescription;
|
||||
private ArrayList<RequestedVRE> listRequestedVRE;
|
||||
|
||||
public ProjectInfo() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ProjectInfo(String packageName, String pacakgeDescription,
|
||||
ArrayList<DeployableVRE> listDeployableVRE) {
|
||||
public ProjectInfo(String algorithmName, String algorithmDescription,
|
||||
ArrayList<RequestedVRE> listRequestedVRE) {
|
||||
super();
|
||||
this.packageName = packageName;
|
||||
this.packageDescription = pacakgeDescription;
|
||||
this.listDeployableVRE = listDeployableVRE;
|
||||
this.algorithmName = algorithmName;
|
||||
this.algorithmDescription = algorithmDescription;
|
||||
this.listRequestedVRE = listRequestedVRE;
|
||||
}
|
||||
|
||||
public String getPackageName() {
|
||||
return packageName;
|
||||
public String getAlgorithmName() {
|
||||
return algorithmName;
|
||||
}
|
||||
|
||||
public void setPackageName(String packageName) {
|
||||
this.packageName = packageName;
|
||||
public String getAlgorithmNameToUpper() {
|
||||
return algorithmName.toUpperCase();
|
||||
}
|
||||
|
||||
public String getPackageDescription() {
|
||||
return packageDescription;
|
||||
public String getAlgorithmNameToClassName() {
|
||||
return algorithmName.replaceAll("_", "");
|
||||
}
|
||||
|
||||
public void setPackageDescription(String packageDescription) {
|
||||
this.packageDescription = packageDescription;
|
||||
public void setAlgorithmName(String algorithmName) {
|
||||
this.algorithmName = algorithmName;
|
||||
}
|
||||
|
||||
public ArrayList<DeployableVRE> getListDeployableVRE() {
|
||||
return listDeployableVRE;
|
||||
public String getAlgorithmDescription() {
|
||||
return algorithmDescription;
|
||||
}
|
||||
|
||||
public void setListDeployableVRE(ArrayList<DeployableVRE> listDeployableVRE) {
|
||||
this.listDeployableVRE = listDeployableVRE;
|
||||
public void setAlgorithmDescription(String algorithmDescription) {
|
||||
this.algorithmDescription = algorithmDescription;
|
||||
}
|
||||
|
||||
public ArrayList<RequestedVRE> getListRequestedVRE() {
|
||||
return listRequestedVRE;
|
||||
}
|
||||
|
||||
public void setListRequestedVRE(ArrayList<RequestedVRE> listRequestedVRE) {
|
||||
this.listRequestedVRE = listRequestedVRE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ProjectInfo [packageName=" + packageName
|
||||
+ ", packageDescription=" + packageDescription
|
||||
+ ", listDeployableVRE=" + listDeployableVRE + "]";
|
||||
return "ProjectInfo [algorithmName=" + algorithmName
|
||||
+ ", algorithmDescription=" + algorithmDescription
|
||||
+ ", listRequestedVRE=" + listRequestedVRE + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -8,18 +8,18 @@ import java.io.Serializable;
|
|||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class DeployableVRE implements Serializable {
|
||||
public class RequestedVRE implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -7548059008384829524L;
|
||||
private int id;
|
||||
private String name;
|
||||
private String description;
|
||||
|
||||
public DeployableVRE() {
|
||||
public RequestedVRE() {
|
||||
super();
|
||||
}
|
||||
|
||||
public DeployableVRE(int id, String name, String description) {
|
||||
public RequestedVRE(int id, String name, String description) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
|
@ -52,10 +52,11 @@ public class DeployableVRE implements Serializable {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DeployableVRE [id=" + id + ", name=" + name + ", description="
|
||||
return "RequestedVRE [id=" + id + ", name=" + name + ", description="
|
||||
+ description + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -3,10 +3,10 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project;
|
|||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
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.InterpreterInfo;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.ProjectInfo;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.SelectedRowsVariables;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InputOutputVariables;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -19,40 +19,29 @@ public class InputData implements Serializable {
|
|||
private static final long serialVersionUID = -2405068429998054485L;
|
||||
private ProjectInfo projectInfo;
|
||||
private InterpreterInfo interpreterInfo;
|
||||
private ArrayList<EnvironmentVariables> listEnvironmentVariables;
|
||||
private ArrayList<SelectedRowsVariables> listSelectedRows;
|
||||
|
||||
|
||||
private ArrayList<GlobalVariables> listGlobalVariables;
|
||||
private ArrayList<InputOutputVariables> listInputOutputVariables;
|
||||
|
||||
public InputData() {
|
||||
super();
|
||||
}
|
||||
|
||||
public InputData(ArrayList<EnvironmentVariables> listEnvironmentVariables,
|
||||
ArrayList<SelectedRowsVariables> listSelectedRows,
|
||||
InterpreterInfo interpreterInfo, ProjectInfo projectInfo) {
|
||||
public InputData(ProjectInfo projectInfo, InterpreterInfo interpreterInfo,
|
||||
ArrayList<GlobalVariables> listGlobalVariables,
|
||||
ArrayList<InputOutputVariables> listInputOutputVariables) {
|
||||
super();
|
||||
this.listEnvironmentVariables = listEnvironmentVariables;
|
||||
this.listSelectedRows = listSelectedRows;
|
||||
this.interpreterInfo = interpreterInfo;
|
||||
this.projectInfo = projectInfo;
|
||||
this.interpreterInfo = interpreterInfo;
|
||||
this.listGlobalVariables = listGlobalVariables;
|
||||
this.listInputOutputVariables = listInputOutputVariables;
|
||||
}
|
||||
|
||||
public ArrayList<EnvironmentVariables> getListEnvironmentVariables() {
|
||||
return listEnvironmentVariables;
|
||||
public ProjectInfo getProjectInfo() {
|
||||
return projectInfo;
|
||||
}
|
||||
|
||||
public void setListEnvironmentVariables(
|
||||
ArrayList<EnvironmentVariables> listEnvironmentVariables) {
|
||||
this.listEnvironmentVariables = listEnvironmentVariables;
|
||||
}
|
||||
|
||||
public ArrayList<SelectedRowsVariables> getListSelectedRows() {
|
||||
return listSelectedRows;
|
||||
}
|
||||
|
||||
public void setListSelectedRows(
|
||||
ArrayList<SelectedRowsVariables> listSelectedRows) {
|
||||
this.listSelectedRows = listSelectedRows;
|
||||
public void setProjectInfo(ProjectInfo projectInfo) {
|
||||
this.projectInfo = projectInfo;
|
||||
}
|
||||
|
||||
public InterpreterInfo getInterpreterInfo() {
|
||||
|
@ -62,23 +51,31 @@ public class InputData implements Serializable {
|
|||
public void setInterpreterInfo(InterpreterInfo interpreterInfo) {
|
||||
this.interpreterInfo = interpreterInfo;
|
||||
}
|
||||
|
||||
public ProjectInfo getProjectInfo() {
|
||||
return projectInfo;
|
||||
|
||||
public ArrayList<GlobalVariables> getListGlobalVariables() {
|
||||
return listGlobalVariables;
|
||||
}
|
||||
|
||||
public void setProjectInfo(ProjectInfo projectInfo) {
|
||||
this.projectInfo = projectInfo;
|
||||
public void setListGlobalVariables(
|
||||
ArrayList<GlobalVariables> listGlobalVariables) {
|
||||
this.listGlobalVariables = listGlobalVariables;
|
||||
}
|
||||
|
||||
public ArrayList<InputOutputVariables> getListInputOutputVariables() {
|
||||
return listInputOutputVariables;
|
||||
}
|
||||
|
||||
public void setListInputOutputVariables(
|
||||
ArrayList<InputOutputVariables> listInputOutputVariables) {
|
||||
this.listInputOutputVariables = listInputOutputVariables;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "InputData [projectInfo=" + projectInfo + ", interpreterInfo="
|
||||
+ interpreterInfo + ", listEnvironmentVariables="
|
||||
+ listEnvironmentVariables + ", listSelectedRows="
|
||||
+ listSelectedRows + "]";
|
||||
+ interpreterInfo + ", listGlobalVariables="
|
||||
+ listGlobalVariables + ", listInputOutputVariables="
|
||||
+ listInputOutputVariables + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue