Revision 23383 branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/gui/panels/MappingFieldsToAnotation.java

View differences:

MappingFieldsToAnotation.java
10 10
import javax.swing.JRadioButton;
11 11
import javax.swing.JTextField;
12 12

  
13
import org.gvsig.fmap.datasources.SelectableDataSource;
13
//import org.gvsig.fmap.datasources.SelectableDataSource;
14 14
import org.gvsig.fmap.mapcontext.layers.MappingAnnotation;
15
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrAnnotation;
15
//import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrAnnotation;
16 16

  
17
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
17
//import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
18 18
import com.iver.andami.PluginServices;
19 19
import com.iver.andami.ui.mdiManager.IWindow;
20 20
import com.iver.andami.ui.mdiManager.WindowInfo;
21 21

  
22
//TODO comentado para que compile
22 23
public class MappingFieldsToAnotation extends JPanel implements IWindow{
23 24

  
24 25
	private JComboBox cmbText = null;
......
33 34
	private JComboBox cmbFont = null;
34 35
	private JButton bOk = null;
35 36
	private JButton bCancel = null;
36
	private SelectableDataSource sds=null;
37
	private FLyrAnnotation la;
37
//	private SelectableDataSource sds=null;
38
//	private FLyrAnnotation la;
38 39
	private int[] mapText;
39 40
	private int[] mapAngle;
40 41
	private int[] mapColor;
......
50 51
	/**
51 52
	 * This is the default constructor
52 53
	 */
53
	public MappingFieldsToAnotation(FLyrAnnotation la) {
54
		super();
55
		this.la=la;
56
		try {
57
			this.sds=la.getRecordset();
58
			initialize();
59
		} catch (ReadDriverException e) {
60
			e.printStackTrace();
61
		}
54
//	public MappingFieldsToAnotation(FLyrAnnotation la) {
55
//		super();
56
//		this.la=la;
57
//		try {
58
//			this.sds=la.getRecordset();
59
//			initialize();
60
//		} catch (ReadDriverException e) {
61
//			e.printStackTrace();
62
//		}
63
//
64
//	}
62 65

  
63
	}
64

  
65 66
	/**
66 67
	 * This method initializes this
67 68
	 *
......
116 117
	private JComboBox getCmbText() {
117 118
		if (cmbText == null) {
118 119
			cmbText = new JComboBox();
119
			try {
120
				mapText=new int[sds.getFieldCount()];
121
				int num=-1;
122
				for (int i = 0; i < sds.getFieldCount(); i++) {
123
					cmbText.addItem(sds.getFieldName(i));
124
					num++;
125
					mapText[i]=num;
126
				}
127
				//cmbText.addItem("- Defaulf -");
128
			} catch (ReadDriverException e) {
129
				e.printStackTrace();
130
			}
120
//			try {
121
//				mapText=new int[sds.getFieldCount()];
122
//				int num=-1;
123
//				for (int i = 0; i < sds.getFieldCount(); i++) {
124
//					cmbText.addItem(sds.getFieldName(i));
125
//					num++;
126
//					mapText[i]=num;
127
//				}
128
//				//cmbText.addItem("- Defaulf -");
129
//			} catch (ReadDriverException e) {
130
//				e.printStackTrace();
131
//			}
131 132
			cmbText.setBounds(new java.awt.Rectangle(15,42,166,20));
132 133

  
133 134
		}
......
142 143
	private JComboBox getCmbAngle() {
143 144
		if (cmbAngle == null) {
144 145
			cmbAngle = new JComboBox();
145
			try {
146
				mapAngle=new int[sds.getFieldCount()];
147
				int num=-1;
148
			for (int i = 0; i < sds.getFieldCount(); i++) {
149
				if (sds.getFieldType(i) == Types.DOUBLE){
150
					cmbAngle.addItem(sds.getFieldName(i));
151
					num++;
152
					mapAngle[i]=num;
153
				}
154
			}
155
			cmbAngle.addItem("- Default -");
156
			cmbAngle.setSelectedItem("- Default -");
157
			} catch (ReadDriverException e) {
158
				e.printStackTrace();
159
			}
146
//			try {
147
//				mapAngle=new int[sds.getFieldCount()];
148
//				int num=-1;
149
//			for (int i = 0; i < sds.getFieldCount(); i++) {
150
//				if (sds.getFieldType(i) == Types.DOUBLE){
151
//					cmbAngle.addItem(sds.getFieldName(i));
152
//					num++;
153
//					mapAngle[i]=num;
154
//				}
155
//			}
156
//			cmbAngle.addItem("- Default -");
157
//			cmbAngle.setSelectedItem("- Default -");
158
//			} catch (ReadDriverException e) {
159
//				e.printStackTrace();
160
//			}
160 161
			cmbAngle.setBounds(new java.awt.Rectangle(15,104,166,20));
161 162
		}
162 163
		return cmbAngle;
......
171 172
		if (cmbColor == null) {
172 173
			cmbColor = new JComboBox();
173 174
			cmbColor.setBounds(new java.awt.Rectangle(15,166,166,20));
174
			try {
175
				mapColor=new int[sds.getFieldCount()];
176
				int num=-1;
177
				for (int i = 0; i < sds.getFieldCount(); i++) {
178
					if (sds.getFieldType(i) == Types.DOUBLE){
179
						cmbColor.addItem(sds.getFieldName(i));
180
						num++;
181
						mapColor[i]=num;
182
					}
183
				}
184
				cmbColor.addItem("- Default -");
185
				cmbColor.setSelectedItem("- Default -");
186
			} catch (ReadDriverException e) {
187
				e.printStackTrace();
188
			}
175
//			try {
176
//				mapColor=new int[sds.getFieldCount()];
177
//				int num=-1;
178
//				for (int i = 0; i < sds.getFieldCount(); i++) {
179
//					if (sds.getFieldType(i) == Types.DOUBLE){
180
//						cmbColor.addItem(sds.getFieldName(i));
181
//						num++;
182
//						mapColor[i]=num;
183
//					}
184
//				}
185
//				cmbColor.addItem("- Default -");
186
//				cmbColor.setSelectedItem("- Default -");
187
//			} catch (ReadDriverException e) {
188
//				e.printStackTrace();
189
//			}
189 190
		}
190 191
		return cmbColor;
191 192
	}
......
198 199
	private JComboBox getCmbHeight() {
199 200
		if (cmbHeight == null) {
200 201
			cmbHeight = new JComboBox();
201
			try {
202
				mapHeight=new int[sds.getFieldCount()];
203
				int num=-1;
204
				for (int i = 0; i < sds.getFieldCount(); i++) {
205
					if (sds.getFieldType(i) == Types.DOUBLE){
206
						cmbHeight.addItem(sds.getFieldName(i));
207
						num++;
208
						mapHeight[i]=num;
209
					}
210
				}
211
				cmbHeight.addItem("- Default -");
212
				cmbHeight.setSelectedItem("- Default -");
213
			} catch (ReadDriverException e) {
214
				e.printStackTrace();
215
			}
202
//			try {
203
//				mapHeight=new int[sds.getFieldCount()];
204
//				int num=-1;
205
//				for (int i = 0; i < sds.getFieldCount(); i++) {
206
//					if (sds.getFieldType(i) == Types.DOUBLE){
207
//						cmbHeight.addItem(sds.getFieldName(i));
208
//						num++;
209
//						mapHeight[i]=num;
210
//					}
211
//				}
212
//				cmbHeight.addItem("- Default -");
213
//				cmbHeight.setSelectedItem("- Default -");
214
//			} catch (ReadDriverException e) {
215
//				e.printStackTrace();
216
//			}
216 217
			cmbHeight.setBounds(new java.awt.Rectangle(15,228,166,20));
217 218
		}
218 219
		return cmbHeight;
......
226 227
	private JComboBox getCmbFont() {
227 228
		if (cmbFont == null) {
228 229
			cmbFont = new JComboBox();
229
			try {
230
				mapFont=new int[sds.getFieldCount()];
231
				int num=-1;
232
				for (int i = 0; i < sds.getFieldCount(); i++) {
233
					if (sds.getFieldType(i) == Types.VARCHAR){
234
						cmbFont.addItem(sds.getFieldName(i));
235
						num++;
236
						mapFont[i]=num;
237
					}
238
				}
239
				cmbFont.addItem("- Default -");
240
				cmbFont.setSelectedItem("- Default -");
241
			} catch (ReadDriverException e) {
242
				e.printStackTrace();
243
			}
230
//			try {
231
//				mapFont=new int[sds.getFieldCount()];
232
//				int num=-1;
233
//				for (int i = 0; i < sds.getFieldCount(); i++) {
234
//					if (sds.getFieldType(i) == Types.VARCHAR){
235
//						cmbFont.addItem(sds.getFieldName(i));
236
//						num++;
237
//						mapFont[i]=num;
238
//					}
239
//				}
240
//				cmbFont.addItem("- Default -");
241
//				cmbFont.setSelectedItem("- Default -");
242
//			} catch (ReadDriverException e) {
243
//				e.printStackTrace();
244
//			}
244 245
			cmbFont.setBounds(new java.awt.Rectangle(15,290,166,20));
245 246
		}
246 247
		return cmbFont;
......
272 273
					if (!getCmbFont().getSelectedItem().equals("- Default -"))
273 274
						mapping.setColumnTypeFont(mapFont[getCmbFont().getSelectedIndex()]);
274 275
					//Falta el estilo, si es necesario.
275
					la.setInPixels(rbPixels.isSelected());
276
					la.setMapping(mapping);
277
					la.setName(getTxtName().getText());
276
//					la.setInPixels(rbPixels.isSelected());
277
//					la.setMapping(mapping);
278
//					la.setName(getTxtName().getText());
278 279
					isOk=true;
279 280
					PluginServices.getMDIManager().closeWindow(MappingFieldsToAnotation.this);
280 281
				}

Also available in: Unified diff