Révision 1992

tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/swt/SwingChartComposite.java (revision 1992)
229 229
				Log.finest("SwingChartComposite.SwingChartComposite(...).new WindowFocusListener() {...}.windowLostFocus()");
230 230
				
231 231
				// FIXME: For Swing focus debug tests
232
				if(RCPPreferences.getInstance().getBoolean(TBXPreferences.EXPERT_USER))	{
232
				//if(RCPPreferences.getInstance().getBoolean(TBXPreferences.EXPERT_USER))	{
233 233
					((JComponent) rootPanel).setBorder(javax.swing.BorderFactory.createEmptyBorder());
234
				}
234
				//}
235 235

  
236 236
				
237 237
			}
......
242 242
				Log.finest("SwingChartComposite.SwingChartComposite(...).new WindowFocusListener() {...}.windowGainedFocus()");
243 243
				
244 244
				// FIXME: For Swing focus debug tests
245
				if(RCPPreferences.getInstance().getBoolean(TBXPreferences.EXPERT_USER))	{
246
					((JComponent) rootPanel).setBorder(new LineBorder(Color.red, 1));
247
				}
245
				//if(RCPPreferences.getInstance().getBoolean(TBXPreferences.EXPERT_USER))	{
246
					((JComponent) rootPanel).setBorder(new LineBorder(Color.GRAY, 1));
247
				//}
248 248
				
249 249
//				// SWT thread
250 250
//				getDisplay().asyncExec(new Runnable() {
......
477 477
		}
478 478
	}
479 479

  
480
	
481
	/**
482
	 * Initializes AWT default events to delegate AWT events to SWT.
483
	 */
484
	public void initializeAWTDelegationListeners()	{
480
	@Override
481
	public void initEventsListeners()	{
485 482

  
486 483
	
487 484
		
......
875 872
				this.createChartComponent();
876 873
				
877 874
				this.rootPanel.add((Component) this.chartComponent);
878

  
879 875
				
880
				// initialize the default shared context menus as Export, etc.
881
				this.initDefaultContextMenus();
882
				// initialize AWT default events to delegate AWT events to SWT.
883
				this.initializeAWTDelegationListeners();
884
				// register user entries event call back extensions
885
				this.registerEventCallBackExtensions();
886

  
887
				
888 876
				this.frame.setVisible(true);
889 877
			}
890 878
			this.loadChart(this.chartEditor.getChart());
......
892 880
	}
893 881
	
894 882
	
895
	/**
896
	 * Registers user entries event call back extensions.
897
	 */
898
	public void registerEventCallBackExtensions()	{
899
		
900
		ChartResult result = this.chartEditor.getResult();
901
		
902
		String extensionPointId = "org.txm.chartsengine.eventcallback"; //$NON-NLS-1$
903
		IConfigurationElement[] contributions = Platform.getExtensionRegistry().getConfigurationElementsFor(extensionPointId);
904
		
905
		for(int i = 0; i < contributions.length; i++) {
906
			if(
907
				(
908
						contributions[i].getAttribute("chartsEngineName") == null || //$NON-NLS-1$ // for callback that can be used for all charts engine implementations 
909
						contributions[i].getAttribute("chartsEngineName").equals(result.getChartsEngine().getName()) //$NON-NLS-1$
910
				)
911
				&&
912
				contributions[i].getAttribute("resultDataClass") != null //$NON-NLS-1$
913
				&& contributions[i].getAttribute("resultDataClass").equals(result.getClass().getName()) //$NON-NLS-1$
914
				
915
				&& ((contributions[i].getAttribute("chartType") == null && result.getChartType().equals(ChartsEnginePreferences.DEFAULT_CHART_TYPE) //$NON-NLS-1$
916
					||
917
					contributions[i].getAttribute("chartType") != null && !result.getChartType().equals(ChartsEnginePreferences.DEFAULT_CHART_TYPE) && contributions[i].getAttribute("chartType").equals(result.getChartType()) //$NON-NLS-1$ //$NON-NLS-2$
918
					)  //$NON-NLS-1$
919
				)
920
				
921
			)	{
922
				try {
923
					EventCallBack eventCallBack = (EventCallBack)contributions[i].createExecutableExtension("class");  //$NON-NLS-1$
924
					
925
					eventCallBack.setChartEditor(this.chartEditor);
926
					
927
					EventCallBackHandler mouseHandler = this.getMouseCallBackHandler();
928
					if(mouseHandler != null && mouseHandler.getEventCallBack(eventCallBack.getClass()) == null)	 {
929 883

  
930
						Log.fine("ChartEditor.registerEventCallBackExtensions(): call back of type " + eventCallBack.getClass()  //$NON-NLS-1$
931
								+ " registered in mouse handler (chart editor = " + this.chartEditor.getClass()  //$NON-NLS-1$
932
								+ ", result data class = " + result.getClass()  //$NON-NLS-1$
933
								+ ", chart type = " + result.getChartType()  //$NON-NLS-1$
934
								+ ").");  //$NON-NLS-1$
935
						
936
						mouseHandler.registerEventCallBack(eventCallBack);
937
					}
938
					EventCallBackHandler keyboardHandler = this.getKeyCallBackHandler();
939
					if(keyboardHandler != null && keyboardHandler.getEventCallBack(eventCallBack.getClass()) == null)	 {
940
						
941
						Log.fine("ChartEditor.registerEventCallBackExtensions(): call back of type " + eventCallBack.getClass()  //$NON-NLS-1$
942
								+ " registered in key handler (chart editor = " + this.chartEditor.getClass()  //$NON-NLS-1$
943
								+ ", result data class = " + result.getClass()  //$NON-NLS-1$
944
								+ ", chart type = " + result.getChartType()  //$NON-NLS-1$
945
								+ ").");  //$NON-NLS-1$
946
						
947
						keyboardHandler.registerEventCallBack(eventCallBack);
948
					}
949
				}
950
				catch(CoreException e) {
951
					e.printStackTrace();
952
				}
953
				break;
954
			}
955
		}
956
		
957
	}
958 884

  
959 885
	
960 886
	@Override

Formats disponibles : Unified diff