root / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / layers / AbstractLinkProperties.java @ 25274
History | View | Annotate | Download (3.09 KB)
1 | 13558 | evercher | package com.iver.cit.gvsig.fmap.layers; |
---|---|---|---|
2 | |||
3 | import java.awt.geom.Point2D; |
||
4 | import java.net.URI; |
||
5 | |||
6 | import com.iver.cit.gvsig.fmap.tools.BehaviorException; |
||
7 | 13913 | jaume | import com.iver.utiles.IPersistence; |
8 | 13558 | evercher | import com.iver.utiles.XMLEntity; |
9 | |||
10 | /**
|
||
11 | * This is an abstract class to keep the properties of the HyperLink. One layer may have
|
||
12 | * one or zero LinkProperties. The properties of a Link are:
|
||
13 | * - fieldName, the field?s name of the selected column of the table associated to the
|
||
14 | * layer
|
||
15 | * - extName, the name of the extension that the usser indicates
|
||
16 | * - typeLink, the type of the Link
|
||
17 | * The class implements 'IPersistance' interface to provide persistance to the properties
|
||
18 | * of HyperLink
|
||
19 | */
|
||
20 | 13913 | jaume | public abstract class AbstractLinkProperties implements IPersistence{ |
21 | 13558 | evercher | private String fieldName; |
22 | private String extName; |
||
23 | private int typeLink; |
||
24 | |||
25 | |||
26 | /**
|
||
27 | * Default constructor
|
||
28 | */
|
||
29 | public AbstractLinkProperties(){
|
||
30 | fieldName=null;
|
||
31 | extName=null;
|
||
32 | typeLink=-1;
|
||
33 | } |
||
34 | |||
35 | /**
|
||
36 | * Provides an array with URIs. Returns one URI by geometry that includes the point
|
||
37 | * in its own geometry limits with a allowed tolerance.
|
||
38 | * @param layer, the layer
|
||
39 | * @param point, the point to check that is contained or not in the geometries in the layer
|
||
40 | * @param tolerance, the tolerance allowed. Allowed margin of error to detect if the point
|
||
41 | * is contained in some geometries of the layer
|
||
42 | * @return
|
||
43 | * @throws BehaviorException
|
||
44 | */
|
||
45 | public abstract URI[] getLink(FLayer layer, Point2D point, double tolerance)throws BehaviorException; |
||
46 | |||
47 | /**
|
||
48 | * Gets the field?s name of the table that the user has selected
|
||
49 | * @return this name of the field
|
||
50 | */
|
||
51 | public String getField(){ |
||
52 | return this.fieldName; |
||
53 | } |
||
54 | |||
55 | /**
|
||
56 | * Sets the field?s name
|
||
57 | * @param campo, the field?s name
|
||
58 | */
|
||
59 | public void setField(String campo){ |
||
60 | this.fieldName=campo;
|
||
61 | } |
||
62 | |||
63 | /**
|
||
64 | * Gets the type of the HyperLink
|
||
65 | * @return the type
|
||
66 | */
|
||
67 | public int getType(){ |
||
68 | return this.typeLink; |
||
69 | } |
||
70 | |||
71 | /**
|
||
72 | * Sets the type of the HyperLink
|
||
73 | * @param tipo
|
||
74 | */
|
||
75 | public void setType(int tipo){ |
||
76 | this.typeLink=tipo;
|
||
77 | } |
||
78 | |||
79 | /**
|
||
80 | * Gets the extension of the files that the user has indicated like properties of the
|
||
81 | * HyperLink, this extension is added to the content of the field selected in the table
|
||
82 | *
|
||
83 | * @return the extension
|
||
84 | */
|
||
85 | public String getExt(){ |
||
86 | return this.extName; |
||
87 | } |
||
88 | |||
89 | /**
|
||
90 | * Sets the extension
|
||
91 | * @param extension, the extension of the files
|
||
92 | */
|
||
93 | public void setExt(String extension){ |
||
94 | this.extName=extension;
|
||
95 | } |
||
96 | |||
97 | /**
|
||
98 | * Provides persistance to the properties of the HyperLink.
|
||
99 | * @return XMLEntity with the information of the HyperLink
|
||
100 | */
|
||
101 | public XMLEntity getXMLEntity() {
|
||
102 | XMLEntity xml=new XMLEntity();
|
||
103 | xml.putProperty("typeChild","linkProperties"); |
||
104 | xml.putProperty("extName",extName);
|
||
105 | xml.putProperty("fieldName",fieldName);
|
||
106 | xml.putProperty("typeLink",typeLink);
|
||
107 | return xml;
|
||
108 | } |
||
109 | |||
110 | /**
|
||
111 | * Sets the properties of the HyperLink using a XMLEntity that contains the information
|
||
112 | * @param XMLEntity
|
||
113 | */
|
||
114 | public void setXMLEntity(XMLEntity xml) { |
||
115 | extName=xml.getStringProperty("extName");
|
||
116 | fieldName=xml.getStringProperty("fieldName");
|
||
117 | typeLink=xml.getIntProperty("typeLink");
|
||
118 | |||
119 | } |
||
120 | } |