Search in sources :

Example 1 with UIPagination

use of org.talend.dataprofiler.core.ui.utils.pagination.UIPagination in project tdq-studio-se by Talend.

the class ColumnAnalysisDetailsPage method computePagination.

/**
 * DOC zshen Comment method "computePagination".
 */
private void computePagination() {
    disposeChartComposite();
    if (uiPagination == null) {
        uiPagination = new UIPagination(toolkit, navigationComposite);
    } else {
        lastTimePageNumber = uiPagination.getCurrentPageNumber();
        uiPagination.reset();
    }
    final ModelElementIndicator[] modelElementIndicatorArrary = this.getCurrentModelElementIndicators();
    int pageSize = IndicatorPaginationInfo.getPageSize();
    int totalPages = modelElementIndicatorArrary.length / pageSize;
    List<ModelElementIndicator> modelElementIndicatorList = null;
    for (int index = 0; index < totalPages; index++) {
        modelElementIndicatorList = new ArrayList<ModelElementIndicator>();
        for (int idx = 0; idx < pageSize; idx++) {
            modelElementIndicatorList.add(modelElementIndicatorArrary[index * pageSize + idx]);
        }
        IndicatorPaginationInfo pginfo = new MasterPaginationInfo(form, previewChartList, modelElementIndicatorList, uiPagination, treeViewer);
        uiPagination.addPage(pginfo);
    }
    int left = modelElementIndicatorArrary.length % pageSize;
    if (left != 0 || totalPages == 0) {
        modelElementIndicatorList = new ArrayList<ModelElementIndicator>();
        for (int leftIdx = 0; leftIdx < left; leftIdx++) {
            modelElementIndicatorList.add(modelElementIndicatorArrary[totalPages * pageSize + leftIdx]);
        }
        IndicatorPaginationInfo pginfo = new MasterPaginationInfo(form, previewChartList, modelElementIndicatorList, uiPagination, treeViewer);
        uiPagination.addPage(pginfo);
        // FIXME totalPages won't used anymore.
        totalPages++;
    }
    uiPagination.init();
}
Also used : UIPagination(org.talend.dataprofiler.core.ui.utils.pagination.UIPagination) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Example 2 with UIPagination

use of org.talend.dataprofiler.core.ui.utils.pagination.UIPagination in project tdq-studio-se by Talend.

the class ColumnAnalysisResultPage method createResultSection.

@Override
protected void createResultSection(Composite parent) {
    resultSection = createSection(form, parent, DefaultMessagesImpl.getString("ColumnAnalysisResultPage.analysisResult"), // $NON-NLS-1$
    null);
    // TDQ-11525 msjian: Add "expand all" and "fold all" icon buttons in the "Analysis Results" section
    Composite collapseExpandComposite = toolkit.createComposite(resultSection);
    GridLayout gdLayout = new GridLayout();
    gdLayout.numColumns = 2;
    collapseExpandComposite.setLayout(gdLayout);
    createCollapseAllLink(collapseExpandComposite);
    createExpandAllLink(collapseExpandComposite);
    resultSection.setTextClient(collapseExpandComposite);
    // TDQ-11525
    Composite chartTableComposite = toolkit.createComposite(resultSection);
    chartTableComposite.setLayout(new GridLayout());
    chartTableComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    final ModelElementIndicator[] modelElementIndicatores = masterPage.getCurrentModelElementIndicators();
    // ~ MOD mzhao 2009-04-20, Do pagination. Bug 6512.
    uiPagination = new UIPagination(toolkit, chartTableComposite);
    int pageSize = IndicatorPaginationInfo.getPageSize();
    int totalPages = modelElementIndicatores.length / pageSize;
    List<ModelElementIndicator> modelElementIndLs = null;
    for (int index = 0; index < totalPages; index++) {
        modelElementIndLs = new ArrayList<ModelElementIndicator>();
        for (int idx = 0; idx < pageSize; idx++) {
            modelElementIndLs.add(modelElementIndicatores[index * pageSize + idx]);
        }
        IndicatorPaginationInfo pginfo = new ResultPaginationInfo(form, modelElementIndLs, masterPage, uiPagination);
        uiPagination.addPage(pginfo);
    }
    int left = modelElementIndicatores.length % pageSize;
    if (left != 0) {
        modelElementIndLs = new ArrayList<ModelElementIndicator>();
        for (int leftIdx = 0; leftIdx < left; leftIdx++) {
            modelElementIndLs.add(modelElementIndicatores[totalPages * pageSize + leftIdx]);
        }
        IndicatorPaginationInfo pginfo = new ResultPaginationInfo(form, modelElementIndLs, masterPage, uiPagination);
        uiPagination.addPage(pginfo);
    }
    chartComposite = toolkit.createComposite(chartTableComposite);
    chartComposite.setLayout(new GridLayout());
    chartComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    // ~
    resultSection.setClient(chartTableComposite);
    uiPagination.setChartComposite(chartComposite);
    uiPagination.init();
    chartComposite.layout();
    chartComposite.pack();
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) UIPagination(org.talend.dataprofiler.core.ui.utils.pagination.UIPagination) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) GridData(org.eclipse.swt.layout.GridData) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Aggregations

ModelElementIndicator (org.talend.dataprofiler.core.model.ModelElementIndicator)2 UIPagination (org.talend.dataprofiler.core.ui.utils.pagination.UIPagination)2 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Composite (org.eclipse.swt.widgets.Composite)1 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)1