Revision 237

View differences:

trunk/org.gvsig.app.document.layout2.app/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/project/documents/layout/LayoutContext.java
272 272
    public void removeTocObserver(TocModelObserver observer);
273 273
    
274 274
    public void removeTocObservers();
275
    
276
    /**
277
     * True when the document window has been opened at least once, false otherwise. This is required
278
     * to decide whether the page setting dialog has to be shown to the user, otherwise it would be
279
     * shown every time the document is opened from project persistence
280
     */
281
	public boolean hasDocBeenOpened();
275 282

  
283
    /**
284
     * True when the document window has been opened at least once, false otherwise. This is required
285
     * to decide whether the page setting dialog has to be shown to the user, otherwise it would be
286
     * shown every time the document is opened from project persistence
287
     */
288
	public void setHasDocBeenOpened(boolean hasBeenOpened);
276 289
}
trunk/org.gvsig.app.document.layout2.app/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/project/documents/layout/DefaultLayoutContext.java
57 57
    private static final String IS_GRID_VISIBLE = "IS_GRID_VISIBLE";
58 58
    private static final String IS_RULER_VISIBLE = "IS_RULER_VISIBLE";
59 59
    private static final String ISEDITABLE_FIELD = "isEditable";
60
    /**
61
     * True when the document window has been opened at least once, false otherwise. This is required
62
     * to decide whether the page setting dialog has to be shown to the user, otherwise it would be
63
     * shown every time the document is opened from project persistence
64
     */
65
    private static final String HAS_WINDOW_BEEN_EVER_OPEN_FIELD = "hasDocBeenOpened";
60 66
    
61 67
    private static final String NUMBEHIND_FIELD = "numBehind";
62 68
    private static final String NUMBEFORE_FIELD = "numBefore";
......
73 79
    private int numBehind = 0;
74 80
    private boolean isEditable = true;
75 81
    private Boolean adjustToGrid = null;
82
    private boolean hasDocBeenOpened = false;
76 83
    
77 84
    private Boolean m_showRuler;
78 85
    private Boolean isGridVisible = null;
......
185 192
    }
186 193

  
187 194
    public void addFFrame(IFFrame frame, boolean clearSelection, boolean select) {
195
    	frame.setLayoutContext(this);
188 196
        IFFrame[] fframes = getFFrames();
189 197
        if (clearSelection) {
190 198
            for (int i = fframes.length - 1; i >= 0; i--) {
......
358 366
            definition.addDynFieldBoolean(ISEDITABLE_FIELD).setMandatory(true);
359 367
            definition.addDynFieldBoolean(IS_GRID_VISIBLE).setMandatory(false);
360 368
            definition.addDynFieldBoolean(IS_RULER_VISIBLE).setMandatory(false);
369
            definition.addDynFieldBoolean(HAS_WINDOW_BEEN_EVER_OPEN_FIELD).setMandatory(false);
361 370
        }
362 371

  
363 372
        FFrame.registerPersistent();
......
375 384
        if (state.hasValue(IS_RULER_VISIBLE)) {
376 385
            m_showRuler = state.getBoolean(IS_RULER_VISIBLE);
377 386
        }
387
        if (state.hasValue(HAS_WINDOW_BEEN_EVER_OPEN_FIELD)) {
388
        	setHasDocBeenOpened(state.getBoolean(HAS_WINDOW_BEEN_EVER_OPEN_FIELD));
389
        }
390
        else {
391
        	// if not present, assume it was opened (as we are loading from persistence)
392
        	setHasDocBeenOpened(true);
393
        }
378 394
        
379 395
        numBehind = state.getInt(NUMBEHIND_FIELD);
380 396
        numBefore = state.getInt(NUMBEFORE_FIELD);
......
393 409
        state.set(NUMBEFORE_FIELD, numBefore);
394 410
        state.set(ATTRIBUTES_FIELD, m_attributes);
395 411
        state.set(FFRAMES_FIELD, fframes);
396
        
412
        state.set(HAS_WINDOW_BEEN_EVER_OPEN_FIELD, new Boolean(hasDocBeenOpened()));
397 413
        state.set(IS_RULER_VISIBLE, this.getRuler());
398 414
        state.set(IS_GRID_VISIBLE, this.isGridVisible());
399 415
    }
......
453 469
	public void removeTocObservers() {
454 470
		this.tocObservers.deleteObservers();		
455 471
	}
472

  
473
    /**
474
     * True when the document window has been opened at least once, false otherwise. This is required
475
     * to decide whether the page setting dialog has to be shown to the user, otherwise it would be
476
     * shown every time the document is opened from project persistence
477
     */
478
	public boolean hasDocBeenOpened() {
479
		return hasDocBeenOpened;
480
	}
481

  
482
    /**
483
     * True when the document window has been opened at least once, false otherwise. This is required
484
     * to decide whether the page setting dialog has to be shown to the user, otherwise it would be
485
     * shown every time the document is opened from project persistence
486
     */
487
	public void setHasDocBeenOpened(boolean hasBeenOpened) {
488
		this.hasDocBeenOpened = hasBeenOpened;
489
	}
456 490
}
trunk/org.gvsig.app.document.layout2.app/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/project/documents/layout/gui/DefaultLayoutPanel.java
132 132
	private int lastPanePos = 150;
133 133

  
134 134
	private Boolean b_isTocEnabled = null;
135
	private boolean b_firstTimeOpened = true;
136 135

  
137 136
    /**
138 137
     * Creates a new Layout object.
......
418 417
     * @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated()
419 418
     */
420 419
    public void windowActivated() {
421
		if (b_firstTimeOpened) {
422
			b_firstTimeOpened = false;
420
		if (getLayoutContext()!=null && !getLayoutContext().hasDocBeenOpened()) {
421
			getLayoutContext().setHasDocBeenOpened(true);
423 422
            if (isInitConfigDialogEnabled()) {
424 423
            	FConfigLayoutDialog configDialog = new FConfigLayoutDialog(this, true);
425 424
            	ApplicationLocator.getManager().getUIManager().addCentredWindow(configDialog);

Also available in: Unified diff