Revision 40963

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.geodb.app/org.gvsig.geodb.app.mainplugin/src/main/java/org/gvsig/geodb/vectorialdb/wizard/TablesListItemVectorial.java
27 27
import java.util.ArrayList;
28 28
import java.util.Iterator;
29 29

  
30
import javax.swing.JOptionPane;
31

  
30 32
import org.gvsig.andami.messages.NotificationManager;
33
import org.gvsig.app.ApplicationLocator;
31 34
import org.gvsig.fmap.dal.DataTypes;
32 35
import org.gvsig.fmap.dal.exception.DataException;
33 36
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
......
35 38
import org.gvsig.fmap.dal.serverexplorer.db.DBServerExplorer;
36 39
import org.gvsig.fmap.dal.store.db.DBStoreParameters;
37 40
import org.gvsig.fmap.mapcontrol.MapControl;
41
import org.gvsig.i18n.Messages;
38 42

  
39 43

  
40 44
public class TablesListItemVectorial extends TablesListItem {
......
89 93
				strb.append(auxId.get(auxId.size() - 1));
90 94

  
91 95
				strb.append('}');
92
				if (auxId.size() == 1) {
93
					auxAll.remove(auxId.get(0));
94
				}
95
				auxAll.add(0, strb.toString());
96
				/*
97
				 * Only the true PK from the DB
98
				 */
99
				auxAll.clear();
100
				auxAll.add(strb.toString());
101
			} else {
102
			    /*
103
			     * If the table does not hace PK declared in the DB,
104
			     * we let the user choose any field and show a warning dialog
105
			     */
106
			    showNoPkWarning(this.tableName);
96 107
			}
108
			
109
			// ===============================
110
			
97 111
			ids = (String[]) auxAll.toArray(new String[auxAll.size()]);
98 112
			int ids_size = ids.length;
99 113
			FieldComboItem[] ids_ci = new FieldComboItem[ids_size];
......
122 136
		return tableSettingsPanel;
123 137
	}
124 138

  
139
    private void showNoPkWarning(String tableName) {
140
        
141
        String msg = Messages.getText(
142
            "_Table_NAME_does_not_have_declared_PK", new String[] { tableName } );
143
        msg = msg + "\n\n";
144
        msg = msg + Messages.getText(
145
            "_If_layer_edited_saving_edits_will_not_be_possible");
146
        msg = msg + "\n";
147
        msg = msg + Messages.getText(
148
            "_Strange_behavior_if_selected_ID_not_unique_values");
149
        msg = msg + "      ";
150
        
151
        JOptionPane.showMessageDialog(
152
            ApplicationLocator.getManager().getRootComponent(),
153
            msg,
154
            Messages.getText("_Id_field"),
155
            JOptionPane.WARNING_MESSAGE);
156
        
157
    }
158

  
125 159
    public void setEnabledPanels(boolean b) {
126 160
    	super.setEnabledPanels(b);
127 161
		tableSettingsPanel.enableSpatialControls(b);
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.geodb.app/org.gvsig.geodb.app.mainplugin/src/main/resources-plugin/i18n/text.properties
31 31
more_provider_parameters_needed_title=Faltan par?metros
32 32
_Unable_to_reproject_viewport_Default_bounds_used=No se han podido reproyectar los l?mites de la vista. Se usan valores por defecto
33 33
_Viewport_bounds_reprojected_to_datasource_CRS=Se han reproyectado los l?mites de la vista al CRS del origen de datos.
34
_Table_NAME_does_not_have_declared_PK=La tabla {0} no tiene clave primaria declarada en la BD
35
_If_layer_edited_saving_edits_will_not_be_possible=Si edita la capa, no ser? posible salvar los cambios en la misma tabla
36
_Strange_behavior_if_selected_ID_not_unique_values=La capa tendr? comportamiento extra?o si el campo elegido como ID no tiene valores ?nicos
34 37

  
38

  
39

  
40

  
41

  
42

  
43

  
44

  
45

  
46

  
47

  
48

  
49

  
50

  
51

  
52

  
53

  
54

  
55

  
56

  
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.geodb.app/org.gvsig.geodb.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties
31 31
more_provider_parameters_needed_title=Missing parameters
32 32
_Unable_to_reproject_viewport_Default_bounds_used=Unable to reproject viewport bounds. Default values used
33 33
_Viewport_bounds_reprojected_to_datasource_CRS=Viewport bounds were reprojected to CRS of datasource
34
_Table_NAME_does_not_have_declared_PK=The table {0} does not have a declared primary key in the DB
35
_If_layer_edited_saving_edits_will_not_be_possible=If layer is edited, saving edits will not be possible
36
_Strange_behavior_if_selected_ID_not_unique_values=The layer will have strange behavior if field selected as ID does not have unique values
34 37

  
35 38

  
39

  
40

  
41

  
42

  
43

  
44

  
45

  
46

  
47

  
48

  
49

  
50

  
51

  
52

  
53

  
54

  
55

  
56

  
57

  
58

  

Also available in: Unified diff