Search in sources :

Example 1 with AbsMatchAnalysisTableComposite

use of org.talend.dataquality.record.linkage.ui.composite.AbsMatchAnalysisTableComposite in project tdq-studio-se by Talend.

the class MatchingKeySection method moveDownTableItem.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.dataquality.record.linkage.ui.section.AbstractMatchAnaysisTableSection#moveDownTableItem()
     */
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
public void moveDownTableItem() {
    AbsMatchAnalysisTableComposite matchRuleTableComp = getCurrentMatchRuleTableComposite();
    ISelection selectItems = matchRuleTableComp.getSelectItems();
    if (selectItems instanceof StructuredSelection) {
        if (selectItems.isEmpty()) {
            return;
        }
        List<?> currentElements = getCurrentTabDefinitions();
        List<?> blockKeyDefinitionlist = ((StructuredSelection) selectItems).toList();
        for (int index = blockKeyDefinitionlist.size() - 1; 0 <= index; index--) {
            if (!isSameWithCurrentModel(currentElements.get(currentElements.size() - blockKeyDefinitionlist.size() + index), blockKeyDefinitionlist.get(index))) {
                continue;
            }
            matchRuleTableComp.moveDownKeyDefinition(blockKeyDefinitionlist.get(index), currentElements);
        }
        matchRuleTableComp.selectAllItem(((StructuredSelection) selectItems).toList());
    }
}
Also used : AbsMatchAnalysisTableComposite(org.talend.dataquality.record.linkage.ui.composite.AbsMatchAnalysisTableComposite) ISelection(org.eclipse.jface.viewers.ISelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection)

Example 2 with AbsMatchAnalysisTableComposite

use of org.talend.dataquality.record.linkage.ui.composite.AbsMatchAnalysisTableComposite in project tdq-studio-se by Talend.

the class MatchingKeySection method moveUpTableItem.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.dataquality.record.linkage.ui.section.AbstractMatchAnaysisTableSection#moveUpTableItem()
     */
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
public void moveUpTableItem() {
    AbsMatchAnalysisTableComposite matchRuleTableComp = getCurrentMatchRuleTableComposite();
    ISelection selectItems = matchRuleTableComp.getSelectItems();
    if (selectItems instanceof StructuredSelection) {
        if (selectItems.isEmpty()) {
            return;
        }
        List<?> currentElements = getCurrentTabDefinitions();
        List<?> KeyDefinitionlist = ((StructuredSelection) selectItems).toList();
        for (int index = 0; index < KeyDefinitionlist.size(); index++) {
            if (!isSameWithCurrentModel(currentElements.get(index), KeyDefinitionlist.get(index))) {
                continue;
            }
            matchRuleTableComp.moveUpKeyDefinition(KeyDefinitionlist.get(index), currentElements);
        }
        matchRuleTableComp.selectAllItem(((StructuredSelection) selectItems).toList());
    }
}
Also used : AbsMatchAnalysisTableComposite(org.talend.dataquality.record.linkage.ui.composite.AbsMatchAnalysisTableComposite) ISelection(org.eclipse.jface.viewers.ISelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection)

Example 3 with AbsMatchAnalysisTableComposite

use of org.talend.dataquality.record.linkage.ui.composite.AbsMatchAnalysisTableComposite in project tdq-studio-se by Talend.

the class MatchingKeySection method importMatchRule.

/**
 * if overwrite: need to delete all current tabs, and create the tab according to the parameter:matchRule else: only
 * add the tab in the parameter matchrule, to the current matchrule.
 *
 * @param matchRuleDefinition
 * @param overwrite
 */
public void importMatchRule(MatchRuleDefinition matchRuleDefinition, boolean overwrite) {
    if (overwrite) {
        // delete all tab in UI
        CTabItem[] tabItems = ruleFolder.getItems();
        if (tabItems != null && tabItems.length > 0) {
            for (CTabItem oneTab : tabItems) {
                @SuppressWarnings("rawtypes") AbsMatchAnalysisTableComposite matchRuleTableComp = getMatchRuleComposite(oneTab);
                matchRuleTableComp.dispose();
                oneTab.dispose();
            }
        }
        // clear all survivorship keys
        getMatchRuleDefinition().getSurvivorshipKeys().clear();
        // clear all match rules in matchrule definition
        getMatchRuleDefinition().getMatchRules().clear();
        // overwrite the threshold
        groupQualityThresholdText.setText(String.valueOf(matchRuleDefinition.getMatchGroupQualityThreshold()));
    }
    // import survivorship keys
    for (SurvivorshipKeyDefinition skd : matchRuleDefinition.getSurvivorshipKeys()) {
        SurvivorshipKeyDefinition survivorshipKeyDefinition = EcoreUtil.copy(skd);
        setColumnValueIfMatch(survivorshipKeyDefinition);
        getMatchRuleDefinition().getSurvivorshipKeys().add(survivorshipKeyDefinition);
    }
    // create the tab from the parameter:matchRule
    for (MatchRule oneMatchRule : matchRuleDefinition.getMatchRules()) {
        MatchRule matchRule2 = createMatchRuleByCopy(oneMatchRule);
        // MOD msjian TDQ-8484: set the name of the match rule by the old name
        matchRule2.setName(oneMatchRule.getName());
        // if the key name= some column name, set the column to this key
        for (MatchKeyDefinition key : matchRule2.getMatchKeys()) {
            setColumnValueIfMatch(key);
        }
        // auto add the tab name order
        addRuleTab(false, matchRule2);
        getMatchRuleDefinition().getMatchRules().add(matchRule2);
    }
}
Also used : AbsMatchAnalysisTableComposite(org.talend.dataquality.record.linkage.ui.composite.AbsMatchAnalysisTableComposite) SurvivorshipKeyDefinition(org.talend.dataquality.rules.SurvivorshipKeyDefinition) MatchKeyDefinition(org.talend.dataquality.rules.MatchKeyDefinition) MatchRule(org.talend.dataquality.rules.MatchRule) CTabItem(org.eclipse.swt.custom.CTabItem)

Example 4 with AbsMatchAnalysisTableComposite

use of org.talend.dataquality.record.linkage.ui.composite.AbsMatchAnalysisTableComposite in project tdq-studio-se by Talend.

the class MatchingKeySection method createPropertyTab.

/**
 * DOC zshen Comment method "createPropertyTab".
 *
 * @param tabName
 * @param reComputeMatchRule
 */
private void createPropertyTab(MatchRule matchRule, boolean reComputeMatchRule) {
    final CTabItem tabItem = new CTabItem(ruleFolder, SWT.CLOSE);
    tabItem.setText(matchRule.getName());
    Composite ruleComp = toolkit.createComposite(ruleFolder, SWT.NONE);
    GridData data = new GridData(GridData.FILL_BOTH);
    ruleComp.setLayoutData(data);
    GridLayout gridLayout = new GridLayout(1, true);
    gridLayout.marginWidth = 0;
    gridLayout.marginHeight = 0;
    ruleComp.setLayout(gridLayout);
    AbsMatchAnalysisTableComposite<?> matchRuleComposite = createTableComposite(ruleComp, matchRule);
    matchRuleComposite.addPropertyChangeListener(this);
    matchRuleComposite.setAddColumn(isAddColumn());
    if (columnMap != null) {
        ArrayList<MetadataColumn> columnList = new ArrayList<MetadataColumn>();
        columnList.addAll(columnMap.keySet());
        matchRuleComposite.setColumnList(columnList);
    }
    matchRuleComposite.createContent();
    setInput(matchRule, matchRuleComposite);
    matchRuleComposite.serViewerSorter(getTableViewerSorter(matchRule));
    matchRuleComposite.setLayout(gridLayout);
    matchRuleComposite.setLayoutData(data);
    tabItem.setControl(ruleComp);
    tabItem.setData(MatchAnalysisConstant.MATCH_RULE_TABLE_COMPOSITE, matchRuleComposite);
    ruleFolder.setSelection(tabItem);
}
Also used : MetadataColumn(org.talend.core.model.metadata.builder.connection.MetadataColumn) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) MatchRuleTableComposite(org.talend.dataquality.record.linkage.ui.composite.MatchRuleTableComposite) AbsMatchAnalysisTableComposite(org.talend.dataquality.record.linkage.ui.composite.AbsMatchAnalysisTableComposite) GridData(org.eclipse.swt.layout.GridData) ArrayList(java.util.ArrayList) CTabItem(org.eclipse.swt.custom.CTabItem)

Aggregations

AbsMatchAnalysisTableComposite (org.talend.dataquality.record.linkage.ui.composite.AbsMatchAnalysisTableComposite)4 ISelection (org.eclipse.jface.viewers.ISelection)2 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)2 CTabItem (org.eclipse.swt.custom.CTabItem)2 ArrayList (java.util.ArrayList)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Composite (org.eclipse.swt.widgets.Composite)1 MetadataColumn (org.talend.core.model.metadata.builder.connection.MetadataColumn)1 MatchRuleTableComposite (org.talend.dataquality.record.linkage.ui.composite.MatchRuleTableComposite)1 MatchKeyDefinition (org.talend.dataquality.rules.MatchKeyDefinition)1 MatchRule (org.talend.dataquality.rules.MatchRule)1 SurvivorshipKeyDefinition (org.talend.dataquality.rules.SurvivorshipKeyDefinition)1