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 / fframes / AbstractFFrameViewDependence.java @ 324
History | View | Annotate | Download (3.4 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.fframes; |
23 |
|
24 |
import org.gvsig.tools.ToolsLocator; |
25 |
import org.gvsig.tools.dynobject.DynStruct; |
26 |
import org.gvsig.tools.persistence.PersistenceManager; |
27 |
import org.gvsig.tools.persistence.PersistentState; |
28 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
29 |
|
30 |
/**
|
31 |
* @author gvSIG Team
|
32 |
* @version $Id$
|
33 |
*
|
34 |
*/
|
35 |
public abstract class AbstractFFrameViewDependence extends FFrame implements |
36 |
IFFrameViewDependence { |
37 |
|
38 |
public static final String PERSISTENCE_DEFINITION_NAME = |
39 |
"AbstractFFrameViewDependence";
|
40 |
private static final String FFRAMEVIEWDEPENDENCE_FIELD = |
41 |
"fframeViewDependence";
|
42 |
|
43 |
protected FFrameView fframeViewDependence = null; |
44 |
|
45 |
@Override
|
46 |
public IFFrame clone() throws CloneNotSupportedException { |
47 |
IFFrame frame = (IFFrame) super.clone();
|
48 |
// ((IFFrameViewDependence)
|
49 |
// frame).initDependence(layout.getLayoutContext().getAllFFrames());
|
50 |
return frame;
|
51 |
} |
52 |
|
53 |
public void setFFrameDependence(IFFrame f) { |
54 |
fframeViewDependence = (FFrameView) f; |
55 |
} |
56 |
|
57 |
public void refreshDependence(IFFrame fant, IFFrame fnew) { |
58 |
if ((fframeViewDependence != null) && fframeViewDependence.equals(fant)) { |
59 |
fframeViewDependence = (FFrameView) fnew; |
60 |
} |
61 |
} |
62 |
|
63 |
public IFFrame[] getFFrameDependence() { |
64 |
return new IFFrame[] { fframeViewDependence }; |
65 |
} |
66 |
|
67 |
public static void registerPersistent() { |
68 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
69 |
if (manager.getDefinition(PERSISTENCE_DEFINITION_NAME) == null) { |
70 |
DynStruct definition = |
71 |
manager.addDefinition(AbstractFFrameViewDependence.class, |
72 |
PERSISTENCE_DEFINITION_NAME, |
73 |
"AbstractFFrameViewDependence persistence definition",
|
74 |
null, null); |
75 |
|
76 |
definition.extend(manager |
77 |
.getDefinition(FFrame.PERSISTENCE_DEFINITION_NAME)); |
78 |
|
79 |
definition.addDynFieldObject(FFRAMEVIEWDEPENDENCE_FIELD) |
80 |
.setClassOfValue(FFrameView.class); |
81 |
} |
82 |
} |
83 |
|
84 |
@Override
|
85 |
public void loadFromState(PersistentState state) |
86 |
throws PersistenceException {
|
87 |
super.loadFromState(state);
|
88 |
fframeViewDependence = |
89 |
(FFrameView) state.get(FFRAMEVIEWDEPENDENCE_FIELD); |
90 |
} |
91 |
|
92 |
@Override
|
93 |
public void saveToState(PersistentState state) throws PersistenceException { |
94 |
super.saveToState(state);
|
95 |
state.set(FFRAMEVIEWDEPENDENCE_FIELD, fframeViewDependence); |
96 |
} |
97 |
} |