gvsig-raster / org.gvsig.raster.tools / trunk / templates / rasterTaskProjectTemplate / alg_template / sources / io / ProjectTemplateDataParameters.java @ 1870
History | View | Annotate | Download (2.94 KB)
1 |
package org.gvsig.raster.projecttemplate.io; |
---|---|
2 |
|
3 |
import org.gvsig.raster.impl.store.AbstractRasterDataParameters; |
4 |
import org.gvsig.tools.ToolsLocator; |
5 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
6 |
import org.gvsig.tools.dynobject.DynClass; |
7 |
import org.gvsig.tools.dynobject.DynField; |
8 |
import org.gvsig.tools.dynobject.DynObjectManager; |
9 |
import org.gvsig.tools.dynobject.DynStruct; |
10 |
import org.gvsig.tools.persistence.PersistenceManager; |
11 |
import org.gvsig.tools.persistence.PersistentState; |
12 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
13 |
|
14 |
|
15 |
public class ProjectTemplateDataParameters extends AbstractRasterDataParameters { |
16 |
public static final String DYNCLASS_NAME = "ProjectTemplateDataParameters"; |
17 |
protected DelegatedDynObject delegatedDynObject = null; |
18 |
private static DynClass DYNCLASS = null; |
19 |
public static final String FIELD_TESTPARAM = "FIELD_TESTPARAM"; |
20 |
|
21 |
public static void registerDynClass() { |
22 |
DynObjectManager dynman = ToolsLocator.getDynObjectManager(); |
23 |
DynClass dynClass; |
24 |
DynField field; |
25 |
|
26 |
if(dynman == null) |
27 |
return;
|
28 |
|
29 |
if (DYNCLASS == null) { |
30 |
dynClass = AbstractRasterDataParameters.registerDynClass(DYNCLASS_NAME); |
31 |
|
32 |
field = dynClass.addDynFieldObject(FIELD_TESTPARAM); |
33 |
field.setDescription("Parameters to test this template");
|
34 |
field.setClassOfValue(Long.class);
|
35 |
field.setMandatory(false);
|
36 |
|
37 |
DYNCLASS = dynClass; |
38 |
} |
39 |
} |
40 |
|
41 |
public ProjectTemplateDataParameters() {
|
42 |
super();
|
43 |
initialize(); |
44 |
} |
45 |
|
46 |
protected void initialize() { |
47 |
this.delegatedDynObject = (DelegatedDynObject) ToolsLocator
|
48 |
.getDynObjectManager().createDynObject( |
49 |
DYNCLASS); |
50 |
} |
51 |
|
52 |
public String getDataStoreName() { |
53 |
return ProjectTemplateProvider.NAME;
|
54 |
} |
55 |
|
56 |
public String getDescription() { |
57 |
return ProjectTemplateProvider.DESCRIPTION;
|
58 |
} |
59 |
|
60 |
public void loadFromState(PersistentState state) |
61 |
throws PersistenceException {
|
62 |
super.loadFromState(state);
|
63 |
} |
64 |
|
65 |
public void saveToState(PersistentState state) throws PersistenceException { |
66 |
super.saveToState(state);
|
67 |
} |
68 |
|
69 |
public static void registerPersistence() { |
70 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
71 |
DynStruct definition = manager.getDefinition("ProjectTemplateDataParameters_Persistent");
|
72 |
if( definition == null ) { |
73 |
definition = manager.addDefinition( |
74 |
ProjectTemplateDataParameters.class, |
75 |
"ProjectTemplateDataParameters_Persistent",
|
76 |
"ProjectTemplateDataParameters Persistent",
|
77 |
null,
|
78 |
null
|
79 |
); |
80 |
AbstractRasterDataParameters.registerPersistence(definition); |
81 |
} |
82 |
} |
83 |
|
84 |
@Override
|
85 |
protected DelegatedDynObject getDelegatedDynObject() {
|
86 |
return delegatedDynObject;
|
87 |
} |
88 |
|
89 |
|
90 |
public long getTestParameter() { |
91 |
return (Long)this.getDynValue(FIELD_TESTPARAM); |
92 |
} |
93 |
|
94 |
public void setTestParameter(long p) { |
95 |
this.setDynValue(FIELD_TESTPARAM, p);
|
96 |
} |
97 |
|
98 |
public boolean isOverridingHost() { |
99 |
return false; |
100 |
} |
101 |
|
102 |
public void setOverrideHost(boolean over) { |
103 |
|
104 |
} |
105 |
} |