Revision 345 trunk/org.gvsig.app.document.layout2.app/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/project/documents/layout/fframes/FFrameView.java
FFrameView.java | ||
---|---|---|
962 | 962 |
// else use the default value |
963 | 963 |
} |
964 | 964 |
quality = state.getInt(QUALITY_FIELD); |
965 |
mapUnits = state.getInt(MAPUNITS_FIELD);; |
|
966 |
viewDocument = (ViewDocument) state.get(VIEW_FIELD); |
|
965 |
mapUnits = state.getInt(MAPUNITS_FIELD); |
|
967 | 966 |
if (state.hasValue(HAS_TOC_FIELD)) { |
968 | 967 |
this.b_hasToc = state.getBoolean(HAS_TOC_FIELD); |
969 |
} |
|
970 |
if (viewDocument!=null) { |
|
971 |
this.setView(viewDocument); |
|
968 |
} |
|
969 |
|
|
970 |
// When copying and pasting layout documents (in project manager), the view |
|
971 |
// is first persisted (copy action) and then re-created from persistence (paste action). |
|
972 |
// This is a problem, as the re-created view is not the same view as the original one |
|
973 |
// and thus layout stops being synchronized with the right view. |
|
974 |
// Therefore, we try to get first the "live" view if available, and get the persisted |
|
975 |
// one otherwise, which will be used when opening projects. |
|
976 |
ViewDocument persistenceView = (ViewDocument) state.get(VIEW_FIELD); |
|
977 |
if (persistenceView!= null) { |
|
978 |
ViewDocument view = (ViewDocument) ProjectManager.getInstance().getCurrentProject().getDocument(persistenceView.getName(), persistenceView.getTypeName()); |
|
979 |
if (view==null) { |
|
980 |
view = persistenceView; |
|
981 |
} |
|
982 |
this.setView(view); |
|
972 | 983 |
// it is crucial to don't persist the MapContext and get a cloned one from the View instead, |
973 | 984 |
// as the cloned instance is different from the one created using persistence. In particular, |
974 | 985 |
// the cloned one will share the EventBuffer with the original one, while persistence would |
... | ... | |
978 | 989 |
if (layoutScale!=null) { |
979 | 990 |
getMapContext().setScaleView(layoutScale.longValue()); |
980 | 991 |
} |
981 |
getMapContext().getViewPort().setEnvelope(envelope); |
|
992 |
getMapContext().getViewPort().setEnvelope(envelope);
|
|
982 | 993 |
if (this.getLayoutContext()!=null) { |
983 | 994 |
this.getLayoutContext().setTocModel(getMapContext()); |
984 | 995 |
} |
... | ... | |
1314 | 1325 |
|
1315 | 1326 |
public void legendChanged(LegendChangedEvent e) { |
1316 | 1327 |
conditionalRedraw(); |
1317 |
invalidateToc();
|
|
1328 |
refreshToc();
|
|
1318 | 1329 |
} |
1319 | 1330 |
|
1320 | 1331 |
public void layerAdded(LayerCollectionEvent e) { |
... | ... | |
1443 | 1454 |
|
1444 | 1455 |
public void legendChanged(final LegendChangedEvent e) { |
1445 | 1456 |
conditionalRedraw(); |
1446 |
invalidateToc();
|
|
1457 |
refreshToc();
|
|
1447 | 1458 |
} |
1448 | 1459 |
|
1449 | 1460 |
public void layerAdded(final LayerCollectionEvent e) { |
Also available in: Unified diff