Revision 31277 branches/v2_0_0_prep/extensions/org.gvsig.annotation/src/main/java/org/gvsig/annotation/create/AnnotationFieldSelectPanel.java

View differences:

AnnotationFieldSelectPanel.java
97 97
    private EventsListener eventsListener = new EventsListener();
98 98

  
99 99
	private AnnotationPreferences preferences;
100
    
101
    public AnnotationFieldSelectPanel(JWizardComponents arg0, FLyrVect lyr) {
100

  
101
	public AnnotationFieldSelectPanel(JWizardComponents arg0, FLyrVect lyr) {
102 102
        super(arg0);
103 103
        layer = lyr;
104 104
        preferences = AnnotationLocator.getAnnotationPreferences();
......
123 123
        if (((String) cmbField.getSelectedItem()).trim().length() < 1) {
124 124
            return false;
125 125
        }
126

  
127 126
        return true;
128 127
    }
129 128

  
......
131 130
        this.setLayout(null);
132 131
        this.setSize(new Dimension(358, 263));
133 132
        this.addLabels();
134

  
135 133
        this.add(getCmbField(), null);
136 134
        this.add(getCmbDuplicate(), null);
135
        this.cmbField.setSelectedItem(0);
137 136
        checkIsOkPanelData();
137
        if (!cmbField.equals(AnnotationConfigureLabelsPanel.TEXT_FOR_NO_SELECTED_VALUE))
138
        	this.setFinishButtonEnabled(false);
138 139
    }
139 140

  
140 141
    private JComboBox getCmbField() {
......
143 144
            this.cmbField.setEditable(false);
144 145
            this.cmbField.setBounds(cmbFieldPosition);
145 146
            this.cmbField.addItemListener(this.eventsListener);
146
            this.cmbField.addItem("");
147
            this.cmbField. addItem(AnnotationConfigureLabelsPanel.TEXT_FOR_NO_SELECTED_VALUE);
147 148
            
148 149
            //Get the layer Fields Name to fill the COMBOBOX
149 150
            FeatureStore store = (FeatureStore) this.layer.getDataStore();
......
153 154
				FeatureType type = features.getDefaultFeatureType();
154 155
			 	FeatureAttributeDescriptor[] fieldsNames = type.getAttributeDescriptors();
155 156
	            for (int i = 0; i < fieldsNames.length; i++) {
156
	                this.cmbField.addItem(fieldsNames[i].getName());
157
	            	if (fieldsNames[i].getName().compareTo("GEOMETRY")!=0){
158
	                	this.cmbField.addItem(fieldsNames[i].getName());
159
	            	}
157 160
	            }
161
	           
158 162
	            //STARTING UP PROPERTIES 
159
	            if(true){
163
	            if(this.cmbField.getSelectedIndex()!=0){
160 164
	            	String fieldSelect;
161 165
					if (preferences.getMappedNumColumnText()>-1)
162 166
	            		fieldSelect = fieldsNames[preferences.getMappedNumColumnText()].getName();
......
165 169
	            	this.cmbField.setSelectedItem(fieldSelect);
166 170
	            	setNextButtonEnabled(true);
167 171
	            }
172
	            else{
173
	            	setNextButtonEnabled(false);
174
	            }
168 175
	            features.dispose();
169 176
			} catch (DataException e) {
170 177
				// ERROR NOTATIFICATION MANAGER
......
182 189
            cmbDuplicate.addItem(PluginServices.getText(this, "centered"));
183 190
            cmbDuplicate.setSelectedItem(PluginServices.getText(this, "centered"));
184 191
        }
185

  
186 192
        return cmbDuplicate;
187 193
    }
188 194

  
189 195
   public String getField() {
196
	   preferences.setMappedNumColumnText(this.getCmbField().getItemCount());
190 197
        return (String) this.getCmbField().getSelectedItem();
191 198
    }
192 199

  
......
203 210

  
204 211
        this.lblDuplicate.setText(PluginServices.getText(this, "duplicate"));
205 212
        this.lblDuplicate.setBounds(lblDuplicatePosition);
206
        this.lblDescription.setText(PluginServices.getText(this,
207
                "descripcion_de_crear_capa_de_anotaciones_nueva"));
213
        this.lblDescription.setText(PluginServices.getText(this, "descripcion_de_crear_capa_de_anotaciones_nueva"));
208 214

  
209
        this.lblField.setText(PluginServices.getText(this,
210
                "seleccione_el_campo_de_texto_que_desea_que_se_utilize_para_mostrar_la_nueva_capa"));
215
        this.lblField.setText(PluginServices.getText(this,"seleccione_el_campo_de_texto_que_desea_que_se_utilize_para_mostrar_la_nueva_capa"));
211 216

  
212 217
        this.lblDescription.setBounds(lblDescriptionPosition);
213 218
        this.lblStep2.setBounds(lblStep2Position);

Also available in: Unified diff