ref 11724: SAI - Update to StorageHUB

https://support.d4science.org/issues/11724

Updated to StorageHub 

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/statistical-algorithms-importer@173900 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2018-10-30 19:39:04 +00:00
parent 6f3088490b
commit 5303a73d84
3 changed files with 73 additions and 105 deletions

View File

@ -106,11 +106,10 @@ public class GlobalVariablesPanel extends ContentPanel {
private void create(Project project) {
// Grid
GlobalVariablesProperties props = GWT
.create(GlobalVariablesProperties.class);
GlobalVariablesProperties props = GWT.create(GlobalVariablesProperties.class);
ColumnConfig<GlobalVariables, String> nameColumn = new ColumnConfig<GlobalVariables, String>(
props.name(), 100, "Name");
ColumnConfig<GlobalVariables, String> nameColumn = new ColumnConfig<GlobalVariables, String>(props.name(), 100,
"Name");
// nameColumn.setMenuDisabled(true);
ColumnConfig<GlobalVariables, String> descriptionColumn = new ColumnConfig<GlobalVariables, String>(
@ -123,10 +122,8 @@ public class GlobalVariablesPanel extends ContentPanel {
inputTypeColumn.setCell(new AbstractCell<DataType>() {
@Override
public void render(Context context, DataType inputType,
SafeHtmlBuilder sb) {
InputTypeTemplates inputTypeTemplates = GWT
.create(InputTypeTemplates.class);
public void render(Context context, DataType inputType, SafeHtmlBuilder sb) {
InputTypeTemplates inputTypeTemplates = GWT.create(InputTypeTemplates.class);
sb.append(inputTypeTemplates.format(inputType.getLabel()));
}
});
@ -141,23 +138,22 @@ public class GlobalVariablesPanel extends ContentPanel {
l.add(inputTypeColumn);
l.add(defaultValueColumn);
ColumnModel<GlobalVariables> columns = new ColumnModel<GlobalVariables>(
l);
ColumnModel<GlobalVariables> columns = new ColumnModel<GlobalVariables>(l);
storeGlobalVariable = new ListStore<GlobalVariables>(props.id());
if (project != null && project.getInputData() != null
&& project.getInputData().getListGlobalVariables() != null) {
storeGlobalVariable.addAll(project.getInputData()
.getListGlobalVariables());
storeGlobalVariable.addAll(project.getInputData().getListGlobalVariables());
seqGlobalVariables = project.getInputData().getListGlobalVariables().size();
} else {
seqGlobalVariables = 0;
}
final GridSelectionModel<GlobalVariables> sm = new GridSelectionModel<GlobalVariables>();
sm.setSelectionMode(SelectionMode.SINGLE);
gridGlobalVariable = new Grid<GlobalVariables>(storeGlobalVariable,
columns);
gridGlobalVariable = new Grid<GlobalVariables>(storeGlobalVariable, columns);
gridGlobalVariable.setSelectionModel(sm);
gridGlobalVariable.getView().setStripeRows(true);
gridGlobalVariable.getView().setColumnLines(true);
@ -167,36 +163,30 @@ public class GlobalVariablesPanel extends ContentPanel {
gridGlobalVariable.setColumnReordering(false);
// DND
GridDragSource<GlobalVariables> ds = new GridDragSource<GlobalVariables>(
gridGlobalVariable);
GridDragSource<GlobalVariables> ds = new GridDragSource<GlobalVariables>(gridGlobalVariable);
ds.addDragStartHandler(new DndDragStartEvent.DndDragStartHandler() {
@Override
public void onDragStart(DndDragStartEvent event) {
@SuppressWarnings("unchecked")
ArrayList<GlobalVariables> draggingSelection = (ArrayList<GlobalVariables>) event
.getData();
ArrayList<GlobalVariables> draggingSelection = (ArrayList<GlobalVariables>) event.getData();
Log.debug("Start Drag: " + draggingSelection);
}
});
GridDropTarget<GlobalVariables> dt = new GridDropTarget<GlobalVariables>(
gridGlobalVariable);
GridDropTarget<GlobalVariables> dt = new GridDropTarget<GlobalVariables>(gridGlobalVariable);
dt.setFeedback(Feedback.BOTH);
dt.setAllowSelfAsSource(true);
// EDITING //
// Key
DataTypePropertiesCombo inputTypePropertiesCombo = GWT
.create(DataTypePropertiesCombo.class);
DataTypePropertiesCombo inputTypePropertiesCombo = GWT.create(DataTypePropertiesCombo.class);
storeComboInputType = new ListStore<DataType>(
inputTypePropertiesCombo.id());
storeComboInputType = new ListStore<DataType>(inputTypePropertiesCombo.id());
comboInputType = new ComboBox<DataType>(storeComboInputType,
inputTypePropertiesCombo.label());
comboInputType = new ComboBox<DataType>(storeComboInputType, inputTypePropertiesCombo.label());
comboInputType.setClearValueOnParseError(false);
comboInputType.setEditable(false);
@ -205,23 +195,18 @@ public class GlobalVariablesPanel extends ContentPanel {
//
TextField nameColumnEditing = new TextField();
nameColumnEditing.addValidator(new RegExValidator("^[^\"]*$",
"Attention character \" is not allowed"));
nameColumnEditing.addValidator(new RegExValidator("^[^\"]*$", "Attention character \" is not allowed"));
TextField descriptionColumnEditing = new TextField();
descriptionColumnEditing.addValidator(new RegExValidator("^[^\"]*$",
"Attention character \" is not allowed"));
descriptionColumnEditing.addValidator(new RegExValidator("^[^\"]*$", "Attention character \" is not allowed"));
TextField defaultValueColumnEditing = new TextField();
defaultValueColumnEditing.addValidator(new RegExValidator("^[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*$",
"Attention character \" is not allowed"));
defaultValueColumnEditing.addValidator(
new RegExValidator("^[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*$", "Attention character \" is not allowed"));
gridGlobalVariableEditing = new GridRowEditing<GlobalVariables>(
gridGlobalVariable);
gridGlobalVariableEditing = new GridRowEditing<GlobalVariables>(gridGlobalVariable);
gridGlobalVariableEditing.addEditor(nameColumn, nameColumnEditing);
gridGlobalVariableEditing.addEditor(descriptionColumn,
descriptionColumnEditing);
gridGlobalVariableEditing.addEditor(descriptionColumn, descriptionColumnEditing);
gridGlobalVariableEditing.addEditor(inputTypeColumn, comboInputType);
gridGlobalVariableEditing.addEditor(defaultValueColumn,
defaultValueColumnEditing);
gridGlobalVariableEditing.addEditor(defaultValueColumn, defaultValueColumnEditing);
btnAdd = new TextButton("Add");
btnAdd.setIcon(StatAlgoImporterResources.INSTANCE.add16());
@ -268,8 +253,7 @@ public class GlobalVariablesPanel extends ContentPanel {
addStatus = false;
}
List<GlobalVariables> listSelected = storeGlobalVariable
.getAll();
List<GlobalVariables> listSelected = storeGlobalVariable.getAll();
List<GlobalVariables> listNewSelected = new ArrayList<GlobalVariables>();
for (int i = 0; i < listSelected.size(); i++) {
GlobalVariables var = listSelected.get(i);
@ -289,52 +273,45 @@ public class GlobalVariablesPanel extends ContentPanel {
ButtonBar buttonBar = gridGlobalVariableEditing.getButtonBar();
buttonBar.add(btnDelete);
gridGlobalVariableEditing
.addBeforeStartEditHandler(new BeforeStartEditHandler<GlobalVariables>() {
gridGlobalVariableEditing.addBeforeStartEditHandler(new BeforeStartEditHandler<GlobalVariables>() {
@Override
public void onBeforeStartEdit(
BeforeStartEditEvent<GlobalVariables> event) {
editingBeforeStart(event);
@Override
public void onBeforeStartEdit(BeforeStartEditEvent<GlobalVariables> event) {
editingBeforeStart(event);
}
});
gridGlobalVariableEditing.addCancelEditHandler(new CancelEditHandler<GlobalVariables>() {
@Override
public void onCancelEdit(CancelEditEvent<GlobalVariables> event) {
storeGlobalVariable.rejectChanges();
btnAdd.setEnabled(true);
}
});
gridGlobalVariableEditing.addCompleteEditHandler(new CompleteEditHandler<GlobalVariables>() {
@Override
public void onCompleteEdit(CompleteEditEvent<GlobalVariables> event) {
try {
if (addStatus) {
addStatus = false;
}
});
storeGlobalVariable.commitChanges();
gridGlobalVariableEditing
.addCancelEditHandler(new CancelEditHandler<GlobalVariables>() {
gridGlobalVariableEditing.getCancelButton().setVisible(true);
btnAdd.setEnabled(true);
@Override
public void onCancelEdit(
CancelEditEvent<GlobalVariables> event) {
storeGlobalVariable.rejectChanges();
btnAdd.setEnabled(true);
}
});
gridGlobalVariableEditing
.addCompleteEditHandler(new CompleteEditHandler<GlobalVariables>() {
@Override
public void onCompleteEdit(
CompleteEditEvent<GlobalVariables> event) {
try {
if (addStatus) {
addStatus = false;
}
storeGlobalVariable.commitChanges();
gridGlobalVariableEditing.getCancelButton()
.setVisible(true);
btnAdd.setEnabled(true);
} catch (Throwable e) {
Log.error("Error: " + e.getLocalizedMessage());
e.printStackTrace();
}
}
});
} catch (Throwable e) {
Log.error("Error: " + e.getLocalizedMessage());
e.printStackTrace();
}
}
});
ToolBar toolBar = new ToolBar();
toolBar.add(btnAdd, new BoxLayoutData(new Margins(0)));
@ -344,16 +321,14 @@ public class GlobalVariablesPanel extends ContentPanel {
vlc.setScrollMode(ScrollMode.NONE);
vlc.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
vlc.add(gridGlobalVariable,
new VerticalLayoutData(1, 1, new Margins(0)));
vlc.add(gridGlobalVariable, new VerticalLayoutData(1, 1, new Margins(0)));
add(vlc, new MarginData(new Margins(0)));
}
private void testGrid(SelectEvent event) {
final ConfirmMessageBox mb = new ConfirmMessageBox("Attention", ""
+ getGlobalVariables());
final ConfirmMessageBox mb = new ConfirmMessageBox("Attention", "" + getGlobalVariables());
mb.addDialogHideHandler(new DialogHideHandler() {
@Override
@ -387,8 +362,7 @@ public class GlobalVariablesPanel extends ContentPanel {
private void addGlobalVariable(SelectEvent event) {
try {
seqGlobalVariables++;
GlobalVariables newGlobalVariable = new GlobalVariables(seqGlobalVariables, "",
"", "", DataType.STRING);
GlobalVariables newGlobalVariable = new GlobalVariables(seqGlobalVariables, "", "", "", DataType.STRING);
Log.debug("New Global Variable: " + newGlobalVariable);
gridGlobalVariableEditing.cancelEditing();
addStatus = true;
@ -397,7 +371,7 @@ public class GlobalVariablesPanel extends ContentPanel {
int row = storeGlobalVariable.indexOf(newGlobalVariable);
storeComboInputType.clear();
storeComboInputType.addAll(DataType.asListForGlobalVariables());
storeComboInputType.commitChanges();
@ -411,8 +385,7 @@ public class GlobalVariablesPanel extends ContentPanel {
if (project != null && project.getInputData() != null
&& project.getInputData().getListGlobalVariables() != null) {
storeGlobalVariable.clear();
storeGlobalVariable.addAll(project.getInputData()
.getListGlobalVariables());
storeGlobalVariable.addAll(project.getInputData().getListGlobalVariables());
storeGlobalVariable.commitChanges();
seqGlobalVariables = project.getInputData().getListGlobalVariables().size();
@ -424,8 +397,7 @@ public class GlobalVariablesPanel extends ContentPanel {
}
public ArrayList<GlobalVariables> getGlobalVariables() {
ArrayList<GlobalVariables> listGlobalVarialbles = new ArrayList<>(
gridGlobalVariable.getStore().getAll());
ArrayList<GlobalVariables> listGlobalVarialbles = new ArrayList<>(gridGlobalVariable.getStore().getAll());
return listGlobalVarialbles;
}

View File

@ -118,14 +118,6 @@ public class InputOutputVariablesPanel extends ContentPanel {
}
private void create(Project project) {
if (project != null && project.getInputData() != null
&& project.getInputData().getListInputOutputVariables() != null) {
seqInputOutputVariables = project.getInputData().getListInputOutputVariables().size();
} else {
seqInputOutputVariables = 0;
}
Log.debug("List of I/O variables start at: " + seqInputOutputVariables);
// Grid
InputOutputVariablesProperties props = GWT.create(InputOutputVariablesProperties.class);
@ -188,8 +180,10 @@ public class InputOutputVariablesPanel extends ContentPanel {
if (project != null && project.getInputData() != null
&& project.getInputData().getListInputOutputVariables() != null) {
checkOutputParameterOnlyFileTypeIsSupported(project.getInputData().getListInputOutputVariables());
storeInputOutputVariables.addAll(project.getInputData().getListInputOutputVariables());
seqInputOutputVariables = project.getInputData().getListInputOutputVariables().size();
} else {
seqInputOutputVariables = 0;
}
final GridSelectionModel<InputOutputVariables> sm = new GridSelectionModel<InputOutputVariables>();
@ -523,8 +517,8 @@ public class InputOutputVariablesPanel extends ContentPanel {
try {
Log.debug("Current Seq: " + seqInputOutputVariables);
seqInputOutputVariables++;
InputOutputVariables newInputOutputVariablesVariable = new InputOutputVariables(seqInputOutputVariables, "", "", "",
DataType.STRING, IOType.INPUT, "");
InputOutputVariables newInputOutputVariablesVariable = new InputOutputVariables(seqInputOutputVariables, "",
"", "", DataType.STRING, IOType.INPUT, "");
Log.debug("New Input/Output Variable: " + newInputOutputVariablesVariable);
gridInputOutputVariablesEditing.cancelEditing();
addStatus = true;

View File

@ -318,7 +318,8 @@ public class InterpreterInfoPanel extends ContentPanel {
try {
Log.debug("Current Seq: " + seqInterpreterPackages);
seqInterpreterPackages++;
InterpreterPackageInfo newInterpreterPackageInfo = new InterpreterPackageInfo(seqInterpreterPackages, "", "", "");
InterpreterPackageInfo newInterpreterPackageInfo = new InterpreterPackageInfo(seqInterpreterPackages, "",
"", "");
Log.debug("New Interpreter Package Info: " + newInterpreterPackageInfo);
gridInterpreterPackageInfoEditing.cancelEditing();
addStatus = true;
@ -349,7 +350,8 @@ public class InterpreterInfoPanel extends ContentPanel {
storeInterpreterPackageInfo
.addAll(project.getInputData().getInterpreterInfo().getInterpreterPackagesInfo());
storeInterpreterPackageInfo.commitChanges();
seqInterpreterPackages = project.getInputData().getInterpreterInfo().getInterpreterPackagesInfo().size();
seqInterpreterPackages = project.getInputData().getInterpreterInfo().getInterpreterPackagesInfo()
.size();
} else {
storeInterpreterPackageInfo.clear();
storeInterpreterPackageInfo.commitChanges();