4 |
4 |
package org.txm.chartsengine.rcp.swt;
|
5 |
5 |
|
6 |
6 |
import java.awt.AWTEvent;
|
|
7 |
import java.awt.BorderLayout;
|
7 |
8 |
import java.awt.Color;
|
8 |
9 |
import java.awt.Component;
|
9 |
10 |
import java.awt.Frame;
|
... | ... | |
14 |
15 |
import java.awt.datatransfer.UnsupportedFlavorException;
|
15 |
16 |
import java.awt.event.MouseEvent;
|
16 |
17 |
import java.awt.event.MouseListener;
|
17 |
|
import java.awt.event.MouseMotionListener;
|
18 |
18 |
import java.awt.event.WindowEvent;
|
19 |
19 |
import java.awt.event.WindowFocusListener;
|
20 |
20 |
import java.awt.event.WindowListener;
|
21 |
21 |
import java.awt.image.BufferedImage;
|
22 |
22 |
import java.io.IOException;
|
23 |
23 |
|
24 |
|
import javax.swing.JApplet;
|
25 |
24 |
import javax.swing.JComponent;
|
|
25 |
import javax.swing.JPanel;
|
26 |
26 |
import javax.swing.SwingUtilities;
|
27 |
27 |
import javax.swing.border.LineBorder;
|
28 |
28 |
|
29 |
29 |
import org.eclipse.core.runtime.CoreException;
|
30 |
30 |
import org.eclipse.core.runtime.IConfigurationElement;
|
31 |
31 |
import org.eclipse.core.runtime.Platform;
|
32 |
|
import org.eclipse.swt.SWT;
|
33 |
32 |
import org.eclipse.swt.awt.SWT_AWT;
|
34 |
33 |
import org.eclipse.swt.graphics.Point;
|
35 |
34 |
import org.eclipse.swt.widgets.Composite;
|
36 |
35 |
import org.eclipse.swt.widgets.Event;
|
37 |
|
import org.eclipse.swt.widgets.Listener;
|
38 |
36 |
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences;
|
39 |
37 |
import org.txm.chartsengine.core.results.ChartResult;
|
40 |
38 |
import org.txm.chartsengine.rcp.IChartComponent;
|
41 |
|
import org.txm.chartsengine.rcp.SWTChartsComponentsProvider;
|
42 |
39 |
import org.txm.chartsengine.rcp.editors.ChartEditor;
|
43 |
40 |
import org.txm.chartsengine.rcp.events.EventCallBack;
|
44 |
41 |
import org.txm.chartsengine.rcp.events.EventCallBackHandler;
|
... | ... | |
74 |
71 |
//FIXME: tests
|
75 |
72 |
//protected Panel rootPanel;
|
76 |
73 |
//protected JRootPane rootPanel;
|
77 |
|
// protected JPanel rootPanel;
|
|
74 |
protected JPanel rootPanel;
|
78 |
75 |
|
79 |
|
protected JComponent rootPanel;
|
|
76 |
// protected JComponent rootPanel;
|
80 |
77 |
|
81 |
78 |
|
82 |
79 |
|
... | ... | |
96 |
93 |
this.frame = SWT_AWT.new_Frame(this);
|
97 |
94 |
|
98 |
95 |
// Need to add an AWT/Swing Panel to fix mouse events and mouse cursors changes on AWT/Swing chart component panel (see: https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4982522)
|
99 |
|
// this.rootPanel = new JPanel(new BorderLayout());
|
100 |
|
// this.frame.add(this.rootPanel);
|
|
96 |
this.rootPanel = new JPanel(new BorderLayout());
|
|
97 |
this.frame.add(this.rootPanel);
|
101 |
98 |
|
102 |
99 |
// FIXME: tests with Applet, see: https://www.eclipse.org/articles/article.php?file=Article-Swing-SWT-Integration/index.html
|
103 |
|
final JApplet applet = new JApplet();
|
104 |
|
this.rootPanel = (JComponent) applet.getRootPane().getContentPane();
|
105 |
|
this.frame.add(applet);
|
|
100 |
// NOTE SJ: avec ce code le changement de moteur à la volée ne fonctionne pas sous Mac OS X
|
|
101 |
// final JApplet applet = new JApplet();
|
|
102 |
// this.rootPanel = (JComponent) applet.getRootPane().getContentPane();
|
|
103 |
// this.frame.add(applet);
|
106 |
104 |
|
107 |
105 |
|
108 |
106 |
//this.frame.pack();
|
109 |
107 |
|
110 |
|
//this.frame.setVisible(true);
|
|
108 |
this.frame.setVisible(true);
|
111 |
109 |
//this.frame.setVisible(false);
|
112 |
110 |
|
113 |
111 |
|
... | ... | |
875 |
873 |
Object chart = this.chartEditor.getChart();
|
876 |
874 |
|
877 |
875 |
if(chart != null) {
|
|
876 |
|
878 |
877 |
// creates components if they not exist
|
879 |
878 |
if(this.chartComponent == null) {
|
880 |
879 |
|