Revision 2855

View differences:

org.gvsig.tools/library/tags/org.gvsig.tools-3.0.344/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.tools.util.ToolsUtilLibrary
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.344/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/euclidean/EuclideanManager.java
1
/*
2
 * To change this license header, choose License Headers in Project Properties.
3
 * To change this template file, choose Tools | Templates
4
 * and open the template in the editor.
5
 */
6
package org.gvsig.euclidean;
7

  
8
import java.awt.geom.Point2D;
9

  
10
/**
11
 *
12
 * @author fdiaz
13
 */
14
public interface EuclideanManager {
15

  
16
    EuclideanLine2D createLine2D(double coefA, double coefB, double coefC);
17

  
18
    EuclideanLine2D createLine2D(double m, double b);
19

  
20
    EuclideanLine2D createLine2D(double m, Point2D p);
21

  
22
    double getYIntercept(double m, Point2D p);
23

  
24
    double getYIntercept(double m, double x, double y);
25

  
26
    EuclideanLine2D createLine2D(double x0, double y0, double x1, double y1);
27

  
28
    EuclideanLine2D createLine2D(Point2D p1, Point2D p2);
29
    
30
    /**
31
     * Gets the distance between two points
32
     *
33
     * @param a Point one
34
     * @param b Point two
35
     * @return 
36
     */
37
    double distance(Point2D a, Point2D b);
38

  
39
    /**
40
     * Gets the distance between two points
41
     *
42
     * @param x1 x of point one
43
     * @param y1 y of point one
44
     * @param x2 x of point two
45
     * @param y2 y of point two
46
     * @return 
47
     */
48
    double distance(double x1, double y1, double x2, double y2);
49
    
50
    /**
51
     * Gets center point of three points.
52
     *
53
     * @param ax x of point one
54
     * @param ay y of point one
55
     * @param bx x of point two
56
     * @param by y of point two
57
     * @param cx x of point three
58
     * @param cy y of point three
59
     * @return Point center.
60
     */
61
    public Point2D getCenter(double ax, double ay, double bx, double by, double cx, double cy);
62
    
63
    /**
64
     * Gets center point of three points.
65
     *
66
     * @param a Point one
67
     * @param b Point two
68
     * @param c Point three
69
     * @return Point center.
70
     */
71
    public Point2D getCenter(Point2D a, Point2D b, Point2D c);
72
    
73
    /**
74
     * Gets midpoint of two points
75
     *
76
     * @param a Point one
77
     * @param b Point two
78
     * @return Mid point of points.
79
     */
80
    public Point2D getMidPoint(Point2D a, Point2D b);
81
    
82
    /**
83
     * Gets midpoint of two points
84
     *
85
     * @param ax x of point one
86
     * @param ay y of point one
87
     * @param bx x of point two
88
     * @param by y of point two
89
     * @return Mid point of points.
90
     */
91
    public Point2D getMidPoint(double ax, double ay, double bx, double by);    
92

  
93
    /**
94
     * Returns the coefficient that expresses the direction in which the 
95
     * angle with vertex at center a and from point1 to point2 is beaten 
96
     * coefDirection >= 0 then the direction is CCW 
97
     * else the direction is CW
98
     * 
99
     * @param centerx
100
     * @param centery
101
     * @param point1x
102
     * @param point1y
103
     * @param point2x
104
     * @param point2y
105
     * @return 
106
     */
107
    public double getCoefDirection(double centerx, double centery, double point1x, double point1y, double point2x, double point2y);
108
    
109
    /**
110
     * Returns the coefficient that expresses the direction in which the 
111
     * angle with vertex at center a and from point1 to point2 is beaten 
112
     * coefDirection >= 0 then the direction is CCW 
113
     * else the direction is CW
114
     * 
115
     * @param center
116
     * @param point1
117
     * @param point2
118
     * @return 
119
     */
120
    public double getCoefDirection(Point2D center, Point2D point1, Point2D point2);
121
    
122
    /**
123
     * Calculate the angle between points p1 and p2 with vertex at vertex point
124
     * 
125
     * @param vertexx
126
     * @param vertexy
127
     * @param p1y
128
     * @param p1x
129
     * @param p2x
130
     * @param p2y
131
     * @return 
132
     */
133
    public double calculateAngle(double vertexx, double vertexy, double p1x, double p1y, double p2x, double p2y);
134
    
135
    /**
136
     * Find the angle in the counterclockwise direction between 
137
     * the horizontal line and point p relative to the vertex
138
     * 
139
     * @param vertexx
140
     * @param vertexy
141
     * @param px
142
     * @param py
143
     * @return 
144
     */
145
    public double calculateAngle(double vertexx, double vertexy, double px, double py);
146
    
147
    public boolean areThreePointsInLine(double ax, double ay, double bx, double by, double cx, double cy);
148
    
149
    public Point2D getPointAtDistance(double x1, double y1, double distance, double angle, String unit);
150
    
151
}
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.344/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/euclidean/EuclideanLine2D.java
1
/*
2
 * To change this license header, choose License Headers in Project Properties.
3
 * To change this template file, choose Tools | Templates
4
 * and open the template in the editor.
5
 */
6
package org.gvsig.euclidean;
7

  
8
import java.awt.geom.Point2D;
9

  
10
/**
11
 *
12
 * @author fdiaz
13
 */
14
public interface EuclideanLine2D {
15
    
16
    /**
17
     * Return coeficient A of general equation (Ax + By + C=0).
18
     * 
19
     * @return A
20
     */
21
    public double getA();
22

  
23
    /**
24
     * Return coeficient B of general equation (Ax + By + C=0).
25
     *
26
     * @return B
27
     */
28
    public double getB();
29

  
30
    /**
31
     * Return coeficient C of general equation (Ax + By + C=0).
32
     * 
33
     * @return C
34
     */
35
    public double getC();
36
    
37
    /**
38
     * Return de slope (m in explicit equation of the line y=m+x+b)
39
     * 
40
     * @return m
41
     */
42
    public double getSlope();
43

  
44
    /**
45
     * Return de Y-intercept (b in explicit equation of the line y=m+x+b)
46
     *
47
     * @return b
48
     */
49
    public double getYIntercept();
50
    
51
    /**
52
     * Returns the y coordinate of a point on the line whose x coordinate is the value of the parameter
53
     * 
54
     * @param x
55
     * @return y
56
     */
57
    public double getY(double x);
58
    
59
    /**
60
     * Returns the x coordinate of a point on the line whose y coordinate is the value of the parameter
61
     * 
62
     * @param y
63
     * @return x
64
     */
65
    public double getX(double y);
66
    
67
    /**
68
     * Returns the angle in radians between this line and x-axis
69
     * 
70
     * @return angle (radians)
71
     */
72
    public double getAngle();
73

  
74
    /**
75
     * Returns the angle in degrees between this line and x-axis
76
     * 
77
     * @return angle (radians)
78
     */
79
    public double getDegreesAngle();
80

  
81
    /**
82
     * Returns the minor angle in radians between this line and the line parameter
83
     * 
84
     * @param line
85
     * @return angle (radians)
86
     */
87
    public double getAngle(EuclideanLine2D line);
88

  
89
    /**
90
     * Returns the angle in radians between this line and the line parameter in the quadrant containing the point parameter
91
     * 
92
     * @param line
93
     * @param quadrant
94
     * @return angle (radians)
95
     */
96
    public double getAngle(EuclideanLine2D line, Point2D quadrant);
97

  
98
    /**
99
     * Returns the minor angle in degrees between this line and the line parameter
100
     *
101
     * @param line
102
     * @return angle (degrees)
103
     */
104
    public double getDegreesAngle(EuclideanLine2D line);
105

  
106
    /**
107
     * Returns the angle in degrees between this line and the line parameter in the quadrant containing the point parameter
108
     *
109
     * @param line
110
     * @param quadrant
111
     * @return angle (degrees)
112
     */
113
    public double getDegreesAngle(EuclideanLine2D line, Point2D quadrant);
114
    
115
    /**
116
     * Returns the distance between this line and the point whose coordinates are the parameters
117
     * 
118
     * @param pointX
119
     * @param pointY
120
     * @return distance line-point
121
     */
122
    public double getDistance(double pointX, double pointY);
123

  
124
    /**
125
     * Returns the distance between this line and the point
126
     *
127
     * @param point
128
     * @return distance line-point
129
     */
130
    public double getDistance(Point2D point);
131

  
132
    /**
133
     * Return the distance between this line and the parameter line
134
     * 
135
     * @param line
136
     * @return distance line-line
137
     */
138
    public double getDistance(EuclideanLine2D line);
139

  
140
    /**
141
     * Returns true if this line and the line passed as parameter are parallel
142
     * 
143
     * @param line
144
     * @return boolean
145
     */
146
    public boolean isParallel(EuclideanLine2D line);
147

  
148
    /**
149
     * Returns true if this line and the line passed as parameter are perpendicular
150
     * 
151
     * @param line
152
     * @return boolean
153
     */
154
    public boolean isPerpendicularl(EuclideanLine2D line);
155

  
156
    /**
157
     * Returns the intersection between this line and the line passed as parameter
158
     * 
159
     * @param line
160
     * @return intersection point
161
     */
162
    public Point2D getIntersection(EuclideanLine2D line);
163
        
164
    /**
165
     * Returns a perpendicular line that passes through the point whose coordinates are pointx, pointy
166
     * 
167
     * @param pointX
168
     * @param pointY
169
     * @return
170
     */
171
    public EuclideanLine2D getPerpendicular(double pointX, double pointY);
172

  
173
    /**
174
     * Returns a perpendicular line that passes through a point
175
     * 
176
     * @param point
177
     * @return perpendicular line
178
     */
179
    public EuclideanLine2D getPerpendicular(Point2D point);
180

  
181
    /**
182
     * Returns a parallel line that passes through the point whose coordinates are pointx, pointy
183
     * 
184
     * @param pointX
185
     * @param pointY
186
     * @return parallel line
187
     */
188
    public EuclideanLine2D getParallel(double pointX, double pointY);
189

  
190
    /**
191
     * Returns a parallel line that passes through a point
192
     * 
193
     * @param point
194
     * @return parallel line
195
     */
196
    public EuclideanLine2D getParallel(Point2D point);
197
    
198
    /**
199
     * Returns the nearest point of this line to the point whose coordinates are pointx, pointy
200
     *
201
     * @param pointX
202
     * @param pointY
203
     * @return nearestPoint
204
     */
205
    public Point2D getNearestPoint(double pointX, double pointY);
206

  
207
    /**
208
     * Returns the nearest point of this line to the point
209
     *
210
     * @param point
211
     * @return nearestPoint
212
     */
213
    public Point2D getNearestPoint(Point2D point);
214
    
215
    /**
216
     * Returns the bisectors between this line and the line passed as parameter
217
     *
218
     * @param line
219
     * @return bisectors
220
     */
221
    public EuclideanLine2D[] getBisectors(EuclideanLine2D line);
222
    
223
    /**
224
     * Returns the point symmetrical to the given point with respect to the line
225
     * 
226
     * @param point
227
     * @return the symmetrical point
228
     */
229
    public Point2D getSymmetricalPoint(Point2D point);
230
    
231
}
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.344/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/json/JsonManager.java
1
package org.gvsig.json;
2

  
3
import java.util.Map;
4
import javax.json.JsonArray;
5
import javax.json.JsonObject;
6
import javax.json.JsonStructure;
7
import javax.json.JsonValue;
8
import org.gvsig.tools.dynobject.DynObject;
9
import org.gvsig.tools.util.GetItemWithSizeAndIterator;
10

  
11
/**
12
 *
13
 * @author gvSIG Team
14
 */
15
public interface JsonManager {
16
    
17
    public static final String ATTRIBUTE_NAME_CLASS = "__classname__";
18

  
19
    public interface JsonSerializer {
20
        public Class getObjectClass();
21
        public Object toObject(JsonObject json);
22
        public JsonObjectBuilder toJsonBuilder(Object value);
23
//        public void addAll(Object target, JsonObject source);
24
//        public void addAll(JsonObjectBuilder target, Object source);
25
    }
26
    
27
    public void registerSerializer(Class<?extends SupportFromJson> theClass);
28

  
29
    public void registerSerializer(JsonSerializer serializer);
30
    
31
    public JsonSerializer getSerializer(Object value);
32
    
33
    public JsonSerializer getSerializer(JsonObject json);
34
    
35
    public JsonObjectBuilder createObjectBuilder();
36
    
37
    public JsonObjectBuilder createObjectBuilder(String json);
38
    
39
    public JsonObjectBuilder createObjectBuilder(JsonObject json);
40
    
41
    public JsonArrayBuilder createArrayBuilder();
42
    
43
    public JsonObject createObject(String json);
44
    
45
    public JsonArray createArray(String json);
46

  
47
    public String toString(JsonValue obj);
48

  
49
    public Object toObject(JsonValue value);
50
    
51
    public Object toObjectOrDefault(JsonValue value, Object defaultValue);
52

  
53
    public Object toObject(JsonObject json, String name);
54

  
55
    public Object toObject(JsonArray json, int index);
56
    
57
    public Object[] toArray(JsonArray jsonArray, Object[]a);
58
    
59
    public Iterable<Object> toIterable(final JsonArray jsonArray);
60
    
61
    public GetItemWithSizeAndIterator<Object> toItems(JsonArray jsonArray);
62
    
63
    public DynObject addAll(DynObject target, JsonObject json);
64
    
65
    public Map toMap(JsonObject json);
66

  
67
    public JsonPathContext createJSonPathContext(JsonStructure jsonObject);
68
    
69
    public JsonPathContext createJSonPathContext(String json);
70
}
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.344/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/json/SupportJson.java
1
package org.gvsig.json;
2

  
3
/**
4
 *
5
 * @author gvSIG Team 
6
 */
7
public interface SupportJson extends SupportFromJson, SupportToJson {
8
    
9
}
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.344/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/json/JsonObjectBuilder.java
1
package org.gvsig.json;
2

  
3
import java.util.Iterator;
4
import java.util.List;
5
import java.util.Map;
6
import java.util.Set;
7
import javax.json.JsonObject;
8
import org.gvsig.tools.dynobject.DynObject;
9
import org.gvsig.tools.util.GetItemByKeyWithGetKeys;
10
import org.gvsig.tools.util.GetItemWithSize;
11

  
12
/**
13
 *
14
 * @author gvSIG Team
15
 */
16
public interface JsonObjectBuilder extends javax.json.JsonObjectBuilder {
17

  
18
    public JsonObjectBuilder add_class(Class value);
19

  
20
    public JsonObjectBuilder add_class(Object value);
21

  
22
    public JsonObjectBuilder add(String name, Class value);
23

  
24
    public JsonObjectBuilder add(String name, SupportToJson value);
25

  
26
    public JsonObjectBuilder add(String name, Object value);
27

  
28
    public JsonObjectBuilder add(String name, Object[] items);
29

  
30
    public JsonObjectBuilder add(String name, Iterable items);
31

  
32
    public JsonObjectBuilder add(String name, Iterator items);
33

  
34
    public JsonObjectBuilder add(String name, Map value);
35
    
36
    public JsonObjectBuilder add(String name, GetItemByKeyWithGetKeys value);
37

  
38
    public JsonObjectBuilder add(String name, GetItemWithSize value);
39
    
40
    public JsonObjectBuilder add(String name, List items);
41
        
42
    public JsonObjectBuilder add(String name, Set items);
43
        
44
    public JsonObjectBuilder addAll(GetItemByKeyWithGetKeys value);
45

  
46
    public JsonObjectBuilder addAll(Map value);
47

  
48
    public JsonObjectBuilder addAll(DynObject value);
49
    
50
    public JsonObjectBuilder addAll(JsonObjectBuilder values);
51
    
52
    public JsonObjectBuilder addAll(JsonObject values);
53
    
54
}
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.344/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/json/Json.java
1
package org.gvsig.json;
2

  
3
import java.io.InputStream;
4
import java.io.Reader;
5
import java.util.Map;
6
import javax.json.JsonArray;
7
import javax.json.JsonObject;
8
import javax.json.JsonReader;
9
import javax.json.JsonStructure;
10
import javax.json.JsonValue;
11
import javax.json.stream.JsonGeneratorFactory;
12
import org.gvsig.tools.dynobject.DynObject;
13
import org.gvsig.tools.util.GetItemWithSizeAndIterator;
14
import org.gvsig.tools.util.ToolsUtilLocator;
15

  
16
/**
17
 *
18
 * @author gvSIG Team
19
 */
20
@SuppressWarnings("UseSpecificCatch")
21
public class Json {
22
    
23
    public static JsonManager getManager() {
24
        return ToolsUtilLocator.getJsonManager();
25
    }
26
    
27
    public static void registerSerializer(Class<?extends SupportFromJson> theClass) {
28
        JsonManager manager = ToolsUtilLocator.getJsonManager();
29
        manager.registerSerializer(theClass);
30
    }
31
    
32
    public static void registerSerializer(JsonManager.JsonSerializer factory) {
33
        JsonManager manager = ToolsUtilLocator.getJsonManager();
34
        manager.registerSerializer(factory);
35
    }
36
    
37
    public static JsonGeneratorFactory createGeneratorFactory(Map<String, ?> config) {
38
        return javax.json.Json.createGeneratorFactory(config);
39
    }
40
        
41
    public static JsonReader createReader(InputStream in) {
42
        return javax.json.Json.createReader(in);
43
    }
44

  
45
    public static Object extract_path(JsonStructure jsonObject, String jsonpath) {
46
        JsonManager manager = ToolsUtilLocator.getJsonManager();
47
        JsonPathContext context = manager.createJSonPathContext(jsonObject);
48
        Object value = context.get(jsonpath);
49
        return value;
50
    }
51
    
52
    public static Object extract_path(String jsonObject, String jsonpath) {
53
        JsonManager manager = ToolsUtilLocator.getJsonManager();
54
        JsonPathContext context = manager.createJSonPathContext(jsonObject);
55
        Object value = context.get(jsonpath);
56
        return value;
57
    }
58
    
59
    public static JsonPathContext createJsonPathContext(JsonStructure jsonObject) {
60
        JsonManager manager = ToolsUtilLocator.getJsonManager();
61
        JsonPathContext context = manager.createJSonPathContext(jsonObject);
62
        return context;
63
    }
64

  
65
    public static JsonPathContext createJsonPathContext(String jsonObject) {
66
        JsonManager manager = ToolsUtilLocator.getJsonManager();
67
        JsonPathContext context = manager.createJSonPathContext(jsonObject);
68
        return context;
69
    }
70

  
71
    public static JsonReader createReader(Reader reader) {
72
        return javax.json.Json.createReader(reader);
73
    }
74

  
75
    public static JsonObjectBuilder createObjectBuilder() {
76
        JsonManager manager = ToolsUtilLocator.getJsonManager();
77
        JsonObjectBuilder builder = manager.createObjectBuilder();
78
        return builder;
79
    }
80
     
81
    public static JsonObjectBuilder createObjectBuilder(String json) {
82
        JsonManager manager = ToolsUtilLocator.getJsonManager();
83
        JsonObjectBuilder builder = manager.createObjectBuilder(json);
84
        return builder;
85
    }
86
     
87
    public static JsonObjectBuilder createObjectBuilder(JsonObject obj) {
88
        JsonManager manager = ToolsUtilLocator.getJsonManager();
89
        JsonObjectBuilder builder = manager.createObjectBuilder(obj);
90
        return builder;
91
    }
92
     
93
    public static JsonArrayBuilder createArrayBuilder() {
94
        JsonManager manager = ToolsUtilLocator.getJsonManager();
95
        JsonArrayBuilder builder = manager.createArrayBuilder();
96
        return builder;
97
    }
98
    
99
    public static JsonObject createObject(String json) {
100
        JsonManager manager = ToolsUtilLocator.getJsonManager();
101
        JsonObject obj = manager.createObject(json);
102
        return obj;
103
    }
104
    
105
    public static JsonObject createObject(InputStream json) {
106
        JsonObject obj = javax.json.Json.createReader(json).readObject();
107
        return obj;
108
    }
109
    
110
    public static JsonArray createArray(String json) {
111
        JsonManager manager = ToolsUtilLocator.getJsonManager();
112
        JsonArray array = manager.createArray(json);
113
        return array;
114
    }
115
   
116
    public static JsonArray createArray(InputStream json) {
117
        JsonArray array = javax.json.Json.createReader(json).readArray();
118
        return array;
119
    }
120
    
121
    public static JsonArray createArray(Reader json) {
122
        JsonArray array = javax.json.Json.createReader(json).readArray();
123
        return array;
124
    }
125
   
126
    public static String toString(JsonValue obj) {
127
        JsonManager manager = ToolsUtilLocator.getJsonManager();
128
        String json = manager.toString(obj);
129
        return json;
130
    }
131
    
132
    public static Object toObject(JsonValue value) {
133
        JsonManager manager = ToolsUtilLocator.getJsonManager();
134
        return manager.toObject(value);
135
    }
136

  
137
    public static Object toObject(JsonArray json, int index) {
138
        JsonManager manager = ToolsUtilLocator.getJsonManager();
139
        return manager.toObject(json, index);
140
    }
141

  
142
    public static Object toObject(JsonObject json, String name) {
143
        if( json == null ) {
144
            return null;
145
        }
146
        if( !json.containsKey(name) ) {
147
            return null;
148
        }
149
        JsonManager manager = ToolsUtilLocator.getJsonManager();
150
        return manager.toObject(json,name);
151
    }
152
    
153
    public static Object toObject(String json) {
154
        JsonManager manager = ToolsUtilLocator.getJsonManager();
155
        JsonObject jsonObject = manager.createObject(json);
156
        return manager.toObject(jsonObject);
157
    }
158
    
159
    public static Object[] toArray(JsonObject json, String name, Object[]a) {
160
        return toArray(json.getJsonArray(name), a);
161
    }
162

  
163
    public static Object[] toArray(JsonArray jsonArray, Object[]a) {
164
        if( jsonArray==null ) {
165
            return null;
166
        }
167
        JsonManager manager = ToolsUtilLocator.getJsonManager();
168
        return manager.toArray(jsonArray, a);
169
    }
170
    
171
    public static Iterable<Object> toIterable(JsonArray jsonArray) {
172
        JsonManager manager = ToolsUtilLocator.getJsonManager();
173
        return manager.toIterable(jsonArray);
174
    }
175
    
176
    public static GetItemWithSizeAndIterator<Object> toItems(JsonArray jsonArray) {
177
        JsonManager manager = ToolsUtilLocator.getJsonManager();
178
        return manager.toItems(jsonArray);
179
    }
180
    
181
    public static DynObject addAll(DynObject target, JsonObject json) {
182
        JsonManager manager = ToolsUtilLocator.getJsonManager();
183
        return manager.addAll(target, json);
184
    }
185

  
186
    public static Map toMap(JsonObject json, String name) {
187
        if( json == null ) {
188
            return null;
189
        }
190
        if( !json.containsKey(name) ) {
191
            return null;
192
        }
193
        JsonManager manager = ToolsUtilLocator.getJsonManager();
194
        return manager.toMap(json.getJsonObject(name));
195
    }
196
    
197
    public static Map toMap(JsonObject json) {
198
        JsonManager manager = ToolsUtilLocator.getJsonManager();
199
        return manager.toMap(json);
200
    }
201

  
202
}
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.344/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/json/SupportToJson.java
1
package org.gvsig.json;
2

  
3
import java.util.Map;
4
import javax.json.JsonObject;
5

  
6
/**
7
 *
8
 * @author gvSIG Team
9
 */
10
public interface SupportToJson {
11
    
12
    public JsonObject toJson();
13
    
14
    public JsonObjectBuilder toJsonBuilder();
15
	
16
    public default JsonObject toJson(Map<String, Object> props) {
17
		return this.toJson();
18
	}
19
    
20
    public default JsonObjectBuilder toJsonBuilder(Map<String, Object> props) {
21
		return this.toJsonBuilder();
22
	}
23
	
24
}
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.344/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/json/SupportFromJson.java
1
package org.gvsig.json;
2

  
3
import javax.json.JsonObject;
4

  
5
/**
6
 *
7
 * @author gvSIG Team
8
 */
9
public interface SupportFromJson {
10
    
11
    public void fromJson(JsonObject json);
12
}
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.344/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/json/JsonPathContext.java
1
/*
2
 * gvSIG. Desktop Geographic Information System.
3
 * 
4
 * Copyright (C) 2007-2020 gvSIG Association.
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 3
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, see <https://www.gnu.org/licenses/>. 
18
 * 
19
 * For any additional information, do not hesitate to contact us
20
 * at info AT gvsig.com, or visit our website www.gvsig.com.
21
 */
22
package org.gvsig.json;
23

  
24
import java.sql.Date;
25
import java.sql.Time;
26
import java.sql.Timestamp;
27
import javax.json.JsonArray;
28
import javax.json.JsonObject;
29
import javax.json.JsonStructure;
30

  
31
/**
32
 *
33
 * @author gvSIG Team
34
 */
35
public interface JsonPathContext {
36
    public JsonStructure getJsonObject();
37
    public void setJsonObject(JsonStructure json);
38
    
39
    public Object get(String path);
40
    
41
    public int getInt(String path, int defaultValue);
42
    public long getLong(String path, long defaultValue);
43
    public double getDouble(String path, double defaultValue);
44
    public float getFloat(String path, float defaultValue);
45
    public Date getDate(String path);
46
    public Time getTime(String path);
47
    public Timestamp getTimestamp(String path);
48
    public JsonObject getJsonObject(String path);
49
    public JsonArray getJsonArray(String path);
50
    
51
}
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.344/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/json/JsonArrayBuilder.java
1
package org.gvsig.json;
2

  
3
import java.util.Iterator;
4
import java.util.List;
5
import java.util.Map;
6
import java.util.Set;
7
import javax.json.JsonObject;
8
import org.gvsig.tools.util.GetItemByKeyWithGetKeys;
9
import org.gvsig.tools.util.GetItemWithSize;
10

  
11
/**
12
 *
13
 * @author gvSIG Team
14
 */
15
public interface JsonArrayBuilder extends javax.json.JsonArrayBuilder {
16

  
17
    public JsonArrayBuilder addAll(GetItemWithSize items);
18

  
19
    public JsonArrayBuilder addAll(Iterable items);
20

  
21
    public JsonArrayBuilder addAll(Iterator items);
22

  
23
    public JsonArrayBuilder addAll(List value);
24

  
25
    public JsonArrayBuilder addAll(Object[] items);
26

  
27
    public JsonArrayBuilder addAll(Set value);
28

  
29
    public JsonArrayBuilder add(JsonObject value);
30

  
31
    public JsonArrayBuilder add(Class value);
32

  
33
    public JsonArrayBuilder add(GetItemByKeyWithGetKeys value);
34

  
35
    public JsonArrayBuilder add(GetItemWithSize value);
36

  
37
    public JsonArrayBuilder add(Iterable items);
38

  
39
    public JsonArrayBuilder add(Iterator items);
40

  
41
    public JsonArrayBuilder add(List value);
42

  
43
    public JsonArrayBuilder add(Map value);
44

  
45
    public JsonArrayBuilder add(Object[] items);
46

  
47
    public JsonArrayBuilder add(Object value);
48

  
49
    public JsonArrayBuilder add(Set value);
50

  
51
    public JsonArrayBuilder add(SupportToJson value);
52

  
53
}
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.344/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/desktopopen/DesktopOpen.java
1
package org.gvsig.desktopopen;
2

  
3
import java.io.File;
4
import java.net.URI;
5

  
6
public interface DesktopOpen {
7

  
8
    public boolean browse(URI uri);
9

  
10
    public boolean edit(File file);
11

  
12
    public boolean open(File file);
13
    
14
}
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.344/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/htmlbuilder/HTMLBuilder.java
1

  
2
package org.gvsig.htmlbuilder;
3

  
4
import java.awt.Color;
5
import java.util.Date;
6
import java.util.List;
7
import java.util.Map;
8

  
9
/**
10
 *
11
 * @author jjdelcerro
12
 */
13
public interface HTMLBuilder {
14

  
15
    
16
    public static final String accesskey = "accesskey";
17
    public static final String class_ = "class";
18
    public static final String contenteditable = "contenteditable";
19
    public static final String content = "content";
20
    public static final String dir = "dir";
21
    public static final String draggable = "draggable";
22
    public static final String dropzone = "dropzone";
23
    public static final String hidden = "hidden";
24
    public static final String id = "id";
25
    public static final String lang = "lang";
26
    public static final String spellcheck = "spellcheck";
27
    public static final String style = "style";
28
    public static final String tabindex = "tabindex";
29
    public static final String title = "title";
30
    public static final String translate = "translate";    
31

  
32
    public static final String alt  = "alt";
33
    public static final String coords = "coords";
34
    public static final String download = "download";
35
    public static final String href = "href";
36
    public static final String hreflang = "hreflang";
37
    public static final String media = "media";
38
    public static final String nohref = "nohref";
39
    public static final String rel  = "rel";
40
    public static final String shape = "shape";
41
    public static final String target = "target";
42
    public static final String type = "type";
43

  
44
    public static final String autofocus = "autofocus";
45
    public static final String disabled = "disabled";
46
    public static final String form = "form";
47
    public static final String formaction = "formaction";
48
    public static final String formenctype = "formenctype";
49
    public static final String formmethod = "formmethod";
50
    public static final String formnovalidate = "formnovalidate";
51
    public static final String formtarget = "formtarget";
52
    public static final String framename = "framename";
53
    public static final String name = "name";
54
    public static final String value  = "value";    
55
    public static final String height  = "height";    
56
    public static final String width  = "width";    
57
    public static final String align  = "align";    
58
    public static final String open  = "open";    
59
    public static final String size  = "size";    
60
    public static final String color  = "color";    
61
    public static final String face  = "face";    
62
    public static final String noshade  = "noshade";    
63
    public static final String xmlns  = "xmlns";    
64
    public static final String for_  = "for";    
65
    public static final String charset = "charset";
66
        
67
    public static final String max = "max";
68
    public static final String min = "min";
69
    public static final String low = "low";
70
    public static final String hight = "hight";
71
    public static final String optimun = "optimun";
72
    
73
    public static final String compact = "compact";
74
    public static final String reversed = "reversed";
75
    public static final String start = "start";
76

  
77
    public static final String multiple = "multiple";
78
    public static final String required = "required";
79
   
80
    public static final String bgcolor = "bgcolor";
81
    public static final String border = "border";
82
    public static final String cellpadding = "cellpadding";
83
    public static final String cellspacing = "cellspacing";
84

  
85
    public static final String colspan = "colspan";
86
    public static final String nowrap = "nowrap";
87
    public static final String valign = "valign";
88

  
89
    public static final String cols = "cols";
90
    public static final String dirname = "dirname";
91
    public static final String maxlength = "maxlength";
92
    public static final String placeholder = "placeholder";
93
    public static final String readonly = "readonly";
94
    public static final String rows = "rows";
95
    public static final String wrap = "wrap";
96

  
97
    public static final String datetime = "datetime";
98
    
99
    
100
    
101
    
102
    
103
    
104
    public static final String target_blank = "_blank";
105
    public static final String target_self = "_self";
106
    public static final String target_parent = "_parent";
107
    public static final String target_top = "_top";
108

  
109
    public static final String method_get = "get";
110
    public static final String method_post = "post";
111

  
112
    public static final String type_button = "button";
113
    public static final String type_reset = "reset";
114
    public static final String type_submit = "submit";
115
        
116
    public static final String valign_top = "top";
117
    public static final String valign_middle = "middle";
118
    public static final String valign_bottom = "bottom";
119
    public static final String valign_baseline = "baseline";
120

  
121
    
122
    
123
    public interface HTMLElement {
124
        public boolean allowContents();
125
        
126
        public boolean allowAttributes();
127
        
128
        public String toHTML();
129
    }
130

  
131
    public interface HTMLElementWithAttributes extends HTMLElement {
132
        public Map<String,String> getAttributes();
133

  
134
        public Map<String,String> getStyle();
135
        
136
        public HTMLElementWithAttributes set(String name, String value);
137
        
138
        public HTMLElementWithAttributes set(String name, int value);
139
        
140
        public HTMLElementWithAttributes set(String name, double value);
141
        
142
        public HTMLElementWithAttributes set(String name, HTMLColor color);
143
        
144
        public HTMLElementWithAttributes set(String name);
145
        
146
        public HTMLElementWithAttributes style(String name, String value);
147
        
148
        public HTMLElementWithAttributes style(String name, int value);
149
        
150
        public HTMLElementWithAttributes style(String name, double value);
151
        
152
        public HTMLElementWithAttributes style(String name, HTMLColor color);
153
        
154
    }
155

  
156
    public interface HTMLElementWithContents extends HTMLElement {
157

  
158
        public HTMLElementWithContents contents(Object... values);
159
        
160
        public List<HTMLElement> getContents();
161
    }
162

  
163
    public interface HTMLComplexElement 
164
            extends  HTMLElementWithContents, HTMLElementWithAttributes
165
    {        
166
        @Override
167
        public HTMLComplexElement contents(Object... values);
168

  
169
        @Override
170
        public HTMLComplexElement set(String name, String value);
171
        
172
        @Override
173
        public HTMLComplexElement set(String name, int value);
174
        
175
        @Override
176
        public HTMLComplexElement set(String name, double value);
177
        
178
        @Override
179
        public HTMLComplexElement set(String name, HTMLColor color);
180
        
181
        @Override
182
        public HTMLComplexElement set(String name);
183
        
184
        @Override
185
        public HTMLComplexElement style(String name, String value);
186
        
187
        @Override
188
        public HTMLComplexElement style(String name, int value);
189
        
190
        @Override
191
        public HTMLComplexElement style(String name, double value);
192
        
193
        @Override
194
        public HTMLComplexElement style(String name, HTMLColor color);
195
        
196
    }
197
    
198
    public interface HTMLColor extends HTMLElement {
199
        
200
    }
201

  
202
    HTMLColor color(Color color);
203

  
204
    HTMLColor color(String color);
205

  
206
    HTMLColor color(int r, int g, int b);
207

  
208
    HTMLElement contents(HTMLElement... values);
209

  
210
    HTMLElement custom(String value);
211
    
212
    HTMLElement plain(String value);
213
    
214
    HTMLElement plainWithNl(String value);
215

  
216

  
217
    
218
    
219
    HTMLComplexElement a(Object... contents);
220

  
221
    HTMLComplexElement a(String link, Object... contents);
222

  
223
    HTMLComplexElement abbr(Object... contents);
224

  
225
    HTMLComplexElement acronym(Object... contents);
226

  
227
    HTMLComplexElement address(Object... contents);
228

  
229
    HTMLComplexElement area(Object... contents);
230

  
231
    HTMLComplexElement article(Object... contents);
232

  
233
    HTMLComplexElement aside(Object... contents);
234

  
235
    HTMLComplexElement b(Object... contents);
236

  
237
    HTMLElementWithAttributes base();
238

  
239
    HTMLElementWithAttributes basefont();
240

  
241
    HTMLComplexElement bdi(Object... contents);
242

  
243
    HTMLComplexElement bdo(Object... contents);
244

  
245
    HTMLElementWithContents big(Object... contents);
246

  
247
    HTMLComplexElement blockquote(Object... contents);
248

  
249
    HTMLComplexElement body(Object... contents);
250

  
251
    HTMLElement br();
252

  
253
    HTMLComplexElement button(Object... contents);
254

  
255
    HTMLComplexElement canvas(Object... contents);
256

  
257
    HTMLComplexElement caption(Object... contents);
258

  
259
    HTMLElementWithContents center(Object... contents);
260

  
261
    HTMLComplexElement cite(Object... contents);
262

  
263
    HTMLComplexElement code(Object... contents);
264

  
265
    HTMLElementWithAttributes col();
266

  
267
    HTMLComplexElement colgroup(Object... contents);
268

  
269
    HTMLComplexElement data(Object... contents);
270

  
271
    HTMLComplexElement datalist(Object... contents);
272

  
273
    HTMLComplexElement dd(Object... contents);
274

  
275
    HTMLComplexElement del(Object... contents);
276

  
277
    HTMLComplexElement details(Object... contents);
278

  
279
    HTMLComplexElement dfn(Object... contents);
280

  
281
    HTMLComplexElement dialog(Object... contents);
282

  
283
    HTMLElementWithContents dir(Object... contents);
284

  
285
    HTMLComplexElement div(Object... contents);
286

  
287
    HTMLComplexElement dl(Object... contents);
288

  
289
    HTMLComplexElement dt(Object... contents);
290

  
291
    HTMLComplexElement em(Object... contents);
292

  
293
    HTMLElementWithAttributes embed();
294

  
295
    HTMLComplexElement fieldset(Object... contents);
296

  
297
    HTMLComplexElement figcaption(Object... contents);
298

  
299
    HTMLComplexElement figure(Object... contents);
300

  
301
    HTMLComplexElement font(Object... contents);
302

  
303
    HTMLComplexElement font(int size, HTMLColor color);
304

  
305
    HTMLComplexElement font(int size, HTMLColor color, String face, Object... contents);
306

  
307
    HTMLComplexElement footer(Object... contents);
308

  
309
    HTMLComplexElement form(Object... contents);
310

  
311
    HTMLComplexElement frame(Object... contents);
312

  
313
    HTMLComplexElement frameset(Object... contents);
314

  
315
    HTMLComplexElement h1(Object... contents);
316

  
317
    HTMLComplexElement h2(Object... contents);
318

  
319
    HTMLComplexElement h3(Object... contents);
320

  
321
    HTMLComplexElement h4(Object... contents);
322

  
323
    HTMLComplexElement h5(Object... contents);
324

  
325
    HTMLComplexElement h6(Object... contents);
326

  
327
    HTMLComplexElement head(Object... contents);
328

  
329
    HTMLComplexElement header(Object... contents);
330

  
331
    HTMLComplexElement hr(Object... contents);
332

  
333
    HTMLComplexElement html(Object... contents);
334

  
335
    HTMLComplexElement i(Object... contents);
336

  
337
    HTMLComplexElement iframe(Object... contents);
338

  
339
    HTMLElementWithAttributes img();
340

  
341
    HTMLElementWithAttributes input(Object... contents);
342

  
343
    HTMLComplexElement ins(Object... contents);
344

  
345
    HTMLComplexElement kbd(Object... contents);
346

  
347
    HTMLComplexElement label(Object... contents);
348

  
349
    HTMLComplexElement legend(Object... contents);
350

  
351
    HTMLComplexElement li(Object... contents);
352

  
353
    HTMLElementWithAttributes link();
354

  
355
    HTMLElementWithAttributes link(String rel, String type, String href);
356

  
357
    HTMLComplexElement main(Object... contents);
358

  
359
    HTMLComplexElement map(Object... contents);
360

  
361
    HTMLComplexElement mark(Object... contents);
362

  
363
    HTMLElementWithAttributes meta();
364

  
365
    HTMLElementWithAttributes meta(String charset);
366

  
367
    HTMLElementWithAttributes meta(String name, String content);
368

  
369
    HTMLComplexElement meter(Object... contents);
370

  
371
    HTMLComplexElement nav(Object... contents);
372

  
373
    HTMLElementWithContents noframes(Object... contents);
374

  
375
    HTMLElementWithContents noscript(Object... contents);
376

  
377
    HTMLComplexElement object(Object... contents);
378

  
379
    HTMLComplexElement ol(Object... contents);
380

  
381
    HTMLComplexElement optgroup(Object... contents);
382

  
383
    HTMLComplexElement  option(Object... contents);
384
    
385
    HTMLComplexElement output(Object... contents);
386

  
387
    HTMLComplexElement p(Object... contents);
388

  
389
    HTMLElementWithAttributes param();
390

  
391
    HTMLComplexElement pre(Object... contents);
392

  
393
    HTMLComplexElement progress(Object... contents);
394

  
395
    HTMLComplexElement q(Object... contents);
396

  
397
    HTMLComplexElement rp(Object... contents);
398

  
399
    HTMLComplexElement rt(Object... contents);
400

  
401
    HTMLComplexElement ruby(Object... contents);
402

  
403
    HTMLComplexElement s(Object... contents);
404

  
405
    HTMLComplexElement samp(Object... contents);
406

  
407
    HTMLComplexElement script(Object... contents);
408

  
409
    HTMLComplexElement section(Object... contents);
410

  
411
    HTMLComplexElement select(Object... contents);
412

  
413
    HTMLComplexElement small(Object... contents);
414

  
415
    HTMLComplexElement source(Object... contents);
416

  
417
    HTMLComplexElement span(Object... contents);
418

  
419
    HTMLElementWithContents strike(Object... contents);
420

  
421
    HTMLComplexElement strong(Object... contents);
422

  
423
    HTMLComplexElement style(Object... contents);
424

  
425
    HTMLComplexElement sub(Object... contents);
426

  
427
    HTMLComplexElement summary(Object... contents);
428

  
429
    HTMLComplexElement sup(Object... contents);
430

  
431
    HTMLComplexElement svg(Object... contents);
432

  
433
    HTMLComplexElement table(Object... contents);
434

  
435
    HTMLComplexElement table(int border, int cellpadding, int cellspacing);
436

  
437
    HTMLComplexElement table(int border, int cellpadding, int cellspacing, int widthpercent);
438

  
439
    HTMLComplexElement tbody(Object... contents);
440

  
441
    HTMLComplexElement td(Object... contents);
442

  
443
    HTMLComplexElement td(boolean wrap, int colspan);
444

  
445
    HTMLComplexElement td(boolean wrap, int colspan, String valign);
446

  
447
    HTMLComplexElement template(Object... contents);
448

  
449
    HTMLComplexElement textarea(Object... contents);
450

  
451
    HTMLComplexElement textarea(int rows, int cols);
452

  
453
    HTMLComplexElement textarea(int rows, int cols, int maxlength);
454

  
455
    HTMLComplexElement tfoot(Object... contents);
456

  
457
    HTMLComplexElement th(Object... contents);
458

  
459
    HTMLComplexElement thead(Object... contents);
460

  
461
    HTMLComplexElement time(Object... contents);
462

  
463
    HTMLComplexElement time(Date datetime);
464

  
465
    HTMLComplexElement time(String datetime);
466

  
467
    HTMLComplexElement title(Object... contents);
468

  
469
    HTMLComplexElement tr(Object... contents);
470

  
471
    HTMLComplexElement tr(HTMLColor color);
472

  
473
    HTMLComplexElement tr(String valign);
474

  
475
    HTMLComplexElement tr(String valign, HTMLColor color);
476

  
477
    HTMLComplexElement track(Object... contents);
478

  
479
    HTMLElementWithContents tt(Object... contents);
480

  
481
    HTMLComplexElement u(Object... contents);
482

  
483
    HTMLComplexElement ul(Object... contents);
484

  
485
    HTMLComplexElement var(Object... contents);
486

  
487
    HTMLComplexElement video(Object... contents);
488

  
489
    HTMLComplexElement wbr(Object... contents);
490
    
491
}
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.344/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/texteditor/JTextEditor.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.texteditor;
25

  
26
import java.awt.event.ActionListener;
27
import javax.swing.text.JTextComponent;
28
import org.gvsig.tools.swing.api.ChangeListenerSupport;
29
import org.gvsig.tools.swing.api.Component;
30

  
31
/**
32
 * @author gvSIG Team
33
 *
34
 */
35
public interface JTextEditor extends Component, ChangeListenerSupport {
36

  
37
    public interface UpdateCaretPositionActionEvent {
38

  
39
        public int getLine();
40

  
41
        public int getColumn();
42

  
43
        public boolean hasLineAndColumn();
44
    }
45

  
46
    public void setMimetype(String mimeType);
47

  
48
    public String getMimetype();
49

  
50
    public void setText(String text);
51

  
52
    public String getText();
53

  
54
    public JTextComponent getJTextComponent();
55

  
56
    public void selectLine(int line);
57

  
58
    public void gotoline(int line);
59

  
60
    public int getLineCount();
61

  
62
    public void clean();
63

  
64
    public void addUpdateCaretPositionActionListener(ActionListener actionlistener);
65

  
66
    public boolean isModified();
67

  
68
}
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff