Revision 40687

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/impl/SymbologyDefaultImplLibrary.java
63 63
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.ImageStyle;
64 64
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.RemoteFileStyle;
65 65
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.SVGStyle;
66
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.SimpleLabelStyle;
66 67
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.SimpleLineStyle;
67 68
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.SimpleMarkerFillPropertiesStyle;
68 69
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.text.impl.SimpleTextSymbol;
......
181 182
        caller.add(new AttrInTableLabelingStrategy.RegisterPersistence());
182 183
                 
183 184
        /*
185
         * Default impl of simple label style
186
         */
187
        caller.add(new SimpleLabelStyle.RegisterPersistence());
188

  
189
        /*
184 190
         * Do register of all
185 191
         */
186 192
        if( !caller.call() ) {
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/symbol/style/SimpleLabelStyle.java
50 50
import org.gvsig.tools.persistence.PersistenceManager;
51 51
import org.gvsig.tools.persistence.PersistentState;
52 52
import org.gvsig.tools.persistence.exception.PersistenceException;
53
import org.gvsig.tools.util.Callable;
53 54
import org.slf4j.Logger;
54 55
import org.slf4j.LoggerFactory;
55 56

  
......
325 326
		return background;
326 327
	}
327 328

  
328
	public void setBackgroundFileStyle(IBackgroundFileStyle background) {
329
		this.background = background;
329
	public void setBackgroundFileStyle(IBackgroundFileStyle bg) {
330
		this.background = bg;
330 331
	}
331 332

  
332
	
333
	public static void registerPersistent() {
334
	    PersistenceManager persistenceManager = ToolsLocator.getPersistenceManager();
335
	    DynStruct definition = persistenceManager.getDefinition(
333
	public static class RegisterPersistence implements Callable {
334

  
335
		public Object call() throws Exception {
336

  
337
			PersistenceManager manager = ToolsLocator.getPersistenceManager();
338
			DynStruct definition = manager.getDefinition(
336 339
	    		SIMPLE_LABEL_STYLE_PERSISTENCE_NAME);
337 340

  
338
	    if (definition == null){
339
	        definition = persistenceManager.addDefinition(
341
			if (definition == null){
342
				definition = manager.addDefinition(
340 343
	        		SimpleLabelStyle.class,
341 344
	        		SIMPLE_LABEL_STYLE_PERSISTENCE_NAME,
342 345
	        		SIMPLE_LABEL_STYLE_PERSISTENCE_NAME + " Persistent definition", 
343
	            null, 
344
	            null
345
	        );
346
	        
347
	        definition.extend(AbstractStyle.STYLE_PERSISTENCE_DEFINITION_NAME);
348
	        
349
	        definition.addDynFieldObject("markerPoint").setClassOfValue(Point2D.class)
350
	        .setMandatory(true);
351
	        definition.addDynFieldList("textFieldAreas").setClassOfItems(Rectangle2D.class)
352
	        .setMandatory(true);
353
	        definition.addDynFieldObject("background").setClassOfValue(IBackgroundFileStyle.class)
354
	        .setMandatory(true);
355
	        definition.addDynFieldObject("defaultSize").setClassOfValue(Dimension.class)
356
	        .setMandatory(true);
357
	        definition.addDynFieldObject("size").setClassOfValue(Dimension.class)
358
	        .setMandatory(true);
359
	    }
346
	        		null, 
347
	        		null);
348
				definition.extend(manager.getDefinition(
349
						AbstractStyle.STYLE_PERSISTENCE_DEFINITION_NAME));
350
				definition.addDynFieldObject("markerPoint").setClassOfValue(Point2D.class)
351
				.setMandatory(true);
352
				definition.addDynFieldList("textFieldAreas").setClassOfItems(Rectangle2D.class)
353
				.setMandatory(true);
354
				definition.addDynFieldObject("background").setClassOfValue(IBackgroundFileStyle.class)
355
				.setMandatory(false);
356
				definition.addDynFieldObject("defaultSize").setClassOfValue(Dimension.class)
357
				.setMandatory(true);
358
				definition.addDynFieldObject("size").setClassOfValue(Dimension.class)
359
				.setMandatory(true);
360
			}
361
			return Boolean.TRUE;
362
		}
360 363
	}
361 364
	
365
	
362 366
	public void loadFromState(PersistentState state)
363 367
			throws PersistenceException {
364 368
		
......
366 370
		
367 371
		this.markerPoint = (Point2D) state.get("markerPoint");
368 372
		this.textFieldAreas = (List<Rectangle2D>) state.get("textFieldAreas");
369
		this.background = (IBackgroundFileStyle) state.get("background");
373
		
374
		if (state.hasValue("background")) {
375
			this.background = (IBackgroundFileStyle) state.get("background");
376
		}
377
		
370 378
		this.defaultSize = (Dimension) state.get("defaultSize");
371 379
		this.sz = (Dimension) state.get("size");
372 380
	}
......
377 385
		
378 386
		state.set("markerPoint", this.markerPoint);
379 387
		state.set("textFieldAreas", this.textFieldAreas);
380
		state.set("background", this.background);
388
		
389
		if (this.background != null) {
390
			state.set("background", this.background);
391
		}
392
		
381 393
		state.set("defaultSize", this.defaultSize);
382
		state.set("size", this.sz);
394
		state.set("size", this.getSize());
383 395
	}
384 396
}

Also available in: Unified diff