Subversion Repository Public Repository

litesoft

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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
 * Copyright 2007 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package org.litesoft.hello.client;

import com.google.gwt.core.client.*;
import com.google.gwt.event.dom.client.*;
import com.google.gwt.user.client.*;
import com.google.gwt.user.client.ui.*;
import com.googlecode.gwtphonegap.client.*;

/**
 * HelloWorld application.
 */
public class Hello implements EntryPoint {
    public static final String VERSION = "1.3";
    private Label mLabel;
    private int mDecaSecs = 1;

    public void onModuleLoad() {
        Button b = new Button( "Click me", new ClickHandler() {
            public void onClick( ClickEvent event ) {
                mDecaSecs += 20;
            }
        } );
        VerticalPanel zPanel = new VerticalPanel();
        zPanel.add( mLabel = new Label( "0" ) );
        zPanel.add( new HTML( " " ) );
        zPanel.add( new HTML( " " ) );
        zPanel.add( new HTML( " " ) );
        zPanel.add( new HTML( " " ) );
        zPanel.add( new HTML( " " ) );
        zPanel.add( b );
        RootPanel.get().add( zPanel );

        GWT.setUncaughtExceptionHandler( new GWT.UncaughtExceptionHandler() {
            @Override
            public void onUncaughtException( Throwable e ) {
                Window.alert( "uncaught: " + // e.getLocalizedMessage() );
                              e.getMessage() );
            }
        } );

        final PhoneGap phoneGap = GWT.create( PhoneGap.class );

        phoneGap.addHandler( new PhoneGapAvailableHandler() {
            @Override
            public void onPhoneGapAvailable( PhoneGapAvailableEvent event ) {
                startShowCase( phoneGap );
            }
        } );

        phoneGap.addHandler( new PhoneGapTimeoutHandler() {
            @Override
            public void onPhoneGapTimeout( PhoneGapTimeoutEvent event ) {
                Window.alert( "can not load Phonegap\nvs " + VERSION );
            }
        } );

        new Timer() {
            long started = System.currentTimeMillis();

            @Override
            public void run() {
                int delay;
                do {
                    String zText = "                  " + (mDecaSecs++);
                    zText = zText.substring( zText.length() - 10 );
                    zText = zText.substring( 0, 9 ) + '.' + zText.substring( 9 ) + " tenths of a second vs " + VERSION;
                    mLabel.setText( zText );
                    delay = (int) ((started + (mDecaSecs * 100)) - System.currentTimeMillis());
                }
                while ( delay < 10 );
                schedule( delay );
            }
        }.schedule( 100 );

        phoneGap.initializePhoneGap();
    }

    private void startShowCase( PhoneGap phoneGap ) {
        Window.alert( "Phonegap ready!\n" +
                      "vs " + VERSION );
    }
}

Commits for litesoft/trunk/GWT_Sandbox/SampleHello/src/org/litesoft/hello/client/Hello.java

Diff revisions: vs.
Revision Author Commited Message
948 Diff Diff GeorgeS picture GeorgeS Sat 07 Jun, 2014 23:42:39 +0000

Jusefuls Formatter Updated to New Code Format

692 Diff Diff GeorgeS picture GeorgeS Mon 28 May, 2012 01:46:31 +0000
675 Diff Diff markcmarkc Mon 14 May, 2012 00:46:36 +0000
664 Diff Diff GeorgeS picture GeorgeS Sun 13 May, 2012 18:06:41 +0000
652 GeorgeS picture GeorgeS Mon 30 Apr, 2012 01:09:16 +0000