Revision 4a3c0817
Added by Andreas Kohlbecker almost 7 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/SpecimenTypeDesignationWorkingsetPopupEditor.java | ||
---|---|---|
11 | 11 |
import java.util.Collection; |
12 | 12 |
|
13 | 13 |
import org.springframework.security.core.GrantedAuthority; |
14 |
import org.vaadin.viritin.fields.ElementCollectionField; |
|
14 | 15 |
|
15 | 16 |
import com.vaadin.data.validator.DoubleRangeValidator; |
16 | 17 |
import com.vaadin.ui.AbstractSelect.ItemCaptionMode; |
18 |
import com.vaadin.ui.Component; |
|
17 | 19 |
import com.vaadin.ui.GridLayout; |
18 | 20 |
import com.vaadin.ui.ListSelect; |
21 |
import com.vaadin.ui.Panel; |
|
19 | 22 |
import com.vaadin.ui.TextArea; |
20 | 23 |
import com.vaadin.ui.TextField; |
21 | 24 |
|
... | ... | |
23 | 26 |
import eu.etaxonomy.cdm.vaadin.component.common.GeoLocationField; |
24 | 27 |
import eu.etaxonomy.cdm.vaadin.component.common.MinMaxTextField; |
25 | 28 |
import eu.etaxonomy.cdm.vaadin.component.common.TeamOrPersonField; |
29 |
import eu.etaxonomy.cdm.vaadin.model.registration.SpecimenTypeDesignationDTO; |
|
26 | 30 |
import eu.etaxonomy.cdm.vaadin.model.registration.SpecimenTypeDesignationWorkingSetDTO; |
27 | 31 |
import eu.etaxonomy.cdm.vaadin.security.AccessRestrictedView; |
28 | 32 |
import eu.etaxonomy.vaadin.mvp.AbstractPopupEditor; |
... | ... | |
47 | 51 |
} |
48 | 52 |
|
49 | 53 |
private static final long serialVersionUID = 5418275817834009509L; |
54 |
|
|
50 | 55 |
private ListSelect countrySelectField; |
51 | 56 |
|
57 |
private ElementCollectionField<SpecimenTypeDesignationDTO> typeDesignationsCollectionField; |
|
52 | 58 |
|
53 | 59 |
/** |
54 | 60 |
* @return the countrySelectField |
... | ... | |
68 | 74 |
grid.setSpacing(true); |
69 | 75 |
grid.setMargin(true); |
70 | 76 |
grid.setColumns(3); |
71 |
grid.setRows(8);
|
|
72 |
//grid.setWidth("600px");
|
|
77 |
grid.setRows(9);
|
|
78 |
grid.setWidth("1200px");
|
|
73 | 79 |
|
74 | 80 |
//TODO typifyingAuthors |
75 | 81 |
|
... | ... | |
135 | 141 |
PartialDateField collectionDateField = new PartialDateField("Collection date"); |
136 | 142 |
addField(collectionDateField, "gatheringDate", 0, row); |
137 | 143 |
TextField fieldNumberField = addTextField("Field number", "fieldNumber", 2, row); |
144 |
|
|
145 |
row++; |
|
146 |
|
|
147 |
// FIXME: can we use the Grid instaed? |
|
148 |
typeDesignationsCollectionField = new ElementCollectionField<>( |
|
149 |
SpecimenTypeDesignationDTO.class, |
|
150 |
SpecimenTypeDesignationDTORow.class |
|
151 |
); |
|
152 |
typeDesignationsCollectionField.withCaption("Types"); |
|
153 |
typeDesignationsCollectionField.getLayout().setSpacing(false); |
|
154 |
typeDesignationsCollectionField.getLayout().setColumns(3); |
|
155 |
|
|
156 |
typeDesignationsCollectionField.setPropertyHeader("accessionNumber", "Access. num."); |
|
157 |
typeDesignationsCollectionField.setPropertyHeader("mediaSpecimenReference", "Image reference"); |
|
158 |
typeDesignationsCollectionField.setPropertyHeader("mediaSpecimenReferenceDetail", "Reference detail"); |
|
159 |
|
|
160 |
// typeDesignationsCollectionField.getLayout().setMargin(false); |
|
161 |
// typeDesignationsCollectionField.addStyleName("composite-field-wrapper"); |
|
162 |
// addField(typeDesignationsCollectionField, "specimenTypeDesignationDTOs", 0, row, 2, row); |
|
163 |
|
|
164 |
Panel scrollPanel = new Panel(typeDesignationsCollectionField.getLayout()); |
|
165 |
scrollPanel.setCaption("Types"); |
|
166 |
scrollPanel.setWidth(800, Unit.PIXELS); |
|
167 |
|
|
168 |
bindField(typeDesignationsCollectionField, "specimenTypeDesignationDTOs"); |
|
169 |
addComponent(scrollPanel, 0, row, 2, row); |
|
170 |
|
|
138 | 171 |
} |
139 | 172 |
|
140 | 173 |
|
... | ... | |
187 | 220 |
} |
188 | 221 |
|
189 | 222 |
|
223 |
// ------- SpecimenTypeDesignationWorkingsetPopupEditorView methods ---- // |
|
224 |
@Override |
|
225 |
public ElementCollectionField<SpecimenTypeDesignationDTO> getTypeDesignationsCollectionField() { |
|
226 |
return typeDesignationsCollectionField; |
|
227 |
} |
|
228 |
|
|
229 |
@Override |
|
230 |
public void applyDefaultComponentStyle(Component ... components){ |
|
231 |
for(int i = 0; i <components.length; i++){ |
|
232 |
components[i].setStyleName(getDefaultComponentStyles()); |
|
233 |
} |
|
234 |
} |
|
235 |
|
|
236 |
|
|
237 |
|
|
190 | 238 |
|
191 | 239 |
} |
Also available in: Unified diff
ref #6724 SpecimenTypeDesignationWorkingsetEditor with Types sub section for contained SpecimenTypeDesignation