Revision 1820

tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/SWTChartsComponentsProvider.java (revision 1820)
972 972

  
973 973

  
974 974
		// Handle the AWT/Swing events delegation
975
//		listener = new Listener () {
976
//			public void handleEvent (Event e) {
977
//				switch (e.type) {
978
//					case SWT.FocusIn:
979
//						// FIXME: DEbug
980
////						System.out.println("SWTChartsComponentProvider.initializeAWTDelegationListeners(...).new Listener() {...}.handleEvent(): SWT composite gained focus");
981
//						//chartEditor.getComposite().setFocus();
982
//						//chartEditor.getComposite().requestFocusInComposite();
983
//						break;
984
//					case SWT.MouseMove:
985
//						//System.err.println("SWTChartsComponentProvider.initializeAWTDelegationListeners(...).new Listener() {...}.handleEvent(): SWT mouse move: " + e.x + " : " + e.y);
986
//
987
////						// FIXME: SWT tool tips test
988
////						ToolTip tip = new ToolTip(getShell(), SWT.BALLOON | SWT.ID_HIDE);
989
////						tip.setMessage("test tool tip SWT");
990
////						tip.setLocation(getDisplay().map(self, null, new Point(e.x, e.y)));
991
////						tip.setVisible(true);
992
//
993
////						// FIXME: JFace tool tips test
994
////						//DefaultToolTip tip2 = new DefaultToolTip( self, SWT.NONE, true );
995
////						//toolTip.setShift(new Point(e.x, e.y));
996
////						//toolTip.setText("<html><body><p>rtrt <font style=\"color: red\">yuyuyu</font></p></body></html>");
997
////						toolTip.setText(e.text);
998
////						if(e.text != null)	{
999
////							toolTip.show(new Point(e.x, e.y));
1000
////						}
1001
////						else	{
1002
////							toolTip.hide();
1003
////						}
1004
//
1005
//						// FIXME: JFace tool tips test 2
1006
////						toolTip.setText(e.text);
1007
////						if(e.text != null)	{
1008
////							toolTip.show(new Point(e.x, e.y));
1009
////						}
1010
////						else	{
1011
////							toolTip.hide();
1012
////						}
1013
//
1014
//
1015
//
1016
//						break;
1017
//					case SWT.MouseDown:
1018
//						// FIXME: to test in Linux and Mac, it should fix the focus bugs in CA chart between table focus and chart composite/panel focus + Linux singular values bar plot focus bug
1019
//						//System.err.println("SWTChartsComponentProvider.initializeAWTDelegationListeners(...).new Listener() {...}.handleEvent(): SWT mouse down : set focus in composite and request focus in chart panel");
1020
//						//chartEditor.getComposite().setFocus();
1021
//						//chartEditor.getComposite().requestFocusInComposite();
1022
//						break;
1023
//					case SWT.MouseUp:
1024
//						//System.err.println("SWTChartsComponentProvider.initializeAWTDelegationListeners(...).new Listener() {...}.handleEvent(): SWT mouse up");
1025
//						break;
1026
//
1027
//					case SWT.MouseEnter:
1028
//						//System.err.println("SWTChartsComponentProvider.initializeAWTDelegationListeners(...).new Listener() {...}.handleEvent(): SWT mouse enter");
1029
//						break;
1030
//
1031
//
1032
//					case SWT.Activate:
1033
//						//System.err.println("SWTChartsComponentProvider.initializeAWTDelegationListeners(...).new Listener() {...}.handleEvent(): SWT activate");
1034
//						//chartEditor.getComposite().requestFocusInComposite();
1035
//						break;
1036
//				}
1037
//		   }
1038
//		};
975
		listener = new Listener () {
976
			public void handleEvent (Event e) {
977
				switch (e.type) {
978
				
979
					case SWT.FocusOut:
980
					// FIXME: DEbug
981
//					System.out.println("SWTChartsComponentProvider.initializeAWTDelegationListeners(...).new Listener() {...}.handleEvent(): SWT composite gained focus");
982
						System.out.println("SWTChartsComponentsProvider.initializeAWTDelegationListeners(...).new Listener() {...}.handleEvent()");
983
						break;
984

  
985
				
986
					case SWT.FocusIn:
987
						// FIXME: DEbug
988
//						System.out.println("SWTChartsComponentProvider.initializeAWTDelegationListeners(...).new Listener() {...}.handleEvent(): SWT composite gained focus");
989
						//chartEditor.getComposite().setFocus();
990
						//chartEditor.getComposite().requestFocusInComposite();
991
						break;
992
					case SWT.MouseMove:
993
						//System.err.println("SWTChartsComponentProvider.initializeAWTDelegationListeners(...).new Listener() {...}.handleEvent(): SWT mouse move: " + e.x + " : " + e.y);
994

  
995
//						// FIXME: SWT tool tips test
996
//						ToolTip tip = new ToolTip(getShell(), SWT.BALLOON | SWT.ID_HIDE);
997
//						tip.setMessage("test tool tip SWT");
998
//						tip.setLocation(getDisplay().map(self, null, new Point(e.x, e.y)));
999
//						tip.setVisible(true);
1000

  
1001
//						// FIXME: JFace tool tips test
1002
//						//DefaultToolTip tip2 = new DefaultToolTip( self, SWT.NONE, true );
1003
//						//toolTip.setShift(new Point(e.x, e.y));
1004
//						//toolTip.setText("<html><body><p>rtrt <font style=\"color: red\">yuyuyu</font></p></body></html>");
1005
//						toolTip.setText(e.text);
1006
//						if(e.text != null)	{
1007
//							toolTip.show(new Point(e.x, e.y));
1008
//						}
1009
//						else	{
1010
//							toolTip.hide();
1011
//						}
1012

  
1013
						// FIXME: JFace tool tips test 2
1014
//						toolTip.setText(e.text);
1015
//						if(e.text != null)	{
1016
//							toolTip.show(new Point(e.x, e.y));
1017
//						}
1018
//						else	{
1019
//							toolTip.hide();
1020
//						}
1021

  
1022

  
1023

  
1024
						break;
1025
					case SWT.MouseDown:
1026
						// FIXME: to test in Linux and Mac, it should fix the focus bugs in CA chart between table focus and chart composite/panel focus + Linux singular values bar plot focus bug
1027
						//System.err.println("SWTChartsComponentProvider.initializeAWTDelegationListeners(...).new Listener() {...}.handleEvent(): SWT mouse down : set focus in composite and request focus in chart panel");
1028
						//chartEditor.getComposite().setFocus();
1029
						//chartEditor.getComposite().requestFocusInComposite();
1030
						break;
1031
					case SWT.MouseUp:
1032
						//System.err.println("SWTChartsComponentProvider.initializeAWTDelegationListeners(...).new Listener() {...}.handleEvent(): SWT mouse up");
1033
						break;
1034

  
1035
					case SWT.MouseEnter:
1036
						//System.err.println("SWTChartsComponentProvider.initializeAWTDelegationListeners(...).new Listener() {...}.handleEvent(): SWT mouse enter");
1037
						break;
1038

  
1039

  
1040
					case SWT.Activate:
1041
						//System.err.println("SWTChartsComponentProvider.initializeAWTDelegationListeners(...).new Listener() {...}.handleEvent(): SWT activate");
1042
						//chartEditor.getComposite().requestFocusInComposite();
1043
						break;
1044
				}
1045
		   }
1046
		};
1047
		chartEditor.getComposite().addListener(SWT.FocusOut, listener);
1039 1048
//		chartEditor.getComposite().addListener(SWT.FocusIn, listener);
1040 1049
//		chartEditor.getComposite().addListener(SWT.MouseDown, listener); // needed to manage the focus delegation between SWT and AWT/Swing
1041 1050
//

Also available in: Unified diff