1
|
/**
|
2
|
* Copyright (C) 2018 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.vaadin.component;
|
10
|
|
11
|
import org.vaadin.viritin.fields.CaptionGenerator;
|
12
|
import org.vaadin.viritin.fields.LazyComboBox.FilterableCountProvider;
|
13
|
import org.vaadin.viritin.fields.LazyComboBox.FilterablePagingProvider;
|
14
|
|
15
|
import eu.etaxonomy.cdm.model.name.TaxonName;
|
16
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
17
|
import eu.etaxonomy.cdm.vaadin.model.name.NameRelationshipDTO;
|
18
|
import eu.etaxonomy.cdm.vaadin.view.name.CachingPresenter;
|
19
|
|
20
|
/**
|
21
|
* @author a.kohlbecker
|
22
|
* @since May 3, 2018
|
23
|
*
|
24
|
*/
|
25
|
public class NameRelationsListEditor extends ToManyRelatedEntitiesListSelect<NameRelationshipDTO, NameRelationField> {
|
26
|
|
27
|
private static final long serialVersionUID = 6295557881702890211L;
|
28
|
|
29
|
private ReloadableLazyComboBoxInstantiator<TaxonName> nameSelectInstantiator;
|
30
|
|
31
|
private ReloadableLazyComboBoxInstantiator<Reference> referenceSelectInstantiator;
|
32
|
|
33
|
/**
|
34
|
* @param itemType
|
35
|
* @param caption
|
36
|
*/
|
37
|
public NameRelationsListEditor(String caption) {
|
38
|
super(NameRelationshipDTO.class, null, caption);
|
39
|
this.fieldType = NameRelationField.class;
|
40
|
// addEmptyRowOnInitContent is false in this class since adding row is only possible after setting the PagingProviders
|
41
|
addEmptyRowOnInitContent = false;
|
42
|
nameSelectInstantiator = new ReloadableLazyComboBoxInstantiator<TaxonName>(TaxonName.class);
|
43
|
referenceSelectInstantiator = new ReloadableLazyComboBoxInstantiator<Reference>(Reference.class);
|
44
|
}
|
45
|
|
46
|
/**
|
47
|
* {@inheritDoc}
|
48
|
*/
|
49
|
// @Override
|
50
|
// protected NameRelationField newFieldInstance(NameRelationshipDTO val) throws InstantiationException, IllegalAccessException {
|
51
|
//
|
52
|
// NameRelationField field = new NameRelationField(nameSelectInstantiator, referenceSelectInstantiator, val);
|
53
|
// field.setWidth(100, Unit.PERCENTAGE);
|
54
|
// return field;
|
55
|
// }
|
56
|
|
57
|
public void setTaxonNamePagingProviders(FilterablePagingProvider<TaxonName> filterablePagingProvider, FilterableCountProvider filterableCountProvider, int pageLength,
|
58
|
CachingPresenter cachingPresenter){
|
59
|
nameSelectInstantiator.setPagingProviders(filterablePagingProvider, filterableCountProvider, pageLength, cachingPresenter);
|
60
|
setInternalValue(null);
|
61
|
}
|
62
|
|
63
|
/**
|
64
|
* @param cdmTitleCacheCaptionGenerator
|
65
|
*/
|
66
|
public void setTaxonNameCaptionGenerator(CaptionGenerator<TaxonName> captionGenerator) {
|
67
|
nameSelectInstantiator.setCaptionGenerator(captionGenerator);
|
68
|
}
|
69
|
|
70
|
public void setReferencePagingProviders(FilterablePagingProvider<Reference> filterablePagingProvider, FilterableCountProvider filterableCountProvider, int pageLength,
|
71
|
CachingPresenter cachingPresenter){
|
72
|
referenceSelectInstantiator.setPagingProviders(filterablePagingProvider, filterableCountProvider, pageLength, cachingPresenter);
|
73
|
setInternalValue(null);
|
74
|
}
|
75
|
|
76
|
/**
|
77
|
* @param cdmTitleCacheCaptionGenerator
|
78
|
*/
|
79
|
public void setReferenceCaptionGenerator(CaptionGenerator<Reference> captionGenerator) {
|
80
|
referenceSelectInstantiator.setCaptionGenerator(captionGenerator);
|
81
|
}
|
82
|
|
83
|
|
84
|
}
|