Skip to content

Commit c8d9111

Browse files
committed
1 parent 1a0c1cf commit c8d9111

File tree

16 files changed

+200
-12
lines changed

16 files changed

+200
-12
lines changed

gwt-client-storage/pom.xml

+11-2
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@
5050

5151
<build>
5252
<resources>
53+
<resource>
54+
<directory>${pom.basedir}/src/main/java</directory>
55+
<includes>
56+
<include>**/*.java</include>
57+
<include>**/*.xml</include>
58+
</includes>
59+
</resource>
60+
</resources>
61+
<!-- <resources>
5362
<resource>
5463
<directory>src/main/java</directory>
5564
<includes>
@@ -64,7 +73,7 @@
6473
<include>**/*.xml</include>
6574
</includes>
6675
</resource>
67-
</resources>
76+
</resources> -->
6877
<plugins>
6978
<plugin>
7079
<groupId>org.apache.maven.plugins</groupId>
@@ -75,7 +84,7 @@
7584
<id>attach-sources</id>
7685
<phase>verify</phase>
7786
<goals>
78-
<goal>jar</goal>
87+
<goal>jar-no-fork</goal>
7988
</goals>
8089
</execution>
8190
</executions>
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package org.krypsis.gwt.store.example.client;
22

3-
import com.google.gwt.user.client.rpc.AsyncCallback;
43
import com.google.gwt.core.client.GWT;
4+
import com.google.gwt.user.client.rpc.AsyncCallback;
55

66
public abstract class SuccessCallback<T> implements AsyncCallback<T> {
7-
public void onFailure(Throwable caught) {
8-
GWT.log("Error: ", caught);
9-
}
7+
8+
@Override
9+
public void onFailure(Throwable caught) {
10+
GWT.log("Error: ", caught);
11+
}
1012
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package modbus.control.api.gwtbp;
2+
3+
/**
4+
* The name Command is taken
5+
*/
6+
public interface Action<T extends Response> {
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package modbus.control.api.gwtbp;
2+
3+
import java.util.ArrayList;
4+
5+
public class Contact {
6+
7+
String name;
8+
ArrayList<ContactDetailId> detailIds;
9+
10+
ArrayList<ContactDetailId> getDetailIds() {
11+
return detailIds;
12+
}
13+
14+
String getName() {
15+
return name;
16+
}
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* To change this template, choose Tools | Templates
3+
* and open the template in the editor.
4+
*/
5+
package modbus.control.api.gwtbp;
6+
7+
/**
8+
*
9+
* @author ag
10+
*/
11+
public class ContactDetail {
12+
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* To change this template, choose Tools | Templates
3+
* and open the template in the editor.
4+
*/
5+
package modbus.control.api.gwtbp;
6+
7+
/**
8+
*
9+
* @author ag
10+
*/
11+
class ContactDetailId {
12+
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package modbus.control.api.gwtbp;
2+
3+
import com.google.gwt.user.client.rpc.RemoteService;
4+
5+
public interface ContactsService extends RemoteService {
6+
7+
public <T extends Response> T execute(Action<T> action);
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package modbus.control.api.gwtbp;
2+
3+
import com.google.gwt.user.client.rpc.AsyncCallback;
4+
5+
public interface ContactsServiceAsync {
6+
7+
public <T extends Response> void execute(Action<T> action, AsyncCallback<T> callback);
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package modbus.control.api.gwtbp;
2+
3+
import java.util.ArrayList;
4+
5+
public class GetDetails implements Action<GetDetailsResponse> {
6+
private final ArrayList<ContactDetailId> ids;
7+
public GetDetails(ArrayList<ContactDetailId> ids) {
8+
this.ids = ids;
9+
}
10+
public ArrayList<ContactDetailId> getIds() {
11+
return ids;
12+
}
13+
}
14+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package modbus.control.api.gwtbp;
2+
3+
import java.util.ArrayList;
4+
5+
6+
class GetDetailsResponse implements Response {
7+
private final ArrayList<ContactDetail> details;
8+
public GetDetailsResponse(ArrayList<ContactDetail> details) {
9+
this.details = details;
10+
}
11+
public ArrayList<ContactDetail> getDetails() {
12+
return new ArrayList<ContactDetail>(details);
13+
}
14+
}
15+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* To change this template, choose Tools | Templates
3+
* and open the template in the editor.
4+
*/
5+
package modbus.control.api.gwtbp;
6+
7+
import com.google.gwt.user.client.rpc.AsyncCallback;
8+
import java.util.ArrayList;
9+
10+
abstract class GotDetails implements
11+
AsyncCallback<GetDetailsResponse> {
12+
13+
@Override
14+
public void onFailure(Throwable oops) {
15+
/*
16+
* default appwide failure handling
17+
*/
18+
}
19+
20+
@Override
21+
public void onSuccess(GetDetailsResponse result) {
22+
got(result.getDetails());
23+
}
24+
25+
public abstract void got(ArrayList<ContactDetail> details);
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* To change this template, choose Tools | Templates
3+
* and open the template in the editor.
4+
*/
5+
package modbus.control.api.gwtbp;
6+
7+
import com.google.gwt.core.client.EntryPoint;
8+
import java.util.ArrayList;
9+
10+
/**
11+
*
12+
* @author ag
13+
*/
14+
public class MyEntryPoint implements EntryPoint {
15+
16+
@Override
17+
public void onModuleLoad() {
18+
showContact(null);
19+
}
20+
21+
void showContact(final Contact contact) {
22+
// service.execute(new GetDetails(contact.getDetailIds()),
23+
// new GotDetails() {
24+
//
25+
// public void got(ArrayList<ContactDetail> details) {
26+
// renderContact(contact);
27+
// renderDetails(details);
28+
// }
29+
// });
30+
}
31+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package modbus.control.api.gwtbp;
2+
3+
public interface Response {
4+
}
5+

modctrl-app/pom.xml

+2-3
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,10 @@
202202
<fileset dir="${basedir}/../modctrl-api/src/main/resources/db" />
203203
</copy>
204204
<mkdir dir="${staging.dir}/ModbusControl/logs"/>
205-
<!--
205+
<!-- -->
206206
<copy todir="C:/ModbusControl">
207207
<fileset dir="${staging.dir}/ModbusControl" />
208-
</copy>
209-
-->
208+
</copy>
210209
</tasks>
211210
</configuration>
212211
</execution>

modctrl-webapp/src/main/java/modbus/control/client/ModbusControl.java

+24-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,29 @@ public ModbusControl() {
6464
@Override
6565
public void onModuleLoad() {
6666
final ListBox select = new ListBox();
67-
final Label errorLabel = new Label();
67+
68+
// Beispielcode:
69+
//
70+
final Label airportLabel = new Label();
71+
// Airport ap = new Airport();
72+
// ap.setCountry("Germany");
73+
// ap.setId("FRA");
74+
//
75+
// airportService.save(ap, new SuccessCallback<Airport>() {
76+
//
77+
// @Override
78+
// public void onSuccess(Airport result) {
79+
// airportLabel.setText(result.toString());
80+
// }
81+
// });
82+
//
83+
// airportService.load("FRA", new SuccessCallback<Airport>() {
84+
//
85+
// @Override
86+
// public void onSuccess(Airport result) {
87+
// airportLabel.setText(result.toString());
88+
// }
89+
// });
6890

6991
select.setVisibleItemCount(1);
7092

@@ -103,7 +125,7 @@ public void onSuccess(List<Category> result) {
103125

104126
// Add the Control Elements to the RootPanel
105127
// Use RootPanel.get() to get the entire body element
106-
RootPanel.get("errorLabelContainer").add(errorLabel);
128+
RootPanel.get("errorLabelContainer").add(airportLabel);
107129
RootPanel.get("selectContainer").add(select);
108130
}
109131

modctrl-webapp/src/main/webapp/WEB-INF/web.xml

-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,5 @@
3737
<!-- Default page to serve -->
3838
<welcome-file-list>
3939
<welcome-file>ModbusControl.html</welcome-file>
40-
<welcome-file>Example.html</welcome-file>
4140
</welcome-file-list>
4241
</web-app>

0 commit comments

Comments
 (0)