1452: Implement a GUI for StatMan Algorithms Importer
Task-Url: https://support.d4science.org/issues/1452 Added open project git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/statistical-algorithms-importer@121825 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
88bf092513
commit
ca6e5ffd61
|
@ -94,7 +94,7 @@ public class StatAlgoImporter implements EntryPoint {
|
||||||
|
|
||||||
// Right
|
// Right
|
||||||
ToolsPanel toolsPanel = new ToolsPanel(eventBus);
|
ToolsPanel toolsPanel = new ToolsPanel(eventBus);
|
||||||
BorderLayoutData eastData = new BorderLayoutData(400);
|
BorderLayoutData eastData = new BorderLayoutData(500);
|
||||||
eastData.setCollapsible(true);
|
eastData.setCollapsible(true);
|
||||||
eastData.setSplit(false);
|
eastData.setSplit(false);
|
||||||
eastData.setFloatable(false);
|
eastData.setFloatable(false);
|
||||||
|
|
|
@ -200,16 +200,15 @@ public class StatAlgoImporterController {
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
eventBus.addHandler(InputSaveReadyEvent.TYPE,
|
eventBus.addHandler(InputSaveReadyEvent.TYPE,
|
||||||
new InputSaveReadyEvent.InputSaveReadyEventHandler() {
|
new InputSaveReadyEvent.InputSaveReadyEventHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInputSaveReady(InputSaveReadyEvent event) {
|
public void onInputSaveReady(InputSaveReadyEvent event) {
|
||||||
Log.debug("Catch InputSaveReadyEvent");
|
Log.debug("Catch InputSaveReadyEvent");
|
||||||
doInputSaveReadyCommand(event);
|
doInputSaveReadyCommand(event);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -217,8 +216,6 @@ public class StatAlgoImporterController {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void doMenuCommand(StatAlgoImporterRibbonEvent event) {
|
private void doMenuCommand(StatAlgoImporterRibbonEvent event) {
|
||||||
StatAlgoImporterRibbonType eventType = event.getStatRunnerRibbonType();
|
StatAlgoImporterRibbonType eventType = event.getStatRunnerRibbonType();
|
||||||
if (eventType == null) {
|
if (eventType == null) {
|
||||||
|
@ -231,6 +228,7 @@ public class StatAlgoImporterController {
|
||||||
showCreateProjectDialog();
|
showCreateProjectDialog();
|
||||||
break;
|
break;
|
||||||
case PROJECT_OPEN:
|
case PROJECT_OPEN:
|
||||||
|
showOpenProjectDialog();
|
||||||
break;
|
break;
|
||||||
case PROJECT_SAVE:
|
case PROJECT_SAVE:
|
||||||
projectSaveRequest();
|
projectSaveRequest();
|
||||||
|
@ -247,25 +245,29 @@ public class StatAlgoImporterController {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void doInputSaveReadyCommand(InputSaveReadyEvent event) {
|
protected void doInputSaveReadyCommand(InputSaveReadyEvent event) {
|
||||||
pm.saveProject(event.getInputVariables());
|
pm.saveProject(event.getInputData());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void projectSaveRequest() {
|
private void projectSaveRequest() {
|
||||||
InputSaveEvent inputSaveEvent=new InputSaveEvent();
|
InputSaveEvent inputSaveEvent = new InputSaveEvent();
|
||||||
eventBus.fireEvent(inputSaveEvent);
|
eventBus.fireEvent(inputSaveEvent);
|
||||||
Log.debug("ProjectSaveRequest: "+inputSaveEvent);
|
Log.debug("ProjectSaveRequest: " + inputSaveEvent);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showCreateProjectDialog() {
|
private void showCreateProjectDialog() {
|
||||||
pm.createProject();
|
pm.createProject();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void showOpenProjectDialog() {
|
||||||
|
pm.openProject();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void showAddResourceDialog() {
|
private void showAddResourceDialog() {
|
||||||
pm.addResource();
|
pm.addResource();
|
||||||
}
|
}
|
||||||
|
@ -277,13 +279,13 @@ public class StatAlgoImporterController {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doDeleteItemCommand(DeleteItemEvent event) {
|
private void doDeleteItemCommand(DeleteItemEvent event) {
|
||||||
ItemDescription itemDescription = event.getItemDescription();
|
ItemDescription itemDescription = event.getItemDescription();
|
||||||
if (itemDescription != null && itemDescription.getId() != null) {
|
if (itemDescription != null && itemDescription.getId() != null) {
|
||||||
pm.deleteItem(itemDescription);
|
pm.deleteItem(itemDescription);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.event;
|
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.event;
|
||||||
|
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.InputVariables;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.InputData;
|
||||||
|
|
||||||
import com.google.gwt.event.shared.EventHandler;
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
import com.google.gwt.event.shared.GwtEvent;
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
@ -19,7 +19,7 @@ public class InputSaveReadyEvent extends
|
||||||
GwtEvent<InputSaveReadyEvent.InputSaveReadyEventHandler> {
|
GwtEvent<InputSaveReadyEvent.InputSaveReadyEventHandler> {
|
||||||
|
|
||||||
public static Type<InputSaveReadyEventHandler> TYPE = new Type<InputSaveReadyEventHandler>();
|
public static Type<InputSaveReadyEventHandler> TYPE = new Type<InputSaveReadyEventHandler>();
|
||||||
private InputVariables inputVariables;
|
private InputData inputData;
|
||||||
|
|
||||||
public interface InputSaveReadyEventHandler extends EventHandler {
|
public interface InputSaveReadyEventHandler extends EventHandler {
|
||||||
void onInputSaveReady(InputSaveReadyEvent event);
|
void onInputSaveReady(InputSaveReadyEvent event);
|
||||||
|
@ -30,8 +30,8 @@ public class InputSaveReadyEvent extends
|
||||||
InputSaveReadyEventHandler handler);
|
InputSaveReadyEventHandler handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
public InputSaveReadyEvent(InputVariables inputVariables) {
|
public InputSaveReadyEvent(InputData inputData) {
|
||||||
this.inputVariables = inputVariables;
|
this.inputData = inputData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -53,13 +53,14 @@ public class InputSaveReadyEvent extends
|
||||||
source.fireEvent(inputSaveReadyEvent);
|
source.fireEvent(inputSaveReadyEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public InputVariables getInputVariables() {
|
public InputData getInputData() {
|
||||||
return inputVariables;
|
return inputData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "InputSaveReadyEvent [inputVariables=" + inputVariables + "]";
|
return "InputSaveReadyEvent [inputData=" + inputData + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.event;
|
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.event;
|
||||||
|
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.type.ProjectStatusEventType;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.type.ProjectStatusEventType;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.workspace.ItemDescription;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
||||||
|
|
||||||
import com.google.gwt.event.shared.EventHandler;
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
import com.google.gwt.event.shared.GwtEvent;
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
@ -21,7 +21,7 @@ public class ProjectStatusEvent extends
|
||||||
|
|
||||||
public static Type<ProjectStatusEventHandler> TYPE = new Type<ProjectStatusEventHandler>();
|
public static Type<ProjectStatusEventHandler> TYPE = new Type<ProjectStatusEventHandler>();
|
||||||
private ProjectStatusEventType projectStatusEventType;
|
private ProjectStatusEventType projectStatusEventType;
|
||||||
private ItemDescription projectFolder;
|
private Project project;
|
||||||
|
|
||||||
public interface ProjectStatusEventHandler extends EventHandler {
|
public interface ProjectStatusEventHandler extends EventHandler {
|
||||||
void onProjectStatus(ProjectStatusEvent event);
|
void onProjectStatus(ProjectStatusEvent event);
|
||||||
|
@ -32,9 +32,9 @@ public class ProjectStatusEvent extends
|
||||||
ProjectStatusEventHandler handler);
|
ProjectStatusEventHandler handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProjectStatusEvent(ProjectStatusEventType projectStatusEventType,ItemDescription projectFolder) {
|
public ProjectStatusEvent(ProjectStatusEventType projectStatusEventType,Project project) {
|
||||||
this.projectStatusEventType = projectStatusEventType;
|
this.projectStatusEventType = projectStatusEventType;
|
||||||
this.projectFolder = projectFolder;
|
this.project = project;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -60,18 +60,19 @@ public class ProjectStatusEvent extends
|
||||||
return projectStatusEventType;
|
return projectStatusEventType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemDescription getProjectFolder() {
|
public Project getProject() {
|
||||||
return projectFolder;
|
return project;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ProjectStatusEvent [projectStatusEventType="
|
return "ProjectStatusEvent [projectStatusEventType="
|
||||||
+ projectStatusEventType + ", projectFolder=" + projectFolder
|
+ projectStatusEventType + ", project=" + project + "]";
|
||||||
+ "]";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,22 +3,35 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.client.maindata;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.SessionExpiredEvent;
|
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;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.rpc.StatAlgoImporterServiceAsync;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.type.SessionExpiredType;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.type.SessionExpiredType;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.utils.UtilsGXT3;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.utils.UtilsGXT3;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.code.CodeData;
|
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.exception.StatAlgoImporterSessionExpiredException;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
import com.google.gwt.event.shared.EventBus;
|
import com.google.gwt.event.shared.EventBus;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
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.ContentPanel;
|
||||||
|
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;
|
||||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
||||||
|
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.toolbar.ToolBar;
|
||||||
|
|
||||||
import edu.ycp.cs.dh.acegwt.client.ace.AceEditor;
|
import edu.ycp.cs.dh.acegwt.client.ace.AceEditor;
|
||||||
|
import edu.ycp.cs.dh.acegwt.client.ace.AceEditorCursorPosition;
|
||||||
import edu.ycp.cs.dh.acegwt.client.ace.AceEditorMode;
|
import edu.ycp.cs.dh.acegwt.client.ace.AceEditorMode;
|
||||||
import edu.ycp.cs.dh.acegwt.client.ace.AceEditorTheme;
|
import edu.ycp.cs.dh.acegwt.client.ace.AceEditorTheme;
|
||||||
|
import edu.ycp.cs.dh.acegwt.client.ace.AceSelection;
|
||||||
|
import edu.ycp.cs.dh.acegwt.client.ace.AceSelectionListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -30,15 +43,19 @@ public class CodeEditPanel extends ContentPanel {
|
||||||
|
|
||||||
private EventBus eventBus;
|
private EventBus eventBus;
|
||||||
private AceEditor editor;
|
private AceEditor editor;
|
||||||
|
|
||||||
|
private TextButton btnSave;
|
||||||
|
private TextButton btnAddInput;
|
||||||
|
private TextButton btnAddOutput;
|
||||||
|
|
||||||
public CodeEditPanel(EventBus eventBus) {
|
public CodeEditPanel(Project project, EventBus eventBus) {
|
||||||
super();
|
super();
|
||||||
Log.debug("CodeEditPanel");
|
Log.debug("CodeEditPanel");
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
|
|
||||||
// msgs = GWT.create(ServiceCategoryMessages.class);
|
// msgs = GWT.create(ServiceCategoryMessages.class);
|
||||||
init();
|
init();
|
||||||
create();
|
create(project);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,14 +68,94 @@ public class CodeEditPanel extends ContentPanel {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void create() {
|
private void create(Project project) {
|
||||||
editor = new AceEditor();
|
btnSave = new TextButton("Save");
|
||||||
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
btnSave.setIcon(StatAlgoImporterResources.INSTANCE.add16());
|
||||||
v.add(editor, new VerticalLayoutData(1, 1));
|
btnSave.setScale(ButtonScale.SMALL);
|
||||||
|
btnSave.setIconAlign(IconAlign.LEFT);
|
||||||
|
btnSave.setToolTip("Save");
|
||||||
|
btnSave.addSelectHandler(new SelectHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSelect(SelectEvent event) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
btnAddInput = new TextButton("Input");
|
||||||
|
btnAddInput.setIcon(StatAlgoImporterResources.INSTANCE.add16());
|
||||||
|
btnAddInput.setScale(ButtonScale.SMALL);
|
||||||
|
btnAddInput.setIconAlign(IconAlign.LEFT);
|
||||||
|
btnAddInput.setToolTip("Add input variable from code");
|
||||||
|
btnAddInput.addSelectHandler(new SelectHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSelect(SelectEvent event) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
btnAddInput.disable();
|
||||||
|
|
||||||
|
btnAddOutput = new TextButton("Output");
|
||||||
|
btnAddOutput.setIcon(StatAlgoImporterResources.INSTANCE.add16());
|
||||||
|
btnAddOutput.setScale(ButtonScale.SMALL);
|
||||||
|
btnAddOutput.setIconAlign(IconAlign.LEFT);
|
||||||
|
btnAddOutput.setToolTip("Add output variable from code");
|
||||||
|
btnAddOutput.addSelectHandler(new SelectHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSelect(SelectEvent event) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
btnAddOutput.disable();
|
||||||
|
|
||||||
|
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)));
|
||||||
|
|
||||||
|
|
||||||
|
editor = new AceEditor();
|
||||||
|
|
||||||
|
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
||||||
|
v.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||||
|
v.add(editor, new VerticalLayoutData(1, 1, new Margins(0)));
|
||||||
|
|
||||||
add(v);
|
add(v);
|
||||||
editor.startEditor();
|
editor.startEditor();
|
||||||
editor.setShowPrintMargin(false);
|
editor.setShowPrintMargin(false);
|
||||||
|
|
||||||
|
|
||||||
|
if (project != null && project.getMainCode() != null) {
|
||||||
|
loadCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
editor.getSelection().addSelectionListener(new AceSelectionListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChangeSelection(AceSelection selection) {
|
||||||
|
if(selection!=null&& !selection.isEmpty()){
|
||||||
|
btnAddInput.enable();
|
||||||
|
btnAddOutput.enable();
|
||||||
|
} else {
|
||||||
|
btnAddInput.disable();
|
||||||
|
btnAddOutput.disable();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadCode() {
|
private void loadCode() {
|
||||||
|
@ -104,9 +201,58 @@ public class CodeEditPanel extends ContentPanel {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void codeUpdate() {
|
public void codeUpdate(Project project) {
|
||||||
loadCode();
|
if (project != null && project.getMainCode() != null) {
|
||||||
|
loadCode();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected String getSelectedText() {
|
||||||
|
String selectedText = null;
|
||||||
|
|
||||||
|
AceSelection editorSelection = editor.getSelection();
|
||||||
|
if (!editorSelection.isEmpty()) {
|
||||||
|
AceEditorCursorPosition startPosition;
|
||||||
|
AceEditorCursorPosition endPosition;
|
||||||
|
if (editorSelection.isBackwards()) {
|
||||||
|
startPosition = editorSelection.getSelectionLead();
|
||||||
|
endPosition = editorSelection.getSelectionAnchor();
|
||||||
|
editorSelection.select(startPosition.getRow(),
|
||||||
|
startPosition.getColumn(), endPosition.getRow(),
|
||||||
|
endPosition.getColumn());
|
||||||
|
} else {
|
||||||
|
startPosition = editorSelection.getSelectionAnchor();
|
||||||
|
endPosition = editorSelection.getSelectionLead();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (editorSelection.isMultiLine()) {
|
||||||
|
String tempTest;
|
||||||
|
for (int i = startPosition.getRow(); i < endPosition.getRow() + 1; i++) {
|
||||||
|
if (i == startPosition.getRow()) {
|
||||||
|
tempTest = editor.getLine(i);
|
||||||
|
tempTest.substring(startPosition.getColumn());
|
||||||
|
selectedText = tempTest;
|
||||||
|
} else {
|
||||||
|
if (i == endPosition.getRow()) {
|
||||||
|
tempTest = editor.getLine(i);
|
||||||
|
tempTest.substring(0, endPosition.getColumn() + 1);
|
||||||
|
selectedText += tempTest;
|
||||||
|
} else {
|
||||||
|
selectedText += editor.getLine(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
String tempTest;
|
||||||
|
tempTest = editor.getLine(startPosition.getRow());
|
||||||
|
selectedText = tempTest.substring(startPosition.getColumn(), endPosition.getColumn()+1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.debug("Selected Text: " + selectedText);
|
||||||
|
return selectedText;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.maindata;
|
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.maindata;
|
||||||
|
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.ProjectStatusEvent;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.ProjectStatusEvent;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
import com.google.gwt.event.shared.EventBus;
|
import com.google.gwt.event.shared.EventBus;
|
||||||
|
@ -29,10 +30,9 @@ public class MainDataPanel extends SimpleContainer {
|
||||||
|
|
||||||
protected void init() {
|
protected void init() {
|
||||||
forceLayoutOnResize = true;
|
forceLayoutOnResize = true;
|
||||||
//setBodyBorder(false);
|
// setBodyBorder(false);
|
||||||
setBorders(false);
|
setBorders(false);
|
||||||
//setHeaderVisible(false);
|
// setHeaderVisible(false);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,39 +43,44 @@ public class MainDataPanel extends SimpleContainer {
|
||||||
private void bindToEvents() {
|
private void bindToEvents() {
|
||||||
eventBus.addHandler(ProjectStatusEvent.TYPE,
|
eventBus.addHandler(ProjectStatusEvent.TYPE,
|
||||||
new ProjectStatusEvent.ProjectStatusEventHandler() {
|
new ProjectStatusEvent.ProjectStatusEventHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onProjectStatus(ProjectStatusEvent event) {
|
public void onProjectStatus(ProjectStatusEvent event) {
|
||||||
Log.debug("Catch ProjectStatusEvent");
|
Log.debug("Catch ProjectStatusEvent");
|
||||||
doProjectStatusCommand(event);
|
doProjectStatusCommand(event);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doProjectStatusCommand(ProjectStatusEvent event) {
|
private void doProjectStatusCommand(ProjectStatusEvent event) {
|
||||||
if(event.getProjectStatusEventType()==null){
|
if (event.getProjectStatusEventType() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switch(event.getProjectStatusEventType()){
|
switch (event.getProjectStatusEventType()) {
|
||||||
case OPEN:
|
case OPEN:
|
||||||
addCodeEditPanel();
|
addCodeEditPanel(event.getProject());
|
||||||
break;
|
break;
|
||||||
case UPDATE:
|
case UPDATE:
|
||||||
codeEditPanel.codeUpdate();
|
codeEditPanel.codeUpdate(event.getProject());
|
||||||
break;
|
break;
|
||||||
|
case ADD_RESOURCE:
|
||||||
|
case DELETE_RESOURCE:
|
||||||
|
case MAIN_CODE_SET:
|
||||||
|
case SAVE:
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addCodeEditPanel() {
|
private void addCodeEditPanel(Project project) {
|
||||||
codeEditPanel = new CodeEditPanel(eventBus);
|
codeEditPanel = new CodeEditPanel(project, eventBus);
|
||||||
add(codeEditPanel, new MarginData(new Margins(0)));
|
add(codeEditPanel, new MarginData(new Margins(0)));
|
||||||
forceLayout();
|
forceLayout();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,10 @@ import org.gcube.portlets.user.statisticalalgorithmsimporter.client.type.Project
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.type.SessionExpiredType;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.type.SessionExpiredType;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.utils.UtilsGXT3;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.utils.UtilsGXT3;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterSessionExpiredException;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterSessionExpiredException;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.InputVariables;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.InputData;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.MainCode;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.ProjectFolder;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.workspace.ItemDescription;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.workspace.ItemDescription;
|
||||||
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectNotification.WorskpaceExplorerSelectNotificationListener;
|
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectNotification.WorskpaceExplorerSelectNotificationListener;
|
||||||
import org.gcube.portlets.widgets.wsexplorer.client.select.WorkspaceExplorerSelectDialog;
|
import org.gcube.portlets.widgets.wsexplorer.client.select.WorkspaceExplorerSelectDialog;
|
||||||
|
@ -31,10 +34,7 @@ import com.sencha.gxt.core.client.dom.XDOM;
|
||||||
*/
|
*/
|
||||||
public class ProjectManager {
|
public class ProjectManager {
|
||||||
private EventBus eventBus;
|
private EventBus eventBus;
|
||||||
private ItemDescription projectFolder;
|
private Project project;
|
||||||
@SuppressWarnings("unused")
|
|
||||||
private ItemDescription mainCodeDescription;
|
|
||||||
|
|
||||||
public ProjectManager(EventBus eventBus) {
|
public ProjectManager(EventBus eventBus) {
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ public class ProjectManager {
|
||||||
public void onSelectedItem(Item item) {
|
public void onSelectedItem(Item item) {
|
||||||
|
|
||||||
if (item.getType() == ItemType.FOLDER) {
|
if (item.getType() == ItemType.FOLDER) {
|
||||||
createProjectOnServer(item);
|
openProjectOnServer(item);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
UtilsGXT3.info("Attention",
|
UtilsGXT3.info("Attention",
|
||||||
|
@ -82,6 +82,51 @@ public class ProjectManager {
|
||||||
wselectDialog.setZIndex(XDOM.getTopZIndex());
|
wselectDialog.setZIndex(XDOM.getTopZIndex());
|
||||||
wselectDialog.show();
|
wselectDialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void openProject() {
|
||||||
|
WorkspaceExplorerSelectDialog wselectDialog = new WorkspaceExplorerSelectDialog(
|
||||||
|
"Select Project Folder", true);
|
||||||
|
|
||||||
|
WorskpaceExplorerSelectNotificationListener handler = new WorskpaceExplorerSelectNotificationListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSelectedItem(Item item) {
|
||||||
|
|
||||||
|
if (item.getType() == ItemType.FOLDER) {
|
||||||
|
openProjectOnServer(item);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
UtilsGXT3.info("Attention",
|
||||||
|
"Select a valid project folder!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailed(Throwable throwable) {
|
||||||
|
Log.error("Error in create project: "
|
||||||
|
+ throwable.getLocalizedMessage());
|
||||||
|
UtilsGXT3.alert("Error", throwable.getLocalizedMessage());
|
||||||
|
throwable.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAborted() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNotValidSelection() {
|
||||||
|
UtilsGXT3.info("Attention", "Select a valid project folder!");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
wselectDialog.addWorkspaceExplorerSelectNotificationListener(handler);
|
||||||
|
wselectDialog.setZIndex(XDOM.getTopZIndex());
|
||||||
|
wselectDialog.show();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void addResource() {
|
public void addResource() {
|
||||||
List<ItemType> selectableTypes = new ArrayList<ItemType>();
|
List<ItemType> selectableTypes = new ArrayList<ItemType>();
|
||||||
|
@ -176,15 +221,15 @@ public class ProjectManager {
|
||||||
|
|
||||||
protected void createProjectOnServer(Item item) {
|
protected void createProjectOnServer(Item item) {
|
||||||
Log.debug("Create Project Item selected: " + item);
|
Log.debug("Create Project Item selected: " + item);
|
||||||
projectFolder = new ItemDescription(item.getId(), item.getName(),
|
final ItemDescription newProjectFolder = new ItemDescription(item.getId(), item.getName(),
|
||||||
item.getOwner(), item.getPath(), item.getType().name());
|
item.getOwner(), item.getPath(), item.getType().name());
|
||||||
StatAlgoImporterServiceAsync.INSTANCE.createProjectOnWorkspace(
|
StatAlgoImporterServiceAsync.INSTANCE.createProjectOnWorkspace(
|
||||||
projectFolder, new AsyncCallback<Void>() {
|
newProjectFolder, new AsyncCallback<Void>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Void result) {
|
public void onSuccess(Void result) {
|
||||||
|
project = new Project(new ProjectFolder(newProjectFolder));
|
||||||
fireProjectStatusOpenEvent();
|
fireProjectStatusOpenEvent();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -203,11 +248,44 @@ public class ProjectManager {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void openProjectOnServer(Item item) {
|
||||||
|
Log.debug("Open Project Item selected: " + item);
|
||||||
|
final ItemDescription newProjectFolder = new ItemDescription(item.getId(), item.getName(),
|
||||||
|
item.getOwner(), item.getPath(), item.getType().name());
|
||||||
|
StatAlgoImporterServiceAsync.INSTANCE.openProjectOnWorkspace(
|
||||||
|
newProjectFolder, new AsyncCallback<Project>() {
|
||||||
|
|
||||||
public void saveProject(InputVariables inputVariables) {
|
@Override
|
||||||
Log.debug("Save Project: " + inputVariables);
|
public void onSuccess(Project projectOpened) {
|
||||||
|
Log.debug("Open: "+projectOpened);
|
||||||
|
project=projectOpened;
|
||||||
|
fireProjectStatusOpenEvent();
|
||||||
|
|
||||||
StatAlgoImporterServiceAsync.INSTANCE.saveProject(inputVariables,
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
if (caught instanceof StatAlgoImporterSessionExpiredException) {
|
||||||
|
eventBus.fireEvent(new SessionExpiredEvent(
|
||||||
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
|
} else {
|
||||||
|
Log.error("Error in open project: "
|
||||||
|
+ caught.getLocalizedMessage());
|
||||||
|
UtilsGXT3.alert("Error",
|
||||||
|
caught.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
caught.printStackTrace();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void saveProject(InputData inputData) {
|
||||||
|
Log.debug("Save Project: " + inputData);
|
||||||
|
|
||||||
|
StatAlgoImporterServiceAsync.INSTANCE.saveProject(inputData,
|
||||||
new AsyncCallback<Void>() {
|
new AsyncCallback<Void>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -233,8 +311,7 @@ public class ProjectManager {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMainCode(ItemDescription itemDescription) {
|
public void setMainCode(final ItemDescription itemDescription) {
|
||||||
this.mainCodeDescription = itemDescription;
|
|
||||||
Log.debug("Set Main Code: " + itemDescription);
|
Log.debug("Set Main Code: " + itemDescription);
|
||||||
StatAlgoImporterServiceAsync.INSTANCE.setMainCode(itemDescription,
|
StatAlgoImporterServiceAsync.INSTANCE.setMainCode(itemDescription,
|
||||||
new AsyncCallback<Void>() {
|
new AsyncCallback<Void>() {
|
||||||
|
@ -256,6 +333,7 @@ public class ProjectManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Void result) {
|
public void onSuccess(Void result) {
|
||||||
|
project.setMainCode(new MainCode(itemDescription));
|
||||||
fireProjectStatusUpdateEvent();
|
fireProjectStatusUpdateEvent();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -293,7 +371,7 @@ public class ProjectManager {
|
||||||
|
|
||||||
protected void fireProjectStatusOpenEvent() {
|
protected void fireProjectStatusOpenEvent() {
|
||||||
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
|
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
|
||||||
ProjectStatusEventType.OPEN, projectFolder);
|
ProjectStatusEventType.OPEN, project);
|
||||||
eventBus.fireEvent(projectStatusEvent);
|
eventBus.fireEvent(projectStatusEvent);
|
||||||
Log.debug("ProjectStatusEvent fired! "+projectStatusEvent);
|
Log.debug("ProjectStatusEvent fired! "+projectStatusEvent);
|
||||||
|
|
||||||
|
@ -301,7 +379,7 @@ public class ProjectManager {
|
||||||
|
|
||||||
protected void fireProjectStatusSaveProjectEvent() {
|
protected void fireProjectStatusSaveProjectEvent() {
|
||||||
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
|
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
|
||||||
ProjectStatusEventType.SAVE, projectFolder);
|
ProjectStatusEventType.SAVE, project);
|
||||||
eventBus.fireEvent(projectStatusEvent);
|
eventBus.fireEvent(projectStatusEvent);
|
||||||
Log.debug("ProjectStatusEvent fired! "+projectStatusEvent);
|
Log.debug("ProjectStatusEvent fired! "+projectStatusEvent);
|
||||||
}
|
}
|
||||||
|
@ -309,7 +387,7 @@ public class ProjectManager {
|
||||||
|
|
||||||
protected void fireProjectStatusAddResourceEvent() {
|
protected void fireProjectStatusAddResourceEvent() {
|
||||||
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
|
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
|
||||||
ProjectStatusEventType.ADD_RESOURCE, projectFolder);
|
ProjectStatusEventType.ADD_RESOURCE, project);
|
||||||
eventBus.fireEvent(projectStatusEvent);
|
eventBus.fireEvent(projectStatusEvent);
|
||||||
Log.debug("ProjectStatusEvent fired! "+projectStatusEvent);
|
Log.debug("ProjectStatusEvent fired! "+projectStatusEvent);
|
||||||
}
|
}
|
||||||
|
@ -317,16 +395,18 @@ public class ProjectManager {
|
||||||
protected void fireProjectStatusDeleteEvent() {
|
protected void fireProjectStatusDeleteEvent() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
|
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
|
||||||
ProjectStatusEventType.DELETE_RESOURCE, projectFolder);
|
ProjectStatusEventType.DELETE_RESOURCE, project);
|
||||||
eventBus.fireEvent(projectStatusEvent);
|
eventBus.fireEvent(projectStatusEvent);
|
||||||
Log.debug("ProjectStatusEvent fired! "+projectStatusEvent);
|
Log.debug("ProjectStatusEvent fired! "+projectStatusEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void fireProjectStatusUpdateEvent() {
|
protected void fireProjectStatusUpdateEvent() {
|
||||||
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
|
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
|
||||||
ProjectStatusEventType.UPDATE, projectFolder);
|
ProjectStatusEventType.UPDATE, project);
|
||||||
eventBus.fireEvent(projectStatusEvent);
|
eventBus.fireEvent(projectStatusEvent);
|
||||||
Log.debug("ProjectStatusEvent fired! "+projectStatusEvent);
|
Log.debug("ProjectStatusEvent fired! "+projectStatusEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties;
|
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties;
|
||||||
|
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InputType;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.DataType;
|
||||||
|
|
||||||
import com.google.gwt.editor.client.Editor.Path;
|
import com.google.gwt.editor.client.Editor.Path;
|
||||||
import com.sencha.gxt.data.shared.LabelProvider;
|
import com.sencha.gxt.data.shared.LabelProvider;
|
||||||
|
@ -14,11 +14,11 @@ import com.sencha.gxt.data.shared.PropertyAccess;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public interface InputTypePropertiesCombo extends PropertyAccess<InputType> {
|
public interface DataTypePropertiesCombo extends PropertyAccess<DataType> {
|
||||||
|
|
||||||
@Path("id")
|
@Path("id")
|
||||||
ModelKeyProvider<InputType> id();
|
ModelKeyProvider<DataType> id();
|
||||||
|
|
||||||
LabelProvider<InputType> label();
|
LabelProvider<DataType> label();
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties;
|
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.EnvironmentVariables;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InputType;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.DataType;
|
||||||
|
|
||||||
import com.sencha.gxt.core.client.ValueProvider;
|
import com.sencha.gxt.core.client.ValueProvider;
|
||||||
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
||||||
|
@ -22,7 +22,7 @@ public interface EnvironmentVariablesProperties extends
|
||||||
|
|
||||||
ValueProvider<EnvironmentVariables, String> description();
|
ValueProvider<EnvironmentVariables, String> description();
|
||||||
|
|
||||||
ValueProvider<EnvironmentVariables, InputType> inputType();
|
ValueProvider<EnvironmentVariables, DataType> dataType();
|
||||||
|
|
||||||
ValueProvider<EnvironmentVariables, String> defaultValue();
|
ValueProvider<EnvironmentVariables, String> defaultValue();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.IOType;
|
||||||
|
|
||||||
|
import com.google.gwt.editor.client.Editor.Path;
|
||||||
|
import com.sencha.gxt.data.shared.LabelProvider;
|
||||||
|
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
||||||
|
import com.sencha.gxt.data.shared.PropertyAccess;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author giancarlo email: <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface IOTypePropertiesCombo extends PropertyAccess<IOType> {
|
||||||
|
|
||||||
|
@Path("id")
|
||||||
|
ModelKeyProvider<IOType> id();
|
||||||
|
|
||||||
|
LabelProvider<IOType> label();
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
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.DataType;
|
||||||
|
|
||||||
|
import com.sencha.gxt.core.client.ValueProvider;
|
||||||
|
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
||||||
|
import com.sencha.gxt.data.shared.PropertyAccess;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author giancarlo email: <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface SelectedRowsVariablesProperties extends
|
||||||
|
PropertyAccess<SelectedRowsVariables> {
|
||||||
|
|
||||||
|
ModelKeyProvider<SelectedRowsVariables> id();
|
||||||
|
|
||||||
|
ValueProvider<SelectedRowsVariables, String> name();
|
||||||
|
|
||||||
|
ValueProvider<SelectedRowsVariables, String> description();
|
||||||
|
|
||||||
|
ValueProvider<SelectedRowsVariables, DataType> dataType();
|
||||||
|
|
||||||
|
ValueProvider<SelectedRowsVariables, String> defaultValue();
|
||||||
|
|
||||||
|
ValueProvider<SelectedRowsVariables, IOType> ioType();
|
||||||
|
|
||||||
|
}
|
|
@ -5,7 +5,8 @@ import java.util.ArrayList;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.code.CodeData;
|
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.exception.StatAlgoImporterServiceException;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.file.FileUploadMonitor;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.file.FileUploadMonitor;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.InputVariables;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.InputData;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.session.UserInfo;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.session.UserInfo;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.workspace.ItemDescription;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.workspace.ItemDescription;
|
||||||
|
|
||||||
|
@ -51,12 +52,14 @@ public interface StatAlgoImporterService extends RemoteService {
|
||||||
|
|
||||||
public void addResourceToProject(ItemDescription itemDescription)
|
public void addResourceToProject(ItemDescription itemDescription)
|
||||||
throws StatAlgoImporterServiceException;
|
throws StatAlgoImporterServiceException;
|
||||||
|
|
||||||
public void deleteResourceOnProject(ItemDescription itemDescription)
|
public void deleteResourceOnProject(ItemDescription itemDescription)
|
||||||
throws StatAlgoImporterServiceException;
|
throws StatAlgoImporterServiceException;
|
||||||
|
|
||||||
public void saveProject(InputVariables inputVariables)
|
public void saveProject(InputData inputData)
|
||||||
|
throws StatAlgoImporterServiceException;
|
||||||
|
|
||||||
|
public Project openProjectOnWorkspace(ItemDescription newProjectFolder)
|
||||||
throws StatAlgoImporterServiceException;
|
throws StatAlgoImporterServiceException;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,8 @@ import java.util.ArrayList;
|
||||||
|
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.code.CodeData;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.code.CodeData;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.file.FileUploadMonitor;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.file.FileUploadMonitor;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.InputVariables;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.InputData;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.session.UserInfo;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.session.UserInfo;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.workspace.ItemDescription;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.workspace.ItemDescription;
|
||||||
|
|
||||||
|
@ -43,10 +44,13 @@ public interface StatAlgoImporterServiceAsync {
|
||||||
void addResourceToProject(ItemDescription itemDescription,
|
void addResourceToProject(ItemDescription itemDescription,
|
||||||
AsyncCallback<Void> asyncCallback);
|
AsyncCallback<Void> asyncCallback);
|
||||||
|
|
||||||
void saveProject(InputVariables inputVariables,
|
void saveProject(InputData inputData,
|
||||||
AsyncCallback<Void> asyncCallback);
|
AsyncCallback<Void> asyncCallback);
|
||||||
|
|
||||||
void deleteResourceOnProject(ItemDescription itemDescription,
|
void deleteResourceOnProject(ItemDescription itemDescription,
|
||||||
AsyncCallback<Void> asyncCallback);
|
AsyncCallback<Void> asyncCallback);
|
||||||
|
|
||||||
|
void openProjectOnWorkspace(ItemDescription newProjectFolder,
|
||||||
|
AsyncCallback<Project> asyncCallback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class ExplorerProjectPanel extends ContentPanel {
|
||||||
setResize(true);
|
setResize(true);
|
||||||
setAnimCollapse(false);
|
setAnimCollapse(false);
|
||||||
setHeadingText("Project Explorer");
|
setHeadingText("Project Explorer");
|
||||||
;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ public class ExplorerProjectPanel extends ContentPanel {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
wsResourcesExplorerPanel = new WorkspaceResourcesExplorerPanel(
|
wsResourcesExplorerPanel = new WorkspaceResourcesExplorerPanel(
|
||||||
event.getProjectFolder().getId(), false);
|
event.getProject().getProjectFolder().getItemDescription().getId(), false);
|
||||||
|
|
||||||
WorskpaceExplorerSelectNotificationListener wsResourceExplorerListener = new WorskpaceExplorerSelectNotificationListener() {
|
WorskpaceExplorerSelectNotificationListener wsResourceExplorerListener = new WorskpaceExplorerSelectNotificationListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -183,7 +183,7 @@ public class ExplorerProjectPanel extends ContentPanel {
|
||||||
// DND
|
// DND
|
||||||
|
|
||||||
dnd = new MultipleDNDUpload();
|
dnd = new MultipleDNDUpload();
|
||||||
dnd.setParameters(event.getProjectFolder().getId(), UPLOAD_TYPE.File);
|
dnd.setParameters(event.getProject().getProjectFolder().getItemDescription().getId(), UPLOAD_TYPE.File);
|
||||||
dnd.addUniqueContainer(vResourcesExplorerContainer);
|
dnd.addUniqueContainer(vResourcesExplorerContainer);
|
||||||
WorskpaceUploadNotificationListener workspaceUploaderListener = new WorskpaceUploadNotificationListener() {
|
WorskpaceUploadNotificationListener workspaceUploaderListener = new WorskpaceUploadNotificationListener() {
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,11 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools.input
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties.EnvironmentVariablesProperties;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties.EnvironmentVariablesProperties;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties.InputTypePropertiesCombo;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties.DataTypePropertiesCombo;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.resource.StatAlgoImporterResources;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.resource.StatAlgoImporterResources;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.EnvironmentVariables;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.EnvironmentVariables;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InputType;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.DataType;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
import com.google.gwt.cell.client.AbstractCell;
|
import com.google.gwt.cell.client.AbstractCell;
|
||||||
|
@ -60,8 +61,8 @@ public class EnvironmentVariablesPanel extends ContentPanel {
|
||||||
private EventBus eventBus;
|
private EventBus eventBus;
|
||||||
private ListStore<EnvironmentVariables> storeEnvironmentVariable;
|
private ListStore<EnvironmentVariables> storeEnvironmentVariable;
|
||||||
private Grid<EnvironmentVariables> gridEnvironmentVariable;
|
private Grid<EnvironmentVariables> gridEnvironmentVariable;
|
||||||
private ListStore<InputType> storeComboInputType;
|
private ListStore<DataType> storeComboInputType;
|
||||||
private ComboBox<InputType> comboInputType;
|
private ComboBox<DataType> comboInputType;
|
||||||
private GridRowEditing<EnvironmentVariables> gridEnvironmentVariableEditing;
|
private GridRowEditing<EnvironmentVariables> gridEnvironmentVariableEditing;
|
||||||
private TextButton btnAdd;
|
private TextButton btnAdd;
|
||||||
private boolean addStatus;
|
private boolean addStatus;
|
||||||
|
@ -72,7 +73,7 @@ public class EnvironmentVariablesPanel extends ContentPanel {
|
||||||
SafeHtml format(String value);
|
SafeHtml format(String value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public EnvironmentVariablesPanel(EventBus eventBus) {
|
public EnvironmentVariablesPanel(Project project, EventBus eventBus) {
|
||||||
super();
|
super();
|
||||||
Log.debug("EnvironmentVariablesPanel");
|
Log.debug("EnvironmentVariablesPanel");
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
|
@ -80,7 +81,7 @@ public class EnvironmentVariablesPanel extends ContentPanel {
|
||||||
// msgs = GWT.create(ServiceCategoryMessages.class);
|
// msgs = GWT.create(ServiceCategoryMessages.class);
|
||||||
try {
|
try {
|
||||||
init();
|
init();
|
||||||
create();
|
create(project);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -94,7 +95,7 @@ public class EnvironmentVariablesPanel extends ContentPanel {
|
||||||
forceLayoutOnResize = true;
|
forceLayoutOnResize = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void create() {
|
private void create(Project project) {
|
||||||
// Grid
|
// Grid
|
||||||
EnvironmentVariablesProperties props = GWT
|
EnvironmentVariablesProperties props = GWT
|
||||||
.create(EnvironmentVariablesProperties.class);
|
.create(EnvironmentVariablesProperties.class);
|
||||||
|
@ -107,13 +108,13 @@ public class EnvironmentVariablesPanel extends ContentPanel {
|
||||||
props.name(), 100, "Description");
|
props.name(), 100, "Description");
|
||||||
// descriptionColumn.setMenuDisabled(true);
|
// descriptionColumn.setMenuDisabled(true);
|
||||||
|
|
||||||
ColumnConfig<EnvironmentVariables, InputType> inputTypeColumn = new ColumnConfig<EnvironmentVariables, InputType>(
|
ColumnConfig<EnvironmentVariables, DataType> inputTypeColumn = new ColumnConfig<EnvironmentVariables, DataType>(
|
||||||
props.inputType(), 100, "Type");
|
props.dataType(), 100, "Type");
|
||||||
// inputTypeColumn.setMenuDisabled(true);
|
// inputTypeColumn.setMenuDisabled(true);
|
||||||
inputTypeColumn.setCell(new AbstractCell<InputType>() {
|
inputTypeColumn.setCell(new AbstractCell<DataType>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(Context context, InputType inputType,
|
public void render(Context context, DataType inputType,
|
||||||
SafeHtmlBuilder sb) {
|
SafeHtmlBuilder sb) {
|
||||||
InputTypeTemplates inputTypeTemplates = GWT
|
InputTypeTemplates inputTypeTemplates = GWT
|
||||||
.create(InputTypeTemplates.class);
|
.create(InputTypeTemplates.class);
|
||||||
|
@ -131,19 +132,15 @@ public class EnvironmentVariablesPanel extends ContentPanel {
|
||||||
l.add(inputTypeColumn);
|
l.add(inputTypeColumn);
|
||||||
l.add(defaultValueColumn);
|
l.add(defaultValueColumn);
|
||||||
|
|
||||||
ColumnModel<EnvironmentVariables> columns = new ColumnModel<EnvironmentVariables>(
|
ColumnModel<EnvironmentVariables> columns = new ColumnModel<EnvironmentVariables>(l);
|
||||||
l);
|
|
||||||
|
|
||||||
storeEnvironmentVariable = new ListStore<EnvironmentVariables>(
|
storeEnvironmentVariable = new ListStore<EnvironmentVariables>(props.id());
|
||||||
props.id());
|
|
||||||
|
|
||||||
/*
|
if (project != null && project.getInputData() != null
|
||||||
* ArrayList<EnvironmentVariables> list = new ArrayList<>(); for (int i
|
&& project.getInputData().getListSelectedRows() != null) {
|
||||||
* = 0; i < 10; i++) { list.add(new EnvironmentVariables(i, "Test" + i,
|
storeEnvironmentVariable.addAll(project.getInputData()
|
||||||
* "Desc", "defaultValue", InputType.STRING)); }
|
.getListEnvironmentVariables());
|
||||||
*
|
}
|
||||||
* storeEnvironmentVariable.addAll(list);
|
|
||||||
*/
|
|
||||||
|
|
||||||
final GridSelectionModel<EnvironmentVariables> sm = new GridSelectionModel<EnvironmentVariables>();
|
final GridSelectionModel<EnvironmentVariables> sm = new GridSelectionModel<EnvironmentVariables>();
|
||||||
sm.setSelectionMode(SelectionMode.SINGLE);
|
sm.setSelectionMode(SelectionMode.SINGLE);
|
||||||
|
@ -177,13 +174,13 @@ public class EnvironmentVariablesPanel extends ContentPanel {
|
||||||
// EDITING //
|
// EDITING //
|
||||||
// Key
|
// Key
|
||||||
|
|
||||||
InputTypePropertiesCombo inputTypePropertiesCombo = GWT
|
DataTypePropertiesCombo inputTypePropertiesCombo = GWT
|
||||||
.create(InputTypePropertiesCombo.class);
|
.create(DataTypePropertiesCombo.class);
|
||||||
|
|
||||||
storeComboInputType = new ListStore<InputType>(
|
storeComboInputType = new ListStore<DataType>(
|
||||||
inputTypePropertiesCombo.id());
|
inputTypePropertiesCombo.id());
|
||||||
|
|
||||||
comboInputType = new ComboBox<InputType>(storeComboInputType,
|
comboInputType = new ComboBox<DataType>(storeComboInputType,
|
||||||
inputTypePropertiesCombo.label());
|
inputTypePropertiesCombo.label());
|
||||||
comboInputType.setClearValueOnParseError(false);
|
comboInputType.setClearValueOnParseError(false);
|
||||||
comboInputType.setEditable(false);
|
comboInputType.setEditable(false);
|
||||||
|
@ -300,13 +297,12 @@ public class EnvironmentVariablesPanel extends ContentPanel {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void editingBeforeStart(
|
private void editingBeforeStart(BeforeStartEditEvent<EnvironmentVariables> event) {
|
||||||
BeforeStartEditEvent<EnvironmentVariables> event) {
|
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addHandlersForComboInputType(LabelProvider<InputType> idI18N) {
|
private void addHandlersForComboInputType(LabelProvider<DataType> idI18N) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -314,8 +310,8 @@ public class EnvironmentVariablesPanel extends ContentPanel {
|
||||||
private void addEnvironmentVariable(SelectEvent event) {
|
private void addEnvironmentVariable(SelectEvent event) {
|
||||||
try {
|
try {
|
||||||
seq++;
|
seq++;
|
||||||
EnvironmentVariables newEnvironmentVariable = new EnvironmentVariables(
|
EnvironmentVariables newEnvironmentVariable = new EnvironmentVariables(seq, "",
|
||||||
seq, "", "", "", InputType.STRING);
|
"", "", DataType.STRING);
|
||||||
Log.debug("New Environment Variable: " + newEnvironmentVariable);
|
Log.debug("New Environment Variable: " + newEnvironmentVariable);
|
||||||
gridEnvironmentVariableEditing.cancelEditing();
|
gridEnvironmentVariableEditing.cancelEditing();
|
||||||
addStatus = true;
|
addStatus = true;
|
||||||
|
@ -324,7 +320,7 @@ public class EnvironmentVariablesPanel extends ContentPanel {
|
||||||
int row = storeEnvironmentVariable.indexOf(newEnvironmentVariable);
|
int row = storeEnvironmentVariable.indexOf(newEnvironmentVariable);
|
||||||
|
|
||||||
storeComboInputType.clear();
|
storeComboInputType.clear();
|
||||||
storeComboInputType.addAll(InputType.asList());
|
storeComboInputType.addAll(DataType.asList());
|
||||||
storeComboInputType.commitChanges();
|
storeComboInputType.commitChanges();
|
||||||
|
|
||||||
gridEnvironmentVariableEditing.startEditing(new GridCell(row, 0));
|
gridEnvironmentVariableEditing.startEditing(new GridCell(row, 0));
|
||||||
|
@ -333,8 +329,14 @@ public class EnvironmentVariablesPanel extends ContentPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update() {
|
public void update(Project project) {
|
||||||
|
if (project != null && project.getInputData() != null
|
||||||
|
&& project.getInputData().getListSelectedRows() != null) {
|
||||||
|
storeEnvironmentVariable.clear();
|
||||||
|
storeEnvironmentVariable.addAll(project.getInputData().getListEnvironmentVariables());
|
||||||
|
storeEnvironmentVariable.commitChanges();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<EnvironmentVariables> getEnvironmentVariables() {
|
public ArrayList<EnvironmentVariables> getEnvironmentVariables() {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools.input;
|
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools.input;
|
||||||
|
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InputType;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.DataType;
|
||||||
|
|
||||||
import com.google.gwt.i18n.client.Messages;
|
import com.google.gwt.i18n.client.Messages;
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ public interface InputTypeMessages extends Messages {
|
||||||
"MAP", "Map",
|
"MAP", "Map",
|
||||||
"BOOLEAN", "Boolean",
|
"BOOLEAN", "Boolean",
|
||||||
"IMAGES", "Images" })
|
"IMAGES", "Images" })
|
||||||
String inputType(@Select InputType inputType);
|
String inputType(@Select DataType inputType);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools.input
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.InputSaveEvent;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.InputSaveEvent;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.ProjectStatusEvent;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.ProjectStatusEvent;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.UIStateEvent;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.UIStateEvent;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
import com.google.gwt.event.shared.EventBus;
|
import com.google.gwt.event.shared.EventBus;
|
||||||
|
@ -110,10 +111,10 @@ public class InputVariablePanel extends ContentPanel {
|
||||||
+ event.toString());
|
+ event.toString());
|
||||||
switch (event.getProjectStatusEventType()) {
|
switch (event.getProjectStatusEventType()) {
|
||||||
case OPEN:
|
case OPEN:
|
||||||
create();
|
create(event.getProject());
|
||||||
break;
|
break;
|
||||||
case UPDATE:
|
case UPDATE:
|
||||||
updatePanel();
|
updatePanel(event.getProject());
|
||||||
break;
|
break;
|
||||||
case ADD_RESOURCE:
|
case ADD_RESOURCE:
|
||||||
break;
|
break;
|
||||||
|
@ -124,10 +125,10 @@ public class InputVariablePanel extends ContentPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void create() {
|
private void create(Project project) {
|
||||||
inputVariableTabPanel = new InputVariableTabPanel(eventBus, this);
|
inputVariableTabPanel = new InputVariableTabPanel(eventBus, this);
|
||||||
add(inputVariableTabPanel);
|
add(inputVariableTabPanel);
|
||||||
startPanel();
|
startPanel(project);
|
||||||
forceLayout();
|
forceLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,17 +137,17 @@ public class InputVariablePanel extends ContentPanel {
|
||||||
* InputVariablePanelState.CLOSED; }
|
* InputVariablePanelState.CLOSED; }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private void startPanel() {
|
private void startPanel(Project project) {
|
||||||
enable();
|
enable();
|
||||||
expand();
|
expand();
|
||||||
state = InputVariablePanelState.OPENED;
|
state = InputVariablePanelState.OPENED;
|
||||||
inputVariableTabPanel.startTabs();
|
inputVariableTabPanel.startTabs(project);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updatePanel() {
|
private void updatePanel(Project project) {
|
||||||
if (state == InputVariablePanelState.OPENED) {
|
if (state == InputVariablePanelState.OPENED) {
|
||||||
inputVariableTabPanel.updateTabs();
|
inputVariableTabPanel.updateTabs(project);
|
||||||
Log.debug("ToolBoxPanel Updated");
|
Log.debug("ToolBoxPanel Updated");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools.input;
|
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools.input;
|
||||||
|
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.InputSaveReadyEvent;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.InputSaveReadyEvent;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.InputVariables;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.InputData;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
|
@ -29,19 +30,23 @@ public class InputVariableTabPanel extends TabPanel {
|
||||||
Log.debug("Create InpuntVariableTabPanel");
|
Log.debug("Create InpuntVariableTabPanel");
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
this.msgs = GWT.create(InputVariableMessages.class);
|
this.msgs = GWT.create(InputVariableMessages.class);
|
||||||
|
init();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void init(){
|
||||||
setId("InputVariableTabPanel");
|
setId("InputVariableTabPanel");
|
||||||
setBodyBorder(false);
|
setBodyBorder(false);
|
||||||
setBorders(false);
|
setBorders(false);
|
||||||
setAnimScroll(true);
|
setAnimScroll(true);
|
||||||
setTabScroll(true);
|
setTabScroll(true);
|
||||||
setCloseContextMenu(true);
|
setCloseContextMenu(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startTabs() {
|
public void startTabs(Project project) {
|
||||||
Log.debug("Start InputVariable Tabs");
|
Log.debug("Start InputVariable Tabs");
|
||||||
addEnvironmentVariablesPanel();
|
addEnvironmentVariablesPanel(project);
|
||||||
addSelectedRowsPanel();
|
addSelectedRowsPanel(project);
|
||||||
|
|
||||||
setActiveWidget(getWidget(0));
|
setActiveWidget(getWidget(0));
|
||||||
|
|
||||||
|
@ -67,10 +72,10 @@ public class InputVariableTabPanel extends TabPanel {
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
public void updateTabs() {
|
public void updateTabs(Project project) {
|
||||||
try {
|
try {
|
||||||
enviromentVariablesPanel.update();
|
enviromentVariablesPanel.update(project);
|
||||||
selectedRowsPanel.update();
|
selectedRowsPanel.update(project);
|
||||||
|
|
||||||
forceLayout();
|
forceLayout();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
@ -81,7 +86,7 @@ public class InputVariableTabPanel extends TabPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveInput() {
|
public void saveInput() {
|
||||||
InputVariables inputVariables = new InputVariables();
|
InputData inputVariables = new InputData();
|
||||||
if (enviromentVariablesPanel != null) {
|
if (enviromentVariablesPanel != null) {
|
||||||
inputVariables.setListEnvironmentVariables(enviromentVariablesPanel
|
inputVariables.setListEnvironmentVariables(enviromentVariablesPanel
|
||||||
.getEnvironmentVariables());
|
.getEnvironmentVariables());
|
||||||
|
@ -100,21 +105,21 @@ public class InputVariableTabPanel extends TabPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add
|
// Add
|
||||||
private void addSelectedRowsPanel() {
|
private void addSelectedRowsPanel(Project project) {
|
||||||
TabItemConfig selectedRowsPanelItemConf = new TabItemConfig(
|
TabItemConfig selectedRowsPanelItemConf = new TabItemConfig(
|
||||||
msgs.selectedRowsItem(), false);
|
msgs.selectedRowsItem(), false);
|
||||||
|
|
||||||
selectedRowsPanel = new SelectedRowsPanel(eventBus);
|
selectedRowsPanel = new SelectedRowsPanel(project, eventBus);
|
||||||
selectedRowsPanel.setHeaderVisible(false);
|
selectedRowsPanel.setHeaderVisible(false);
|
||||||
add(selectedRowsPanel, selectedRowsPanelItemConf);
|
add(selectedRowsPanel, selectedRowsPanelItemConf);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addEnvironmentVariablesPanel() {
|
private void addEnvironmentVariablesPanel(Project project) {
|
||||||
TabItemConfig enviromentVariablePanelItemConf = new TabItemConfig(
|
TabItemConfig enviromentVariablePanelItemConf = new TabItemConfig(
|
||||||
msgs.environmentVariables(), false);
|
msgs.environmentVariables(), false);
|
||||||
|
|
||||||
enviromentVariablesPanel = new EnvironmentVariablesPanel(eventBus);
|
enviromentVariablesPanel = new EnvironmentVariablesPanel(project, eventBus);
|
||||||
enviromentVariablesPanel.setHeaderVisible(false);
|
enviromentVariablesPanel.setHeaderVisible(false);
|
||||||
add(enviromentVariablesPanel, enviromentVariablePanelItemConf);
|
add(enviromentVariablesPanel, enviromentVariablePanelItemConf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,14 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools.input
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties.EnvironmentVariablesProperties;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties.DataTypePropertiesCombo;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties.InputTypePropertiesCombo;
|
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.resource.StatAlgoImporterResources;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.resource.StatAlgoImporterResources;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.EnvironmentVariables;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.DataType;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InputType;
|
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.project.Project;
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
import com.google.gwt.cell.client.AbstractCell;
|
import com.google.gwt.cell.client.AbstractCell;
|
||||||
|
@ -14,7 +17,6 @@ import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.event.shared.EventBus;
|
import com.google.gwt.event.shared.EventBus;
|
||||||
import com.google.gwt.safehtml.shared.SafeHtml;
|
import com.google.gwt.safehtml.shared.SafeHtml;
|
||||||
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||||
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
|
|
||||||
import com.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction;
|
import com.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction;
|
||||||
import com.sencha.gxt.core.client.Style.SelectionMode;
|
import com.sencha.gxt.core.client.Style.SelectionMode;
|
||||||
import com.sencha.gxt.core.client.XTemplates;
|
import com.sencha.gxt.core.client.XTemplates;
|
||||||
|
@ -57,21 +59,29 @@ public class SelectedRowsPanel extends ContentPanel {
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private EventBus eventBus;
|
private EventBus eventBus;
|
||||||
private ListStore<EnvironmentVariables> storeEnvironmentVariable;
|
private ListStore<SelectedRowsVariables> storeSelectedRows;
|
||||||
private Grid<EnvironmentVariables> gridSelectedRows;
|
private Grid<SelectedRowsVariables> gridSelectedRows;
|
||||||
private ListStore<InputType> storeComboInputType;
|
private ListStore<DataType> storeComboDataType;
|
||||||
private ComboBox<InputType> comboInputType;
|
private ComboBox<DataType> comboDataType;
|
||||||
private GridRowEditing<EnvironmentVariables> gridEnvironmentVariableEditing;
|
private ListStore<IOType> storeComboIOType;
|
||||||
|
private ComboBox<IOType> comboIOType;
|
||||||
|
private GridRowEditing<SelectedRowsVariables> gridSelectedRowsEditing;
|
||||||
private TextButton btnAdd;
|
private TextButton btnAdd;
|
||||||
private boolean addStatus;
|
private boolean addStatus;
|
||||||
private int seq = 0;
|
private int seq = 0;
|
||||||
|
|
||||||
interface InputTypeTemplates extends XTemplates {
|
interface DataTypeTemplates extends XTemplates {
|
||||||
@XTemplate("<span title=\"{value}\">{value}</span>")
|
@XTemplate("<span title=\"{value}\">{value}</span>")
|
||||||
SafeHtml format(String value);
|
SafeHtml format(String value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SelectedRowsPanel(EventBus eventBus) {
|
interface IOTypeTemplates extends XTemplates {
|
||||||
|
@XTemplate("<span title=\"{value}\">{value}</span>")
|
||||||
|
SafeHtml format(String value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public SelectedRowsPanel(Project project, EventBus eventBus) {
|
||||||
super();
|
super();
|
||||||
Log.debug("SelectedRowsPanel");
|
Log.debug("SelectedRowsPanel");
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
|
@ -79,7 +89,7 @@ public class SelectedRowsPanel extends ContentPanel {
|
||||||
// msgs = GWT.create(ServiceCategoryMessages.class);
|
// msgs = GWT.create(ServiceCategoryMessages.class);
|
||||||
try {
|
try {
|
||||||
init();
|
init();
|
||||||
create();
|
create(project);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -93,62 +103,85 @@ public class SelectedRowsPanel extends ContentPanel {
|
||||||
forceLayoutOnResize = true;
|
forceLayoutOnResize = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void create() {
|
private void create(Project project) {
|
||||||
// Grid
|
// Grid
|
||||||
EnvironmentVariablesProperties props = GWT
|
SelectedRowsVariablesProperties props = GWT
|
||||||
.create(EnvironmentVariablesProperties.class);
|
.create(SelectedRowsVariablesProperties.class);
|
||||||
|
|
||||||
ColumnConfig<EnvironmentVariables, String> nameColumn = new ColumnConfig<EnvironmentVariables, String>(
|
ColumnConfig<SelectedRowsVariables, String> nameColumn = new ColumnConfig<SelectedRowsVariables, String>(
|
||||||
props.name(), 100, "Name");
|
props.name(), 100, "Name");
|
||||||
// nameColumn.setMenuDisabled(true);
|
// nameColumn.setMenuDisabled(true);
|
||||||
|
|
||||||
ColumnConfig<EnvironmentVariables, String> descriptionColumn = new ColumnConfig<EnvironmentVariables, String>(
|
ColumnConfig<SelectedRowsVariables, String> descriptionColumn = new ColumnConfig<SelectedRowsVariables, String>(
|
||||||
props.name(), 100, "Description");
|
props.name(), 100, "Description");
|
||||||
// descriptionColumn.setMenuDisabled(true);
|
// descriptionColumn.setMenuDisabled(true);
|
||||||
|
|
||||||
ColumnConfig<EnvironmentVariables, InputType> inputTypeColumn = new ColumnConfig<EnvironmentVariables, InputType>(
|
ColumnConfig<SelectedRowsVariables, DataType> dataTypeColumn = new ColumnConfig<SelectedRowsVariables, DataType>(
|
||||||
props.inputType(), 100, "Type");
|
props.dataType(), 100, "Type");
|
||||||
// inputTypeColumn.setMenuDisabled(true);
|
// inputTypeColumn.setMenuDisabled(true);
|
||||||
inputTypeColumn.setCell(new AbstractCell<InputType>() {
|
dataTypeColumn.setCell(new AbstractCell<DataType>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(Context context, InputType inputType,
|
public void render(Context context, DataType inputType,
|
||||||
SafeHtmlBuilder sb) {
|
SafeHtmlBuilder sb) {
|
||||||
InputTypeTemplates inputTypeTemplates = GWT
|
DataTypeTemplates inputTypeTemplates = GWT
|
||||||
.create(InputTypeTemplates.class);
|
.create(DataTypeTemplates.class);
|
||||||
sb.append(inputTypeTemplates.format(inputType.getLabel()));
|
sb.append(inputTypeTemplates.format(inputType.getLabel()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ColumnConfig<EnvironmentVariables, String> defaultValueColumn = new ColumnConfig<EnvironmentVariables, String>(
|
ColumnConfig<SelectedRowsVariables, String> defaultValueColumn = new ColumnConfig<SelectedRowsVariables, String>(
|
||||||
props.defaultValue(), 100, "Default");
|
props.defaultValue(), 100, "Default");
|
||||||
// defaColumn.setMenuDisabled(true);
|
// defaColumn.setMenuDisabled(true);
|
||||||
|
|
||||||
|
|
||||||
|
ColumnConfig<SelectedRowsVariables, IOType> ioTypeColumn = new ColumnConfig<SelectedRowsVariables, IOType>(
|
||||||
|
props.ioType(), 100, "I/O");
|
||||||
|
// inputTypeColumn.setMenuDisabled(true);
|
||||||
|
ioTypeColumn.setCell(new AbstractCell<IOType>() {
|
||||||
|
|
||||||
ArrayList<ColumnConfig<EnvironmentVariables, ?>> l = new ArrayList<ColumnConfig<EnvironmentVariables, ?>>();
|
@Override
|
||||||
|
public void render(Context context, IOType ioType,
|
||||||
|
SafeHtmlBuilder sb) {
|
||||||
|
IOTypeTemplates ioTypeTemplates = GWT
|
||||||
|
.create(IOTypeTemplates.class);
|
||||||
|
sb.append(ioTypeTemplates.format(ioType.getLabel()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ArrayList<ColumnConfig<SelectedRowsVariables, ?>> l = new ArrayList<ColumnConfig<SelectedRowsVariables, ?>>();
|
||||||
l.add(nameColumn);
|
l.add(nameColumn);
|
||||||
l.add(descriptionColumn);
|
l.add(descriptionColumn);
|
||||||
l.add(inputTypeColumn);
|
l.add(dataTypeColumn);
|
||||||
l.add(defaultValueColumn);
|
l.add(defaultValueColumn);
|
||||||
|
l.add(ioTypeColumn);
|
||||||
|
|
||||||
ColumnModel<EnvironmentVariables> columns = new ColumnModel<EnvironmentVariables>(
|
ColumnModel<SelectedRowsVariables> columns = new ColumnModel<SelectedRowsVariables>(
|
||||||
l);
|
l);
|
||||||
|
|
||||||
storeEnvironmentVariable = new ListStore<EnvironmentVariables>(
|
storeSelectedRows = new ListStore<SelectedRowsVariables>(
|
||||||
props.id());
|
props.id());
|
||||||
|
|
||||||
/*ArrayList<EnvironmentVariables> list = new ArrayList<>();
|
/*
|
||||||
for (int i = 0; i < 10; i++) {
|
* ArrayList<SelectedRowsVariables> list = new ArrayList<>(); for (int i
|
||||||
list.add(new EnvironmentVariables(i, "Test" + i, "Desc",
|
* = 0; i < 10; i++) { list.add(new SelectedRowsVariables(i, "Test" + i,
|
||||||
"defaultValue", InputType.STRING));
|
* "Desc", "defaultValue", InputType.STRING)); }
|
||||||
|
*
|
||||||
|
* storeEnvironmentVariable.addAll(list);
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (project != null && project.getInputData() != null
|
||||||
|
&& project.getInputData().getListSelectedRows() != null) {
|
||||||
|
storeSelectedRows.addAll(project.getInputData().getListSelectedRows());
|
||||||
}
|
}
|
||||||
|
|
||||||
storeEnvironmentVariable.addAll(list);*/
|
final GridSelectionModel<SelectedRowsVariables> sm = new GridSelectionModel<SelectedRowsVariables>();
|
||||||
|
|
||||||
final GridSelectionModel<EnvironmentVariables> sm = new GridSelectionModel<EnvironmentVariables>();
|
|
||||||
sm.setSelectionMode(SelectionMode.SINGLE);
|
sm.setSelectionMode(SelectionMode.SINGLE);
|
||||||
|
|
||||||
gridSelectedRows = new Grid<EnvironmentVariables>(
|
gridSelectedRows = new Grid<SelectedRowsVariables>(
|
||||||
storeEnvironmentVariable, columns);
|
storeSelectedRows, columns);
|
||||||
gridSelectedRows.setSelectionModel(sm);
|
gridSelectedRows.setSelectionModel(sm);
|
||||||
gridSelectedRows.getView().setStripeRows(true);
|
gridSelectedRows.getView().setStripeRows(true);
|
||||||
gridSelectedRows.getView().setColumnLines(true);
|
gridSelectedRows.getView().setColumnLines(true);
|
||||||
|
@ -156,60 +189,81 @@ public class SelectedRowsPanel extends ContentPanel {
|
||||||
gridSelectedRows.getView().setAutoFill(true);
|
gridSelectedRows.getView().setAutoFill(true);
|
||||||
gridSelectedRows.setBorders(false);
|
gridSelectedRows.setBorders(false);
|
||||||
gridSelectedRows.setColumnReordering(false);
|
gridSelectedRows.setColumnReordering(false);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GridDragSource<EnvironmentVariables> ds = new
|
* GridDragSource<SelectedRowsVariables> ds = new
|
||||||
* GridDragSource<EnvironmentVariables>( gridEnvironmentVariable);
|
* GridDragSource<SelectedRowsVariables>( gridEnvironmentVariable);
|
||||||
* ds.addDragStartHandler(new DndDragStartHandler() {
|
* ds.addDragStartHandler(new DndDragStartHandler() {
|
||||||
*
|
*
|
||||||
* @Override public void onDragStart(DndDragStartEvent event) {
|
* @Override public void onDragStart(DndDragStartEvent event) {
|
||||||
*
|
*
|
||||||
* @SuppressWarnings("unchecked") ArrayList<EnvironmentVariables>
|
* @SuppressWarnings("unchecked") ArrayList<SelectedRowsVariables>
|
||||||
* draggingSelection = (ArrayList<EnvironmentVariables>) event
|
* draggingSelection = (ArrayList<SelectedRowsVariables>) event
|
||||||
* .getData(); Log.debug("Start Drag: " + draggingSelection);
|
* .getData(); Log.debug("Start Drag: " + draggingSelection);
|
||||||
*
|
*
|
||||||
* } }); GridDropTarget<EnvironmentVariables> dt = new
|
* } }); GridDropTarget<SelectedRowsVariables> dt = new
|
||||||
* GridDropTarget<EnvironmentVariables>( gridEnvironmentVariable);
|
* GridDropTarget<SelectedRowsVariables>( gridEnvironmentVariable);
|
||||||
* dt.setFeedback(Feedback.BOTH); dt.setAllowSelfAsSource(true);
|
* dt.setFeedback(Feedback.BOTH); dt.setAllowSelfAsSource(true);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// EDITING //
|
// EDITING //
|
||||||
// Key
|
|
||||||
|
// DataType
|
||||||
|
DataTypePropertiesCombo dataTypePropertiesCombo = GWT
|
||||||
|
.create(DataTypePropertiesCombo.class);
|
||||||
|
|
||||||
InputTypePropertiesCombo inputTypePropertiesCombo = GWT
|
storeComboDataType = new ListStore<DataType>(
|
||||||
.create(InputTypePropertiesCombo.class);
|
dataTypePropertiesCombo.id());
|
||||||
|
|
||||||
storeComboInputType = new ListStore<InputType>(
|
comboDataType = new ComboBox<DataType>(storeComboDataType,
|
||||||
inputTypePropertiesCombo.id());
|
dataTypePropertiesCombo.label());
|
||||||
|
comboDataType.setClearValueOnParseError(false);
|
||||||
|
comboDataType.setEditable(false);
|
||||||
|
|
||||||
comboInputType = new ComboBox<InputType>(storeComboInputType,
|
comboDataType.setTriggerAction(TriggerAction.ALL);
|
||||||
inputTypePropertiesCombo.label());
|
addHandlersForComboDataType(dataTypePropertiesCombo.label());
|
||||||
comboInputType.setClearValueOnParseError(false);
|
|
||||||
comboInputType.setEditable(false);
|
// IOType
|
||||||
|
IOTypePropertiesCombo ioTypePropertiesCombo = GWT
|
||||||
|
.create(IOTypePropertiesCombo.class);
|
||||||
|
|
||||||
comboInputType.setTriggerAction(TriggerAction.ALL);
|
storeComboIOType = new ListStore<IOType>(
|
||||||
addHandlersForComboInputType(inputTypePropertiesCombo.label());
|
ioTypePropertiesCombo.id());
|
||||||
|
|
||||||
gridEnvironmentVariableEditing = new GridRowEditing<EnvironmentVariables>(
|
comboIOType = new ComboBox<IOType>(storeComboIOType,
|
||||||
|
ioTypePropertiesCombo.label());
|
||||||
|
comboIOType.setClearValueOnParseError(false);
|
||||||
|
comboIOType.setEditable(false);
|
||||||
|
|
||||||
|
comboIOType.setTriggerAction(TriggerAction.ALL);
|
||||||
|
addHandlersForComboIOType(ioTypePropertiesCombo.label());
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
gridSelectedRowsEditing = new GridRowEditing<SelectedRowsVariables>(
|
||||||
gridSelectedRows);
|
gridSelectedRows);
|
||||||
gridEnvironmentVariableEditing.addEditor(nameColumn, new TextField());
|
gridSelectedRowsEditing.addEditor(nameColumn, new TextField());
|
||||||
gridEnvironmentVariableEditing.addEditor(descriptionColumn,
|
gridSelectedRowsEditing.addEditor(descriptionColumn,
|
||||||
new TextField());
|
new TextField());
|
||||||
gridEnvironmentVariableEditing
|
gridSelectedRowsEditing.addEditor(dataTypeColumn,
|
||||||
.addEditor(inputTypeColumn, comboInputType);
|
comboDataType);
|
||||||
gridEnvironmentVariableEditing.addEditor(defaultValueColumn,
|
gridSelectedRowsEditing.addEditor(defaultValueColumn,
|
||||||
new TextField());
|
new TextField());
|
||||||
|
|
||||||
|
gridSelectedRowsEditing.addEditor(ioTypeColumn,
|
||||||
|
comboIOType);
|
||||||
|
|
||||||
|
|
||||||
btnAdd = new TextButton();
|
btnAdd = new TextButton();
|
||||||
btnAdd.setIcon(StatAlgoImporterResources.INSTANCE.add16());
|
btnAdd.setIcon(StatAlgoImporterResources.INSTANCE.add16());
|
||||||
//btnAdd.setIconAlign(IconAlign.);
|
// btnAdd.setIconAlign(IconAlign.);
|
||||||
btnAdd.setToolTip("Add Environment Variable");
|
btnAdd.setToolTip("Add Environment Variable");
|
||||||
btnAdd.addSelectHandler(new SelectHandler() {
|
btnAdd.addSelectHandler(new SelectHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSelect(SelectEvent event) {
|
public void onSelect(SelectEvent event) {
|
||||||
addEnvironmentVariable(event);
|
addSelectedRow(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -217,62 +271,62 @@ public class SelectedRowsPanel extends ContentPanel {
|
||||||
TextButton btnDelete = new TextButton("Delete");
|
TextButton btnDelete = new TextButton("Delete");
|
||||||
btnDelete.addSelectHandler(new SelectEvent.SelectHandler() {
|
btnDelete.addSelectHandler(new SelectEvent.SelectHandler() {
|
||||||
public void onSelect(SelectEvent event) {
|
public void onSelect(SelectEvent event) {
|
||||||
GridCell cell = gridEnvironmentVariableEditing.getActiveCell();
|
GridCell cell = gridSelectedRowsEditing.getActiveCell();
|
||||||
int rowIndex = cell.getRow();
|
int rowIndex = cell.getRow();
|
||||||
|
|
||||||
gridEnvironmentVariableEditing.cancelEditing();
|
gridSelectedRowsEditing.cancelEditing();
|
||||||
|
|
||||||
storeEnvironmentVariable.remove(rowIndex);
|
storeSelectedRows.remove(rowIndex);
|
||||||
storeEnvironmentVariable.commitChanges();
|
storeSelectedRows.commitChanges();
|
||||||
|
|
||||||
gridEnvironmentVariableEditing.getCancelButton()
|
gridSelectedRowsEditing.getCancelButton().setVisible(
|
||||||
.setVisible(true);
|
true);
|
||||||
btnAdd.setEnabled(true);
|
btnAdd.setEnabled(true);
|
||||||
if (addStatus) {
|
if (addStatus) {
|
||||||
addStatus = false;
|
addStatus = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ButtonBar buttonBar = gridEnvironmentVariableEditing.getButtonBar();
|
ButtonBar buttonBar = gridSelectedRowsEditing.getButtonBar();
|
||||||
buttonBar.add(btnDelete);
|
buttonBar.add(btnDelete);
|
||||||
|
|
||||||
gridEnvironmentVariableEditing
|
gridSelectedRowsEditing
|
||||||
.addBeforeStartEditHandler(new BeforeStartEditHandler<EnvironmentVariables>() {
|
.addBeforeStartEditHandler(new BeforeStartEditHandler<SelectedRowsVariables>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBeforeStartEdit(
|
public void onBeforeStartEdit(
|
||||||
BeforeStartEditEvent<EnvironmentVariables> event) {
|
BeforeStartEditEvent<SelectedRowsVariables> event) {
|
||||||
editingBeforeStart(event);
|
editingBeforeStart(event);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
gridEnvironmentVariableEditing
|
gridSelectedRowsEditing
|
||||||
.addCancelEditHandler(new CancelEditHandler<EnvironmentVariables>() {
|
.addCancelEditHandler(new CancelEditHandler<SelectedRowsVariables>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCancelEdit(
|
public void onCancelEdit(
|
||||||
CancelEditEvent<EnvironmentVariables> event) {
|
CancelEditEvent<SelectedRowsVariables> event) {
|
||||||
storeEnvironmentVariable.rejectChanges();
|
storeSelectedRows.rejectChanges();
|
||||||
btnAdd.setEnabled(true);
|
btnAdd.setEnabled(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
gridEnvironmentVariableEditing
|
gridSelectedRowsEditing
|
||||||
.addCompleteEditHandler(new CompleteEditHandler<EnvironmentVariables>() {
|
.addCompleteEditHandler(new CompleteEditHandler<SelectedRowsVariables>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCompleteEdit(
|
public void onCompleteEdit(
|
||||||
CompleteEditEvent<EnvironmentVariables> event) {
|
CompleteEditEvent<SelectedRowsVariables> event) {
|
||||||
try {
|
try {
|
||||||
if (addStatus) {
|
if (addStatus) {
|
||||||
addStatus = false;
|
addStatus = false;
|
||||||
}
|
}
|
||||||
storeEnvironmentVariable.commitChanges();
|
storeSelectedRows.commitChanges();
|
||||||
|
|
||||||
gridEnvironmentVariableEditing.getCancelButton()
|
gridSelectedRowsEditing.getCancelButton()
|
||||||
.setVisible(true);
|
.setVisible(true);
|
||||||
btnAdd.setEnabled(true);
|
btnAdd.setEnabled(true);
|
||||||
|
|
||||||
|
@ -290,57 +344,72 @@ public class SelectedRowsPanel extends ContentPanel {
|
||||||
VerticalLayoutContainer vlc = new VerticalLayoutContainer();
|
VerticalLayoutContainer vlc = new VerticalLayoutContainer();
|
||||||
vlc.setAdjustForScroll(false);
|
vlc.setAdjustForScroll(false);
|
||||||
vlc.setScrollMode(ScrollMode.NONE);
|
vlc.setScrollMode(ScrollMode.NONE);
|
||||||
|
|
||||||
vlc.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
|
vlc.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||||
vlc.add(gridSelectedRows, new VerticalLayoutData(1, 1,
|
vlc.add(gridSelectedRows, new VerticalLayoutData(1, 1, new Margins(0)));
|
||||||
new Margins(0)));
|
|
||||||
|
|
||||||
add(vlc, new MarginData(new Margins(0)));
|
add(vlc, new MarginData(new Margins(0)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void editingBeforeStart(
|
private void editingBeforeStart(
|
||||||
BeforeStartEditEvent<EnvironmentVariables> event) {
|
BeforeStartEditEvent<SelectedRowsVariables> event) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addHandlersForComboInputType(LabelProvider<InputType> idI18N) {
|
private void addHandlersForComboDataType(LabelProvider<DataType> idI18N) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addEnvironmentVariable(SelectEvent event) {
|
private void addHandlersForComboIOType(LabelProvider<IOType> idI18N) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void addSelectedRow(SelectEvent event) {
|
||||||
try {
|
try {
|
||||||
seq++;
|
seq++;
|
||||||
EnvironmentVariables newEnvironmentVariable = new EnvironmentVariables(
|
SelectedRowsVariables newEnvironmentVariable = new SelectedRowsVariables(
|
||||||
seq, "", "", "", InputType.STRING);
|
seq, "", "", "", DataType.STRING, IOType.INPUT);
|
||||||
Log.debug("New Environment Variable: " + newEnvironmentVariable);
|
Log.debug("New Environment Variable: " + newEnvironmentVariable);
|
||||||
gridEnvironmentVariableEditing.cancelEditing();
|
gridSelectedRowsEditing.cancelEditing();
|
||||||
addStatus = true;
|
addStatus = true;
|
||||||
gridEnvironmentVariableEditing.getCancelButton().setVisible(false);
|
gridSelectedRowsEditing.getCancelButton().setVisible(false);
|
||||||
storeEnvironmentVariable.add(newEnvironmentVariable);
|
storeSelectedRows.add(newEnvironmentVariable);
|
||||||
int row = storeEnvironmentVariable.indexOf(newEnvironmentVariable);
|
int row = storeSelectedRows.indexOf(newEnvironmentVariable);
|
||||||
|
|
||||||
storeComboInputType.clear();
|
storeComboDataType.clear();
|
||||||
storeComboInputType.addAll(InputType.asList());
|
storeComboDataType.addAll(DataType.asList());
|
||||||
storeComboInputType.commitChanges();
|
storeComboDataType.commitChanges();
|
||||||
|
|
||||||
|
storeComboIOType.clear();
|
||||||
|
storeComboIOType.addAll(IOType.asList());
|
||||||
|
storeComboIOType.commitChanges();
|
||||||
|
|
||||||
gridEnvironmentVariableEditing.startEditing(new GridCell(row, 0));
|
gridSelectedRowsEditing.startEditing(new GridCell(row, 0));
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update() {
|
public void update(Project project) {
|
||||||
|
if (project != null && project.getInputData() != null
|
||||||
|
&& project.getInputData().getListSelectedRows() != null) {
|
||||||
|
storeSelectedRows.clear();
|
||||||
|
storeSelectedRows.addAll(project.getInputData().getListSelectedRows());
|
||||||
|
storeSelectedRows.commitChanges();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<EnvironmentVariables> getSelectedRows() {
|
public ArrayList<SelectedRowsVariables> getSelectedRows() {
|
||||||
ArrayList<EnvironmentVariables> listEnviromentVarialbles = new ArrayList<>(
|
ArrayList<SelectedRowsVariables> listEnviromentVarialbles = new ArrayList<>(
|
||||||
gridSelectedRows.getStore().getAll());
|
gridSelectedRows.getStore().getAll());
|
||||||
return listEnviromentVarialbles;
|
return listEnviromentVarialbles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ import org.gcube.portlets.user.statisticalalgorithmsimporter.server.storage.Proj
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.code.CodeData;
|
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.exception.StatAlgoImporterServiceException;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.file.FileUploadMonitor;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.file.FileUploadMonitor;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.InputVariables;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.InputData;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.MainCode;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.MainCode;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.ProjectFolder;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.ProjectFolder;
|
||||||
|
@ -146,13 +146,13 @@ public class StatAlgoImporterServiceImpl extends RemoteServiceServlet implements
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void createProjectOnWorkspace(ItemDescription itemDescription)
|
public void createProjectOnWorkspace(ItemDescription newProjectFolder)
|
||||||
throws StatAlgoImporterServiceException {
|
throws StatAlgoImporterServiceException {
|
||||||
try {
|
try {
|
||||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
SessionUtil.getAslSession(session);
|
SessionUtil.getAslSession(session);
|
||||||
logger.debug("createProjectOnWorkspace()");
|
logger.debug("createProjectOnWorkspace()");
|
||||||
ProjectFolder projectFolder = new ProjectFolder(itemDescription);
|
ProjectFolder projectFolder = new ProjectFolder(newProjectFolder);
|
||||||
Project projectSession = new Project(projectFolder);
|
Project projectSession = new Project(projectFolder);
|
||||||
SessionUtil.setProjectSession(session, projectSession);
|
SessionUtil.setProjectSession(session, projectSession);
|
||||||
|
|
||||||
|
@ -167,6 +167,32 @@ public class StatAlgoImporterServiceImpl extends RemoteServiceServlet implements
|
||||||
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
|
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Project openProjectOnWorkspace(ItemDescription newProjectFolder)
|
||||||
|
throws StatAlgoImporterServiceException {
|
||||||
|
try {
|
||||||
|
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
|
ASLSession aslSession=SessionUtil.getAslSession(session);
|
||||||
|
logger.debug("openProjectOnWorkspace()");
|
||||||
|
|
||||||
|
Project project=ProjectArchiver.readProject(newProjectFolder,aslSession);
|
||||||
|
SessionUtil.setProjectSession(session, project);
|
||||||
|
|
||||||
|
return project;
|
||||||
|
} catch (StatAlgoImporterServiceException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw e;
|
||||||
|
} catch (Throwable e) {
|
||||||
|
logger.error(
|
||||||
|
"openProjectOnWorkspace(): " + e.getLocalizedMessage(), e);
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setMainCode(ItemDescription itemDescription)
|
public void setMainCode(ItemDescription itemDescription)
|
||||||
|
@ -268,15 +294,15 @@ public class StatAlgoImporterServiceImpl extends RemoteServiceServlet implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void saveProject(InputVariables inputVariables)
|
public void saveProject(InputData inputData)
|
||||||
throws StatAlgoImporterServiceException {
|
throws StatAlgoImporterServiceException {
|
||||||
try {
|
try {
|
||||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
ASLSession aslSession=SessionUtil.getAslSession(session);
|
ASLSession aslSession=SessionUtil.getAslSession(session);
|
||||||
logger.debug("saveProject():"+inputVariables);
|
logger.debug("saveProject():"+inputData);
|
||||||
Project project = SessionUtil.getProjectSession(session);
|
Project project = SessionUtil.getProjectSession(session);
|
||||||
if (project != null) {
|
if (project != null) {
|
||||||
project.setInputVariable(inputVariables);
|
project.setInputData(inputData);
|
||||||
SessionUtil.setProjectSession(session, project);
|
SessionUtil.setProjectSession(session, project);
|
||||||
ProjectArchiver.archive(project, aslSession);
|
ProjectArchiver.archive(project, aslSession);
|
||||||
} else {
|
} else {
|
||||||
|
@ -296,4 +322,6 @@ public class StatAlgoImporterServiceImpl extends RemoteServiceServlet implements
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,7 +113,42 @@ public class FilesStorage {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public InputStream retrieveProjectItemOnWorkspace(String user, String folderId)
|
||||||
|
throws StatAlgoImporterServiceException {
|
||||||
|
Workspace ws;
|
||||||
|
try {
|
||||||
|
ws = HomeLibrary.getUserWorkspace(user);
|
||||||
|
|
||||||
|
WorkspaceItem workSpaceItem = ws.getItem(folderId);
|
||||||
|
if (!workSpaceItem.isFolder()) {
|
||||||
|
throw new StatAlgoImporterServiceException(
|
||||||
|
"Folder is not valid item!");
|
||||||
|
}
|
||||||
|
|
||||||
|
WorkspaceItem projectItem=ws.find(STATISTICAL_ALGORITHM_PROJECT_FILE_NAME, folderId);
|
||||||
|
|
||||||
|
if(projectItem==null){
|
||||||
|
throw new StatAlgoImporterServiceException(
|
||||||
|
"No project found in this folder!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return retrieveImputStream(user, projectItem);
|
||||||
|
|
||||||
|
} catch (WorkspaceFolderNotFoundException | InternalErrorException
|
||||||
|
| HomeNotFoundException | ItemNotFoundException | WrongItemTypeException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
package org.gcube.portlets.user.statisticalalgorithmsimporter.server.storage;
|
package org.gcube.portlets.user.statisticalalgorithmsimporter.server.storage;
|
||||||
|
|
||||||
|
import java.beans.XMLDecoder;
|
||||||
import java.beans.XMLEncoder;
|
import java.beans.XMLEncoder;
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
import org.gcube.application.framework.core.session.ASLSession;
|
import org.gcube.application.framework.core.session.ASLSession;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterServiceException;
|
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.project.Project;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.workspace.ItemDescription;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -17,24 +20,37 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ProjectArchiver {
|
public class ProjectArchiver {
|
||||||
|
|
||||||
public static final Logger logger = LoggerFactory
|
public static final Logger logger = LoggerFactory
|
||||||
.getLogger(ProjectArchiver.class);
|
.getLogger(ProjectArchiver.class);
|
||||||
|
|
||||||
|
|
||||||
public static void archive(Project project, ASLSession aslSession)
|
public static void archive(Project project, ASLSession aslSession)
|
||||||
throws StatAlgoImporterServiceException {
|
throws StatAlgoImporterServiceException {
|
||||||
|
|
||||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||||
XMLEncoder xmlEncoder = new XMLEncoder(byteArrayOutputStream);
|
XMLEncoder xmlEncoder = new XMLEncoder(byteArrayOutputStream);
|
||||||
xmlEncoder.writeObject(project);
|
xmlEncoder.writeObject(project);
|
||||||
xmlEncoder.close();
|
xmlEncoder.close();
|
||||||
logger.debug("Archived:" + byteArrayOutputStream);
|
logger.debug("Archived:" + byteArrayOutputStream);
|
||||||
|
|
||||||
ByteArrayInputStream byteArrayInputStream=new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
|
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
|
||||||
FilesStorage filesStorage=new FilesStorage();
|
byteArrayOutputStream.toByteArray());
|
||||||
filesStorage.saveItemOnFolder(aslSession.getUsername(), byteArrayInputStream, project.getProjectFolder().getItemDescription().getId());
|
FilesStorage filesStorage = new FilesStorage();
|
||||||
|
filesStorage.saveItemOnFolder(aslSession.getUsername(),
|
||||||
|
byteArrayInputStream, project.getProjectFolder()
|
||||||
|
.getItemDescription().getId());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Project readProject(ItemDescription newProjectFolder,
|
||||||
|
ASLSession aslSession) throws StatAlgoImporterServiceException {
|
||||||
|
FilesStorage filesStorage = new FilesStorage();
|
||||||
|
InputStream inputStream = filesStorage.retrieveProjectItemOnWorkspace(
|
||||||
|
aslSession.getUsername(), newProjectFolder.getId());
|
||||||
|
|
||||||
|
XMLDecoder xmlDecoder = new XMLDecoder(inputStream);
|
||||||
|
Project project = (Project) xmlDecoder.readObject();
|
||||||
|
xmlDecoder.close();
|
||||||
|
return project;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import java.util.List;
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public enum InputType {
|
public enum DataType {
|
||||||
STRING("String"),
|
STRING("String"),
|
||||||
NUMBER("Number"),
|
NUMBER("Number"),
|
||||||
ENUMERATED("Enumerated"),
|
ENUMERATED("Enumerated"),
|
||||||
|
@ -33,7 +33,7 @@ public enum InputType {
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
private InputType(String id) {
|
private DataType(String id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,8 +51,8 @@ public enum InputType {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static List<InputType> asList() {
|
public static List<DataType> asList() {
|
||||||
List<InputType> list = Arrays.asList(values());
|
List<DataType> list = Arrays.asList(values());
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ public class EnvironmentVariables implements Serializable {
|
||||||
private String name;
|
private String name;
|
||||||
private String description;
|
private String description;
|
||||||
private String defaultValue;
|
private String defaultValue;
|
||||||
private InputType inputType;
|
private DataType dataType;
|
||||||
|
|
||||||
public EnvironmentVariables() {
|
public EnvironmentVariables() {
|
||||||
super();
|
super();
|
||||||
|
@ -27,16 +27,16 @@ public class EnvironmentVariables implements Serializable {
|
||||||
* @param name
|
* @param name
|
||||||
* @param description
|
* @param description
|
||||||
* @param defaultValue
|
* @param defaultValue
|
||||||
* @param inputType
|
* @param dataType
|
||||||
*/
|
*/
|
||||||
public EnvironmentVariables(int id, String name, String description,
|
public EnvironmentVariables(int id, String name, String description,
|
||||||
String defaultValue, InputType inputType) {
|
String defaultValue, DataType dataType) {
|
||||||
super();
|
super();
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.defaultValue = defaultValue;
|
this.defaultValue = defaultValue;
|
||||||
this.inputType = inputType;
|
this.dataType = dataType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
|
@ -71,21 +71,20 @@ public class EnvironmentVariables implements Serializable {
|
||||||
this.defaultValue = defaultValue;
|
this.defaultValue = defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InputType getInputType() {
|
public DataType getDataType() {
|
||||||
return inputType;
|
return dataType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInputType(InputType inputType) {
|
public void setDataType(DataType dataType) {
|
||||||
this.inputType = inputType;
|
this.dataType = dataType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "EnvironmentVariables [id=" + id + ", name=" + name
|
return "EnvironmentVariables [id=" + id + ", name=" + name
|
||||||
+ ", description=" + description + ", defaultValue="
|
+ ", description=" + description + ", defaultValue="
|
||||||
+ defaultValue + ", inputType=" + inputType + "]";
|
+ defaultValue + ", dataType=" + dataType + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
package org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public enum IOType {
|
||||||
|
INPUT("Input"),
|
||||||
|
OUTPUT("Output");
|
||||||
|
|
||||||
|
|
||||||
|
//private static IOTypeMessages msgs=GWT.create(IOTypeMessages.class);
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
//private static List<String> inputTypeI18NList;
|
||||||
|
|
||||||
|
/*static {
|
||||||
|
ioTypeI18NList = new ArrayList<String>();
|
||||||
|
for (IOType iotype : values()) {
|
||||||
|
ioI18NList.add(msgs.ioType(iotype));
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
private IOType(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel(){
|
||||||
|
//return msgs.ioType(this);
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static List<IOType> asList() {
|
||||||
|
List<IOType> list = Arrays.asList(values());
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*public static List<String> asI18NList() {
|
||||||
|
return ioTypeI18NList;
|
||||||
|
|
||||||
|
}*/
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,95 @@
|
||||||
|
package org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author giancarlo email: <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SelectedRowsVariables implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -2519686355634242523L;
|
||||||
|
private int id;
|
||||||
|
private String name;
|
||||||
|
private String description;
|
||||||
|
private String defaultValue;
|
||||||
|
private DataType dataType;
|
||||||
|
private IOType ioType;
|
||||||
|
|
||||||
|
public SelectedRowsVariables() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public SelectedRowsVariables(int id, String name, String description,
|
||||||
|
String defaultValue, DataType dataType, IOType ioType) {
|
||||||
|
super();
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
this.description = description;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
this.dataType = dataType;
|
||||||
|
this.ioType = ioType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDefaultValue() {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDefaultValue(String defaultValue) {
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DataType getDataType() {
|
||||||
|
return dataType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataType(DataType dataType) {
|
||||||
|
this.dataType = dataType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IOType getIoType() {
|
||||||
|
return ioType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIoType(IOType ioType) {
|
||||||
|
this.ioType = ioType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "SelectedRowsVariables [id=" + id + ", name=" + name
|
||||||
|
+ ", description=" + description + ", defaultValue="
|
||||||
|
+ defaultValue + ", dataType=" + dataType + ", ioType="
|
||||||
|
+ ioType + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -4,6 +4,7 @@ import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.EnvironmentVariables;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.EnvironmentVariables;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.SelectedRowsVariables;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -11,19 +12,18 @@ import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.Enviro
|
||||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class InputVariables implements Serializable {
|
public class InputData implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -2405068429998054485L;
|
private static final long serialVersionUID = -2405068429998054485L;
|
||||||
private ArrayList<EnvironmentVariables> listEnvironmentVariables;
|
private ArrayList<EnvironmentVariables> listEnvironmentVariables;
|
||||||
private ArrayList<EnvironmentVariables> listSelectedRows;
|
private ArrayList<SelectedRowsVariables> listSelectedRows;
|
||||||
|
|
||||||
public InputVariables() {
|
public InputData() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public InputVariables(
|
public InputData(ArrayList<EnvironmentVariables> listEnvironmentVariables,
|
||||||
ArrayList<EnvironmentVariables> listEnvironmentVariables,
|
ArrayList<SelectedRowsVariables> listSelectedRows) {
|
||||||
ArrayList<EnvironmentVariables> listSelectedRows) {
|
|
||||||
super();
|
super();
|
||||||
this.listEnvironmentVariables = listEnvironmentVariables;
|
this.listEnvironmentVariables = listEnvironmentVariables;
|
||||||
this.listSelectedRows = listSelectedRows;
|
this.listSelectedRows = listSelectedRows;
|
||||||
|
@ -38,20 +38,23 @@ public class InputVariables implements Serializable {
|
||||||
this.listEnvironmentVariables = listEnvironmentVariables;
|
this.listEnvironmentVariables = listEnvironmentVariables;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<EnvironmentVariables> getListSelectedRows() {
|
public ArrayList<SelectedRowsVariables> getListSelectedRows() {
|
||||||
return listSelectedRows;
|
return listSelectedRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setListSelectedRows(
|
public void setListSelectedRows(
|
||||||
ArrayList<EnvironmentVariables> listSelectedRows) {
|
ArrayList<SelectedRowsVariables> listSelectedRows) {
|
||||||
this.listSelectedRows = listSelectedRows;
|
this.listSelectedRows = listSelectedRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "InputVariables [listEnvironmentVariables="
|
return "InputData [listEnvironmentVariables="
|
||||||
+ listEnvironmentVariables + ", listSelectedRows="
|
+ listEnvironmentVariables + ", listSelectedRows="
|
||||||
+ listSelectedRows + "]";
|
+ listSelectedRows + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -14,7 +14,7 @@ public class Project implements Serializable {
|
||||||
|
|
||||||
private ProjectFolder projectFolder;
|
private ProjectFolder projectFolder;
|
||||||
private MainCode mainCode;
|
private MainCode mainCode;
|
||||||
private InputVariables inputVariable;
|
private InputData inputData;
|
||||||
|
|
||||||
public Project(){
|
public Project(){
|
||||||
super();
|
super();
|
||||||
|
@ -42,18 +42,18 @@ public class Project implements Serializable {
|
||||||
this.projectFolder = projectFolder;
|
this.projectFolder = projectFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InputVariables getInputVariable() {
|
public InputData getInputData() {
|
||||||
return inputVariable;
|
return inputData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInputVariable(InputVariables inputVariable) {
|
public void setInputData(InputData inputData) {
|
||||||
this.inputVariable = inputVariable;
|
this.inputData = inputData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Project [projectFolder=" + projectFolder + ", mainCode="
|
return "Project [projectFolder=" + projectFolder + ", mainCode="
|
||||||
+ mainCode + ", inputVariable=" + inputVariable + "]";
|
+ mainCode + ", inputData=" + inputData + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue