Revision 903
org.gvsig.chart/tags/org.gvsig.chart-1.0.167/org.gvsig.chart.app/org.gvsig.chart.app.legendplugin/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
3 |
<modelVersion>4.0.0</modelVersion> |
|
4 |
<packaging>jar</packaging> |
|
5 |
<artifactId>org.gvsig.chart.app.legendplugin</artifactId> |
|
6 |
<name>${project.artifactId}</name> |
|
7 |
<description> |
|
8 |
This package adds to the view chart legend. |
|
9 |
</description> |
|
10 |
|
|
11 |
<parent> |
|
12 |
<groupId>org.gvsig</groupId> |
|
13 |
<artifactId>org.gvsig.chart.app</artifactId> |
|
14 |
<version>1.0.167</version> |
|
15 |
</parent> |
|
16 |
|
|
17 |
<dependencies> |
|
18 |
<dependency> |
|
19 |
<groupId>org.gvsig</groupId> |
|
20 |
<artifactId>org.gvsig.utils</artifactId> |
|
21 |
<scope>compile</scope> |
|
22 |
</dependency> |
|
23 |
<dependency> |
|
24 |
<groupId>org.gvsig</groupId> |
|
25 |
<artifactId>org.gvsig.fmap.mapcontext.api</artifactId> |
|
26 |
<scope>compile</scope> |
|
27 |
</dependency> |
|
28 |
<dependency> |
|
29 |
<groupId>org.gvsig</groupId> |
|
30 |
<artifactId>org.gvsig.symbology.lib.api</artifactId> |
|
31 |
<scope>compile</scope> |
|
32 |
</dependency> |
|
33 |
<dependency> |
|
34 |
<groupId>org.gvsig</groupId> |
|
35 |
<artifactId>org.gvsig.projection.api</artifactId> |
|
36 |
<scope>compile</scope> |
|
37 |
</dependency> |
|
38 |
<dependency> |
|
39 |
<groupId>org.gvsig</groupId> |
|
40 |
<artifactId>org.gvsig.app.mainplugin</artifactId> |
|
41 |
<scope>compile</scope> |
|
42 |
</dependency> |
|
43 |
<dependency> |
|
44 |
<groupId>org.gvsig</groupId> |
|
45 |
<artifactId>org.gvsig.compat.api</artifactId> |
|
46 |
<scope>compile</scope> |
|
47 |
</dependency> |
|
48 |
<dependency> |
|
49 |
<groupId>org.gvsig</groupId> |
|
50 |
<artifactId>org.gvsig.ui</artifactId> |
|
51 |
<scope>compile</scope> |
|
52 |
</dependency> |
|
53 |
<dependency> |
|
54 |
<groupId>org.gvsig</groupId> |
|
55 |
<artifactId>org.gvsig.app.document.table.app.mainplugin</artifactId> |
|
56 |
<scope>compile</scope> |
|
57 |
</dependency> |
|
58 |
<dependency> |
|
59 |
<groupId>org.gvsig</groupId> |
|
60 |
<artifactId>org.gvsig.chart.lib.api</artifactId> |
|
61 |
<scope>compile</scope> |
|
62 |
</dependency> |
|
63 |
<dependency> |
|
64 |
<groupId>org.gvsig</groupId> |
|
65 |
<artifactId>org.gvsig.chart.swing.api</artifactId> |
|
66 |
<scope>compile</scope> |
|
67 |
</dependency> |
|
68 |
<dependency> |
|
69 |
<groupId>org.gvsig</groupId> |
|
70 |
<artifactId>org.gvsig.chart.lib.impl</artifactId> |
|
71 |
<scope>runtime</scope> |
|
72 |
</dependency> |
|
73 |
<dependency> |
|
74 |
<groupId>org.gvsig</groupId> |
|
75 |
<artifactId>org.gvsig.chart.lib.base</artifactId> |
|
76 |
<scope>runtime</scope> |
|
77 |
</dependency> |
|
78 |
<dependency> |
|
79 |
<groupId>org.gvsig</groupId> |
|
80 |
<artifactId>org.gvsig.chart.swing.impl</artifactId> |
|
81 |
<scope>runtime</scope> |
|
82 |
</dependency> |
|
83 |
<dependency> |
|
84 |
<groupId>org.gvsig</groupId> |
|
85 |
<artifactId>org.gvsig.chart.swing.base</artifactId> |
|
86 |
<scope>runtime</scope> |
|
87 |
</dependency> |
|
88 |
<dependency> |
|
89 |
<groupId>org.gvsig</groupId> |
|
90 |
<artifactId>org.gvsig.symbology.swing.api</artifactId> |
|
91 |
<scope>compile</scope> |
|
92 |
</dependency> |
|
93 |
<dependency> |
|
94 |
<groupId>org.gvsig</groupId> |
|
95 |
<artifactId>org.gvsig.chart.app.mainplugin</artifactId> |
|
96 |
<scope>compile</scope> |
|
97 |
</dependency> |
|
98 |
|
|
99 |
</dependencies> |
|
100 |
|
|
101 |
<properties> |
|
102 |
<!-- Package info property values --> |
|
103 |
<!-- Default values in org.gvsig.desktop --> |
|
104 |
<gvsig.package.info.state>testing</gvsig.package.info.state> |
|
105 |
<gvsig.package.info.official>true</gvsig.package.info.official> |
|
106 |
<gvsig.package.info.name>Vector legend: Chart</gvsig.package.info.name> |
|
107 |
<gvsig.package.info.dependencies>required: org.gvsig.app.mainplugin -ge 2.1.0-A, required: org.gvsig.chart.app.mainplugin -ge 1.0.0-A</gvsig.package.info.dependencies> |
|
108 |
<gvsig.package.info.categories>View, Vector, Symbology, Chart</gvsig.package.info.categories> |
|
109 |
<gvsig.package.info.poolURL>https://devel.gvsig.org/download/projects/gvsig-chart/pool/</gvsig.package.info.poolURL> |
|
110 |
</properties> |
|
111 |
|
|
112 |
</project> |
|
0 | 113 |
org.gvsig.chart/tags/org.gvsig.chart-1.0.167/org.gvsig.chart.app/org.gvsig.chart.app.legendplugin/buildNumber.properties | ||
---|---|---|
1 |
#Tue Feb 01 03:42:02 CET 2022 |
|
2 |
buildNumber=181 |
|
0 | 3 |
org.gvsig.chart/tags/org.gvsig.chart-1.0.167/org.gvsig.chart.app/org.gvsig.chart.app.legendplugin/src/main/resources-plugin/i18n/text.properties | ||
---|---|---|
1 |
#Translations for language [es] |
|
2 |
#Tue May 12 10:57:39 CEST 2009 |
|
3 |
Chart_preview=Previsualizaci\u00f3n del gr\u00e1fico |
|
4 |
Advanced_configurations=Configuraci\u00f3n avanzada |
|
5 |
Chart_variables=Variables del gr\u00e1fico |
|
6 |
Visible=\u00bfEs visible? |
|
7 |
Chart_Name=Nombre de la variable |
|
8 |
Chart_Type=Tipo de gr\u00e1fico |
|
9 |
Render_type=Tipo de renderer |
|
10 |
Table_name=Tabla origen de datos |
|
11 |
Type_Chart=Tipo de gr\u00e1fico |
|
12 |
Data_Chart=Origen de datos |
|
13 |
Format_Chart=Formato del gr\u00e1fico |
|
14 |
Cancel=Cancelar |
|
15 |
accept=Aceptar |
|
16 |
Data_origin=Elegir fuente de datos |
|
17 |
Table=Tabla |
|
18 |
Chart_Data_Definition=Campos de datos del gr\u00e1fico |
|
19 |
use_selected_rows=Usar s\u00f3lo campos seleccionados |
|
20 |
Edit_Series_Values=Editar valores de campos |
|
21 |
Symbol=S\u00edmbolo |
|
22 |
Series_name=Nombre de la serie |
|
23 |
Format_configurations=Configuraci\u00f3n |
|
24 |
Series=Series |
|
25 |
Chart_Area=\u00c1rea del gr\u00e1fico |
|
26 |
Plot_Area=\u00c1rea de datos |
|
27 |
Axis=Ejes |
|
28 |
Plot=Gr\u00e1fico |
|
29 |
Legend=Leyenda |
|
30 |
Title=T\u00edtulo |
|
31 |
Chart_Title=T\u00edtulo del gr\u00e1fico |
|
32 |
|
|
33 |
Default=Por defecto |
|
34 |
Category=Categorizado |
|
35 |
Numerical=Num\u00e9rico |
|
36 |
|
|
37 |
Name=Nombre |
|
38 |
Units=Unidades |
|
39 |
Description=Descripci\u00f3n |
|
40 |
Chart_Renderer_types=Tipos de renderer |
|
41 |
Drawing_options=Opciones de pintado |
|
42 |
Dimension= Dimensi\u00f3n: |
|
43 |
Output_Format=Formato salida: |
|
44 |
Domain_Axis_type=Eje de dominio: |
|
45 |
Series_Type=Tipo de series: |
|
46 |
Orientation=Orientaci\u00f3n |
|
47 |
Flip_Axis=Invertir ejes |
|
48 |
legend=leyenda |
|
49 |
tooltip=tooltip |
|
50 |
urls=urls |
|
51 |
|
|
52 |
Axis_Panel=Ejes |
|
53 |
alpha=Alfa |
|
54 |
Chart_Visibility=Visibilidad del gr\u00e1fico |
|
55 |
Hide_chart_if_no_data=Ocultar el gr\u00e1fico si no hay datos |
|
56 |
Show_message=Mostrar el gr\u00e1fico vac\u00edo con el mensaje siguiente: |
|
57 |
Text=Texto |
|
58 |
Font=Fuente |
|
59 |
Type=Tipo: |
|
60 |
Format=Formato |
|
61 |
Labels=Etiquetas |
|
62 |
Outline=Contorno: |
|
63 |
|
|
64 |
Is_category_Axis=Eje de categorias |
|
65 |
Combine_axis=Combinar con otro eje |
|
66 |
|
|
67 |
LEFT=IZQUIERDA |
|
68 |
RIGHT=DERECHA |
|
69 |
CENTER=CENTRO |
|
70 |
TOP=ARRIBA |
|
71 |
BOTTOM=ABAJO |
|
72 |
|
|
73 |
Previous=Anterior |
|
74 |
Next=Siguiente |
|
75 |
Accept=Aceptar |
|
76 |
|
|
77 |
Legend_visible=Leyenda visible |
|
78 |
Legend_position=Posici\u00f3n |
|
79 |
Choose_Font_Color=Color de la fuente |
|
80 |
Use_default=Por defecto |
|
81 |
Coordinates=Coordenadas |
|
82 |
(pixels)=(p\u00edxeles) |
|
83 |
|
|
84 |
Default_size=Tama\u00f1o por defecto |
|
85 |
Width=Ancho: |
|
86 |
Height=Alto: |
|
87 |
|
|
88 |
Pick_Color=Elige un color... |
|
89 |
propiedades_grafico=Propiedades del Gr\u00e1fico |
|
90 |
General_options=Opciones generales |
|
91 |
Add_new_variable=A\u00f1ade nueva variable |
|
92 |
Edit_a_variable=Edita una variable |
|
93 |
|
|
94 |
bar_legend=Barras |
|
95 |
pie_legend=Tartas |
|
96 |
|
|
97 |
configure_size=Configurar tama\u00f1o de los s\u00edmbolos |
|
98 |
fixed_size=Tama\u00f1o fijo |
|
99 |
sum_field_values_size=Tama\u00f1o variable de la suma de los valores representados |
|
100 |
field_size=Tama\u00f1o por campo |
|
101 |
normalize=normalizado por |
|
102 |
limits=L\u00edmites |
|
103 |
active_limits=Activar l\u00edmites |
|
104 |
show_axis=Mostrar ejes del gr\u00e1fico |
|
0 | 105 |
org.gvsig.chart/tags/org.gvsig.chart-1.0.167/org.gvsig.chart.app/org.gvsig.chart.app.legendplugin/src/main/resources-plugin/i18n/text_en.properties | ||
---|---|---|
1 |
#Translations for language [en] |
|
2 |
#Tue May 12 10:57:38 CEST 2009 |
|
3 |
Chart_preview=Chart preview |
|
4 |
Advanced_configurations=Advanced configuration |
|
5 |
Chart_variables=Chart variables |
|
6 |
Visible=Is visible? |
|
7 |
Chart_Name=Variable name |
|
8 |
Chart_Type=Chart type |
|
9 |
Render_type=Renderer type |
|
10 |
Table_name=Data Table name |
|
11 |
Previous=Previous |
|
12 |
Next=Next |
|
13 |
Accept=Accept |
|
14 |
show_axis=Show chart axis |
|
0 | 15 |
org.gvsig.chart/tags/org.gvsig.chart-1.0.167/org.gvsig.chart.app/org.gvsig.chart.app.legendplugin/src/main/resources-plugin/config.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<plugin-config> |
|
3 |
<depends plugin-name="org.gvsig.app.mainplugin" /> |
|
4 |
<depends plugin-name="org.gvsig.chart.app.mainplugin" /> |
|
5 |
<depends plugin-name="org.gvsig.app.document.table.app.mainplugin" /> |
|
6 |
<resourceBundle name="text"/> |
|
7 |
<libraries library-dir="lib"/> |
|
8 |
<extensions> |
|
9 |
<extension class-name="org.gvsig.app.chart.legendplugin.ChartLegendExtension" |
|
10 |
description="" |
|
11 |
active="true" |
|
12 |
priority="1"> |
|
13 |
</extension> |
|
14 |
</extensions> |
|
15 |
</plugin-config> |
|
0 | 16 |
org.gvsig.chart/tags/org.gvsig.chart-1.0.167/org.gvsig.chart.app/org.gvsig.chart.app.legendplugin/src/main/assembly/gvsig-plugin-package.xml | ||
---|---|---|
1 |
<assembly> |
|
2 |
<id>gvsig-plugin-package</id> |
|
3 |
<formats> |
|
4 |
<format>zip</format> |
|
5 |
</formats> |
|
6 |
<baseDirectory>${project.artifactId}</baseDirectory> |
|
7 |
<includeBaseDirectory>true</includeBaseDirectory> |
|
8 |
<files> |
|
9 |
<file> |
|
10 |
<source>target/${project.artifactId}-${project.version}.jar</source> |
|
11 |
<outputDirectory>lib</outputDirectory> |
|
12 |
</file> |
|
13 |
<file> |
|
14 |
<source>target/package.info</source> |
|
15 |
</file> |
|
16 |
</files> |
|
17 |
|
|
18 |
<fileSets> |
|
19 |
<fileSet> |
|
20 |
<directory>src/main/resources-plugin</directory> |
|
21 |
<outputDirectory>.</outputDirectory> |
|
22 |
</fileSet> |
|
23 |
</fileSets> |
|
24 |
|
|
25 |
<dependencySets> |
|
26 |
|
|
27 |
</dependencySets> |
|
28 |
|
|
29 |
</assembly> |
|
0 | 30 |
org.gvsig.chart/tags/org.gvsig.chart-1.0.167/org.gvsig.chart.app/org.gvsig.chart.app.legendplugin/src/main/java/org/gvsig/project/documents/view/legend/PieChartLegend.java | ||
---|---|---|
1 |
package org.gvsig.project.documents.view.legend; |
|
2 |
|
|
3 |
import java.awt.Color; |
|
4 |
import org.gvsig.chart.legend.IChartLegend; |
|
5 |
import org.gvsig.chart.legend.IPieChartLegend; |
|
6 |
import org.gvsig.chart.legend.symbols.IChartSymbol; |
|
7 |
import org.gvsig.fmap.dal.feature.FeatureSelection; |
|
8 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
|
9 |
import org.gvsig.fmap.mapcontext.MapContextManager; |
|
10 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
|
11 |
import static org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.VectorialUniqueValueLegend.VECTORIAL_UNIQUE_VALUE_LEGEND_PERSISTENCE_DEFINITION_NAME; |
|
12 |
import org.gvsig.tools.ToolsLocator; |
|
13 |
import org.gvsig.tools.dynobject.DynStruct; |
|
14 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
15 |
import org.gvsig.tools.persistence.PersistentState; |
|
16 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
|
17 |
import org.gvsig.tools.util.Callable; |
|
18 |
|
|
19 |
/** |
|
20 |
* @author Fjp |
|
21 |
* |
|
22 |
* TODO: CAMBIAR EL NOMBRE DE ESTA LEYENDA A CHARTLEGEND, PORQUE EN REALIDAD |
|
23 |
* ESTA SE USA PARA TODO TIPO DE CHARTS. (BarsChartLegend no se usa, borrarla) |
|
24 |
*/ |
|
25 |
public final class PieChartLegend extends BasePieChartLegend implements IPieChartLegend { |
|
26 |
|
|
27 |
public static class RegisterLegend implements Callable { |
|
28 |
|
|
29 |
@Override |
|
30 |
public Object call() throws Exception { |
|
31 |
MapContextManager manager = MapContextLocator.getMapContextManager(); |
|
32 |
|
|
33 |
manager.registerLegend(IChartLegend.PIECHART_LEGEND_NAME, |
|
34 |
PieChartLegend.class); |
|
35 |
|
|
36 |
return Boolean.TRUE; |
|
37 |
} |
|
38 |
|
|
39 |
} |
|
40 |
|
|
41 |
public static final String PIE_CHART_LEGEND_PERSISTENCE_DEFINITION_NAME = "PieChartLegend"; |
|
42 |
|
|
43 |
private static final String FIELD_NAMES = "FieldLegendNames"; |
|
44 |
private static final String FIELD_LABEL_NAMES = "FieldLabelNames"; |
|
45 |
private static final String FIELD_LABEL_COLOR = "FieldLabelColor"; |
|
46 |
|
|
47 |
public PieChartLegend() { |
|
48 |
super(); |
|
49 |
} |
|
50 |
|
|
51 |
public PieChartLegend(int shapeType) { |
|
52 |
super(shapeType); |
|
53 |
} |
|
54 |
|
|
55 |
@Override |
|
56 |
public void loadFromState(PersistentState state) throws PersistenceException { |
|
57 |
// Set parent properties |
|
58 |
super.loadFromState(state); |
|
59 |
|
|
60 |
} |
|
61 |
|
|
62 |
@Override |
|
63 |
public void saveToState(PersistentState state) throws PersistenceException { |
|
64 |
// Save parent properties |
|
65 |
super.saveToState(state); |
|
66 |
} |
|
67 |
|
|
68 |
public static class RegisterPersistence implements Callable { |
|
69 |
|
|
70 |
@Override |
|
71 |
public Object call() throws Exception { |
|
72 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
|
73 |
if (manager.getDefinition(PIE_CHART_LEGEND_PERSISTENCE_DEFINITION_NAME) == null) { |
|
74 |
DynStruct definition = manager.addDefinition( |
|
75 |
PieChartLegend.class, |
|
76 |
PIE_CHART_LEGEND_PERSISTENCE_DEFINITION_NAME, |
|
77 |
PIE_CHART_LEGEND_PERSISTENCE_DEFINITION_NAME + " Persistence definition", |
|
78 |
null, |
|
79 |
null |
|
80 |
); |
|
81 |
// Extend the Classified Vector Legend base definition |
|
82 |
definition.extend(manager.getDefinition(VECTORIAL_UNIQUE_VALUE_LEGEND_PERSISTENCE_DEFINITION_NAME)); |
|
83 |
|
|
84 |
// Field names |
|
85 |
definition.addDynFieldArray(FIELD_NAMES) |
|
86 |
.setClassOfItems(String.class); |
|
87 |
definition.addDynFieldArray(FIELD_LABEL_NAMES) |
|
88 |
.setClassOfItems(String.class); |
|
89 |
definition.addDynFieldArray(FIELD_LABEL_COLOR) |
|
90 |
.setClassOfItems(Color.class); |
|
91 |
|
|
92 |
definition.addDynField("backgroundSymbol").setClassOfValue(ISymbol.class); |
|
93 |
definition.addDynFieldInt("size"); |
|
94 |
definition.addDynFieldBoolean("is3D"); |
|
95 |
|
|
96 |
definition.addDynFieldBoolean("isOutlineShow"); |
|
97 |
definition.addDynFieldBoolean("onlySelection"); |
|
98 |
definition.addDynFieldBoolean("isActiveLimits"); |
|
99 |
|
|
100 |
definition.addDynFieldInt("outlineWidth"); |
|
101 |
definition.addDynFieldInt("referenceSystem"); |
|
102 |
definition.addDynFieldInt("sizeFrom"); |
|
103 |
definition.addDynFieldInt("sizeTo"); |
|
104 |
definition.addDynFieldInt("unit"); |
|
105 |
definition.addDynFieldInt("sizeOption"); |
|
106 |
|
|
107 |
definition.addDynFieldObject("outlineColor").setClassOfValue(Color.class); |
|
108 |
definition.addDynFieldObject("symbol").setClassOfValue(IChartSymbol.class); |
|
109 |
definition.addDynFieldObject("featSelection").setClassOfValue(FeatureSelection.class); |
|
110 |
|
|
111 |
definition.addDynFieldString("fieldSize"); |
|
112 |
definition.addDynFieldString("fieldNormalize"); |
|
113 |
|
|
114 |
definition.addDynFieldDouble("minFeature"); |
|
115 |
definition.addDynFieldDouble("maxFeature"); |
|
116 |
definition.addDynFieldDouble("maxField"); |
|
117 |
} |
|
118 |
return Boolean.TRUE; |
|
119 |
} |
|
120 |
|
|
121 |
} |
|
122 |
|
|
123 |
} |
|
0 | 124 |
org.gvsig.chart/tags/org.gvsig.chart-1.0.167/org.gvsig.chart.app/org.gvsig.chart.app.legendplugin/src/main/java/org/gvsig/project/documents/view/legend/gui/ColorCellEditor.java | ||
---|---|---|
1 |
package org.gvsig.project.documents.view.legend.gui; |
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
import java.awt.Color; |
|
6 |
import java.awt.Component; |
|
7 |
import java.awt.event.KeyAdapter; |
|
8 |
import java.awt.event.KeyEvent; |
|
9 |
import java.awt.event.MouseEvent; |
|
10 |
import java.awt.event.MouseListener; |
|
11 |
import java.util.ArrayList; |
|
12 |
import java.util.EventObject; |
|
13 |
|
|
14 |
import javax.swing.JButton; |
|
15 |
import javax.swing.JColorChooser; |
|
16 |
import javax.swing.JPanel; |
|
17 |
import javax.swing.JTable; |
|
18 |
import javax.swing.SwingUtilities; |
|
19 |
import javax.swing.event.CellEditorListener; |
|
20 |
import javax.swing.event.ChangeEvent; |
|
21 |
import javax.swing.table.TableCellEditor; |
|
22 |
|
|
23 |
import org.gvsig.andami.PluginServices; |
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
/** |
|
29 |
* Cell Editor de ISymbols. Controla los eventos de edici?n que se realicen |
|
30 |
* sobre la columna de s?mbolos. |
|
31 |
* |
|
32 |
* @author Vicente Caballero Navarro |
|
33 |
*/ |
|
34 |
public class ColorCellEditor extends JButton implements TableCellEditor { |
|
35 |
private ArrayList listeners = new ArrayList(); |
|
36 |
private java.awt.Color color; |
|
37 |
// private ColorButtonDialog colorChooser=new ColorButtonDialog(); |
|
38 |
private ColorChange colorChange; |
|
39 |
|
|
40 |
public ColorCellEditor() { |
|
41 |
addMouseListener(new MouseListener(){ |
|
42 |
|
|
43 |
public void mouseClicked(MouseEvent e) { |
|
44 |
if (e.getClickCount()==2){ |
|
45 |
Color newColor = JColorChooser.showDialog(SwingUtilities.windowForComponent( |
|
46 |
(Component)PluginServices.getMainFrame()), PluginServices.getText(this,"choose_color"), color); |
|
47 |
|
|
48 |
if (newColor == null) { |
|
49 |
return; |
|
50 |
} |
|
51 |
|
|
52 |
color=newColor; |
|
53 |
stopCellEditing(); |
|
54 |
colorChange.actionChange(); |
|
55 |
} |
|
56 |
} |
|
57 |
|
|
58 |
public void mouseEntered(MouseEvent e) { |
|
59 |
} |
|
60 |
|
|
61 |
public void mouseExited(MouseEvent e) { |
|
62 |
} |
|
63 |
|
|
64 |
public void mousePressed(MouseEvent e) { |
|
65 |
} |
|
66 |
|
|
67 |
public void mouseReleased(MouseEvent e) { |
|
68 |
} |
|
69 |
|
|
70 |
}); |
|
71 |
addKeyListener(new KeyAdapter() { |
|
72 |
public void keyReleased(KeyEvent e) { |
|
73 |
if (e.getKeyCode() == KeyEvent.VK_ENTER) { |
|
74 |
stopCellEditing(); |
|
75 |
} else if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { |
|
76 |
cancelCellEditing(); |
|
77 |
} |
|
78 |
} |
|
79 |
}); |
|
80 |
} |
|
81 |
|
|
82 |
|
|
83 |
//Implement the one CellEditor method that AbstractCellEditor doesn't. |
|
84 |
public Object getCellEditorValue() { |
|
85 |
return color; |
|
86 |
} |
|
87 |
|
|
88 |
//Implement the one method defined by TableCellEditor. |
|
89 |
public Component getTableCellEditorComponent(JTable table, Object value, |
|
90 |
boolean isSelected, int row, int column) { |
|
91 |
color = ((JPanel) value).getBackground(); |
|
92 |
return this; |
|
93 |
} |
|
94 |
|
|
95 |
/** |
|
96 |
* DOCUMENT ME! |
|
97 |
*/ |
|
98 |
public void cancelCellEditing() { |
|
99 |
if (color != null) { |
|
100 |
} |
|
101 |
|
|
102 |
for (int i = 0; i < listeners.size(); i++) { |
|
103 |
CellEditorListener l = (CellEditorListener) listeners.get(i); |
|
104 |
ChangeEvent evt = new ChangeEvent(this); |
|
105 |
l.editingCanceled(evt); |
|
106 |
} |
|
107 |
} |
|
108 |
|
|
109 |
/** |
|
110 |
* DOCUMENT ME! |
|
111 |
* |
|
112 |
* @return DOCUMENT ME! |
|
113 |
*/ |
|
114 |
public boolean stopCellEditing() { |
|
115 |
for (int i = 0; i < listeners.size(); i++) { |
|
116 |
CellEditorListener l = (CellEditorListener) listeners.get(i); |
|
117 |
ChangeEvent evt = new ChangeEvent(this); |
|
118 |
l.editingStopped(evt); |
|
119 |
} |
|
120 |
|
|
121 |
return true; |
|
122 |
} |
|
123 |
|
|
124 |
/** |
|
125 |
* DOCUMENT ME! |
|
126 |
* |
|
127 |
* @param anEvent DOCUMENT ME! |
|
128 |
* |
|
129 |
* @return DOCUMENT ME! |
|
130 |
*/ |
|
131 |
public boolean isCellEditable(EventObject anEvent) { |
|
132 |
return true; |
|
133 |
} |
|
134 |
|
|
135 |
/** |
|
136 |
* DOCUMENT ME! |
|
137 |
* |
|
138 |
* @param anEvent DOCUMENT ME! |
|
139 |
* |
|
140 |
* @return DOCUMENT ME! |
|
141 |
*/ |
|
142 |
public boolean shouldSelectCell(EventObject anEvent) { |
|
143 |
return true; |
|
144 |
} |
|
145 |
|
|
146 |
/** |
|
147 |
* DOCUMENT ME! |
|
148 |
* |
|
149 |
* @param l DOCUMENT ME! |
|
150 |
*/ |
|
151 |
public void addCellEditorListener(CellEditorListener l) { |
|
152 |
listeners.add(l); |
|
153 |
} |
|
154 |
|
|
155 |
/** |
|
156 |
* DOCUMENT ME! |
|
157 |
* |
|
158 |
* @param l DOCUMENT ME! |
|
159 |
*/ |
|
160 |
public void removeCellEditorListener(CellEditorListener l) { |
|
161 |
listeners.remove(l); |
|
162 |
} |
|
163 |
|
|
164 |
|
|
165 |
public void addColorChange(ColorChange colorChange) { |
|
166 |
this.colorChange=colorChange; |
|
167 |
} |
|
168 |
} |
|
0 | 169 |
org.gvsig.chart/tags/org.gvsig.chart-1.0.167/org.gvsig.chart.app/org.gvsig.chart.app.legendplugin/src/main/java/org/gvsig/project/documents/view/legend/gui/ChartLinkedLegendPanel.java | ||
---|---|---|
1 |
package org.gvsig.project.documents.view.legend.gui; |
|
2 |
|
|
3 |
import java.awt.BorderLayout; |
|
4 |
import java.awt.Color; |
|
5 |
import java.awt.Component; |
|
6 |
import java.awt.Dimension; |
|
7 |
import java.awt.FlowLayout; |
|
8 |
import java.awt.Font; |
|
9 |
import java.awt.event.ActionEvent; |
|
10 |
import java.awt.event.ActionListener; |
|
11 |
import java.sql.Types; |
|
12 |
import java.util.ArrayList; |
|
13 |
import java.util.Iterator; |
|
14 |
import java.util.List; |
|
15 |
import java.util.Properties; |
|
16 |
import java.util.Random; |
|
17 |
|
|
18 |
import javax.swing.BorderFactory; |
|
19 |
import javax.swing.ButtonGroup; |
|
20 |
import javax.swing.DefaultComboBoxModel; |
|
21 |
import javax.swing.DefaultListModel; |
|
22 |
import javax.swing.ImageIcon; |
|
23 |
import javax.swing.JButton; |
|
24 |
import javax.swing.JCheckBox; |
|
25 |
import javax.swing.JComboBox; |
|
26 |
import javax.swing.JLabel; |
|
27 |
import javax.swing.JList; |
|
28 |
import javax.swing.JOptionPane; |
|
29 |
import javax.swing.JPanel; |
|
30 |
import javax.swing.JRadioButton; |
|
31 |
import javax.swing.JScrollPane; |
|
32 |
import javax.swing.JTextField; |
|
33 |
import javax.swing.border.TitledBorder; |
|
34 |
import javax.swing.event.ChangeEvent; |
|
35 |
import javax.swing.event.ChangeListener; |
|
36 |
|
|
37 |
import org.apache.commons.lang3.StringUtils; |
|
38 |
|
|
39 |
import org.gvsig.andami.IconThemeHelper; |
|
40 |
import org.gvsig.andami.PluginServices; |
|
41 |
import org.gvsig.andami.messages.NotificationManager; |
|
42 |
import org.gvsig.app.ApplicationLocator; |
|
43 |
import org.gvsig.app.ApplicationManager; |
|
44 |
import org.gvsig.app.gui.panels.ColorChooserPanel; |
|
45 |
import org.gvsig.app.gui.styling.JComboBoxColorScheme; |
|
46 |
import org.gvsig.app.project.Project; |
|
47 |
import org.gvsig.app.project.ProjectManager; |
|
48 |
import org.gvsig.app.project.documents.Document; |
|
49 |
import org.gvsig.app.project.documents.table.TableDocument; |
|
50 |
import org.gvsig.app.project.documents.table.TableManager; |
|
51 |
import org.gvsig.app.project.documents.view.legend.gui.ILegendPanel; |
|
52 |
import org.gvsig.app.project.documents.view.legend.gui.JSymbolPreviewButton; |
|
53 |
import org.gvsig.app.project.documents.view.legend.gui.MultipleAttributes; |
|
54 |
import org.gvsig.chart.ChartLocator; |
|
55 |
import org.gvsig.chart.ChartManager; |
|
56 |
import org.gvsig.chart.ChartProperties; |
|
57 |
import org.gvsig.chart.ChartService; |
|
58 |
import org.gvsig.chart.legend.IBarsChartLegend; |
|
59 |
import org.gvsig.chart.legend.IChartLegend; |
|
60 |
import org.gvsig.chart.legend.ILinkedChartLegend; |
|
61 |
import org.gvsig.chart.legend.symbols.IChartSymbol; |
|
62 |
import org.gvsig.fmap.dal.exception.DataException; |
|
63 |
import org.gvsig.fmap.dal.exception.ReadException; |
|
64 |
import org.gvsig.fmap.dal.feature.Feature; |
|
65 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
66 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
|
67 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
68 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
69 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
|
70 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
71 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
|
72 |
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend; |
|
73 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
|
74 |
import org.gvsig.gui.beans.swing.JNumberSpinner; |
|
75 |
import org.gvsig.i18n.Messages; |
|
76 |
import org.gvsig.project.documents.view.legend.LinkedChartLegend; |
|
77 |
import org.gvsig.tools.dataTypes.DataTypes; |
|
78 |
import org.gvsig.tools.dispose.DisposableIterator; |
|
79 |
import org.gvsig.tools.service.ServiceException; |
|
80 |
|
|
81 |
public class ChartLinkedLegendPanel extends JPanel implements ILegendPanel { |
|
82 |
|
|
83 |
/** |
|
84 |
* |
|
85 |
*/ |
|
86 |
private static final long serialVersionUID = -5009857246030623420L; |
|
87 |
// private PreviewBarSymbol previewPanel = null; |
|
88 |
private FLyrVect layer; |
|
89 |
private int shapeType; |
|
90 |
private IChartLegend auxLegend; // @jve:decl-index=0: |
|
91 |
private IChartLegend theLegend; |
|
92 |
private JPanel centerPanel = null; // @jve:decl-index=0:visual-constraint="10,10" |
|
93 |
private JScrollPane jScrollPane = null; |
|
94 |
private JList jFieldList = null; |
|
95 |
private Random rand = new Random(System.currentTimeMillis()); |
|
96 |
private JPanel buttons = null; |
|
97 |
private JButton addButton = null; |
|
98 |
private JButton removeButton = null; |
|
99 |
private JButton addAllButton = null; |
|
100 |
private JButton removeAllButton = null; |
|
101 |
private JPanel pCentral = null; |
|
102 |
private FieldsTable fieldsTable = null; // @jve:decl-index=0:visual-constraint="746,10" |
|
103 |
private JPanel northPanel = null; |
|
104 |
private JPanel southPanel = null; |
|
105 |
|
|
106 |
private JButton bSize = null; |
|
107 |
private JPanel symbolPanel = null; |
|
108 |
private JLabel lBackgroundSymbol = null; |
|
109 |
|
|
110 |
private JSymbolPreviewButton bSymbolBackground = null; |
|
111 |
private JComboBoxColorScheme colorCombo = null; |
|
112 |
private JLabel lColorSchema = null; |
|
113 |
|
|
114 |
private JCheckBox ckOnlySelection = null; |
|
115 |
private JPanel eastPanel; |
|
116 |
private JPanel outlinePanel; |
|
117 |
private JLabel jLabel; |
|
118 |
private JCheckBox jCheckBox; |
|
119 |
private JCheckBox jShowAxis; |
|
120 |
private JPanel jPanel; |
|
121 |
private JLabel jLabel1; |
|
122 |
private JPanel jPanel1; |
|
123 |
private JNumberSpinner comboWidth; |
|
124 |
private JPanel dimensionPanel; |
|
125 |
private JCheckBox ck3D; |
|
126 |
private ColorChooserPanel colorButton; |
|
127 |
private JPanel jLinkedPane; |
|
128 |
private JPanel jLinkedOriginPane; |
|
129 |
private JPanel jLinkedDestinationPane; |
|
130 |
private JTextField originTable; |
|
131 |
private JComboBox originField; |
|
132 |
private JCheckBox originSelection; |
|
133 |
private JCheckBox destinationSelection; |
|
134 |
private JComboBox destinationField; |
|
135 |
private JComboBox destinationTable; |
|
136 |
private JRadioButton PieCb; |
|
137 |
private JRadioButton BarsCb; |
|
138 |
private JPanel jChartTypePane; |
|
139 |
private JPanel fieldsPanel; |
|
140 |
private JComboBox timeField; |
|
141 |
|
|
142 |
/** |
|
143 |
* This is the default constructor |
|
144 |
*/ |
|
145 |
public ChartLinkedLegendPanel() { |
|
146 |
super(); |
|
147 |
initialize(); |
|
148 |
} |
|
149 |
|
|
150 |
/** |
|
151 |
* This method initializes this |
|
152 |
* |
|
153 |
* @return void |
|
154 |
*/ |
|
155 |
private void initialize() { |
|
156 |
this.setSize(732, 354); |
|
157 |
this.setLayout(new BorderLayout()); |
|
158 |
this.add(getLinkedPanel(), BorderLayout.NORTH); |
|
159 |
this.add(getCenterPanel(), BorderLayout.CENTER); |
|
160 |
this.add(getSouthPanel(), BorderLayout.SOUTH); |
|
161 |
this.add(getEastPanel(), BorderLayout.EAST); |
|
162 |
|
|
163 |
// JButton btnTestLegend = new JButton("Crear leyenda de prueba!!"); |
|
164 |
// btnTestLegend.addActionListener(new ActionListener() { |
|
165 |
// public void actionPerformed(ActionEvent e) { |
|
166 |
// createTestLegend(); |
|
167 |
// } |
|
168 |
// }); |
|
169 |
// add(btnTestLegend, BorderLayout.SOUTH); |
|
170 |
// initializeTableDocuments(); |
|
171 |
//fillDestinationFieldNames((String) destinationTable.getSelectedItem()); |
|
172 |
} |
|
173 |
|
|
174 |
private JPanel getEastPanel() { |
|
175 |
if (eastPanel == null) { |
|
176 |
eastPanel = new JPanel(); |
|
177 |
eastPanel.setLayout(new BorderLayout()); |
|
178 |
eastPanel.setPreferredSize(new Dimension(150, 52)); |
|
179 |
// eastPanel.add(getPreviewChart(), BorderLayout.NORTH); |
|
180 |
eastPanel.add(getDimensionPanel(), BorderLayout.NORTH); |
|
181 |
eastPanel.add(getOutlinePanel(), BorderLayout.CENTER); |
|
182 |
eastPanel.add(getBSize(), BorderLayout.SOUTH); |
|
183 |
} |
|
184 |
return eastPanel; |
|
185 |
} |
|
186 |
|
|
187 |
private JPanel getDimensionPanel() { |
|
188 |
if (dimensionPanel == null) { |
|
189 |
dimensionPanel = new JPanel(); |
|
190 |
dimensionPanel.setLayout(new BorderLayout()); |
|
191 |
dimensionPanel.setBorder(BorderFactory.createTitledBorder(null, |
|
192 |
PluginServices.getText(this, "dimension"), |
|
193 |
TitledBorder.DEFAULT_JUSTIFICATION, |
|
194 |
TitledBorder.DEFAULT_POSITION, new Font("Dialog", |
|
195 |
Font.BOLD, 12), new Color(51, 51, 51))); |
|
196 |
dimensionPanel.setPreferredSize(new Dimension(150, 50)); |
|
197 |
dimensionPanel.add(getCk3D(), BorderLayout.NORTH); |
|
198 |
} |
|
199 |
return dimensionPanel; |
|
200 |
} |
|
201 |
|
|
202 |
private JCheckBox getCk3D() { |
|
203 |
if (ck3D == null) { |
|
204 |
ck3D = new JCheckBox(); |
|
205 |
ck3D.setEnabled(false); |
|
206 |
ck3D.setText(PluginServices.getText(this, "display_3d")); |
|
207 |
ck3D.addChangeListener(new ChangeListener() { |
|
208 |
public void stateChanged(ChangeEvent e) { |
|
209 |
// getPreviewChart().set3D(ck3D.isSelected()); |
|
210 |
// getPreviewChart().repaint(); |
|
211 |
// auxLegend.setIs3D(ck3D.isSelected()); |
|
212 |
} |
|
213 |
|
|
214 |
}); |
|
215 |
} |
|
216 |
return ck3D; |
|
217 |
} |
|
218 |
|
|
219 |
private JPanel getOutlinePanel() { |
|
220 |
if (outlinePanel == null) { |
|
221 |
jLabel = new JLabel(); |
|
222 |
jLabel.setText(PluginServices.getText(this, "color")); |
|
223 |
outlinePanel = new JPanel(); |
|
224 |
outlinePanel.setLayout(new BorderLayout()); |
|
225 |
outlinePanel.setBorder(BorderFactory.createTitledBorder(null, |
|
226 |
PluginServices.getText(this, "background_color"), |
|
227 |
TitledBorder.DEFAULT_JUSTIFICATION, |
|
228 |
TitledBorder.DEFAULT_POSITION, new Font("Dialog", |
|
229 |
Font.BOLD, 12), new Color(51, 51, 51))); |
|
230 |
outlinePanel.setPreferredSize(new Dimension(150, 115)); |
|
231 |
outlinePanel.add(getJCheckBox(), BorderLayout.NORTH); |
|
232 |
outlinePanel.add(getJPanel(), BorderLayout.CENTER); |
|
233 |
//outlinePanel.add(getJPanel1(), BorderLayout.SOUTH); |
|
234 |
} |
|
235 |
return outlinePanel; |
|
236 |
} |
|
237 |
|
|
238 |
private JPanel getJPanel() { |
|
239 |
if (jPanel == null) { |
|
240 |
jPanel = new JPanel(); |
|
241 |
jPanel.setLayout(new FlowLayout()); |
|
242 |
jPanel.add(jLabel, null); |
|
243 |
jPanel.add(getColorButton(), null); |
|
244 |
} |
|
245 |
return jPanel; |
|
246 |
} |
|
247 |
|
|
248 |
private ColorChooserPanel getColorButton() { |
|
249 |
if (colorButton == null) { |
|
250 |
colorButton = new ColorChooserPanel(true); |
|
251 |
colorButton.setColor(Color.black); |
|
252 |
Dimension dim = colorButton.getPreferredSize(); |
|
253 |
colorButton.setPreferredSize(new Dimension(dim.width - 10, dim.height)); |
|
254 |
// colorButton.addActionListener(new ActionListener() { |
|
255 |
// public void actionPerformed(ActionEvent e) { |
|
256 |
// // getPreviewChart().setOutLineColor(colorButton.getColor()); |
|
257 |
// // getPreviewChart().repaint(); |
|
258 |
// auxLegend.setOutlineColor(colorButton.getColor()); |
|
259 |
// } |
|
260 |
// }); |
|
261 |
} |
|
262 |
return colorButton; |
|
263 |
} |
|
264 |
|
|
265 |
/** |
|
266 |
* This method initializes jPanel1 |
|
267 |
* |
|
268 |
* @return javax.swing.JPanel |
|
269 |
*/ |
|
270 |
private JPanel getJPanel1() { |
|
271 |
if (jPanel1 == null) { |
|
272 |
jLabel1 = new JLabel(); |
|
273 |
jLabel1.setText(PluginServices.getText(this, "width")); |
|
274 |
jPanel1 = new JPanel(); |
|
275 |
jPanel1.setLayout(new FlowLayout()); |
|
276 |
jPanel1.add(jLabel1, null); |
|
277 |
jPanel1.add(getComboWidth(), null); |
|
278 |
} |
|
279 |
return jPanel1; |
|
280 |
} |
|
281 |
|
|
282 |
private JNumberSpinner getComboWidth() { |
|
283 |
if (comboWidth == null) { |
|
284 |
comboWidth = new JNumberSpinner(String.valueOf(1), 3, 0, Integer.MAX_VALUE, 1); |
|
285 |
// comboWidth.addActionListener(new ActionListener() { |
|
286 |
// public void actionPerformed(ActionEvent e) { |
|
287 |
// // getPreviewChart().setOutlineWidth(comboWidth.getInteger()); |
|
288 |
// // getPreviewChart().repaint(); |
|
289 |
// auxLegend.setOutlineWidth(comboWidth.getInteger()); |
|
290 |
// } |
|
291 |
// |
|
292 |
// }); |
|
293 |
} |
|
294 |
return comboWidth; |
|
295 |
} |
|
296 |
|
|
297 |
private JCheckBox getShowAxis() { |
|
298 |
if (jShowAxis == null) { |
|
299 |
jShowAxis = new JCheckBox(); |
|
300 |
jShowAxis.setEnabled(false); |
|
301 |
jShowAxis.setText(PluginServices.getText(this, "show_axis")); |
|
302 |
} |
|
303 |
return jShowAxis; |
|
304 |
} |
|
305 |
|
|
306 |
private JCheckBox getJCheckBox() { |
|
307 |
if (jCheckBox == null) { |
|
308 |
jCheckBox = new JCheckBox(); |
|
309 |
jCheckBox.setText(PluginServices.getText(this, "Show")); |
|
310 |
// jCheckBox.addChangeListener(new ChangeListener() { |
|
311 |
// public void stateChanged(ChangeEvent e) { |
|
312 |
// // getPreviewChart().setOutlineShow(jCheckBox.isSelected()); |
|
313 |
// // getPreviewChart().repaint(); |
|
314 |
// auxLegend.setOutlineShow(jCheckBox.isSelected()); |
|
315 |
// } |
|
316 |
// |
|
317 |
// }); |
|
318 |
} |
|
319 |
return jCheckBox; |
|
320 |
} |
|
321 |
|
|
322 |
private JPanel getSouthPanel() { |
|
323 |
if (southPanel == null) { |
|
324 |
southPanel = new JPanel(); |
|
325 |
southPanel.setLayout(new FlowLayout()); |
|
326 |
southPanel.setPreferredSize(new Dimension(170, 50)); |
|
327 |
southPanel.add(getSymbolPanel(), null); |
|
328 |
southPanel.add(getNorthPanel(), null); |
|
329 |
southPanel.add(getBSize(), null); |
|
330 |
southPanel.add(getCkOnlySelection(), null); |
|
331 |
} |
|
332 |
return southPanel; |
|
333 |
} |
|
334 |
|
|
335 |
private JPanel getSymbolPanel() { |
|
336 |
if (symbolPanel == null) { |
|
337 |
lBackgroundSymbol = new JLabel(); |
|
338 |
lBackgroundSymbol.setText(PluginServices.getText(this, |
|
339 |
"background_symbol")); |
|
340 |
lBackgroundSymbol.setText(PluginServices.getText(this, |
|
341 |
"show_axis")); |
|
342 |
symbolPanel = new JPanel(); |
|
343 |
symbolPanel.setLayout(new FlowLayout()); |
|
344 |
symbolPanel.setPreferredSize(new Dimension(241, 40)); |
|
345 |
// symbolPanel.add(lBackgroundSymbol, null); |
|
346 |
// symbolPanel.add(getBackgroundSymbol(), null); |
|
347 |
symbolPanel.add(getShowAxis(), null); |
|
348 |
|
|
349 |
} |
|
350 |
return symbolPanel; |
|
351 |
} |
|
352 |
|
|
353 |
// ?? Este s?mbolo no deber?a ser independiente del typo de capa |
|
354 |
private JSymbolPreviewButton getBackgroundSymbol() { |
|
355 |
if (bSymbolBackground == null) { |
|
356 |
bSymbolBackground = new JSymbolPreviewButton(shapeType); |
|
357 |
bSymbolBackground.setPreferredSize(new Dimension(110, 20)); |
|
358 |
bSymbolBackground.addActionListener(new ActionListener() { |
|
359 |
public void actionPerformed(ActionEvent e) { |
|
360 |
// getPreviewChart().setBackgroundSymbol(bSymbolBackground.getSymbol()); |
|
361 |
// getPreviewChart().repaint(); |
|
362 |
} |
|
363 |
}); |
|
364 |
} |
|
365 |
return bSymbolBackground; |
|
366 |
} |
|
367 |
|
|
368 |
private JButton getBSize() { |
|
369 |
if (bSize == null) { |
|
370 |
bSize = new JButton(); |
|
371 |
bSize.setText(PluginServices.getText(this, "size")); |
|
372 |
bSize.setPreferredSize(new Dimension(100, 30)); |
|
373 |
bSize.setMaximumSize(new Dimension(100, 30)); |
|
374 |
bSize.addActionListener(new ActionListener() { |
|
375 |
public void actionPerformed(ActionEvent e) { |
|
376 |
PluginServices.getMDIManager().addCentredWindow( |
|
377 |
new SizePanel(layer, auxLegend)); |
|
378 |
} |
|
379 |
|
|
380 |
}); |
|
381 |
} |
|
382 |
return bSize; |
|
383 |
} |
|
384 |
|
|
385 |
/** |
|
386 |
* This method initializes centerPanel |
|
387 |
* |
|
388 |
* @return javax.swing.JPanel |
|
389 |
*/ |
|
390 |
private JPanel getCenterPanel() { |
|
391 |
if (centerPanel == null) { |
|
392 |
centerPanel = new JPanel(); |
|
393 |
centerPanel.setLayout(new BorderLayout()); |
|
394 |
centerPanel.setPreferredSize(new Dimension(350, 150)); |
|
395 |
centerPanel.add(getChartTypePanel(), BorderLayout.NORTH); |
|
396 |
centerPanel.add(getJScrollPane(), BorderLayout.WEST); |
|
397 |
centerPanel.add(getButtons(), BorderLayout.CENTER); |
|
398 |
centerPanel.add(getFieldsPane(), java.awt.BorderLayout.EAST); |
|
399 |
} |
|
400 |
return centerPanel; |
|
401 |
} |
|
402 |
|
|
403 |
private JPanel getFieldsPane() { |
|
404 |
if (fieldsPanel == null) { |
|
405 |
fieldsPanel = new JPanel(); |
|
406 |
fieldsPanel.setLayout(new BorderLayout()); |
|
407 |
fieldsPanel.add(getFieldsTable(), BorderLayout.NORTH); |
|
408 |
JLabel label = new JLabel(); |
|
409 |
label.setPreferredSize(new Dimension(125, 20)); |
|
410 |
label.setText(PluginServices.getText(this, "time_field")); |
|
411 |
fieldsPanel.add(label, BorderLayout.WEST); |
|
412 |
timeField = new JComboBox(); |
|
413 |
timeField.setPreferredSize(new Dimension(75, 20)); |
|
414 |
fieldsPanel.add(timeField, BorderLayout.CENTER); |
|
415 |
} |
|
416 |
return fieldsPanel; |
|
417 |
} |
|
418 |
|
|
419 |
private JPanel getPCentral() { |
|
420 |
if (pCentral == null) { |
|
421 |
pCentral = new JPanel(); |
|
422 |
pCentral.setLayout(new FlowLayout()); |
|
423 |
pCentral.setPreferredSize(new Dimension(50, 185)); |
|
424 |
pCentral.add(getRemoveAllButton(), null); |
|
425 |
pCentral.add(getAddAllButton(), null); |
|
426 |
pCentral.add(getRemoveButton(), null); |
|
427 |
pCentral.add(getAddButton(), null); |
|
428 |
} |
|
429 |
return pCentral; |
|
430 |
} |
|
431 |
|
|
432 |
private JButton getAddButton() { |
|
433 |
if (addButton == null) { |
|
434 |
addButton = new JButton(); |
|
435 |
addButton.setText(">"); |
|
436 |
addButton.setPreferredSize(new Dimension(50, 40)); |
|
437 |
addButton.addActionListener(new java.awt.event.ActionListener() { |
|
438 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
439 |
Object[] fields = getJFieldList().getSelectedValues(); |
|
440 |
Color[] colorScheme = colorCombo.getSelectedColors(); |
|
441 |
|
|
442 |
Color[] colors = new Color[colorScheme.length]; |
|
443 |
for (int i = 0; i < colorScheme.length; i++) { |
|
444 |
colors[i] = colorScheme[i]; |
|
445 |
} |
|
446 |
for (int i = 0; i < fields.length; i++) { |
|
447 |
getFieldsTable().addTableRecord( |
|
448 |
colorScheme[rand.nextInt(colorScheme.length)], |
|
449 |
(String) fields[i], (String) fields[i]); |
|
450 |
((DefaultListModel) getJFieldList().getModel()) |
|
451 |
.removeElement(fields[i]); |
|
452 |
} |
|
453 |
actualizePreviewSymbol(); |
|
454 |
} |
|
455 |
}); |
|
456 |
} |
|
457 |
return addButton; |
|
458 |
} |
|
459 |
|
|
460 |
/** |
|
461 |
* This method initializes northPanel |
|
462 |
* |
|
463 |
* @return javax.swing.JPanel |
|
464 |
*/ |
|
465 |
private JPanel getNorthPanel() { |
|
466 |
if (northPanel == null) { |
|
467 |
lColorSchema = new JLabel(); |
|
468 |
lColorSchema.setText(PluginServices.getText(this, "color_schema")); |
|
469 |
northPanel = new JPanel(); |
|
470 |
northPanel.setLayout(new FlowLayout()); |
|
471 |
northPanel.add(lColorSchema, null); |
|
472 |
northPanel.add(getColorCombo()); |
|
473 |
} |
|
474 |
return northPanel; |
|
475 |
} |
|
476 |
|
|
477 |
private JComboBoxColorScheme getColorCombo() { |
|
478 |
if (colorCombo == null) { |
|
479 |
colorCombo = new JComboBoxColorScheme(false); |
|
480 |
} |
|
481 |
return colorCombo; |
|
482 |
} |
|
483 |
|
|
484 |
/** |
|
485 |
* This method initializes removeButton |
|
486 |
* |
|
487 |
* @return javax.swing.JButton |
|
488 |
*/ |
|
489 |
private JButton getRemoveButton() { |
|
490 |
if (removeButton == null) { |
|
491 |
removeButton = new JButton(); |
|
492 |
removeButton.setPreferredSize(new Dimension(50, 40)); |
|
493 |
removeButton.setText("<"); |
|
494 |
removeButton.addActionListener(new java.awt.event.ActionListener() { |
|
495 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
496 |
int[] index = getFieldsTable().getSelectedRows(); |
|
497 |
String[] fields = new String[index.length]; |
|
498 |
for (int i = 0; i < index.length; i++) { |
|
499 |
fields[i] = (String) getFieldsTable().getFieldValue( |
|
500 |
index[i], 1); |
|
501 |
} |
|
502 |
for (int i = 0; i < fields.length; i++) { |
|
503 |
((DefaultListModel) getJFieldList().getModel()) |
|
504 |
.addElement(fields[i]); |
|
505 |
} |
|
506 |
getFieldsTable().removeSelectedRows(); |
|
507 |
actualizePreviewSymbol(); |
|
508 |
|
|
509 |
fillDestinationFieldNames((String) destinationTable.getSelectedItem()); |
|
510 |
} |
|
511 |
}); |
|
512 |
} |
|
513 |
return removeButton; |
|
514 |
} |
|
515 |
|
|
516 |
/** |
|
517 |
* This method initializes addAllButton |
|
518 |
* |
|
519 |
* @return javax.swing.JButton |
|
520 |
*/ |
|
521 |
private JButton getAddAllButton() { |
|
522 |
if (addAllButton == null) { |
|
523 |
addAllButton = new JButton(); |
|
524 |
addAllButton.setPreferredSize(new Dimension(50, 40)); |
|
525 |
addAllButton.setText(">>"); |
|
526 |
addAllButton.addActionListener(new java.awt.event.ActionListener() { |
|
527 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
528 |
Object[] fields = ((DefaultListModel) getJFieldList() |
|
529 |
.getModel()).toArray(); |
|
530 |
|
Also available in: Unified diff