Search in sources :

Example 1 with TableIndicator

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;
    }
}
Also used : TableIndicator(org.talend.dataprofiler.core.model.TableIndicator) IRepositoryNode(org.talend.repository.model.IRepositoryNode) ArrayList(java.util.ArrayList) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode)

Example 2 with TableIndicator

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);
}
Also used : AnalysisTableTreeViewer(org.talend.dataprofiler.core.ui.editor.composite.AnalysisTableTreeViewer) GridLayout(org.eclipse.swt.layout.GridLayout) TableIndicator(org.talend.dataprofiler.core.model.TableIndicator) AbstractPagePart(org.talend.dataprofiler.core.ui.editor.composite.AbstractPagePart) 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)

Example 3 with TableIndicator

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;
}
Also used : TableIndicator(org.talend.dataprofiler.core.model.TableIndicator) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite)

Example 4 with TableIndicator

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);
}
Also used : TableIndicator(org.talend.dataprofiler.core.model.TableIndicator) MouseEvent(org.eclipse.swt.events.MouseEvent) IndicatorEnum(org.talend.dq.nodes.indicator.type.IndicatorEnum) TreeEditor(org.eclipse.swt.custom.TreeEditor) TreeItem(org.eclipse.swt.widgets.TreeItem) SysIndicatorDefinitionRepNode(org.talend.dq.nodes.SysIndicatorDefinitionRepNode) Label(org.eclipse.swt.widgets.Label) MouseAdapter(org.eclipse.swt.events.MouseAdapter) TableIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.TableIndicatorUnit) RowCountIndicator(org.talend.dataquality.indicators.RowCountIndicator)

Example 5 with TableIndicator

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);
}
Also used : ModelElement(orgomg.cwm.objectmodel.core.ModelElement) TableIndicator(org.talend.dataprofiler.core.model.TableIndicator) MouseEvent(org.eclipse.swt.events.MouseEvent) TreeEditor(org.eclipse.swt.custom.TreeEditor) TreeItem(org.eclipse.swt.widgets.TreeItem) Label(org.eclipse.swt.widgets.Label) MouseAdapter(org.eclipse.swt.events.MouseAdapter)

Aggregations

TableIndicator (org.talend.dataprofiler.core.model.TableIndicator)18 NamedColumnSet (orgomg.cwm.resource.relational.NamedColumnSet)8 ArrayList (java.util.ArrayList)7 TableIndicatorUnit (org.talend.dataprofiler.core.ui.editor.preview.TableIndicatorUnit)5 Indicator (org.talend.dataquality.indicators.Indicator)5 Composite (org.eclipse.swt.widgets.Composite)4 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)4 Connection (org.talend.core.model.metadata.builder.connection.Connection)4 MouseAdapter (org.eclipse.swt.events.MouseAdapter)3 MouseEvent (org.eclipse.swt.events.MouseEvent)3 GridData (org.eclipse.swt.layout.GridData)3 GridLayout (org.eclipse.swt.layout.GridLayout)3 TreeItem (org.eclipse.swt.widgets.TreeItem)3 ExpansionAdapter (org.eclipse.ui.forms.events.ExpansionAdapter)3 ExpansionEvent (org.eclipse.ui.forms.events.ExpansionEvent)3 CompositeIndicator (org.talend.dataprofiler.core.ui.editor.preview.CompositeIndicator)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 List (java.util.List)2 Map (java.util.Map)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2