Skip to content

Commit 3500a7e

Browse files
committed
JSR 330 version of client (initial checkin)
1 parent 23deb1f commit 3500a7e

20 files changed

Lines changed: 1104 additions & 0 deletions

jsr330client/pom.xml

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>steveonjava</groupId>
6+
<artifactId>javafx-spring-client</artifactId>
7+
<name>Spring client for JavaFX/Spring sample application.</name>
8+
<packaging>jar</packaging>
9+
<version>1.0.0</version>
10+
11+
<properties>
12+
<java-version>1.6</java-version>
13+
<org.springframework-version>3.1.0.RELEASE</org.springframework-version>
14+
</properties>
15+
<dependencies>
16+
<dependency>
17+
<groupId>com.oracle</groupId>
18+
<artifactId>javafx</artifactId>
19+
<version>2.2</version>
20+
<scope>system</scope>
21+
<systemPath>${java.home}/lib/jfxrt.jar</systemPath>
22+
</dependency>
23+
<dependency>
24+
<groupId>org.slf4j</groupId>
25+
<artifactId>slf4j-api</artifactId>
26+
<version>1.5.6</version>
27+
</dependency>
28+
<dependency>
29+
<groupId>org.slf4j</groupId>
30+
<artifactId>slf4j-log4j12</artifactId>
31+
<version>1.5.6</version>
32+
<scope>compile</scope>
33+
</dependency>
34+
<dependency>
35+
<groupId>org.codehaus.jackson</groupId>
36+
<artifactId>jackson-mapper-asl</artifactId>
37+
<version>1.9.9</version>
38+
</dependency>
39+
<dependency>
40+
<groupId>cglib</groupId>
41+
<artifactId>cglib</artifactId>
42+
<version>2.2.2</version>
43+
</dependency>
44+
<dependency>
45+
<groupId>org.springframework.security</groupId>
46+
<artifactId>spring-security-core</artifactId>
47+
<version>${org.springframework-version}</version>
48+
</dependency>
49+
<dependency>
50+
<groupId>org.springframework.security</groupId>
51+
<artifactId>spring-security-config</artifactId>
52+
<version>${org.springframework-version}</version>
53+
</dependency>
54+
<dependency>
55+
<groupId>org.springframework</groupId>
56+
<artifactId>spring-web</artifactId>
57+
<version>${org.springframework-version}</version>
58+
</dependency>
59+
<dependency>
60+
<groupId>org.springframework</groupId>
61+
<artifactId>spring-core</artifactId>
62+
<version>${org.springframework-version}</version>
63+
</dependency>
64+
<dependency>
65+
<groupId>org.springframework</groupId>
66+
<artifactId>spring-context</artifactId>
67+
<version>${org.springframework-version}</version>
68+
</dependency>
69+
<dependency>
70+
<groupId>org.springframework</groupId>
71+
<artifactId>spring-beans</artifactId>
72+
<version>${org.springframework-version}</version>
73+
</dependency>
74+
<dependency>
75+
<groupId>org.springframework</groupId>
76+
<artifactId>spring-expression</artifactId>
77+
<version>${org.springframework-version}</version>
78+
</dependency>
79+
<dependency>
80+
<groupId>javax.inject</groupId>
81+
<artifactId>javax.inject</artifactId>
82+
<version>1</version>
83+
</dependency>
84+
</dependencies>
85+
<repositories>
86+
<!-- For testing against latest Spring snapshots -->
87+
<repository>
88+
<id>org.springframework.maven.snapshot</id>
89+
<name>Spring Maven Snapshot Repository</name>
90+
<url>http://maven.springframework.org/snapshot</url>
91+
<releases>
92+
<enabled>false</enabled>
93+
</releases>
94+
<snapshots>
95+
<enabled>true</enabled>
96+
</snapshots>
97+
</repository>
98+
<!-- For developing against latest Spring milestones -->
99+
<repository>
100+
<id>org.springframework.maven.milestone</id>
101+
<name>Spring Maven Milestone Repository</name>
102+
<url>http://maven.springframework.org/milestone</url>
103+
<snapshots>
104+
<enabled>false</enabled>
105+
</snapshots>
106+
</repository>
107+
<!-- For JPA and Hibernate artifacts -->
108+
<repository>
109+
<id>JBoss Repo</id>
110+
<url>https://repository.jboss.org/nexus/content/repositories/releases</url>
111+
<name>JBoss Repo</name>
112+
</repository>
113+
</repositories>
114+
<pluginRepositories>
115+
<pluginRepository>
116+
<id>repository.springframework.maven.milestone</id>
117+
<name>Spring Framework Maven Milestone Repository</name>
118+
<url>http://maven.springframework.org/milestone</url>
119+
</pluginRepository>
120+
</pluginRepositories>
121+
<build>
122+
<plugins>
123+
<plugin>
124+
<groupId>org.apache.maven.plugins</groupId>
125+
<artifactId>maven-compiler-plugin</artifactId>
126+
<version>2.3.2</version>
127+
<configuration>
128+
<source>1.7</source>
129+
<target>1.7</target>
130+
<fork>true</fork>
131+
</configuration>
132+
</plugin>
133+
<plugin>
134+
<groupId>org.codehaus.mojo</groupId>
135+
<artifactId>exec-maven-plugin</artifactId>
136+
<configuration>
137+
<classpathScope>compile</classpathScope>
138+
<mainClass>steveonjava.client.CustomerApp</mainClass>
139+
</configuration>
140+
</plugin>
141+
<plugin>
142+
<artifactId>maven-assembly-plugin</artifactId>
143+
<configuration>
144+
<archive>
145+
<manifest>
146+
<mainClass>steveonjava.client.CustomerApp</mainClass>
147+
</manifest>
148+
</archive>
149+
<descriptorRefs>
150+
<descriptorRef>jar-with-dependencies</descriptorRef>
151+
</descriptorRefs>
152+
</configuration>
153+
</plugin>
154+
</plugins>
155+
</build>
156+
</project>
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* Copyright (c) 2012, Stephen Chin
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions are met:
7+
* * Redistributions of source code must retain the above copyright
8+
* notice, this list of conditions and the following disclaimer.
9+
* * Redistributions in binary form must reproduce the above copyright
10+
* notice, this list of conditions and the following disclaimer in the
11+
* documentation and/or other materials provided with the distribution.
12+
* * Neither the name of the <organization> nor the
13+
* names of its contributors may be used to endorse or promote products
14+
* derived from this software without specific prior written permission.
15+
*
16+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19+
* DISCLAIMED. IN NO EVENT SHALL STEPHEN CHIN OR ORACLE CORPORATION BE LIABLE FOR ANY
20+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26+
*/
27+
package steveonjava.client;
28+
29+
import javafx.fxml.FXML;
30+
import javafx.scene.control.TextField;
31+
import javafx.stage.Stage;
32+
import javax.inject.Inject;
33+
import javax.inject.Named;
34+
35+
@Named
36+
public class AddCustomerController {
37+
@Inject
38+
private CustomerModel model;
39+
40+
@FXML
41+
TextField firstName;
42+
@FXML
43+
TextField lastName;
44+
45+
@FXML
46+
public void add() {
47+
model.addCustomer(firstName.getText(), lastName.getText());
48+
((Stage) firstName.getScene().getWindow()).close();
49+
}
50+
51+
@FXML
52+
public void cancel() {
53+
((Stage) firstName.getScene().getWindow()).close();
54+
}
55+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright (c) 2012, Stephen Chin
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions are met:
7+
* * Redistributions of source code must retain the above copyright
8+
* notice, this list of conditions and the following disclaimer.
9+
* * Redistributions in binary form must reproduce the above copyright
10+
* notice, this list of conditions and the following disclaimer in the
11+
* documentation and/or other materials provided with the distribution.
12+
* * Neither the name of the <organization> nor the
13+
* names of its contributors may be used to endorse or promote products
14+
* derived from this software without specific prior written permission.
15+
*
16+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19+
* DISCLAIMED. IN NO EVENT SHALL STEPHEN CHIN OR ORACLE CORPORATION BE LIABLE FOR ANY
20+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26+
*/
27+
package steveonjava.client;
28+
29+
import javafx.stage.StageStyle;
30+
import javax.inject.Named;
31+
32+
@Named
33+
public class AddCustomerDialogProvider extends FXMLDialogProvider {
34+
public AddCustomerDialogProvider() {
35+
super(AddCustomerDialogProvider.class.getResource("AddCustomer.fxml"), StageStyle.DECORATED);
36+
}
37+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Copyright (c) 2012, Stephen Chin
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions are met:
7+
* * Redistributions of source code must retain the above copyright
8+
* notice, this list of conditions and the following disclaimer.
9+
* * Redistributions in binary form must reproduce the above copyright
10+
* notice, this list of conditions and the following disclaimer in the
11+
* documentation and/or other materials provided with the distribution.
12+
* * Neither the name of the <organization> nor the
13+
* names of its contributors may be used to endorse or promote products
14+
* derived from this software without specific prior written permission.
15+
*
16+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19+
* DISCLAIMED. IN NO EVENT SHALL STEPHEN CHIN OR ORACLE CORPORATION BE LIABLE FOR ANY
20+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26+
*/
27+
package steveonjava.client;
28+
29+
import javafx.application.Application;
30+
import javafx.stage.Stage;
31+
import org.springframework.context.ApplicationContext;
32+
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
33+
34+
public class CustomerApp extends Application {
35+
private static Stage primaryStage;
36+
37+
public static Stage getPrimaryStage() {
38+
return primaryStage;
39+
}
40+
41+
public static void main(String[] args) {
42+
launch(args);
43+
}
44+
45+
@Override
46+
public void start(Stage stage) throws Exception {
47+
primaryStage = stage;
48+
ApplicationContext context = new AnnotationConfigApplicationContext(CustomerAppConfiguration.class);
49+
context.getBean(LoginDialogProvider.class).get().show();
50+
}
51+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright (c) 2012, Stephen Chin
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions are met:
7+
* * Redistributions of source code must retain the above copyright
8+
* notice, this list of conditions and the following disclaimer.
9+
* * Redistributions in binary form must reproduce the above copyright
10+
* notice, this list of conditions and the following disclaimer in the
11+
* documentation and/or other materials provided with the distribution.
12+
* * Neither the name of the <organization> nor the
13+
* names of its contributors may be used to endorse or promote products
14+
* derived from this software without specific prior written permission.
15+
*
16+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19+
* DISCLAIMED. IN NO EVENT SHALL STEPHEN CHIN OR ORACLE CORPORATION BE LIABLE FOR ANY
20+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26+
*/
27+
package steveonjava.client;
28+
29+
import java.util.Collections;
30+
import org.springframework.context.annotation.Bean;
31+
import org.springframework.context.annotation.ComponentScan;
32+
import org.springframework.context.annotation.Configuration;
33+
import org.springframework.context.annotation.ImportResource;
34+
import org.springframework.http.converter.HttpMessageConverter;
35+
import org.springframework.http.converter.json.MappingJacksonHttpMessageConverter;
36+
import org.springframework.web.client.RestTemplate;
37+
38+
@Configuration
39+
@ComponentScan(basePackages="steveonjava.client")
40+
@ImportResource("classpath:applicationContext-security.xml")
41+
public class CustomerAppConfiguration {
42+
@Bean
43+
RestTemplate restTemplate() {
44+
RestTemplate restTemplate = new RestTemplate();
45+
restTemplate.setMessageConverters(Collections.<HttpMessageConverter<?>>singletonList(new MappingJacksonHttpMessageConverter()));
46+
return restTemplate;
47+
}
48+
}

0 commit comments

Comments
 (0)