summaryrefslogtreecommitdiff
path: root/webapps/qooxdoo-0.6.5-sdk/frontend/application/sample/source/html/test/History_1.html
blob: 3c137ad1310d6b0d844691a5f5a7a6c853d9d248 (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
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
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>qooxdoo &raquo; Demo &raquo; Sample</title>
  <link type="text/css" rel="stylesheet" href="../../css/layout.css"/>
  <!--[if IE]>
  <link type="text/css" rel="stylesheet" href="../../css/layout_ie.css"/>
  <![endif]-->
  <script type="text/javascript" src="../../script/sample.js"></script>
</head>
<body>
  <script type="text/javascript" src="../../script/layout.js"></script>

  <div id="demoDescription">
    <p>Test the back button functionality of qooxdoo.</p>
  </div>

  <script type="text/javascript">
  qx.core.Init.getInstance().defineMain(function()
  {
    var d = qx.ui.core.ClientDocument.getInstance();

    function callback(e) {
			d.debug(e.getData());
			a1.setLabel("History event: " + e.getData());
		}

    var history = qx.client.History.getInstance();
  	
		history.init();
		history.addEventListener("request", callback);
		
		qx.client.Timer.once(function() {
			history.addToHistory("Juhu1", "Juhu1");
		}, this, 300);
		
    qx.client.Timer.once(function() {
			history.addToHistory("Juhu2", "Juhu2");
		}, this, 600);
		
		qx.client.Timer.once(function() {
			history.addToHistory("Juhu3", "Juhu3");
		}, this, 900);

    var t1 = new qx.ui.form.TextField();
    t1.set({
			left: 20,
			top:48,
			height: 20,
			value: ""
		});
		
		var a1 = new qx.ui.basic.Atom("");
		a1.set({
			left: 20,
			top: 78,
			width: 230,
			height: 120,
			backgroundColor: "orange",
			border: qx.renderer.border.BorderPresets.getInstance().thinInset
		});
		
		var b1 = new qx.ui.form.Button("add to history");
		b1.set({
			top: 48,
			left: 150,
			height: 20,
			width: 100
		});
		b1.addEventListener("execute", function() {
			var data = t1.getValue();
			if (!data) return;
			t1.setValue("");
			qx.client.Timer.once(function() {
			  history.addToHistory(data, data);
		  }, this, 100);
		});
		
		d.add(t1, a1, b1);
		
  });
  </script>
</body>
</html>