Revision 43524 trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.labeling.app/org.gvsig.labeling.app.mainplugin/src/main/java/org/gvsig/labeling/placements/PointPlacementConstraints.java

View differences:

PointPlacementConstraints.java
89 89
 *
90 90
 */
91 91
public class PointPlacementConstraints extends AbstractPlacementConstraints {
92
	
92

  
93 93
	public static final String POINT_PLACEM_CONSTRAINTS_PERSIST_NAME =
94 94
			"POINT_PLACEM_CONSTRAINTS_PERSIST_NAME";
95 95
	private PointLabelPositioner positioner = null;
......
107 107
	public void setPositioner(PointLabelPositioner pos) {
108 108
		this.positioner = pos;
109 109
	}
110
	
110

  
111 111
	public void saveToState(PersistentState state) throws PersistenceException {
112 112

  
113 113
		super.saveToState(state);
......
117 117
	}
118 118

  
119 119
	public void loadFromState(PersistentState state) throws PersistenceException {
120
		
120

  
121 121
		super.loadFromState(state);
122 122
		if (state.hasValue("pointPositioner")) {
123 123
			positioner = (PointLabelPositioner) state.get("pointPositioner");
......
125 125
	}
126 126

  
127 127
	public static void registerPersistent() {
128
		
128

  
129 129
		PersistenceManager manager = ToolsLocator.getPersistenceManager();
130 130
		if( manager.getDefinition(POINT_PLACEM_CONSTRAINTS_PERSIST_NAME) == null) {
131
			
131

  
132 132
			DynStruct definition = manager.addDefinition(
133 133
					PointPlacementConstraints.class,
134 134
					POINT_PLACEM_CONSTRAINTS_PERSIST_NAME,
135 135
					POINT_PLACEM_CONSTRAINTS_PERSIST_NAME +" Persistence definition",
136
					null, 
136
					null,
137 137
					null);
138
			
138

  
139 139
			definition.extend(manager.getDefinition(
140 140
					AbstractPlacementConstraints.PLACEMENT_CONSTRAINTS_PERSISTENCE_NAME));
141 141
			definition.addDynFieldObject("pointPositioner").setClassOfValue(
142 142
					PointLabelPositioner.class).setMandatory(false);
143
		}		
143
		}
144 144
	}
145
	
145

  
146 146
	public Object clone() throws CloneNotSupportedException {
147
		
147

  
148 148
		PointPlacementConstraints resp = (PointPlacementConstraints) super.clone();
149
		PointLabelPositioner aux = (PointLabelPositioner) positioner.clone();
150
		resp.setPositioner(aux);
149
		if(positioner!=null){
150
		    PointLabelPositioner aux = (PointLabelPositioner) positioner.clone();
151
		    resp.setPositioner(aux);
152
		}
151 153
		return resp;
152 154
	}
153 155

  

Also available in: Unified diff