Revision 40963 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

View differences:

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);

Also available in: Unified diff