Search in sources :

Example 1 with TableStructureEntity

use of org.talend.dataprofiler.core.ui.editor.preview.model.entity.TableStructureEntity in project tdq-studio-se by Talend.

the class FunctionalDependencyAnalysisResultPage method createTable.

/**
 * DOC xqliu Comment method "createTable".
 *
 * @param composite
 */
private void createTable(Composite composite) {
    final TableViewer tableViewer = new TableViewer(composite, SWT.FULL_SELECTION | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    Table resultTable = tableViewer.getTable();
    resultTable.setLinesVisible(true);
    resultTable.setHeaderVisible(true);
    // create table headers
    TableStructureEntity tableStructure = getTableStructure();
    String[] fieldNames = tableStructure.getFieldNames();
    Integer[] fieldWidths = tableStructure.getFieldWidths();
    for (int i = 0; i < fieldNames.length; ++i) {
        TableColumn columnHeader = new TableColumn(resultTable, SWT.LEFT);
        columnHeader.setText(fieldNames[i]);
        columnHeader.setWidth(fieldWidths[i]);
    }
    // create table items
    CustomerDefaultCategoryDataset dataset = initCustomerDataset();
    ChartDataEntity[] dataEntities = dataset.getDataEntities();
    if (dataEntities != null) {
        // MOD mzhao bug 8839 There might be duplicate dependencies on left and right columnSet.
        if (canShowChartForResultPage() && TOPChartUtils.getInstance().getColumnCount(dataset.getDataset()) < dataEntities.length) {
            // $NON-NLS-1$
            MessageDialog.openError(// $NON-NLS-1$
            this.getEditor().getSite().getShell(), // $NON-NLS-1$
            "Duplicate dependencies", // $NON-NLS-1$
            "There might be duplicate dependencies on left and right columnSet.");
        } else {
            for (ChartDataEntity dataEntity : dataEntities) {
                TableItem item = new TableItem(resultTable, SWT.NULL);
                String numMatch = ((PatternChartDataEntity) dataEntity).getNumMatch();
                String numNoMatch = ((PatternChartDataEntity) dataEntity).getNumNoMatch();
                Number match = Long.parseLong(numMatch);
                Number notMatch = Long.parseLong(numNoMatch);
                Number row = match.intValue() + notMatch.intValue();
                item.setText(0, dataEntity.getLabel());
                item.setText(1, String.valueOf(match.intValue()));
                // TDQ-8695 display "N/A" if it is infinite or NaN
                double percentage = match.doubleValue() / row.doubleValue();
                if (Double.isNaN(percentage) || Double.isInfinite(percentage)) {
                    item.setText(2, PluginConstant.NA_STRING);
                } else {
                    item.setText(2, StringFormatUtil.format(String.valueOf(percentage), StringFormatUtil.PERCENT).toString());
                }
                item.setText(3, String.valueOf(row));
                item.setData(dataEntity);
            }
        }
    }
    GridData gd = new GridData();
    gd.heightHint = 180;
    gd.widthHint = 450;
    resultTable.setLayoutData(gd);
    // add menus
    ChartTableFactory.addMenuAndTip(tableViewer, new ColumnDependencyExplorer(), this.masterPage.getCurrentModelElement());
}
Also used : Table(org.eclipse.swt.widgets.Table) TableItem(org.eclipse.swt.widgets.TableItem) TableStructureEntity(org.talend.dataprofiler.core.ui.editor.preview.model.entity.TableStructureEntity) PatternChartDataEntity(org.talend.dq.indicators.preview.table.PatternChartDataEntity) ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity) TableColumn(org.eclipse.swt.widgets.TableColumn) CustomerDefaultCategoryDataset(org.talend.dataprofiler.common.ui.editor.preview.CustomerDefaultCategoryDataset) PatternChartDataEntity(org.talend.dq.indicators.preview.table.PatternChartDataEntity) GridData(org.eclipse.swt.layout.GridData) ColumnDependencyExplorer(org.talend.dq.analysis.explore.ColumnDependencyExplorer) TableViewer(org.eclipse.jface.viewers.TableViewer)

Example 2 with TableStructureEntity

use of org.talend.dataprofiler.core.ui.editor.preview.model.entity.TableStructureEntity in project tdq-studio-se by Talend.

the class BenfordLawFrequencyTableState method getTableStructure.

@Override
protected TableStructureEntity getTableStructure() {
    TableStructureEntity entity = new TableStructureEntity();
    entity.setFieldNames(new String[] { DefaultMessagesImpl.getString("BenfordLawFrequencyState.value"), DefaultMessagesImpl.getString("FrequencyTypeStates.count"), // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    "%" });
    entity.setFieldWidths(new Integer[] { 200, 150, 150 });
    return entity;
}
Also used : TableStructureEntity(org.talend.dataprofiler.core.ui.editor.preview.model.entity.TableStructureEntity)

Example 3 with TableStructureEntity

use of org.talend.dataprofiler.core.ui.editor.preview.model.entity.TableStructureEntity in project tdq-studio-se by Talend.

the class SimpleStatisticsTableState method getTableStructure.

@Override
protected TableStructureEntity getTableStructure() {
    TableStructureEntity entity = new TableStructureEntity();
    entity.setFieldNames(new String[] { DefaultMessagesImpl.getString("SimpleStatisticsState.Label"), DefaultMessagesImpl.getString("SimpleStatisticsState.Count"), // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    "%" });
    entity.setFieldWidths(new Integer[] { 200, 150, 150 });
    return entity;
}
Also used : TableStructureEntity(org.talend.dataprofiler.core.ui.editor.preview.model.entity.TableStructureEntity)

Example 4 with TableStructureEntity

use of org.talend.dataprofiler.core.ui.editor.preview.model.entity.TableStructureEntity in project tdq-studio-se by Talend.

the class SoundexFrequencyTableState method getTableStructure.

@Override
protected TableStructureEntity getTableStructure() {
    TableStructureEntity entity = new TableStructureEntity();
    entity.setFieldNames(new String[] { DefaultMessagesImpl.getString("FrequencyTypeStates.value"), DefaultMessagesImpl.getString("FrequencyTypeStates.distinctCount"), DefaultMessagesImpl.getString("FrequencyTypeStates.count"), // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
    "%" });
    entity.setFieldWidths(new Integer[] { 180, 120, 100, 100 });
    return entity;
}
Also used : TableStructureEntity(org.talend.dataprofiler.core.ui.editor.preview.model.entity.TableStructureEntity)

Example 5 with TableStructureEntity

use of org.talend.dataprofiler.core.ui.editor.preview.model.entity.TableStructureEntity in project tdq-studio-se by Talend.

the class PatternStatisticsTableState method getTableStructure.

@Override
protected TableStructureEntity getTableStructure() {
    TableStructureEntity entity = new TableStructureEntity();
    entity.setFieldNames(new String[] { DefaultMessagesImpl.getString("PatternStatisticsState.Label"), DefaultMessagesImpl.getString("PatternStatisticsState.Match"), DefaultMessagesImpl.getString("PatternStatisticsState.NoMatch"), DefaultMessagesImpl.getString("PatternStatisticsState.Match_"), // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
    DefaultMessagesImpl.getString("PatternStatisticsState.NoMatch_") });
    entity.setFieldWidths(new Integer[] { 200, 75, 75, 75, 75 });
    return entity;
}
Also used : TableStructureEntity(org.talend.dataprofiler.core.ui.editor.preview.model.entity.TableStructureEntity)

Aggregations

TableStructureEntity (org.talend.dataprofiler.core.ui.editor.preview.model.entity.TableStructureEntity)16 TableViewer (org.eclipse.jface.viewers.TableViewer)1 GridData (org.eclipse.swt.layout.GridData)1 Table (org.eclipse.swt.widgets.Table)1 TableColumn (org.eclipse.swt.widgets.TableColumn)1 TableItem (org.eclipse.swt.widgets.TableItem)1 CustomerDefaultCategoryDataset (org.talend.dataprofiler.common.ui.editor.preview.CustomerDefaultCategoryDataset)1 ColumnDependencyExplorer (org.talend.dq.analysis.explore.ColumnDependencyExplorer)1 ChartDataEntity (org.talend.dq.indicators.preview.table.ChartDataEntity)1 PatternChartDataEntity (org.talend.dq.indicators.preview.table.PatternChartDataEntity)1