Revision 146 branches/usability_v2/org.gvsig.app.document.layout.app/org.gvsig.app.document.layout.app.mainplugin/src/main/java/org/gvsig/app/project/documents/layout/fframes/FFrameView.java
FFrameView.java | ||
---|---|---|
54 | 54 |
import org.gvsig.fmap.mapcontext.MapContext; |
55 | 55 |
import org.gvsig.fmap.mapcontext.MapContextException; |
56 | 56 |
import org.gvsig.fmap.mapcontext.ViewPort; |
57 |
import org.gvsig.fmap.mapcontext.events.AtomicEvent; |
|
57 | 58 |
import org.gvsig.fmap.mapcontext.events.ColorEvent; |
58 | 59 |
import org.gvsig.fmap.mapcontext.events.ExtentEvent; |
59 | 60 |
import org.gvsig.fmap.mapcontext.events.ProjectionEvent; |
61 |
import org.gvsig.fmap.mapcontext.events.listeners.AtomicEventListener; |
|
60 | 62 |
import org.gvsig.fmap.mapcontext.events.listeners.ViewPortListener; |
61 | 63 |
import org.gvsig.fmap.mapcontext.layers.CancelationException; |
62 | 64 |
import org.gvsig.fmap.mapcontext.layers.LayerCollectionEvent; |
... | ... | |
636 | 638 |
public void updateScaleCtrl() { |
637 | 639 |
NewStatusBar statusbar = PluginServices.getMainFrame().getStatusBar(); |
638 | 640 |
MapContext mapContext = this.getMapContext(); |
641 |
if (mapContext==null) { |
|
642 |
return; |
|
643 |
} |
|
639 | 644 |
statusbar.setMessage("units", |
640 | 645 |
PluginServices.getText(this, mapContext.getDistanceName())); |
641 | 646 |
statusbar.setControlValue("layout-view-change-scale", |
... | ... | |
792 | 797 |
} |
793 | 798 |
|
794 | 799 |
protected void removeToc() { |
795 |
this.toc = null; |
|
796 |
this.getLayoutPanel().removeLateralComponent(); |
|
800 |
if (this.getLayoutPanel()!=null && this.toc!=null) { |
|
801 |
this.getLayoutPanel().removeLateralComponent(this.toc); |
|
802 |
this.toc = null; |
|
803 |
} |
|
797 | 804 |
} |
798 | 805 |
|
799 | 806 |
@Override |
... | ... | |
846 | 853 |
protected void invalidateLayout() { |
847 | 854 |
b_validCache = false; |
848 | 855 |
observers.notifyObservers(this, |
849 |
new DefaultLayoutNotification(LayoutNotification.LAYOUT_INVALIDATED));
|
|
856 |
new DefaultLayoutNotification(LayoutNotification.LAYOUT_REFRESH));
|
|
850 | 857 |
} |
851 | 858 |
|
852 | 859 |
public void refresh() { |
... | ... | |
869 | 876 |
if (linked) { |
870 | 877 |
getView().getMapContext().addLayerListener(viewDocListener); |
871 | 878 |
getView().getMapContext().getLayers().addLayerCollectionListener(viewDocListener); |
879 |
getView().getMapContext().addAtomicEventListener(viewDocListener); |
|
872 | 880 |
} |
873 | 881 |
if (getTypeScale()==IFFrameUseFMap.AUTOMATICO) { |
874 | 882 |
getView().getMapContext().getViewPort().addViewPortListener(viewDocListener); |
... | ... | |
920 | 928 |
if (this.getView()!=null && this.getView().getMapContext()!=null) { |
921 | 929 |
clearViewListeners(this.getView().getMapContext()); |
922 | 930 |
} |
923 |
if (b_hasToc && this.getLayoutPanel()!=null) {
|
|
924 |
this.getLayoutPanel().removeLateralComponent();
|
|
931 |
if (b_hasToc) { |
|
932 |
removeToc();
|
|
925 | 933 |
} |
926 | 934 |
} |
927 | 935 |
|
... | ... | |
949 | 957 |
protected void doSetSelected(int selectedStatus) { |
950 | 958 |
super.doSetSelected(selectedStatus); |
951 | 959 |
addToc(); |
960 |
updateScaleCtrl(); |
|
952 | 961 |
} |
953 | 962 |
|
954 | 963 |
private class ViewDocListener |
955 |
implements ViewPortListener, LegendListener, LayerCollectionListener { |
|
964 |
implements ViewPortListener, LegendListener, LayerCollectionListener, AtomicEventListener {
|
|
956 | 965 |
|
957 | 966 |
public void extentChanged(ExtentEvent e) { |
958 | 967 |
if (!b_fframeOriginatedUpdate && getTypeScale()==AUTOMATICO) { |
... | ... | |
1036 | 1045 |
throws CancelationException { |
1037 | 1046 |
conditionalRedraw(); |
1038 | 1047 |
} |
1048 |
|
|
1049 |
public void atomicEvent(AtomicEvent e) { |
|
1050 |
conditionalRedraw(); |
|
1051 |
// TODO Auto-generated method stub |
|
1052 |
|
|
1053 |
} |
|
1039 | 1054 |
} |
1040 | 1055 |
|
1041 | 1056 |
private class OwnMapContextListener |
Also available in: Unified diff