summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-10-03 11:35:02 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2011-10-03 11:35:02 +0200
commitc9e1a2df6ade1428d2785538272dc6357414d696 (patch)
treebe75a8a0782f12f574c06297d46dc6fcae13bc79
parent4709a519148e2338f81d4b29b58da53c9f897e23 (diff)
downloadskeletons-c9e1a2df6ade1428d2785538272dc6357414d696.zip
skeletons-c9e1a2df6ade1428d2785538272dc6357414d696.tar.gz
vaadin-app: use Properties and Logger
-rw-r--r--vaadin-app/src/Application.properties2
-rw-r--r--vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java32
2 files changed, 34 insertions, 0 deletions
diff --git a/vaadin-app/src/Application.properties b/vaadin-app/src/Application.properties
new file mode 100644
index 0000000..e5b8c95
--- /dev/null
+++ b/vaadin-app/src/Application.properties
@@ -0,0 +1,2 @@
+hello.next=Ô
+hello.world=WoRlD
diff --git a/vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java b/vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java
index be5ab08..d9cfaa1 100644
--- a/vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java
+++ b/vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java
@@ -1,5 +1,9 @@
package ch.asynk.helloworld;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
import com.vaadin.Application;
import com.vaadin.terminal.Terminal;
import com.vaadin.terminal.UserError;
@@ -14,14 +18,42 @@ import com.vaadin.ui.AbstractComponent;
public class HelloWorldApp extends Application {
private static final long serialVersionUID = 1L;
+ private static Logger logger = Logger.getLogger("com.heraeus.hmsa");
+ public static Properties props = new Properties();
@Override
public void init() {
+ init_properties();
setTheme("asynk");
final Window mainWindow = new Window("Hello World Application");
mainWindow.setContent( new MainLayout() );
setMainWindow(mainWindow);
setLogoutURL("http://asynk.ch");
+ logger.warning("hell : "+props.getProperty("hello.next")+" "+props.getProperty("hello.world"));
+ }
+
+ private void init_properties() {
+ //
+ String properties_file = "Application.properties";
+ logger.info("doing stuff : ");
+ java.io.InputStream is = null;
+ try {
+ is = HelloWorldApp.class.getClassLoader().getResourceAsStream(properties_file);
+ }
+ catch(java.lang.Exception x) {
+ logger.log(Level.SEVERE,"Error loading "+properties_file+"' properties",x);
+ return;
+ }
+ if (is!=null) {
+ try {
+ props.load(is);
+ }
+ catch (java.io.IOException e) {
+ logger.log(Level.SEVERE,"Error reading properties '"+properties_file+"' ",e);
+ }
+ } else {
+ logger.warning("'"+properties_file+"' file not found");
+ }
}
@Override