Révision 1701
tmp/org.txm.chartsengine.raster.rcp/src/org/txm/chartsengine/raster/rcp/swt/RasterComposite.java (revision 1701) | ||
---|---|---|
104 | 104 |
|
105 | 105 |
|
106 | 106 |
@Override |
107 |
public void requestFocusInComposite() {
|
|
107 |
public void requestFocusInChartComponent() {
|
|
108 | 108 |
// FIXME: to check |
109 | 109 |
// EventQueue.invokeLater(new Runnable () { |
110 | 110 |
// public void run () { |
tmp/org.txm.chartsengine.jfreechart.rcp/src/org/txm/chartsengine/jfreechart/rcp/themes/base/swing/ItemSelectionJFCChartPanel.java (revision 1701) | ||
---|---|---|
72 | 72 |
public ItemSelectionJFCChartPanel(SWTChartsComponentsProvider swtChartsComponentProvider, JFreeChart chart) { |
73 | 73 |
super(chart); |
74 | 74 |
this.swtChartsComponentProvider = swtChartsComponentProvider; |
75 |
// this.squareOffEnabled = false; |
|
76 | 75 |
} |
77 | 76 |
|
78 | 77 |
|
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/editors/ChartEditor.java (revision 1701) | ||
---|---|---|
327 | 327 |
this.updateEditorFromChart(update); |
328 | 328 |
|
329 | 329 |
|
330 |
if(this.parentMultiPagesEditor == null) { |
|
331 |
this.forceFocus(); |
|
332 |
} |
|
330 |
// if(this.parentMultiPagesEditor == null) {
|
|
331 |
// this.forceFocus();
|
|
332 |
// }
|
|
333 | 333 |
} |
334 | 334 |
|
335 | 335 |
|
... | ... | |
447 | 447 |
// TODO: for focus and activation debug |
448 | 448 |
// System.out.println("ChartEditor.activate(): current active editor = " + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart()); |
449 | 449 |
// System.out.println("ChartEditor.activate(): activating: " + this); |
450 |
// // PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().bringToTop(this);
|
|
450 |
// PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().bringToTop(this); |
|
451 | 451 |
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().activate(this); |
452 |
|
|
452 | 453 |
// System.out.println("ChartEditor.activate(): new active editor = " + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart()); |
453 | 454 |
} |
454 | 455 |
} |
... | ... | |
469 | 470 |
public void setFocus() { |
470 | 471 |
|
471 | 472 |
// Debug |
472 |
Log.finest("ChartEditor.setFocus().");
|
|
473 |
Log.finest("ChartEditor.setFocus(): giving focus to chart composite..."); //$NON-NLS-1$
|
|
473 | 474 |
|
474 | 475 |
this.chartComposite.setFocus(); |
475 | 476 |
|
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/swt/ChartComposite.java (revision 1701) | ||
---|---|---|
188 | 188 |
/** |
189 | 189 |
* Requests that component to get the focus thread-safely. |
190 | 190 |
*/ |
191 |
public abstract void requestFocusInComposite();
|
|
191 |
public abstract void requestFocusInChartComponent();
|
|
192 | 192 |
|
193 | 193 |
/** |
194 | 194 |
* Clears the selected items in chart. |
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/swt/SwingChartComposite.java (revision 1701) | ||
---|---|---|
14 | 14 |
import java.awt.datatransfer.Transferable; |
15 | 15 |
import java.awt.datatransfer.UnsupportedFlavorException; |
16 | 16 |
import java.awt.image.BufferedImage; |
17 |
import java.io.File; |
|
18 | 17 |
import java.io.IOException; |
19 | 18 |
|
19 |
import javax.swing.JComponent; |
|
20 | 20 |
import javax.swing.JPanel; |
21 | 21 |
|
22 |
import org.eclipse.swt.SWT; |
|
23 | 22 |
import org.eclipse.swt.awt.SWT_AWT; |
24 | 23 |
import org.eclipse.swt.widgets.Composite; |
25 | 24 |
import org.txm.chartsengine.core.results.ChartResult; |
... | ... | |
83 | 82 |
|
84 | 83 |
} |
85 | 84 |
|
86 |
// FIXME: old version; to remove if all ok |
|
87 |
// @Override |
|
88 |
// public void loadChart() { |
|
89 |
// |
|
90 |
// // loads the chart from the result |
|
91 |
// Object chart = this.chartEditor.getChart(); |
|
92 |
// |
|
93 |
// if(chart != null) { |
|
94 |
// // creates components if they not exist |
|
95 |
// if(this.chartComponent == null) { |
|
96 |
// |
|
97 |
// // recreates the chart if not of right type |
|
98 |
// if(!(chart instanceof File)) { |
|
99 |
// try { |
|
100 |
// this.chartEditor.getResult().clearLastRenderingParameters(); |
|
101 |
// this.chartEditor.getResult().compute(); |
|
102 |
// } |
|
103 |
// catch (Exception e) { |
|
104 |
// // TODO Auto-generated catch block |
|
105 |
// e.printStackTrace(); |
|
106 |
// } |
|
107 |
// } |
|
108 |
// |
|
109 |
// |
|
110 |
// this.chartEditor.getSWTChartsComponentsProvider().createChartContainer(this.chartEditor.getEditorInput()); |
|
111 |
// this.chartComponent = (IChartComponent) this.chartEditor.getEditorInput().getChartContainer(); |
|
112 |
// |
|
113 |
// this.rootPanel.add((Component) this.chartComponent); |
|
114 |
// |
|
115 |
// this.frame.setVisible(true); |
|
116 |
// } |
|
117 |
// this.loadChart(chart); |
|
118 |
// } |
|
119 |
// } |
|
120 |
|
|
121 | 85 |
@Override |
122 | 86 |
public void loadChart() { |
123 | 87 |
|
... | ... | |
154 | 118 |
|
155 | 119 |
} |
156 | 120 |
this.loadChart(this.chartEditor.getChart()); |
157 |
this.forceFocus(); |
|
121 |
//this.setFocus(); |
|
122 |
//this.forceFocus(); |
|
158 | 123 |
} |
159 | 124 |
} |
160 | 125 |
|
... | ... | |
199 | 164 |
public boolean setFocus() { |
200 | 165 |
|
201 | 166 |
// Debug |
202 |
Log.finest("SwingChartComposite.setFocus(): trying to give focus to SWT composite and to the AWT component..."); //$NON-NLS-1$
|
|
167 |
Log.finest("SwingChartComposite.setFocus(): trying to give focus to SWT composite and AWT component..."); //$NON-NLS-1$ |
|
203 | 168 |
|
204 | 169 |
boolean focusState = super.setFocus(); |
205 | 170 |
|
206 | 171 |
// Debug |
207 |
Log.finest(TXMCoreMessages.bind("SwingChartComposite.setFocus(): SWT composite focus given state = {0}.", focusState)); //$NON-NLS-1$
|
|
172 |
Log.finest(TXMCoreMessages.bind("SwingChartComposite.setFocus(): SWT composite focus given state = {0}.", this.isFocusControl())); //$NON-NLS-1$
|
|
208 | 173 |
|
209 |
this.requestFocusInComposite();
|
|
174 |
this.requestFocusInChartComponent();
|
|
210 | 175 |
|
211 | 176 |
return focusState; |
212 | 177 |
} |
213 | 178 |
|
214 | 179 |
@Override |
215 |
public void requestFocusInComposite() {
|
|
180 |
public void requestFocusInChartComponent() {
|
|
216 | 181 |
EventQueue.invokeLater(new Runnable () { |
217 | 182 |
public void run () { |
218 | 183 |
if(chartComponent != null) { |
219 | 184 |
|
220 | 185 |
boolean focusState = ((Component) chartComponent).requestFocusInWindow(); |
186 |
((JComponent) chartComponent).grabFocus(); |
|
221 | 187 |
|
222 | 188 |
// Debug |
223 |
Log.finest(TXMCoreMessages.bind("SwingChartComposite.requestFocusInComposite(): AWT component focus given state = {0}.", focusState)); //$NON-NLS-1$
|
|
189 |
Log.finest(TXMCoreMessages.bind("SwingChartComposite.requestFocusInChartComponent(): AWT component focus given state = {0}.", ((Component) chartComponent).isFocusOwner())); //$NON-NLS-1$
|
|
224 | 190 |
|
225 | 191 |
} |
226 | 192 |
} |
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/SWTChartsComponentsProvider.java (revision 1701) | ||
---|---|---|
552 | 552 |
|
553 | 553 |
//openedChartEditorPart.refreshCorporaView(); |
554 | 554 |
|
555 |
openedChartEditorPart.forceFocus(); |
|
555 |
//openedChartEditorPart.forceFocus();
|
|
556 | 556 |
|
557 | 557 |
} |
558 | 558 |
catch(PartInitException e) { |
... | ... | |
731 | 731 |
// FIXME: Debug |
732 | 732 |
// System.out.println("SWTChartsComponentProvider.initializeAWTDelegationListeners(...).new MouseListener() {...}.mousePressed(...).new Runnable() {...}.run()"); |
733 | 733 |
// Activate the editor part on AWT mouse pressed event |
734 |
chartEditor.activate(); |
|
734 |
// chartEditor.activate();
|
|
735 | 735 |
// chartEditor.forceFocus(); |
736 | 736 |
} |
737 | 737 |
}); |
... | ... | |
819 | 819 |
} |
820 | 820 |
}); |
821 | 821 |
|
822 |
swingComponent.addFocusListener(new FocusListener() { |
|
823 |
|
|
824 |
@Override |
|
825 |
public void focusLost(FocusEvent e) { |
|
826 |
|
|
827 |
// FIXME: For Swing focus debug tests |
|
828 |
if(RCPPreferences.getInstance().getBoolean(TBXPreferences.EXPERT_USER)) { |
|
829 |
swingComponent.setBorder(javax.swing.BorderFactory.createEmptyBorder()); |
|
830 |
} |
|
831 |
|
|
832 |
Display.getDefault().asyncExec(new Runnable() { |
|
833 |
|
|
834 |
@Override |
|
835 |
public void run() { |
|
836 |
chartEditor.deactivateContext(); |
|
837 |
} |
|
838 |
}); |
|
839 |
} |
|
840 |
|
|
841 |
@Override |
|
842 |
public void focusGained(FocusEvent e) { |
|
843 |
|
|
844 |
// FIXME: For Swing focus debug tests |
|
845 |
if(RCPPreferences.getInstance().getBoolean(TBXPreferences.EXPERT_USER)) { |
|
846 |
swingComponent.setBorder(new LineBorder(Color.red, 1)); |
|
847 |
} |
|
848 |
|
|
849 |
Display.getDefault().asyncExec(new Runnable() { |
|
850 |
|
|
851 |
@Override |
|
852 |
public void run() { |
|
853 |
chartEditor.activateContext(); |
|
854 |
} |
|
855 |
}); |
|
856 |
} |
|
857 |
}); |
|
858 |
|
|
822 | 859 |
|
860 |
|
|
823 | 861 |
|
824 | 862 |
|
863 |
|
|
825 | 864 |
// SWT |
826 | 865 |
|
827 | 866 |
// SWT Tooltips tests |
... | ... | |
868 | 907 |
case SWT.FocusIn: |
869 | 908 |
// FIXME: DEbug |
870 | 909 |
// System.out.println("SWTChartsComponentProvider.initializeAWTDelegationListeners(...).new Listener() {...}.handleEvent(): SWT composite gained focus"); |
871 |
chartEditor.getComposite().setFocus(); |
|
910 |
//chartEditor.getComposite().setFocus();
|
|
872 | 911 |
//chartEditor.getComposite().requestFocusInComposite(); |
873 | 912 |
break; |
874 | 913 |
case SWT.MouseMove: |
... | ... | |
907 | 946 |
case SWT.MouseDown: |
908 | 947 |
// 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 |
909 | 948 |
//System.err.println("SWTChartsComponentProvider.initializeAWTDelegationListeners(...).new Listener() {...}.handleEvent(): SWT mouse down : set focus in composite and request focus in chart panel"); |
910 |
chartEditor.getComposite().setFocus(); |
|
949 |
//chartEditor.getComposite().setFocus();
|
|
911 | 950 |
//chartEditor.getComposite().requestFocusInComposite(); |
912 | 951 |
break; |
913 | 952 |
case SWT.MouseUp: |
... | ... | |
921 | 960 |
|
922 | 961 |
case SWT.Activate: |
923 | 962 |
//System.err.println("SWTChartsComponentProvider.initializeAWTDelegationListeners(...).new Listener() {...}.handleEvent(): SWT activate"); |
924 |
chartEditor.getComposite().requestFocusInComposite(); |
|
963 |
//chartEditor.getComposite().requestFocusInComposite();
|
|
925 | 964 |
break; |
926 | 965 |
} |
927 | 966 |
} |
... | ... | |
933 | 972 |
// chartEditor.getComposite().addListener(SWT.Activate, listener); // TODO : test AWT delegation |
934 | 973 |
|
935 | 974 |
|
936 |
swingComponent.addFocusListener(new FocusListener() { |
|
937 |
|
|
938 |
@Override |
|
939 |
public void focusLost(FocusEvent e) { |
|
940 |
|
|
941 |
// FIXME: For Swing focus debug |
|
942 |
if(RCPPreferences.getInstance().getBoolean(TBXPreferences.EXPERT_USER)) { |
|
943 |
swingComponent.setBorder(javax.swing.BorderFactory.createEmptyBorder()); |
|
944 |
} |
|
945 |
|
|
946 |
Display.getDefault().asyncExec(new Runnable() { |
|
947 |
|
|
948 |
@Override |
|
949 |
public void run() { |
|
950 |
chartEditor.deactivateContext(); |
|
951 |
} |
|
952 |
}); |
|
953 |
} |
|
954 |
|
|
955 |
@Override |
|
956 |
public void focusGained(FocusEvent e) { |
|
957 |
|
|
958 |
// FIXME: For Swing focus debug |
|
959 |
if(RCPPreferences.getInstance().getBoolean(TBXPreferences.EXPERT_USER)) { |
|
960 |
swingComponent.setBorder(new LineBorder(Color.red, 1)); |
|
961 |
} |
|
962 |
|
|
963 |
Display.getDefault().asyncExec(new Runnable() { |
|
964 |
|
|
965 |
@Override |
|
966 |
public void run() { |
|
967 |
chartEditor.activateContext(); |
|
968 |
} |
|
969 |
}); |
|
970 |
} |
|
971 |
}); |
|
972 |
|
|
973 | 975 |
|
974 | 976 |
// FIXME: SWT tool tips test rather than using Swing |
975 | 977 |
//chartEditor.getComposite().addListener(SWT.MouseMove, listener); |
... | ... | |
1023 | 1025 |
|
1024 | 1026 |
|
1025 | 1027 |
/** |
1028 |
* Sets the name of the provider. |
|
1026 | 1029 |
* @param name the name to set |
1027 | 1030 |
*/ |
1028 | 1031 |
public void setName(String name) { |
Formats disponibles : Unified diff