1 | /* |
---|
2 | * Copyright (C) 2014 CLARIN |
---|
3 | * |
---|
4 | * This program is free software: you can redistribute it and/or modify |
---|
5 | * it under the terms of the GNU General Public License as published by |
---|
6 | * the Free Software Foundation, either version 3 of the License, or |
---|
7 | * (at your option) any later version. |
---|
8 | * |
---|
9 | * This program is distributed in the hope that it will be useful, |
---|
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
12 | * GNU General Public License for more details. |
---|
13 | * |
---|
14 | * You should have received a copy of the GNU General Public License |
---|
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
16 | */ |
---|
17 | package eu.clarin.cmdi.vlo.wicket.components; |
---|
18 | |
---|
19 | import eu.clarin.cmdi.vlo.pojo.DocumentField; |
---|
20 | import org.apache.wicket.markup.html.basic.Label; |
---|
21 | import org.apache.wicket.markup.html.list.ListItem; |
---|
22 | import org.apache.wicket.markup.html.list.ListView; |
---|
23 | import org.apache.wicket.markup.html.panel.Panel; |
---|
24 | import org.apache.wicket.markup.repeater.Item; |
---|
25 | import org.apache.wicket.markup.repeater.data.DataView; |
---|
26 | import org.apache.wicket.markup.repeater.data.IDataProvider; |
---|
27 | import org.apache.wicket.model.IModel; |
---|
28 | import org.apache.wicket.model.PropertyModel; |
---|
29 | |
---|
30 | /** |
---|
31 | * |
---|
32 | * @author twagoo |
---|
33 | */ |
---|
34 | public class FieldsTablePanel extends Panel { |
---|
35 | |
---|
36 | public FieldsTablePanel(String id, IDataProvider<DocumentField> fieldProvider) { |
---|
37 | super(id); |
---|
38 | add(new DataView<DocumentField>("documentField", fieldProvider) { |
---|
39 | |
---|
40 | @Override |
---|
41 | protected void populateItem(Item<DocumentField> item) { |
---|
42 | final IModel<DocumentField> fieldModel = item.getModel(); |
---|
43 | item.add(new Label("fieldName", new PropertyModel(fieldModel, "fieldName"))); |
---|
44 | item.add(new ListView("values", new PropertyModel(fieldModel, "values")) { |
---|
45 | |
---|
46 | @Override |
---|
47 | protected void populateItem(ListItem item) { |
---|
48 | item.add(new Label("value", item.getModel())); |
---|
49 | } |
---|
50 | }); |
---|
51 | } |
---|
52 | }); |
---|
53 | } |
---|
54 | |
---|
55 | } |
---|