Search in sources :

Example 6 with OverviewIndUIElement

use of org.talend.dataprofiler.core.model.OverviewIndUIElement in project tdq-studio-se by Talend.

the class ConnectionAnalysisDetailsPage method getCatalogIndicators.

@Override
public List<OverviewIndUIElement> getCatalogIndicators() {
    ConnectionIndicator conIndicator = (ConnectionIndicator) getCurrentModelElement().getResults().getIndicators().get(0);
    Connection analyzedElement = (Connection) conIndicator.getAnalyzedElement();
    EList<CatalogIndicator> catalogIndicators = conIndicator.getCatalogIndicators();
    List<OverviewIndUIElement> cataUIEleList = new ArrayList<OverviewIndUIElement>();
    RepositoryNode connNode = RepositoryNodeHelper.recursiveFind(analyzedElement);
    for (Indicator indicator : catalogIndicators) {
        if (connNode != null) {
            for (IRepositoryNode catalogNode : connNode.getChildren()) {
                Catalog catalog = ((MetadataCatalogRepositoryObject) catalogNode.getObject()).getCatalog();
                String connUuid = ResourceHelper.getUUID(catalog);
                String anaUuid = ResourceHelper.getUUID(indicator.getAnalyzedElement());
                if (connUuid.equals(anaUuid)) {
                    OverviewIndUIElement cataUIEle = new OverviewIndUIElement();
                    cataUIEle.setNode(catalogNode);
                    cataUIEle.setOverviewIndicator(indicator);
                    cataUIEleList.add(cataUIEle);
                    break;
                }
            }
        }
    }
    return cataUIEleList;
}
Also used : IRepositoryNode(org.talend.repository.model.IRepositoryNode) Connection(org.talend.core.model.metadata.builder.connection.Connection) CatalogIndicator(org.talend.dataquality.indicators.schema.CatalogIndicator) ArrayList(java.util.ArrayList) MetadataCatalogRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataCatalogRepositoryObject) IRepositoryNode(org.talend.repository.model.IRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode) CatalogIndicator(org.talend.dataquality.indicators.schema.CatalogIndicator) ConnectionIndicator(org.talend.dataquality.indicators.schema.ConnectionIndicator) SchemaIndicator(org.talend.dataquality.indicators.schema.SchemaIndicator) Indicator(org.talend.dataquality.indicators.Indicator) Catalog(orgomg.cwm.resource.relational.Catalog) OverviewIndUIElement(org.talend.dataprofiler.core.model.OverviewIndUIElement) ConnectionIndicator(org.talend.dataquality.indicators.schema.ConnectionIndicator)

Example 7 with OverviewIndUIElement

use of org.talend.dataprofiler.core.model.OverviewIndUIElement in project tdq-studio-se by Talend.

the class OverviewResultPage method createContextMenuFor.

protected void createContextMenuFor(final StructuredViewer viewer) {
    // $NON-NLS-1$
    final MenuManager contextMenu = new MenuManager("#PopUp");
    // $NON-NLS-1$
    contextMenu.add(new Separator("additions"));
    contextMenu.setRemoveAllWhenShown(true);
    contextMenu.addMenuListener(new IMenuListener() {

        public void menuAboutToShow(IMenuManager mgr) {
            Object overviewObject = ((StructuredSelection) viewer.getSelection()).getFirstElement();
            if (overviewObject instanceof OverviewIndUIElement) {
                OverviewIndUIElement overview = (OverviewIndUIElement) overviewObject;
                IRepositoryNode node = overview.getNode();
                List<IRepositoryNode> nodes = new ArrayList<IRepositoryNode>();
                nodes.add(node);
                contextMenu.add(new OverviewAnalysisAction(nodes));
            }
        // if (obj instanceof SchemaIndicator) {
        // SchemaIndicator schemaIndicator = (SchemaIndicator) obj;
        // contextMenu.add(new OverviewAnalysisAction(new Package[] { (Package)
        // schemaIndicator.getAnalyzedElement() }));
        // }
        }
    });
    Menu menu = contextMenu.createContextMenu(viewer.getControl());
    viewer.getControl().setMenu(menu);
}
Also used : IRepositoryNode(org.talend.repository.model.IRepositoryNode) OverviewAnalysisAction(org.talend.dataprofiler.core.ui.action.actions.OverviewAnalysisAction) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) MetadataTableRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataTableRepositoryObject) OverviewIndUIElement(org.talend.dataprofiler.core.model.OverviewIndUIElement) List(java.util.List) ArrayList(java.util.ArrayList) EList(org.eclipse.emf.common.util.EList) IMenuManager(org.eclipse.jface.action.IMenuManager) Menu(org.eclipse.swt.widgets.Menu) Separator(org.eclipse.jface.action.Separator) IMenuListener(org.eclipse.jface.action.IMenuListener)

Example 8 with OverviewIndUIElement

use of org.talend.dataprofiler.core.model.OverviewIndUIElement in project tdq-studio-se by Talend.

the class OverviewResultPage method displayTableAndViewComp.

/**
 * DOC klliu Comment method "displayTableAndViewComp".
 *
 * @param schemaIndicator
 * @param parentNode
 */
protected void displayTableAndViewComp(final SchemaIndicator schemaIndicator, final IRepositoryNode parentNode) {
    tableAndViewComposite.setVisible(true);
    // DOC wapperInput retrun OverViewUIElement
    EList<TableIndicator> indicatorTableList = schemaIndicator.getTableIndicators();
    List<OverviewIndUIElement> tableElements = wapperInput(indicatorTableList, parentNode);
    if (tableOfCatalogOrSchemaViewer == null || tableOfCatalogOrSchemaViewer.getTable().isDisposed()) {
        tableOfCatalogOrSchemaViewer = new TableViewer(tableAndViewComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | // SWT.SINGLE);
        SWT.FULL_SELECTION);
        final Table catalogOrSchemaTable = tableOfCatalogOrSchemaViewer.getTable();
        TableUtils.addActionTooltip(catalogOrSchemaTable);
        catalogOrSchemaTable.setHeaderVisible(true);
        catalogOrSchemaTable.setLinesVisible(true);
        GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
        layoutData.heightHint = 150;
        catalogOrSchemaTable.setLayoutData(layoutData);
        String[] columnTexts = new String[] { DefaultMessagesImpl.getString("AbstractFilterMetadataPage.Table"), DefaultMessagesImpl.getString("AbstractFilterMetadataPage.rows"), DefaultMessagesImpl.getString("AbstractFilterMetadataPage.keys"), // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
        DefaultMessagesImpl.getString("AbstractFilterMetadataPage.indexes") };
        createSorterColumns(tableOfCatalogOrSchemaViewer, columnTexts, tableSorters, COLUMN_TABLE_WIDTH);
        TableOfCatalogOrSchemaProvider tableProvider = new TableOfCatalogOrSchemaProvider();
        tableOfCatalogOrSchemaViewer.setLabelProvider(tableProvider);
        tableOfCatalogOrSchemaViewer.setContentProvider(tableProvider);
        catalogOrSchemaTable.addMouseListener(new MouseAdapter() {

            @Override
            public void mouseDown(MouseEvent e) {
                if (e.button == 3) {
                    TableItem item = catalogOrSchemaTable.getItem(catalogOrSchemaTable.getSelectionIndex());
                    // TDQ-11430: show the menu only when there have data and have selected one.
                    if (catalogOrSchemaTable.getItemCount() > 0 && catalogOrSchemaTable.getSelectionIndex() != -1) {
                        final Menu menu = new Menu(catalogOrSchemaTable.getShell(), SWT.POP_UP);
                        catalogOrSchemaTable.setMenu(menu);
                        MenuItem viewKeyMenuItem = new MenuItem(menu, SWT.PUSH);
                        // $NON-NLS-1$
                        viewKeyMenuItem.setText(DefaultMessagesImpl.getString("AbstractFilterMetadataPage.ViewKeys"));
                        viewKeyMenuItem.setImage(ImageLib.getImage(ImageLib.PK_DECORATE));
                        viewKeyMenuItem.addSelectionListener(new SelectionAdapter() {

                            @Override
                            public void widgetSelected(SelectionEvent e) {
                                runMenu(catalogOrSchemaTable, // $NON-NLS-1$
                                DefaultMessagesImpl.getString("DatabaseDetailView.Tab.PrimaryKeys"));
                            }
                        });
                        MenuItem viewIndexMenuItem = new MenuItem(menu, SWT.PUSH);
                        // $NON-NLS-1$
                        viewIndexMenuItem.setText(DefaultMessagesImpl.getString("AbstractFilterMetadataPage.ViewIndexes"));
                        viewIndexMenuItem.setImage(ImageLib.getImage(ImageLib.INDEX_VIEW));
                        viewIndexMenuItem.addSelectionListener(new SelectionAdapter() {

                            @Override
                            public void widgetSelected(SelectionEvent e) {
                                // $NON-NLS-1$
                                runMenu(catalogOrSchemaTable, DefaultMessagesImpl.getString("DatabaseDetailView.Tab.Indexes"));
                            }
                        });
                        TableItem tableItem = catalogOrSchemaTable.getItem(catalogOrSchemaTable.getSelectionIndex());
                        final OverviewIndUIElement data = (OverviewIndUIElement) tableItem.getData();
                        MenuItem tableAnalysisMenuItem = new MenuItem(menu, SWT.PUSH);
                        tableAnalysisMenuItem.setText(DefaultMessagesImpl.getString(// $NON-NLS-1$
                        "CreateTableAnalysisAction.tableAnalysis"));
                        tableAnalysisMenuItem.setImage(ImageLib.getImage(ImageLib.ACTION_NEW_ANALYSIS));
                        tableAnalysisMenuItem.addSelectionListener(new SelectionAdapter() {

                            @Override
                            public void widgetSelected(SelectionEvent e) {
                                runTableAnalysis(data);
                            }
                        });
                        if (data.isVirtualNode()) {
                            tableAnalysisMenuItem.setEnabled(false);
                        }
                    } else {
                        // TDQ-11430: when there is no views will not show menu
                        catalogOrSchemaTable.setMenu(null);
                    }
                }
            }
        });
        viewOfCatalogOrSchemaViewer = new TableViewer(tableAndViewComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
        final Table tableCatalogOrSchemaView = viewOfCatalogOrSchemaViewer.getTable();
        TableUtils.addActionTooltip(tableCatalogOrSchemaView);
        tableCatalogOrSchemaView.setHeaderVisible(true);
        tableCatalogOrSchemaView.setLinesVisible(true);
        layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
        layoutData.heightHint = 150;
        tableCatalogOrSchemaView.setLayoutData(layoutData);
        columnTexts = new String[] { DefaultMessagesImpl.getString("AbstractFilterMetadataPage.view"), // $NON-NLS-1$ //$NON-NLS-2$
        DefaultMessagesImpl.getString("AbstractFilterMetadataPage.rows") };
        createSorterColumns(viewOfCatalogOrSchemaViewer, columnTexts, viewSorters, COLUMN_VIEW_WIDTH);
        ViewOfCatalogOrSchemaProvider viewProvider = new ViewOfCatalogOrSchemaProvider();
        viewOfCatalogOrSchemaViewer.setLabelProvider(viewProvider);
        viewOfCatalogOrSchemaViewer.setContentProvider(viewProvider);
        // ADD msjian TDQ-4523 2013-1-22: Add "Table analysis" menu on the views
        tableCatalogOrSchemaView.addMouseListener(new MouseAdapter() {

            @Override
            public void mouseDown(MouseEvent e) {
                if (e.button == 3) {
                    // TDQ-11430: show the menu only when there have data and have selected one.
                    TableItem tableItem = tableCatalogOrSchemaView.getItem(tableCatalogOrSchemaView.getSelectionIndex());
                    final OverviewIndUIElement data = (OverviewIndUIElement) tableItem.getData();
                    if (tableCatalogOrSchemaView.getItemCount() > 0 && tableCatalogOrSchemaView.getSelectionIndex() != -1) {
                        final Menu menu = new Menu(tableCatalogOrSchemaView.getShell(), SWT.POP_UP);
                        tableCatalogOrSchemaView.setMenu(menu);
                        MenuItem tableAnalysisMenuItem = new MenuItem(menu, SWT.PUSH);
                        tableAnalysisMenuItem.setText(DefaultMessagesImpl.getString(// $NON-NLS-1$
                        "CreateTableAnalysisAction.tableAnalysis"));
                        tableAnalysisMenuItem.setImage(ImageLib.getImage(ImageLib.ACTION_NEW_ANALYSIS));
                        tableAnalysisMenuItem.addSelectionListener(new SelectionAdapter() {

                            @Override
                            public void widgetSelected(SelectionEvent e) {
                                ViewIndicator viewIndicator = (ViewIndicator) data.getOverviewIndicator();
                                runTableAnalysis(viewIndicator.getTableName());
                            }
                        });
                        if (data.isVirtualNode()) {
                            tableAnalysisMenuItem.setEnabled(false);
                        }
                    } else {
                        // TDQ-11430: when there is no views will not show menu
                        tableCatalogOrSchemaView.setMenu(null);
                    }
                }
            }
        });
    // TDQ-4523~
    }
    tableOfCatalogOrSchemaViewer.getTable().setMenu(null);
    tableOfCatalogOrSchemaViewer.setInput(tableElements);
    List<ViewIndicator> indicatorViewList = schemaIndicator.getViewIndicators();
    List<OverviewIndUIElement> viewElements = wapperInput(indicatorViewList, parentNode);
    viewOfCatalogOrSchemaViewer.setInput(viewElements);
    viewOfCatalogOrSchemaViewer.getTable().setMenu(null);
    // MOD xqliu 2009-11-05 bug 9521
    tableAndViewComposite.pack();
    statisticalSection.pack();
    statisticalSection.layout();
    // ~
    form.reflow(true);
}
Also used : TableIndicator(org.talend.dataquality.indicators.schema.TableIndicator) MetadataTable(org.talend.core.model.metadata.builder.connection.MetadataTable) Table(org.eclipse.swt.widgets.Table) MouseEvent(org.eclipse.swt.events.MouseEvent) TableItem(org.eclipse.swt.widgets.TableItem) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) MouseAdapter(org.eclipse.swt.events.MouseAdapter) MenuItem(org.eclipse.swt.widgets.MenuItem) ViewIndicator(org.talend.dataquality.indicators.schema.ViewIndicator) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) OverviewIndUIElement(org.talend.dataprofiler.core.model.OverviewIndUIElement) Menu(org.eclipse.swt.widgets.Menu) TableViewer(org.eclipse.jface.viewers.TableViewer)

Example 9 with OverviewIndUIElement

use of org.talend.dataprofiler.core.model.OverviewIndUIElement in project tdq-studio-se by Talend.

the class OverviewResultPage method wapperInput.

/**
 * DOC zshen Comment method "wapperInput".
 *
 * @param indicatorViewList
 * @param parentNode
 * @return
 */
private List<OverviewIndUIElement> wapperInput(List<ViewIndicator> indicatorViewList, IRepositoryNode parentNode) {
    List<OverviewIndUIElement> cataUIEleList = new ArrayList<OverviewIndUIElement>();
    List<IRepositoryNode> children = parentNode.getChildren();
    for (IRepositoryNode folderNode : children) {
        if (folderNode instanceof DBViewFolderRepNode) {
            List<IRepositoryNode> tableNodes = folderNode.getChildren();
            // MOD 20120315 klliu&yyin TDQ-2391, avoid getting many times for table nodes.
            for (ViewIndicator indicator : indicatorViewList) {
                boolean equals = false;
                for (IRepositoryNode tableNode : tableNodes) {
                    MetadataTable table = ((MetadataTableRepositoryObject) tableNode.getObject()).getTable();
                    String name = table.getName();
                    String tableName = indicator.getTableName();
                    // String connUuid = ResourceHelper.getUUID(table);
                    // String anaUuid = ResourceHelper.getUUID(indicator.getAnalyzedElement());
                    equals = name.equals(tableName);
                    if (equals) {
                        OverviewIndUIElement tableUIEle = new OverviewIndUIElement();
                        tableUIEle.setNode(tableNode);
                        tableUIEle.setOverviewIndicator(indicator);
                        if (DqRepositoryViewService.isComeFromRefrenceProject(getTdDataProvider()) && ColumnSetHelper.getColumns((ColumnSet) table).isEmpty()) {
                            tableUIEle.setVirtualNode(true);
                        }
                        cataUIEleList.add(tableUIEle);
                        break;
                    }
                }
                if (!equals) {
                    OverviewIndUIElement tableUIEle = new OverviewIndUIElement();
                    tableUIEle.setOverviewIndicator(indicator);
                    tableUIEle.setVirtualNode(true);
                    cataUIEleList.add(tableUIEle);
                }
            }
        }
    }
    return cataUIEleList;
}
Also used : IRepositoryNode(org.talend.repository.model.IRepositoryNode) ArrayList(java.util.ArrayList) MetadataTable(org.talend.core.model.metadata.builder.connection.MetadataTable) OverviewIndUIElement(org.talend.dataprofiler.core.model.OverviewIndUIElement) ViewIndicator(org.talend.dataquality.indicators.schema.ViewIndicator) DBViewFolderRepNode(org.talend.dq.nodes.DBViewFolderRepNode) MetadataTableRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataTableRepositoryObject)

Example 10 with OverviewIndUIElement

use of org.talend.dataprofiler.core.model.OverviewIndUIElement in project tdq-studio-se by Talend.

the class SchemaAnalysisDetailsPage method getSchemaIndicators.

@Override
protected List<OverviewIndUIElement> getSchemaIndicators() {
    List<OverviewIndUIElement> cataUIEleList = new ArrayList<OverviewIndUIElement>();
    EList<Indicator> indicators = getCurrentModelElement().getResults().getIndicators();
    for (Indicator indicator : indicators) {
        RepositoryNode schemaNode = RepositoryNodeHelper.recursiveFind(indicator.getAnalyzedElement());
        OverviewIndUIElement cataUIEle = new OverviewIndUIElement();
        cataUIEle.setNode(schemaNode);
        cataUIEle.setOverviewIndicator(indicator);
        cataUIEleList.add(cataUIEle);
    }
    return cataUIEleList;
}
Also used : ArrayList(java.util.ArrayList) OverviewIndUIElement(org.talend.dataprofiler.core.model.OverviewIndUIElement) RepositoryNode(org.talend.repository.model.RepositoryNode) Indicator(org.talend.dataquality.indicators.Indicator)

Aggregations

OverviewIndUIElement (org.talend.dataprofiler.core.model.OverviewIndUIElement)10 ArrayList (java.util.ArrayList)8 IRepositoryNode (org.talend.repository.model.IRepositoryNode)7 Indicator (org.talend.dataquality.indicators.Indicator)5 MetadataTable (org.talend.core.model.metadata.builder.connection.MetadataTable)4 CatalogIndicator (org.talend.dataquality.indicators.schema.CatalogIndicator)4 SchemaIndicator (org.talend.dataquality.indicators.schema.SchemaIndicator)4 RepositoryNode (org.talend.repository.model.RepositoryNode)4 MetadataTableRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataTableRepositoryObject)3 TableIndicator (org.talend.dataquality.indicators.schema.TableIndicator)3 ViewIndicator (org.talend.dataquality.indicators.schema.ViewIndicator)3 List (java.util.List)2 EList (org.eclipse.emf.common.util.EList)2 TableViewer (org.eclipse.jface.viewers.TableViewer)2 Menu (org.eclipse.swt.widgets.Menu)2 Table (org.eclipse.swt.widgets.Table)2 Connection (org.talend.core.model.metadata.builder.connection.Connection)2 ConnectionIndicator (org.talend.dataquality.indicators.schema.ConnectionIndicator)2 Catalog (orgomg.cwm.resource.relational.Catalog)2 IMenuListener (org.eclipse.jface.action.IMenuListener)1