aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/itmill/toolkit/tests/TestDateField.java
blob: ba1c6a12353bd6bd8f84daacb27c55789cb51794 (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
package com.itmill.toolkit.tests;

import com.itmill.toolkit.terminal.ClassResource;
import com.itmill.toolkit.terminal.ErrorMessage;
import com.itmill.toolkit.terminal.UserError;
import com.itmill.toolkit.ui.CustomComponent;
import com.itmill.toolkit.ui.DateField;
import com.itmill.toolkit.ui.Label;
import com.itmill.toolkit.ui.OrderedLayout;

/**
 * 
 * @author IT Mill Ltd.
 */
public class TestDateField extends CustomComponent {

	OrderedLayout main = new OrderedLayout();

	DateField df;

	public TestDateField() {
		setCompositionRoot(main);
		createNewView();
	}

	public void createNewView() {
		main.removeAllComponents();
		main.addComponent(new Label("DateField"));

		df = new DateField();
		main.addComponent(df);

		ErrorMessage errorMsg = new UserError("User error " + df);
		df.setCaption("DateField caption " + df);
		df.setDescription("DateField description " + df);
		df.setComponentError(errorMsg);
		df.setImmediate(true);
		// FIXME: bug #1138 this makes datefield to render with unknown component (UIDL tree debug)
		df.addStyleName("thisShouldBeHarmless");
	}

	public void attach() {
		ClassResource res = new ClassResource("m.gif", super.getApplication());
		df.setIcon(res);
		super.attach();
	}

}