Project

General

Profile

Download (3.33 KB) Statistics
| Branch: | Tag: | Revision:
1
package eu.etaxonomy.cdm.vaadin.view;
2

    
3
import com.vaadin.annotations.AutoGenerated;
4
import com.vaadin.navigator.View;
5
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
6
import com.vaadin.ui.Alignment;
7
import com.vaadin.ui.Button;
8
import com.vaadin.ui.Button.ClickEvent;
9
import com.vaadin.ui.Button.ClickListener;
10
import com.vaadin.ui.CustomComponent;
11
import com.vaadin.ui.Panel;
12
import com.vaadin.ui.TextArea;
13
import com.vaadin.ui.UI;
14
import com.vaadin.ui.VerticalLayout;
15

    
16
import eu.etaxonomy.cdm.vaadin.ui.NavigatorTestUI;
17

    
18
public class NaviTestView extends CustomComponent implements View {
19

    
20
	/*- VaadinEditorProperties={"grid":"RegularGrid,20","showGrid":true,"snapToGrid":true,"snapToObject":true,"movingGuides":false,"snappingDistance":10} */
21

    
22
	@AutoGenerated
23
	private VerticalLayout mainLayout;
24
	@AutoGenerated
25
	private Panel panel;
26
	@AutoGenerated
27
	private VerticalLayout panelVLayout;
28
	@AutoGenerated
29
	private Button button;
30
	@AutoGenerated
31
	private TextArea textArea;
32
	/**
33
	 * The constructor should first build the main layout, set the
34
	 * composition root and then do any custom initialization.
35
	 *
36
	 * The constructor will not be automatically regenerated by the
37
	 * visual editor.
38
	 */
39
	public NaviTestView() {
40
		buildMainLayout();
41
		setCompositionRoot(mainLayout);		
42
		
43
		button.addClickListener(new ClickListener() {
44

    
45
			@Override
46
			public void buttonClick(ClickEvent event) {
47
				UI.getCurrent().getNavigator().navigateTo(NavigatorTestUI.SECOND_VIEW);
48
				
49
			}
50
			
51
		});
52
	}
53

    
54
	public void setText(String text) {
55
		textArea.setValue(text);
56
	}
57
	
58
	public void removeButton() {
59
		panelVLayout.removeComponent(button);
60
	}
61
	
62
	@Override
63
	public void enter(ViewChangeEvent event) {
64
		// TODO Auto-generated method stub
65
		
66
	}
67

    
68
	@AutoGenerated
69
	private VerticalLayout buildMainLayout() {
70
		// common part: create layout
71
		mainLayout = new VerticalLayout();
72
		mainLayout.setImmediate(false);
73
		mainLayout.setWidth("100%");
74
		mainLayout.setHeight("100%");
75
		mainLayout.setMargin(true);
76
		mainLayout.setSpacing(true);
77
		
78
		// top-level component properties
79
		setWidth("100.0%");
80
		setHeight("100.0%");
81
		
82
		// panel
83
		panel = buildPanel();
84
		mainLayout.addComponent(panel);
85
		mainLayout.setComponentAlignment(panel, new Alignment(48));
86
		
87
		return mainLayout;
88
	}
89

    
90
	@AutoGenerated
91
	private Panel buildPanel() {
92
		// common part: create layout
93
		panel = new Panel();
94
		panel.setImmediate(false);
95
		panel.setWidth("242px");
96
		panel.setHeight("162px");
97
		
98
		// panelVLayout
99
		panelVLayout = buildPanelVLayout();
100
		panel.setContent(panelVLayout);
101
		
102
		return panel;
103
	}
104

    
105
	@AutoGenerated
106
	private VerticalLayout buildPanelVLayout() {
107
		// common part: create layout
108
		panelVLayout = new VerticalLayout();
109
		panelVLayout.setImmediate(false);
110
		panelVLayout.setWidth("100.0%");
111
		panelVLayout.setHeight("100.0%");
112
		panelVLayout.setMargin(false);
113
		
114
		// textArea
115
		textArea = new TextArea();
116
		textArea.setImmediate(false);
117
		textArea.setWidth("214px");
118
		textArea.setHeight("-1px");
119
		panelVLayout.addComponent(textArea);
120
		panelVLayout.setComponentAlignment(textArea, new Alignment(48));
121
		
122
		// button
123
		button = new Button();
124
		button.setCaption("Click Me to navigate to next view");
125
		button.setImmediate(true);
126
		button.setWidth("-1px");
127
		button.setHeight("-1px");
128
		panelVLayout.addComponent(button);
129
		panelVLayout.setComponentAlignment(button, new Alignment(48));
130
		
131
		return panelVLayout;
132
	}
133

    
134
}
    (1-1/1)