Skip to content

Commit c0dfe44

Browse files
committed
Add JsArray class for javascript arrays
1 parent 9d9effa commit c0dfe44

File tree

14 files changed

+362
-8
lines changed

14 files changed

+362
-8
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>io.github.jeemv.springboot.vuejs</groupId>
88
<artifactId>springboot-vuejs</artifactId>
9-
<version>1.0.6</version>
9+
<version>1.0.8</version>
1010

1111
<name>springboot-vuejs</name>
1212
<url>https://github.com/jeeMv/SpringBoot-VueJS</url>

src/main/java/io/github/jeemv/springboot/vuejs/VueConfig.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
import java.util.Properties;
44

5+
/**
6+
* VueConfig
7+
* This class is part of springBoot-VueJS
8+
* @author jc
9+
* @version 1.0.0
10+
*
11+
*/
512
public class VueConfig{
613
private static VueConfig instance;
714
public static boolean debug=false;

src/main/java/io/github/jeemv/springboot/vuejs/VueJS.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@
1111
import io.github.jeemv.springboot.vuejs.parts.VueFilter;
1212
import io.github.jeemv.springboot.vuejs.utilities.JsUtils;
1313

14+
1415
/**
1516
* VueJS instance
16-
* @author jcheron
17-
* @version 1.0.0.3
17+
* This class is part of springBoot-VueJS
18+
* @author jc
19+
* @version 1.0.3
20+
*
1821
*/
1922
public class VueJS extends AbstractVueJS{
2023
protected String el;

src/main/java/io/github/jeemv/springboot/vuejs/annotations/VueJSInstance.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88

99
/**
1010
* VueJSInstance annotation
11+
* This class is part of spring-boot-vuejs
1112
* inject an instance of VueJS initialized from the parameters selector and modelName.
1213
* The annotated method must take the ModelMap and VueJS type parameters at the last position.
13-
* @author jcheron
14+
* @author jc
1415
* @since 1.0.2
16+
*
1517
*/
1618
@Target(value={ElementType.METHOD})
1719
@Retention(RetentionPolicy.RUNTIME)

src/main/java/io/github/jeemv/springboot/vuejs/beans/RawObject.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
package io.github.jeemv.springboot.vuejs.beans;
22

3+
4+
/**
5+
* RawObject
6+
* This class is part of spring-boot-vuejs
7+
* @author jc
8+
* @version 1.0.0
9+
*
10+
*/
311
public class RawObject {
412
private Object value;
513

src/main/java/io/github/jeemv/springboot/vuejs/components/VueComponent.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,13 @@
2121
import io.github.jeemv.springboot.vuejs.parts.VueProps;
2222
import io.github.jeemv.springboot.vuejs.utilities.JsUtils;
2323

24+
2425
/**
2526
* VueJS component class
26-
* @author jcheron
27-
* @version 1.0.0.0
27+
* This class is part of springBoot-VueJS
28+
* @author jc
29+
* @version 1.0.0
30+
*
2831
*/
2932
public class VueComponent extends AbstractVueJS{
3033
private String name;

src/main/java/io/github/jeemv/springboot/vuejs/components/VueProp.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
import io.github.jeemv.springboot.vuejs.utilities.JsUtils;
1111

1212
/**
13-
* Represents a ViewJS property for Components
14-
* @author jcheron
13+
* Represents a VueJS property for Components
14+
* This class is part of springBoot-VueJS
15+
* @author jc
16+
* @version 1.0.0
1517
*
1618
*/
1719
public class VueProp {

src/main/java/io/github/jeemv/springboot/vuejs/parts/VueComputed.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
package io.github.jeemv.springboot.vuejs.parts;
22

3+
/**
4+
* VueComputed
5+
* represents a computed property
6+
* This class is part of springBoot-VueJS
7+
* @author jc
8+
* @version 1.0.0
9+
*
10+
*/
311
public class VueComputed {
412
private String get;
513
private String set;

src/main/java/io/github/jeemv/springboot/vuejs/utilities/Http.java

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,28 @@ private static String getJsCode() {
2626
}
2727
return "";
2828
}
29+
30+
/**
31+
* Submits an existing form
32+
* @param formRef the Vuejs form ref
33+
* @param action the action (url for submit)
34+
* @param successCallback the javascript code to execute if success (parameter response)
35+
* @param errorCallback the javascript code to execute on error (parameter response)
36+
* @return
37+
*/
2938
public static String submitForm(String formRef,String action,String successCallback,String errorCallback) {
3039
String result= getJsCode()+"let form=this.$refs['"+formRef+"'];"+
3140
"let formData=form.model;"+request("form.$vnode.data.attrs.method.toLowerCase()", action, "formData", successCallback,errorCallback);
3241
return result;
3342
}
3443

44+
/**
45+
* Submits an existing form
46+
* @param formRef the Vuejs form ref
47+
* @param action the action (url for submit)
48+
* @param successCallback the javascript code to execute if success (parameter response)
49+
* @return
50+
*/
3551
public static String submitForm(String formRef,String action,String successCallback) {
3652
return submitForm(formRef, action, successCallback, null);
3753
}
@@ -46,6 +62,15 @@ public static String submitForm(String formRef,String successCallback) {
4662
return Http.submitForm(formRef, "form.$vnode.data.attrs.action", successCallback,null);
4763
}
4864

65+
/**
66+
* Sends a request
67+
* @param method the http method (get,post,delete,patch,put,options,head)
68+
* @param url the url to request
69+
* @param data the data to send to the request
70+
* @param successCallback the javascript code to execute if success (parameter response)
71+
* @param errorCallback the javascript code to execute on error (parameter response)
72+
* @return
73+
*/
4974
public static String request(String method,String url,Object data,String successCallback,String errorCallback){
5075
if(!url.contains("$")&& !url.startsWith("this")) {
5176
url="'"+url+"'";
@@ -66,86 +91,233 @@ public static String request(String method,String url,Object data,String success
6691
return result;
6792
}
6893

94+
/**
95+
* Sends a request
96+
* @param method the http method (get,post,delete,patch,put,options,head)
97+
* @param url the url to request
98+
* @param data the data to send to the request
99+
* @param successCallback the javascript code to execute if success (parameter response)
100+
* @return
101+
*/
69102
public static String request(String method,String url,Object data,String successCallback) {
70103
return request(method, url, data, successCallback, null);
71104
}
72105

106+
/**
107+
* Sends a get request
108+
* @param url the url to request
109+
* @param data the data to send to the request
110+
* @param successCallback the javascript code to execute if success (parameter response)
111+
* @param errorCallback the javascript code to execute on error (parameter response)
112+
* @return
113+
*/
73114
public static String get(String url,Object data,String successCallback,String errorCallback) {
74115
return request("'get'", url, data, successCallback, errorCallback);
75116
}
76117

118+
/**
119+
* Sends a get request
120+
* @param url the url to request
121+
* @param data the data to send to the request
122+
* @param successCallback the javascript code to execute if success (parameter response)
123+
* @return
124+
*/
77125
public static String get(String url,Object data,String successCallback) {
78126
return request("'get'", url, data, successCallback, null);
79127
}
80128

129+
/**
130+
* Sends a get request
131+
* @param url the url to request
132+
* @param successCallback the javascript code to execute if success (parameter response)
133+
* @return
134+
*/
81135
public static String get(String url,String successCallback) {
82136
return request("'get'", url, "{}", successCallback, null);
83137
}
84138

139+
/**
140+
* Sends a get request
141+
* @param url the url to request
142+
* @param successCallback the javascript code to execute if success (parameter response)
143+
* @param errorCallback the javascript code to execute on error (parameter response)
144+
* @return
145+
*/
85146
public static String get(String url,String successCallback,String errorCallback) {
86147
return request("'get'", url, "{}", successCallback, errorCallback);
87148
}
88149

150+
/**
151+
* Sends a delete request
152+
* @param url the url to request
153+
* @param data the data to send to the request
154+
* @param successCallback the javascript code to execute if success (parameter response)
155+
* @param errorCallback the javascript code to execute on error (parameter response)
156+
* @return
157+
*/
89158
public static String delete(String url,Object data,String successCallback,String errorCallback) {
90159
return request("'delete'", url, data, successCallback, errorCallback);
91160
}
92161

162+
/**
163+
* Sends a delete request
164+
* @param url the url to request
165+
* @param data the data to send to the request
166+
* @param successCallback the javascript code to execute if success (parameter response)
167+
* @return
168+
*/
93169
public static String delete(String url,Object data,String successCallback) {
94170
return request("'delete'", url, data, successCallback, null);
95171
}
96172

173+
/**
174+
* Sends a delete request
175+
* @param url the url to request
176+
* @param successCallback the javascript code to execute if success (parameter response)
177+
* @return
178+
*/
97179
public static String delete(String url,String successCallback) {
98180
return request("'delete'", url, "{}", successCallback, null);
99181
}
100182

183+
/**
184+
* Sends a delete request
185+
* @param url the url to request
186+
* @param successCallback the javascript code to execute if success (parameter response)
187+
* @param errorCallback the javascript code to execute on error (parameter response)
188+
* @return
189+
*/
101190
public static String delete(String url,String successCallback,String errorCallback) {
102191
return request("'delete'", url, "{}", successCallback, errorCallback);
103192
}
104193

194+
/**
195+
* Sends a put request
196+
* @param url the url to request
197+
* @param data the data to send to the request
198+
* @param successCallback the javascript code to execute if success (parameter response)
199+
* @param errorCallback the javascript code to execute on error (parameter response)
200+
* @return
201+
*/
105202
public static String put(String url,Object data,String successCallback,String errorCallback) {
106203
return request("'put'", url, data, successCallback, errorCallback);
107204
}
108205

206+
/**
207+
* Sends a put request
208+
* @param url the url to request
209+
* @param data the data to send to the request
210+
* @param successCallback the javascript code to execute if success (parameter response)
211+
* @return
212+
*/
109213
public static String put(String url,Object data,String successCallback) {
110214
return request("'put'", url, data, successCallback, null);
111215
}
112216

217+
/**
218+
* Sends a put request
219+
* @param url the url to request
220+
* @param successCallback the javascript code to execute if success (parameter response)
221+
* @return
222+
*/
113223
public static String put(String url,String successCallback) {
114224
return request("'put'", url, "{}", successCallback, null);
115225
}
116226

227+
/**
228+
* Sends a put request
229+
* @param url the url to request
230+
* @param successCallback the javascript code to execute if success (parameter response)
231+
* @param errorCallback the javascript code to execute on error (parameter response)
232+
* @return
233+
*/
117234
public static String put(String url,String successCallback,String errorCallback) {
118235
return request("'put'", url, "{}", successCallback, errorCallback);
119236
}
120237

238+
/**
239+
* Sends a patch request
240+
* @param url the url to request
241+
* @param data the data to send to the request
242+
* @param successCallback the javascript code to execute if success (parameter response)
243+
* @param errorCallback the javascript code to execute on error (parameter response)
244+
* @return
245+
*/
121246
public static String patch(String url,Object data,String successCallback,String errorCallback) {
122247
return request("'patch'", url, data, successCallback, errorCallback);
123248
}
124249

250+
/**
251+
* Sends a patch request
252+
* @param url the url to request
253+
* @param data the data to send to the request
254+
* @param successCallback the javascript code to execute if success (parameter response)
255+
* @return
256+
*/
125257
public static String patch(String url,Object data,String successCallback) {
126258
return request("'patch'", url, data, successCallback, null);
127259
}
128260

261+
/**
262+
* Sends a patch request
263+
* @param url the url to request
264+
* @param successCallback the javascript code to execute if success (parameter response)
265+
* @return
266+
*/
129267
public static String patch(String url,String successCallback) {
130268
return request("'patch'", url, "{}", successCallback, null);
131269
}
132270

271+
/**
272+
* Sends a patch request
273+
* @param url the url to request
274+
* @param successCallback the javascript code to execute if success (parameter response)
275+
* @param errorCallback the javascript code to execute on error (parameter response)
276+
* @return
277+
*/
133278
public static String patch(String url,String successCallback,String errorCallback) {
134279
return request("'patch'", url, "{}", successCallback, errorCallback);
135280
}
136281

282+
/**
283+
* Sends a post request
284+
* @param url the url to request
285+
* @param data the data to send to the request
286+
* @param successCallback the javascript code to execute if success (parameter response)
287+
* @param errorCallback the javascript code to execute on error (parameter response)
288+
* @return
289+
*/
137290
public static String post(String url,Object data,String successCallback,String errorCallback) {
138291
return request("'post'", url, data, successCallback, errorCallback);
139292
}
140293

294+
/**
295+
* Sends a post request
296+
* @param url the url to request
297+
* @param data the data to send to the request
298+
* @param successCallback the javascript code to execute if success (parameter response)
299+
* @return
300+
*/
141301
public static String post(String url,Object data,String successCallback) {
142302
return request("'post'", url, data, successCallback, null);
143303
}
144304

305+
/**
306+
* Sends a post request
307+
* @param url the url to request
308+
* @param successCallback the javascript code to execute if success (parameter response)
309+
* @return
310+
*/
145311
public static String post(String url,String successCallback) {
146312
return request("'post'", url, "{}", successCallback, null);
147313
}
148314

315+
/**
316+
* Defines a request header
317+
* @param key the header key
318+
* @param value the header value
319+
* @return
320+
*/
149321
public static String setRequestHeader(String key, String value) {
150322
return "this.$http.headers.set('"+key+"', '"+value+"');";
151323
}

0 commit comments

Comments
 (0)