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());
}
}
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());
}
}
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);
}
}
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);
}
Aggregations