Revision 28

View differences:

old/extension/trunk/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"
3
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4
	<modelVersion>4.0.0</modelVersion>
5
	<packaging>jar</packaging>
6
	<artifactId>org.gvsig.chart.app.legendplugin</artifactId>
7
	<name>Vector legend: Charts</name>
8
	<description>
9
This package adds to the view chart legend.
10
</description>	
11

  
12
	<parent>
13
		<groupId>org.gvsig</groupId>
14
		<artifactId>org.gvsig.chart.app</artifactId>
15
		<version>1.0.0-SNAPSHOT</version>
16
	</parent>
17

  
18
	<dependencies>
19
		<dependency>
20
			<groupId>org.gvsig</groupId>
21
			<artifactId>org.gvsig.utils</artifactId>
22
			<scope>compile</scope>
23
		</dependency>
24
		<dependency>
25
			<groupId>org.gvsig</groupId>
26
			<artifactId>org.gvsig.fmap.mapcontext.api</artifactId>
27
            <scope>compile</scope>
28
		</dependency>
29
		<dependency>
30
			<groupId>org.gvsig</groupId>
31
			<artifactId>org.gvsig.symbology.lib.api</artifactId>
32
			<scope>compile</scope>
33
		</dependency>
34
		<dependency>
35
			<groupId>org.gvsig</groupId>
36
			<artifactId>org.gvsig.projection.api</artifactId>
37
			<scope>compile</scope>
38
		</dependency>
39
		<dependency>
40
			<groupId>org.gvsig</groupId>
41
			<artifactId>org.gvsig.app.mainplugin</artifactId>
42
			<scope>compile</scope>
43
		</dependency>
44
		<dependency>
45
			<groupId>org.gvsig</groupId>
46
			<artifactId>org.gvsig.compat.api</artifactId>
47
			<scope>compile</scope>
48
		</dependency>
49
		<dependency>
50
			<groupId>org.gvsig</groupId>
51
			<artifactId>org.gvsig.ui</artifactId>
52
            <scope>compile</scope>
53
		</dependency>
54
		<dependency>
55
			<groupId>org.gvsig</groupId>
56
			<artifactId>org.gvsig.app.document.table.app.mainplugin</artifactId>
57
			<scope>compile</scope>
58
		</dependency>
59
		<dependency>
60
			<groupId>org.gvsig</groupId>
61
			<artifactId>org.gvsig.chart.lib.api</artifactId>
62
			<scope>compile</scope>
63
		</dependency>
64
		<dependency>
65
			<groupId>org.gvsig</groupId>
66
			<artifactId>org.gvsig.chart.swing.api</artifactId>
67
			<scope>compile</scope>
68
		</dependency>
69
		<dependency>
70
			<groupId>org.gvsig</groupId>
71
			<artifactId>org.gvsig.chart.lib.impl</artifactId>
72
			<scope>runtime</scope>
73
		</dependency>
74
		<dependency>
75
			<groupId>org.gvsig</groupId>
76
			<artifactId>org.gvsig.chart.lib.base</artifactId>
77
			<scope>runtime</scope>
78
		</dependency>
79
		<dependency>
80
			<groupId>org.gvsig</groupId>
81
			<artifactId>org.gvsig.chart.swing.impl</artifactId>
82
			<scope>runtime</scope>
83
		</dependency>
84
		<dependency>
85
			<groupId>org.gvsig</groupId>
86
			<artifactId>org.gvsig.chart.swing.base</artifactId>
87
			<scope>runtime</scope>
88
		</dependency>
89
		<dependency>
90
			<groupId>org.gvsig</groupId>
91
			<artifactId>org.gvsig.symbology.swing.api</artifactId>
92
			<scope>compile</scope>
93
		</dependency>
94
		<dependency>
95
			<groupId>org.gvsig</groupId>
96
			<artifactId>org.gvsig.chart.app.mainplugin</artifactId>
97
			<scope>compile</scope>
98
		</dependency>
99

  
100
	</dependencies>
101
	
102
    <properties>
103
        <!-- Package info property values -->
104
        <!-- Default values in org.gvsig.desktop -->
105
        <gvsig.package.info.state>testing</gvsig.package.info.state>
106
        <gvsig.package.info.official>true</gvsig.package.info.official>
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>http://devel.gvsig.org/download/projects/gvsig-chart/pool/</gvsig.package.info.poolURL>
110
    </properties>
111
    
112
</project>
0 113

  
old/extension/trunk/org.gvsig.chart.app/org.gvsig.chart.app.legendplugin/buildNumber.properties
1
#Thu Nov 14 02:14:56 CET 2013
2
buildNumber=12
0 3

  
old/extension/trunk/org.gvsig.chart.app/org.gvsig.chart.app.legendplugin/src/test/resources/log4j.xml
1
<?xml version="1.0" encoding="ISO-8859-1" ?>
2
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
3

  
4
<!-- 
5
Log4J configuration file for unit tests execution.
6
 -->
7
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
8

  
9
	<!-- Appender configuration to show logging messages through the console -->
10
	<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
11
		<layout class="org.apache.log4j.PatternLayout">
12
			<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n  %m%n" />
13
		</layout>
14
	</appender>
15

  
16
	<!-- 
17
	Activate logging messages of DEBUG level of higher only for the
18
	org.gvsig.tools packages.
19
	You can put full classes names or packages instead, to configure
20
	logging for all the classes and subpackages of the package.
21
	-->
22
	<category name="org.gvsig.tools">
23
		<priority value="DEBUG" />
24
	</category>
25
	<category name="org.gvsig.chart">
26
		<priority value="DEBUG" />
27
	</category>
28

  
29
	<!-- 
30
	By default, show only logging messages of INFO level or higher, 
31
	through the previously configured CONSOLE appender. 
32
	-->
33
	<root>
34
		<priority value="INFO" />
35
		<appender-ref ref="CONSOLE" />
36
	</root>
37
</log4j:configuration>
0 38

  
old/extension/trunk/org.gvsig.chart.app/org.gvsig.chart.app.legendplugin/src/test/resources/README.txt
1
Put into this folder the resources needed by your test classes.
2

  
3
This folder is added to the Tests classpath, so you can load any resources 
4
through the ClassLoader.
5

  
6
By default, in this folder you can find an example of log4j configuration,
7
prepared to log messages through the console, so logging works when you
8
run your tests classes.
0 9

  
old/extension/trunk/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

  
old/extension/trunk/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?n del gr?fico
4
Advanced_configurations=Configuraci?n avanzada
5
Chart_variables=Variables del gr?fico
6
Visible=?Es visible?
7
Chart_Name=Nombre de la variable
8
Chart_Type=Tipo de gr?fico
9
Render_type=Tipo de renderer
10
Table_name=Tabla origen de datos
11
Type_Chart=Tipo de gr?fico
12
Data_Chart=Origen de datos
13
Format_Chart=Formato del gr?fico
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?fico
19
use_selected_rows=Usar s?lo campos seleccionados
20
Edit_Series_Values=Editar valores de campos
21
Symbol=S?mbolo
22
Series_name=Nombre de la serie
23
Format_configurations=Configuraci?n
24
Series=Series
25
Chart_Area=?rea del gr?fico
26
Plot_Area=?rea de datos
27
Axis=Ejes
28
Plot=Gr?fico
29
Legend=Leyenda
30
Title=T?tulo
31
Chart_Title=T?tulo del gr?fico
32

  
33
Default=Por defecto
34
Category=Categorizado
35
Numerical=Num?rico
36

  
37
Name=Nombre
38
Units=Unidades
39
Description=Descripci?n
40
Chart_Renderer_types=Tipos de renderer
41
Drawing_options=Opciones de pintado
42
Dimension= Dimensi?n: 
43
Output_Format=Formato salida:
44
Domain_Axis_type=Eje de dominio:
45
Series_Type=Tipo de series:
46
Orientation=Orientaci?n
47
Flip_Axis=Invertir ejes
48
legend=leyenda
49
tooltip=tooltip
50
urls=urls
51

  
52
Axis_Panel=Ejes
53
Background=Background
54
alpha=Alfa
55
Chart_Visibility=Visibilidad del gr?fico
56
Hide_chart_if_no_data=Ocultar el gr?fico si no hay datos
57
Show_message=Mostrar el gr?fico vac?o con el mensaje siguiente:
58
Text=Texto
59
Font=Fuente
60
Type=Tipo:
61
Format=Formato
62
Labels=Etiquetas
63
Outline=Contorno:
64

  
65
Is_category_Axis=Eje de categorias
66
Combine_axis=Combinar con otro eje
67

  
68
LEFT=IZQUIERDA
69
RIGHT=DERECHA
70
CENTER=CENTRO
71
TOP=ARRIBA
72
BOTTOM=ABAJO
73

  
74
Previous=Anterior
75
Next=Siguiente
76
Accept=Aceptar
77

  
78
Legend_visible=Leyenda visible
79
Legend_position=Posici?n
80
Choose_Font_Color=Color de la fuente
81
Use_default=Por defecto
82
Coordinates=Coordenadas
83
(pixels)=(p?xeles)
84

  
85
Default_size=Tama?o por defecto
86
Width=Ancho:
87
Height=Alto:
88

  
89
Pick_Color=Elige un color...
90
propiedades_grafico=Propiedades del Gr?fico
91
General_options=Opciones generales
92
Add_new_variable=A?ade nueva variable
93
Edit_a_variable=Edita una variable
94

  
95
bar_legend=Barras
96
pie_legend=Tartas
97

  
98
configure_size=Configurar tama?o de los s?mbolos
99
fixed_size=Tama?o fijo
100
sum_field_values_size=Tama?o variable de la suma de los valores representados
101
field_size=Tama?o por campo
102
normalize=normalizado por
103
limits=L?mites
104
active_limits=Activar l?mites
105
show_axis=Mostrar ejes del gr?fico
0 106

  
old/extension/trunk/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=CAdvanced 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

  
old/extension/trunk/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

  
old/extension/trunk/org.gvsig.chart.app/org.gvsig.chart.app.legendplugin/src/main/java/org/gvsig/app/chart/legendplugin/ChartLegendExtension.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.app.chart.legendplugin;
23

  
24
import org.gvsig.andami.IconThemeHelper;
25
import org.gvsig.andami.plugins.Extension;
26
import org.gvsig.andami.plugins.IExtension;
27
import org.gvsig.app.project.documents.view.legend.gui.LegendManager;
28
import org.gvsig.project.documents.view.legend.BarsChartLegend;
29
import org.gvsig.project.documents.view.legend.LinkedChartLegend;
30
import org.gvsig.project.documents.view.legend.PieChartLegend;
31
import org.gvsig.project.documents.view.legend.gui.ChartLegendPanelBars;
32
import org.gvsig.project.documents.view.legend.gui.ChartLegendPanelPie;
33
import org.gvsig.project.documents.view.legend.gui.ChartLinkedLegendPanel;
34
import org.gvsig.project.documents.view.legend.symbol.ChartSymbol;
35
import org.gvsig.tools.util.Caller;
36
import org.gvsig.tools.util.impl.DefaultCaller;
37

  
38
/**
39
 * Andami extension to show Chart in the application.
40
 * 
41
 * @author gvSIG Team
42
 * @version $Id$
43
 */
44
public class ChartLegendExtension extends Extension {
45

  
46
	public void initialize() {
47
		registerIcons();
48
		
49
		LegendManager.addLegendPage(ChartLegendPanelPie.class);
50
		LegendManager.addLegendPage(ChartLegendPanelBars.class);
51
		
52
		LegendManager.addLegendPage(ChartLinkedLegendPanel.class);
53

  
54
	}
55

  
56
	public void postInitialize() {
57
		  Caller caller = new DefaultCaller();
58
	       
59
	        /*
60
	         * Add registry of symbols 
61
	         */
62
	        caller.add( new ChartSymbol.RegisterSymbol() );
63

  
64
	        /*
65
	         * Add registry of legends
66
	         * Be careful: No all charts are suitable to be applied as simple legends.
67
	         * Simple legends may be applied to usual vectorial layers.
68
	         * Each feature will create a chart, using numerical values as series
69
	         * and the name of the fields as categories.
70
	         * Registered legends will appear in LegendManger window.
71
	         * About complex chart legends, if the layer has a time field like SOS layers,
72
	         * or its features are complex features (one feature may have several records 
73
	         * associated to it), then we can use any chart in this legend.
74
	         * The user will be able to open a new window to define the kind of chart.
75
	         */
76
	        caller.add( new PieChartLegend.RegisterLegend() );
77
	        caller.add( new BarsChartLegend.RegisterLegend() );
78

  
79
	        caller.add( new LinkedChartLegend.RegisterLegend() );
80
	        
81
	        
82
		    /*
83
	         * Add registry of persistent symbols
84
	         */
85
	        caller.add( new ChartSymbol.RegisterPersistence() );
86
	        
87
		    /*
88
	         * Add registry of persistent legends
89
	         */
90
	        caller.add( new BarsChartLegend.RegisterPersistence() );
91
	        caller.add( new PieChartLegend.RegisterPersistence() );
92
	        
93
	        caller.add( new LinkedChartLegend.RegisterPersistence() );
94
	        
95
	        caller.call();
96
	}
97

  
98

  
99
	/**
100
	 * Execute the actions associated to this extension.
101
	 */
102
	public void execute(String actionCommand) {
103
	}
104

  
105
	/**
106
	 * Check if tools of this extension are enabled.
107
	 */
108
	public boolean isEnabled() {
109
		return true;
110
	}
111

  
112
	/**
113
	 * Check if tools of this extension are visible.
114
	 */
115
	public boolean isVisible() {
116
			return true;
117
	}
118

  
119
	/**
120
	 * Check if an extension is enabled.
121
	 */
122
	public boolean isEnabled(IExtension extension) {
123
		return extension.isEnabled();
124
	}
125

  
126
	/**
127
	 * Check if an extension is visible.
128
	 */
129
	public boolean isVisible(IExtension extension) {
130
		return extension.isVisible();
131
	}
132

  
133
	private void registerIcons() {	
134
		IconThemeHelper.registerIcon("legend", "legend-pie-chart", ChartLegendExtension.class);
135
		IconThemeHelper.registerIcon("legend", "legend-bar-chart", ChartLegendExtension.class);
136
	}
137

  
138
}
0 139

  
old/extension/trunk/org.gvsig.chart.app/org.gvsig.chart.app.legendplugin/src/main/java/org/gvsig/app/chart/legendplugin/package.html
1
<?xml version="1.0" encoding="UTF-8" ?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml">
4
<head>
5
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
<title>org.gvsig.landregistryviewer package documentation</title>
7
</head>
8
<body>
9

  
10
	<p>LandRegistryViewer gvSIG extension</p>
11
	
12
	<p>
13
	Shows LandRegistryViewer into gvSIG.
14
	</p>
15

  
16
</body>
17
</html>
0 18

  
old/extension/trunk/org.gvsig.chart.app/org.gvsig.chart.app.legendplugin/src/main/java/org/gvsig/project/documents/view/legend/gui/ColorChange.java
1
package org.gvsig.project.documents.view.legend.gui;
2

  
3
/**
4
 * Listener to control color change.
5
 *
6
 * @author Vicente Caballero Navarro
7
 */
8
public interface ColorChange {
9

  
10
	public void actionChange();
11
}
0 12

  
old/extension/trunk/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

  
old/extension/trunk/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.HashMap;
14
import java.util.Hashtable;
15
import java.util.Iterator;
16
import java.util.List;
17
import java.util.Map;
18
import java.util.Properties;
19
import java.util.Random;
20

  
21
import javax.swing.BorderFactory;
22
import javax.swing.ButtonGroup;
23
import javax.swing.DefaultComboBoxModel;
24
import javax.swing.DefaultListModel;
25
import javax.swing.ImageIcon;
26
import javax.swing.JButton;
27
import javax.swing.JCheckBox;
28
import javax.swing.JComboBox;
29
import javax.swing.JLabel;
30
import javax.swing.JList;
31
import javax.swing.JPanel;
32
import javax.swing.JRadioButton;
33
import javax.swing.JScrollPane;
34
import javax.swing.JTextField;
35
import javax.swing.border.TitledBorder;
36
import javax.swing.event.ChangeEvent;
37
import javax.swing.event.ChangeListener;
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.IChartLegend;
59
import org.gvsig.chart.legend.ILinkedChartLegend;
60
import org.gvsig.chart.legend.symbols.IChartSymbol;
61
import org.gvsig.fmap.dal.exception.DataException;
62
import org.gvsig.fmap.dal.exception.ReadException;
63
import org.gvsig.fmap.dal.feature.Feature;
64
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
65
import org.gvsig.fmap.dal.feature.FeatureSelection;
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.JIncrementalNumberField;
75
import org.gvsig.gui.beans.swing.ValidatingTextField;
76
import org.gvsig.project.documents.view.legend.LinkedChartLegend;
77
import org.gvsig.tools.dispose.DisposableIterator;
78
import org.gvsig.tools.service.ServiceException;
79

  
80
public class ChartLinkedLegendPanel extends JPanel implements ILegendPanel {
81

  
82
	/**
83
	 * 
84
	 */
85
	private static final long serialVersionUID = -5009857246030623420L;
86
	// private PreviewBarSymbol previewPanel = null;
87
	private FLyrVect layer;
88
	private int shapeType;
89
	private IChartLegend auxLegend; // @jve:decl-index=0:
90
	private IChartLegend theLegend;
91
	private JPanel centerPanel = null; // @jve:decl-index=0:visual-constraint="10,10"
92
	private JScrollPane jScrollPane = null;
93
	private JList jFieldList = null;
94
	private Random rand = new Random(System.currentTimeMillis());
95
	private JPanel buttons = null;
96
	private JButton addButton = null;
97
	private JButton removeButton = null;
98
	private JButton addAllButton = null;
99
	private JButton removeAllButton = null;
100
	private JPanel pCentral = null;
101
	private FieldsTable fieldsTable = null; // @jve:decl-index=0:visual-constraint="746,10"
102
	private JPanel northPanel = null;
103
	private JPanel southPanel = null;
104

  
105
	private JButton bSize = null;
106
	private JPanel symbolPanel = null;
107
	private JLabel lBackgroundSymbol = null;
108

  
109
	private JSymbolPreviewButton bSymbolBackground = null;
110
	private JComboBoxColorScheme colorCombo = null;
111
	private JLabel lColorSchema = null;
112

  
113
	private JCheckBox ckOnlySelection = null;
114
	private JPanel eastPanel;
115
	private JPanel outlinePanel;
116
	private JLabel jLabel;
117
	private JCheckBox jCheckBox;
118
	private JCheckBox jShowAxis;
119
	private JPanel jPanel;
120
	private JLabel jLabel1;
121
	private JPanel jPanel1;
122
	private JIncrementalNumberField comboWidth;
123
	private JPanel dimensionPanel;
124
	private JCheckBox ck3D;
125
	private ColorChooserPanel colorButton;
126
	private JPanel jLinkedPane;
127
	private JPanel jLinkedOriginPane;
128
	private JPanel jLinkedDestinationPane;
129
	private JTextField originTable;
130
	private JComboBox originField;
131
	private JCheckBox originSelection;
132
	private JCheckBox destinationSelection;
133
	private JComboBox destinationField;
134
	private JComboBox destinationTable;
135
	private JRadioButton PieCb;
136
	private JRadioButton BarsCb;
137
	private JPanel jChartTypePane;
138
	private JPanel fieldsPanel;
139
	private JComboBox timeField;
140

  
141
	/**
142
	 * This is the default constructor
143
	 */
144
	public ChartLinkedLegendPanel() {
145
		super();
146
		initialize();
147
	}
148

  
149
	/**
150
	 * This method initializes this
151
	 * 
152
	 * @return void
153
	 */
154
	private void initialize() {
155
		this.setSize(732, 354);
156
		this.setLayout(new BorderLayout());
157
		this.add(getLinkedPanel(), BorderLayout.NORTH);
158
		this.add(getCenterPanel(), BorderLayout.CENTER);
159
		this.add(getSouthPanel(), BorderLayout.SOUTH);
160
		this.add(getEastPanel(), BorderLayout.EAST);
161

  
162
//		JButton btnTestLegend = new JButton("Crear leyenda de prueba!!");
163
//		btnTestLegend.addActionListener(new ActionListener() {
164
//			public void actionPerformed(ActionEvent e) {
165
//				createTestLegend();
166
//			}
167
//		});
168
		// add(btnTestLegend, BorderLayout.SOUTH);
169
		
170
		initializeTableDocuments();
171
		
172
		//fillDestinationFieldNames((String) destinationTable.getSelectedItem());
173
	}
174

  
175
	private JPanel getEastPanel() {
176
		if (eastPanel == null) {
177
			eastPanel = new JPanel();
178
			eastPanel.setLayout(new BorderLayout());
179
			eastPanel.setPreferredSize(new Dimension(150, 52));
180
			// eastPanel.add(getPreviewChart(), BorderLayout.NORTH);
181
			eastPanel.add(getDimensionPanel(), BorderLayout.NORTH);
182
			eastPanel.add(getOutlinePanel(), BorderLayout.CENTER);
183
			eastPanel.add(getBSize(), BorderLayout.SOUTH);
184
		}
185
		return eastPanel;
186
	}
187

  
188
	private JPanel getDimensionPanel() {
189
		if (dimensionPanel == null) {
190
			dimensionPanel = new JPanel();
191
			dimensionPanel.setLayout(new BorderLayout());
192
			dimensionPanel.setBorder(BorderFactory.createTitledBorder(null,
193
					PluginServices.getText(this, "dimension"),
194
					TitledBorder.DEFAULT_JUSTIFICATION,
195
					TitledBorder.DEFAULT_POSITION, new Font("Dialog",
196
							Font.BOLD, 12), new Color(51, 51, 51)));
197
			dimensionPanel.setPreferredSize(new Dimension(150, 50));
198
			dimensionPanel.add(getCk3D(), BorderLayout.NORTH);
199
		}
200
		return dimensionPanel;
201
	}
202

  
203
	private JCheckBox getCk3D() {
204
		if (ck3D == null) {
205
			ck3D = new JCheckBox();
206
			ck3D.setEnabled(false);
207
			ck3D.setText(PluginServices.getText(this, "display_3d"));
208
			ck3D.addChangeListener(new ChangeListener() {
209
				public void stateChanged(ChangeEvent e) {
210
					// getPreviewChart().set3D(ck3D.isSelected());
211
					// getPreviewChart().repaint();
212
					// auxLegend.setIs3D(ck3D.isSelected());
213
				}
214

  
215
			});
216
		}
217
		return ck3D;
218
	}
219

  
220
	private JPanel getOutlinePanel() {
221
		if (outlinePanel == null) {
222
			jLabel = new JLabel();
223
			jLabel.setText(PluginServices.getText(this, "color"));
224
			outlinePanel = new JPanel();
225
			outlinePanel.setLayout(new BorderLayout());
226
			outlinePanel.setBorder(BorderFactory.createTitledBorder(null,
227
					PluginServices.getText(this, "Background"),
228
					TitledBorder.DEFAULT_JUSTIFICATION,
229
					TitledBorder.DEFAULT_POSITION, new Font("Dialog",
230
							Font.BOLD, 12), new Color(51, 51, 51)));
231
			outlinePanel.setPreferredSize(new Dimension(150, 115));
232
			outlinePanel.add(getJCheckBox(), BorderLayout.NORTH);
233
			outlinePanel.add(getJPanel(), BorderLayout.CENTER);
234
			//outlinePanel.add(getJPanel1(), BorderLayout.SOUTH);
235
		}
236
		return outlinePanel;
237
	}
238

  
239
	private JPanel getJPanel() {
240
		if (jPanel == null) {
241
			jPanel = new JPanel();
242
			jPanel.setLayout(new FlowLayout());
243
			jPanel.add(jLabel, null);
244
			jPanel.add(getColorButton(), null);
245
		}
246
		return jPanel;
247
	}
248

  
249
	private ColorChooserPanel getColorButton() {
250
		if (colorButton == null) {
251
			colorButton = new ColorChooserPanel(true);
252
			colorButton.setColor(Color.black);
253
			Dimension dim = colorButton.getPreferredSize();
254
			colorButton.setPreferredSize(new Dimension(dim.width-10, dim.height));
255
			colorButton.addActionListener(new ActionListener() {
256
				public void actionPerformed(ActionEvent e) {
257
					// getPreviewChart().setOutLineColor(colorButton.getColor());
258
					// getPreviewChart().repaint();
259
					auxLegend.setOutlineColor(colorButton.getColor());
260
				}
261
			});
262
		}
263
		return colorButton;
264
	}
265

  
266
	/**
267
	 * This method initializes jPanel1
268
	 * 
269
	 * @return javax.swing.JPanel
270
	 */
271
	private JPanel getJPanel1() {
272
		if (jPanel1 == null) {
273
			jLabel1 = new JLabel();
274
			jLabel1.setText(PluginServices.getText(this, "width"));
275
			jPanel1 = new JPanel();
276
			jPanel1.setLayout(new FlowLayout());
277
			jPanel1.add(jLabel1, null);
278
			jPanel1.add(getComboWidth(), null);
279
		}
280
		return jPanel1;
281
	}
282

  
283
	private JIncrementalNumberField getComboWidth() {
284
		if (comboWidth == null) {
285
			comboWidth = new JIncrementalNumberField(String.valueOf(1), 3,
286
					ValidatingTextField.INTEGER_VALIDATOR,
287
					ValidatingTextField.NUMBER_CLEANER, 0, Integer.MAX_VALUE, 1);
288
			comboWidth.addActionListener(new ActionListener() {
289
				public void actionPerformed(ActionEvent e) {
290
					// getPreviewChart().setOutlineWidth(comboWidth.getInteger());
291
					// getPreviewChart().repaint();
292
					auxLegend.setOutlineWidth(comboWidth.getInteger());
293
				}
294

  
295
			});
296
		}
297
		return comboWidth;
298
	}
299

  
300
	private JCheckBox getShowAxis() {
301
		if (jShowAxis == null) {
302
			jShowAxis = new JCheckBox();
303
			jShowAxis.setEnabled(false);
304
			jShowAxis.setText(PluginServices.getText(this, "show_axis"));
305
		}
306
		return jShowAxis;
307
	}
308
	
309
	private JCheckBox getJCheckBox() {
310
		if (jCheckBox == null) {
311
			jCheckBox = new JCheckBox();
312
			jCheckBox.setText(PluginServices.getText(this, "show"));
313
			jCheckBox.addChangeListener(new ChangeListener() {
314
				public void stateChanged(ChangeEvent e) {
315
					// getPreviewChart().setOutlineShow(jCheckBox.isSelected());
316
					// getPreviewChart().repaint();
317
					auxLegend.setOutlineShow(jCheckBox.isSelected());
318
				}
319

  
320
			});
321
		}
322
		return jCheckBox;
323
	}
324

  
325
	private JPanel getSouthPanel() {
326
		if (southPanel == null) {
327
			southPanel = new JPanel();
328
			southPanel.setLayout(new FlowLayout());
329
			southPanel.setPreferredSize(new Dimension(170, 50));
330
			southPanel.add(getSymbolPanel(), null);
331
			southPanel.add(getNorthPanel(), null);
332
			southPanel.add(getBSize(), null);
333
			southPanel.add(getCkOnlySelection(), null);
334
		}
335
		return southPanel;
336
	}
337

  
338
	private JPanel getSymbolPanel() {
339
		if (symbolPanel == null) {
340
			lBackgroundSymbol = new JLabel();
341
			lBackgroundSymbol.setText(PluginServices.getText(this,
342
					"background_symbol"));
343
			lBackgroundSymbol.setText(PluginServices.getText(this,
344
					"show_axis"));
345
			symbolPanel = new JPanel();
346
			symbolPanel.setLayout(new FlowLayout());
347
			symbolPanel.setPreferredSize(new Dimension(241, 40));
348
//			symbolPanel.add(lBackgroundSymbol, null);
349
//			symbolPanel.add(getBackgroundSymbol(), null);
350
			symbolPanel.add(getShowAxis(), null);
351
	
352
		}
353
		return symbolPanel;
354
	}
355

  
356
	// private PreviewPieSymbol getPreviewChart() {
357
	// if (previewPanel == null) {
358
	// previewPanel = new PreviewPieSymbol();
359
	// previewPanel.setLayout(new BorderLayout());
360
	// previewPanel.setBorder(BorderFactory.createTitledBorder(null,
361
	// PluginServices.getText(this, "preview_chart"),
362
	// TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new
363
	// Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51)));
364
	// previewPanel.setPreferredSize(new Dimension(150, 100));
365
	// }
366
	// return previewPanel;
367
	// }
368

  
369
	private JSymbolPreviewButton getBackgroundSymbol() {
370
		if (bSymbolBackground == null) {
371
			bSymbolBackground = new JSymbolPreviewButton(shapeType);
372
			bSymbolBackground.setPreferredSize(new Dimension(110, 20));
373
			bSymbolBackground.addActionListener(new ActionListener() {
374
				public void actionPerformed(ActionEvent e) {
375
					// getPreviewChart().setBackgroundSymbol(bSymbolBackground.getSymbol());
376
					// getPreviewChart().repaint();
377
				}
378
			});
379
		}
380
		return bSymbolBackground;
381
	}
382

  
383
	private JButton getBSize() {
384
		if (bSize == null) {
385
			bSize = new JButton();
386
			bSize.setText(PluginServices.getText(this, "size"));
387
			bSize.setPreferredSize(new Dimension(100, 30));
388
			bSize.setMaximumSize(new Dimension(100, 30));
389
			bSize.addActionListener(new ActionListener() {
390
				public void actionPerformed(ActionEvent e) {
391
					PluginServices.getMDIManager().addCentredWindow(
392
							new SizePanel(layer, auxLegend));
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff