1452: Implement a GUI for StatMan Algorithms Importer

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

Added DND on tables

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/statistical-algorithms-importer@122493 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2016-01-25 16:02:23 +00:00
parent 6bf37916c9
commit 84e0f110ed
5 changed files with 192 additions and 96 deletions

View File

@ -25,7 +25,12 @@ import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
import com.sencha.gxt.core.client.util.Margins; import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.data.shared.LabelProvider; import com.sencha.gxt.data.shared.LabelProvider;
import com.sencha.gxt.data.shared.ListStore; import com.sencha.gxt.data.shared.ListStore;
import com.sencha.gxt.dnd.core.client.DND.Feedback;
import com.sencha.gxt.dnd.core.client.DndDragStartEvent;
import com.sencha.gxt.dnd.core.client.GridDragSource;
import com.sencha.gxt.dnd.core.client.GridDropTarget;
import com.sencha.gxt.widget.core.client.ContentPanel; import com.sencha.gxt.widget.core.client.ContentPanel;
import com.sencha.gxt.widget.core.client.box.ConfirmMessageBox;
import com.sencha.gxt.widget.core.client.button.ButtonBar; import com.sencha.gxt.widget.core.client.button.ButtonBar;
import com.sencha.gxt.widget.core.client.button.TextButton; 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.BoxLayoutContainer.BoxLayoutData;
@ -33,11 +38,13 @@ import com.sencha.gxt.widget.core.client.container.MarginData;
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.BeforeStartEditEvent; import com.sencha.gxt.widget.core.client.event.BeforeStartEditEvent;
import com.sencha.gxt.widget.core.client.event.DialogHideEvent;
import com.sencha.gxt.widget.core.client.event.BeforeStartEditEvent.BeforeStartEditHandler; import com.sencha.gxt.widget.core.client.event.BeforeStartEditEvent.BeforeStartEditHandler;
import com.sencha.gxt.widget.core.client.event.CancelEditEvent; import com.sencha.gxt.widget.core.client.event.CancelEditEvent;
import com.sencha.gxt.widget.core.client.event.CancelEditEvent.CancelEditHandler; import com.sencha.gxt.widget.core.client.event.CancelEditEvent.CancelEditHandler;
import com.sencha.gxt.widget.core.client.event.CompleteEditEvent; import com.sencha.gxt.widget.core.client.event.CompleteEditEvent;
import com.sencha.gxt.widget.core.client.event.CompleteEditEvent.CompleteEditHandler; import com.sencha.gxt.widget.core.client.event.CompleteEditEvent.CompleteEditHandler;
import com.sencha.gxt.widget.core.client.event.DialogHideEvent.DialogHideHandler;
import com.sencha.gxt.widget.core.client.event.SelectEvent; import com.sencha.gxt.widget.core.client.event.SelectEvent;
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler; import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
import com.sencha.gxt.widget.core.client.form.ComboBox; import com.sencha.gxt.widget.core.client.form.ComboBox;
@ -70,7 +77,6 @@ public class GlobalVariablesPanel extends ContentPanel {
private ListStore<DataType> storeComboInputType; private ListStore<DataType> storeComboInputType;
private ComboBox<DataType> comboInputType; private ComboBox<DataType> comboInputType;
interface InputTypeTemplates extends XTemplates { interface InputTypeTemplates extends XTemplates {
@XTemplate("<span title=\"{value}\">{value}</span>") @XTemplate("<span title=\"{value}\">{value}</span>")
SafeHtml format(String value); SafeHtml format(String value);
@ -135,7 +141,8 @@ public class GlobalVariablesPanel extends ContentPanel {
l.add(inputTypeColumn); l.add(inputTypeColumn);
l.add(defaultValueColumn); l.add(defaultValueColumn);
ColumnModel<GlobalVariables> columns = new ColumnModel<GlobalVariables>(l); ColumnModel<GlobalVariables> columns = new ColumnModel<GlobalVariables>(
l);
storeGlobalVariable = new ListStore<GlobalVariables>(props.id()); storeGlobalVariable = new ListStore<GlobalVariables>(props.id());
@ -149,8 +156,8 @@ public class GlobalVariablesPanel extends ContentPanel {
final GridSelectionModel<GlobalVariables> sm = new GridSelectionModel<GlobalVariables>(); final GridSelectionModel<GlobalVariables> sm = new GridSelectionModel<GlobalVariables>();
sm.setSelectionMode(SelectionMode.SINGLE); sm.setSelectionMode(SelectionMode.SINGLE);
gridGlobalVariable = new Grid<GlobalVariables>( gridGlobalVariable = new Grid<GlobalVariables>(storeGlobalVariable,
storeGlobalVariable, columns); columns);
gridGlobalVariable.setSelectionModel(sm); gridGlobalVariable.setSelectionModel(sm);
gridGlobalVariable.getView().setStripeRows(true); gridGlobalVariable.getView().setStripeRows(true);
gridGlobalVariable.getView().setColumnLines(true); gridGlobalVariable.getView().setColumnLines(true);
@ -159,21 +166,25 @@ public class GlobalVariablesPanel extends ContentPanel {
gridGlobalVariable.setBorders(false); gridGlobalVariable.setBorders(false);
gridGlobalVariable.setColumnReordering(false); gridGlobalVariable.setColumnReordering(false);
/* // DND
* GridDragSource<GlobalVariables> ds = new GridDragSource<GlobalVariables> ds = new GridDragSource<GlobalVariables>(
* GridDragSource<GlobalVariables>( gridGlobalVariable); gridGlobalVariable);
* ds.addDragStartHandler(new DndDragStartHandler() { ds.addDragStartHandler(new DndDragStartEvent.DndDragStartHandler() {
*
* @Override public void onDragStart(DndDragStartEvent event) { @Override
* public void onDragStart(DndDragStartEvent event) {
* @SuppressWarnings("unchecked") ArrayList<GlobalVariables> @SuppressWarnings("unchecked")
* draggingSelection = (ArrayList<GlobalVariables>) event ArrayList<GlobalVariables> draggingSelection = (ArrayList<GlobalVariables>) event
* .getData(); Log.debug("Start Drag: " + draggingSelection); .getData();
* Log.debug("Start Drag: " + draggingSelection);
* } }); GridDropTarget<GlobalVariables> dt = new
* GridDropTarget<GlobalVariables>( gridGlobalVariable); }
* dt.setFeedback(Feedback.BOTH); dt.setAllowSelfAsSource(true); });
*/
GridDropTarget<GlobalVariables> dt = new GridDropTarget<GlobalVariables>(
gridGlobalVariable);
dt.setFeedback(Feedback.BOTH);
dt.setAllowSelfAsSource(true);
// EDITING // // EDITING //
// Key // Key
@ -208,8 +219,7 @@ public class GlobalVariablesPanel extends ContentPanel {
gridGlobalVariableEditing.addEditor(nameColumn, nameColumnEditing); gridGlobalVariableEditing.addEditor(nameColumn, nameColumnEditing);
gridGlobalVariableEditing.addEditor(descriptionColumn, gridGlobalVariableEditing.addEditor(descriptionColumn,
descriptionColumnEditing); descriptionColumnEditing);
gridGlobalVariableEditing.addEditor(inputTypeColumn, gridGlobalVariableEditing.addEditor(inputTypeColumn, comboInputType);
comboInputType);
gridGlobalVariableEditing.addEditor(defaultValueColumn, gridGlobalVariableEditing.addEditor(defaultValueColumn,
defaultValueColumnEditing); defaultValueColumnEditing);
@ -227,6 +237,20 @@ public class GlobalVariablesPanel extends ContentPanel {
}); });
TextButton btnTest = new TextButton("Test");
btnTest.setIcon(StatAlgoImporterResources.INSTANCE.add16());
btnTest.setScale(ButtonScale.SMALL);
btnTest.setIconAlign(IconAlign.LEFT);
btnTest.setToolTip("Test");
btnTest.addSelectHandler(new SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
testGrid(event);
}
});
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) {
@ -238,17 +262,17 @@ public class GlobalVariablesPanel extends ContentPanel {
storeGlobalVariable.remove(rowIndex); storeGlobalVariable.remove(rowIndex);
storeGlobalVariable.commitChanges(); storeGlobalVariable.commitChanges();
gridGlobalVariableEditing.getCancelButton().setVisible( gridGlobalVariableEditing.getCancelButton().setVisible(true);
true);
btnAdd.setEnabled(true); btnAdd.setEnabled(true);
if (addStatus) { if (addStatus) {
addStatus = false; addStatus = false;
} }
List<GlobalVariables> listSelected=storeGlobalVariable.getAll(); List<GlobalVariables> listSelected = storeGlobalVariable
List<GlobalVariables> listNewSelected= new ArrayList<GlobalVariables>(); .getAll();
for(int i=0; i<listSelected.size(); i++){ List<GlobalVariables> listNewSelected = new ArrayList<GlobalVariables>();
GlobalVariables var=listSelected.get(i); for (int i = 0; i < listSelected.size(); i++) {
GlobalVariables var = listSelected.get(i);
var.setId(i); var.setId(i);
listNewSelected.add(var); listNewSelected.add(var);
} }
@ -257,8 +281,8 @@ public class GlobalVariablesPanel extends ContentPanel {
storeGlobalVariable.addAll(listNewSelected); storeGlobalVariable.addAll(listNewSelected);
storeGlobalVariable.commitChanges(); storeGlobalVariable.commitChanges();
seq=listNewSelected.size(); seq = listNewSelected.size();
Log.debug("Current Seq: "+seq); Log.debug("Current Seq: " + seq);
} }
}); });
@ -306,8 +330,7 @@ public class GlobalVariablesPanel extends ContentPanel {
btnAdd.setEnabled(true); btnAdd.setEnabled(true);
} catch (Throwable e) { } catch (Throwable e) {
Log.error("Error: " Log.error("Error: " + e.getLocalizedMessage());
+ e.getLocalizedMessage());
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -321,13 +344,36 @@ public class GlobalVariablesPanel extends ContentPanel {
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(gridGlobalVariable, new VerticalLayoutData(1, 1, vlc.add(gridGlobalVariable,
new Margins(0))); new VerticalLayoutData(1, 1, new Margins(0)));
add(vlc, new MarginData(new Margins(0))); add(vlc, new MarginData(new Margins(0)));
} }
private void testGrid(SelectEvent event) {
final ConfirmMessageBox mb = new ConfirmMessageBox("Attention", ""
+ getGlobalVariables());
mb.addDialogHideHandler(new DialogHideHandler() {
@Override
public void onDialogHide(DialogHideEvent event) {
switch (event.getHideButton()) {
case NO:
break;
case YES:
break;
default:
break;
}
}
});
mb.setWidth(300);
mb.show();
}
private void editingBeforeStart(BeforeStartEditEvent<GlobalVariables> event) { private void editingBeforeStart(BeforeStartEditEvent<GlobalVariables> event) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
@ -364,14 +410,15 @@ public class GlobalVariablesPanel extends ContentPanel {
if (project != null && project.getInputData() != null if (project != null && project.getInputData() != null
&& project.getInputData().getListGlobalVariables() != null) { && project.getInputData().getListGlobalVariables() != null) {
storeGlobalVariable.clear(); storeGlobalVariable.clear();
storeGlobalVariable.addAll(project.getInputData().getListGlobalVariables()); storeGlobalVariable.addAll(project.getInputData()
.getListGlobalVariables());
storeGlobalVariable.commitChanges(); storeGlobalVariable.commitChanges();
seq = project.getInputData().getListGlobalVariables().size(); seq = project.getInputData().getListGlobalVariables().size();
} else { } else {
storeGlobalVariable.clear(); storeGlobalVariable.clear();
storeGlobalVariable.commitChanges(); storeGlobalVariable.commitChanges();
seq=0; seq = 0;
} }
} }

View File

@ -25,6 +25,10 @@ import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
import com.sencha.gxt.core.client.util.Margins; import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.data.shared.LabelProvider; import com.sencha.gxt.data.shared.LabelProvider;
import com.sencha.gxt.data.shared.ListStore; import com.sencha.gxt.data.shared.ListStore;
import com.sencha.gxt.dnd.core.client.DND.Feedback;
import com.sencha.gxt.dnd.core.client.DndDragStartEvent;
import com.sencha.gxt.dnd.core.client.GridDragSource;
import com.sencha.gxt.dnd.core.client.GridDropTarget;
import com.sencha.gxt.widget.core.client.ContentPanel; import com.sencha.gxt.widget.core.client.ContentPanel;
import com.sencha.gxt.widget.core.client.button.ButtonBar; import com.sencha.gxt.widget.core.client.button.ButtonBar;
import com.sencha.gxt.widget.core.client.button.TextButton; import com.sencha.gxt.widget.core.client.button.TextButton;
@ -195,24 +199,25 @@ public class InputOutputVariablesPanel extends ContentPanel {
gridInputOutputVariables.setBorders(false); gridInputOutputVariables.setBorders(false);
gridInputOutputVariables.setColumnReordering(false); gridInputOutputVariables.setColumnReordering(false);
/* // DND
* GridDragSource<InputOutputVariablesVariables> ds = new GridDragSource<InputOutputVariables> ds = new GridDragSource<InputOutputVariables>(
* GridDragSource<InputOutputVariablesVariables>( gridInputOutputVariables);
* gridEnvironmentVariable); ds.addDragStartHandler(new ds.addDragStartHandler(new DndDragStartEvent.DndDragStartHandler() {
* DndDragStartHandler() {
* @Override
* @Override public void onDragStart(DndDragStartEvent event) { public void onDragStart(DndDragStartEvent event) {
* @SuppressWarnings("unchecked")
* @SuppressWarnings("unchecked") ArrayList<InputOutputVariables> draggingSelection = (ArrayList<InputOutputVariables>) event
* ArrayList<InputOutputVariablesVariables> draggingSelection = .getData();
* (ArrayList<InputOutputVariablesVariables>) event .getData(); Log.debug("Start Drag: " + draggingSelection);
* Log.debug("Start Drag: " + draggingSelection);
* }
* } }); GridDropTarget<InputOutputVariablesVariables> dt = new });
* GridDropTarget<InputOutputVariablesVariables>(
* gridEnvironmentVariable); dt.setFeedback(Feedback.BOTH); GridDropTarget<InputOutputVariables> dt = new GridDropTarget<InputOutputVariables>(
* dt.setAllowSelfAsSource(true); gridInputOutputVariables);
*/ dt.setFeedback(Feedback.BOTH);
dt.setAllowSelfAsSource(true);
// EDITING // // EDITING //

View File

@ -16,6 +16,10 @@ import com.sencha.gxt.core.client.Style.SelectionMode;
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode; import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
import com.sencha.gxt.core.client.util.Margins; import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.data.shared.ListStore; import com.sencha.gxt.data.shared.ListStore;
import com.sencha.gxt.dnd.core.client.DND.Feedback;
import com.sencha.gxt.dnd.core.client.DndDragStartEvent;
import com.sencha.gxt.dnd.core.client.GridDragSource;
import com.sencha.gxt.dnd.core.client.GridDropTarget;
import com.sencha.gxt.widget.core.client.ContentPanel; import com.sencha.gxt.widget.core.client.ContentPanel;
import com.sencha.gxt.widget.core.client.button.ButtonBar; import com.sencha.gxt.widget.core.client.button.ButtonBar;
import com.sencha.gxt.widget.core.client.button.TextButton; import com.sencha.gxt.widget.core.client.button.TextButton;
@ -140,18 +144,38 @@ public class InterpreterInfoPanel extends ContentPanel {
gridInterpreterPackageInfo.setBorders(false); gridInterpreterPackageInfo.setBorders(false);
gridInterpreterPackageInfo.setColumnReordering(false); gridInterpreterPackageInfo.setColumnReordering(false);
// DND
GridDragSource<InterpreterPackageInfo> ds = new GridDragSource<InterpreterPackageInfo>(
gridInterpreterPackageInfo);
ds.addDragStartHandler(new DndDragStartEvent.DndDragStartHandler() {
@Override
public void onDragStart(DndDragStartEvent event) {
@SuppressWarnings("unchecked")
ArrayList<InterpreterPackageInfo> draggingSelection = (ArrayList<InterpreterPackageInfo>) event
.getData();
Log.debug("Start Drag: " + draggingSelection);
}
});
GridDropTarget<InterpreterPackageInfo> dt = new GridDropTarget<InterpreterPackageInfo>(
gridInterpreterPackageInfo);
dt.setFeedback(Feedback.BOTH);
dt.setAllowSelfAsSource(true);
// EDITING // // EDITING //
TextField nameColumnEditing=new TextField(); TextField nameColumnEditing = new TextField();
nameColumnEditing.addValidator(new RegExValidator("^[^\"]*$", nameColumnEditing.addValidator(new RegExValidator("^[^\"]*$",
"Attention character \" is not allowed")); "Attention character \" is not allowed"));
TextField versionColumnEditing=new TextField(); TextField versionColumnEditing = new TextField();
versionColumnEditing.addValidator(new RegExValidator("^[^\"]*$", versionColumnEditing.addValidator(new RegExValidator("^[^\"]*$",
"Attention character \" is not allowed")); "Attention character \" is not allowed"));
gridInterpreterPackageInfoEditing = new GridRowEditing<InterpreterPackageInfo>( gridInterpreterPackageInfoEditing = new GridRowEditing<InterpreterPackageInfo>(
gridInterpreterPackageInfo); gridInterpreterPackageInfo);
gridInterpreterPackageInfoEditing gridInterpreterPackageInfoEditing.addEditor(nameColumn,
.addEditor(nameColumn, nameColumnEditing); nameColumnEditing);
gridInterpreterPackageInfoEditing.addEditor(versionColumn, gridInterpreterPackageInfoEditing.addEditor(versionColumn,
versionColumnEditing); versionColumnEditing);
@ -364,7 +388,8 @@ public class InterpreterInfoPanel extends ContentPanel {
storeInterpreterPackageInfo.addAll(project.getInputData() storeInterpreterPackageInfo.addAll(project.getInputData()
.getInterpreterInfo().getInterpreterPackagesInfo()); .getInterpreterInfo().getInterpreterPackagesInfo());
storeInterpreterPackageInfo.commitChanges(); storeInterpreterPackageInfo.commitChanges();
seq = project.getInputData().getInterpreterInfo().getInterpreterPackagesInfo().size(); seq = project.getInputData().getInterpreterInfo()
.getInterpreterPackagesInfo().size();
} else { } else {
seq = 0; seq = 0;
} }

View File

@ -20,6 +20,10 @@ import com.sencha.gxt.core.client.Style.SelectionMode;
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode; import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
import com.sencha.gxt.core.client.util.Margins; import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.data.shared.ListStore; import com.sencha.gxt.data.shared.ListStore;
import com.sencha.gxt.dnd.core.client.DND.Feedback;
import com.sencha.gxt.dnd.core.client.DndDragStartEvent;
import com.sencha.gxt.dnd.core.client.GridDragSource;
import com.sencha.gxt.dnd.core.client.GridDropTarget;
import com.sencha.gxt.widget.core.client.ContentPanel; import com.sencha.gxt.widget.core.client.ContentPanel;
import com.sencha.gxt.widget.core.client.button.ButtonBar; import com.sencha.gxt.widget.core.client.button.ButtonBar;
import com.sencha.gxt.widget.core.client.button.TextButton; import com.sencha.gxt.widget.core.client.button.TextButton;
@ -112,19 +116,17 @@ public class ProjectInfoPanel extends ContentPanel {
algorithmDescription.setEmptyText("Enter description..."); algorithmDescription.setEmptyText("Enter description...");
algorithmDescription.addValidator(new RegExValidator("^[^\"]*$", algorithmDescription.addValidator(new RegExValidator("^[^\"]*$",
"Attention character \" is not allowed")); "Attention character \" is not allowed"));
FieldLabel descriptionLabel = new FieldLabel( FieldLabel descriptionLabel = new FieldLabel(algorithmDescription,
algorithmDescription, "Description"); "Description");
descriptionLabel.setLabelWidth(LABAEL_WIDTH); descriptionLabel.setLabelWidth(LABAEL_WIDTH);
// Grid // Grid
RequestedVREProperties props = GWT RequestedVREProperties props = GWT.create(RequestedVREProperties.class);
.create(RequestedVREProperties.class);
ColumnConfig<RequestedVRE, String> nameColumn = new ColumnConfig<RequestedVRE, String>( ColumnConfig<RequestedVRE, String> nameColumn = new ColumnConfig<RequestedVRE, String>(
props.name(), 100, "Name"); props.name(), 100, "Name");
// nameColumn.setMenuDisabled(true); // nameColumn.setMenuDisabled(true);
ColumnConfig<RequestedVRE, String> descriptionColumn = new ColumnConfig<RequestedVRE, String>( ColumnConfig<RequestedVRE, String> descriptionColumn = new ColumnConfig<RequestedVRE, String>(
props.description(), 100, "Description"); props.description(), 100, "Description");
// descriptionColumn.setMenuDisabled(true); // descriptionColumn.setMenuDisabled(true);
@ -171,19 +173,39 @@ public class ProjectInfoPanel extends ContentPanel {
gridRequestedVRE.setBorders(false); gridRequestedVRE.setBorders(false);
gridRequestedVRE.setColumnReordering(false); gridRequestedVRE.setColumnReordering(false);
// DND
GridDragSource<RequestedVRE> ds = new GridDragSource<RequestedVRE>(
gridRequestedVRE);
ds.addDragStartHandler(new DndDragStartEvent.DndDragStartHandler() {
@Override
public void onDragStart(DndDragStartEvent event) {
@SuppressWarnings("unchecked")
ArrayList<RequestedVRE> draggingSelection = (ArrayList<RequestedVRE>) event
.getData();
Log.debug("Start Drag: " + draggingSelection);
}
});
GridDropTarget<RequestedVRE> dt = new GridDropTarget<RequestedVRE>(
gridRequestedVRE);
dt.setFeedback(Feedback.BOTH);
dt.setAllowSelfAsSource(true);
// EDITING // // EDITING //
TextField nameColumnEditing=new TextField(); TextField nameColumnEditing = new TextField();
nameColumnEditing.addValidator(new RegExValidator("^[^\"]*$", nameColumnEditing.addValidator(new RegExValidator("^[^\"]*$",
"Attention character \" is not allowed")); "Attention character \" is not allowed"));
TextField descriptionColumnEditing=new TextField(); TextField descriptionColumnEditing = new TextField();
descriptionColumnEditing.addValidator(new RegExValidator("^[^\"]*$", descriptionColumnEditing.addValidator(new RegExValidator("^[^\"]*$",
"Attention character \" is not allowed")); "Attention character \" is not allowed"));
gridRequestedVREEditing = new GridRowEditing<RequestedVRE>( gridRequestedVREEditing = new GridRowEditing<RequestedVRE>(
gridRequestedVRE); gridRequestedVRE);
gridRequestedVREEditing.addEditor(nameColumn, nameColumnEditing); gridRequestedVREEditing.addEditor(nameColumn, nameColumnEditing);
gridRequestedVREEditing.addEditor(descriptionColumn, descriptionColumnEditing); gridRequestedVREEditing.addEditor(descriptionColumn,
descriptionColumnEditing);
btnAdd = new TextButton("Add"); btnAdd = new TextButton("Add");
btnAdd.setIcon(StatAlgoImporterResources.INSTANCE.add16()); btnAdd.setIcon(StatAlgoImporterResources.INSTANCE.add16());
@ -251,8 +273,7 @@ public class ProjectInfoPanel extends ContentPanel {
.addCancelEditHandler(new CancelEditHandler<RequestedVRE>() { .addCancelEditHandler(new CancelEditHandler<RequestedVRE>() {
@Override @Override
public void onCancelEdit( public void onCancelEdit(CancelEditEvent<RequestedVRE> event) {
CancelEditEvent<RequestedVRE> event) {
storeRequestedVRE.rejectChanges(); storeRequestedVRE.rejectChanges();
btnAdd.setEnabled(true); btnAdd.setEnabled(true);
@ -295,10 +316,9 @@ public class ProjectInfoPanel extends ContentPanel {
vlc.setScrollMode(ScrollMode.NONE); vlc.setScrollMode(ScrollMode.NONE);
vlc.add(nameLabel, new VerticalLayoutData(1, -1, new Margins(0))); vlc.add(nameLabel, new VerticalLayoutData(1, -1, new Margins(0)));
vlc.add(descriptionLabel, new VerticalLayoutData(1, -1, vlc.add(descriptionLabel, new VerticalLayoutData(1, -1, new Margins(0)));
new Margins(0))); vlc.add(requestedVRELabel,
vlc.add(requestedVRELabel, new VerticalLayoutData(1, -1, new VerticalLayoutData(1, -1, new Margins(0)));
new Margins(0)));
vlc.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0))); vlc.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
vlc.add(gridRequestedVRE, new VerticalLayoutData(1, 1, new Margins(0))); vlc.add(gridRequestedVRE, new VerticalLayoutData(1, 1, new Margins(0)));
@ -356,8 +376,7 @@ public class ProjectInfoPanel extends ContentPanel {
private void addRequestedVRE(SelectEvent event) { private void addRequestedVRE(SelectEvent event) {
try { try {
seq++; seq++;
RequestedVRE newRequestedVRE = new RequestedVRE(seq, "", RequestedVRE newRequestedVRE = new RequestedVRE(seq, "", "");
"");
Log.debug("New RequestedVRE: " + newRequestedVRE); Log.debug("New RequestedVRE: " + newRequestedVRE);
gridRequestedVREEditing.cancelEditing(); gridRequestedVREEditing.cancelEditing();
addStatus = true; addStatus = true;

View File

@ -25,7 +25,6 @@ import org.gcube.common.homelibrary.home.workspace.exceptions.WrongItemTypeExcep
import org.gcube.common.homelibrary.home.workspace.folder.FolderItem; import org.gcube.common.homelibrary.home.workspace.folder.FolderItem;
import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalFile; import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalFile;
import org.gcube.common.homelibrary.util.zip.ZipUtil; import org.gcube.common.homelibrary.util.zip.ZipUtil;
import org.gcube.contentmanager.storageclient.model.protocol.smp.SMPUrl;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterServiceException; import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterServiceException;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -398,7 +397,6 @@ public class FilesStorage {
} }
} }
/** /**
* *
* @param user * @param user
@ -406,8 +404,8 @@ public class FilesStorage {
* @return * @return
* @throws StatAlgoImporterServiceException * @throws StatAlgoImporterServiceException
*/ */
public boolean existProjectItemOnWorkspace(String user, public boolean existProjectItemOnWorkspace(String user, String folderId)
String folderId) throws StatAlgoImporterServiceException { throws StatAlgoImporterServiceException {
Workspace ws; Workspace ws;
try { try {
ws = HomeLibrary.getUserWorkspace(user); ws = HomeLibrary.getUserWorkspace(user);
@ -435,7 +433,6 @@ public class FilesStorage {
} }
} }
/** /**
* *
* @param user * @param user
@ -504,6 +501,9 @@ public class FilesStorage {
try { try {
org.gcube.common.homelibrary.home.workspace.folder.items.File gcubeItem = ((org.gcube.common.homelibrary.home.workspace.folder.items.File) wi); org.gcube.common.homelibrary.home.workspace.folder.items.File gcubeItem = ((org.gcube.common.homelibrary.home.workspace.folder.items.File) wi);
is=gcubeItem.getData();
/*
SMPUrl smsHome = new SMPUrl(gcubeItem.getPublicLink()); SMPUrl smsHome = new SMPUrl(gcubeItem.getPublicLink());
logger.debug("smsHome: [host:" + smsHome.getHost() + " path:" logger.debug("smsHome: [host:" + smsHome.getHost() + " path:"
@ -512,7 +512,7 @@ public class FilesStorage {
URLConnection uc = null; URLConnection uc = null;
uc = (URLConnection) smsHome.openConnection(); uc = (URLConnection) smsHome.openConnection();
is = uc.getInputStream(); is = uc.getInputStream();
*/
} catch (Exception e) { } catch (Exception e) {
logger.error("Error retrieving file from storage", e); logger.error("Error retrieving file from storage", e);
e.printStackTrace(); e.printStackTrace();