Revision 47344

View differences:

tags/org.gvsig.desktop-2.0.423/org.gvsig.desktop.plugin/org.gvsig.geodb.app/org.gvsig.geodb.app.mainplugin/buildNumber.properties
1
#Sun Jun 18 23:15:17 CEST 2023
2
buildNumber=2975
0 3

  
tags/org.gvsig.desktop-2.0.423/org.gvsig.desktop.plugin/org.gvsig.geodb.app/org.gvsig.geodb.app.mainplugin/src/main/resources-plugin/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<!--
3

  
4
    gvSIG. Desktop Geographic Information System.
5

  
6
    Copyright (C) 2007-2013 gvSIG Association.
7

  
8
    This program is free software; you can redistribute it and/or
9
    modify it under the terms of the GNU General Public License
10
    as published by the Free Software Foundation; either version 3
11
    of the License, or (at your option) any later version.
12

  
13
    This program is distributed in the hope that it will be useful,
14
    but WITHOUT ANY WARRANTY; without even the implied warranty of
15
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
    GNU General Public License for more details.
17

  
18
    You should have received a copy of the GNU General Public License
19
    along with this program; if not, write to the Free Software
20
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21
    MA  02110-1301, USA.
22

  
23
    For any additional information, do not hesitate to contact us
24
    at info AT gvsig.com, or visit our website www.gvsig.com.
25

  
26
-->
27
<plugin-config>
28
    <alternativeNames name="org.gvsig.geodb"/>
29
    <libraries library-dir="lib"/>
30
    <depends plugin-name="org.gvsig.app.mainplugin"/>
31
    <depends plugin-name="org.gvsig.app.document.table.app.mainplugin" />
32
    <resourceBundle name="text"/>
33
    <extensions>
34
        <extension class-name="org.gvsig.geodb.ExtDB_Spatial"
35
                   description="Support to access Spatial databases"
36
                   active="true">
37
        </extension>		
38
    
39
        <extension class-name="org.gvsig.geodb.databaseworkspace.WorkspaceExtension"
40
                   description=""
41
                   active="true"
42
                   priority="1000">
43

  
44
            <action
45
                name="database-workspace-manage"
46
                label="_Manage_database_workspace"
47
                position="908500160"
48
                tooltip="_Manage_database_workspace"
49
                action-command="database-workspace-manage"
50
                icon="database-workspace-manage"
51
                accelerator=""
52
            />
53

  
54
            <action
55
                name="database-workspace-connect"
56
                label="_Connect_to_database_repository"
57
                position="108000000"
58
                tooltip="_Connect_to_database_repository"
59
                action-command="database-workspace-connect"
60
                icon="database-workspace-connect"
61
                accelerator=""
62
            />
63

  
64
            <menu
65
                name="database-workspace-connect"
66
                text="File/_Connect_to_database_repository"
67
            />
68
            <menu text="File/sep0_database_workspace"
69
                  position="108000001"
70
                  is_separator="true"
71
            />
72

  
73
            <menu
74
                name="database-workspace-manage"
75
                text="tools/Development/Manage database workspace"
76
            />
77
            <menu text="tools/Development/sep1_database_workspace"
78
                  position="908500161"
79
                  is_separator="true"/>
80

  
81
        </extension>
82

  
83
    </extensions>
84
    
85
</plugin-config>
0 86

  
tags/org.gvsig.desktop-2.0.423/org.gvsig.desktop.plugin/org.gvsig.geodb.app/org.gvsig.geodb.app.mainplugin/src/main/resources-plugin/about/prodevelop.html
1
<!--
2

  
3
    gvSIG. Desktop Geographic Information System.
4

  
5
    Copyright (C) 2007-2013 gvSIG Association.
6

  
7
    This program is free software; you can redistribute it and/or
8
    modify it under the terms of the GNU General Public License
9
    as published by the Free Software Foundation; either version 3
10
    of the License, or (at your option) any later version.
11

  
12
    This program is distributed in the hope that it will be useful,
13
    but WITHOUT ANY WARRANTY; without even the implied warranty of
14
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
    GNU General Public License for more details.
16

  
17
    You should have received a copy of the GNU General Public License
18
    along with this program; if not, write to the Free Software
19
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20
    MA  02110-1301, USA.
21

  
22
    For any additional information, do not hesitate to contact us
23
    at info AT gvsig.com, or visit our website www.gvsig.com.
24

  
25
-->
26
<html>
27
<body>
28

  
29
<img src="prodevelop-logo.png"><br>
30

  
31
<h2>PRODEVELOP</h2>
32
<br>
33

  
34
<p>EN CONSTRUCCION</p>
35

  
36
</body>
37
</html>
0 38

  
tags/org.gvsig.desktop-2.0.423/org.gvsig.desktop.plugin/org.gvsig.geodb.app/org.gvsig.geodb.app.mainplugin/src/main/resources-plugin/plugin-persistence.def
1
<?xml version="1.0"?>
2
<!--
3
Definitions of plugin persistence org.gvsig.geodb.  
4
 -->
5
<definitions>
6
  <version>1.0.0</version>
7
  <classes>
8
    <class name="org.gvsig.geodb.app.mainplugin">
9
      <description>plugin persistence org.gvsig.geodb</description>
10
      <fields>
11
        <field name="explorersPool" type="object" classOfValue="org.gvsig.fmap.dal.DataServerExplorerPool" mandatory="false">
12
          <description>Connections</description>
13
        </field>
14
        <field name="layersScaleVisibility" type="Map" classOfItems="org.gvsig.geodb.vectorialdb.visibility.LayerScaleVisibility" mandatory="false">
15
          <description>Layers scale visibility</description>
16
        </field>
17
      </fields>
18
    </class>
19
  </classes>
20
</definitions>  
tags/org.gvsig.desktop-2.0.423/org.gvsig.desktop.plugin/org.gvsig.geodb.app/org.gvsig.geodb.app.mainplugin/src/main/resources-plugin/i18n/text.properties
1
#Translations for language [es]
2
more_provider_parameters_needed_message=El driver seleccionado necesita par\u00e1metros adicionales.\nA continuaci\u00f3n se abrir\u00e1 el editor de propiedades avanzado.
3
more_provider_parameters_needed_title=Par\u00e1metros adicionales requeridos
4
_Advanced_properties=Propiedades avanzadas
5
_Get_view_extent=Capturar extensi\u00f3n de la vista
6
choose_connection=Elija conexi\u00f3n
7
choose_table=Elija tabla
8
connection_error=Error de conexi\u00f3n
9
table_fields=Columnas de la tabla
10
_All=Todos
11
_None=Ninguno
12
_Name=Nombre
13
_SQL_restriction=Restricci\u00f3n SQL
14
_Id_field=Campo ID
15
_Table_settings=Configuraci\u00f3n de tabla
16
_Working_area=\u00c1rea de trabajo
17
_Geo_field=Campo geom\u00e9trico
18
_Get_view_extent=Obtener \u00e1rea de la vista
19
_Schema=Esquema
20
_Host=Servidor
21
_Port=Puerto
22
_User=Usuario
23
_Password=Contrase\u00f1a
24
_Database=Base de datos
25
_Driver_type=Conector
26
_Connection_name=Nombre de conexi\u00f3n
27
_Connection_parameters=Par\u00e1metros de conexi\u00f3n
28
_Connected=Conectado
29
more_provider_parameters_needed_message=Hubo un problema con los par\u00e1metros. Se abrir\u00e1 el di\u00e1logo de propiedades avanzadas.
30
more_provider_parameters_needed_title=Faltan par\u00e1metros
31
_Unable_to_reproject_viewport_Default_bounds_used=No se han podido reproyectar los l\u00edmites de la vista. Se usan valores por defecto
32
_Viewport_bounds_reprojected_to_datasource_CRS=Se han reproyectado los l\u00edmites de la vista al CRS del origen de datos.
33
_Table_NAME_does_not_have_declared_PK=La tabla {0} no tiene clave primaria declarada en la BD
34
_If_layer_edited_saving_edits_will_not_be_possible=Si edita la capa, no ser\u00e1 posible salvar los cambios en la misma tabla
35
_Strange_behavior_if_selected_ID_not_unique_values=La capa tendr\u00e1 comportamiento extra\u00f1o si el campo elegido como ID no tiene valores \u00fanicos
36
_Remove_connection_parameters_from_list_question=\u00bfDesea eliminar de la lista los par\u00e1metros que han causado el problema?
37
_JDBCConecctionPanel_foother=Tenga en cuenta que el nombre de usuario y la  contrase\u00f1a deben coincidir en mayusculas y minusculas con el registrado en la base de dato.
38
delete=Borrar
39
1_25000_description=Esta escala es adecuada para presentar, por ejemplo, informaci\u00f3n de carreteras.
40
1_5000_description=Esta escala es adecuada para presentar informaci\u00f3n de una ciudad, como callejeros, u otra informaci\u00f3n relacionada con ella.
41
1_1000_description=Esta escala es adecuada para presentar informaci\u00f3n m\u00e1s precisa de una ciudad, como se\u00f1alizaci\u00f3n u otra informaci\u00f3n relacionada con ella.
42
dont_show_layer_when_scale=No mostrar la capa cuando la escala
43
is_below_1_colon=est\u00e9 por debajo de 1:
44
is_above_1_colon=est\u00e9 por encima de 1:
45
maximum_scale=Escala m\u00e1xima
46
minimum_scale=Escala m\u00ednima
47
_Remember_this_answer_for_future_times_when_this_layer_is_loaded=Recordar esta respuesta para futuras ocasiones en las que se cargue esta capa.
48
visibility_scale_selector_dialog_description=<html>Esta capa tiene m\u00e1s de {0} registros y es muy probable que precise especificar la escala de visualizaci\u00f3n para una representaci\u00f3n fluida.<br/>Por favor, seleccione la escala.</html>
49
_Remembered_layers_visibility=Visibilidad de capas recordada
50
_Visibility_scales_remembered_for_the_following_layers=Escalas de visibilidad recordadas para las siguientes capas
51
_Read_only=Solo lectura
52
_View=Vista
53
_Geometry_field_required=Es necesario especificar el campo para la geometr\u00eda
54
_Geometry_field_recommended=Es recomendable especificar el campo para la geometr\u00eda
55
_GeometryType_required=Es necesario especificar el tipo de la geometr\u00eda
56
_GeometryType_recommended=Es recomendable especificar el tipo de la geometr\u00eda
57
_GeometrySubType_required=Es necesario especificar el subtipo de la geometr\u00eda
58
_GeometrySubType_recommended=Es recomendable especificar el subtipo de la geometr\u00eda
59
_Projection_required=Es necesario especificar la proyecci\u00f3n
60
_Projection_recommended=Es recomendable especificar la proyecci\u00f3n
61
_PrimaryKey_field_required=Es necesario especificar la clave primaria
62
_PrimaryKey_field_recommended=Es recomendable especificar la clave primaria
63
_Do_not_assign_a_display_scale=No asignarle una escala de visualizaci\u00f3n
64
_Do_not_ask_the_scale_again=No volver a preguntar la escala.
65
_The_name_of_some_tables_of_the_repository_coincide_with_those_of_another_repository_already_registered=El nombre de algunas tablas del repositorio coincide con las de otro repositorio ya registrado.
66
_If_you_connect_to_this_repository_and_have_tables_or_layers_loaded_from_the_previous_repository_you_may_notice_inconsistencies_in_the_data=Si se conecta con este repositorio y tiene tablas o capas cargadas del repositorio anterior puede notar inconsistencias en los datos.
67
_Do_you_want_to_connect_with_the_current_repository_anyway=\u00bfDesea conectarse con el repositorio actual de todos modos?
68
_Select_visibility_scale=Seleccionar escala de visualizaci\u00f3n
0 69

  
tags/org.gvsig.desktop-2.0.423/org.gvsig.desktop.plugin/org.gvsig.geodb.app/org.gvsig.geodb.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties
1
#Translations for language [en]
2
more_provider_parameters_needed_message=The selected driver requires more additional parameters.\nNext the advanced properties editor will be opened.
3
more_provider_parameters_needed_title=More parameters required
4
_Advanced_properties=Advanced properties
5
_Get_view_extent=Get view extent
6
choose_connection=Choose connection
7
choose_table=Choose table
8
connection_error=Connection error
9
table_fields=Table fields
10
_All=All
11
_None=None
12
_Name=Name
13
_SQL_restriction=SQL restriction
14
_Id_field=ID field
15
_Table_settings=Table settings
16
_Working_area=Working area
17
_Geo_field=Geometry field
18
_Get_view_extent=Get view extent
19
_Schema=Schema
20
_Host=Host
21
_Port=Port
22
_User=User
23
_Password=Password
24
_Database=Database
25
_Driver_type=Driver
26
_Connection_name=Connection name
27
_Connection_parameters=Connection parameters
28
_Connected=Connected
29
more_provider_parameters_needed_message=There was a problem with parameters. Advanced properties dialog will now open.
30
more_provider_parameters_needed_title=Missing parameters
31
_Unable_to_reproject_viewport_Default_bounds_used=Unable to reproject viewport bounds. Default values used
32
_Viewport_bounds_reprojected_to_datasource_CRS=Viewport bounds were reprojected to CRS of datasource
33
_Table_NAME_does_not_have_declared_PK=The table {0} does not have a declared primary key in the DB
34
_If_layer_edited_saving_edits_will_not_be_possible=If layer is edited, saving edits will not be possible
35
_Strange_behavior_if_selected_ID_not_unique_values=The layer will have strange behavior if field selected as ID does not have unique values
36
_Remove_connection_parameters_from_list_question=Do you wish to remove the offending parameters from the list?
37
_JDBCConecctionPanel_foother=Note that the user name and password must match case sensitive with that recorded in the data base.
38
delete=Delete
39
1_25000_description=This scale is suitable for displaying, for example, road information.
40
1_5000_description=This scale is suitable for presenting information about a city, such as street maps, or other information related to it.
41
1_1000_description=This scale is suitable for presenting more accurate information about a city, such as signage or other information related to it.
42
dont_show_layer_when_scale_colon=Don't show layer when:
43
is_below_1_colon=is below 1:
44
is_above_1_colon=is above 1:
45
maximum_scale=Maximum scale
46
minimum_scale=Minimum scale
47
_Remember_this_answer_for_future_times_when_this_layer_is_loaded=Remember this answer for future occasions when this layer will load.
48
visibility_scale_selector_dialog_description=<html>This layer has more than {0} records and it is very likely that you will need to specify the display scale for a fluid representation.<br/>Please select the scale.</html>
49
_Remembered_layers_visibility=Remembered layers visibility
50
_Visibility_scales_remembered_for_the_following_layers=Visibility scales remembered for the following layers
51
_Read_only=Read-only
52
_View=View
53
_Geometry_field_required=Geometry field required
54
_Geometry_field_recommended=Geometry field recommended
55
_GeometryType_required=GeometryType required
56
_GeometryType_recommended=GeometryType recommended
57
_GeometrySubType_required=GeometrySubType required
58
_GeometrySubType_recommended=GeometrySubType recommended
59
_Projection_required=Projection required
60
_Projection_recommended=Projection recommended
61
_PrimaryKey_field_required=PrimaryKey field required
62
_PrimaryKey_field_recommended=PrimaryKey field recommended
63
_Do_not_assign_a_display_scale=Do not assign a display scale
64
_Do_not_ask_the_scale_again=Do not ask the scale again.
65
_The_name_of_some_tables_of_the_repository_coincide_with_those_of_another_repository_already_registered=The name of some tables of the repository coincide with those of another repository already registered.
66
_If_you_connect_to_this_repository_and_have_tables_or_layers_loaded_from_the_previous_repository_you_may_notice_inconsistencies_in_the_data=If you connect to this repository and have tables or layers loaded from the previous repository you may notice inconsistencies in the data.
67
_Do_you_want_to_connect_with_the_current_repository_anyway=Do you want to connect with the current repository anyway?
68
_Select_visibility_scale=Select visibility scale
0 69

  
tags/org.gvsig.desktop-2.0.423/org.gvsig.desktop.plugin/org.gvsig.geodb.app/org.gvsig.geodb.app.mainplugin/src/main/assembly/gvsig-plugin-package.xml
1
<!--
2

  
3
    gvSIG. Desktop Geographic Information System.
4

  
5
    Copyright (C) 2007-2013 gvSIG Association.
6

  
7
    This program is free software; you can redistribute it and/or
8
    modify it under the terms of the GNU General Public License
9
    as published by the Free Software Foundation; either version 3
10
    of the License, or (at your option) any later version.
11

  
12
    This program is distributed in the hope that it will be useful,
13
    but WITHOUT ANY WARRANTY; without even the implied warranty of
14
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
    GNU General Public License for more details.
16

  
17
    You should have received a copy of the GNU General Public License
18
    along with this program; if not, write to the Free Software
19
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20
    MA  02110-1301, USA.
21

  
22
    For any additional information, do not hesitate to contact us
23
    at info AT gvsig.com, or visit our website www.gvsig.com.
24

  
25
-->
26
<assembly>
27
  <id>gvsig-plugin-package</id>
28
  <formats>
29
    <format>zip</format>
30
  </formats>
31
  <baseDirectory>${project.artifactId}</baseDirectory>
32
  <includeBaseDirectory>true</includeBaseDirectory>
33
  <files>
34
    <file>
35
      <source>target/${project.artifactId}-${project.version}.jar</source>
36
      <outputDirectory>lib</outputDirectory>
37
    </file>
38
    <file>
39
      <source>target/package.info</source>
40
    </file>
41
  </files>
42

  
43
  <fileSets>
44
    <fileSet>
45
      <directory>src/main/resources-plugin</directory>
46
      <outputDirectory>.</outputDirectory>
47
    </fileSet>
48
  </fileSets>
49

  
50
  <dependencySets>
51
    <dependencySet>
52
      <useProjectArtifact>false</useProjectArtifact>
53
      <useTransitiveDependencies>false</useTransitiveDependencies>
54
      <outputDirectory>lib</outputDirectory>
55
      <includes>
56
		<include>commons-collections:commons-collections</include>
57
	  </includes>
58
    </dependencySet>
59
  </dependencySets>
60

  
61
</assembly>
62

  
0 63

  
tags/org.gvsig.desktop-2.0.423/org.gvsig.desktop.plugin/org.gvsig.geodb.app/org.gvsig.geodb.app.mainplugin/src/main/java/org/gvsig/geodb/AbstractWizardDBView.java
1
package org.gvsig.geodb;
2

  
3
import com.jeta.forms.components.border.TitledBorderLabel;
4
import com.jeta.open.i18n.I18NUtils;
5
import com.jgoodies.forms.layout.CellConstraints;
6
import com.jgoodies.forms.layout.FormLayout;
7
import java.awt.BorderLayout;
8
import java.awt.ComponentOrientation;
9
import java.awt.Container;
10
import java.awt.Dimension;
11
import javax.swing.Box;
12
import javax.swing.ImageIcon;
13
import javax.swing.JButton;
14
import javax.swing.JComboBox;
15
import javax.swing.JFrame;
16
import javax.swing.JLabel;
17
import javax.swing.JList;
18
import javax.swing.JPanel;
19
import javax.swing.JScrollPane;
20
import javax.swing.JTextField;
21
import javax.swing.border.EmptyBorder;
22

  
23

  
24
public class AbstractWizardDBView extends JPanel
25
{
26
   TitledBorderLabel lblConnection = new TitledBorderLabel();
27
   JComboBox cboConnection = new JComboBox();
28
   JButton btnConnection = new JButton();
29
   JList lstTables = new JList();
30
   JButton btnDeselectAllColumns = new JButton();
31
   JButton btnSelectAllColumns = new JButton();
32
   TitledBorderLabel lblTable = new TitledBorderLabel();
33
   TitledBorderLabel lblColumns = new TitledBorderLabel();
34
   JList lstColumns = new JList();
35
   JButton btnTablesFilter = new JButton();
36
   JTextField txtTablesFilter = new JTextField();
37
   JLabel lblName = new JLabel();
38
   JTextField txtName = new JTextField();
39
   JLabel lblIdField = new JLabel();
40
   JComboBox cboIdField = new JComboBox();
41
   JLabel lblGeometryField = new JLabel();
42
   JComboBox cboGeometryField = new JComboBox();
43
   JLabel lblProjection = new JLabel();
44
   JTextField txtProjection = new JTextField();
45
   JButton btnProjection = new JButton();
46
   JButton btnChangeViewProjection = new JButton();
47
   JLabel lblFilter = new JLabel();
48
   JTextField txtFilter = new JTextField();
49
   JButton btnFilter = new JButton();
50
   JButton btnFilterBookmarks = new JButton();
51
   JButton btnFilterHistory = new JButton();
52
   JButton btnAdvancedProperties = new JButton();
53
   JLabel lblReadOnlyNotification = new JLabel();
54
   JPanel pnlCfgActions = new JPanel();
55

  
56
   /**
57
    * Default constructor
58
    */
59
   public AbstractWizardDBView()
60
   {
61
      initializePanel();
62
   }
63

  
64
   /**
65
    * Adds fill components to empty cells in the first row and first column of the grid.
66
    * This ensures that the grid spacing will be the same as shown in the designer.
67
    * @param cols an array of column indices in the first row where fill components should be added.
68
    * @param rows an array of row indices in the first column where fill components should be added.
69
    */
70
   void addFillComponents( Container panel, int[] cols, int[] rows )
71
   {
72
      Dimension filler = new Dimension(10,10);
73

  
74
      boolean filled_cell_11 = false;
75
      CellConstraints cc = new CellConstraints();
76
      if ( cols.length > 0 && rows.length > 0 )
77
      {
78
         if ( cols[0] == 1 && rows[0] == 1 )
79
         {
80
            /** add a rigid area  */
81
            panel.add( Box.createRigidArea( filler ), cc.xy(1,1) );
82
            filled_cell_11 = true;
83
         }
84
      }
85

  
86
      for( int index = 0; index < cols.length; index++ )
87
      {
88
         if ( cols[index] == 1 && filled_cell_11 )
89
         {
90
            continue;
91
         }
92
         panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) );
93
      }
94

  
95
      for( int index = 0; index < rows.length; index++ )
96
      {
97
         if ( rows[index] == 1 && filled_cell_11 )
98
         {
99
            continue;
100
         }
101
         panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) );
102
      }
103

  
104
   }
105

  
106
   /**
107
    * Helper method to load an image file from the CLASSPATH
108
    * @param imageName the package and name of the file to load relative to the CLASSPATH
109
    * @return an ImageIcon instance with the specified image file
110
    * @throws IllegalArgumentException if the image resource cannot be loaded.
111
    */
112
   public ImageIcon loadImage( String imageName )
113
   {
114
      try
115
      {
116
         ClassLoader classloader = getClass().getClassLoader();
117
         java.net.URL url = classloader.getResource( imageName );
118
         if ( url != null )
119
         {
120
            ImageIcon icon = new ImageIcon( url );
121
            return icon;
122
         }
123
      }
124
      catch( Exception e )
125
      {
126
         e.printStackTrace();
127
      }
128
      throw new IllegalArgumentException( "Unable to load image: " + imageName );
129
   }
130

  
131
   /**
132
    * Method for recalculating the component orientation for 
133
    * right-to-left Locales.
134
    * @param orientation the component orientation to be applied
135
    */
136
   public void applyComponentOrientation( ComponentOrientation orientation )
137
   {
138
      // Not yet implemented...
139
      // I18NUtils.applyComponentOrientation(this, orientation);
140
      super.applyComponentOrientation(orientation);
141
   }
142

  
143
   public JPanel createPanel()
144
   {
145
      JPanel jpanel1 = new JPanel();
146
      FormLayout formlayout1 = new FormLayout("FILL:4DLU:NONE,FILL:8DLU:GROW(1.0),FILL:4DLU:NONE","CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:2DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE");
147
      CellConstraints cc = new CellConstraints();
148
      jpanel1.setLayout(formlayout1);
149

  
150
      lblConnection.setName("lblConnection");
151
      lblConnection.setText("_Connection");
152
      jpanel1.add(lblConnection,cc.xy(2,1));
153

  
154
      jpanel1.add(createPanel1(),cc.xy(2,3));
155
      jpanel1.add(createPanel2(),cc.xy(2,6));
156
      jpanel1.add(createPanel5(),cc.xy(2,9));
157
      jpanel1.add(createPanel8(),cc.xy(2,11));
158
      addFillComponents(jpanel1,new int[]{ 1,3 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12 });
159
      return jpanel1;
160
   }
161

  
162
   public JPanel createPanel1()
163
   {
164
      JPanel jpanel1 = new JPanel();
165
      FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE,FILL:DEFAULT:NONE","CENTER:DEFAULT:NONE");
166
      CellConstraints cc = new CellConstraints();
167
      jpanel1.setLayout(formlayout1);
168

  
169
      cboConnection.setName("cboConnection");
170
      jpanel1.add(cboConnection,cc.xy(1,1));
171

  
172
      btnConnection.setActionCommand("...");
173
      btnConnection.setName("btnConnection");
174
      btnConnection.setOpaque(false);
175
      btnConnection.setText("...");
176
      EmptyBorder emptyborder1 = new EmptyBorder(2,2,2,2);
177
      btnConnection.setBorder(emptyborder1);
178
      jpanel1.add(btnConnection,cc.xy(3,1));
179

  
180
      addFillComponents(jpanel1,new int[]{ 2 },new int[0]);
181
      return jpanel1;
182
   }
183

  
184
   public JPanel createPanel2()
185
   {
186
      JPanel jpanel1 = new JPanel();
187
      FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:GROW(0.5),FILL:4DLU:NONE,FILL:DEFAULT:GROW(0.5)","CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:2DLU:NONE,CENTER:DEFAULT:NONE");
188
      CellConstraints cc = new CellConstraints();
189
      jpanel1.setLayout(formlayout1);
190

  
191
      lstTables.setName("lstTables");
192
      JScrollPane jscrollpane1 = new JScrollPane();
193
      jscrollpane1.setViewportView(lstTables);
194
      jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
195
      jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
196
      jpanel1.add(jscrollpane1,cc.xywh(1,5,1,3));
197

  
198
      jpanel1.add(createPanel3(),cc.xy(3,7));
199
      lblTable.setName("lblTable");
200
      lblTable.setText("choose_table");
201
      jpanel1.add(lblTable,cc.xy(1,1));
202

  
203
      lblColumns.setName("lblColumns");
204
      lblColumns.setText("table_fields");
205
      jpanel1.add(lblColumns,cc.xy(3,1));
206

  
207
      lstColumns.setName("lstColumns");
208
      JScrollPane jscrollpane2 = new JScrollPane();
209
      jscrollpane2.setViewportView(lstColumns);
210
      jscrollpane2.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
211
      jscrollpane2.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
212
      jpanel1.add(jscrollpane2,cc.xywh(3,3,1,3));
213

  
214
      jpanel1.add(createPanel4(),cc.xy(1,3));
215
      addFillComponents(jpanel1,new int[]{ 2 },new int[]{ 2,3,4,6,7 });
216
      return jpanel1;
217
   }
218

  
219
   public JPanel createPanel3()
220
   {
221
      JPanel jpanel1 = new JPanel();
222
      FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:GROW(1.0),FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE","CENTER:DEFAULT:NONE");
223
      CellConstraints cc = new CellConstraints();
224
      jpanel1.setLayout(formlayout1);
225

  
226
      btnDeselectAllColumns.setActionCommand("Ninguno");
227
      btnDeselectAllColumns.setName("btnDeselectAllColumns");
228
      btnDeselectAllColumns.setOpaque(false);
229
      btnDeselectAllColumns.setText("_None");
230
      EmptyBorder emptyborder1 = new EmptyBorder(2,2,2,2);
231
      btnDeselectAllColumns.setBorder(emptyborder1);
232
      jpanel1.add(btnDeselectAllColumns,cc.xy(4,1));
233

  
234
      btnSelectAllColumns.setActionCommand("Todos");
235
      btnSelectAllColumns.setName("btnSelectAllColumns");
236
      btnSelectAllColumns.setOpaque(false);
237
      btnSelectAllColumns.setText("_All");
238
      EmptyBorder emptyborder2 = new EmptyBorder(2,2,2,2);
239
      btnSelectAllColumns.setBorder(emptyborder2);
240
      jpanel1.add(btnSelectAllColumns,cc.xy(2,1));
241

  
242
      addFillComponents(jpanel1,new int[]{ 1,3 },new int[]{ 1 });
243
      return jpanel1;
244
   }
245

  
246
   public JPanel createPanel4()
247
   {
248
      JPanel jpanel1 = new JPanel();
249
      FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE,FILL:DEFAULT:NONE","CENTER:DEFAULT:NONE");
250
      CellConstraints cc = new CellConstraints();
251
      jpanel1.setLayout(formlayout1);
252

  
253
      btnTablesFilter.setActionCommand("...");
254
      btnTablesFilter.setName("btnTablesFilter");
255
      btnTablesFilter.setText("...");
256
      EmptyBorder emptyborder1 = new EmptyBorder(2,2,2,2);
257
      btnTablesFilter.setBorder(emptyborder1);
258
      jpanel1.add(btnTablesFilter,cc.xy(3,1));
259

  
260
      txtTablesFilter.setName("txtTablesFilter");
261
      jpanel1.add(txtTablesFilter,cc.xy(1,1));
262

  
263
      addFillComponents(jpanel1,new int[]{ 2 },new int[0]);
264
      return jpanel1;
265
   }
266

  
267
   public JPanel createPanel5()
268
   {
269
      JPanel jpanel1 = new JPanel();
270
      FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:GROW(1.0)","CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE");
271
      CellConstraints cc = new CellConstraints();
272
      jpanel1.setLayout(formlayout1);
273

  
274
      lblName.setName("lblName");
275
      lblName.setText("_Name");
276
      jpanel1.add(lblName,cc.xy(1,2));
277

  
278
      txtName.setName("txtName");
279
      jpanel1.add(txtName,cc.xy(3,2));
280

  
281
      lblIdField.setName("lblIdField");
282
      lblIdField.setText("_Id_field");
283
      jpanel1.add(lblIdField,cc.xy(1,4));
284

  
285
      cboIdField.setName("cboIdField");
286
      jpanel1.add(cboIdField,cc.xy(3,4));
287

  
288
      lblGeometryField.setName("lblGeometryField");
289
      lblGeometryField.setText("_Geo_field");
290
      jpanel1.add(lblGeometryField,cc.xy(1,6));
291

  
292
      cboGeometryField.setName("cboGeometryField");
293
      jpanel1.add(cboGeometryField,cc.xy(3,6));
294

  
295
      lblProjection.setName("lblProjection");
296
      lblProjection.setText("_Projection");
297
      jpanel1.add(lblProjection,cc.xy(1,8));
298

  
299
      jpanel1.add(createPanel6(),cc.xy(3,8));
300
      lblFilter.setName("lblFilter");
301
      lblFilter.setText("_Filter");
302
      jpanel1.add(lblFilter,cc.xy(1,10));
303

  
304
      jpanel1.add(createPanel7(),cc.xy(3,10));
305
      addFillComponents(jpanel1,new int[]{ 1,2,3 },new int[]{ 1,3,5,7,9 });
306
      return jpanel1;
307
   }
308

  
309
   public JPanel createPanel6()
310
   {
311
      JPanel jpanel1 = new JPanel();
312
      FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE","FILL:DEFAULT:NONE");
313
      CellConstraints cc = new CellConstraints();
314
      jpanel1.setLayout(formlayout1);
315

  
316
      txtProjection.setName("txtProjection");
317
      jpanel1.add(txtProjection,cc.xy(1,1));
318

  
319
      btnProjection.setActionCommand("...");
320
      btnProjection.setName("btnProjection");
321
      btnProjection.setOpaque(false);
322
      btnProjection.setText("...");
323
      EmptyBorder emptyborder1 = new EmptyBorder(2,2,2,2);
324
      btnProjection.setBorder(emptyborder1);
325
      jpanel1.add(btnProjection,cc.xy(3,1));
326

  
327
      btnChangeViewProjection.setActionCommand("...");
328
      btnChangeViewProjection.setIcon(loadImage("datos/devel/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.geodb.app/org.gvsig.geodb.app.mainplugin/src/main/resources-plugin/images/geodb/geodb-crstoview.png"));
329
      btnChangeViewProjection.setName("btnChangeViewProjection");
330
      btnChangeViewProjection.setOpaque(false);
331
      btnChangeViewProjection.setToolTipText("_Change_view_projection_to_this_projection");
332
      EmptyBorder emptyborder2 = new EmptyBorder(2,2,2,2);
333
      btnChangeViewProjection.setBorder(emptyborder2);
334
      jpanel1.add(btnChangeViewProjection,cc.xy(5,1));
335

  
336
      addFillComponents(jpanel1,new int[]{ 2,4 },new int[0]);
337
      return jpanel1;
338
   }
339

  
340
   public JPanel createPanel7()
341
   {
342
      JPanel jpanel1 = new JPanel();
343
      FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE","CENTER:DEFAULT:NONE");
344
      CellConstraints cc = new CellConstraints();
345
      jpanel1.setLayout(formlayout1);
346

  
347
      txtFilter.setName("txtFilter");
348
      jpanel1.add(txtFilter,cc.xy(1,1));
349

  
350
      btnFilter.setActionCommand("...");
351
      btnFilter.setName("btnFilter");
352
      btnFilter.setOpaque(false);
353
      btnFilter.setText("...");
354
      EmptyBorder emptyborder1 = new EmptyBorder(2,2,2,2);
355
      btnFilter.setBorder(emptyborder1);
356
      jpanel1.add(btnFilter,cc.xy(3,1));
357

  
358
      btnFilterBookmarks.setActionCommand("...");
359
      btnFilterBookmarks.setName("btnFilterBookmarks");
360
      btnFilterBookmarks.setOpaque(false);
361
      btnFilterBookmarks.setText("...");
362
      EmptyBorder emptyborder2 = new EmptyBorder(2,2,2,2);
363
      btnFilterBookmarks.setBorder(emptyborder2);
364
      jpanel1.add(btnFilterBookmarks,cc.xy(7,1));
365

  
366
      btnFilterHistory.setActionCommand("...");
367
      btnFilterHistory.setName("btnFilterHistory");
368
      btnFilterHistory.setOpaque(false);
369
      btnFilterHistory.setText("...");
370
      EmptyBorder emptyborder3 = new EmptyBorder(2,2,2,2);
371
      btnFilterHistory.setBorder(emptyborder3);
372
      jpanel1.add(btnFilterHistory,cc.xy(5,1));
373

  
374
      addFillComponents(jpanel1,new int[]{ 2,4,6 },new int[0]);
375
      return jpanel1;
376
   }
377

  
378
   public JPanel createPanel8()
379
   {
380
      JPanel jpanel1 = new JPanel();
381
      FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:GROW(1.0),FILL:DEFAULT:NONE,FILL:DEFAULT:NONE","CENTER:DEFAULT:NONE");
382
      CellConstraints cc = new CellConstraints();
383
      jpanel1.setLayout(formlayout1);
384

  
385
      btnAdvancedProperties.setActionCommand("_Advanced_properties");
386
      btnAdvancedProperties.setName("btnAdvancedProperties");
387
      btnAdvancedProperties.setText("_Advanced_properties");
388
      jpanel1.add(btnAdvancedProperties,cc.xy(2,1));
389

  
390
      lblReadOnlyNotification.setName("lblReadOnlyNotification");
391
      jpanel1.add(lblReadOnlyNotification,new CellConstraints(1,1,1,1,CellConstraints.LEFT,CellConstraints.TOP));
392

  
393
      pnlCfgActions.setName("pnlCfgActions");
394
      jpanel1.add(pnlCfgActions,cc.xy(3,1));
395

  
396
      addFillComponents(jpanel1,new int[0],new int[0]);
397
      return jpanel1;
398
   }
399

  
400
   /**
401
    * Initializer
402
    */
403
   protected void initializePanel()
404
   {
405
      setLayout(new BorderLayout());
406
      add(createPanel(), BorderLayout.CENTER);
407
   }
408

  
409

  
410
}
tags/org.gvsig.desktop-2.0.423/org.gvsig.desktop.plugin/org.gvsig.geodb.app/org.gvsig.geodb.app.mainplugin/src/main/java/org/gvsig/geodb/TableInfoController.java
1
package org.gvsig.geodb;
2

  
3
import java.awt.BorderLayout;
4
import java.awt.Cursor;
5
import java.awt.event.ActionEvent;
6
import java.awt.event.ItemEvent;
7
import javax.swing.AbstractAction;
8
import javax.swing.DefaultComboBoxModel;
9
import javax.swing.DefaultListModel;
10
import javax.swing.DefaultListSelectionModel;
11
import javax.swing.JButton;
12
import javax.swing.JCheckBox;
13
import javax.swing.JComboBox;
14
import javax.swing.JComponent;
15
import javax.swing.JLabel;
16
import javax.swing.JList;
17
import javax.swing.JTextField;
18
import javax.swing.event.ChangeEvent;
19
import javax.swing.event.ChangeListener;
20
import org.apache.commons.lang.BooleanUtils;
21
import org.apache.commons.lang3.StringUtils;
22
import org.cresques.cts.IProjection;
23
import org.gvsig.configurableactions.ConfigurableActionsMamager;
24
import org.gvsig.expressionevaluator.swing.ExpressionEvaluatorSwingLocator;
25
import org.gvsig.expressionevaluator.swing.ExpressionEvaluatorSwingManager;
26
import org.gvsig.expressionevaluator.swing.ExpressionPickerController;
27
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
28
import org.gvsig.fmap.dal.feature.FeatureType;
29
import org.gvsig.fmap.dal.store.jdbc.JDBCStoreParameters;
30
import org.gvsig.fmap.dal.swing.DALSwingLocator;
31
import org.gvsig.fmap.dal.swing.DataSwingManager;
32
import org.gvsig.fmap.dal.swing.ProjectionPickerController;
33
import org.gvsig.fmap.dal.swing.dataStoreParameters.DataStoreParametersPanel;
34
import org.gvsig.fmap.dal.swing.dataStoreParameters.DataStoreParametersPanelManager;
35
import org.gvsig.fmap.geom.Geometry;
36
import org.gvsig.fmap.mapcontext.MapContext;
37
import org.gvsig.tools.ToolsLocator;
38
import org.gvsig.tools.i18n.I18nManager;
39
import org.gvsig.tools.locator.LocatorException;
40
import org.gvsig.tools.swing.api.ChangeListenerHelper;
41
import org.gvsig.tools.swing.api.ChangeListenerSupport;
42
import org.gvsig.tools.swing.api.JListWithCheckbox;
43
import org.gvsig.tools.swing.api.SupportIsEnable;
44
import org.gvsig.tools.swing.api.ToolsSwingLocator;
45
import org.gvsig.tools.swing.api.ToolsSwingManager;
46
import org.gvsig.tools.swing.api.windowmanager.Dialog;
47
import org.gvsig.tools.swing.api.windowmanager.WindowManager;
48
import org.gvsig.tools.swing.api.windowmanager.WindowManager_v2;
49
import org.gvsig.tools.util.ToolsUtilLocator;
50

  
51
/**
52
 *
53
 * @author fdiaz
54
 */
55
public class TableInfoController implements SupportIsEnable, ChangeListenerSupport {
56

  
57
    public static final String CONFIGURABLE_PANEL_ID = "TableInfoController";
58
    private final ChangeListenerHelper changeListener;
59
    private JCheckBox chkVisible;
60

  
61
    public static class RemoveDALInformationAction extends AbstractAction {
62

  
63
        @SuppressWarnings("OverridableMethodCallInConstructor")
64
        public RemoveDALInformationAction() {
65
            I18nManager i18n = ToolsLocator.getI18nManager();
66

  
67
            this.putValue(NAME, i18n.getTranslation("_Remove_metadata"));
68
            this.putValue(ACTION_COMMAND_KEY, "RemoveDALInformation");
69
        }
70

  
71
        @Override
72
        public Object getValue(String key) {
73
            if (NAME.equals(key)) {
74
                // Cuando se registra la accion aun no se han cargado las traducciones
75
                I18nManager i18n = ToolsLocator.getI18nManager();
76
                return i18n.getTranslation("_Remove_metadata");
77
            }
78
            return super.getValue(key);
79
        }
80

  
81
        @Override
82
        public void actionPerformed(ActionEvent e) {
83
            TableInfoController controller = (TableInfoController) e.getSource();
84
            final TableInfo info = controller.getCurrentTableInfo();
85
            if (info == null) {
86
                return;
87
            }
88
            controller.fetch(info);
89
            info.removeDALInfo();
90
            controller.put(info);
91
        }
92

  
93
    }
94

  
95
    private final JButton btnDeselectAllColumns;
96
    private final JButton btnSelectAllColumns;
97
    private final JList lstColumns;
98
    private final JTextField txtName;
99
    private final JComboBox cboIdField;
100
    private final JComboBox cboGeometryField;
101
    private final JTextField txtProjection;
102
    private final JButton btnProjection;
103
    private final JTextField txtFilter;
104
    private final JButton btnFilter;
105
    private final JButton btnFilterBookmarks;
106
    private final JButton btnFilterHistory;
107
    private final JButton btnAdvancedProperties;
108
    private final JLabel lblReadOnlyNotification;
109
    private JListWithCheckbox lwcColumns;
110
    private ProjectionPickerController pickerProjection;
111
    private ExpressionPickerController pickerFilter;
112
    private TableInfo tableInfo;
113
    private final JComponent pnlCfgActions;
114
    private final JButton btnChangeViewProjection;
115

  
116
    private MapContext mapContext;
117

  
118
    public TableInfoController(
119
            JButton btnDeselectAllColumns,
120
            JButton btnSelectAllColumns,
121
            JList lstColumns,
122
            JTextField txtName,
123
            JComboBox cboIdField,
124
            JComboBox cboGeometryField,
125
            JTextField txtProjection,
126
            JButton btnProjection,
127
            JTextField txtFilter,
128
            JButton btnFilter,
129
            JButton btnFilterBookmarks,
130
            JButton btnFilterHistory,
131
            JButton btnAdvancedProperties,
132
            JLabel lblReadOnlyNotification,
133
            JComponent pnlCfgActions,
134
            JButton btnChangeViewProjection
135
    ) {
136
        this(
137
                btnDeselectAllColumns, 
138
                btnSelectAllColumns, 
139
                lstColumns, 
140
                txtName, 
141
                cboIdField, 
142
                cboGeometryField, 
143
                txtProjection, 
144
                btnProjection, 
145
                txtFilter, 
146
                btnFilter, 
147
                btnFilterBookmarks, 
148
                btnFilterHistory, 
149
                btnAdvancedProperties, 
150
                lblReadOnlyNotification, 
151
                pnlCfgActions, 
152
                btnChangeViewProjection, 
153
                null
154
        );
155
    }
156
    
157
    public TableInfoController(
158
            JButton btnDeselectAllColumns,
159
            JButton btnSelectAllColumns,
160
            JList lstColumns,
161
            JTextField txtName,
162
            JComboBox cboIdField,
163
            JComboBox cboGeometryField,
164
            JTextField txtProjection,
165
            JButton btnProjection,
166
            JTextField txtFilter,
167
            JButton btnFilter,
168
            JButton btnFilterBookmarks,
169
            JButton btnFilterHistory,
170
            JButton btnAdvancedProperties,
171
            JLabel lblReadOnlyNotification,
172
            JComponent pnlCfgActions,
173
            JButton btnChangeViewProjection,
174
            JCheckBox chkVisible
175
    ) {
176

  
177
        this.btnDeselectAllColumns = btnDeselectAllColumns;
178
        this.btnSelectAllColumns = btnSelectAllColumns;
179
        this.lstColumns = lstColumns;
180
        this.txtName = txtName;
181
        this.cboIdField = cboIdField;
182
        this.cboGeometryField = cboGeometryField;
183
        this.txtProjection = txtProjection;
184
        this.btnProjection = btnProjection;
185
        this.txtFilter = txtFilter;
186
        this.btnFilter = btnFilter;
187
        this.btnFilterBookmarks = btnFilterBookmarks;
188
        this.btnFilterHistory = btnFilterHistory;
189
        this.btnAdvancedProperties = btnAdvancedProperties;
190
        this.lblReadOnlyNotification = lblReadOnlyNotification;
191
        this.pnlCfgActions = pnlCfgActions;
192
        if( btnChangeViewProjection == null ) {
193
            this.btnChangeViewProjection = new JButton();
194
        } else {
195
            this.btnChangeViewProjection = btnChangeViewProjection;
196
        }
197
        if( chkVisible==null ) {
198
            this.chkVisible = new JCheckBox();
199
        } else {
200
            this.chkVisible = chkVisible;
201
        }
202
        this.changeListener = ToolsSwingLocator.getToolsSwingManager().createChangeListenerHelper();
203

  
204
        initComponents();
205
    }
206

  
207
    private void initComponents() {
208
        DataSwingManager dataSwingManager = DALSwingLocator.getDataSwingManager();
209
        ToolsSwingManager toolsSwingManager = ToolsSwingLocator.getToolsSwingManager();
210
        ExpressionEvaluatorSwingManager expressionSwingManager = ExpressionEvaluatorSwingLocator.getManager();
211

  
212
        if(this.pnlCfgActions != null){
213
            ConfigurableActionsMamager cfgActionsManager = ToolsUtilLocator.getConfigurableActionsMamager();
214
            JComponent c = cfgActionsManager.getConfigurableActionsComponent(CONFIGURABLE_PANEL_ID, this);
215
            this.pnlCfgActions.setLayout(new BorderLayout(0, 0));
216
            this.pnlCfgActions.add(c, BorderLayout.CENTER);
217
        }
218

  
219
        toolsSwingManager.translate(this.btnDeselectAllColumns);
220
        toolsSwingManager.translate(this.btnSelectAllColumns);
221
        toolsSwingManager.translate(this.btnAdvancedProperties);
222

  
223
        toolsSwingManager.addClearButton(this.txtName);
224
        toolsSwingManager.setDefaultPopupMenu(this.txtName);
225

  
226
        this.lwcColumns = toolsSwingManager.createJListWithCheckbox(
227
                this.lstColumns
228
        );
229

  
230
        this.pickerProjection = dataSwingManager.createProjectionPickerController(
231
                this.txtProjection,
232
                this.btnProjection
233
        );
234
        this.pickerFilter = expressionSwingManager.createExpressionPickerController(
235
                this.txtFilter,
236
                this.btnFilter,
237
                this.btnFilterBookmarks,
238
                this.btnFilterHistory
239
        );
240
        this.pickerProjection.addChangeListener((ChangeEvent e) -> {
241
            doChangeProjection();
242
        });
243
        this.btnChangeViewProjection.addActionListener((e) -> {
244
            doChangeViewProjection();
245
        } );
246
        this.cboIdField.addItemListener((ItemEvent e) -> {
247
            if (e.getStateChange() == ItemEvent.SELECTED) {
248
                doChangeIdField();
249
            }
250
        });
251
        this.cboGeometryField.addItemListener((ItemEvent e) -> {
252
            if (e.getStateChange() == ItemEvent.SELECTED) {
253
                doChangeGeometryField();
254
                updateLabel();
255
                changeListener.fireEvent();
256
            }
257
        });
258
        this.btnDeselectAllColumns.addActionListener((ActionEvent e) -> {
259
            doDeselectAllColumns();
260
        });
261
        this.btnSelectAllColumns.addActionListener((ActionEvent e) -> {
262
            doSelectAllColumns();
263
        });
264
        this.btnAdvancedProperties.addActionListener((ActionEvent e) -> {
265
            doShowAdvancedProperties();
266
        });
267

  
268
        this.btnSelectAllColumns.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
269
        this.btnDeselectAllColumns.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
270
        this.btnProjection.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
271
        this.btnFilter.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
272
        this.btnFilterBookmarks.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
273
        this.btnFilterHistory.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
274
        this.btnAdvancedProperties.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
275

  
276
    }
277

  
278
    protected TableInfo getTableInfo() {
279
        return this.tableInfo;
280
    }
281
    
282
    private void doChangeIdField() {
283
        final TableInfo info = this.getCurrentTableInfo();
284
        if (info == null) {
285
            return;
286
        }
287
        info.setIdFieldSelected(this.cboIdField.getSelectedIndex());
288
        updateLabel();
289
        changeListener.fireEvent();
290
    }
291

  
292
    private void doChangeProjection() {
293
        final TableInfo info = this.getCurrentTableInfo();
294
        if (info == null) {
295
            return;
296
        }
297
        info.setProjection(this.pickerProjection.get());
298
        updateChangeViewProjection();
299
        updateLabel();
300
        changeListener.fireEvent();
301
    }
302

  
303
    private void doChangeGeometryField() {
304
        TableInfo info = this.getCurrentTableInfo();
305
        if (info == null) {
306
            return;
307
        }
308
        String attrName = (String) this.cboGeometryField.getSelectedItem();
309

  
310
        info.setGeomFieldSelected(this.cboGeometryField.getSelectedIndex());
311

  
312
        if (StringUtils.isBlank(attrName)) {
313
            this.pickerProjection.set(null);
314
            return;
315
        }
316

  
317
        FeatureAttributeDescriptor attr = info.getAttributeDescriptor(attrName);
318
        IProjection srs = attr.getSRS();
319
        if (srs == null) {
320
            return;
321
        }
322
        this.pickerProjection.set(srs);
323
        tableInfo.setProjection(this.pickerProjection.get());
324
        if(tableInfo.getGeometryType() == Geometry.TYPES.UNKNOWN){
325
            tableInfo.setGeometryType(attr.getGeomType().getType());
326
        }
327
        if(tableInfo.getGeometrySubtype() == Geometry.SUBTYPES.UNKNOWN){
328
            tableInfo.setGeometrySubtype(attr.getGeomType().getSubType());
329
        }
330
    }
331

  
332
    private void doDeselectAllColumns() {
333
        TableInfo info = this.getCurrentTableInfo();
334
        if (info == null) {
335
            return;
336
        }
337
        info.getColumnChecksModel().clearSelection();
338
    }
339

  
340
    private void doSelectAllColumns() {
341
        TableInfo info = this.getCurrentTableInfo();
342
        if (info == null) {
343
            return;
344
        }
345
        info.getColumnChecksModel().setSelectionInterval(0, info.getAttributeDescriptors().size());
346
    }
347

  
348
    private void doShowAdvancedProperties() {
349
        final TableInfo info = this.getCurrentTableInfo();
350
        if (info == null) {
351
            return;
352
        }
353
        this.fetch(info);
354
        I18nManager i18n = ToolsLocator.getI18nManager();
355
        WindowManager_v2 winmgr = (WindowManager_v2) ToolsSwingLocator.getWindowManager();
356
        DataStoreParametersPanelManager paramsPanelManager = DALSwingLocator.getDataStoreParametersPanelManager();
357

  
358
        final DataStoreParametersPanel panel = paramsPanelManager.createDataStoreParametersPanel(info.getParameters());
359
        final Dialog dialog = winmgr.createDialog(
360
                panel.asJComponent(),
361
                i18n.getTranslation("_Connection_parameters"),
362
                null,
363
                WindowManager_v2.BUTTONS_OK_CANCEL
364
        );
365
        dialog.addActionListener((ActionEvent e) -> {
366
            if (dialog.getAction() == WindowManager_v2.BUTTON_OK) {
367
                JDBCStoreParameters parameters = info.getParameters();
368
                panel.fetchParameters(parameters);
369
                info.fetch(parameters);
370
                put(info);
371
            }
372
        });
373
        dialog.show(WindowManager.MODE.DIALOG);
374
    }
375

  
376
    public void put(TableInfo tableInfo) {
377
        this.tableInfo = tableInfo;
378
        boolean enableEvents = this.changeListener.isEnabledEvents();
379
        try {
380
            this.changeListener.setEnabledEvents(false);
381
            if (tableInfo == null) {
382
                this.lwcColumns.setModel(new DefaultListModel());
383
                this.lwcColumns.setCheckedModel(new DefaultListSelectionModel());
384
                this.txtName.setText("");
385
                this.cboGeometryField.setModel(new DefaultComboBoxModel());
386
                this.cboIdField.setModel(new DefaultComboBoxModel());
387
                this.pickerProjection.set(null);
388
                this.pickerFilter.set(null);
389
                this.chkVisible.setSelected(true);
390
                if (this.lblReadOnlyNotification != null) {
391
                    this.lblReadOnlyNotification.setText("");
392
                }
393
                this.btnChangeViewProjection.setEnabled(false);
394
            } else {
395
                this.lwcColumns.setModel(tableInfo.getColumnsListModel());
396
                this.lwcColumns.setCheckedModel(tableInfo.getColumnChecksModel());
397

  
398
                this.txtName.setText(tableInfo.getDocumentName());
399

  
400
                this.cboGeometryField.setModel(tableInfo.getGeomFieldComboModel());
401
                this.cboGeometryField.setSelectedIndex(tableInfo.getGeomFieldSelected());
402

  
403
                this.cboIdField.setModel(tableInfo.getIdFieldComboModel());
404
                this.cboIdField.setSelectedIndex(tableInfo.getIdFieldSelected());
405

  
406
                this.pickerProjection.set(tableInfo.getProjection());
407
                this.pickerFilter.set(tableInfo.getFilter());
408
                this.chkVisible.setSelected(BooleanUtils.toBooleanDefaultIfNull(tableInfo.getVisible(),true));
409
            }
410
        } finally {
411
            changeListener.setEnabledEvents(enableEvents);
412
        }
413
        updateChangeViewProjection();
414
        updateLabel();
415
        changeListener.fireEvent();
416
    }
417

  
418
    private void updateLabel() throws LocatorException {
419
        if(  this.tableInfo==null ) {
420
            if( this.lblReadOnlyNotification!=null ) {
421
                this.lblReadOnlyNotification.setText("");
422
            }
423
            return;
424
        }
425
        if (this.lblReadOnlyNotification != null) {
426
            StringBuilder builder = new StringBuilder();
427
            builder.append("<html>");
428
            builder.append("<font color='#00008B'>");
429
            updateLabel(builder);
430
            builder.append("</font>");
431
            builder.append("</html>");
432
            this.lblReadOnlyNotification.setText(builder.toString());
433
        }
434
    }
435
    
436
    protected void updateLabel(StringBuilder builder) throws LocatorException {
437
        I18nManager i18n = ToolsLocator.getI18nManager();
438
        if (tableInfo.isView()) {
439
            builder.append(i18n.getTranslation("_View"));
440
        } else {
441
            builder.append(i18n.getTranslation("_Table"));
442
        }
443
        boolean readOnly = tableInfo.isReadOnly();
444
        if (readOnly) {
445
            builder.append(" - <b>");
446
            builder.append(i18n.getTranslation("_Read_only"));
447
            builder.append("</b>");
448
        }
449
        if (StringUtils.isBlank(this.tableInfo.getFieldId())) {
450
            builder.append(" - ");
451
            builder.append(i18n.getTranslation("_PrimaryKey_field_recommended"));
452
        }
453
        if (this.tableInfo.requireGeometry()) {
454
            FeatureType featType = this.tableInfo.getFeatureType();
455
            if (StringUtils.isBlank(this.tableInfo.getGeomField())) {
456
                builder.append(" - <b>");
457
                builder.append(i18n.getTranslation("_Geometry_field_required"));
458
                builder.append("</b>");
459
            }
460
            if (tableInfo.getGeometryType() == Geometry.TYPES.NULL || tableInfo.getGeometryType() == Geometry.TYPES.UNKNOWN) {
461
                builder.append(" - <b>");
462
                builder.append(i18n.getTranslation("_GeometryType_required"));
463
                builder.append("</b>");
464
            }
465
            if (tableInfo.getGeometrySubtype() == Geometry.SUBTYPES.UNKNOWN) {
466
                builder.append(" - <b>");
467
                builder.append(i18n.getTranslation("_GeometrySubType_required"));
468
                builder.append("</b>");
469
            }
470
            if (this.tableInfo.getProjection() == null) {
471
                builder.append(" - ");
472
                builder.append(i18n.getTranslation("_Projection_recommended"));
473
            } else {
474
                if( this.mapContext!=null ) {
475
                    if (!this.tableInfo.getProjection().equals(this.mapContext.getProjection())) {
476
                        builder.append(" - ");
477
                        builder.append(i18n.getTranslation("_reprojected_on_the_fly"));
478
                    }
479
                }
480
            }
481
        } else { //Not require geometry
482
            FeatureType featType = this.tableInfo.getFeatureType();
483
            if (StringUtils.isNotBlank(this.tableInfo.getGeomField())) {
484
                if (tableInfo.getGeometryType() == Geometry.TYPES.NULL || tableInfo.getGeometryType() == Geometry.TYPES.UNKNOWN) {
485
                    builder.append(" - ");
486
                    builder.append(i18n.getTranslation("_GeometryType_recommended"));
487
                }
488
                if (tableInfo.getGeometrySubtype() == Geometry.SUBTYPES.UNKNOWN) {
489
                    builder.append(" - ");
490
                    builder.append(i18n.getTranslation("_GeometrySubType_recommended"));
491
                }
492
                if (StringUtils.isNotBlank(this.tableInfo.getGeomField()) && this.tableInfo.getProjection() == null) {
493
                    builder.append(" - ");
494
                    builder.append(i18n.getTranslation("_Projection_recommended"));
495
                }
496
                if( this.mapContext!=null && this.tableInfo.getProjection() != null) {
497
                    if (!this.tableInfo.getProjection().equals(this.mapContext.getProjection())) {
498
                        builder.append(" - ");
499
                        builder.append(i18n.getTranslation("_reprojected_on_the_fly"));
500
                    }
501
                }
502
            }
503
        }
504
    }
505

  
506
    public void fetch(TableInfo tableInfo) {
507
        tableInfo.setIdFieldSelected(this.cboIdField.getSelectedIndex());
508
        tableInfo.setGeomFieldSelected(this.cboGeometryField.getSelectedIndex());
509
        tableInfo.setFilter(this.pickerFilter.get());
510
        tableInfo.setVisible(this.chkVisible.isSelected());
511
        tableInfo.setProjection(this.pickerProjection.get());
512
        tableInfo.setDocumentName(this.txtName.getText());
513
    }
514

  
515
    private TableInfo getCurrentTableInfo() {
516
        return this.tableInfo;
517
    }
518

  
519
    public void setEditable(boolean enable) {
520
        this.lstColumns.setEnabled(enable);
521
        this.txtName.setEditable(enable);
522
        this.cboGeometryField.setEnabled(enable);
523
        this.cboIdField.setEnabled(enable);
524
        this.pickerProjection.setEditable(enable);
525
        this.pickerFilter.setEditable(enable);
526
        this.btnDeselectAllColumns.setEnabled(enable);
527
        this.btnSelectAllColumns.setEnabled(enable);
528
        this.btnAdvancedProperties.setEnabled(enable);
529
    }
530

  
531
    public void setEnabled(boolean enable) {
532
        this.lstColumns.setEnabled(enable);
533
        this.txtName.setEnabled(enable);
534
        this.cboGeometryField.setEnabled(enable);
535
        this.cboIdField.setEnabled(enable);
536
        this.pickerProjection.setEnabled(enable);
537
        this.pickerFilter.setEnabled(enable);
538
        this.btnDeselectAllColumns.setEnabled(enable);
539
        this.btnSelectAllColumns.setEnabled(enable);
540
        this.btnAdvancedProperties.setEnabled(enable);
541
    }
542

  
543
    public String getId() {
544
        if (tableInfo == null) {
545
            return null;
546
        }
547
        return this.getCurrentTableInfo().getId();
548
    }
549

  
550
    public void clear() {
551
        this.put(null);
552
    }
553

  
554
    @Override
555
    public boolean isEnabled(Object component) {
556
        try {
557
            if (component instanceof RemoveDALInformationAction) {
558
                final TableInfo info = this.getCurrentTableInfo();
559
                if (info == null) {
560
                    return false;
561
                }
562
                this.fetch(info);
563
                return info.existsDALInfo();
564
            }
565
        } catch (Exception ex) {
566
//            LOGGER.warn("Can't check if is enebled component",ex);
567
        }
568
        return true;
569
    }
570

  
571
    public static void selfRegister() {
572
        ConfigurableActionsMamager cfgActionsManager = ToolsUtilLocator.getConfigurableActionsMamager();
573
        cfgActionsManager.addConfigurableAction(CONFIGURABLE_PANEL_ID, new RemoveDALInformationAction());
574
    }
575

  
576
        @Override
577
    public void addChangeListener(ChangeListener listener) {
578
        this.changeListener.addChangeListener(listener);
579
    }
580

  
581
    @Override
582
    public ChangeListener[] getChangeListeners() {
583
        return this.changeListener.getChangeListeners();
584
    }
585

  
586
    @Override
587
    public void removeChangeListener(ChangeListener listener) {
588
        this.changeListener.removeChangeListener(listener);
589
    }
590

  
591
    @Override
592
    public void removeAllChangeListener() {
593
        this.changeListener.removeAllChangeListener();
594
    }
595

  
596
    @Override
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff