Revision 250 trunk/org.gvsig.app.document.layout2.app/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/project/documents/layout/FLayoutGraphics.java
FLayoutGraphics.java | ||
---|---|---|
26 | 26 |
|
27 | 27 |
import org.slf4j.Logger; |
28 | 28 |
import org.slf4j.LoggerFactory; |
29 |
|
|
30 | 29 |
import org.gvsig.andami.PluginServices; |
31 | 30 |
import org.gvsig.app.project.ProjectManager; |
32 | 31 |
import org.gvsig.app.project.documents.layout.fframes.FFrameGroup; |
33 | 32 |
import org.gvsig.app.project.documents.layout.fframes.FFrameLegend; |
34 | 33 |
import org.gvsig.app.project.documents.layout.fframes.IFFrame; |
35 | 34 |
import org.gvsig.app.project.documents.layout.fframes.IFFrameUseFMap; |
35 |
import org.gvsig.app.project.documents.layout.fframes.gui.dialogs.FFrameDialogNotification; |
|
36 |
import org.gvsig.app.project.documents.layout.fframes.gui.dialogs.FFrameViewDialog; |
|
36 | 37 |
import org.gvsig.app.project.documents.layout.fframes.gui.dialogs.IFFrameDialog; |
37 | 38 |
import org.gvsig.app.project.documents.layout.gui.LayoutPanel; |
38 | 39 |
import org.gvsig.app.project.documents.layout.gui.dialogs.FAlignDialog; |
39 | 40 |
import org.gvsig.app.project.documents.layout.gui.dialogs.FBorderDialog; |
40 | 41 |
import org.gvsig.app.project.documents.layout.gui.dialogs.FPositionDialog; |
42 |
import org.gvsig.tools.observer.Observable; |
|
43 |
import org.gvsig.tools.observer.Observer; |
|
41 | 44 |
|
42 | 45 |
/** |
43 | 46 |
* Operaciones realizadas sobre el conjunto de FFrames. |
... | ... | |
245 | 248 |
* Abre el di?logo adecuadao a las propiedades del FFrame seleccionado, |
246 | 249 |
* ahora mismo solo se abre cuando hay un solo FFrame seleccionado. |
247 | 250 |
*/ |
248 |
public boolean openFFrameDialog() {
|
|
251 |
public void openFrameDialog(final Observer observer) {
|
|
249 | 252 |
IFFrame[] selecList = layout.getLayoutContext().getSelectedFFrames(); |
250 | 253 |
|
251 | 254 |
if (selecList.length == 1) { |
252 |
IFFrame frame = selecList[0]; |
|
253 |
IFFrameDialog fframeDialog = layout.createFFrameDialog(frame); |
|
254 |
IFFrame fframeAux = null; |
|
255 |
final IFFrame frame = selecList[0]; |
|
256 |
final IFFrameDialog fframeDialog = layout.createFFrameDialog(frame); |
|
255 | 257 |
if (fframeDialog != null) { |
258 |
Observer onPanelClosedObserver = new Observer() { |
|
259 |
public void update(Observable observable, |
|
260 |
Object notification) { |
|
261 |
if (notification instanceof FFrameDialogNotification && |
|
262 |
((FFrameDialogNotification)notification).getType()==FFrameDialogNotification.DIALOG_CLOSED) { |
|
263 |
onDialogClosed(fframeDialog, frame, observer); |
|
264 |
} |
|
265 |
} |
|
266 |
}; |
|
267 |
fframeDialog.addObserver(onPanelClosedObserver); |
|
268 |
if (observer!=null) { |
|
269 |
fframeDialog.addObserver(observer); |
|
270 |
} |
|
256 | 271 |
PluginServices.getMDIManager().addWindow(fframeDialog); |
257 |
fframeAux = fframeDialog.getFFrame(); |
|
258 |
|
|
259 |
if (fframeAux != null) { |
|
260 |
// if user has pressed cancel, then fframeAux is null |
|
261 |
if (fframeAux instanceof IFFrameUseFMap) |
|
262 |
((IFFrameUseFMap) fframeAux).refresh(); |
|
263 |
layout.getLayoutContext().getFrameCommandsRecord() |
|
264 |
.update(frame, fframeAux); |
|
265 |
fframeAux.getBoundingBox(layout.getLayoutControl().getAT()); |
|
266 |
layout.getLayoutContext().updateFFrames(); |
|
267 |
layout.getLayoutControl().setIsReSel(true); |
|
268 |
layout.getLayoutControl().refresh(); |
|
269 |
} |
|
270 | 272 |
} |
271 |
// layout.setTool(toolaux); |
|
272 |
if (fframeAux != null) |
|
273 |
return true; |
|
274 | 273 |
} |
275 |
return false; |
|
276 | 274 |
} |
275 |
|
|
276 |
public void openFrameDialog() { |
|
277 |
openFrameDialog(null); |
|
278 |
} |
|
279 |
|
|
280 |
/** |
|
281 |
* @Deprecated Use {@link #openFrameDialog()} |
|
282 |
* and {@link #openFrameDialog(Observer)} |
|
283 |
* @return |
|
284 |
*/ |
|
285 |
@Deprecated |
|
286 |
public boolean openFFrameDialog() { |
|
287 |
openFrameDialog(null); |
|
288 |
return true; |
|
289 |
} |
|
290 |
|
|
291 |
protected void onDialogClosed(IFFrameDialog dialog, IFFrame oldFrame, Observer observer) { |
|
292 |
IFFrame fframeAux = dialog.getFFrame(); |
|
293 |
if (fframeAux != null) { |
|
294 |
// if user has pressed cancel, then fframeAux is null |
|
295 |
if (fframeAux instanceof IFFrameUseFMap) |
|
296 |
((IFFrameUseFMap) fframeAux).refresh(); |
|
297 |
layout.getLayoutContext().getFrameCommandsRecord() |
|
298 |
.update(oldFrame, fframeAux); |
|
299 |
fframeAux.getBoundingBox(layout.getLayoutControl().getAT()); |
|
300 |
layout.getLayoutContext().updateFFrames(); |
|
301 |
layout.getLayoutControl().setIsReSel(true); |
|
302 |
layout.getLayoutControl().refresh(); |
|
303 |
if (observer!=null) { |
|
304 |
observer.update(dialog, new FFrameDialogNotification(FFrameDialogNotification.FRAME_CREATED)); |
|
305 |
} |
|
306 |
} |
|
307 |
} |
|
277 | 308 |
|
309 |
|
|
278 | 310 |
/** |
279 | 311 |
* Selecci?n de todos los FFrames del Layout. |
280 | 312 |
*/ |
Also available in: Unified diff