Revision 32880 branches/v2_0_0_prep/extensions/org.gvsig.symbology/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/symbol/text/impl/SimpleTextSymbol.java
SimpleTextSymbol.java | ||
---|---|---|
50 | 50 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.impl.AbstractSymbol; |
51 | 51 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.impl.CartographicSupportToolkit; |
52 | 52 |
import org.gvsig.tools.ToolsLocator; |
53 |
import org.gvsig.tools.dynobject.DynClass;
|
|
54 |
import org.gvsig.tools.persistence.PersistenceException;
|
|
53 |
import org.gvsig.tools.dynobject.DynStruct;
|
|
54 |
import org.gvsig.tools.persistence.PersistenceManager;
|
|
55 | 55 |
import org.gvsig.tools.persistence.PersistentState; |
56 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
|
56 | 57 |
import org.gvsig.tools.task.Cancellable; |
57 | 58 |
import org.slf4j.Logger; |
58 | 59 |
import org.slf4j.LoggerFactory; |
... | ... | |
330 | 331 |
} |
331 | 332 |
|
332 | 333 |
public void loadFromState(PersistentState state) |
334 |
|
|
333 | 335 |
throws PersistenceException { |
334 | 336 |
// Set parent fill symbol properties |
335 | 337 |
super.loadFromState(state); |
... | ... | |
355 | 357 |
} |
356 | 358 |
|
357 | 359 |
public static void registerPersistence() { |
358 |
// Add the SimpleTextSymbol DynClass definition. |
|
359 |
DynClass dynClass = ToolsLocator.getDynObjectManager().add( |
|
360 |
SIMPLE_TEXT_SYMBOL_DYNCLASS_NAME); |
|
361 |
|
|
360 |
// Add the SimpleTextSymbol persistence definition. |
|
361 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
|
362 |
DynStruct definition = manager.addDefinition( |
|
363 |
SimpleTextSymbol.class, |
|
364 |
SIMPLE_TEXT_SYMBOL_DYNCLASS_NAME, |
|
365 |
SIMPLE_TEXT_SYMBOL_DYNCLASS_NAME+" Persistence definition", |
|
366 |
null, |
|
367 |
null |
|
368 |
); |
|
362 | 369 |
// Extend the Symbol base definition |
363 |
dynClass.extend(SYMBOL_DYNCLASS_NAME);
|
|
370 |
definition.extend(SYMBOL_DYNCLASS_NAME);
|
|
364 | 371 |
|
365 | 372 |
// Auto resize? |
366 |
dynClass.addDynFieldBoolean(FIELD_AUTO_RESIZE).setMandatory(true);
|
|
373 |
definition.addDynFieldBoolean(FIELD_AUTO_RESIZE).setMandatory(true);
|
|
367 | 374 |
// Font |
368 |
dynClass.addDynFieldObject(FIELD_FONT).setMandatory(true);
|
|
375 |
definition.addDynFieldObject(FIELD_FONT).setMandatory(true);
|
|
369 | 376 |
// Rotation |
370 |
dynClass.addDynFieldDouble(FIELD_ROTATION).setMandatory(true);
|
|
377 |
definition.addDynFieldDouble(FIELD_ROTATION).setMandatory(true);
|
|
371 | 378 |
// Text |
372 |
dynClass.addDynFieldString(FIELD_TEXT);
|
|
379 |
definition.addDynFieldString(FIELD_TEXT);
|
|
373 | 380 |
// Text color |
374 |
dynClass.addDynFieldObject(FIELD_TEXT_COLOR).setMandatory(true); |
|
375 |
|
|
376 |
// Register in persistence |
|
377 |
ToolsLocator.getPersistenceManager().registerClass( |
|
378 |
SimpleTextSymbol.class, dynClass); |
|
381 |
definition.addDynFieldObject(FIELD_TEXT_COLOR).setMandatory(true); |
|
379 | 382 |
} |
380 | 383 |
} |
Also available in: Unified diff