use of org.talend.dataprofiler.core.model.TableIndicator in project tdq-studio-se by Talend.
the class BusinessRuleAnalysisDetailsPage method openTableSelectionDialog.
public void openTableSelectionDialog() {
if (!RepositoryNodeHelper.isOpenDQCommonViewer()) {
if (RepositoryNodeHelper.getDQCommonViewer(true) == null) {
MessageDialog.openWarning(this.getSite().getShell(), DefaultMessagesImpl.getString("TableMasterDetailsPage.WarningDialogTitle"), // $NON-NLS-1$ //$NON-NLS-2$
DefaultMessagesImpl.getString("TableMasterDetailsPage.WarningDialogCantFindNode"));
return;
}
}
TableIndicator[] tableIndicators = treeViewer.getTableIndicator();
List<IRepositoryNode> setList = new ArrayList<IRepositoryNode>();
for (TableIndicator tableIndicator : tableIndicators) {
RepositoryNode recursiveFind = RepositoryNodeHelper.recursiveFind(tableIndicator.getColumnSet());
if (recursiveFind == null) {
recursiveFind = RepositoryNodeHelper.createRepositoryNode(tableIndicator.getColumnSet());
}
setList.add(recursiveFind);
}
RepositoryNode connComboSelectNode = getConnComboSelectNode();
TablesSelectionDialog dialog = new TablesSelectionDialog(this, null, DefaultMessagesImpl.getString("TableMasterDetailsPage.tableSelection"), setList, // $NON-NLS-1$
DefaultMessagesImpl.getString("TableMasterDetailsPage.tableSelections"), // $NON-NLS-1$
connComboSelectNode);
dialog.setTableType(TableSelectionType.ALL);
if (dialog.open() == Window.OK) {
Object[] tables = dialog.getResult();
treeViewer.setInput(tables);
return;
}
}
use of org.talend.dataprofiler.core.model.TableIndicator in project tdq-studio-se by Talend.
the class BusinessRuleAnalysisResultPage method createResultSection.
@Override
protected void createResultSection(Composite parent) {
// ADD gdbu 2011-3-4 bug 19242
AbstractPagePart treeViewer = masterPage.getTreeViewer();
if (treeViewer != null && treeViewer instanceof AnalysisTableTreeViewer) {
tableTreeViewer = (AnalysisTableTreeViewer) treeViewer;
}
// ~
// $NON-NLS-1$
resultSection = createSection(form, parent, DefaultMessagesImpl.getString("TableAnalysisResultPage.analysisResult"), null);
sectionClient = toolkit.createComposite(resultSection);
sectionClient.setLayout(new GridLayout());
sectionClient.setLayoutData(new GridData(GridData.FILL_BOTH));
dynamicList.clear();
for (final TableIndicator tableIndicator : tableTreeViewer.getTableIndicator()) {
ExpandableComposite exComp = toolkit.createExpandableComposite(sectionClient, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT | ExpandableComposite.EXPANDED);
// bug 10541 fix by zshen,Change some character set to be proper to add view in the table anasys
if (tableIndicator.isTable()) {
exComp.setText(DefaultMessagesImpl.getString("TableAnalysisResultPage.table", // $NON-NLS-1$
tableIndicator.getColumnSet().getName()));
} else {
exComp.setText(DefaultMessagesImpl.getString("TableAnalysisResultPage.view", // $NON-NLS-1$
tableIndicator.getColumnSet().getName()));
}
exComp.setLayout(new GridLayout());
exComp.setLayoutData(new GridData(GridData.FILL_BOTH));
// MOD xqliu 2009-06-23 bug 7481
exComp.setExpanded(EditorPreferencePage.isUnfoldingAnalyzedEelementsResultPage());
// ~
final Composite comp = toolkit.createComposite(exComp);
comp.setLayout(new GridLayout());
comp.setLayoutData(new GridData(GridData.FILL_BOTH));
exComp.setClient(comp);
createResultDataComposite(comp, tableIndicator);
exComp.addExpansionListener(new ExpansionAdapter() {
@Override
public void expansionStateChanged(ExpansionEvent e) {
form.reflow(true);
}
});
}
resultSection.setClient(sectionClient);
}
use of org.talend.dataprofiler.core.model.TableIndicator in project tdq-studio-se by Talend.
the class AnalysisTableTreeViewer method getTheSuitedComposite.
/*
* (non-Javadoc)
*
* @see
* org.talend.dataprofiler.core.ui.editor.composite.AbstractColumnDropTree#getTheSuitedComposite(org.eclipse.swt
* .events.SelectionEvent)
*/
@Override
public ExpandableComposite getTheSuitedComposite(SelectionEvent e) {
Composite[] previewChartCompsites = masterPage.getPreviewChartCompsites();
if (previewChartCompsites == null) {
return null;
}
Object obj = e.item.getData(TABLE_INDICATOR_KEY);
if (obj instanceof TableIndicator) {
TableIndicator tableIndicator = (TableIndicator) obj;
for (Composite comp : previewChartCompsites) {
if (comp.getData() == tableIndicator) {
return (ExpandableComposite) comp;
}
}
}
return null;
}
use of org.talend.dataprofiler.core.model.TableIndicator in project tdq-studio-se by Talend.
the class AnalysisTableTreeViewer method createOneUnit.
public void createOneUnit(final TreeItem treeItem, TableIndicatorUnit indicatorUnit) {
final TreeItem indicatorItem = new TreeItem(treeItem, SWT.NONE);
final TableIndicatorUnit unit = indicatorUnit;
IndicatorEnum type = indicatorUnit.getType();
final IndicatorEnum indicatorEnum = type;
indicatorItem.setData(TABLE_INDICATOR_KEY, treeItem.getData(TABLE_INDICATOR_KEY));
indicatorItem.setData(INDICATOR_UNIT_KEY, unit);
indicatorItem.setData(VIEWER_KEY, this);
String label = indicatorUnit.getIndicatorName();
// $NON-NLS-1$
label = label != null ? label : "Unknown indicator";
SysIndicatorDefinitionRepNode recursiveFindIndicatorDefinition = RepositoryNodeHelper.recursiveFindIndicatorDefinition(indicatorUnit.getIndicator().getIndicatorDefinition());
if (recursiveFindIndicatorDefinition != null && !recursiveFindIndicatorDefinition.getProject().isMainProject()) {
label = label + recursiveFindIndicatorDefinition.getDisplayProjectName();
}
if (IndicatorEnum.WhereRuleIndicatorEnum.compareTo(type) == 0) {
indicatorItem.setImage(0, ImageLib.getImage(ImageLib.DQ_RULE));
} else if (IndicatorEnum.RowCountIndicatorEnum.compareTo(type) == 0) {
indicatorItem.setImage(0, ImageLib.getImage(ImageLib.IND_DEFINITION));
}
indicatorItem.setText(0, label);
TreeEditor optionEditor = new TreeEditor(tree);
// $NON-NLS-1$
final Label optionLabel = createTreeItemLabel(tree, ImageLib.OPTION, "AnalysisTableTreeViewer.options");
optionLabel.setData(indicatorUnit);
optionLabel.addMouseListener(new MouseAdapter() {
@Override
public void mouseDown(MouseEvent e) {
boolean hasIndicatorParameters = openIndicatorOptionDialog(Display.getCurrent().getActiveShell(), indicatorItem);
if (hasIndicatorParameters) {
optionLabel.setImage(ImageLib.getImage(ImageLib.INDICATOR_OPTION_CHECKED));
}
}
});
optionEditor.minimumWidth = optionLabel.getImage().getBounds().width;
optionEditor.horizontalAlignment = SWT.CENTER;
optionEditor.setEditor(optionLabel, indicatorItem, 1);
TreeEditor delEditor = null;
if (!(unit.getIndicator() instanceof RowCountIndicator)) {
delEditor = new TreeEditor(tree);
// $NON-NLS-1$
Label delLabel = createTreeItemLabel(tree, ImageLib.DELETE_ACTION, "AnalysisTableTreeViewer.delete");
delLabel.addMouseListener(new MouseAdapter() {
@Override
public void mouseDown(MouseEvent e) {
deleteIndicatorItems((TableIndicator) treeItem.getData(TABLE_INDICATOR_KEY), unit);
if (indicatorItem.getParentItem() != null && indicatorItem.getParentItem().getData(INDICATOR_UNIT_KEY) != null) {
setElements(tableIndicators);
} else {
removeItemBranch(indicatorItem);
indicatorTreeItemMap.remove(unit);
}
}
});
delEditor.minimumWidth = delLabel.getImage().getBounds().width;
delEditor.horizontalAlignment = SWT.CENTER;
delEditor.setEditor(delLabel, indicatorItem, 2);
}
if (delEditor == null) {
indicatorItem.setData(ITEM_EDITOR_KEY, new TreeEditor[] { optionEditor });
} else {
indicatorItem.setData(ITEM_EDITOR_KEY, new TreeEditor[] { optionEditor, delEditor });
}
if (indicatorEnum != null && indicatorEnum.hasChildren()) {
indicatorItem.setData(treeItem.getData(TABLE_INDICATOR_KEY));
createIndicatorItems(indicatorItem, indicatorUnit.getChildren());
}
if (hasIndicatorParameters(indicatorUnit)) {
optionLabel.setImage(ImageLib.getImage(ImageLib.INDICATOR_OPTION_CHECKED));
}
// ADD xqliu 2009-04-30 bug 6808
this.indicatorTreeItemMap.put(unit, indicatorItem);
}
use of org.talend.dataprofiler.core.model.TableIndicator in project tdq-studio-se by Talend.
the class AnalysisTableTreeViewer method addItemElements.
private void addItemElements(final TableIndicator[] elements) {
for (final TableIndicator tableIndicator : elements) {
final TreeItem treeItem = new TreeItem(tree, SWT.NONE);
if (tableIndicator.isTable()) {
treeItem.setImage(ImageLib.getImage(ImageLib.TABLE));
} else if (tableIndicator.isView()) {
treeItem.setImage(ImageLib.getImage(ImageLib.VIEW));
}
ModelElement columnSet = tableIndicator.getColumnSet();
if (columnSet.eIsProxy()) {
// try to resolve the proxy
columnSet = (ModelElement) EObjectHelper.resolveObject(columnSet);
}
String columnSetName = columnSet.getName();
if (columnSetName == null) {
// $NON-NLS-1$
columnSetName = "Unknown name";
}
treeItem.setText(0, columnSetName);
treeItem.setData(TABLE_INDICATOR_KEY, tableIndicator);
TreeEditor addDQRuleEditor = new TreeEditor(tree);
// $NON-NLS-1$
Label addDQRuleLabl = createTreeItemLabel(tree, ImageLib.ADD_DQ, "AnalysisColumnTreeViewer.addDQRule");
addDQRuleLabl.addMouseListener(new MouseAdapter() {
@Override
public void mouseDown(MouseEvent e) {
showAddDQRuleDialog(treeItem, tableIndicator);
}
});
addDQRuleEditor.minimumWidth = addDQRuleLabl.getImage().getBounds().width;
addDQRuleEditor.setEditor(addDQRuleLabl, treeItem, 1);
TreeEditor delLabelEditor = new TreeEditor(tree);
// $NON-NLS-1$
Label delLabel = createTreeItemLabel(tree, ImageLib.DELETE_ACTION, "AnalysisColumnTreeViewer.delete");
delLabel.addMouseListener(new MouseAdapter() {
@Override
public void mouseDown(MouseEvent e) {
deleteTableItems(tableIndicator);
if (treeItem.getParentItem() != null && treeItem.getParentItem().getData(INDICATOR_UNIT_KEY) != null) {
setElements(tableIndicators);
} else {
deleteIndicatorItems(tableIndicator);
removeItemBranch(treeItem);
indicatorTreeItemMap.remove(tableIndicator);
}
// MOD mzhao 2005-05-05 bug 6587.
// MOD mzhao 2009-06-8, bug 5887.
// updateBindConnection(masterPage, getTableIndicator(),
// tree);
}
});
delLabelEditor.minimumWidth = delLabel.getImage().getBounds().width;
delLabelEditor.horizontalAlignment = SWT.CENTER;
delLabelEditor.setEditor(delLabel, treeItem, 2);
treeItem.setData(ITEM_EDITOR_KEY, new TreeEditor[] { addDQRuleEditor, delLabelEditor });
if (tableIndicator.hasIndicators()) {
createIndicatorItems(treeItem, tableIndicator.getIndicatorUnits());
}
treeItem.setExpanded(true);
// ADD xqliu 2009-04-30 bug 6808
this.indicatorTreeItemMap.put(tableIndicator, treeItem);
}
this.setDirty(true);
}
Aggregations