Search in sources :

Example 1 with ModelElementIndicator

use of org.talend.dataprofiler.core.model.ModelElementIndicator in project tdq-studio-se by Talend.

the class MasterPaginationInfo method render.

@Override
protected void render() {
    // refresh analysis tree
    if (treeViewer != null) {
        treeViewer.setElements(modelElementIndicators.toArray(new ModelElementIndicator[modelElementIndicators.size()]), false);
    }
    // chart composite don't display So need't consider it.
    if (previewChartList == null || uiPagination.getChartComposite() == null) {
        return;
    }
    previewChartList.clear();
    clearDynamicList();
    if (EditorPreferencePage.isHideGraphicsSectionForSettingsPage() || !TOPChartUtils.getInstance().isTOPChartInstalled()) {
        return;
    }
    for (ModelElementIndicator modelElementIndicator : modelElementIndicators) {
        final ExpandableComposite exComp = uiPagination.getToolkit().createExpandableComposite(uiPagination.getChartComposite(), ExpandableComposite.TREE_NODE | ExpandableComposite.CLIENT_INDENT);
        needDispostWidgets.add(exComp);
        exComp.setText(DefaultMessagesImpl.getString("ColumnMasterDetailsPage.column", // $NON-NLS-1$
        modelElementIndicator.getElementName()));
        exComp.setLayout(new GridLayout());
        exComp.setData(modelElementIndicator);
        previewChartList.add(exComp);
        Composite comp = uiPagination.getToolkit().createComposite(exComp);
        comp.setLayout(new GridLayout());
        comp.setLayoutData(new GridData(GridData.FILL_BOTH));
        Map<EIndicatorChartType, List<IndicatorUnit>> indicatorComposite = CompositeIndicator.getInstance().getIndicatorComposite(modelElementIndicator);
        for (EIndicatorChartType chartType : indicatorComposite.keySet()) {
            List<IndicatorUnit> units = indicatorComposite.get(chartType);
            if (!units.isEmpty()) {
                if (chartType == EIndicatorChartType.UDI_FREQUENCY) {
                    for (IndicatorUnit unit : units) {
                        List<IndicatorUnit> specialUnit = new ArrayList<IndicatorUnit>();
                        specialUnit.add(unit);
                        createChart(comp, chartType, specialUnit);
                    }
                } else {
                    createChart(comp, chartType, units);
                }
            }
        }
        exComp.addExpansionListener(new ExpansionAdapter() {

            @Override
            public void expansionStateChanged(ExpansionEvent e) {
                uiPagination.getChartComposite().layout();
                form.reflow(true);
                if (e.getState()) {
                    exComp.setExpanded(e.getState());
                    exComp.getParent().pack();
                }
            }
        });
        exComp.setExpanded(true);
        exComp.setClient(comp);
        uiPagination.getChartComposite().layout();
    }
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) ArrayList(java.util.ArrayList) ExpansionAdapter(org.eclipse.ui.forms.events.ExpansionAdapter) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData) EIndicatorChartType(org.talend.dq.indicators.preview.EIndicatorChartType) ArrayList(java.util.ArrayList) List(java.util.List) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ExpansionEvent(org.eclipse.ui.forms.events.ExpansionEvent) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Example 2 with ModelElementIndicator

use of org.talend.dataprofiler.core.model.ModelElementIndicator in project tdq-studio-se by Talend.

the class ResultPaginationInfo method render.

@Override
protected void render() {
    clearDynamicList();
    allExpandableCompositeList.clear();
    columnCompositeMap.clear();
    for (ModelElementIndicator modelElementIndicator : modelElementIndicators) {
        ExpandableComposite exComp = uiPagination.getToolkit().createExpandableComposite(uiPagination.getChartComposite(), ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT | ExpandableComposite.EXPANDED | ExpandableComposite.LEFT_TEXT_CLIENT_ALIGNMENT);
        needDispostWidgets.add(exComp);
        allExpandableCompositeList.add(exComp);
        // MOD klliu add more information about the column belongs to which table/view.
        IRepositoryNode modelElementRepositoryNode = modelElementIndicator.getModelElementRepositoryNode();
        IRepositoryNode parentNodeForColumnNode = RepositoryNodeHelper.getParentNodeForColumnNode(modelElementRepositoryNode);
        String label = parentNodeForColumnNode.getObject().getLabel();
        if (label != null && !label.equals("")) {
            // $NON-NLS-1$
            // $NON-NLS-1$
            label = label.concat(".").concat(modelElementIndicator.getElementName());
        } else {
            label = modelElementIndicator.getElementName();
        }
        // ~
        // $NON-NLS-1$
        exComp.setText(DefaultMessagesImpl.getString("ColumnAnalysisResultPage.Column", label));
        exComp.setLayout(new GridLayout());
        exComp.setLayoutData(new GridData(GridData.FILL_BOTH));
        // MOD xqliu 2009-06-23 bug 7481
        exComp.setExpanded(EditorPreferencePage.isUnfoldingAnalyzedEelementsResultPage());
        // ~
        // TDQ-11525 msjian : Add "expand all" and "fold all" icon buttons in the "Analysis Results" section
        Composite collapseExpandComposite = uiPagination.getToolkit().createComposite(exComp);
        GridLayout gdLayout = new GridLayout();
        gdLayout.numColumns = 2;
        collapseExpandComposite.setLayout(gdLayout);
        createCollapseAllLink(collapseExpandComposite, label);
        createExpandAllLink(collapseExpandComposite, label);
        exComp.setTextClient(collapseExpandComposite);
        // TDQ-11525~
        Composite comp = uiPagination.getToolkit().createComposite(exComp);
        comp.setLayout(new GridLayout());
        comp.setLayoutData(new GridData(GridData.FILL_BOTH));
        exComp.setClient(comp);
        createResultDataComposite(comp, modelElementIndicator);
        columnCompositeMap.put(label, comp);
        exComp.addExpansionListener(new ExpansionAdapter() {

            @Override
            public void expansionStateChanged(ExpansionEvent e) {
                uiPagination.getChartComposite().layout();
                form.reflow(true);
            }
        });
        uiPagination.getChartComposite().layout();
        masterPage.registerSection(exComp);
    }
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) IRepositoryNode(org.talend.repository.model.IRepositoryNode) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) GridData(org.eclipse.swt.layout.GridData) ExpansionAdapter(org.eclipse.ui.forms.events.ExpansionAdapter) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ExpansionEvent(org.eclipse.ui.forms.events.ExpansionEvent) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Example 3 with ModelElementIndicator

use of org.talend.dataprofiler.core.model.ModelElementIndicator in project tdq-studio-se by Talend.

the class ColumnAnalysisDetailsPage method propertyChange.

public void propertyChange(PropertyChangeEvent evt) {
    if (PluginConstant.ISDIRTY_PROPERTY.equals(evt.getPropertyName())) {
        ((AnalysisEditor) currentEditor).firePropertyChange(IEditorPart.PROP_DIRTY);
        ((AnalysisEditor) currentEditor).setRefreshResultPage(true);
    // synNagivatorStat();
    } else if (PluginConstant.DATAFILTER_PROPERTY.equals(evt.getPropertyName())) {
        this.analysisHandler.setStringDataFilter((String) evt.getNewValue());
    } else if (PluginConstant.EXPAND_TREE.equals(evt.getPropertyName())) {
        ModelElementIndicator indicator = (ModelElementIndicator) ((Widget) evt.getNewValue()).getData(AbstractColumnDropTree.MODELELEMENT_INDICATOR_KEY);
        expandChart(indicator);
    }
}
Also used : ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Example 4 with ModelElementIndicator

use of org.talend.dataprofiler.core.model.ModelElementIndicator 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 5 with ModelElementIndicator

use of org.talend.dataprofiler.core.model.ModelElementIndicator in project tdq-studio-se by Talend.

the class ColumnAnalysisDetailsPage method canSave.

@Override
public ReturnCode canSave() {
    // MOD by gdbu 2011-3-21 bug 19179
    ReturnCode canModRetCode = super.canSave();
    if (!canModRetCode.isOk()) {
        return canModRetCode;
    }
    // ~19179
    List<ModelElement> analyzedElement = new ArrayList<ModelElement>();
    for (ModelElementIndicator modelElementIndicator : treeViewer.getModelElementIndicator()) {
        IRepositoryViewObject modelElementRepositoryObj = modelElementIndicator.getModelElementRepositoryNode().getObject();
        if (modelElementRepositoryObj instanceof MetadataColumnRepositoryObject) {
            analyzedElement.add(((MetadataColumnRepositoryObject) modelElementRepositoryObj).getTdColumn());
        }
    }
    if (!analyzedElement.isEmpty()) {
        if (!ModelElementHelper.isFromSameTable(analyzedElement) && !"".equals(dataFilterComp.getDataFilterString())) {
            // $NON-NLS-1$
            return new ReturnCode(DefaultMessagesImpl.getString("ColumnMasterDetailsPage.CannotCreatAnalysis"), false);
        }
    }
    if (!this.isValidateRowCount()) {
        // $NON-NLS-1$
        return new ReturnCode(DefaultMessagesImpl.getString("MatchMasterDetailsPage.LoadedRowCountError"), false);
    }
    return new ReturnCode(true);
}
Also used : ModelElement(orgomg.cwm.objectmodel.core.ModelElement) ReturnCode(org.talend.utils.sugars.ReturnCode) ArrayList(java.util.ArrayList) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MetadataColumnRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Aggregations

ModelElementIndicator (org.talend.dataprofiler.core.model.ModelElementIndicator)58 IRepositoryNode (org.talend.repository.model.IRepositoryNode)22 ArrayList (java.util.ArrayList)16 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)16 ModelElement (orgomg.cwm.objectmodel.core.ModelElement)16 MetadataColumnRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject)15 Indicator (org.talend.dataquality.indicators.Indicator)13 IndicatorUnit (org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit)12 TreeItem (org.eclipse.swt.widgets.TreeItem)11 RepositoryNode (org.talend.repository.model.RepositoryNode)10 IndicatorEnum (org.talend.dq.nodes.indicator.type.IndicatorEnum)9 MetadataXmlElementTypeRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataXmlElementTypeRepositoryObject)7 Connection (org.talend.core.model.metadata.builder.connection.Connection)6 CompositeIndicator (org.talend.dataquality.indicators.CompositeIndicator)6 MetadataTableRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataTableRepositoryObject)5 TreeEditor (org.eclipse.swt.custom.TreeEditor)4 MouseAdapter (org.eclipse.swt.events.MouseAdapter)4 MouseEvent (org.eclipse.swt.events.MouseEvent)4 Composite (org.eclipse.swt.widgets.Composite)4 Label (org.eclipse.swt.widgets.Label)4