Revision 08f24060
Added by Andreas Kohlbecker about 7 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/view/phycobank/ListViewBean.java | ||
---|---|---|
18 | 18 |
import com.vaadin.data.util.PropertyValueGenerator; |
19 | 19 |
import com.vaadin.navigator.View; |
20 | 20 |
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; |
21 |
import com.vaadin.shared.ui.MarginInfo; |
|
22 | 21 |
import com.vaadin.shared.ui.grid.HeightMode; |
23 | 22 |
import com.vaadin.spring.annotation.SpringView; |
24 |
import com.vaadin.ui.Alignment; |
|
25 | 23 |
import com.vaadin.ui.Component; |
24 |
import com.vaadin.ui.CssLayout; |
|
26 | 25 |
import com.vaadin.ui.Grid; |
27 | 26 |
import com.vaadin.ui.Grid.Column; |
28 | 27 |
import com.vaadin.ui.Grid.SelectionMode; |
29 |
import com.vaadin.ui.Label; |
|
30 |
import com.vaadin.ui.Panel; |
|
31 |
import com.vaadin.ui.VerticalLayout; |
|
32 | 28 |
import com.vaadin.ui.renderers.ButtonRenderer; |
33 | 29 |
import com.vaadin.ui.renderers.DateRenderer; |
34 | 30 |
import com.vaadin.ui.renderers.HtmlRenderer; |
35 |
import com.vaadin.ui.themes.ValoTheme; |
|
36 | 31 |
|
37 | 32 |
import eu.etaxonomy.cdm.vaadin.component.phycobank.RegistrationItem; |
38 | 33 |
import eu.etaxonomy.cdm.vaadin.presenter.phycobank.ListPresenter; |
39 | 34 |
import eu.etaxonomy.cdm.vaadin.presenter.phycobank.RegistrationDTO; |
40 | 35 |
import eu.etaxonomy.cdm.vaadin.util.JodaDateTimeConverter; |
41 | 36 |
import eu.etaxonomy.cdm.vaadin.util.UrlStringConverter; |
42 |
import eu.etaxonomy.vaadin.mvp.AbstractView;
|
|
37 |
import eu.etaxonomy.cdm.vaadin.view.AbstractPageView;
|
|
43 | 38 |
import eu.etaxonomy.vaadin.ui.navigation.NavigationEvent; |
44 | 39 |
|
45 | 40 |
/** |
... | ... | |
48 | 43 |
* |
49 | 44 |
*/ |
50 | 45 |
@SpringView(name=ListViewBean.NAME) |
51 |
public class ListViewBean extends AbstractView<ListPresenter> implements ListView, View { |
|
46 |
public class ListViewBean extends AbstractPageView<ListPresenter> implements ListView, View {
|
|
52 | 47 |
|
53 | 48 |
private static final long serialVersionUID = 3543300933072824713L; |
54 | 49 |
|
55 | 50 |
public static final String NAME = "list"; |
56 | 51 |
|
57 |
private VerticalLayout layout;
|
|
52 |
CssLayout listContainer;
|
|
58 | 53 |
|
59 | 54 |
private Grid grid; |
60 | 55 |
|
61 |
private Panel panel; |
|
62 |
|
|
63 | 56 |
public ListViewBean() { |
64 |
layout = new VerticalLayout(); |
|
65 |
layout.setSpacing(true); |
|
66 |
layout.setSizeFull(); |
|
67 | 57 |
|
68 |
Label title = new Label("Registrations"); |
|
69 |
title.setStyleName(ValoTheme.LABEL_HUGE); |
|
70 |
title.setWidthUndefined(); |
|
71 |
layout.addComponent(title); |
|
72 |
layout.setComponentAlignment(title, Alignment.TOP_CENTER); |
|
58 |
super(); |
|
73 | 59 |
|
74 |
Label hint = new Label("This is the list of all your registrations in progress."); |
|
75 |
hint.setWidthUndefined(); |
|
76 |
layout.addComponent(hint); |
|
77 |
layout.setComponentAlignment(hint, Alignment.MIDDLE_CENTER); |
|
60 |
CssLayout toolBar = new CssLayout(); |
|
61 |
// toolBar.addComponent(new Button); |
|
78 | 62 |
|
79 | 63 |
// grid = buildGrid(); |
80 | 64 |
// layout.addComponent(grid); |
81 | 65 |
// layout.setExpandRatio(grid, 1); |
82 | 66 |
|
83 |
buildPanel(); |
|
67 |
listContainer = new CssLayout(); |
|
68 |
listContainer.setId("registration-list"); |
|
69 |
listContainer.setWidth(100, Unit.PERCENTAGE); |
|
70 |
listContainer.setHeight(100, Unit.PERCENTAGE); |
|
71 |
|
|
72 |
getLayout().addComponent(listContainer); |
|
84 | 73 |
|
85 |
setCompositionRoot(layout); |
|
86 |
this.setSizeFull(); |
|
87 | 74 |
} |
88 | 75 |
|
89 |
/** |
|
90 |
* |
|
91 |
*/ |
|
92 |
private void buildPanel() { |
|
93 |
panel = new Panel(); |
|
94 |
panel.setSizeFull(); |
|
95 |
panel.setId("registration-list"); |
|
96 |
layout.addComponent(panel); |
|
97 |
layout.setExpandRatio(panel, 1); |
|
76 |
@Override |
|
77 |
protected String getHeaderText() { |
|
78 |
return "Registrations"; |
|
79 |
} |
|
80 |
|
|
81 |
@Override |
|
82 |
protected String getSubHeaderText() { |
|
83 |
return "This is the list of all your registrations in progress."; |
|
98 | 84 |
} |
99 | 85 |
|
100 | 86 |
private Grid buildGrid() { |
... | ... | |
189 | 175 |
*/ |
190 | 176 |
@Override |
191 | 177 |
public void populateList(Collection<RegistrationDTO> registrations) { |
192 |
VerticalLayout list = new VerticalLayout(); |
|
193 |
list.setMargin(new MarginInfo(false, true)); |
|
194 |
list.setSpacing(true); |
|
178 |
|
|
195 | 179 |
for(RegistrationDTO regDto : registrations) { |
196 | 180 |
|
197 | 181 |
Component lazyItem = new RegistrationItem(regDto, this); //new LazyLoadWrapper(new RegistrationItem(regDto, this)); |
198 |
list.addComponent(lazyItem); |
|
182 |
lazyItem.setWidth(100, Unit.PERCENTAGE); |
|
183 |
listContainer.addComponent(lazyItem); |
|
199 | 184 |
// if(list.getComponentCount() > 10){ |
200 | 185 |
// break; |
201 | 186 |
// } |
202 | 187 |
} |
203 |
panel.setContent(list);
|
|
188 |
// panel.setContent(listContainer);
|
|
204 | 189 |
|
205 | 190 |
} |
206 | 191 |
|
Also available in: Unified diff
ref #6169 abstract page view having header and sub-header