Revision 10844

View differences:

trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/Project.java
2067 2067
	 public boolean hasChanged() {
2068 2068

  
2069 2069
		 return signatureAtStartup != getXMLEntity().hash();
2070

  
2071 2070
	 }
2072 2071

  
2073 2072
	public void setSignature(long hash) {
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/legend/gui/ThemeManagerWindow.java
65 65
import com.iver.cit.gvsig.fmap.rendering.Legend;
66 66

  
67 67
/**
68
 * 
68
 *
69 69
 * @author jaume dominguez faus - jaume.dominguez@iver.es
70 70
 * @version 01-feb-2007
71 71
 */
......
92 92
		// que el di?logo se autorrellene
93 93
		initialize();
94 94
	}
95
	
95

  
96 96
	private  void initialize() {
97 97
		for (int i = 0; i < pages.size(); i++) {
98 98
			Class pageClass = (Class) pages.get(i);
......
128 128
			};
129 129
		});
130 130
		add(getPanelButtons(), java.awt.BorderLayout.SOUTH);
131
		setSize(new java.awt.Dimension(723,468));
131
		setSize(new java.awt.Dimension(675, 540));
132 132
	}
133 133

  
134 134
	private JPanel getPanelButtons() {
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/legend/gui/LabelingManager.java
63 63
import javax.swing.JOptionPane;
64 64
import javax.swing.JPanel;
65 65
import javax.swing.JTextField;
66
import javax.swing.border.BevelBorder;
66 67

  
67 68
import org.gvsig.gui.beans.AcceptCancelPanel;
68 69
import org.gvsig.gui.beans.swing.GridBagLayoutPanel;
69 70
import org.gvsig.gui.beans.swing.JButton;
70 71

  
71 72
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
72
import com.hardcode.gdbms.engine.data.driver.DriverException;
73 73
import com.iver.andami.PluginServices;
74 74
import com.iver.andami.messages.NotificationManager;
75 75
import com.iver.andami.ui.mdiManager.IWindow;
......
81 81
import com.iver.cit.gvsig.fmap.core.symbols.ITextSymbol;
82 82
import com.iver.cit.gvsig.fmap.layers.FLayer;
83 83
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
84
import com.iver.cit.gvsig.fmap.rendering.styling.AttrInTableLabeling;
84 85
import com.iver.cit.gvsig.fmap.rendering.styling.ILabelingMethod;
85 86
import com.iver.cit.gvsig.fmap.rendering.styling.ILabelingStrategy;
86 87
import com.iver.cit.gvsig.fmap.rendering.styling.IPlacementConstraints;
......
94 95
import com.iver.cit.gvsig.gui.utils.FontChooser;
95 96
import com.iver.utiles.swing.JComboBox;
96 97

  
98

  
97 99
public class LabelingManager extends AbstractThemeManagerPage implements ActionListener {
98 100
	private static int newClassSuffix = 0;
99 101
	private static Hashtable methods = new Hashtable();
......
119 121
	private ILabelable layer;
120 122
	private JButton btnVisualization;
121 123
	private ArrayList expressions;
122
	private GridBagLayoutPanel content;
124
	private JPanel content;
123 125
	private IPlacementConstraints placementConstraints;
124 126
	private IZoomConstraints zoomConstraints;
125 127
	private JButton btnSymbol;
128
	private GridBagLayoutPanel userDefinedContent;
129
	private GridBagLayoutPanel tableDefinedContent;
130
	private JPanel pnlNorth;
131
	private JComboBox cmbMode;
132
	private JComboBox cmbRotationField;
133
	private JComboBox cmbHeightField;
134
	private JComboBox cmbTextField;
126 135

  
127 136
	private class MethodItem {
128 137
		private String name;
......
213 222
	}
214 223

  
215 224
	private void initialize() {
216
		content = new GridBagLayoutPanel();
217
		content.addComponent(getChkApplyLabels());
218
		JPanel aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5,0));
219
		aux.add(new JLabel(PluginServices.getText(this, "method")+":"));
220
		aux.add(getCmbMethod());
221
		aux.setPreferredSize(new Dimension(550, 40));
222
		content.addComponent(aux);
225
		setLayout(new BorderLayout());
226
		getUserDefinedContent();
227
		getTableDefinedContent();
228
		content = new JPanel(new BorderLayout());
229
		content.setBorder(BorderFactory.createEtchedBorder());
230
		add(getPnlNorth(), BorderLayout.NORTH);
231
		add(content, BorderLayout.SOUTH);
232
	}
223 233

  
234
	private JPanel getPnlNorth() {
235
		if (pnlNorth == null) {
236
			pnlNorth = new JPanel(new BorderLayout(5,5));
237
			JPanel aux = new JPanel(new FlowLayout(FlowLayout.LEFT));
224 238

  
225
		classesPanel = new GridBagLayoutPanel();
226
		aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5,0));
227
		aux.add(new JLabel(PluginServices.getText(this, "class")+":"));
228
		aux.add(getCmbClasses());
229
		aux.add(getChkLabelFeatures());
230
		aux.setPreferredSize(new Dimension(530, 40));
231
		classesPanel.addComponent(aux);
239
			aux.add(getChkApplyLabels());
240
			pnlNorth.add(aux, BorderLayout.NORTH);
241
			aux = new JPanel(new FlowLayout(FlowLayout.LEFT));
242
			aux.add(new JLabel(PluginServices.getText(this, "general")+":"));
243
			aux.add(getCmbMode());
244
			pnlNorth.add(aux, BorderLayout.CENTER);
232 245

  
233
		aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5, 0));
234
		aux.add(getBtnAddClass());
235
		aux.add(getBtnDelClass());
236
		aux.add(getBtnRenameClass());
237
		aux.add(getBtnSQLQuery());
238
		aux.setPreferredSize(new Dimension(530, 30));
239
		classesPanel.addComponent(aux);
240
		classesPanel.setBorder(BorderFactory.createTitledBorder(null, PluginServices.getText(this, "classes")));
241
		content.addComponent(classesPanel);
246
		}
247
		return pnlNorth;
248
	}
242 249

  
250
	private JComboBox getCmbMode() {
251
		if (cmbMode == null) {
252
			cmbMode = new JComboBox(new String[] {
253
					PluginServices.getText(this, "user_defined_labels"),
254
					PluginServices.getText(this, "label_atributes_defined_in_table"),
255
			});
256
			cmbMode.addActionListener(this);
257
		}
243 258

  
244
		aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5, 0));
245
		aux.setBorder(BorderFactory.createTitledBorder(null, PluginServices.getText(this, "text_string")));
246
		aux.add(new JLabel(PluginServices.getText(this, "expression")+":"));
247
		aux.add(getCmbExpressions());
248
		aux.add(getBtnEditExpression());
249
		aux.setPreferredSize(new Dimension(540, 60));
250
		content.addComponent(aux);
259
		return cmbMode;
260
	}
251 261

  
262
	private JPanel getTableDefinedContent() {
263
		if (tableDefinedContent == null) {
264
			tableDefinedContent = new GridBagLayoutPanel();
265
			tableDefinedContent.addComponent(
266
					PluginServices.getText(this, "text_field") + ":", getCmbTextField());
267
			tableDefinedContent.addComponent(
268
					PluginServices.getText(this, "text_height_field") + ":", getCmbHeightField());
269
			tableDefinedContent.addComponent(
270
					PluginServices.getText(this, "rotation_height") + ":", getCmbRotationField());
252 271

  
253
		aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5, 0));
254
		aux.setBorder(BorderFactory.createTitledBorder(null, PluginServices.getText(this, "text_symbol")));
255
		aux.add(getSymbolPreviewer());
256
		JPanel aux2 = new JPanel();
257
		aux2.add(getBtnFont());
258
		aux2.add(getBtnSymbol());
272
		}
259 273

  
260
		aux2.setLayout(new GridLayout(aux2.getComponentCount(), 1));
261
		aux.add(aux2);
262
		content.addComponent(aux);
274
		return tableDefinedContent;
275
	}
263 276

  
277
	private JComboBox getCmbRotationField() {
278
		if (cmbRotationField == null) {
279
			cmbRotationField = new JComboBox();
280
			cmbRotationField.addActionListener(this);
281
		}
282
		return cmbRotationField;
283
	}
264 284

  
265
		aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5, 0));
266
		aux.setBorder(BorderFactory.createTitledBorder(null, PluginServices.getText(this, "options")));
267
		aux.add(getBtnVisualization());
268
		aux.add(getBtnPlacement());
269
		aux.add(getBtnLabelStyles());
270
		aux.setPreferredSize(new Dimension(540, 60));
271
		content.addComponent(aux);
272
		add(content);
285
	private JComboBox getCmbHeightField() {
286
		if (cmbHeightField == null) {
287
			cmbHeightField = new JComboBox();
288
			cmbHeightField.addActionListener(this);
289
		}
290
		return cmbHeightField;
273 291
	}
274 292

  
293
	private JComboBox getCmbTextField() {
294
		if (cmbTextField == null) {
295
			cmbTextField = new JComboBox();
296
			cmbTextField.addActionListener(this);
297
		}
298
		return cmbTextField;
299
	}
300

  
301
	private JPanel getUserDefinedContent() {
302
		if (userDefinedContent == null) {
303
			userDefinedContent = new GridBagLayoutPanel();
304
			userDefinedContent.addComponent(getChkApplyLabels());
305
			JPanel aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5,0));
306
			aux.add(new JLabel(PluginServices.getText(this, "method")+":"));
307
			aux.add(getCmbMethod());
308
			aux.setPreferredSize(new Dimension(530, 40));
309
			userDefinedContent.addComponent(aux);
310

  
311

  
312
			classesPanel = new GridBagLayoutPanel();
313
			aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5,0));
314
			aux.add(new JLabel(PluginServices.getText(this, "class")+":"));
315
			aux.add(getCmbClasses());
316
			aux.add(getChkLabelFeatures());
317
			aux.setPreferredSize(new Dimension(530, 40));
318
			classesPanel.addComponent(aux);
319

  
320
			aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5, 0));
321
			aux.add(getBtnAddClass());
322
			aux.add(getBtnDelClass());
323
			aux.add(getBtnRenameClass());
324
			aux.add(getBtnSQLQuery());
325
			aux.setPreferredSize(new Dimension(530, 30));
326
			classesPanel.addComponent(aux);
327
			classesPanel.setBorder(BorderFactory.createTitledBorder(null, PluginServices.getText(this, "classes")));
328
			userDefinedContent.addComponent(classesPanel);
329

  
330

  
331
			aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5, 0));
332
			aux.setBorder(BorderFactory.createTitledBorder(null, PluginServices.getText(this, "text_string")));
333
			aux.add(new JLabel(PluginServices.getText(this, "expression")+":"));
334
			aux.add(getCmbExpressions());
335
			aux.add(getBtnEditExpression());
336
			aux.setPreferredSize(new Dimension(542, 60));
337
			userDefinedContent.addComponent(aux);
338

  
339

  
340
			aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5, 0));
341
			aux.setBorder(BorderFactory.createTitledBorder(null, PluginServices.getText(this, "text_symbol")));
342
			aux.add(getSymbolPreviewer());
343
			JPanel aux2 = new JPanel();
344
			aux2.add(getBtnFont());
345
			aux2.add(getBtnSymbol());
346

  
347
			aux2.setLayout(new GridLayout(aux2.getComponentCount(), 1));
348
			aux.add(aux2);
349
			aux.setPreferredSize(new Dimension(542, 100));
350
			userDefinedContent.addComponent(aux);
351

  
352

  
353
			aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5, 0));
354
			aux.setBorder(BorderFactory.createTitledBorder(null, PluginServices.getText(this, "options")));
355
			aux.add(getBtnVisualization());
356
			aux.add(getBtnPlacement());
357
			aux.add(getBtnLabelStyles());
358
			aux.setPreferredSize(new Dimension(542, 60));
359
			userDefinedContent.addComponent(aux);
360
		}
361
		return userDefinedContent;
362
	}
363

  
275 364
	private Component getBtnSymbol() {
276 365
		if (btnSymbol == null) {
277 366
			btnSymbol = new JButton(PluginServices.getText(this, "symbol"));
......
463 552
				setMethod(strategy.getLabelingMethod());
464 553
			setComponentEnabled(this, true);
465 554
			refreshControls();
466
			actionPerformed(new ActionEvent(chkApplyLabels, 0, null));
555

  
556
			int mode = (this.layer.getLabelingStrategy() instanceof AttrInTableLabeling) ? 1 : 0;
557
			getCmbMode().setSelectedIndex(mode);
558

  
559
			ActionEvent evt = new ActionEvent(chkApplyLabels, 0, null);
560
			evt.setSource(chkApplyLabels);
561
			actionPerformed(evt);
562

  
467 563
		} else {
468 564
			setComponentEnabled(this, false);
469 565
		}
......
645 741
			if (sym != null)
646 742
				// gather the symbol and apply to the class
647 743
				clazz.setSymbol((ITextSymbol) symSel.getSelectedObject());
744
		} else if (c.equals(cmbMode)) {
745
			remove(content);
746
			if (cmbMode.getSelectedIndex() == 0) {
747

  
748
				content.remove(getTableDefinedContent());
749
				content.add(getUserDefinedContent());
750
			} else {
751

  
752
				content.remove(getUserDefinedContent());
753
				content.add(getTableDefinedContent());
754
			}
755
			add(content, BorderLayout.CENTER);
756
			actionPerformed(new ActionEvent(chkApplyLabels, 0, null));
757
			revalidate();
758

  
648 759
		}
649 760
	}
650 761

  
trunk/libraries/libFMap/src-test/com/iver/cit/gvsig/fmap/core/symbols/TestISymbol.java
173 173
			assertTrue(symbols[i].getClassName() + " does not declare a description in its XMLEntity",
174 174
					symbols[i].getXMLEntity().contains("desc"));
175 175
		}
176
	}
176 177

  
178
	/**
179
	 * ensures that any symbol has an isShapeVisible field in its persistence
180
	 * (very important)
181
	 */
182
	public void testIsShapeVisible() {
183
		for (int i = 0; i < symbols.length; i++) {
184
			assertTrue(symbols[i].getClassName() + " does not declare a description in its XMLEntity",
185
					symbols[i].getXMLEntity().contains("isShapeVisible"));
186
		}
177 187
	}
188

  
178 189
	/**
179 190
	 * ensures that the symbol is self-defining
180 191
	 */
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/symbols/MultiShapeSymbol.java
125 125
	}
126 126

  
127 127
	public XMLEntity getXMLEntity() {
128
		// TODO Implement it
129
		throw new Error("Not yet implemented!");
130

  
128
		XMLEntity xml = new XMLEntity();
129
		xml.putProperty("className", getClassName());
130
		xml.putProperty("desc", getDescription());
131
		xml.addChild(marker.getXMLEntity());
132
		xml.addChild(line.getXMLEntity());
133
		xml.addChild(fill.getXMLEntity());
134
		return xml;
131 135
	}
132 136

  
133 137
	public void setXMLEntity(XMLEntity xml) {
134
		// TODO Implement it
135
		throw new Error("Not yet implemented!");
136

  
138
		setDescription(xml.getStringProperty("desc"));
139
		marker = (IMarkerSymbol) SymbologyFactory.createSymbolFromXML(xml.getChild(0), null);
140
		line = (ILineSymbol) SymbologyFactory.createSymbolFromXML(xml.getChild(0), null);
141
		fill = (IFillSymbol) SymbologyFactory.createSymbolFromXML(xml.getChild(0), null);
137 142
	}
138 143

  
139 144
	public String getDescription() {
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/symbols/PictureMarkerSymbol.java
43 43
*
44 44
* $Id$
45 45
* $Log$
46
* Revision 1.3  2007-03-09 11:20:57  jaume
46
* Revision 1.4  2007-03-21 17:36:22  jaume
47
* *** empty log message ***
48
*
49
* Revision 1.3  2007/03/09 11:20:57  jaume
47 50
* Advanced symbology (start committing)
48 51
*
49 52
* Revision 1.1.2.4  2007/02/21 07:34:09  jaume
......
141 144
		// TODO Implement it
142 145
		XMLEntity xml = new XMLEntity();
143 146
		xml.putProperty("className", getClassName());
147
		xml.putProperty("isShapeVisible", isShapeVisible());
144 148
		xml.putProperty("desc", getDescription());
145 149
		xml.putProperty("imagePath", imagePath);
146 150
		return xml;
......
161 165
	}
162 166

  
163 167
	public void setXMLEntity(XMLEntity xml) {
168
		setDescription(xml.getStringProperty("desc"));
169
		setIsShapeVisible(xml.getBooleanProperty("isShapeVisible"));
164 170
		imagePath = xml.getStringProperty("imagePath");
165 171
	}
166 172

  
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/symbols/MarkerFillSymbol.java
43 43
*
44 44
* $Id$
45 45
* $Log$
46
* Revision 1.5  2007-03-13 16:58:36  jaume
46
* Revision 1.6  2007-03-21 17:36:22  jaume
47
* *** empty log message ***
48
*
49
* Revision 1.5  2007/03/13 16:58:36  jaume
47 50
* Added QuantityByCategory (Multivariable legend) and some bugfixes in symbols
48 51
*
49 52
* Revision 1.4  2007/03/09 11:20:57  jaume
......
244 247
	public XMLEntity getXMLEntity() {
245 248
		XMLEntity xml = new XMLEntity();
246 249
		xml.putProperty("className", getClassName());
247
		// color
248
		xml.putProperty("color", StringUtilities.color2String(getFillColor()));
250
		xml.putProperty("isShapeVisible", isShapeVisible());
251
		// color (necessite)
252
		if (getFillColor() !=null)
253
			xml.putProperty("color", StringUtilities.color2String(getFillColor()));
249 254
		xml.putProperty("desc", getDescription());
250 255
		xml.putProperty("rotation", rotation);
251 256
		xml.putProperty("xOffset", xOffset);
......
278 283
	}
279 284

  
280 285
	public void setXMLEntity(XMLEntity xml) {
286
		setDescription(xml.getStringProperty("desc"));
287
		setIsShapeVisible(xml.getBooleanProperty("isShapeVisible"));
281 288
		rotation = xml.getDoubleProperty("rotation");
282 289
		xOffset = xml.getDoubleProperty("xOffset");
283 290
		yOffset = xml.getDoubleProperty("yOffset");
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/symbols/SmartTextSymbol.java
43 43
*
44 44
* $Id$
45 45
* $Log$
46
* Revision 1.1  2007-03-09 11:20:56  jaume
46
* Revision 1.2  2007-03-21 17:36:22  jaume
47
* *** empty log message ***
48
*
49
* Revision 1.1  2007/03/09 11:20:56  jaume
47 50
* Advanced symbology (start committing)
48 51
*
49 52
* Revision 1.1.2.8  2007/02/21 07:34:09  jaume
......
191 194
		XMLEntity xml = new XMLEntity();
192 195
		xml.putProperty("className", getClassName());
193 196
		xml.putProperty("desc", getDescription());
194

  
197
		xml.putProperty("isShapeVisible", isShapeVisible());
195 198
		return xml;
196 199
	}
197 200

  
......
220 223
	public void setXMLEntity(XMLEntity xml) {
221 224
		setFont(new Font("Arial", Font.PLAIN, 18));
222 225
		setText("this is my TEST text that follows a line");
223
		setTextColor(Color.BLACK);
224
		setIsShapeVisible(true);
226
		setDescription(xml.getStringProperty("desc"));
227
		setIsShapeVisible(xml.getBooleanProperty("isShapeVisible"));
228

  
225 229
	}
226 230

  
227 231
	public void print(Graphics2D g, AffineTransform at, FShape shape) throws ReadDriverException {
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/symbols/SimpleTextSymbol.java
105 105
		XMLEntity xml = new XMLEntity();
106 106
		xml.putProperty("className", getClassName());
107 107
		xml.putProperty("desc", getDescription());
108

  
108
		xml.putProperty("isShapeVisible", isShapeVisible());
109 109
		xml.putProperty("font", font.getName());
110 110
		xml.putProperty("fontStyle", font.getStyle());
111 111
		xml.putProperty("size", font.getSize());
......
122 122
		font = new Font(xml.getStringProperty("font"),
123 123
				xml.getIntProperty("fontStyle"),
124 124
				xml.getIntProperty("size"));
125
		setDescription(xml.getStringProperty("desc"));
126
		setIsShapeVisible(xml.getBooleanProperty("isShapeVisible"));
125 127
		text = xml.getStringProperty("text");
126 128
		textColor = StringUtilities.string2Color(xml.getStringProperty("textColor"));
127 129
	}

Also available in: Unified diff