Revision 147 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/gui/DefaultLayoutPanel.java
DefaultLayoutPanel.java | ||
---|---|---|
62 | 62 |
import org.gvsig.app.project.documents.layout.LayoutControl; |
63 | 63 |
import org.gvsig.app.project.documents.layout.LayoutDocument; |
64 | 64 |
import org.gvsig.app.project.documents.layout.LayoutManager; |
65 |
import org.gvsig.app.project.documents.layout.TocModelChangedNotification; |
|
65 | 66 |
import org.gvsig.app.project.documents.layout.fframes.IFFrame; |
66 | 67 |
import org.gvsig.app.project.documents.layout.fframes.IFFrameUseFMap; |
67 | 68 |
import org.gvsig.app.project.documents.layout.fframes.gui.dialogs.IFFrameDialog; |
68 | 69 |
import org.gvsig.app.project.documents.layout.gui.dialogs.FConfigLayoutDialog; |
69 | 70 |
import org.gvsig.app.project.documents.layout.gui.panel.UIManager; |
71 |
import org.gvsig.app.project.documents.layout.toc.TocModelObserver; |
|
72 |
import org.gvsig.app.project.documents.view.toc.gui.TOC; |
|
73 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
74 |
import org.gvsig.fmap.mapcontext.events.AtomicEvent; |
|
70 | 75 |
import org.gvsig.fmap.mapcontext.events.ColorEvent; |
71 | 76 |
import org.gvsig.fmap.mapcontext.events.ExtentEvent; |
72 | 77 |
import org.gvsig.fmap.mapcontext.events.ProjectionEvent; |
78 |
import org.gvsig.fmap.mapcontext.events.listeners.AtomicEventListener; |
|
79 |
import org.gvsig.fmap.mapcontext.layers.CancelationException; |
|
80 |
import org.gvsig.fmap.mapcontext.layers.LayerCollectionEvent; |
|
81 |
import org.gvsig.fmap.mapcontext.layers.LayerCollectionListener; |
|
82 |
import org.gvsig.fmap.mapcontext.layers.LayerEvent; |
|
83 |
import org.gvsig.fmap.mapcontext.layers.LayerListener; |
|
84 |
import org.gvsig.fmap.mapcontext.layers.LayerPositionEvent; |
|
85 |
import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendChangedEvent; |
|
86 |
import org.gvsig.fmap.mapcontext.rendering.legend.events.listeners.LegendListener; |
|
73 | 87 |
import org.gvsig.gui.beans.swing.JFileChooser; |
74 | 88 |
import org.gvsig.tools.ToolsLocator; |
75 | 89 |
import org.gvsig.tools.dynobject.DynStruct; |
... | ... | |
120 | 134 |
private UIManager uiManager; |
121 | 135 |
|
122 | 136 |
private JPanel leftPanel; |
137 |
private TOC toc = null; |
|
123 | 138 |
|
124 | 139 |
private JSplitPane splitPane; |
125 |
private int lastPanePos = 0; |
|
140 |
private int lastPanePos = 150;
|
|
126 | 141 |
|
127 | 142 |
/** |
128 | 143 |
* Creates a new Layout object. |
... | ... | |
151 | 166 |
} |
152 | 167 |
} |
153 | 168 |
}); |
169 |
|
|
170 |
setToc(); |
|
154 | 171 |
} |
155 | 172 |
|
156 | 173 |
/** |
... | ... | |
158 | 175 |
*/ |
159 | 176 |
private void initComponents() { |
160 | 177 |
this.setLayout(new BorderLayout()); |
178 |
|
|
161 | 179 |
leftPanel = new JPanel(new BorderLayout()); |
162 | 180 |
splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, |
163 | 181 |
leftPanel, layoutControl.getComponent()); |
164 | 182 |
splitPane.setResizeWeight(0.2); |
165 | 183 |
splitPane.setOneTouchExpandable(true); |
166 | 184 |
splitPane.setContinuousLayout(true); |
167 |
|
|
185 |
setToc(); |
|
168 | 186 |
add(splitPane, BorderLayout.CENTER); |
169 | 187 |
layoutControl.getComponent().setDoubleBuffered(true); |
170 | 188 |
} |
189 |
|
|
190 |
protected void createToc() { |
|
191 |
if (toc==null) { |
|
192 |
toc = new TOC(); |
|
193 |
} |
|
194 |
toc.setMapContext(getLayoutContext().getTocModel()); |
|
195 |
leftPanel.removeAll(); |
|
196 |
leftPanel.add(toc); |
|
197 |
} |
|
198 |
|
|
199 |
protected void setToc() { |
|
200 |
if (getLayoutContext()!=null) { |
|
201 |
if (getLayoutContext().getTocModel()!=null) { |
|
202 |
createToc(); |
|
203 |
} |
|
204 |
else if (toc!=null) { |
|
205 |
DefaultLayoutPanel.this.leftPanel.remove(toc); |
|
206 |
} |
|
207 |
|
|
208 |
this.getLayoutContext().addTocObserver(new TocModelObserver() { |
|
209 |
|
|
210 |
public void tocUpdated(Object observable, |
|
211 |
TocModelChangedNotification notification) { |
|
212 |
if (TocModelChangedNotification.MODEL_CHANGED==notification.getType()) { |
|
213 |
if (DefaultLayoutPanel.this.toc!=null){ |
|
214 |
DefaultLayoutPanel.this.toc.refresh(); |
|
215 |
} |
|
216 |
} |
|
217 |
else if (TocModelChangedNotification.MODEL_SET==notification.getType()) { |
|
218 |
MapContext mapContext = notification.getModel(); |
|
219 |
if (mapContext!=null) { |
|
220 |
createToc(); |
|
221 |
} |
|
222 |
else if (DefaultLayoutPanel.this.toc!=null){ |
|
223 |
DefaultLayoutPanel.this.leftPanel.remove(DefaultLayoutPanel.this.toc); |
|
224 |
} |
|
225 |
} |
|
226 |
} |
|
227 |
}); |
|
228 |
} |
|
229 |
} |
|
171 | 230 |
|
172 | 231 |
/** |
173 | 232 |
* Open the dialog of Layout properties. |
... | ... | |
466 | 525 |
} |
467 | 526 |
|
468 | 527 |
public void update(Observable observable, Object notification) { |
469 |
this.layoutContext.updateFFrames();
|
|
470 |
this.layoutControl.refresh();
|
|
528 |
this.layoutContext.updateFFrames();
|
|
529 |
this.layoutControl.refresh();
|
|
471 | 530 |
} |
472 | 531 |
|
473 | 532 |
public Object getWindowProfile() { |
... | ... | |
554 | 613 |
} |
555 | 614 |
} |
556 | 615 |
|
557 |
public void addLateralComponent(JComponent c) { |
|
558 |
leftPanel.removeAll(); |
|
559 |
leftPanel.add(c, BorderLayout.CENTER); |
|
560 |
} |
|
561 |
|
|
562 |
public void removeLateralComponent(JComponent c) { |
|
563 |
if (leftPanel.getComponentCount()>0) { |
|
564 |
leftPanel.remove(c); |
|
565 |
} |
|
566 |
} |
|
567 |
|
|
568 |
public void hideLateralComponent(JComponent c) { |
|
616 |
public void hideToc(JComponent c) { |
|
569 | 617 |
lastPanePos = splitPane.getDividerLocation(); |
570 | 618 |
splitPane.setDividerLocation(0); |
571 | 619 |
} |
572 | 620 |
|
573 |
public void showLateralComponent(JComponent c) {
|
|
621 |
public void showToc(JComponent c) {
|
|
574 | 622 |
splitPane.setDividerLocation(lastPanePos); |
575 | 623 |
|
576 | 624 |
} |
Also available in: Unified diff