Révision 901
tmp/org.txm.chartsengine.graphstream.core/src/org/txm/chartsengine/graphstream/core/GSChartCreator.java (revision 901) | ||
---|---|---|
1 |
package org.txm.chartsengine.graphstream.core; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
|
|
5 |
import org.graphstream.graph.Graph; |
|
6 |
import org.txm.chartsengine.core.ChartCreator; |
|
7 |
import org.txm.chartsengine.core.results.ChartResult; |
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
/** |
|
12 |
* GraphStream base chart creator. |
|
13 |
* |
|
14 |
* All GSC charts creators should extend this class. |
|
15 |
* The updateChart(ChartResult result) method implementation of the subclasses must call super.update(result) to benefit to the shared system. |
|
16 |
* |
|
17 |
* @author sjacquot |
|
18 |
* |
|
19 |
*/ |
|
20 |
public abstract class GSChartCreator extends ChartCreator { |
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
@Override |
|
25 |
public void updateChart(ChartResult result) { |
|
26 |
// Java object |
|
27 |
if(result.getChart() instanceof Graph) { |
|
28 |
Graph graph = (Graph) result.getChart(); |
|
29 |
|
|
30 |
|
|
31 |
// FIXME: Debug |
|
32 |
System.out.println("GSChartCreator.updateChart() style sheet dump: " + graph.getAttribute("ui.stylesheet")); |
|
33 |
|
|
34 |
// Add the current shared preferences as Font size, etc. |
|
35 |
graph.addAttribute("ui.stylesheet", graph.getAttribute("ui.stylesheet") + "node {" |
|
36 |
+ " text-size: " + result.getFont().split("\\|")[2] + ";" |
|
37 |
+ " text-font: \"" + result.getFont().split("\\|")[1] + "\";" |
|
38 |
|
|
39 |
+ " }"); |
|
40 |
|
|
41 |
// FIXME: Debug |
|
42 |
System.out.println("GSChartCreator.updateChart() style sheet dump: " + graph.getAttribute("ui.stylesheet")); |
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
|
53 |
// // freeze rendering |
|
54 |
// chart.setNotify(false); |
|
55 |
// |
|
56 |
// |
|
57 |
// // applying full theme |
|
58 |
// if(applyTheme) { |
|
59 |
// this.getChartsEngine().getJFCTheme().applyThemeToChart(result); |
|
60 |
// } |
|
61 |
// |
|
62 |
// |
|
63 |
// // rendering color mode |
|
64 |
// this.getChartsEngine().getJFCTheme().applySeriesPaint(result); |
|
65 |
// |
|
66 |
// // multiple line strokes |
|
67 |
// this.getChartsEngine().getJFCTheme().applySeriesStrokes(result); |
|
68 |
// |
|
69 |
// // title visibility |
|
70 |
// if(chart.getTitle() != null && result.hasParameterChanged(ChartsEnginePreferences.SHOW_TITLE)) { |
|
71 |
// chart.getTitle().setVisible(result.isTitleVisible()); |
|
72 |
// } |
|
73 |
// // legend visibility |
|
74 |
// if(chart.getLegend() != null && result.hasParameterChanged(ChartsEnginePreferences.SHOW_LEGEND)) { |
|
75 |
// chart.getLegend().setVisible(result.isLegendVisible()); |
|
76 |
// } |
|
77 |
// // CategoryPlot |
|
78 |
// if(chart.getPlot() instanceof CategoryPlot) { |
|
79 |
// CategoryPlot plot = (CategoryPlot) chart.getPlot(); |
|
80 |
// // grid visibility |
|
81 |
// plot.setDomainGridlinesVisible(result.isGridVisible()); |
|
82 |
// plot.setRangeGridlinesVisible(result.isGridVisible()); |
|
83 |
// |
|
84 |
// // force the renderer initialization to override theme settings |
|
85 |
// if(plot.getRenderer() instanceof IRendererWithItemSelection) { |
|
86 |
// ((IRendererWithItemSelection) plot.getRenderer()).init(); |
|
87 |
// } |
|
88 |
// } |
|
89 |
// // XYPlot |
|
90 |
// else if(chart.getPlot() instanceof XYPlot) { |
|
91 |
// XYPlot plot = (XYPlot) chart.getPlot(); |
|
92 |
// // grid visibility |
|
93 |
// plot.setRangeGridlinesVisible(result.isGridVisible()); |
|
94 |
// plot.setDomainGridlinesVisible(result.isGridVisible()); |
|
95 |
// |
|
96 |
// // force the renderer initialization to override theme settings |
|
97 |
// if(plot.getRenderer() instanceof IRendererWithItemSelection) { |
|
98 |
// ((IRendererWithItemSelection) plot.getRenderer()).init(); |
|
99 |
// } |
|
100 |
// } |
|
101 |
// |
|
102 |
// chart.setNotify(true); |
|
103 |
} |
|
104 |
// File |
|
105 |
else if(result.getChart() instanceof File) { |
|
106 |
// creates a new chart but using the same file |
|
107 |
this.createChartFile(result, (File)result.getChart()); |
|
108 |
|
|
109 |
// FIXME: using new file |
|
110 |
//this.createChartFile(result, preferencesNode); |
|
111 |
|
|
112 |
} |
|
113 |
} |
|
114 |
|
|
115 |
|
|
116 |
|
|
117 |
|
|
118 |
@Override |
|
119 |
public Class getChartsEngineClass() { |
|
120 |
return GSChartsEngine.class; |
|
121 |
} |
|
122 |
|
|
123 |
/** |
|
124 |
* Convenience method. |
|
125 |
* @return the casted charts engine. |
|
126 |
*/ |
|
127 |
protected GSChartsEngine getChartsEngine() { |
|
128 |
return (GSChartsEngine) this.chartsEngine; |
|
129 |
} |
|
130 |
|
|
131 |
} |
|
0 | 132 |
tmp/org.txm.chartsengine.graphstream.core/src/org/txm/chartsengine/graphstream/core/preferences/GSChartsEnginePreferences.java (revision 901) | ||
---|---|---|
1 |
package org.txm.chartsengine.graphstream.core.preferences; |
|
2 |
|
|
3 |
|
|
4 |
import org.eclipse.core.runtime.preferences.DefaultScope; |
|
5 |
import org.osgi.framework.FrameworkUtil; |
|
6 |
import org.osgi.service.prefs.Preferences; |
|
7 |
import org.txm.chartsengine.graphstream.core.GSChartsEngine; |
|
8 |
import org.txm.core.preferences.TXMPreferences; |
|
9 |
|
|
10 |
/** |
|
11 |
* Preferences initializer and manager. |
|
12 |
* |
|
13 |
* @author sjacquot |
|
14 |
* |
|
15 |
*/ |
|
16 |
public class GSChartsEnginePreferences extends TXMPreferences { |
|
17 |
|
|
18 |
|
|
19 |
public static final String PREFERENCE_NODE = FrameworkUtil.getBundle(GSChartsEnginePreferences.class).getSymbolicName(); |
|
20 |
|
|
21 |
|
|
22 |
public final static String PREFERENCES_PREFIX = GSChartsEngine.NAME + "_"; |
|
23 |
|
|
24 |
|
|
25 |
public static final String OUTPUT_FORMAT = PREFERENCES_PREFIX + "output_format"; //$NON-NLS-1$ |
|
26 |
|
|
27 |
|
|
28 |
/** |
|
29 |
* |
|
30 |
*/ |
|
31 |
public GSChartsEnginePreferences() { |
|
32 |
// TODO Auto-generated constructor stub |
|
33 |
} |
|
34 |
|
|
35 |
@Override |
|
36 |
public void initializeDefaultPreferences() { |
|
37 |
Preferences defaultPreferences = DefaultScope.INSTANCE.getNode(PREFERENCE_NODE); |
|
38 |
defaultPreferences.put(OUTPUT_FORMAT, GSChartsEngine.OUTPUT_FORMAT_GRAPHSTREAM); |
|
39 |
} |
|
40 |
|
|
41 |
} |
|
0 | 42 |
tmp/org.txm.chartsengine.graphstream.core/src/org/txm/chartsengine/graphstream/core/GSChartsEngine.java (revision 901) | ||
---|---|---|
1 |
/** |
|
2 |
* |
|
3 |
*/ |
|
4 |
package org.txm.chartsengine.graphstream.core; |
|
5 |
|
|
6 |
import java.io.File; |
|
7 |
import java.util.ArrayList; |
|
8 |
|
|
9 |
import org.eclipse.core.runtime.IProgressMonitor; |
|
10 |
import org.txm.chartsengine.core.ChartsEngine; |
|
11 |
import org.txm.chartsengine.graphstream.core.preferences.GSChartsEnginePreferences; |
|
12 |
import org.txm.core.preferences.TXMPreferences; |
|
13 |
|
|
14 |
/** |
|
15 |
* GraphStream charts engine. |
|
16 |
* @author sjacquot |
|
17 |
* |
|
18 |
*/ |
|
19 |
public class GSChartsEngine extends ChartsEngine { |
|
20 |
|
|
21 |
|
|
22 |
/** |
|
23 |
* Constants for extra output formats. |
|
24 |
*/ |
|
25 |
public final static String OUTPUT_FORMAT_GRAPHSTREAM = "GraphStream/Java2D"; //$NON-NLS-1$ |
|
26 |
|
|
27 |
|
|
28 |
/** |
|
29 |
* The charts engine internal name. |
|
30 |
*/ |
|
31 |
public final static String NAME = "graphstream_charts_engine"; //$NON-NLS-1$ |
|
32 |
|
|
33 |
/** |
|
34 |
* The charts engine description. |
|
35 |
*/ |
|
36 |
public final static String DESCRIPTION = "GraphStream/Java2D"; |
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
/** |
|
41 |
* Creates a GraphStream charts engine with output format from the preferences. |
|
42 |
*/ |
|
43 |
public GSChartsEngine() { |
|
44 |
this(TXMPreferences.getString(GSChartsEnginePreferences.OUTPUT_FORMAT, GSChartsEnginePreferences.PREFERENCE_NODE)); |
|
45 |
} |
|
46 |
|
|
47 |
|
|
48 |
/** |
|
49 |
* Creates a GraphStream charts engine with the specified output format. |
|
50 |
* @param outputFormat |
|
51 |
*/ |
|
52 |
public GSChartsEngine(String outputFormat) { |
|
53 |
super(DESCRIPTION, outputFormat); |
|
54 |
} |
|
55 |
|
|
56 |
|
|
57 |
|
|
58 |
|
|
59 |
/* (non-Javadoc) |
|
60 |
* @see org.txm.core.engines.Engine#getName() |
|
61 |
*/ |
|
62 |
@Override |
|
63 |
public String getName() { |
|
64 |
return GSChartsEngine.NAME; |
|
65 |
} |
|
66 |
|
|
67 |
/* (non-Javadoc) |
|
68 |
* @see org.txm.core.engines.Engine#getState() |
|
69 |
*/ |
|
70 |
@Override |
|
71 |
public boolean isRunning() { |
|
72 |
// TODO Auto-generated method stub |
|
73 |
return true; |
|
74 |
} |
|
75 |
|
|
76 |
/* (non-Javadoc) |
|
77 |
* @see org.txm.core.engines.Engine#start(org.eclipse.core.runtime.IProgressMonitor) |
|
78 |
*/ |
|
79 |
@Override |
|
80 |
public boolean start(IProgressMonitor monitor) throws Exception { |
|
81 |
// TODO Auto-generated method stub |
|
82 |
return true; |
|
83 |
} |
|
84 |
|
|
85 |
/* (non-Javadoc) |
|
86 |
* @see org.txm.core.engines.Engine#stop() |
|
87 |
*/ |
|
88 |
@Override |
|
89 |
public boolean stop() throws Exception { |
|
90 |
// TODO Auto-generated method stub |
|
91 |
return true; |
|
92 |
} |
|
93 |
|
|
94 |
/* (non-Javadoc) |
|
95 |
* @see org.txm.chartsengine.core.ChartsEngine#createChartFile(java.lang.Object, java.io.File) |
|
96 |
*/ |
|
97 |
@Override |
|
98 |
public File createChartFile(Object chart, File file) { |
|
99 |
// TODO Auto-generated method stub |
|
100 |
return null; |
|
101 |
} |
|
102 |
|
|
103 |
/* (non-Javadoc) |
|
104 |
* @see org.txm.chartsengine.core.ChartsEngine#exportChart(java.lang.Object, java.io.File, java.lang.String, int, int, int, int, int, int) |
|
105 |
*/ |
|
106 |
@Override |
|
107 |
public File exportChart(Object chart, File file, String outputFormat, int imageWidth, int imageHeight, int drawingAreaX, int drawingAreaY, int drawingAreaWidth, int drawingAreaHeight) { |
|
108 |
// TODO Auto-generated method stub |
|
109 |
return null; |
|
110 |
} |
|
111 |
|
|
112 |
|
|
113 |
@Override |
|
114 |
public ArrayList<String> getSupportedOutputDisplayFormats() { |
|
115 |
ArrayList<String> formats = new ArrayList<String>(1); |
|
116 |
|
|
117 |
formats.add(OUTPUT_FORMAT_GRAPHSTREAM); |
|
118 |
|
|
119 |
return formats; |
|
120 |
} |
|
121 |
|
|
122 |
|
|
123 |
@Override |
|
124 |
public ArrayList<String> getSupportedOutputFileFormats() { |
|
125 |
ArrayList<String> formats = new ArrayList<String>(1); |
|
126 |
return formats; |
|
127 |
|
|
128 |
} |
|
129 |
|
|
130 |
} |
|
0 | 131 |
tmp/org.txm.chartsengine.graphstream.core/build.properties (revision 901) | ||
---|---|---|
1 |
source.. = src/ |
|
2 |
output.. = bin/ |
|
3 |
bin.includes = META-INF/,\ |
|
4 |
.,\ |
|
5 |
plugin.xml |
|
0 | 6 |
tmp/org.txm.chartsengine.graphstream.core/plugin.xml (revision 901) | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<?eclipse version="3.4"?> |
|
3 |
<plugin> |
|
4 |
<extension |
|
5 |
point="org.txm.chartsengine.chartsengine"> |
|
6 |
<ChartsEngine |
|
7 |
class="org.txm.chartsengine.graphstream.core.GSChartsEngine" |
|
8 |
description="GraphStream" |
|
9 |
name="graphstream_charts_engine"> |
|
10 |
</ChartsEngine> |
|
11 |
</extension> |
|
12 |
<extension |
|
13 |
point="org.eclipse.core.runtime.preferences"> |
|
14 |
<initializer |
|
15 |
class="org.txm.chartsengine.graphstream.core.preferences.GSChartsEnginePreferences"> |
|
16 |
</initializer> |
|
17 |
</extension> |
|
18 |
</plugin> |
|
0 | 19 |
tmp/org.txm.chartsengine.graphstream.core/.settings/org.eclipse.jdt.core.prefs (revision 901) | ||
---|---|---|
1 |
eclipse.preferences.version=1 |
|
2 |
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled |
|
3 |
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 |
|
4 |
org.eclipse.jdt.core.compiler.compliance=1.7 |
|
5 |
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error |
|
6 |
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error |
|
7 |
org.eclipse.jdt.core.compiler.source=1.7 |
|
0 | 8 |
tmp/org.txm.chartsengine.graphstream.core/.classpath (revision 901) | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<classpath> |
|
3 |
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/> |
|
4 |
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"> |
|
5 |
<accessrules> |
|
6 |
<accessrule kind="accessible" pattern="**"/> |
|
7 |
</accessrules> |
|
8 |
</classpathentry> |
|
9 |
<classpathentry kind="src" path="src"/> |
|
10 |
<classpathentry kind="output" path="bin"/> |
|
11 |
</classpath> |
|
0 | 12 |
tmp/org.txm.chartsengine.graphstream.core/META-INF/MANIFEST.MF (revision 901) | ||
---|---|---|
1 |
Manifest-Version: 1.0 |
|
2 |
Bundle-ManifestVersion: 2 |
|
3 |
Bundle-Name: GraphStream Charts Engine Core |
|
4 |
Bundle-SymbolicName: org.txm.chartsengine.graphstream.core;singleton:=true |
|
5 |
Bundle-Version: 1.0.0.qualifier |
|
6 |
Bundle-Vendor: Textometrie.org |
|
7 |
Bundle-RequiredExecutionEnvironment: JavaSE-1.7 |
|
8 |
Require-Bundle: org.txm.libs.graphstream;bundle-version="1.3.0";visibility:=reexport, |
|
9 |
org.eclipse.core.runtime;visibility:=reexport, |
|
10 |
org.txm.chartsengine.core;bundle-version="1.0.0";visibility:=reexport, |
|
11 |
org.txm.core;visibility:=reexport |
|
12 |
Export-Package: org.txm.chartsengine.graphstream.core, |
|
13 |
org.txm.chartsengine.graphstream.core.preferences |
|
0 | 14 |
tmp/org.txm.chartsengine.graphstream.core/.project (revision 901) | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<projectDescription> |
|
3 |
<name>org.txm.chartsengine.graphstream.core</name> |
|
4 |
<comment></comment> |
|
5 |
<projects> |
|
6 |
</projects> |
|
7 |
<buildSpec> |
|
8 |
<buildCommand> |
|
9 |
<name>org.eclipse.jdt.core.javabuilder</name> |
|
10 |
<arguments> |
|
11 |
</arguments> |
|
12 |
</buildCommand> |
|
13 |
<buildCommand> |
|
14 |
<name>org.eclipse.pde.ManifestBuilder</name> |
|
15 |
<arguments> |
|
16 |
</arguments> |
|
17 |
</buildCommand> |
|
18 |
<buildCommand> |
|
19 |
<name>org.eclipse.pde.SchemaBuilder</name> |
|
20 |
<arguments> |
|
21 |
</arguments> |
|
22 |
</buildCommand> |
|
23 |
</buildSpec> |
|
24 |
<natures> |
|
25 |
<nature>org.eclipse.pde.PluginNature</nature> |
|
26 |
<nature>org.eclipse.jdt.core.javanature</nature> |
|
27 |
</natures> |
|
28 |
</projectDescription> |
|
0 | 29 |
Formats disponibles : Unified diff