package com.itmill.toolkit.demo;

import java.util.Date;

import com.itmill.toolkit.ui.Button;
import com.itmill.toolkit.ui.CalendarField;
import com.itmill.toolkit.ui.DateField;
import com.itmill.toolkit.ui.Label;
import com.itmill.toolkit.ui.OrderedLayout;
import com.itmill.toolkit.ui.Window;

/**
 * The classic "hello, world!" example for IT Mill Toolkit. The class simply
 * implements the abstract {@link com.itmill.toolkit.Application#init() init()}
 * method in which it creates a Window and adds a Label to it.
 * 
 * @author IT Mill Ltd.
 * @see com.itmill.toolkit.Application
 * @see com.itmill.toolkit.ui.Window
 * @see com.itmill.toolkit.ui.Label
 */
public class HelloWorld extends com.itmill.toolkit.Application {

	/**
	 * The initialization method that is the only requirement for inheriting the
	 * com.itmill.toolkit.service.Application class. It will be automatically
	 * called by the framework when a user accesses the application.
	 */
	OrderedLayout l;
	public void init() {

		setTheme("demo");
		/*
		 * - Create new window for the application - Give the window a visible
		 * title - Set the window to be the main window of the application
		 */
		Window main = new Window("Hello window");
		setMainWindow(main);

		main.addComponent(new DateField());
		main.addComponent(new CalendarField());
		
		/*
		 * - Create a label with the classic text - Add the label to the main
		 * window
		 */
		main.addComponent(new Label("Hello4 World!"));
		
		l = new OrderedLayout();
		main.addComponent(l);
		l.addComponent(new Button("foo",this,"foo"));
		l.addComponent(new Button("asd",this,"asd"));

		/*
		 * And that's it! The framework will display the main window and its
		 * contents when the application is accessed with the terminal.
		 */
	}
	
	public void foo() {
	    long s = new Date().getTime();
	    System.out.println("> foo: " + s);
	    try {
		Thread.currentThread().sleep(5000);
	    } catch (Exception e) {
		
	    }
	    System.out.println("< foo: " + s);	
	}
	public void asd() {
	    long s = new Date().getTime();
	    System.out.println("> asd: " + s);
	    try {
		Thread.currentThread().sleep(5000);
	    } catch (Exception e) {
		
	    }
	    System.out.println("< asd: " + s);	
	}
}

@@ -38,261 +38,31 @@
 ort 
-java.util.Date;%0A%0Aimport com.itmill.toolkit.ui.Button;%0Aimport com.itmill.toolkit.ui.CalendarField;%0Aimport com.itmill.toolkit.ui.DateField;%0Aimport com.itmill.toolkit.ui.Label;%0Aimport com.itmill.toolkit.ui.OrderedLayout;%0Aimport com.itmill.toolkit.ui.Window
+com.itmill.toolkit.ui.*
 ;%0A%0A/
@@ -727,26 +727,8 @@
  */%0A
-%09OrderedLayout l;%0A
 %09pub
@@ -750,28 +750,8 @@
  %7B%0A%0A
-%09%09setTheme(%22demo%22);%0A
 %09%09/*
@@ -971,91 +971,8 @@
 );%0A%0A
-%09%09main.addComponent(new DateField());%0A%09%09main.addComponent(new CalendarField());%0A%09%09%0A
 %09%09/*
@@ -1102,9 +1102,8 @@
 ello
-4
  Wor
@@ -1114,766 +1114,156 @@
 ));%0A
-%09%09%0A%09%09l = new OrderedLayout();%0A%09%09main.addComponent(l);%0A%09%09l.addComponent(new Button(%22foo%22,this,%22foo%22));%0A%09%09l.addComponent(new Button(%22asd%22,this,%22asd%22));%0A%0A%09%09/*%0A%09%09 * And that's it! The framework will display the main window and its%0A%09%09 * contents when the application is accessed with the terminal.%0A%09%09 */%0A%09%7D%0A%09%0A%09public void foo() %7B%0A%09    long s = new Date().getTime();%0A%09    System.out.println(%22%3E foo: %22 + s);%0A%09    try %7B%0A%09%09Thread.currentThread().sleep(5000);%0A%09    %7D catch (Exception e) %7B%0A%09%09%0A%09    %7D%0A%09    System.out.println(%22%3C foo: %22 + s);%09%0A%09%7D%0A%09public void asd() %7B%0A%09    long s = new Date().getTime();%0A%09    System.out.println(%22%3E asd: %22 + s);%0A%09    try %7B%0A%09%09Thread.currentThread().sleep(5000);%0A%09    %7D catch (Exception e) %7B%0A%09%09%0A%09    %7D%0A%09    System.out.println(%22%3C asd: %22 + s);%09
+%0A%09%09/*%0A%09%09 * And that's it! The framework will display the main window and its%0A%09%09 * contents when the application is accessed with the terminal.%0A%09%09 */
 %0A%09%7D%0A

undo bad commit