Revision 33420 branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/project/documents/layout/fframes/FFrameOverView.java
FFrameOverView.java | ||
---|---|---|
16 | 16 |
import org.gvsig.app.project.documents.layout.fframes.gui.dialogs.FFrameOverViewDialog; |
17 | 17 |
import org.gvsig.app.project.documents.layout.fframes.gui.dialogs.IFFrameDialog; |
18 | 18 |
import org.gvsig.app.project.documents.layout.gui.LayoutPanel; |
19 |
import org.gvsig.app.project.documents.view.DefaultViewDocument;
|
|
19 |
import org.gvsig.app.project.documents.view.ViewDocument; |
|
20 | 20 |
import org.gvsig.app.project.documents.view.ViewManager; |
21 | 21 |
import org.gvsig.fmap.dal.exception.ReadException; |
22 | 22 |
import org.gvsig.fmap.geom.primitive.Envelope; |
23 | 23 |
import org.gvsig.fmap.mapcontext.MapContext; |
24 | 24 |
import org.gvsig.fmap.mapcontext.ViewPort; |
25 |
import org.gvsig.tools.ToolsLocator; |
|
26 |
import org.gvsig.tools.dynobject.DynStruct; |
|
27 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
28 |
import org.gvsig.tools.persistence.PersistentState; |
|
29 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
|
25 | 30 |
import org.gvsig.utils.XMLEntity; |
26 | 31 |
|
27 | 32 |
|
... | ... | |
32 | 37 |
* @author Vicente Caballero Navarro |
33 | 38 |
*/ |
34 | 39 |
public class FFrameOverView extends FFrameView implements IFFrameViewDependence{ |
35 |
private MapContext assoc_map; |
|
40 |
public static final String PERSISTENCE_DEFINITION_NAME = "FFrameOverView"; |
|
41 |
|
|
42 |
private static final String INDEX_FIELD = "index"; |
|
43 |
|
|
44 |
private MapContext assoc_map; |
|
36 | 45 |
private Envelope extent; |
37 | 46 |
private FFrameView fframeview; |
38 | 47 |
private int dependenceIndex = -1; |
... | ... | |
131 | 140 |
* |
132 | 141 |
* @param v Modelo de la vista. |
133 | 142 |
*/ |
134 |
public void setView(DefaultViewDocument v) {
|
|
143 |
public void setView(ViewDocument v) { |
|
135 | 144 |
view = v; |
136 | 145 |
|
137 | 146 |
ViewPort vp = null; |
... | ... | |
300 | 309 |
|
301 | 310 |
int indice = xml.getIntProperty("indice"); |
302 | 311 |
|
303 |
DefaultViewDocument view = null;
|
|
312 |
ViewDocument view = null; |
|
304 | 313 |
|
305 | 314 |
if (xml.contains("viewName")){ |
306 |
view = (DefaultViewDocument)project.getDocument(xml.getStringProperty("viewName"),ViewManager.TYPENAME);
|
|
315 |
view = (ViewDocument)project.getDocument(xml.getStringProperty("viewName"),ViewManager.TYPENAME); |
|
307 | 316 |
}else { |
308 | 317 |
if (indice != -1) { |
309 | 318 |
try { |
310 | 319 |
List<Document> views = project.getDocuments(ViewManager.TYPENAME); |
311 | 320 |
|
312 |
view = (DefaultViewDocument) views.get(indice);
|
|
321 |
view = (ViewDocument) views.get(indice); |
|
313 | 322 |
} catch (IndexOutOfBoundsException e) { |
314 | 323 |
NotificationManager.addError("No se ha encontrado la vista de indice "+ indice, |
315 | 324 |
e); |
... | ... | |
356 | 365 |
|
357 | 366 |
} |
358 | 367 |
|
368 |
public static void registerPersistent() { |
|
369 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
|
370 |
if( manager.getDefinition(PERSISTENCE_DEFINITION_NAME)==null ) { |
|
371 |
DynStruct definition = manager.addDefinition( |
|
372 |
FFrameOverView.class, |
|
373 |
PERSISTENCE_DEFINITION_NAME, |
|
374 |
"FFrameOverView persistence definition", |
|
375 |
null, |
|
376 |
null |
|
377 |
); |
|
378 |
|
|
379 |
definition.extend(manager.getDefinition(FFrameView.PERSISTENCE_DEFINITION_NAME)); |
|
380 |
|
|
381 |
definition.addDynFieldInt(INDEX_FIELD); |
|
382 |
} |
|
383 |
} |
|
384 |
|
|
385 |
@Override |
|
386 |
public void loadFromState(PersistentState state) |
|
387 |
throws PersistenceException { |
|
388 |
super.loadFromState(state); |
|
389 |
dependenceIndex = state.getInt(INDEX_FIELD); |
|
390 |
} |
|
391 |
|
|
392 |
@Override |
|
393 |
public void saveToState(PersistentState state) throws PersistenceException { |
|
394 |
super.saveToState(state); |
|
395 |
if (fframeview != null) { |
|
396 |
LayoutPanel layout = fframeview.getLayout(); |
|
397 |
IFFrame[] fframes = layout.getLayoutContext().getAllFFrames(); |
|
398 |
|
|
399 |
for (int i = 0; i < fframes.length; i++) { |
|
400 |
if (fframeview.equals(fframes[i])) { |
|
401 |
state.set(INDEX_FIELD, i); |
|
402 |
break; |
|
403 |
} |
|
404 |
} |
|
405 |
} |
|
406 |
|
|
407 |
} |
|
359 | 408 |
} |
Also available in: Unified diff