Statistics
| Revision:

svn-document-layout / trunk / org.gvsig.app.document.layout2.app / org.gvsig.app.document.layout2.app.mainplugin / src / main / java / org / gvsig / app / project / documents / layout / DefaultLayoutDocument.java @ 433

History | View | Annotate | Download (2.47 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.app.project.documents.layout;
23

    
24
import java.util.Iterator;
25
import org.gvsig.app.project.documents.AbstractDocument;
26
import org.gvsig.app.project.documents.DocumentManager;
27
import org.gvsig.tools.persistence.PersistentState;
28
import org.gvsig.tools.persistence.exception.PersistenceException;
29

    
30
/**
31
 * Modelo del Layout.
32
 * 
33
 * @author Fernando Gonz?lez Cort?s
34
 */
35
public class DefaultLayoutDocument extends AbstractDocument implements
36
    LayoutDocument {
37

    
38
    private static final long serialVersionUID = 7320640550072493414L;
39
    public static final String PERSISTENCE_DEFINITION_NAME = "DefaultLayoutDocument";
40

    
41
    static final String LAYOUT_CONTEXT_OBJECT = "layoutContext";
42

    
43
    private LayoutContext layoutContext = null;
44

    
45
    public DefaultLayoutDocument(DocumentManager factory) {
46
        super(factory);
47
        this.layoutContext = new DefaultLayoutContext();
48

    
49
    }
50

    
51
    public DefaultLayoutDocument() {
52
        this(null);
53
    }
54

    
55
    public void loadFromState(PersistentState state)
56
        throws PersistenceException {
57
        super.loadFromState(state);
58
        this.layoutContext = (LayoutContext) state.get(LAYOUT_CONTEXT_OBJECT);
59
    }
60

    
61
    public void saveToState(PersistentState state) throws PersistenceException {
62
        super.saveToState(state);
63
        state.set(LAYOUT_CONTEXT_OBJECT, layoutContext);
64
    }
65

    
66
    public LayoutContext getLayoutContext() {
67
        return layoutContext;
68
    }
69

    
70
    public Iterator deepiterator() {
71
        return this.layoutContext.deepiterator();
72
    }
73
    
74
    public Iterator iterator() {
75
        return this.layoutContext.iterator();
76
    }
77
}