summaryrefslogtreecommitdiffstats
path: root/vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java
blob: d5e3091103c13b8273957e77c6f070d2429f4c44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package ch.asynk.helloworld;

import com.vaadin.Application;
import com.vaadin.terminal.Terminal;
import com.vaadin.terminal.Sizeable;
import com.vaadin.ui.Window;

public class HelloWorldApp extends Application {
    //
    private static final long serialVersionUID = 1L;
    //
    private Context ctx = null;
    public Context getCtx() {
        return ctx;
    }
    //
    @Override
    public void init() {
        ctx = new Context(this);
        setTheme("asynk");
        final Window mainWindow = new Window("Hello World Application");
        mainWindow.setWidth(900,Sizeable.UNITS_PIXELS);
        setMainWindow(mainWindow);
        mainWindow.setContent( new MainLayout(ctx) );
        setLogoutURL("http://asynk.ch");
        ctx.getLogger().warning("hell : "+ctx.getProps().getProperty("hello.next")+" "+ctx.getProps().getProperty("hello.world"));
    }

    public void notifyError(String title, String msg){
        getMainWindow().showNotification(title,msg,Window.Notification.TYPE_ERROR_MESSAGE);
    }

    @Override
    public void terminalError(Terminal.ErrorEvent event) {
        // Call the default implementation.
        super.terminalError(event);
        // Some custom behaviour.
        if (getMainWindow() != null) {
            getMainWindow().showNotification("An unchecked exception occured!", event.getThrowable().toString(), Window.Notification.TYPE_ERROR_MESSAGE);
        }
    }
}