137 lines
3.9 KiB
Java
137 lines
3.9 KiB
Java
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools.input;
|
|
|
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.InputSaveReadyEvent;
|
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.SelectedRowsVariables;
|
|
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.google.gwt.core.client.GWT;
|
|
import com.google.gwt.event.shared.EventBus;
|
|
import com.sencha.gxt.widget.core.client.TabItemConfig;
|
|
import com.sencha.gxt.widget.core.client.TabPanel;
|
|
|
|
//import org.gcube.portlets.user.td.taskswidget.client.TdTaskController;
|
|
|
|
/**
|
|
*
|
|
* @author giancarlo email: <a
|
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
*
|
|
*/
|
|
public class InputVariableTabPanel extends TabPanel {
|
|
private InputVariableMessages msgs;
|
|
private EventBus eventBus;
|
|
private EnvironmentVariablesPanel enviromentVariablesPanel;
|
|
private SelectedRowsPanel selectedRowsPanel;
|
|
|
|
public InputVariableTabPanel(EventBus eventBus,
|
|
InputVariablePanel toolBoxPanel) {
|
|
super();
|
|
Log.debug("Create InpuntVariableTabPanel");
|
|
this.eventBus = eventBus;
|
|
this.msgs = GWT.create(InputVariableMessages.class);
|
|
init();
|
|
|
|
}
|
|
|
|
protected void init(){
|
|
setId("InputVariableTabPanel");
|
|
setBodyBorder(false);
|
|
setBorders(false);
|
|
setAnimScroll(true);
|
|
setTabScroll(true);
|
|
setCloseContextMenu(true);
|
|
}
|
|
|
|
public void startTabs(Project project) {
|
|
Log.debug("Start InputVariable Tabs");
|
|
addEnvironmentVariablesPanel(project);
|
|
addSelectedRowsPanel(project);
|
|
|
|
setActiveWidget(getWidget(0));
|
|
|
|
}
|
|
|
|
/*
|
|
* public void openEnviromentVariablesPanel() {
|
|
* Log.debug("Open EnviromentVariablesPanel Tab"); if
|
|
* (enviromentVariablesPanel == null) { addChangeColumnTypePanel(trId,
|
|
* columnName); } else { enviromentVariablesPanel.update(); }
|
|
* setActiveWidget(changeColumnTypePanel);
|
|
*
|
|
* }
|
|
*/
|
|
|
|
// Close
|
|
/*
|
|
* public void closePropertiesTabs() { Log.debug("Close Properties Tab"); if
|
|
* (trProperties != null) { remove(trProperties); trProperties = null; }
|
|
*
|
|
* }
|
|
*/
|
|
|
|
//
|
|
|
|
public void updateTabs(Project project) {
|
|
try {
|
|
enviromentVariablesPanel.update(project);
|
|
selectedRowsPanel.update(project);
|
|
|
|
forceLayout();
|
|
} catch (Throwable e) {
|
|
Log.error("Error in InputVariableTabPanel: "
|
|
+ e.getLocalizedMessage());
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
public void saveInput() {
|
|
InputData inputVariables = new InputData();
|
|
if (enviromentVariablesPanel != null) {
|
|
inputVariables.setListEnvironmentVariables(enviromentVariablesPanel
|
|
.getEnvironmentVariables());
|
|
}
|
|
|
|
if (selectedRowsPanel != null) {
|
|
inputVariables.setListSelectedRows(selectedRowsPanel
|
|
.getSelectedRows());
|
|
}
|
|
|
|
InputSaveReadyEvent inputSaveReadyEvent = new InputSaveReadyEvent(
|
|
inputVariables);
|
|
eventBus.fireEvent(inputSaveReadyEvent);
|
|
Log.debug("Fired InputSaveReadyEvent");
|
|
|
|
}
|
|
|
|
// Add
|
|
private void addSelectedRowsPanel(Project project) {
|
|
TabItemConfig selectedRowsPanelItemConf = new TabItemConfig(
|
|
msgs.selectedRowsItem(), false);
|
|
|
|
selectedRowsPanel = new SelectedRowsPanel(project, eventBus);
|
|
selectedRowsPanel.setHeaderVisible(false);
|
|
add(selectedRowsPanel, selectedRowsPanelItemConf);
|
|
|
|
}
|
|
|
|
private void addEnvironmentVariablesPanel(Project project) {
|
|
TabItemConfig enviromentVariablePanelItemConf = new TabItemConfig(
|
|
msgs.environmentVariables(), false);
|
|
|
|
enviromentVariablesPanel = new EnvironmentVariablesPanel(project, eventBus);
|
|
enviromentVariablesPanel.setHeaderVisible(false);
|
|
add(enviromentVariablesPanel, enviromentVariablePanelItemConf);
|
|
}
|
|
|
|
public void addSelectedRowsVariable(
|
|
SelectedRowsVariables selectedRowsVariable) {
|
|
setActiveWidget(selectedRowsPanel);
|
|
selectedRowsPanel.addNewSelectedRowsVariable(selectedRowsVariable);
|
|
|
|
|
|
}
|
|
|
|
}
|