Search in sources :

Example 1 with IExecutionTaskDialog

use of org.jowidgets.cap.ui.api.widgets.IExecutionTaskDialog in project jo-client-platform by jo-source.

the class CsvExportExecutor method execute.

@Override
public void execute(final IExecutionContext executionContext, final List<IBeanProxy<BEAN_TYPE>> beans, final ICsvExportParameter parameter) throws Exception {
    final IExecutionTask executionTask = CapUiToolkit.executionTaskFactory().create(executionContext);
    final IExecutionTaskDialog executionTaskDialog = createExecutionTaskDialog(executionContext, executionTask);
    final IResultCallback<String> resultCallback = new ResultCallback(executionTaskDialog);
    final Runnable exportRunnable;
    if (parameter.getExportType() == ExportType.SELECTION) {
        final List<IBeanDto> beanDtos = createBeanDtos(beans, model.getPropertyNames());
        exportRunnable = new CsvExportSelectedRunnable(model, resultCallback, parameter, beanDtos, executionTask);
    } else {
        final List<IBeanDto> addedData = createBeanDtos(model.getAddedData(), model.getPropertyNames());
        exportRunnable = new CsvExportTableRunnable(model, addedData, resultCallback, parameter, executionTask);
    }
    executionTaskDialog.setVisible(true);
    executor.execute(exportRunnable);
}
Also used : AbstractUiResultCallback(org.jowidgets.cap.ui.tools.execution.AbstractUiResultCallback) IResultCallback(org.jowidgets.cap.common.api.execution.IResultCallback) IBeanDto(org.jowidgets.cap.common.api.bean.IBeanDto) IExecutionTaskDialog(org.jowidgets.cap.ui.api.widgets.IExecutionTaskDialog) IExecutionTask(org.jowidgets.cap.ui.api.execution.IExecutionTask)

Aggregations

IBeanDto (org.jowidgets.cap.common.api.bean.IBeanDto)1 IResultCallback (org.jowidgets.cap.common.api.execution.IResultCallback)1 IExecutionTask (org.jowidgets.cap.ui.api.execution.IExecutionTask)1 IExecutionTaskDialog (org.jowidgets.cap.ui.api.widgets.IExecutionTaskDialog)1 AbstractUiResultCallback (org.jowidgets.cap.ui.tools.execution.AbstractUiResultCallback)1