Search in sources :

Example 16 with IndicatorUnit

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

the class AnalysisColumnTreeViewer method createTree.

/**
 * @param parent
 */
private Tree createTree(Composite parent) {
    final Tree newTree = new TooltipTree(parent, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION) {

        @Override
        protected boolean isValidItem(TreeItem item) {
            if (item == null) {
                return false;
            }
            Object itemData = item.getData(INDICATOR_UNIT_KEY);
            Object columnItemData = item.getData(MODELELEMENT_INDICATOR_KEY);
            if (itemData != null) {
                IndicatorUnit indicatorUnit = (IndicatorUnit) item.getData(INDICATOR_UNIT_KEY);
                if (indicatorUnit != null && !(indicatorUnit.getIndicator() instanceof CompositeIndicator)) {
                    return true;
                }
                return false;
            } else {
                if (columnItemData != null) {
                    ModelElementIndicator modelElementIndicator = (ModelElementIndicator) columnItemData;
                    IRepositoryNode modelElementRepositoryNode = modelElementIndicator.getModelElementRepositoryNode();
                    return modelElementRepositoryNode == null ? false : true;
                }
                return false;
            }
        }

        @Override
        protected String getItemTooltipText(TreeItem item) {
            String expCont = isExpressionNull(item);
            if (expCont == null) {
                // $NON-NLS-1$
                return DefaultMessagesImpl.getString("AnalysisColumnTreeViewer.queryNotGen");
            }
            return expCont;
        }
    };
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(newTree);
    newTree.setHeaderVisible(true);
    // $NON-NLS-1$
    createTreeItem(newTree, 300, "AnalysisColumnTreeViewer.analyzedColumns");
    createTreeDataminingItem(newTree);
    // $NON-NLS-1$
    createTreeItem(newTree, 80, "AnalysisColumnTreeViewer.pattern");
    // $NON-NLS-1$
    createTreeItem(newTree, 80, "AnalysisColumnTreeViewer.udi");
    // $NON-NLS-1$
    createTreeItem(newTree, 80, "AnalysisColumnTreeViewer.operation");
    // TDQ-11622 : add a column here, let the width = 1 and text = EMPTY_STRING TODO need to find a better solution!
    TreeColumn blankColumn = new TreeColumn(newTree, SWT.CENTER);
    blankColumn.setWidth(1);
    // ~ TDQ-11622
    parent.layout();
    AbstractAnalysisActionHandler actionHandler = new AbstractAnalysisActionHandler(parent) {

        @Override
        protected void handleRemove() {
            removeSelectedElements(newTree);
        }
    };
    parent.setData(AbstractMetadataFormPage.ACTION_HANDLER, actionHandler);
    ColumnViewerDND.installDND(newTree);
    this.addTreeListener(newTree);
    newTree.setData(this);
    return newTree;
}
Also used : AbstractAnalysisActionHandler(org.talend.dataprofiler.core.ui.editor.AbstractAnalysisActionHandler) IRepositoryNode(org.talend.repository.model.IRepositoryNode) TreeItem(org.eclipse.swt.widgets.TreeItem) TreeColumn(org.eclipse.swt.widgets.TreeColumn) CompositeIndicator(org.talend.dataquality.indicators.CompositeIndicator) IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) TooltipTree(org.talend.dataprofiler.core.ui.dialog.composite.TooltipTree) Tree(org.eclipse.swt.widgets.Tree) MetadataTableRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataTableRepositoryObject) MetadataColumnRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject) MetadataXmlElementTypeRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataXmlElementTypeRepositoryObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) TooltipTree(org.talend.dataprofiler.core.ui.dialog.composite.TooltipTree) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Example 17 with IndicatorUnit

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

the class ModelElementTreeMenuProvider method editPattern.

private void editPattern(Tree tree) {
    TreeItem[] selection = tree.getSelection();
    if (selection.length > 0) {
        TreeItem treeItem = selection[0];
        IndicatorUnit indicatorUnit = (IndicatorUnit) treeItem.getData(AbstractColumnDropTree.INDICATOR_UNIT_KEY);
        PatternMatchingIndicator indicator = (PatternMatchingIndicator) indicatorUnit.getIndicator();
        Pattern pattern = indicator.getParameters().getDataValidDomain().getPatterns().get(0);
        RepositoryNode patternRecursiveFind = RepositoryNodeHelper.recursiveFind(pattern);
        PatternItemEditorInput patternItemEditorInput = new PatternItemEditorInput(patternRecursiveFind);
        CorePlugin.getDefault().openEditor(patternItemEditorInput, PatternEditor.class.getName());
    }
}
Also used : Pattern(org.talend.dataquality.domain.pattern.Pattern) PatternMatchingIndicator(org.talend.dataquality.indicators.PatternMatchingIndicator) PatternEditor(org.talend.dataprofiler.core.ui.editor.pattern.PatternEditor) TreeItem(org.eclipse.swt.widgets.TreeItem) IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) ColumnIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.ColumnIndicatorUnit) PatternItemEditorInput(org.talend.dataprofiler.core.ui.editor.pattern.PatternItemEditorInput) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode)

Example 18 with IndicatorUnit

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

the class PatternMouseAdapter method mouseDown.

@Override
public void mouseDown(MouseEvent e) {
    DataManager dm = analysis.getContext().getConnection();
    if (dm == null) {
        masterPage.doSave(null);
    }
    // MOD gdbu 2011-8-26 bug : TDQ-2169
    IRepositoryNode patternFolderNode = getPatternSelectDialogInputData();
    if (patternFolderNode == null) {
        return;
    }
    CheckedTreeSelectionDialog dialog = PatternUtilities.createPatternCheckedTreeSelectionDialog(patternFolderNode);
    if (null != filters) {
        for (ViewerFilter filter : filters) {
            dialog.addFilter(filter);
        }
    }
    // ~TDQ-2169
    Object[] selectedRepNodes = PatternUtilities.getPatternRepNodesByIndicator(meIndicator);
    dialog.setInitialSelections(selectedRepNodes);
    dialog.create();
    if (dialog.open() == Window.OK) {
        // MOD qiongli 2012-10-17 TDQ-5923,just remove some deselected indicatorUnit,just create new indicatorUnit
        // for some new added pattern nodes.
        List<PatternRepNode> allSelectedPatternNodes = new ArrayList<PatternRepNode>();
        Set<String> allSelectedNodeNames = new HashSet<String>();
        for (Object obj : dialog.getResult()) {
            if (obj instanceof PatternRepNode) {
                PatternRepNode patternNode = (PatternRepNode) obj;
                allSelectedPatternNodes.add(patternNode);
                allSelectedNodeNames.add(patternNode.getLabel());
            }
        }
        Set<String> oldSelectedNodeNames = new HashSet<String>();
        Map<String, IndicatorUnit> oldSelectedUnits = new HashMap<String, IndicatorUnit>();
        for (IndicatorUnit indicatorUnit : meIndicator.getIndicatorUnits()) {
            Indicator indicator = indicatorUnit.getIndicator();
            if (indicator instanceof PatternMatchingIndicator) {
                if (!allSelectedNodeNames.contains(indicator.getName())) {
                    // this method will deal dependency with same time
                    columnDropTree.deleteIndicatorItems(meIndicator, indicatorUnit);
                    if (!columnDropTree.isDirty()) {
                        columnDropTree.setDirty(true);
                    }
                } else {
                    oldSelectedNodeNames.add(indicator.getName());
                    oldSelectedUnits.put(indicator.getName(), indicatorUnit);
                }
            }
        }
        // Added yyin 20121121 TDQ-6329: after remove all, should also add the old selected patterns
        // because the columnset does not have pagination, can not refresh automatically
        boolean addOldSelected = false;
        if (masterPage instanceof ColumnSetAnalysisDetailsPage) {
            addOldSelected = true;
        }
        if (addOldSelected) {
            for (TreeItem child : treeItem.getItems()) {
                masterPage.getTreeViewer().removeItemBranch(child);
            }
        }
        // ~
        treeItem.removeAll();
        for (PatternRepNode patternNode : allSelectedPatternNodes) {
            if (oldSelectedNodeNames.contains(patternNode.getLabel()) && !addOldSelected) {
                continue;
            }
            TypedReturnCode<IndicatorUnit> trc = PatternUtilities.createIndicatorUnit(patternNode.getPattern(), meIndicator, analysis);
            if (trc.isOk()) {
                createOneUnit(trc.getObject());
                // TDQ-8860 add msjian 2014-4-30:check whether show allmatchindicator in the indicators section
                if (masterPage instanceof ColumnSetAnalysisDetailsPage) {
                    EventManager.getInstance().publish(analysis, EventEnum.DQ_COLUMNSET_SHOW_MATCH_INDICATORS, null);
                }
            // TDQ-8860~
            }
        }
        treeItem.setExpanded(true);
        if (masterPage instanceof ColumnAnalysisDetailsPage) {
            ColumnAnalysisDetailsPage page = (ColumnAnalysisDetailsPage) masterPage;
            page.refreshTheTree(page.getCurrentModelElementIndicators());
        }
    }
}
Also used : IRepositoryNode(org.talend.repository.model.IRepositoryNode) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) CheckedTreeSelectionDialog(org.eclipse.ui.dialogs.CheckedTreeSelectionDialog) HashMap(java.util.HashMap) TreeItem(org.eclipse.swt.widgets.TreeItem) ArrayList(java.util.ArrayList) IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) DataManager(orgomg.cwm.foundation.softwaredeployment.DataManager) PatternMatchingIndicator(org.talend.dataquality.indicators.PatternMatchingIndicator) Indicator(org.talend.dataquality.indicators.Indicator) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator) PatternMatchingIndicator(org.talend.dataquality.indicators.PatternMatchingIndicator) ColumnSetAnalysisDetailsPage(org.talend.dataprofiler.core.ui.editor.analysis.ColumnSetAnalysisDetailsPage) ColumnAnalysisDetailsPage(org.talend.dataprofiler.core.ui.editor.analysis.ColumnAnalysisDetailsPage) PatternRepNode(org.talend.dq.nodes.PatternRepNode) HashSet(java.util.HashSet)

Example 19 with IndicatorUnit

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

the class ModeStatisticsState method getCustomerDataset.

public ICustomerDataset getCustomerDataset() {
    CustomerDefaultCategoryDataset customerdataset = new CustomerDefaultCategoryDataset();
    for (IndicatorUnit unit : units) {
        ChartDataEntity entity = ModeStatisticsStateUtil.createDataEntity(unit, unit.getIndicatorName());
        customerdataset.addDataEntity(entity);
    }
    return customerdataset;
}
Also used : IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity) CustomerDefaultCategoryDataset(org.talend.dataprofiler.common.ui.editor.preview.CustomerDefaultCategoryDataset)

Example 20 with IndicatorUnit

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

the class PhoneNumbStatisticsState method getCustomerDataset.

/*
     * (non-Jsdoc)
     * 
     * @see org.talend.dataprofiler.core.ui.editor.preview.model.states.IChartTypeStates#getCustomerDataset()
     */
public ICustomerDataset getCustomerDataset() {
    CustomerDefaultCategoryDataset customerdataset = new CustomerDefaultCategoryDataset();
    for (IndicatorUnit unit : units) {
        String value = CommonStateUtil.getUnitValue(unit.getValue(), StringFormatUtil.DOUBLE_NUMBER);
        String label = unit.getIndicatorName();
        customerdataset.addValue(Double.parseDouble(value), label, label);
        ChartDataEntity entity = PhoneNumbStatisticsStateUtil.createDataEntity(unit.getIndicator(), value, label);
        customerdataset.addDataEntity(entity);
    }
    return customerdataset;
}
Also used : IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity) CustomerDefaultCategoryDataset(org.talend.dataprofiler.common.ui.editor.preview.CustomerDefaultCategoryDataset)

Aggregations

IndicatorUnit (org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit)54 ArrayList (java.util.ArrayList)24 ModelElementIndicator (org.talend.dataprofiler.core.model.ModelElementIndicator)17 ChartDataEntity (org.talend.dq.indicators.preview.table.ChartDataEntity)17 ColumnIndicatorUnit (org.talend.dataprofiler.core.ui.editor.preview.ColumnIndicatorUnit)13 CustomerDefaultCategoryDataset (org.talend.dataprofiler.common.ui.editor.preview.CustomerDefaultCategoryDataset)10 TreeItem (org.eclipse.swt.widgets.TreeItem)9 Indicator (org.talend.dataquality.indicators.Indicator)9 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)7 FrequencyExt (org.talend.dq.indicators.ext.FrequencyExt)7 BoxIndicator (org.talend.dataquality.indicators.BoxIndicator)5 CountsIndicator (org.talend.dataquality.indicators.CountsIndicator)5 IQRIndicator (org.talend.dataquality.indicators.IQRIndicator)5 PhoneNumbStatisticsIndicator (org.talend.dataquality.indicators.PhoneNumbStatisticsIndicator)5 IRepositoryNode (org.talend.repository.model.IRepositoryNode)5 MetadataColumnRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject)4 ColumnSetIndicatorUnit (org.talend.dataprofiler.core.ui.editor.preview.ColumnSetIndicatorUnit)4 IndicatorEnum (org.talend.dq.nodes.indicator.type.IndicatorEnum)4 IChartTypeStates (org.talend.dataprofiler.core.ui.editor.preview.model.states.IChartTypeStates)3 AverageLengthIndicator (org.talend.dataquality.indicators.AverageLengthIndicator)3