Revision 11195

View differences:

trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/legend/gui/PlacementProperties.java
43 43
*
44 44
* $Id$
45 45
* $Log$
46
* Revision 1.4  2007-04-12 16:01:32  jaume
46
* Revision 1.5  2007-04-13 12:10:56  jaume
47 47
* *** empty log message ***
48 48
*
49
* Revision 1.4  2007/04/12 16:01:32  jaume
50
* *** empty log message ***
51
*
49 52
* Revision 1.3  2007/03/28 15:38:56  jaume
50 53
* GUI for lines, points and polygons
51 54
*
......
130 133
		public void actionPerformed(ActionEvent e) {
131 134
			if ("OK".equals(e.getActionCommand()))
132 135
				applyConstraints();
136

  
137
			if ("CANCEL".equals(e.getActionCommand()))
138
				constraints = oldConstraints;
133 139
			PluginServices.getMDIManager().closeWindow(PlacementProperties.this);
134 140
		}
135 141
	};
......
148 154
	private JCheckBox chkAbove;
149 155
	private JComboBox cmbOrientationSystem;
150 156
	private JLabel lblPointPosDesc = new JLabel(pointStyle.getDescription());
157
	private IPlacementConstraints oldConstraints;
158

  
151 159
	public PlacementProperties(FLyrVect layer, IPlacementConstraints constraints) throws ReadDriverException {
152 160
		this.shapeType = layer.getShapeType();
161
		this.oldConstraints = constraints;
153 162
		this.constraints = constraints != null ?
154
				constraints	:
163
				LabelingFactory.createPlacementConstraints(constraints.getXMLEntity())	:
155 164
				LabelingFactory.createPlacementConstraints(layer);
156 165
		initialize();
157 166
	}
......
235 244
	private JComboBox getCmbLocationAlongLines() {
236 245
		if (cmbLocationAlongLines == null) {
237 246
			cmbLocationAlongLines = new JComboBox(new String[] {
238
					PluginServices.getText(this, "at_best"),
247
					PluginServices.getText(this, "in_the_middle"),
239 248
					PluginServices.getText(this, "at_begin"),
240 249
					PluginServices.getText(this, "at_end"),
250
					PluginServices.getText(this, "at_best"),
241 251
			});
252
			cmbLocationAlongLines.setSelectedIndex(0);
242 253
		}
243 254

  
244 255
		return cmbLocationAlongLines;
......
546 557
			constraints.setPlacementMode(mode);
547 558
			constraints.setAboveTheLine(getChkAbove().isSelected());
548 559
			constraints.setBellowTheLine(getChkBelow().isSelected());
549
			// ON THE LINE??
560
			// what about ON THE LINE??
550 561

  
551
			constraints.setPageOriented(getCmbOrientationSystem().getSelectedIndex() ==1);
552
			constraints.setLocationAlongTheLine()
562
			constraints.setPageOriented(
563
					getCmbOrientationSystem().getSelectedIndex() == 1);
564
			int i = getCmbLocationAlongLines().getSelectedIndex();
565
			if (i == 0) {
566
				i = IPlacementConstraints.AT_THE_MIDDLE_OF_THE_LINE;
567
			} else if (i == 1) {
568
				i = IPlacementConstraints.AT_THE_BEGINING_OF_THE_LINE;
569
			} else {
570
				i = IPlacementConstraints.AT_THE_END_OF_THE_LINE;
571
			}
572
			constraints.setLocationAlongTheLine(i);
553 573
			break;
554 574
		case FShape.POLYGON:
555 575
			break;

Also available in: Unified diff