svn-gvsig-desktop / branches / v2_0_0_prep / applications / appgvSIG / src / org / gvsig / app / tools / swing / serv / field / dynobject / CRSAndDateDynObjectTest.java @ 33597
History | View | Annotate | Download (2.6 KB)
1 |
package org.gvsig.app.tools.swing.serv.field.dynobject; |
---|---|
2 |
|
3 |
import org.cresques.cts.IProjection; |
4 |
|
5 |
import org.gvsig.fmap.crs.CRSFactory; |
6 |
import org.gvsig.fmap.dal.DataTypes; |
7 |
import org.gvsig.tools.ToolsLocator; |
8 |
import org.gvsig.tools.dynobject.DynObject; |
9 |
import org.gvsig.tools.dynobject.DynObjectManager; |
10 |
import org.gvsig.tools.dynobject.impl.DefaultDynClass; |
11 |
import org.gvsig.tools.service.ServiceException; |
12 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
13 |
import org.gvsig.tools.swing.api.dynobject.DynObjectModel; |
14 |
import org.gvsig.tools.swing.api.dynobject.DynObjectSwingManager; |
15 |
|
16 |
public class CRSAndDateDynObjectTest extends DefaultDynClass { |
17 |
|
18 |
public static final String DYNNAME = "AppDynObjectTest"; |
19 |
|
20 |
private static final String DYNDESCRIPTION = ""; |
21 |
|
22 |
private static DynObjectSwingManager swingManager = |
23 |
ToolsSwingLocator.getDynObjectSwingManager(); |
24 |
|
25 |
private static DynObjectManager dynManager = |
26 |
ToolsLocator.getDynObjectManager(); |
27 |
|
28 |
//
|
29 |
/**
|
30 |
* @param manager
|
31 |
* @param name
|
32 |
* @param description
|
33 |
*/
|
34 |
public CRSAndDateDynObjectTest() {
|
35 |
super(dynManager, DYNNAME, DYNDESCRIPTION);
|
36 |
initDynClass(); |
37 |
} |
38 |
|
39 |
public static void registerDynObject() { |
40 |
ToolsLocator.getDynObjectManager().add(new CRSAndDateDynObjectTest());
|
41 |
} |
42 |
|
43 |
/**
|
44 |
* @return
|
45 |
*/
|
46 |
private void initDynClass() { |
47 |
// IProjection proj = null;
|
48 |
// Iterator it = ProjectionPool.iterator();
|
49 |
// while(it.hasNext()){
|
50 |
// proj = (IProjection) it.next();
|
51 |
// if (proj.getAbrev().equals("EPSG:23030")){
|
52 |
// break;
|
53 |
// }
|
54 |
// }
|
55 |
IProjection proj = CRSFactory.getCRS("EPSG:23030");
|
56 |
this.addDynField("srs").setMandatory(true).setType(DataTypes.CRS) |
57 |
.setDefaultFieldValue(proj); |
58 |
this.addDynField("date").setMandatory(true).setType(DataTypes.DATE); |
59 |
this.addDynField("time").setMandatory(true).setType(DataTypes.TIME); |
60 |
this.addDynField("timestamp").setMandatory(true).setType( |
61 |
DataTypes.TIMESTAMP); |
62 |
} |
63 |
|
64 |
/**
|
65 |
* @return
|
66 |
* @throws ServiceException
|
67 |
*/
|
68 |
public DynObjectModel createDynModel() throws ServiceException { |
69 |
DynObjectModel model = swingManager.createEmptyDynObjectModel(this);
|
70 |
model.add("SRS", "crs"); |
71 |
model.add("Date", "date"); |
72 |
model.add("Date", "time"); |
73 |
model.add("Date", "timestamp"); |
74 |
return model;
|
75 |
} |
76 |
|
77 |
public DynObject createDynObject() throws ServiceException { |
78 |
return dynManager.createDynObject(this); |
79 |
} |
80 |
|
81 |
} |