Revision 106

View differences:

trunk/org.gvsig.app.document.layout.app/org.gvsig.app.document.layout.app.mainplugin/src/main/java/org/gvsig/app/project/documents/layout/DefaultLayoutContext.java
51 51
    public static final String PERSISTENCE_DEFINITION_NAME = "LayoutContext";
52 52

  
53 53
    private static final String ISADJUSTINGTOGRID_FIELD = "isAdjustingToGrid";
54
    private static final String IS_GRID_VISIBLE = "IS_GRID_VISIBLE";
55
    private static final String IS_RULER_VISIBLE = "IS_RULER_VISIBLE";
54 56
    private static final String ISEDITABLE_FIELD = "isEditable";
57
    
55 58
    private static final String NUMBEHIND_FIELD = "numBehind";
56 59
    private static final String NUMBEFORE_FIELD = "numBefore";
57 60
    private static final String ATTRIBUTES_FIELD = "attributes";
......
318 321
                    PERSISTENCE_DEFINITION_NAME,
319 322
                    "Layout context persistence definition", null, null);
320 323

  
321
            definition.addDynFieldBoolean(ISADJUSTINGTOGRID_FIELD)
322
                .setMandatory(true);
323
            definition.addDynFieldBoolean(ISEDITABLE_FIELD).setMandatory(true);
324 324
            definition.addDynFieldInt(NUMBEHIND_FIELD).setMandatory(true);
325 325
            definition.addDynFieldInt(NUMBEFORE_FIELD).setMandatory(true);
326 326
            definition.addDynFieldObject(ATTRIBUTES_FIELD)
327 327
                .setClassOfValue(Attributes.class).setMandatory(true);
328 328
            definition.addDynFieldArray(FFRAMES_FIELD)
329 329
                .setClassOfItems(IFFrame.class).setMandatory(true);
330
            // ==================
331
            definition.addDynFieldBoolean(ISADJUSTINGTOGRID_FIELD).setMandatory(true);
332
            definition.addDynFieldBoolean(ISEDITABLE_FIELD).setMandatory(true);
333
            definition.addDynFieldBoolean(IS_GRID_VISIBLE).setMandatory(false);
334
            definition.addDynFieldBoolean(IS_RULER_VISIBLE).setMandatory(false);
330 335
        }
331 336

  
332 337
        FFrame.registerPersistent();
......
337 342
        throws PersistenceException {
338 343
        adjustToGrid = state.getBoolean(ISADJUSTINGTOGRID_FIELD);
339 344
        isEditable = state.getBoolean(ISEDITABLE_FIELD);
345
        
346
        if (state.hasValue(IS_GRID_VISIBLE)) {
347
            isGridVisible = state.getBoolean(IS_GRID_VISIBLE);
348
        }
349
        if (state.hasValue(IS_RULER_VISIBLE)) {
350
            m_showRuler = state.getBoolean(IS_RULER_VISIBLE);
351
        }
352
        
340 353
        numBehind = state.getInt(NUMBEHIND_FIELD);
341 354
        numBefore = state.getInt(NUMBEFORE_FIELD);
342 355
        m_attributes = (Attributes) state.get(ATTRIBUTES_FIELD);
......
354 367
        state.set(NUMBEFORE_FIELD, numBefore);
355 368
        state.set(ATTRIBUTES_FIELD, m_attributes);
356 369
        state.set(FFRAMES_FIELD, fframes);
357

  
370
        
371
        state.set(IS_RULER_VISIBLE, this.m_showRuler);
372
        state.set(IS_GRID_VISIBLE, this.isGridVisible);
358 373
    }
359 374

  
360 375
    public void setNumBefore(int numBefore) {

Also available in: Unified diff