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);
}
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~
}
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);
}
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();
// ~
}
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);
}
Aggregations