Search in sources :

Example 1 with AbstractAnalysisActionHandler

use of org.talend.dataprofiler.core.ui.editor.AbstractAnalysisActionHandler in project tdq-studio-se by Talend.

the class AnalysisColumnTreeViewer method createTree.

/**
 * @param parent
 */
private Tree createTree(Composite parent) {
    final Tree newTree = new TooltipTree(parent, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION) {

        @Override
        protected boolean isValidItem(TreeItem item) {
            if (item == null) {
                return false;
            }
            Object itemData = item.getData(INDICATOR_UNIT_KEY);
            Object columnItemData = item.getData(MODELELEMENT_INDICATOR_KEY);
            if (itemData != null) {
                IndicatorUnit indicatorUnit = (IndicatorUnit) item.getData(INDICATOR_UNIT_KEY);
                if (indicatorUnit != null && !(indicatorUnit.getIndicator() instanceof CompositeIndicator)) {
                    return true;
                }
                return false;
            } else {
                if (columnItemData != null) {
                    ModelElementIndicator modelElementIndicator = (ModelElementIndicator) columnItemData;
                    IRepositoryNode modelElementRepositoryNode = modelElementIndicator.getModelElementRepositoryNode();
                    return modelElementRepositoryNode == null ? false : true;
                }
                return false;
            }
        }

        @Override
        protected String getItemTooltipText(TreeItem item) {
            String expCont = isExpressionNull(item);
            if (expCont == null) {
                // $NON-NLS-1$
                return DefaultMessagesImpl.getString("AnalysisColumnTreeViewer.queryNotGen");
            }
            return expCont;
        }
    };
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(newTree);
    newTree.setHeaderVisible(true);
    // $NON-NLS-1$
    createTreeItem(newTree, 300, "AnalysisColumnTreeViewer.analyzedColumns");
    createTreeDataminingItem(newTree);
    // $NON-NLS-1$
    createTreeItem(newTree, 80, "AnalysisColumnTreeViewer.pattern");
    // $NON-NLS-1$
    createTreeItem(newTree, 80, "AnalysisColumnTreeViewer.udi");
    // $NON-NLS-1$
    createTreeItem(newTree, 80, "AnalysisColumnTreeViewer.operation");
    // TDQ-11622 : add a column here, let the width = 1 and text = EMPTY_STRING TODO need to find a better solution!
    TreeColumn blankColumn = new TreeColumn(newTree, SWT.CENTER);
    blankColumn.setWidth(1);
    // ~ TDQ-11622
    parent.layout();
    AbstractAnalysisActionHandler actionHandler = new AbstractAnalysisActionHandler(parent) {

        @Override
        protected void handleRemove() {
            removeSelectedElements(newTree);
        }
    };
    parent.setData(AbstractMetadataFormPage.ACTION_HANDLER, actionHandler);
    ColumnViewerDND.installDND(newTree);
    this.addTreeListener(newTree);
    newTree.setData(this);
    return newTree;
}
Also used : AbstractAnalysisActionHandler(org.talend.dataprofiler.core.ui.editor.AbstractAnalysisActionHandler) IRepositoryNode(org.talend.repository.model.IRepositoryNode) TreeItem(org.eclipse.swt.widgets.TreeItem) TreeColumn(org.eclipse.swt.widgets.TreeColumn) CompositeIndicator(org.talend.dataquality.indicators.CompositeIndicator) IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) TooltipTree(org.talend.dataprofiler.core.ui.dialog.composite.TooltipTree) Tree(org.eclipse.swt.widgets.Tree) MetadataTableRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataTableRepositoryObject) MetadataColumnRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject) MetadataXmlElementTypeRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataXmlElementTypeRepositoryObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) TooltipTree(org.talend.dataprofiler.core.ui.dialog.composite.TooltipTree) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Example 2 with AbstractAnalysisActionHandler

use of org.talend.dataprofiler.core.ui.editor.AbstractAnalysisActionHandler in project tdq-studio-se by Talend.

the class AnalysisTableTreeViewer method createTree.

private Tree createTree(Composite parent) {
    final Tree newTree = new TooltipTree(parent, SWT.MULTI | SWT.BORDER) {

        @Override
        protected boolean isValidItem(TreeItem item) {
            if (item == null) {
                return false;
            }
            Object itemData = item.getData(INDICATOR_UNIT_KEY);
            if (itemData != null) {
                TableIndicatorUnit indicatorUnit = (TableIndicatorUnit) item.getData(INDICATOR_UNIT_KEY);
                if (indicatorUnit != null && !(indicatorUnit.getIndicator() instanceof CompositeIndicator)) {
                    return true;
                }
                return false;
            } else {
                return false;
            }
        }

        @Override
        protected String getItemTooltipText(TreeItem item) {
            String expCont = isExpressionNull(item);
            if (expCont == null) {
                // $NON-NLS-1$
                return DefaultMessagesImpl.getString("AnalysisTableTreeViewer.queryNotGen");
            }
            return expCont;
        }
    };
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(newTree);
    newTree.setHeaderVisible(true);
    // $NON-NLS-1$
    createTreeItem(newTree, 190, "AnalysisTableTreeViewer.analyzedTables");
    // $NON-NLS-1$
    createTreeItem(newTree, 80, "AnalysisTableTreeViewer.dqrule");
    // $NON-NLS-1$
    createTreeItem(newTree, 80, "AnalysisColumnTreeViewer.operation");
    parent.layout();
    AbstractAnalysisActionHandler actionHandler = new AbstractAnalysisActionHandler(parent) {

        @Override
        protected void handleRemove() {
            removeSelectedElements(newTree);
        }
    };
    parent.setData(AbstractMetadataFormPage.ACTION_HANDLER, actionHandler);
    TableViewerDND.installDND(newTree);
    this.addTreeListener(newTree);
    newTree.setData(this);
    return newTree;
}
Also used : AbstractAnalysisActionHandler(org.talend.dataprofiler.core.ui.editor.AbstractAnalysisActionHandler) TreeItem(org.eclipse.swt.widgets.TreeItem) CompositeIndicator(org.talend.dataquality.indicators.CompositeIndicator) TooltipTree(org.talend.dataprofiler.core.ui.dialog.composite.TooltipTree) Tree(org.eclipse.swt.widgets.Tree) TableIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.TableIndicatorUnit) TooltipTree(org.talend.dataprofiler.core.ui.dialog.composite.TooltipTree)

Example 3 with AbstractAnalysisActionHandler

use of org.talend.dataprofiler.core.ui.editor.AbstractAnalysisActionHandler in project tdq-studio-se by Talend.

the class AnalysisColumnNominalIntervalTreeViewer method createTree.

/**
 * @param parent
 */
private Tree createTree(Composite parent) {
    final Tree newTree = new Tree(parent, SWT.MULTI | SWT.BORDER);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(newTree);
    newTree.setHeaderVisible(true);
    // $NON-NLS-1$
    createTreeItem(newTree, 300, "AnalysisColumnTreeViewer.analyzedColumns");
    createTreeDataminingItem(newTree);
    // $NON-NLS-1$
    createTreeItem(newTree, 80, "AnalysisColumnTreeViewer.operation");
    parent.layout();
    createTreeMenu(newTree, false);
    AbstractAnalysisActionHandler actionHandler = new AbstractAnalysisActionHandler(parent) {

        @Override
        protected void handleRemove() {
            removeSelectedElements(newTree);
        // MOD mzhao 2005-05-05 bug 6587.
        // MOD mzhao 2009-06-8, bug 5887.
        // updateBindConnection(masterPage, tree);
        }
    };
    parent.setData(AbstractMetadataFormPage.ACTION_HANDLER, actionHandler);
    addSourceDND(newTree);
    addTargetDND(newTree);
    addTreeListener(newTree);
    return newTree;
}
Also used : AbstractAnalysisActionHandler(org.talend.dataprofiler.core.ui.editor.AbstractAnalysisActionHandler) Tree(org.eclipse.swt.widgets.Tree)

Example 4 with AbstractAnalysisActionHandler

use of org.talend.dataprofiler.core.ui.editor.AbstractAnalysisActionHandler in project tdq-studio-se by Talend.

the class AnalysisColumnSetTreeViewer method createTree.

/**
 * @param parent
 */
private Tree createTree(Composite parent) {
    final Tree newTree = new TooltipTree(parent, SWT.MULTI | SWT.BORDER) {

        @Override
        protected String getItemTooltipText(TreeItem item) {
            ModelElementIndicator meIndicator = (ModelElementIndicator) item.getData(MODELELEMENT_INDICATOR_KEY);
            IRepositoryNode parentNodeForColumnNode = RepositoryNodeHelper.getParentNodeForColumnNode(meIndicator.getModelElementRepositoryNode());
            return DefaultMessagesImpl.getString("AnalysisColumnTreeViewer.columnParent", // $NON-NLS-1$ //;
            parentNodeForColumnNode.getObject().getLabel());
        }
    };
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(newTree);
    newTree.setHeaderVisible(true);
    // $NON-NLS-1$
    createTreeItem(newTree, 300, "AnalysisColumnTreeViewer.analyzedColumns");
    createTreeDataminingItem(newTree);
    // $NON-NLS-1$
    createTreeItem(newTree, 80, "AnalysisColumnTreeViewer.pattern");
    // $NON-NLS-1$
    createTreeItem(newTree, 80, "AnalysisColumnTreeViewer.operation");
    parent.layout();
    AbstractAnalysisActionHandler actionHandler = new AbstractAnalysisActionHandler(parent) {

        @Override
        protected void handleRemove() {
            removeSelectedElements(newTree);
            // MOD mzhao 2005-05-05 bug 6587.
            // MOD mzhao 2009-06-8, bug 5887.
            updateBindConnection(masterPage, tree);
        }
    };
    parent.setData(AbstractMetadataFormPage.ACTION_HANDLER, actionHandler);
    addTargetDND(newTree);
    addTreeListener(newTree);
    return newTree;
}
Also used : AbstractAnalysisActionHandler(org.talend.dataprofiler.core.ui.editor.AbstractAnalysisActionHandler) IRepositoryNode(org.talend.repository.model.IRepositoryNode) TreeItem(org.eclipse.swt.widgets.TreeItem) TooltipTree(org.talend.dataprofiler.core.ui.dialog.composite.TooltipTree) Tree(org.eclipse.swt.widgets.Tree) TooltipTree(org.talend.dataprofiler.core.ui.dialog.composite.TooltipTree) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Aggregations

Tree (org.eclipse.swt.widgets.Tree)4 AbstractAnalysisActionHandler (org.talend.dataprofiler.core.ui.editor.AbstractAnalysisActionHandler)4 TreeItem (org.eclipse.swt.widgets.TreeItem)3 TooltipTree (org.talend.dataprofiler.core.ui.dialog.composite.TooltipTree)3 ModelElementIndicator (org.talend.dataprofiler.core.model.ModelElementIndicator)2 CompositeIndicator (org.talend.dataquality.indicators.CompositeIndicator)2 IRepositoryNode (org.talend.repository.model.IRepositoryNode)2 TreeColumn (org.eclipse.swt.widgets.TreeColumn)1 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)1 MetadataColumnRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject)1 MetadataTableRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataTableRepositoryObject)1 MetadataXmlElementTypeRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataXmlElementTypeRepositoryObject)1 IndicatorUnit (org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit)1 TableIndicatorUnit (org.talend.dataprofiler.core.ui.editor.preview.TableIndicatorUnit)1