/**
 * 
 */
package com.tilioteo.hypothesis.ui;

import javax.servlet.annotation.WebServlet;

import com.tilioteo.hypothesis.servlet.HibernateServlet;
import com.tilioteo.hypothesis.ui.Timer.StopEvent;
import com.tilioteo.hypothesis.ui.Timer.StopListener;
import com.tilioteo.hypothesis.ui.view.PacksView;
import com.vaadin.annotations.Theme;
import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.navigator.Navigator;
import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.Notification;
import com.vaadin.ui.Notification.Type;
import com.vaadin.ui.UI;

/**
 * @author kamil
 * 
 */
@SuppressWarnings("serial")
@Theme("hypothesis")
public class MainUI extends HUI {

	@WebServlet(value = "/*", asyncSupported = true)
	@VaadinServletConfiguration(productionMode = false, ui = MainUI.class, widgetset = "com.tilioteo.hypothesis.HypothesisWidgetset")
	public static class Servlet extends HibernateServlet {
	}

	private Navigator navigator;

	@Override
	protected void init(VaadinRequest request) {
		getPage().setTitle("Hypothesis");

		/*navigator = new Navigator(this, this);

		navigator.addView("/packs", PacksView.class);

		navigator.navigateTo("/packs");*/
		
		VerticalLayout verticalLayout = new VerticalLayout();
		setContent(verticalLayout);
		
		Timer timer = new Timer();
		addTimer(timer);
		
		TimerLabel timerLabel = new TimerLabel();
		timerLabel.setTimer(timer);
		
		verticalLayout.addComponent(timerLabel);
		
		timer.addStopListener(new StopListener() {
			@Override
			public void stop(StopEvent event) {
				Notification.show("Time out!", Type.HUMANIZED_MESSAGE);
			}
		});
		
		timer.start(30000);

	}

}
@@ -179,72 +179,250 @@
 sis.
-ui.Timer.StopEvent;%0Aimport com.tilioteo.hypothesis.ui.Timer.Stop
+shared.ui.timer.TimerState.Direction;%0Aimport com.tilioteo.hypothesis.ui.Timer.StopEvent;%0Aimport com.tilioteo.hypothesis.ui.Timer.StopListener;%0Aimport com.tilioteo.hypothesis.ui.Timer.UpdateEvent;%0Aimport com.tilioteo.hypothesis.ui.Timer.Update
 List
@@ -1496,24 +1496,62 @@
 mer(timer);%0A
+%09%09timer.setDirection(Direction.DOWN);%0A
 %09%09%0A%09%09TimerLa
@@ -1585,16 +1585,60 @@
 abel();%0A
+%09%09//timerLabel.setTimeFormat(%22kk:mm:ss.S%22);%0A
 %09%09timerL
@@ -1875,24 +1875,498 @@
 %09%7D%0A%09%09%7D);%0A%09%09%0A
+%09%09timer.addUpdateListener(2000, new UpdateListener() %7B%0A%09%09%09@Override%0A%09%09%09public void update(UpdateEvent event) %7B%0A%09%09%09%09Notification.show(String.format(%22%25d miliseconds, interval %25d ms%22, event.getTime(), event.getInterval()));%0A%09%09%09%7D%0A%09%09%7D);%0A%09%09%0A%09%09/*timer.addUpdateListener(5000, new UpdateListener() %7B%0A%09%09%09@Override%0A%09%09%09public void update(UpdateEvent event) %7B%0A%09%09%09%09Notification.show(String.format(%22%25d miliseconds, interval %25d ms%22, event.getTime(), event.getInterval()));%0A%09%09%09%7D%0A%09%09%7D);*/%0A%09%09%0A
 %09%09timer.star

test some features of timer