868 lines
21 KiB
Java
868 lines
21 KiB
Java
/**
|
|
*
|
|
*/
|
|
package org.gcube.portlets.user.td.client;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import org.gcube.portlets.user.td.csvexportwidget.client.CSVExportWizardTD;
|
|
import org.gcube.portlets.user.td.csvimportwidget.client.CSVImportWizardTD;
|
|
import org.gcube.portlets.user.td.expressionwidget.client.ColumnFilterDialog;
|
|
import org.gcube.portlets.user.td.expressionwidget.client.MultiColumnFilterDialog;
|
|
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
|
import org.gcube.portlets.user.td.openwidget.client.TDOpen;
|
|
import org.gcube.portlets.user.td.sdmxexportwidget.client.SDMXExportWizardTD;
|
|
import org.gcube.portlets.user.td.sdmximportwidget.client.SDMXImportWizardTD;
|
|
import org.gcube.portlets.user.td.taskswidget.client.TdTaskController;
|
|
import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent;
|
|
import org.gcube.portlets.user.td.widgetcommonevent.client.event.GridContextMenuItemEvent;
|
|
import org.gcube.portlets.user.td.widgetcommonevent.client.event.GridHeaderColumnMenuItemEvent;
|
|
import org.gcube.portlets.user.td.widgetcommonevent.client.event.RibbonEvent;
|
|
import org.gcube.portlets.user.td.widgetcommonevent.client.event.TasksMonitorEvent;
|
|
import org.gcube.portlets.user.td.widgetcommonevent.client.event.UIStateEvent;
|
|
import org.gcube.portlets.user.td.widgetcommonevent.client.event.WidgetRequestEvent;
|
|
import org.gcube.portlets.user.td.widgetcommonevent.client.type.RibbonType;
|
|
import org.gcube.portlets.user.td.widgetcommonevent.client.type.TaskType;
|
|
import org.gcube.portlets.user.td.widgetcommonevent.client.type.UIStateType;
|
|
import org.gcube.portlets.user.td.widgetcommonevent.client.type.WidgetRequestType;
|
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.GridHeaderOperationId;
|
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.GridOperationId;
|
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
|
import org.gcube.portlets.user.td.wizardwidget.client.WizardListener;
|
|
import org.gcube.portlets.user.tdtemplate.client.TdTemplateController;
|
|
//import org.gcube.portlets.user.tdtemplate.client.TdTemplateController;
|
|
import org.gcube.portlets.user.tdwx.client.TabularDataX;
|
|
import org.gcube.portlets.user.tdwx.shared.model.TableId;
|
|
|
|
import com.allen_sauer.gwt.log.client.Log;
|
|
import com.google.gwt.core.client.GWT;
|
|
import com.google.gwt.core.client.RunAsyncCallback;
|
|
import com.google.gwt.user.client.Window;
|
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
|
import com.google.web.bindery.event.shared.EventBus;
|
|
import com.google.web.bindery.event.shared.SimpleEventBus;
|
|
import com.sencha.gxt.widget.core.client.ContentPanel;
|
|
import com.sencha.gxt.widget.core.client.Dialog.PredefinedButton;
|
|
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
|
|
import com.sencha.gxt.widget.core.client.box.ConfirmMessageBox;
|
|
import com.sencha.gxt.widget.core.client.container.BorderLayoutContainer.BorderLayoutData;
|
|
import com.sencha.gxt.widget.core.client.event.HideEvent;
|
|
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
|
|
import com.sencha.gxt.widget.core.client.info.Info;
|
|
|
|
/**
|
|
*
|
|
* @author "Giancarlo Panichi" <a
|
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
*
|
|
*/
|
|
public class TabularDataController {
|
|
// implements HasCloseHandlers<Long>, HasOpenHandlers<Long> {
|
|
|
|
protected SimpleEventBus eventBus;
|
|
protected TabularDataX tabularData;
|
|
protected UIStateType uiState = UIStateType.START;
|
|
|
|
private boolean taskManagerInit = false;
|
|
protected TdTaskController tdTaskController;
|
|
|
|
protected ContentPanel toolBoxPanel;
|
|
protected BorderLayoutData westData;
|
|
|
|
/**
|
|
* Tabular Resource Id
|
|
*/
|
|
protected TRId trId;
|
|
|
|
/**
|
|
* Grid TableId
|
|
*/
|
|
protected TableId tableOpening;
|
|
|
|
public TabularDataController() {
|
|
eventBus = new SimpleEventBus();
|
|
callHello();
|
|
bindToEvents();
|
|
}
|
|
|
|
/**
|
|
* @return the eventBus
|
|
*/
|
|
public EventBus getEventBus() {
|
|
return eventBus;
|
|
}
|
|
|
|
public void setTabularData(TabularDataX tabularData) {
|
|
this.tabularData = tabularData;
|
|
}
|
|
|
|
public ContentPanel getToolBoxPanel() {
|
|
return toolBoxPanel;
|
|
}
|
|
|
|
public void setToolBoxPanel(ContentPanel toolBoxPanel) {
|
|
this.toolBoxPanel = toolBoxPanel;
|
|
}
|
|
|
|
public BorderLayoutData getWestData() {
|
|
return westData;
|
|
}
|
|
|
|
public void setWestData(BorderLayoutData westData) {
|
|
this.westData = westData;
|
|
}
|
|
|
|
protected void callHello() {
|
|
TDGWTServiceAsync.INSTANCE.hello(new AsyncCallback<String>() {
|
|
|
|
@Override
|
|
public void onFailure(Throwable caught) {
|
|
Log.info("No valid user found: " + caught.getMessage());
|
|
alertMessage("Error", "No user found");
|
|
}
|
|
|
|
@Override
|
|
public void onSuccess(String result) {
|
|
Log.info("Hello: " + result);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
// Bind Controller to events on bus
|
|
protected void bindToEvents() {
|
|
eventBus.addHandler(
|
|
GridHeaderColumnMenuItemEvent.TYPE,
|
|
new GridHeaderColumnMenuItemEvent.GridHeaderColumnMenuItemEventHandler() {
|
|
|
|
public void onGridHeaderColumnMenuItemEvent(
|
|
GridHeaderColumnMenuItemEvent event) {
|
|
Log.debug("Catch Event HeaderColumnMenuItemEvent");
|
|
doGridHeaderColumnMenuCommand(event);
|
|
|
|
}
|
|
});
|
|
|
|
eventBus.addHandler(GridContextMenuItemEvent.TYPE,
|
|
new GridContextMenuItemEvent.GridContextMenuItemEventHandler() {
|
|
|
|
public void onGridContextMenuItemEvent(
|
|
GridContextMenuItemEvent event) {
|
|
Log.debug("Catch Event ContextMenuItemEvent");
|
|
doGridContextMenuCommand(event);
|
|
|
|
}
|
|
});
|
|
|
|
eventBus.addHandler(ChangeTableRequestEvent.TYPE,
|
|
new ChangeTableRequestEvent.ChangeTableRequestEventHandler() {
|
|
|
|
public void onChangeTableRequestEvent(
|
|
ChangeTableRequestEvent event) {
|
|
Log.debug("Catch Event ChangeTableRequestEvent");
|
|
doChangeTableRequestEventCommand(event);
|
|
|
|
}
|
|
});
|
|
|
|
eventBus.addHandler(RibbonEvent.TYPE,
|
|
new RibbonEvent.RibbonEventHandler() {
|
|
|
|
public void onRibbon(RibbonEvent event) {
|
|
doRibbonCommand(event);
|
|
|
|
}
|
|
});
|
|
|
|
eventBus.addHandler(TasksMonitorEvent.TYPE,
|
|
new TasksMonitorEvent.TasksMonitorEventHandler() {
|
|
|
|
public void onTasksMonitorEvent(TasksMonitorEvent event) {
|
|
Log.debug("Catch Event HeaderColumnMenuItemEvent");
|
|
doTasksMonitorCommand(event);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
eventBus.fireEvent(new UIStateEvent(UIStateType.START));
|
|
|
|
}
|
|
|
|
// Simple alert
|
|
protected void alertMessage(String reason, String details) {
|
|
AlertMessageBox d = new AlertMessageBox(reason, details);
|
|
d.addHideHandler(new HideHandler() {
|
|
|
|
public void onHide(HideEvent event) {
|
|
//
|
|
}
|
|
|
|
});
|
|
d.show();
|
|
}
|
|
|
|
// Resume state of user interface
|
|
protected void resumeUIState() {
|
|
try {
|
|
if (uiState == UIStateType.TR_OPEN) {
|
|
UIStateEvent uiStateEvent = new UIStateEvent(
|
|
UIStateType.TR_OPEN);
|
|
uiStateEvent.setTrId(trId);
|
|
eventBus.fireEvent(uiStateEvent);
|
|
} else {
|
|
eventBus.fireEvent(new UIStateEvent(UIStateType.TR_CLOSE));
|
|
|
|
}
|
|
} catch (Exception e) {
|
|
Log.debug("Resume :" + e.getLocalizedMessage());
|
|
}
|
|
}
|
|
|
|
// Open Table
|
|
protected void openTable(TRId tabularResourceId) {
|
|
Log.debug("openTabe: " + tabularResourceId);
|
|
trId = tabularResourceId;
|
|
tableOpening = new TableId(Constants.TDX_DATASOURCE_FACTORY_ID,
|
|
trId.getTableId());
|
|
tabularData.openTable(tableOpening);
|
|
uiState = UIStateType.TR_OPEN;
|
|
UIStateEvent uiStateEvent = new UIStateEvent(UIStateType.TR_OPEN);
|
|
uiStateEvent.setTrId(tabularResourceId);
|
|
eventBus.fireEvent(uiStateEvent);
|
|
}
|
|
|
|
// Close Tabular Resource
|
|
protected void closeTabularResource() {
|
|
if (uiState == UIStateType.TR_OPEN) {
|
|
Log.debug("CloseTabularResource Open");
|
|
tabularData.closeTable();
|
|
trId = null;
|
|
tableOpening = null;
|
|
uiState = UIStateType.TR_CLOSE;
|
|
Log.debug("fireEvent TR_CLOSE");
|
|
try {
|
|
eventBus.fireEvent(new UIStateEvent(UIStateType.TR_CLOSE));
|
|
} catch (Exception e) {
|
|
Log.debug("Bus Error: " + e.getMessage());
|
|
}
|
|
}
|
|
}
|
|
|
|
protected void deleteTabularResource() {
|
|
|
|
final ConfirmMessageBox mb = new ConfirmMessageBox("Confirm",
|
|
"Are you sure you want to delete the taular resource?");
|
|
mb.addHideHandler(new HideHandler() {
|
|
public void onHide(HideEvent event) {
|
|
if (mb.getHideButton() == mb.getButtonById(PredefinedButton.YES
|
|
.name())) {
|
|
Log.debug("Remove TR:" + trId);
|
|
TDGWTServiceAsync.INSTANCE.removeTabularResource(trId,
|
|
new AsyncCallback<Void>() {
|
|
|
|
public void onFailure(Throwable caught) {
|
|
alertMessage(
|
|
"Error",
|
|
"Error on remove TabResource: "
|
|
+ caught.getLocalizedMessage());
|
|
}
|
|
|
|
public void onSuccess(Void result) {
|
|
closeTabularResource();
|
|
}
|
|
|
|
});
|
|
|
|
mb.hide();
|
|
} else if (mb.getHideButton() == mb
|
|
.getButtonById(PredefinedButton.NO.name())) {
|
|
mb.hide();
|
|
}
|
|
}
|
|
});
|
|
mb.setWidth(300);
|
|
mb.show();
|
|
|
|
}
|
|
|
|
protected void openWizard() {
|
|
eventBus.fireEvent(new UIStateEvent(UIStateType.WIZARD_OPEN));
|
|
}
|
|
|
|
public void doRibbonCommand(RibbonEvent event) {
|
|
RibbonType type = event.getRibbonType();
|
|
Log.trace("doRibbonEvent ribbonType: " + type);
|
|
try {
|
|
switch (type) {
|
|
case OPEN:
|
|
openTabularResource();
|
|
break;
|
|
case CLOSE:
|
|
closeTabularResource();
|
|
break;
|
|
case DELETE:
|
|
deleteTabularResource();
|
|
break;
|
|
case PROPERTIES:
|
|
break;
|
|
case IMPORTSDMX:
|
|
openSDMXImportWizard();
|
|
break;
|
|
case IMPORTCSV:
|
|
openCSVImportWizard();
|
|
break;
|
|
case IMPORTJSON:
|
|
break;
|
|
case EXPORTSDMX:
|
|
openSDMXExportWizard();
|
|
break;
|
|
case EXPORTCSV:
|
|
openCSVExportWizard();
|
|
break;
|
|
case EXPORTJSON:
|
|
break;
|
|
case TEMPLATEOPEN:
|
|
openTemplateOpen();
|
|
break;
|
|
case TEMPLATENEW:
|
|
openTemplateNew();
|
|
break;
|
|
case SHARE:
|
|
break;
|
|
case TIMELINE:
|
|
openTasksManagerWizard();
|
|
break;
|
|
case HISTORY:
|
|
break;
|
|
case DISCARD:
|
|
break;
|
|
case DISCARDALL:
|
|
break;
|
|
case HELP:
|
|
break;
|
|
case RULENEW:
|
|
break;
|
|
case RULEMANAGE:
|
|
break;
|
|
case DUPLICATEDETECTION:
|
|
break;
|
|
case TEMPLATEAPPLY:
|
|
break;
|
|
case TABLETYPE:
|
|
openTableType();
|
|
break;
|
|
case COLUMNLABEL:
|
|
openColumnLabel();
|
|
break;
|
|
case COLUMNTYPE:
|
|
openColumnType();
|
|
break;
|
|
case COLUMNADD:
|
|
break;
|
|
case COLUMNDELETE:
|
|
openColumnDelete();
|
|
break;
|
|
case DENORMALIZE:
|
|
break;
|
|
case NORMALIZE:
|
|
break;
|
|
case EXTRACTCODELIST:
|
|
break;
|
|
case GENERATESUMMARY:
|
|
break;
|
|
case TABLEFILTER:
|
|
break;
|
|
case TABLEUNION:
|
|
break;
|
|
case TABLEGROUPBY:
|
|
break;
|
|
case TABLEAGGREAGETE:
|
|
break;
|
|
case ROWADD:
|
|
break;
|
|
case ROWDELETE:
|
|
break;
|
|
case DUPLICATEDELETE:
|
|
break;
|
|
case ANNOTATIONADD:
|
|
break;
|
|
case COLUMNFILTER:
|
|
openMultiColumnFilter();
|
|
break;
|
|
case COLUMNEDIT:
|
|
break;
|
|
case ANALYSETABLEFILTER:
|
|
break;
|
|
case ANALYSETABLEUNION:
|
|
break;
|
|
case ANALYSETABLEGROUPBY:
|
|
break;
|
|
case ANALYSETABLEAGGREAGETE:
|
|
break;
|
|
case ANALYSEROWADD:
|
|
break;
|
|
case ANALYSEROWDELETE:
|
|
break;
|
|
case ANALYSEDUPLICATEDELETE:
|
|
break;
|
|
case ANALYSEANNOTATIONADD:
|
|
break;
|
|
case ANALYSECOLUMNFILTER:
|
|
break;
|
|
case ANALYSECOLUMNEDIT:
|
|
break;
|
|
case CHARTPIE:
|
|
break;
|
|
case CHARTBAR:
|
|
break;
|
|
case CHARTCURVE:
|
|
break;
|
|
case CHARTBULLS:
|
|
break;
|
|
case RSTUDIO:
|
|
break;
|
|
case STATISTICAL:
|
|
break;
|
|
case SPREAD:
|
|
break;
|
|
case GIS:
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
} catch (Exception e) {
|
|
Log.error("doRibbonCommand Error : " + e.getLocalizedMessage()
|
|
+ " \n " + e.getMessage());
|
|
}
|
|
}
|
|
|
|
protected void doTasksMonitorCommand(TasksMonitorEvent event) {
|
|
TaskType taskType = event.getTaskType();
|
|
Log.debug("Received TaskMonitorEvent: " + taskType);
|
|
switch (taskType) {
|
|
case OPENTABLE:
|
|
// openTable(event.getTrId());
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
/*
|
|
* protected void openToolBox() { if (uiState == UIStateType.TR_OPEN) { if
|
|
* (uiToolBox == UIToolBox.OPENED) { toolBoxPanel.collapse();
|
|
* toolBoxPanel.disable();
|
|
*
|
|
* uiToolBox = UIToolBox.CLOSED; eventBus.fireEvent(new
|
|
* UIStateEvent(UIStateType.TOOLBOX_CLOSE)); toolBox.remove(trProperties);
|
|
* Info.display("Properties", "Closed"); } else { eventBus.fireEvent(new
|
|
* UIStateEvent(UIStateType.TOOLBOX_OPEN)); toolBoxPanel.enable();
|
|
* toolBoxPanel.expand(); uiToolBox = UIToolBox.OPENED;
|
|
*
|
|
* } } else { Info.display("Properties", "No table open"); } };
|
|
*/
|
|
|
|
protected void openSDMXImportWizard() {
|
|
GWT.runAsync(new RunAsyncCallback() {
|
|
|
|
public void onSuccess() {
|
|
openWizard();
|
|
SDMXImportWizardTD importWizard = new SDMXImportWizardTD(
|
|
"SDMX Import");
|
|
importWizard.addListener(new WizardListener() {
|
|
|
|
public void completed(TRId tabularResourceId) {
|
|
openTable(tabularResourceId);
|
|
}
|
|
|
|
public void aborted() {
|
|
resumeUIState();
|
|
}
|
|
|
|
public void failed(Throwable throwable, String reason,
|
|
String details) {
|
|
alertMessage(reason, details);
|
|
resumeUIState();
|
|
}
|
|
|
|
});
|
|
|
|
importWizard.show();
|
|
}
|
|
|
|
public void onFailure(Throwable reason) {
|
|
asyncCodeLoadingFailed(reason);
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
protected void openCSVExportWizard() {
|
|
GWT.runAsync(new RunAsyncCallback() {
|
|
|
|
public void onSuccess() {
|
|
openWizard();
|
|
CSVExportWizardTD exportWizard = new CSVExportWizardTD(
|
|
"CSV Export");
|
|
|
|
exportWizard.addListener(new WizardListener() {
|
|
public void failed(Throwable throwable, String reason,
|
|
String details) {
|
|
alertMessage(reason, details);
|
|
resumeUIState();
|
|
}
|
|
|
|
public void completed(TRId id) {
|
|
resumeUIState();
|
|
|
|
}
|
|
|
|
public void aborted() {
|
|
resumeUIState();
|
|
}
|
|
});
|
|
|
|
exportWizard.show();
|
|
}
|
|
|
|
public void onFailure(Throwable reason) {
|
|
asyncCodeLoadingFailed(reason);
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
protected void openSDMXExportWizard() {
|
|
GWT.runAsync(new RunAsyncCallback() {
|
|
|
|
public void onSuccess() {
|
|
openWizard();
|
|
SDMXExportWizardTD exportWizard = new SDMXExportWizardTD(
|
|
"SDMX Export");
|
|
|
|
exportWizard.addListener(new WizardListener() {
|
|
public void failed(Throwable throwable, String reason,
|
|
String details) {
|
|
alertMessage(reason, details);
|
|
resumeUIState();
|
|
}
|
|
|
|
public void completed(TRId id) {
|
|
resumeUIState();
|
|
|
|
}
|
|
|
|
public void aborted() {
|
|
resumeUIState();
|
|
}
|
|
});
|
|
|
|
exportWizard.show();
|
|
}
|
|
|
|
public void onFailure(Throwable reason) {
|
|
asyncCodeLoadingFailed(reason);
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
/**
|
|
*
|
|
*/
|
|
protected void openTabularResource() {
|
|
Log.info("Open Tabular Resources");
|
|
|
|
GWT.runAsync(new RunAsyncCallback() {
|
|
|
|
public void onSuccess() {
|
|
openWizard();
|
|
TDOpen tdOpen = new TDOpen("Open Tabular Resource");
|
|
|
|
tdOpen.addListener(new WizardListener() {
|
|
|
|
public void aborted() {
|
|
resumeUIState();
|
|
}
|
|
|
|
public void failed(Throwable throwable, String reason,
|
|
String details) {
|
|
alertMessage(reason, details);
|
|
resumeUIState();
|
|
}
|
|
|
|
public void completed(TRId tabularResourceId) {
|
|
openTable(tabularResourceId);
|
|
|
|
}
|
|
|
|
});
|
|
Log.info("TDOpen add Listener");
|
|
tdOpen.show();
|
|
}
|
|
|
|
public void onFailure(Throwable reason) {
|
|
asyncCodeLoadingFailed(reason);
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
protected void openCSVImportWizard() {
|
|
GWT.runAsync(new RunAsyncCallback() {
|
|
|
|
public void onSuccess() {
|
|
openWizard();
|
|
CSVImportWizardTD importWizard = new CSVImportWizardTD(
|
|
"CSV Import");
|
|
|
|
importWizard.addListener(new WizardListener() {
|
|
|
|
public void failed(Throwable throwable, String reason,
|
|
String details) {
|
|
alertMessage(reason, details);
|
|
resumeUIState();
|
|
}
|
|
|
|
public void completed(TRId id) {
|
|
openTable(id);
|
|
|
|
}
|
|
|
|
public void aborted() {
|
|
resumeUIState();
|
|
}
|
|
});
|
|
|
|
importWizard.show();
|
|
}
|
|
|
|
public void onFailure(Throwable reason) {
|
|
asyncCodeLoadingFailed(reason);
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
protected com.extjs.gxt.ui.client.widget.Window tdTaskMainWindow;
|
|
|
|
protected void openTasksManagerWizard() {
|
|
initTaskManager();
|
|
tdTaskMainWindow.setPosition((Window.getClientWidth() / 2) - 200,
|
|
(Window.getClientHeight() / 2) - 300);
|
|
tdTaskController.updateTasks(true);
|
|
tdTaskMainWindow.show();
|
|
}
|
|
|
|
protected void initTaskManager() {
|
|
if (!taskManagerInit) {
|
|
taskManagerInit = true;
|
|
tdTaskController = TdTaskController.getInstance();
|
|
TdTaskController.bindCommonBus(eventBus);
|
|
tdTaskMainWindow = tdTaskController.getWindowTaskMonitor();
|
|
} else {
|
|
|
|
}
|
|
}
|
|
|
|
protected void openTemplateNew() {
|
|
|
|
TdTemplateController tdTemplateController = new TdTemplateController();
|
|
tdTemplateController.getWindowTemplatePanel().show();
|
|
|
|
}
|
|
|
|
protected void openTemplateOpen() {
|
|
|
|
}
|
|
|
|
protected void openMultiColumnFilter() {
|
|
Log.debug("Request Open Multi Column Filter Dialog");
|
|
if (trId != null) {
|
|
MultiColumnFilterDialog mcfDialog = new MultiColumnFilterDialog(
|
|
trId, eventBus);
|
|
mcfDialog.show();
|
|
}
|
|
}
|
|
|
|
protected void openColumnFilter(String columnName) {
|
|
Log.debug("Request Open Column Filter Dialog");
|
|
if (trId != null) {
|
|
ColumnFilterDialog cfDialog = new ColumnFilterDialog(trId,
|
|
columnName, eventBus);
|
|
cfDialog.show();
|
|
}
|
|
}
|
|
|
|
protected void openColumnType() {
|
|
openColumnType(null);
|
|
}
|
|
|
|
protected void openColumnType(String columnName) {
|
|
Log.debug("Request Open Change Column Tab");
|
|
if (trId != null) {
|
|
WidgetRequestEvent e = new WidgetRequestEvent(
|
|
WidgetRequestType.CHANGECOLUMNTYPEPANEL);
|
|
e.setTrId(trId);
|
|
e.setColumnName(columnName);
|
|
eventBus.fireEvent(e);
|
|
}
|
|
}
|
|
|
|
protected void openColumnDelete() {
|
|
openColumnDelete(null);
|
|
}
|
|
|
|
protected void openColumnDelete(String columnName) {
|
|
Log.debug("Request Delete Column Tab");
|
|
if (trId != null) {
|
|
WidgetRequestEvent e = new WidgetRequestEvent(
|
|
WidgetRequestType.DELETECOLUMNPANEL);
|
|
e.setTrId(trId);
|
|
e.setColumnName(columnName);
|
|
eventBus.fireEvent(e);
|
|
}
|
|
}
|
|
|
|
protected void openColumnLabel() {
|
|
openColumnLabel(null);
|
|
}
|
|
|
|
protected void openColumnLabel(String columnName) {
|
|
Log.debug("Request Column Label Tab");
|
|
if (trId != null) {
|
|
WidgetRequestEvent e = new WidgetRequestEvent(
|
|
WidgetRequestType.LABELCOLUNPANEL);
|
|
e.setTrId(trId);
|
|
e.setColumnName(columnName);
|
|
eventBus.fireEvent(e);
|
|
}
|
|
}
|
|
|
|
protected void openTableType() {
|
|
Log.debug("Request Change Table Type Tab");
|
|
if (trId != null) {
|
|
WidgetRequestEvent e = new WidgetRequestEvent(
|
|
WidgetRequestType.CHANGETABLETYPEPANEL);
|
|
e.setTrId(trId);
|
|
eventBus.fireEvent(e);
|
|
}
|
|
}
|
|
|
|
protected void doChangeTableRequestEventCommand(
|
|
ChangeTableRequestEvent event) {
|
|
Log.debug("Change Table Request to " + event.getTrId());
|
|
openTable(event.getTrId());
|
|
};
|
|
|
|
protected void doGridContextMenuCommand(GridContextMenuItemEvent event) {
|
|
Log.debug("GridContextMenu Fire Event",
|
|
"OperationId: " + event.getGridOperationId());
|
|
GridOperationId gridOperationId = event.getGridOperationId();
|
|
ArrayList<String> rows = event.getRows();
|
|
|
|
if(rows==null || rows.size()==0){
|
|
alertMessage("No rows selected", "No rows selected");
|
|
return;
|
|
}
|
|
|
|
switch (gridOperationId) {
|
|
case ROWADD:
|
|
break;
|
|
case ROWEDIT:
|
|
break;
|
|
case ROWDELETE:
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
}
|
|
|
|
protected void doGridHeaderColumnMenuCommand(
|
|
GridHeaderColumnMenuItemEvent event) {
|
|
Log.debug("GridHeaderColumnMenu Fire Event",
|
|
"OperationId: " + event.getOperationId() + " Column: \n"
|
|
+ event.getColumnSelected());
|
|
String opId = event.getOperationId();
|
|
String columnName = tabularData.getColumnId(event.getColumnSelected());
|
|
Log.debug("GridColumnName: " + columnName);
|
|
|
|
if (opId.compareTo(GridHeaderOperationId.COLUMNLABEL.toString()) == 0) {
|
|
openColumnLabel(columnName);
|
|
} else {
|
|
if (opId.compareTo(GridHeaderOperationId.COLUMNADD.toString()) == 0) {
|
|
|
|
} else {
|
|
if (opId.compareTo(GridHeaderOperationId.COLUMNEDIT.toString()) == 0) {
|
|
|
|
} else {
|
|
if (opId.compareTo(GridHeaderOperationId.COLUMNDELETE
|
|
.toString()) == 0) {
|
|
openColumnDelete(columnName);
|
|
} else {
|
|
if (opId.compareTo(GridHeaderOperationId.COLUMNTYPE
|
|
.toString()) == 0) {
|
|
openColumnType(columnName);
|
|
} else {
|
|
if (opId.compareTo(GridHeaderOperationId.COLUMNFILTER
|
|
.toString()) == 0) {
|
|
openColumnFilter(columnName);
|
|
} else {
|
|
if (opId.compareTo(GridHeaderOperationId.ANNOTATIONADD
|
|
.toString()) == 0) {
|
|
|
|
} else {
|
|
if (opId.compareTo(GridHeaderOperationId.DUPLICATEDETECTION
|
|
.toString()) == 0) {
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
protected void asyncCodeLoadingFailed(Throwable reason) {
|
|
Log.error("Async code loading failed", reason);
|
|
Info.display("Async code loading failed",
|
|
"Please retry to lunch the operation");
|
|
}
|
|
|
|
/**
|
|
* {@inheritDoc}
|
|
*
|
|
* @Override public HandlerRegistration addCloseHandler(CloseHandler<Long>
|
|
* handler) { //return eventBus.addHandler(CloseEvent.getType(),
|
|
* handler); }
|
|
*
|
|
* /** {@inheritDoc}
|
|
* @Override public HandlerRegistration addOpenHandler(OpenHandler<Long>
|
|
* handler) { //return eventBus.addHandler(OpenEvent.getType(),
|
|
* handler); }
|
|
*/
|
|
|
|
/**
|
|
* {@inheritDoc}
|
|
*
|
|
* @Override public void fireEvent(GwtEvent<?> event) {
|
|
* eventBus.fireEvent(event); }
|
|
*/
|
|
|
|
}
|