1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2015 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
package eu.etaxonomy.cdm.vaadin.component;
|
11
|
|
12
|
import com.vaadin.annotations.AutoGenerated;
|
13
|
import com.vaadin.data.Container;
|
14
|
import com.vaadin.ui.AbsoluteLayout;
|
15
|
import com.vaadin.ui.Button;
|
16
|
import com.vaadin.ui.ComboBox;
|
17
|
import com.vaadin.ui.CustomComponent;
|
18
|
import com.vaadin.ui.Label;
|
19
|
import com.vaadin.ui.TwinColSelect;
|
20
|
import com.vaadin.ui.Window;
|
21
|
|
22
|
import eu.etaxonomy.cdm.model.common.TermVocabulary;
|
23
|
import eu.etaxonomy.cdm.vaadin.presenter.dbstatus.settings.SettingsPresenter;
|
24
|
|
25
|
/**
|
26
|
* @author alex
|
27
|
* @date 22.04.2015
|
28
|
*
|
29
|
*/
|
30
|
public class ConfigWindow extends CustomComponent {
|
31
|
|
32
|
/*- VaadinEditorProperties={"grid":"RegularGrid,20","showGrid":true,"snapToGrid":true,"snapToObject":true,"movingGuides":false,"snappingDistance":10} */
|
33
|
|
34
|
@AutoGenerated
|
35
|
private AbsoluteLayout mainLayout;
|
36
|
@AutoGenerated
|
37
|
private Label label_4;
|
38
|
@AutoGenerated
|
39
|
private TwinColSelect distStatusSelect;
|
40
|
@AutoGenerated
|
41
|
private Label label_3;
|
42
|
@AutoGenerated
|
43
|
private Label label_2;
|
44
|
@AutoGenerated
|
45
|
private ComboBox distAreaBox;
|
46
|
@AutoGenerated
|
47
|
private ComboBox classificationBox;
|
48
|
@AutoGenerated
|
49
|
private Button okButton;
|
50
|
@AutoGenerated
|
51
|
private Button cancelButton;
|
52
|
@AutoGenerated
|
53
|
private Label label_1;
|
54
|
private final SettingsPresenter presenter;
|
55
|
/**
|
56
|
* The constructor should first build the main layout, set the
|
57
|
* composition root and then do any custom initialization.
|
58
|
*
|
59
|
* The constructor will not be automatically regenerated by the
|
60
|
* visual editor.
|
61
|
*/
|
62
|
public ConfigWindow() {
|
63
|
buildMainLayout();
|
64
|
// setCompositionRoot(mainLayout);
|
65
|
presenter = new SettingsPresenter();
|
66
|
init();
|
67
|
}
|
68
|
|
69
|
/**
|
70
|
*
|
71
|
*/
|
72
|
private void init() {
|
73
|
Container classificationContainer = presenter.getClassificationContainer();
|
74
|
Container distributionContainer = presenter.getDistributionContainer();
|
75
|
TermVocabulary chosenArea = presenter.getChosenArea();
|
76
|
classificationBox.setContainerDataSource(classificationContainer);
|
77
|
classificationBox.setValue(presenter.getChosenClassification());
|
78
|
distAreaBox.setContainerDataSource(distributionContainer);
|
79
|
distAreaBox.setValue(chosenArea);
|
80
|
distStatusSelect.setContainerDataSource(presenter.getDistributionStatusContainer());
|
81
|
}
|
82
|
|
83
|
public Window createWindow(){
|
84
|
Window window = new Window();
|
85
|
window.setModal(true);
|
86
|
window.setHeight("600px");
|
87
|
window.setWidth("500px");
|
88
|
window.setCaption("Settings");
|
89
|
window.setContent(mainLayout);
|
90
|
return window;
|
91
|
}
|
92
|
|
93
|
@AutoGenerated
|
94
|
private AbsoluteLayout buildMainLayout() {
|
95
|
// common part: create layout
|
96
|
mainLayout = new AbsoluteLayout();
|
97
|
mainLayout.setImmediate(false);
|
98
|
mainLayout.setWidth("100%");
|
99
|
mainLayout.setHeight("100%");
|
100
|
|
101
|
// top-level component properties
|
102
|
setWidth("100.0%");
|
103
|
setHeight("100.0%");
|
104
|
|
105
|
// label_1
|
106
|
label_1 = new Label();
|
107
|
label_1.setImmediate(false);
|
108
|
label_1.setWidth("100.0%");
|
109
|
label_1.setHeight("40px");
|
110
|
label_1.setValue("This is a description box for my settings");
|
111
|
mainLayout.addComponent(label_1, "top:0.0px;left:0.0px;");
|
112
|
|
113
|
// cancelButton
|
114
|
cancelButton = new Button();
|
115
|
cancelButton.setCaption("Cancel");
|
116
|
cancelButton.setImmediate(true);
|
117
|
cancelButton.setWidth("-1px");
|
118
|
cancelButton.setHeight("-1px");
|
119
|
mainLayout.addComponent(cancelButton, "top:380.0px;left:273.0px;");
|
120
|
|
121
|
// okButton
|
122
|
okButton = new Button();
|
123
|
okButton.setCaption("OK");
|
124
|
okButton.setImmediate(true);
|
125
|
okButton.setWidth("67px");
|
126
|
okButton.setHeight("-1px");
|
127
|
mainLayout.addComponent(okButton, "top:380.0px;left:364.0px;");
|
128
|
|
129
|
// classificationBox
|
130
|
classificationBox = new ComboBox();
|
131
|
classificationBox.setImmediate(false);
|
132
|
classificationBox.setWidth("-1px");
|
133
|
classificationBox.setHeight("-1px");
|
134
|
mainLayout.addComponent(classificationBox, "top:97.0px;left:258.0px;");
|
135
|
|
136
|
// distAreaBox
|
137
|
distAreaBox = new ComboBox();
|
138
|
distAreaBox.setImmediate(false);
|
139
|
distAreaBox.setWidth("-1px");
|
140
|
distAreaBox.setHeight("-1px");
|
141
|
mainLayout.addComponent(distAreaBox, "top:141.0px;left:258.0px;");
|
142
|
|
143
|
// label_2
|
144
|
label_2 = new Label();
|
145
|
label_2.setImmediate(false);
|
146
|
label_2.setWidth("-1px");
|
147
|
label_2.setHeight("-1px");
|
148
|
label_2.setValue("Classification:");
|
149
|
mainLayout.addComponent(label_2, "top:97.0px;left:24.0px;");
|
150
|
|
151
|
// label_3
|
152
|
label_3 = new Label();
|
153
|
label_3.setImmediate(false);
|
154
|
label_3.setWidth("-1px");
|
155
|
label_3.setHeight("-1px");
|
156
|
label_3.setValue("Distribution Area:");
|
157
|
mainLayout.addComponent(label_3, "top:141.0px;left:24.0px;");
|
158
|
|
159
|
// distStatusSelect
|
160
|
distStatusSelect = new TwinColSelect();
|
161
|
distStatusSelect.setImmediate(false);
|
162
|
distStatusSelect.setWidth("-1px");
|
163
|
distStatusSelect.setHeight("-1px");
|
164
|
mainLayout.addComponent(distStatusSelect, "top:188.0px;left:152.0px;");
|
165
|
|
166
|
// label_4
|
167
|
label_4 = new Label();
|
168
|
label_4.setImmediate(false);
|
169
|
label_4.setWidth("-1px");
|
170
|
label_4.setHeight("-1px");
|
171
|
label_4.setValue("Distribution Status:");
|
172
|
mainLayout.addComponent(label_4, "top:202.0px;left:20.0px;");
|
173
|
|
174
|
return mainLayout;
|
175
|
}
|
176
|
|
177
|
}
|