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 @ 1594
History | View | Annotate | Download (3.08 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.app.project.documents.layout.fframes.FFrameView; |
28 |
import org.gvsig.app.project.documents.layout.fframes.IFFrame; |
29 |
import org.gvsig.tools.persistence.PersistentState; |
30 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
31 |
|
32 |
/**
|
33 |
* Modelo del Layout.
|
34 |
*
|
35 |
* @author Fernando Gonz?lez Cort?s
|
36 |
*/
|
37 |
public class DefaultLayoutDocument extends AbstractDocument implements |
38 |
LayoutDocument { |
39 |
|
40 |
private static final long serialVersionUID = 7320640550072493414L; |
41 |
public static final String PERSISTENCE_DEFINITION_NAME = "DefaultLayoutDocument"; |
42 |
|
43 |
static final String LAYOUT_CONTEXT_OBJECT = "layoutContext"; |
44 |
|
45 |
private LayoutContext layoutContext = null; |
46 |
private boolean persistIndependent; |
47 |
|
48 |
public DefaultLayoutDocument(DocumentManager factory) {
|
49 |
super(factory);
|
50 |
this.layoutContext = new DefaultLayoutContext(); |
51 |
|
52 |
} |
53 |
|
54 |
public DefaultLayoutDocument() {
|
55 |
this(null); |
56 |
} |
57 |
|
58 |
public void loadFromState(PersistentState state) |
59 |
throws PersistenceException {
|
60 |
super.loadFromState(state);
|
61 |
this.layoutContext = (LayoutContext) state.get(LAYOUT_CONTEXT_OBJECT);
|
62 |
} |
63 |
|
64 |
public void saveToState(PersistentState state) throws PersistenceException { |
65 |
super.saveToState(state);
|
66 |
state.set(LAYOUT_CONTEXT_OBJECT, layoutContext); |
67 |
} |
68 |
|
69 |
public LayoutContext getLayoutContext() {
|
70 |
return layoutContext;
|
71 |
} |
72 |
|
73 |
public Iterator deepiterator() { |
74 |
return this.layoutContext.deepiterator(); |
75 |
} |
76 |
|
77 |
public Iterator iterator() { |
78 |
return this.layoutContext.iterator(); |
79 |
} |
80 |
|
81 |
@Override
|
82 |
public void setPersistIndependent(boolean b) { |
83 |
this.persistIndependent = b;
|
84 |
for (IFFrame frame : this.layoutContext.getAllFFrames()) { |
85 |
if (frame instanceof FFrameView) { |
86 |
FFrameView view = (FFrameView) frame; |
87 |
view.setPersistIndependent(b); |
88 |
} |
89 |
} |
90 |
|
91 |
} |
92 |
|
93 |
@Override
|
94 |
public boolean isPersistIndependent() { |
95 |
return this.persistIndependent; |
96 |
} |
97 |
} |