root / branches / v2_0_0_prep / libraries / libFMap_mapcontext / src / org / gvsig / fmap / mapcontext / layers / AbstractLinkProperties.java @ 38581
History | View | Annotate | Download (4.07 KB)
1 | 21200 | vcaballero | package org.gvsig.fmap.mapcontext.layers; |
---|---|---|---|
2 | |||
3 | import java.awt.geom.Point2D; |
||
4 | import java.net.URI; |
||
5 | |||
6 | 24504 | jmvivo | import org.gvsig.fmap.dal.exception.ReadException; |
7 | 30173 | jldominguez | import org.gvsig.tools.persistence.Persistent; |
8 | import org.gvsig.tools.persistence.PersistentState; |
||
9 | 32880 | jjdelcerro | import org.gvsig.tools.persistence.exception.PersistenceException; |
10 | 21200 | vcaballero | |
11 | |||
12 | |||
13 | /**
|
||
14 | * This is an abstract class to keep the properties of the HyperLink. One layer may have
|
||
15 | * one or zero LinkProperties. The properties of a Link are:
|
||
16 | * - fieldName, the field?s name of the selected column of the table associated to the
|
||
17 | * layer
|
||
18 | * - extName, the name of the extension that the usser indicates
|
||
19 | * - typeLink, the type of the Link
|
||
20 | * The class implements 'IPersistance' interface to provide persistance to the properties
|
||
21 | * of HyperLink
|
||
22 | 33331 | jjdelcerro | *
|
23 | * @deprecated this functionality has extracted of the core in gvSIG 2.0
|
||
24 | 21200 | vcaballero | */
|
25 | 30173 | jldominguez | public abstract class AbstractLinkProperties implements Persistent { |
26 | 21200 | vcaballero | private String fieldName; |
27 | private String extName; |
||
28 | private int typeLink; |
||
29 | |||
30 | |||
31 | /**
|
||
32 | * Default constructor
|
||
33 | */
|
||
34 | public AbstractLinkProperties(){
|
||
35 | fieldName=null;
|
||
36 | extName=null;
|
||
37 | typeLink=-1;
|
||
38 | } |
||
39 | |||
40 | /**
|
||
41 | * Provides an array with URIs. Returns one URI by geometry that includes the point
|
||
42 | * in its own geometry limits with a allowed tolerance.
|
||
43 | * @param layer, the layer
|
||
44 | * @param point, the point to check that is contained or not in the geometries in the layer
|
||
45 | * @param tolerance, the tolerance allowed. Allowed margin of error to detect if the point
|
||
46 | * is contained in some geometries of the layer
|
||
47 | * @return
|
||
48 | * @throws ReadException
|
||
49 | * @throws BehaviorException
|
||
50 | */
|
||
51 | public abstract URI[] getLink(FLayer layer, Point2D point, double tolerance) throws ReadException; |
||
52 | |||
53 | /**
|
||
54 | * Gets the field?s name of the table that the user has selected
|
||
55 | * @return this name of the field
|
||
56 | */
|
||
57 | public String getField(){ |
||
58 | return this.fieldName; |
||
59 | } |
||
60 | |||
61 | /**
|
||
62 | * Sets the field?s name
|
||
63 | * @param campo, the field?s name
|
||
64 | */
|
||
65 | public void setField(String campo){ |
||
66 | this.fieldName=campo;
|
||
67 | } |
||
68 | |||
69 | /**
|
||
70 | * Gets the type of the HyperLink
|
||
71 | * @return the type
|
||
72 | */
|
||
73 | public int getType(){ |
||
74 | return this.typeLink; |
||
75 | } |
||
76 | |||
77 | /**
|
||
78 | * Sets the type of the HyperLink
|
||
79 | * @param tipo
|
||
80 | */
|
||
81 | public void setType(int tipo){ |
||
82 | this.typeLink=tipo;
|
||
83 | } |
||
84 | |||
85 | /**
|
||
86 | * Gets the extension of the files that the user has indicated like properties of the
|
||
87 | * HyperLink, this extension is added to the content of the field selected in the table
|
||
88 | *
|
||
89 | * @return the extension
|
||
90 | */
|
||
91 | public String getExt(){ |
||
92 | return this.extName; |
||
93 | } |
||
94 | |||
95 | /**
|
||
96 | * Sets the extension
|
||
97 | * @param extension, the extension of the files
|
||
98 | */
|
||
99 | public void setExt(String extension){ |
||
100 | this.extName=extension;
|
||
101 | } |
||
102 | |||
103 | 30173 | jldominguez | // /**
|
104 | // * Provides persistance to the properties of the HyperLink.
|
||
105 | // * @return XMLEntity with the information of the HyperLink
|
||
106 | // */
|
||
107 | // public XMLEntity getXMLEntity() {
|
||
108 | // XMLEntity xml=new XMLEntity();
|
||
109 | // xml.putProperty("typeChild","linkProperties");
|
||
110 | // xml.putProperty("extName",extName);
|
||
111 | // xml.putProperty("fieldName",fieldName);
|
||
112 | // xml.putProperty("typeLink",typeLink);
|
||
113 | // return xml;
|
||
114 | // }
|
||
115 | //
|
||
116 | // /**
|
||
117 | // * Sets the properties of the HyperLink using a XMLEntity that contains the information
|
||
118 | // * @param XMLEntity
|
||
119 | // */
|
||
120 | // public void setXMLEntity(XMLEntity xml) {
|
||
121 | // extName=xml.getStringProperty("extName");
|
||
122 | // fieldName=xml.getStringProperty("fieldName");
|
||
123 | // typeLink=xml.getIntProperty("typeLink");
|
||
124 | // }
|
||
125 | |||
126 | 21200 | vcaballero | /**
|
127 | 30173 | jldominguez | * Saves the internal state of the object on the provided
|
128 | * PersistentState object.
|
||
129 | *
|
||
130 | * @param state
|
||
131 | 21200 | vcaballero | */
|
132 | 30173 | jldominguez | public void saveToState(PersistentState state) throws PersistenceException { |
133 | state.set("extName",extName);
|
||
134 | state.set("fieldName",fieldName);
|
||
135 | state.set("typeLink",typeLink);
|
||
136 | 21200 | vcaballero | } |
137 | |||
138 | /**
|
||
139 | 30173 | jldominguez | * Set the state of the object from the state passed as parameter.
|
140 | *
|
||
141 | * @param state
|
||
142 | 21200 | vcaballero | */
|
143 | 30173 | jldominguez | public void loadFromState(PersistentState state) throws PersistenceException { |
144 | |||
145 | extName = state.getString("extName");
|
||
146 | fieldName = state.getString("fieldName");
|
||
147 | typeLink = state.getInt("typeLink");
|
||
148 | 21200 | vcaballero | } |
149 | 30173 | jldominguez | |
150 | |||
151 | 21200 | vcaballero | } |