/** * unregister every dynamic events which registered before executing analysis * * @param eventReceivers */ public void unRegisterDynamicEvent() { EventManager.getInstance() .unRegister( masterPage.getAnalysis(), EventEnum.DQ_DYNAMIC_SWITCH_MASTER_RESULT_PAGE, switchBetweenPageEvent); for (Indicator oneIndicator : eventReceivers.keySet()) { DynamicChartEventReceiver eventReceiver = (DynamicChartEventReceiver) eventReceivers.get(oneIndicator); eventReceiver.clear(); EventManager.getInstance().clearEvent(oneIndicator, EventEnum.DQ_DYMANIC_CHART); } eventReceivers.clear(); EventManager.getInstance() .unRegister( chartComposite, EventEnum.DQ_DYNAMIC_REFRESH_DYNAMIC_CHART, registerDynamicRefreshEvent); if (uiPagination != null) { uiPagination.clearAllDynamicMapOfCurrentPage(); } masterPage.clearDynamicDatasets(); }
/** refresh the composite of the chart, to show the changes on the chart. */ private void registerOtherDynamicEvent() { registerDynamicRefreshEvent = new EventReceiver() { @Override public boolean handle(Object data) { reLayoutChartComposite(); return true; } }; EventManager.getInstance() .register( chartComposite, 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.refresh(); } return true; } }; EventManager.getInstance() .register( masterPage.getAnalysis(), EventEnum.DQ_DYNAMIC_SWITCH_MASTER_RESULT_PAGE, switchBetweenPageEvent); }
private void registerIndicatorEvent(Indicator oneIndicator, DynamicChartEventReceiver eReceiver) { eventReceivers.put(oneIndicator, eReceiver); EventManager.getInstance().register(oneIndicator, EventEnum.DQ_DYMANIC_CHART, eReceiver); }