Search in sources :

Example 1 with EventReceiver

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

the class MatchAnalysisDetailsPage method registerEvents.

private void registerEvents(Composite dataSampleComposite) {
    // register: refresh the result page after running it from menu
    afterCreateConnectionReceiver = new EventReceiver() {

        @Override
        public boolean handle(Object data) {
            // check if the connection is unavailable, give a warning dialog to user without opening the columns
            // select dialog
            DataManager dataManager = (DataManager) data;
            if (ConnectionUtils.checkConnection(dataManager, getAnalysisHandler().getAnalysis().getName())) {
                // need to give the new connection to the dialog to show only this new one in the dialog.
                openColumnsSelectionDialog(dataManager);
                // reset the select key buttons status
                resetSelectKeyButton();
            }
            return true;
        }
    };
    EventManager.getInstance().register(dataSampleComposite, EventEnum.DQ_SELECT_ELEMENT_AFTER_CREATE_CONNECTION, afterCreateConnectionReceiver);
    // register: refresh the data sample table to display the running result(with GID, SCORE, ...)
    refreshTableDataReceiver = new EventReceiver() {

        @Override
        public boolean handle(final Object data) {
            Display.getDefault().asyncExec(new Runnable() {

                @SuppressWarnings("unchecked")
                public void run() {
                    refreshTable((List<Object[]>) data);
                }
            });
            return true;
        }
    };
    EventManager.getInstance().register(analysisHandler.getAnalysis(), EventEnum.DQ_MATCH_ANALYSIS_REFRESH_WITH_RESULT, refreshTableDataReceiver);
}
Also used : MetadataColumnRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject) DataManager(orgomg.cwm.foundation.softwaredeployment.DataManager) EventReceiver(org.talend.dataprofiler.core.ui.events.EventReceiver)

Example 2 with EventReceiver

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

the class MatchAnalysisDetailsPage method createAnaDataLabelComposite.

/**
 * create Analysis Data Label Composite.
 *
 * @param dataparent
 */
private void createAnaDataLabelComposite(Composite dataparent) {
    Composite titleComposite = toolkit.createComposite(dataparent);
    GridLayout layout = new GridLayout(2, Boolean.TRUE);
    titleComposite.setLayout(layout);
    analyzeDataLabel = new Label(titleComposite, SWT.NONE);
    final int analysisColumnSize = analysisHandler.getAnalyzedColumns().size();
    final RepositoryNode firstColumnNode = analysisColumnSize > 0 ? RepositoryNodeHelper.recursiveFind(analysisHandler.getAnalyzedColumns().get(0)) : null;
    // register: refresh the dataprovider combobox when the name of the data provider is changed.
    refreshDataProiverLabel = new EventReceiver() {

        @Override
        public boolean handle(Object data) {
            if (firstColumnNode != null) {
                updateAnalyzeDataLabel(firstColumnNode);
            }
            return true;
        }
    };
    EventManager.getInstance().register(getCurrentModelElement(), EventEnum.DQ_MATCH_ANALYSIS_REFRESH_DATAPROVIDER_LABEL, refreshDataProiverLabel);
    if (analysisColumnSize > 0 && firstColumnNode != null) {
        updateAnalyzeDataLabel(firstColumnNode);
    } else if (analysisColumnSize > 0 && firstColumnNode == null) {
        // $NON-NLS-1$
        analyzeDataLabel.setText(analyzeDataDefaultInfo + "The connection is not available now!");
    } else {
        analyzeDataLabel.setText(analyzeDataDefaultInfo);
    }
    // ADD msjian TDQ-8040 2013-11-8: Add a button "show in repository view"
    ImageHyperlink showInDQViewLink = toolkit.createImageHyperlink(titleComposite, SWT.NONE);
    // $NON-NLS-1$
    showInDQViewLink.setToolTipText(DefaultMessagesImpl.getString("AnalysisColumnTreeViewer.showDQElement"));
    showInDQViewLink.setImage(ImageLib.getImage(ImageLib.APPLICATION_HOME));
    showInDQViewLink.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent e) {
            List<IRepositoryNode> analysedElements = findAllSelectedRepositoryNode();
            if (analysedElements != null && analysedElements.size() > 0) {
                DQRespositoryView dqview = CorePlugin.getDefault().findAndOpenRepositoryView();
                // if DqRepository view is not openning we will not do anything
                if (dqview == null) {
                    return;
                }
                ModelElement column = RepositoryNodeHelper.getModelElementFromRepositoryNode(analysedElements.get(0));
                ModelElement container = (ModelElement) (column.eContainer());
                RepositoryNode recursiveFind = RepositoryNodeHelper.recursiveFind(container);
                if (recursiveFind == null) {
                    recursiveFind = RepositoryNodeHelper.createRepositoryNode(container);
                }
                dqview.showSelectedElements(recursiveFind);
            }
        }
    });
// TDQ-8040~
}
Also used : HyperlinkEvent(org.eclipse.ui.forms.events.HyperlinkEvent) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ImageHyperlink(org.eclipse.ui.forms.widgets.ImageHyperlink) Label(org.eclipse.swt.widgets.Label) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) EventReceiver(org.talend.dataprofiler.core.ui.events.EventReceiver) ModelElement(orgomg.cwm.objectmodel.core.ModelElement) GridLayout(org.eclipse.swt.layout.GridLayout) MetadataColumnRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject) List(java.util.List) ArrayList(java.util.ArrayList) EList(org.eclipse.emf.common.util.EList) DQRespositoryView(org.talend.dataprofiler.core.ui.views.DQRespositoryView) HyperlinkAdapter(org.eclipse.ui.forms.events.HyperlinkAdapter)

Example 3 with EventReceiver

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

the class BusinessRuleAnalysisResultPage method registerRefreshDynamicChartEvent.

/**
 * refresh the composite of the chart, to show the changes on the chart.
 */
private void registerRefreshDynamicChartEvent() {
    registerDynamicRefreshEvent = new EventReceiver() {

        @Override
        public boolean handle(Object data) {
            reLayoutChartComposite();
            return true;
        }
    };
    EventManager.getInstance().register(sectionClient, EventEnum.DQ_DYNAMIC_REFRESH_DYNAMIC_CHART, registerDynamicRefreshEvent);
    // register a event to handle switch between master and result page
    switchBetweenPageEvent = new EventReceiver() {

        int times = 0;

        @Override
        public boolean handle(Object data) {
            if (times == 0) {
                times++;
                masterPage.refreshGraphicsInSettingsPage();
            }
            return true;
        }
    };
    EventManager.getInstance().register(masterPage.getCurrentModelElement(), EventEnum.DQ_DYNAMIC_SWITCH_MASTER_RESULT_PAGE, switchBetweenPageEvent);
}
Also used : TableDynamicChartEventReceiver(org.talend.dataprofiler.core.ui.events.TableDynamicChartEventReceiver) IEventReceiver(org.talend.dataprofiler.core.ui.events.IEventReceiver) DynamicChartEventReceiver(org.talend.dataprofiler.core.ui.events.DynamicChartEventReceiver) EventReceiver(org.talend.dataprofiler.core.ui.events.EventReceiver)

Example 4 with EventReceiver

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

the class AbstractAnalysisMetadataPage method createConnBindWidget.

/**
 * MOD mzhao 2009-06-17 feature 5887.
 *
 * @param parentComp
 */
public void createConnBindWidget(Composite parentComp) {
    // ~ MOD mzhao 2009-05-05,Bug 6587.
    Composite labelButtonClient = toolkit.createComposite(parentComp, SWT.NONE);
    GridLayout labelButtonClientLayout = new GridLayout();
    labelButtonClientLayout.numColumns = 4;
    labelButtonClient.setLayout(labelButtonClientLayout);
    // $NON-NLS-1$
    toolkit.createLabel(labelButtonClient, DefaultMessagesImpl.getString("AbstractMetadataFormPage.connBind"));
    // MOD yyin 201204 TDQ-4977, change to TableCombo type to show the connection type.
    // create TableCombo
    connCombo = new TableCombo(labelButtonClient, SWT.BORDER | SWT.READ_ONLY);
    connCombo.setLayoutData(new GridData(SWT.DEFAULT, SWT.DEFAULT));
    // tell the TableCombo that I want 2 blank columns auto sized.
    connCombo.defineColumns(2);
    // set which column will be used for the selected item.
    connCombo.setDisplayColumnIndex(0);
    connCombo.setSize(SWT.DEFAULT, SWT.DEFAULT);
    // add listener
    // connCombo = new TableCombo(labelButtonClient, SWT.BORDER);
    connCombo.setEditable(false);
    connCombo.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            updateAnalysisConnectionVersionInfo();
            setSampleDataShowWayStatus();
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }
    });
    // ADD msjian TDQ-5184 2012-4-8: set the connCombo background color as system set color
    connCombo.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    // TDQ-5184~
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).applyTo(labelButtonClient);
    // register: refresh the dataprovider combobox when the name of the data provider is changed.
    refreshDataProvider = new EventReceiver() {

        @Override
        public boolean handle(Object data) {
            reloadDataproviderAndFillConnCombo();
            // TDQ-9345,avoid to get an old column RepositoryNode when click "selecet columns..."
            updateAnalysisTree();
            return true;
        }
    };
    EventManager.getInstance().register(getCurrentModelElement(), EventEnum.DQ_ANALYSIS_REFRESH_DATAPROVIDER_LIST, refreshDataProvider);
    connCombo.addDisposeListener(new DisposeListener() {

        public void widgetDisposed(DisposeEvent e) {
            EventManager.getInstance().clearEvent(getCurrentModelElement(), EventEnum.DQ_ANALYSIS_REFRESH_DATAPROVIDER_LIST);
        }
    });
    createConnVersionText(labelButtonClient);
    createConnDeletedLabel(labelButtonClient);
    reloadDataproviderAndFillConnCombo();
// ~
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TableCombo(org.eclipse.nebula.widgets.tablecombo.TableCombo) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ISubRepositoryObject(org.talend.core.model.repository.ISubRepositoryObject) DisposeEvent(org.eclipse.swt.events.DisposeEvent) EventReceiver(org.talend.dataprofiler.core.ui.events.EventReceiver) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 5 with EventReceiver

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

the class TOPRepositoryService method addSoftwareSystemUpdateListener.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.core.ITDQRepositoryService#addSoftwareSystemUpdateListener()
     */
public void addSoftwareSystemUpdateListener() {
    EventReceiver softwareSystemUpdateEventReceiver = new SoftwareSystemUpdateEventReceiver();
    EventManager.getInstance().register(EventEnum.DQ_SOFTWARESYSTEM_UPDATE.name(), EventEnum.DQ_SOFTWARESYSTEM_UPDATE, softwareSystemUpdateEventReceiver);
}
Also used : SoftwareSystemUpdateEventReceiver(org.talend.dataprofiler.core.ui.events.SoftwareSystemUpdateEventReceiver) EventReceiver(org.talend.dataprofiler.core.ui.events.EventReceiver) SoftwareSystemUpdateEventReceiver(org.talend.dataprofiler.core.ui.events.SoftwareSystemUpdateEventReceiver)

Aggregations

EventReceiver (org.talend.dataprofiler.core.ui.events.EventReceiver)9 DynamicChartEventReceiver (org.talend.dataprofiler.core.ui.events.DynamicChartEventReceiver)3 GridLayout (org.eclipse.swt.layout.GridLayout)2 Composite (org.eclipse.swt.widgets.Composite)2 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)2 ISubRepositoryObject (org.talend.core.model.repository.ISubRepositoryObject)2 MetadataColumnRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject)2 DynamicBAWChartEventReceiver (org.talend.dataprofiler.core.ui.events.DynamicBAWChartEventReceiver)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 EList (org.eclipse.emf.common.util.EList)1 TableCombo (org.eclipse.nebula.widgets.tablecombo.TableCombo)1 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)1 DisposeEvent (org.eclipse.swt.events.DisposeEvent)1 DisposeListener (org.eclipse.swt.events.DisposeListener)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 SelectionListener (org.eclipse.swt.events.SelectionListener)1 GridData (org.eclipse.swt.layout.GridData)1 Label (org.eclipse.swt.widgets.Label)1 PartInitException (org.eclipse.ui.PartInitException)1