Revision 10138

View differences:

branches/simbologia/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/legend/gui/LabelingManager.java
446 446
			ILabelingStrategy strategy = this.layer.getLabelingStrategy();
447 447
			if (strategy == null) {
448 448
				// set a new (simplest) one
449
//				strategy = LabelingFactory.createDefaultStrategy(getShapeType());
449
				try {
450
					strategy = LabelingFactory.createDefaultStrategy(layer);
451
				} catch (DriverException e) {
452
					strategy = null;
453
				}
450 454
			}
451

  
452
			setMethod(strategy.getLabelingMethod());
455
			if (strategy != null)
456
				setMethod(strategy.getLabelingMethod());
453 457
			setComponentEnabled(this, true);
454 458
			refreshControls();
455 459
			actionPerformed(new ActionEvent(chkApplyLabels, 0, null));
456 460
		} else {
461

  
457 462
			setComponentEnabled(this, false);
458 463
		}
459 464
	}
......
615 620
	}
616 621

  
617 622
	public void applyAction() {
618
		layer.setIsLabeled(getChkApplyLabels().isSelected());
619
		try {
620
			layer.setLabelingStrategy(
621
					LabelingFactory.
623
		if (layer != null) { // in other case the layer is not labelable
624
			layer.setIsLabeled(getChkApplyLabels().isSelected());
625
			try {
626
				layer.setLabelingStrategy(
627
						LabelingFactory.
622 628
						createStrategy((FLayer) layer,
623
									   getMethod(),
624
									   getPlacementConstraints(),
625
									   getZoomConstraints()));
626
		} catch (DriverException e) {
627
			// TODO Auto-generated catch block
628
			NotificationManager.addError(PluginServices.getText(this, "XXXX"), e);
629
								getMethod(),
630
								getPlacementConstraints(),
631
								getZoomConstraints()));
632
			} catch (DriverException e) {
633
				// TODO Auto-generated catch block
634
				NotificationManager.addError(PluginServices.getText(this, "XXXX"), e);
635
			}
629 636
		}
630 637
	}
631 638

  

Also available in: Unified diff