diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/GlobalVariablesPanel.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/GlobalVariablesPanel.java index 1fddabf..65eed66 100644 --- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/GlobalVariablesPanel.java +++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/GlobalVariablesPanel.java @@ -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 nameColumn = new ColumnConfig( - props.name(), 100, "Name"); + ColumnConfig nameColumn = new ColumnConfig(props.name(), 100, + "Name"); // nameColumn.setMenuDisabled(true); ColumnConfig descriptionColumn = new ColumnConfig( @@ -123,10 +122,8 @@ public class GlobalVariablesPanel extends ContentPanel { inputTypeColumn.setCell(new AbstractCell() { @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 columns = new ColumnModel( - l); + ColumnModel columns = new ColumnModel(l); storeGlobalVariable = new ListStore(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 sm = new GridSelectionModel(); sm.setSelectionMode(SelectionMode.SINGLE); - gridGlobalVariable = new Grid(storeGlobalVariable, - columns); + gridGlobalVariable = new Grid(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 ds = new GridDragSource( - gridGlobalVariable); + GridDragSource ds = new GridDragSource(gridGlobalVariable); ds.addDragStartHandler(new DndDragStartEvent.DndDragStartHandler() { @Override public void onDragStart(DndDragStartEvent event) { @SuppressWarnings("unchecked") - ArrayList draggingSelection = (ArrayList) event - .getData(); + ArrayList draggingSelection = (ArrayList) event.getData(); Log.debug("Start Drag: " + draggingSelection); } }); - GridDropTarget dt = new GridDropTarget( - gridGlobalVariable); + GridDropTarget dt = new GridDropTarget(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( - inputTypePropertiesCombo.id()); + storeComboInputType = new ListStore(inputTypePropertiesCombo.id()); - comboInputType = new ComboBox(storeComboInputType, - inputTypePropertiesCombo.label()); + comboInputType = new ComboBox(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( - gridGlobalVariable); + gridGlobalVariableEditing = new GridRowEditing(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 listSelected = storeGlobalVariable - .getAll(); + List listSelected = storeGlobalVariable.getAll(); List listNewSelected = new ArrayList(); 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() { + gridGlobalVariableEditing.addBeforeStartEditHandler(new BeforeStartEditHandler() { - @Override - public void onBeforeStartEdit( - BeforeStartEditEvent event) { - editingBeforeStart(event); + @Override + public void onBeforeStartEdit(BeforeStartEditEvent event) { + editingBeforeStart(event); + } + }); + + gridGlobalVariableEditing.addCancelEditHandler(new CancelEditHandler() { + + @Override + public void onCancelEdit(CancelEditEvent event) { + storeGlobalVariable.rejectChanges(); + btnAdd.setEnabled(true); + + } + + }); + + gridGlobalVariableEditing.addCompleteEditHandler(new CompleteEditHandler() { + + @Override + public void onCompleteEdit(CompleteEditEvent event) { + try { + if (addStatus) { + addStatus = false; } - }); + storeGlobalVariable.commitChanges(); - gridGlobalVariableEditing - .addCancelEditHandler(new CancelEditHandler() { + gridGlobalVariableEditing.getCancelButton().setVisible(true); + btnAdd.setEnabled(true); - @Override - public void onCancelEdit( - CancelEditEvent event) { - storeGlobalVariable.rejectChanges(); - btnAdd.setEnabled(true); - - } - - }); - - gridGlobalVariableEditing - .addCompleteEditHandler(new CompleteEditHandler() { - - @Override - public void onCompleteEdit( - CompleteEditEvent 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 getGlobalVariables() { - ArrayList listGlobalVarialbles = new ArrayList<>( - gridGlobalVariable.getStore().getAll()); + ArrayList listGlobalVarialbles = new ArrayList<>(gridGlobalVariable.getStore().getAll()); return listGlobalVarialbles; } diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/InputOutputVariablesPanel.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/InputOutputVariablesPanel.java index 9dac6aa..c77a627 100644 --- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/InputOutputVariablesPanel.java +++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/InputOutputVariablesPanel.java @@ -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 sm = new GridSelectionModel(); @@ -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; diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/InterpreterInfoPanel.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/InterpreterInfoPanel.java index cb441b0..603ffcc 100644 --- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/InterpreterInfoPanel.java +++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/InterpreterInfoPanel.java @@ -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();