1452: Implement a GUI for StatMan Algorithms Importer
Task-Url: https://support.d4science.org/issues/1452 Added Interpreter Informations git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/statistical-algorithms-importer@122142 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
cbb59e97e2
commit
89bb818699
|
@ -0,0 +1,24 @@
|
||||||
|
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InterpreterPackageInfo;
|
||||||
|
|
||||||
|
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 InterpreterPackageInfoProperties extends
|
||||||
|
PropertyAccess<InterpreterPackageInfo> {
|
||||||
|
|
||||||
|
ModelKeyProvider<InterpreterPackageInfo> id();
|
||||||
|
|
||||||
|
ValueProvider<InterpreterPackageInfo, String> name();
|
||||||
|
|
||||||
|
ValueProvider<InterpreterPackageInfo, String> version();
|
||||||
|
|
||||||
|
}
|
|
@ -293,7 +293,7 @@ public class EnvironmentVariablesPanel extends ContentPanel {
|
||||||
btnAdd.setEnabled(true);
|
btnAdd.setEnabled(true);
|
||||||
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Log.error("Error in RuleOnTableNewDefinitionCard: "
|
Log.error("Error: "
|
||||||
+ e.getLocalizedMessage());
|
+ e.getLocalizedMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,11 +12,13 @@ public interface InputVariableMessages extends Messages {
|
||||||
|
|
||||||
//
|
//
|
||||||
@DefaultMessage("Selected Rows")
|
@DefaultMessage("Selected Rows")
|
||||||
String selectedRowsItem();
|
String selectedRows();
|
||||||
|
|
||||||
@DefaultMessage("Enviroment Variables")
|
@DefaultMessage("Enviroment Variables")
|
||||||
String environmentVariables();
|
String environmentVariables();
|
||||||
|
|
||||||
|
@DefaultMessage("Interpreter")
|
||||||
|
String interpreterInfo();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -24,6 +24,7 @@ public class InputVariableTabPanel extends TabPanel {
|
||||||
private EventBus eventBus;
|
private EventBus eventBus;
|
||||||
private EnvironmentVariablesPanel enviromentVariablesPanel;
|
private EnvironmentVariablesPanel enviromentVariablesPanel;
|
||||||
private SelectedRowsPanel selectedRowsPanel;
|
private SelectedRowsPanel selectedRowsPanel;
|
||||||
|
private InterpreterInfoPanel interpreterInfoPanel;
|
||||||
|
|
||||||
public InputVariableTabPanel(EventBus eventBus,
|
public InputVariableTabPanel(EventBus eventBus,
|
||||||
InputVariablePanel toolBoxPanel) {
|
InputVariablePanel toolBoxPanel) {
|
||||||
|
@ -34,8 +35,8 @@ public class InputVariableTabPanel extends TabPanel {
|
||||||
init();
|
init();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void init(){
|
protected void init() {
|
||||||
setId("InputVariableTabPanel");
|
setId("InputVariableTabPanel");
|
||||||
setBodyBorder(false);
|
setBodyBorder(false);
|
||||||
setBorders(false);
|
setBorders(false);
|
||||||
|
@ -48,7 +49,7 @@ public class InputVariableTabPanel extends TabPanel {
|
||||||
Log.debug("Start InputVariable Tabs");
|
Log.debug("Start InputVariable Tabs");
|
||||||
addEnvironmentVariablesPanel(project);
|
addEnvironmentVariablesPanel(project);
|
||||||
addSelectedRowsPanel(project);
|
addSelectedRowsPanel(project);
|
||||||
|
addInterpreterInfoPanel(project);
|
||||||
setActiveWidget(getWidget(0));
|
setActiveWidget(getWidget(0));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -83,15 +84,15 @@ public class InputVariableTabPanel extends TabPanel {
|
||||||
+ e.getLocalizedMessage());
|
+ e.getLocalizedMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void updateTabs(Project project) {
|
public void updateTabs(Project project) {
|
||||||
try {
|
try {
|
||||||
enviromentVariablesPanel.update(project);
|
enviromentVariablesPanel.update(project);
|
||||||
selectedRowsPanel.update(project);
|
selectedRowsPanel.update(project);
|
||||||
|
interpreterInfoPanel.update(project);
|
||||||
|
|
||||||
forceLayout();
|
forceLayout();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Log.error("Error in InputVariableTabPanel: "
|
Log.error("Error in InputVariableTabPanel: "
|
||||||
|
@ -112,6 +113,11 @@ public class InputVariableTabPanel extends TabPanel {
|
||||||
.getSelectedRows());
|
.getSelectedRows());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (interpreterInfoPanel != null) {
|
||||||
|
inputVariables.setInterpreterInfo(interpreterInfoPanel
|
||||||
|
.getInterpreterInfo());
|
||||||
|
}
|
||||||
|
|
||||||
InputSaveReadyEvent inputSaveReadyEvent = new InputSaveReadyEvent(
|
InputSaveReadyEvent inputSaveReadyEvent = new InputSaveReadyEvent(
|
||||||
inputVariables);
|
inputVariables);
|
||||||
eventBus.fireEvent(inputSaveReadyEvent);
|
eventBus.fireEvent(inputSaveReadyEvent);
|
||||||
|
@ -122,7 +128,7 @@ public class InputVariableTabPanel extends TabPanel {
|
||||||
// Add
|
// Add
|
||||||
private void addSelectedRowsPanel(Project project) {
|
private void addSelectedRowsPanel(Project project) {
|
||||||
TabItemConfig selectedRowsPanelItemConf = new TabItemConfig(
|
TabItemConfig selectedRowsPanelItemConf = new TabItemConfig(
|
||||||
msgs.selectedRowsItem(), false);
|
msgs.selectedRows(), false);
|
||||||
|
|
||||||
selectedRowsPanel = new SelectedRowsPanel(project, eventBus);
|
selectedRowsPanel = new SelectedRowsPanel(project, eventBus);
|
||||||
selectedRowsPanel.setHeaderVisible(false);
|
selectedRowsPanel.setHeaderVisible(false);
|
||||||
|
@ -134,19 +140,27 @@ public class InputVariableTabPanel extends TabPanel {
|
||||||
TabItemConfig enviromentVariablePanelItemConf = new TabItemConfig(
|
TabItemConfig enviromentVariablePanelItemConf = new TabItemConfig(
|
||||||
msgs.environmentVariables(), false);
|
msgs.environmentVariables(), false);
|
||||||
|
|
||||||
enviromentVariablesPanel = new EnvironmentVariablesPanel(project, eventBus);
|
enviromentVariablesPanel = new EnvironmentVariablesPanel(project,
|
||||||
|
eventBus);
|
||||||
enviromentVariablesPanel.setHeaderVisible(false);
|
enviromentVariablesPanel.setHeaderVisible(false);
|
||||||
add(enviromentVariablesPanel, enviromentVariablePanelItemConf);
|
add(enviromentVariablesPanel, enviromentVariablePanelItemConf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addInterpreterInfoPanel(Project project) {
|
||||||
|
TabItemConfig interpreterInfoPanelItemConf = new TabItemConfig(
|
||||||
|
msgs.interpreterInfo(), false);
|
||||||
|
|
||||||
|
interpreterInfoPanel = new InterpreterInfoPanel(project, eventBus);
|
||||||
|
interpreterInfoPanel.setHeaderVisible(false);
|
||||||
|
add(interpreterInfoPanel, interpreterInfoPanelItemConf);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void addSelectedRowsVariable(
|
public void addSelectedRowsVariable(
|
||||||
SelectedRowsVariables selectedRowsVariable) {
|
SelectedRowsVariables selectedRowsVariable) {
|
||||||
setActiveWidget(selectedRowsPanel);
|
setActiveWidget(selectedRowsPanel);
|
||||||
selectedRowsPanel.addNewSelectedRowsVariable(selectedRowsVariable);
|
selectedRowsPanel.addNewSelectedRowsVariable(selectedRowsVariable);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,381 @@
|
||||||
|
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools.input;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties.InterpreterPackageInfoProperties;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.resource.StatAlgoImporterResources;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InterpreterInfo;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InterpreterPackageInfo;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
||||||
|
|
||||||
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.event.shared.EventBus;
|
||||||
|
import com.sencha.gxt.core.client.Style.SelectionMode;
|
||||||
|
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
|
||||||
|
import com.sencha.gxt.core.client.util.Margins;
|
||||||
|
import com.sencha.gxt.data.shared.ListStore;
|
||||||
|
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.TextButton;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
|
||||||
|
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.VerticalLayoutData;
|
||||||
|
import com.sencha.gxt.widget.core.client.event.BeforeStartEditEvent;
|
||||||
|
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.CancelEditHandler;
|
||||||
|
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.SelectEvent;
|
||||||
|
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||||
|
import com.sencha.gxt.widget.core.client.form.FieldLabel;
|
||||||
|
import com.sencha.gxt.widget.core.client.form.TextField;
|
||||||
|
import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
|
||||||
|
import com.sencha.gxt.widget.core.client.grid.ColumnModel;
|
||||||
|
import com.sencha.gxt.widget.core.client.grid.Grid;
|
||||||
|
import com.sencha.gxt.widget.core.client.grid.Grid.GridCell;
|
||||||
|
import com.sencha.gxt.widget.core.client.grid.GridSelectionModel;
|
||||||
|
import com.sencha.gxt.widget.core.client.grid.editing.GridRowEditing;
|
||||||
|
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author giancarlo email: <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class InterpreterInfoPanel extends ContentPanel {
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private EventBus eventBus;
|
||||||
|
private ListStore<InterpreterPackageInfo> storeInterpreterPackageInfo;
|
||||||
|
private Grid<InterpreterPackageInfo> gridInterpreterPackageInfo;
|
||||||
|
private GridRowEditing<InterpreterPackageInfo> gridInterpreterPackageInfoEditing;
|
||||||
|
private TextButton btnAdd;
|
||||||
|
private boolean addStatus;
|
||||||
|
private int seq = 0;
|
||||||
|
private TextField interpreterVersion;
|
||||||
|
|
||||||
|
public InterpreterInfoPanel(Project project, EventBus eventBus) {
|
||||||
|
super();
|
||||||
|
Log.debug("InterpreterPanel");
|
||||||
|
this.eventBus = eventBus;
|
||||||
|
|
||||||
|
// msgs = GWT.create(ServiceCategoryMessages.class);
|
||||||
|
try {
|
||||||
|
init();
|
||||||
|
create(project);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init() {
|
||||||
|
setHeaderVisible(false);
|
||||||
|
setResize(true);
|
||||||
|
setBodyBorder(false);
|
||||||
|
setBorders(false);
|
||||||
|
forceLayoutOnResize = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void create(Project project) {
|
||||||
|
if (project != null
|
||||||
|
&& project.getInputData() != null
|
||||||
|
&& project.getInputData().getInterpreterInfo() != null
|
||||||
|
&& project.getInputData().getInterpreterInfo()
|
||||||
|
.getInterpreterPackagesInfo() != null) {
|
||||||
|
seq = project.getInputData().getInterpreterInfo()
|
||||||
|
.getInterpreterPackagesInfo().size();
|
||||||
|
} else {
|
||||||
|
seq = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Grid
|
||||||
|
InterpreterPackageInfoProperties props = GWT
|
||||||
|
.create(InterpreterPackageInfoProperties.class);
|
||||||
|
|
||||||
|
ColumnConfig<InterpreterPackageInfo, String> nameColumn = new ColumnConfig<InterpreterPackageInfo, String>(
|
||||||
|
props.name(), 100, "Name");
|
||||||
|
// nameColumn.setMenuDisabled(true);
|
||||||
|
|
||||||
|
ColumnConfig<InterpreterPackageInfo, String> versionColumn = new ColumnConfig<InterpreterPackageInfo, String>(
|
||||||
|
props.version(), 100, "Version");
|
||||||
|
// descriptionColumn.setMenuDisabled(true);
|
||||||
|
|
||||||
|
ArrayList<ColumnConfig<InterpreterPackageInfo, ?>> l = new ArrayList<ColumnConfig<InterpreterPackageInfo, ?>>();
|
||||||
|
l.add(nameColumn);
|
||||||
|
l.add(versionColumn);
|
||||||
|
|
||||||
|
ColumnModel<InterpreterPackageInfo> columns = new ColumnModel<InterpreterPackageInfo>(
|
||||||
|
l);
|
||||||
|
|
||||||
|
storeInterpreterPackageInfo = new ListStore<InterpreterPackageInfo>(
|
||||||
|
props.id());
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ArrayList<InterpreterPackageInfo> list = new ArrayList<>(); for (int
|
||||||
|
* i = 0; i < 10; i++) { list.add(new InterpreterPackageInfo(i, "Test" +
|
||||||
|
* i, "Desc", "defaultValue", InputType.STRING)); }
|
||||||
|
*
|
||||||
|
* storeEnvironmentVariable.addAll(list);
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (project != null
|
||||||
|
&& project.getInputData() != null
|
||||||
|
&& project.getInputData().getInterpreterInfo() != null
|
||||||
|
&& project.getInputData().getInterpreterInfo()
|
||||||
|
.getInterpreterPackagesInfo() != null) {
|
||||||
|
storeInterpreterPackageInfo.addAll(project.getInputData()
|
||||||
|
.getInterpreterInfo().getInterpreterPackagesInfo());
|
||||||
|
}
|
||||||
|
|
||||||
|
final GridSelectionModel<InterpreterPackageInfo> sm = new GridSelectionModel<InterpreterPackageInfo>();
|
||||||
|
sm.setSelectionMode(SelectionMode.SINGLE);
|
||||||
|
|
||||||
|
gridInterpreterPackageInfo = new Grid<InterpreterPackageInfo>(
|
||||||
|
storeInterpreterPackageInfo, columns);
|
||||||
|
gridInterpreterPackageInfo.setSelectionModel(sm);
|
||||||
|
gridInterpreterPackageInfo.getView().setStripeRows(true);
|
||||||
|
gridInterpreterPackageInfo.getView().setColumnLines(true);
|
||||||
|
gridInterpreterPackageInfo.getView().setAutoExpandColumn(nameColumn);
|
||||||
|
gridInterpreterPackageInfo.getView().setAutoFill(true);
|
||||||
|
gridInterpreterPackageInfo.setBorders(false);
|
||||||
|
gridInterpreterPackageInfo.setColumnReordering(false);
|
||||||
|
|
||||||
|
// EDITING //
|
||||||
|
gridInterpreterPackageInfoEditing = new GridRowEditing<InterpreterPackageInfo>(
|
||||||
|
gridInterpreterPackageInfo);
|
||||||
|
gridInterpreterPackageInfoEditing
|
||||||
|
.addEditor(nameColumn, new TextField());
|
||||||
|
gridInterpreterPackageInfoEditing.addEditor(versionColumn,
|
||||||
|
new TextField());
|
||||||
|
|
||||||
|
btnAdd = new TextButton();
|
||||||
|
btnAdd.setIcon(StatAlgoImporterResources.INSTANCE.add16());
|
||||||
|
// btnAdd.setIconAlign(IconAlign.);
|
||||||
|
btnAdd.setToolTip("Add Package Info");
|
||||||
|
btnAdd.addSelectHandler(new SelectHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSelect(SelectEvent event) {
|
||||||
|
addInterpreterPackageInfo(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
TextButton btnDelete = new TextButton("Delete");
|
||||||
|
btnDelete.addSelectHandler(new SelectEvent.SelectHandler() {
|
||||||
|
public void onSelect(SelectEvent event) {
|
||||||
|
GridCell cell = gridInterpreterPackageInfoEditing
|
||||||
|
.getActiveCell();
|
||||||
|
int rowIndex = cell.getRow();
|
||||||
|
|
||||||
|
gridInterpreterPackageInfoEditing.cancelEditing();
|
||||||
|
|
||||||
|
storeInterpreterPackageInfo.remove(rowIndex);
|
||||||
|
storeInterpreterPackageInfo.commitChanges();
|
||||||
|
|
||||||
|
gridInterpreterPackageInfoEditing.getCancelButton().setVisible(
|
||||||
|
true);
|
||||||
|
btnAdd.setEnabled(true);
|
||||||
|
if (addStatus) {
|
||||||
|
addStatus = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<InterpreterPackageInfo> listPackages = storeInterpreterPackageInfo
|
||||||
|
.getAll();
|
||||||
|
List<InterpreterPackageInfo> listNewPackages = new ArrayList<InterpreterPackageInfo>();
|
||||||
|
for (int i = 0; i < listPackages.size(); i++) {
|
||||||
|
InterpreterPackageInfo var = listPackages.get(i);
|
||||||
|
var.setId(i);
|
||||||
|
listNewPackages.add(var);
|
||||||
|
}
|
||||||
|
|
||||||
|
storeInterpreterPackageInfo.clear();
|
||||||
|
storeInterpreterPackageInfo.addAll(listNewPackages);
|
||||||
|
storeInterpreterPackageInfo.commitChanges();
|
||||||
|
|
||||||
|
seq = listNewPackages.size();
|
||||||
|
Log.debug("Current Seq: " + seq);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ButtonBar buttonBar = gridInterpreterPackageInfoEditing.getButtonBar();
|
||||||
|
buttonBar.add(btnDelete);
|
||||||
|
|
||||||
|
gridInterpreterPackageInfoEditing
|
||||||
|
.addBeforeStartEditHandler(new BeforeStartEditHandler<InterpreterPackageInfo>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBeforeStartEdit(
|
||||||
|
BeforeStartEditEvent<InterpreterPackageInfo> event) {
|
||||||
|
editingBeforeStart(event);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
gridInterpreterPackageInfoEditing
|
||||||
|
.addCancelEditHandler(new CancelEditHandler<InterpreterPackageInfo>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCancelEdit(
|
||||||
|
CancelEditEvent<InterpreterPackageInfo> event) {
|
||||||
|
storeInterpreterPackageInfo.rejectChanges();
|
||||||
|
btnAdd.setEnabled(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
gridInterpreterPackageInfoEditing
|
||||||
|
.addCompleteEditHandler(new CompleteEditHandler<InterpreterPackageInfo>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCompleteEdit(
|
||||||
|
CompleteEditEvent<InterpreterPackageInfo> event) {
|
||||||
|
try {
|
||||||
|
if (addStatus) {
|
||||||
|
addStatus = false;
|
||||||
|
}
|
||||||
|
storeInterpreterPackageInfo.commitChanges();
|
||||||
|
|
||||||
|
gridInterpreterPackageInfoEditing.getCancelButton()
|
||||||
|
.setVisible(true);
|
||||||
|
btnAdd.setEnabled(true);
|
||||||
|
|
||||||
|
} catch (Throwable e) {
|
||||||
|
Log.error("Error: " + e.getLocalizedMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
interpreterVersion = new TextField();
|
||||||
|
interpreterVersion.setAllowBlank(false);
|
||||||
|
interpreterVersion.setEmptyText("Enter version...");
|
||||||
|
FieldLabel interpreterVersionLabel = new FieldLabel(interpreterVersion,
|
||||||
|
"Version");
|
||||||
|
|
||||||
|
if (project != null
|
||||||
|
&& project.getInputData() != null
|
||||||
|
&& project.getInputData().getInterpreterInfo() != null
|
||||||
|
&& project.getInputData().getInterpreterInfo().getVersion() != null) {
|
||||||
|
interpreterVersion.setValue(project.getInputData()
|
||||||
|
.getInterpreterInfo().getVersion());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
FieldLabel interpreterPackagesLabel = new FieldLabel(null, "Packages");
|
||||||
|
|
||||||
|
ToolBar toolBar = new ToolBar();
|
||||||
|
toolBar.add(btnAdd, new BoxLayoutData(new Margins(0)));
|
||||||
|
|
||||||
|
VerticalLayoutContainer vlc = new VerticalLayoutContainer();
|
||||||
|
vlc.setAdjustForScroll(false);
|
||||||
|
vlc.setScrollMode(ScrollMode.NONE);
|
||||||
|
|
||||||
|
vlc.add(interpreterVersionLabel, new VerticalLayoutData(1, -1,
|
||||||
|
new Margins(5, 0, 5, 0)));
|
||||||
|
|
||||||
|
vlc.add(interpreterPackagesLabel, new VerticalLayoutData(1, -1,
|
||||||
|
new Margins(0)));
|
||||||
|
|
||||||
|
vlc.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||||
|
vlc.add(gridInterpreterPackageInfo, new VerticalLayoutData(1, 1,
|
||||||
|
new Margins(0)));
|
||||||
|
|
||||||
|
add(vlc, new MarginData(new Margins(0)));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void editingBeforeStart(
|
||||||
|
BeforeStartEditEvent<InterpreterPackageInfo> event) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addNewInterpreterPackageInfo(
|
||||||
|
InterpreterPackageInfo interpreterPackageInfo) {
|
||||||
|
try {
|
||||||
|
Log.debug("Current Seq: " + seq);
|
||||||
|
seq++;
|
||||||
|
interpreterPackageInfo.setId(seq);
|
||||||
|
Log.debug("New Interpreter Package Info: " + interpreterPackageInfo);
|
||||||
|
storeInterpreterPackageInfo.add(interpreterPackageInfo);
|
||||||
|
storeInterpreterPackageInfo.commitChanges();
|
||||||
|
|
||||||
|
if (gridInterpreterPackageInfoEditing.isEditing()) {
|
||||||
|
gridInterpreterPackageInfoEditing.cancelEditing();
|
||||||
|
}
|
||||||
|
forceLayout();
|
||||||
|
} catch (Throwable e) {
|
||||||
|
Log.error(e.getLocalizedMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addInterpreterPackageInfo(SelectEvent event) {
|
||||||
|
try {
|
||||||
|
Log.debug("Current Seq: " + seq);
|
||||||
|
seq++;
|
||||||
|
InterpreterPackageInfo newInterpreterPackageInfo = new InterpreterPackageInfo(
|
||||||
|
seq, "", "");
|
||||||
|
Log.debug("New Interpreter Package Info: "
|
||||||
|
+ newInterpreterPackageInfo);
|
||||||
|
gridInterpreterPackageInfoEditing.cancelEditing();
|
||||||
|
addStatus = true;
|
||||||
|
gridInterpreterPackageInfoEditing.getCancelButton().setVisible(
|
||||||
|
false);
|
||||||
|
storeInterpreterPackageInfo.add(newInterpreterPackageInfo);
|
||||||
|
int row = storeInterpreterPackageInfo
|
||||||
|
.indexOf(newInterpreterPackageInfo);
|
||||||
|
|
||||||
|
gridInterpreterPackageInfoEditing
|
||||||
|
.startEditing(new GridCell(row, 0));
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(Project project) {
|
||||||
|
Log.debug("Update Interpreter Package Info: " + project);
|
||||||
|
if (project != null && project.getInputData() != null
|
||||||
|
&& project.getInputData().getInterpreterInfo() != null) {
|
||||||
|
|
||||||
|
if (project.getInputData().getInterpreterInfo().getVersion() != null) {
|
||||||
|
interpreterVersion.setValue(project.getInputData()
|
||||||
|
.getInterpreterInfo().getVersion());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (project.getInputData().getInterpreterInfo()
|
||||||
|
.getInterpreterPackagesInfo() != null) {
|
||||||
|
|
||||||
|
storeInterpreterPackageInfo.clear();
|
||||||
|
storeInterpreterPackageInfo.addAll(project.getInputData()
|
||||||
|
.getInterpreterInfo().getInterpreterPackagesInfo());
|
||||||
|
storeInterpreterPackageInfo.commitChanges();
|
||||||
|
seq = project.getInputData().getListSelectedRows().size();
|
||||||
|
} else {
|
||||||
|
seq = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
interpreterVersion.clear();
|
||||||
|
seq = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public InterpreterInfo getInterpreterInfo() {
|
||||||
|
|
||||||
|
ArrayList<InterpreterPackageInfo> interpreterPackagesInfo = new ArrayList<>(
|
||||||
|
gridInterpreterPackageInfo.getStore().getAll());
|
||||||
|
|
||||||
|
String version = interpreterVersion.getCurrentValue();
|
||||||
|
return new InterpreterInfo(version, interpreterPackagesInfo);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -349,7 +349,7 @@ public class SelectedRowsPanel extends ContentPanel {
|
||||||
btnAdd.setEnabled(true);
|
btnAdd.setEnabled(true);
|
||||||
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Log.error("Error in RuleOnTableNewDefinitionCard: "
|
Log.error("Error: "
|
||||||
+ e.getLocalizedMessage());
|
+ e.getLocalizedMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
package org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author giancarlo email: <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class InterpreterInfo implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -7259162372427984451L;
|
||||||
|
|
||||||
|
private String version;
|
||||||
|
private ArrayList<InterpreterPackageInfo> interpreterPackagesInfo;
|
||||||
|
|
||||||
|
public InterpreterInfo() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public InterpreterInfo(String version,
|
||||||
|
ArrayList<InterpreterPackageInfo> interpreterPackagesInfo) {
|
||||||
|
super();
|
||||||
|
this.version = version;
|
||||||
|
this.interpreterPackagesInfo = interpreterPackagesInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVersion() {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVersion(String version) {
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<InterpreterPackageInfo> getInterpreterPackagesInfo() {
|
||||||
|
return interpreterPackagesInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInterpreterPackagesInfo(
|
||||||
|
ArrayList<InterpreterPackageInfo> interpreterPackagesInfo) {
|
||||||
|
this.interpreterPackagesInfo = interpreterPackagesInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "InterpreterInfo [version=" + version
|
||||||
|
+ ", interpreterPackagesInfo=" + interpreterPackagesInfo + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,66 @@
|
||||||
|
package org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Giancarlo Panichi email: <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class InterpreterPackageInfo implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 6638656450670269043L;
|
||||||
|
|
||||||
|
private int id;
|
||||||
|
private String name;
|
||||||
|
private String version;
|
||||||
|
|
||||||
|
public InterpreterPackageInfo() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @param name Package Name
|
||||||
|
* @param version Package Version
|
||||||
|
*/
|
||||||
|
public InterpreterPackageInfo(int id, String name, String version) {
|
||||||
|
super();
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 getVersion() {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVersion(String version) {
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "InterpreterPackageInfo [id=" + id + ", name=" + name
|
||||||
|
+ ", version=" + version + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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.InterpreterInfo;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.SelectedRowsVariables;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.SelectedRowsVariables;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -17,16 +18,19 @@ 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<SelectedRowsVariables> listSelectedRows;
|
private ArrayList<SelectedRowsVariables> listSelectedRows;
|
||||||
|
private InterpreterInfo interpreterInfo;
|
||||||
|
|
||||||
public InputData() {
|
public InputData() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public InputData(ArrayList<EnvironmentVariables> listEnvironmentVariables,
|
public InputData(ArrayList<EnvironmentVariables> listEnvironmentVariables,
|
||||||
ArrayList<SelectedRowsVariables> listSelectedRows) {
|
ArrayList<SelectedRowsVariables> listSelectedRows,
|
||||||
|
InterpreterInfo interpreterInfo) {
|
||||||
super();
|
super();
|
||||||
this.listEnvironmentVariables = listEnvironmentVariables;
|
this.listEnvironmentVariables = listEnvironmentVariables;
|
||||||
this.listSelectedRows = listSelectedRows;
|
this.listSelectedRows = listSelectedRows;
|
||||||
|
this.interpreterInfo = interpreterInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<EnvironmentVariables> getListEnvironmentVariables() {
|
public ArrayList<EnvironmentVariables> getListEnvironmentVariables() {
|
||||||
|
@ -47,14 +51,20 @@ public class InputData implements Serializable {
|
||||||
this.listSelectedRows = listSelectedRows;
|
this.listSelectedRows = listSelectedRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public InterpreterInfo getInterpreterInfo() {
|
||||||
|
return interpreterInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInterpreterInfo(InterpreterInfo interpreterInfo) {
|
||||||
|
this.interpreterInfo = interpreterInfo;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "InputData [listEnvironmentVariables="
|
return "InputData [listEnvironmentVariables="
|
||||||
+ listEnvironmentVariables + ", listSelectedRows="
|
+ listEnvironmentVariables + ", listSelectedRows="
|
||||||
+ listSelectedRows + "]";
|
+ listSelectedRows + ", interpreterInfo=" + interpreterInfo
|
||||||
|
+ "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue