Revision cfabbeb0
Added by Andreas Kohlbecker almost 7 years ago
src/main/java/eu/etaxonomy/cdm/service/CdmFilterablePagingProvider.java | ||
---|---|---|
29 | 29 |
|
30 | 30 |
private int pageSize = 20; |
31 | 31 |
|
32 |
private IIdentifiableEntityService<T> service;
|
|
32 |
protected IIdentifiableEntityService<T> service;
|
|
33 | 33 |
|
34 | 34 |
private MatchMode matchMode = MatchMode.ANYWHERE; |
35 | 35 |
|
... | ... | |
65 | 65 |
} |
66 | 66 |
|
67 | 67 |
/** |
68 |
* With defaults for matchMode = MatchMode.ANYWHERE and orderHints = OrderHint.ORDER_BY_TITLE_CACHE |
|
69 |
* |
|
68 | 70 |
* @param service |
69 | 71 |
*/ |
70 | 72 |
public CdmFilterablePagingProvider(IIdentifiableEntityService<T> service) { |
src/main/java/eu/etaxonomy/cdm/vaadin/component/SelectFieldFactory.java | ||
---|---|---|
11 | 11 |
import java.util.ArrayList; |
12 | 12 |
import java.util.Arrays; |
13 | 13 |
import java.util.List; |
14 |
import java.util.UUID; |
|
14 | 15 |
|
15 | 16 |
import org.springframework.beans.factory.annotation.Autowired; |
16 | 17 |
import org.springframework.beans.factory.annotation.Qualifier; |
... | ... | |
20 | 21 |
import com.vaadin.ui.ListSelect; |
21 | 22 |
|
22 | 23 |
import eu.etaxonomy.cdm.api.application.CdmRepository; |
24 |
import eu.etaxonomy.cdm.api.service.pager.Pager; |
|
23 | 25 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
24 | 26 |
import eu.etaxonomy.cdm.model.common.DefinedTermBase; |
25 | 27 |
import eu.etaxonomy.cdm.model.common.TermType; |
28 |
import eu.etaxonomy.cdm.model.common.TermVocabulary; |
|
26 | 29 |
import eu.etaxonomy.cdm.persistence.query.OrderHint; |
27 |
import eu.etaxonomy.vaadin.component.ToOneRelatedEntityListSelect; |
|
28 | 30 |
|
29 | 31 |
/** |
30 | 32 |
* @author a.kohlbecker |
... | ... | |
47 | 49 |
orderHints.add(OrderHint.ORDER_BY_TITLE_CACHE); |
48 | 50 |
} |
49 | 51 |
|
52 |
/** |
|
53 |
* Constructor for the Spring Bean Factory |
|
54 |
*/ |
|
55 |
public SelectFieldFactory(){ |
|
56 |
this.repo = null; |
|
57 |
} |
|
58 |
|
|
59 |
/** |
|
60 |
* Constructor to be used by presenter classes directly |
|
61 |
* |
|
62 |
* @param repo |
|
63 |
*/ |
|
64 |
public SelectFieldFactory(CdmRepository repo){ |
|
65 |
this.repo = repo; |
|
66 |
} |
|
67 |
|
|
50 | 68 |
public ListSelect createListSelect(String caption, TermType termType){ |
51 | 69 |
BeanItemContainer<DefinedTermBase> termItemContainer = buildBeanItemContainer(termType); |
52 | 70 |
ListSelect select = new ListSelect(caption, termItemContainer); |
... | ... | |
96 | 114 |
return select; |
97 | 115 |
} |
98 | 116 |
|
99 |
/** |
|
100 |
* |
|
101 |
* @param caption |
|
102 |
* @param type |
|
103 |
* @param orderHints |
|
104 |
* @param propertyId the property id from which to read the label |
|
105 |
* @return |
|
106 |
*/ |
|
107 |
public <T extends CdmBase> ToOneRelatedEntityListSelect<T> createListSelectEditor(String caption, Class<T> type, List<OrderHint> orderHints, String propertyId){ |
|
108 |
|
|
109 |
if(orderHints == null){ |
|
110 |
orderHints = OrderHint.defaultOrderHintsFor(type); |
|
111 |
} |
|
112 |
|
|
113 |
BeanItemContainer<T> termItemContainer = buildBeanItemContainer(type, orderHints); |
|
114 |
ToOneRelatedEntityListSelect<T> selectEditor = new ToOneRelatedEntityListSelect<T>(caption, type, termItemContainer); |
|
115 |
|
|
116 |
// guess property id to use for display |
|
117 |
if(propertyId == null) { |
|
118 |
if(orderHints != null && !orderHints.isEmpty()){ |
|
119 |
propertyId = orderHints.get(0).getPropertyName(); |
|
120 |
} |
|
121 |
} |
|
122 |
if(propertyId != null){ |
|
123 |
selectEditor.getSelect().setItemCaptionPropertyId(propertyId); |
|
124 |
} |
|
125 |
return selectEditor; |
|
126 |
} |
|
127 |
|
|
128 | 117 |
|
129 | 118 |
/** |
130 | 119 |
* @param termType |
131 | 120 |
*/ |
132 |
private BeanItemContainer<DefinedTermBase> buildBeanItemContainer(TermType termType) {
|
|
121 |
public BeanItemContainer<DefinedTermBase> buildBeanItemContainer(TermType termType) {
|
|
133 | 122 |
// TODO use TermCacher? |
134 | 123 |
List<DefinedTermBase> terms = repo.getTermService().listByTermType(termType, null, null, orderHints, INIT_STRATEGY); |
135 | 124 |
BeanItemContainer<DefinedTermBase> termItemContainer = new BeanItemContainer<>(DefinedTermBase.class); |
... | ... | |
140 | 129 |
/** |
141 | 130 |
* @param termType |
142 | 131 |
*/ |
143 |
private <T extends CdmBase> BeanItemContainer<T> buildBeanItemContainer(Class<T> type, List<OrderHint> orderHints) { |
|
132 |
public BeanItemContainer<DefinedTermBase> buildBeanItemContainer(UUID vocabularyUuid) { |
|
133 |
|
|
134 |
TermVocabulary vocab = repo.getVocabularyService().find(vocabularyUuid); |
|
135 |
Pager<DefinedTermBase> terms = repo.getVocabularyService().getTerms(vocab, null, null, orderHints, INIT_STRATEGY); |
|
136 |
BeanItemContainer<DefinedTermBase> termItemContainer = new BeanItemContainer<>(DefinedTermBase.class); |
|
137 |
termItemContainer.addAll(terms.getRecords()); |
|
138 |
return termItemContainer; |
|
139 |
} |
|
140 |
|
|
141 |
/** |
|
142 |
* @param termType |
|
143 |
*/ |
|
144 |
public <T extends CdmBase> BeanItemContainer<T> buildBeanItemContainer(Class<T> type, List<OrderHint> orderHints) { |
|
144 | 145 |
|
145 | 146 |
List<T> terms = repo.getCommonService().list(type, (Integer)null, (Integer)null, |
146 | 147 |
orderHints, |
src/main/java/eu/etaxonomy/cdm/vaadin/component/common/MinMaxTextField.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2017 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.cdm.vaadin.component.common; |
|
10 |
|
|
11 |
import org.apache.commons.lang.StringUtils; |
|
12 |
|
|
13 |
import com.vaadin.ui.HorizontalLayout; |
|
14 |
import com.vaadin.ui.TextField; |
|
15 |
|
|
16 |
/** |
|
17 |
* @author a.kohlbecker |
|
18 |
* @since Jun 22, 2017 |
|
19 |
* |
|
20 |
*/ |
|
21 |
public class MinMaxTextField extends HorizontalLayout { |
|
22 |
|
|
23 |
/** |
|
24 |
* |
|
25 |
*/ |
|
26 |
private static final String PRIMARY_STYLE = "v-min-max-text-field"; |
|
27 |
|
|
28 |
private static final long serialVersionUID = -6690659776664579698L; |
|
29 |
|
|
30 |
TextField minField, textField; |
|
31 |
MaxTextField maxField; |
|
32 |
|
|
33 |
String unitOfMeasure; |
|
34 |
|
|
35 |
public MinMaxTextField(String caption, String unitOfMeasure){ |
|
36 |
|
|
37 |
this.unitOfMeasure = unitOfMeasure; |
|
38 |
|
|
39 |
setCaption(caption); |
|
40 |
setPrimaryStyleName(PRIMARY_STYLE); |
|
41 |
|
|
42 |
initFields(unitOfMeasure); |
|
43 |
|
|
44 |
} |
|
45 |
|
|
46 |
/** |
|
47 |
* @param unitOfMeasure |
|
48 |
*/ |
|
49 |
protected void initFields(String unitOfMeasure) { |
|
50 |
textField = new TextField("free text"); |
|
51 |
maxField = new MaxTextField(String.format("min (%s)", unitOfMeasure)); |
|
52 |
minField = new TextField(String.format("min (%s)", unitOfMeasure)) { |
|
53 |
|
|
54 |
private static final long serialVersionUID = -536012841624056585L; |
|
55 |
|
|
56 |
/** |
|
57 |
* {@inheritDoc} |
|
58 |
*/ |
|
59 |
@Override |
|
60 |
protected void setInternalValue(String newValue) { |
|
61 |
super.setInternalValue(newValue); |
|
62 |
updateMaxFieldEnablement(); |
|
63 |
} |
|
64 |
|
|
65 |
}; |
|
66 |
|
|
67 |
minField.setWidth("100px"); |
|
68 |
maxField.setWidth("100px"); |
|
69 |
textField.setWidth("100%"); |
|
70 |
|
|
71 |
addComponents(minField, maxField, textField); |
|
72 |
|
|
73 |
setExpandRatio(textField, 1); |
|
74 |
|
|
75 |
minField.addValueChangeListener(e -> updateMaxFieldEnablement()); |
|
76 |
maxField.setEnabled(false); |
|
77 |
} |
|
78 |
|
|
79 |
public void updateMaxFieldEnablement(){ |
|
80 |
if(maxField != null && minField != null){ |
|
81 |
boolean enabled = !StringUtils.isEmpty(minField.getValue()); |
|
82 |
maxField.setSuperEnabled(enabled); |
|
83 |
} |
|
84 |
} |
|
85 |
|
|
86 |
/** |
|
87 |
* @return the minField |
|
88 |
*/ |
|
89 |
public TextField getMinField() { |
|
90 |
return minField; |
|
91 |
} |
|
92 |
|
|
93 |
/** |
|
94 |
* @return the maxField |
|
95 |
*/ |
|
96 |
public TextField getMaxField() { |
|
97 |
return maxField; |
|
98 |
} |
|
99 |
|
|
100 |
/** |
|
101 |
* @return the textField |
|
102 |
*/ |
|
103 |
public TextField getTextField() { |
|
104 |
return textField; |
|
105 |
} |
|
106 |
|
|
107 |
/** |
|
108 |
* @return the unitOfMeasure |
|
109 |
*/ |
|
110 |
public String getUnitOfMeasure() { |
|
111 |
return unitOfMeasure; |
|
112 |
} |
|
113 |
|
|
114 |
public void addSubComponentsStyleName(String style) { |
|
115 |
minField.addStyleName(style); |
|
116 |
maxField.addStyleName(style); |
|
117 |
textField.addStyleName(style); |
|
118 |
} |
|
119 |
|
|
120 |
/** |
|
121 |
* {@inheritDoc} |
|
122 |
*/ |
|
123 |
@Override |
|
124 |
public void setEnabled(boolean enabled) { |
|
125 |
// TODO Auto-generated method stub |
|
126 |
super.setEnabled(enabled); |
|
127 |
} |
|
128 |
|
|
129 |
class MaxTextField extends TextField { |
|
130 |
|
|
131 |
private static final long serialVersionUID = -536012841624056585L; |
|
132 |
|
|
133 |
|
|
134 |
|
|
135 |
/** |
|
136 |
* @param caption |
|
137 |
*/ |
|
138 |
public MaxTextField(String caption) { |
|
139 |
super(caption); |
|
140 |
} |
|
141 |
|
|
142 |
/** |
|
143 |
* {@inheritDoc} |
|
144 |
*/ |
|
145 |
@Override |
|
146 |
protected void setInternalValue(String newValue) { |
|
147 |
super.setInternalValue(newValue); |
|
148 |
updateMaxFieldEnablement(); |
|
149 |
} |
|
150 |
|
|
151 |
/** |
|
152 |
* {@inheritDoc} |
|
153 |
*/ |
|
154 |
@Override |
|
155 |
public void setEnabled(boolean enabled) { |
|
156 |
updateMaxFieldEnablement(); |
|
157 |
} |
|
158 |
|
|
159 |
public void setSuperEnabled(boolean enabled) { |
|
160 |
super.setEnabled(enabled); |
|
161 |
} |
|
162 |
|
|
163 |
} |
|
164 |
|
|
165 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/model/registration/SpecimenTypeDesignationWorkingSetDTO.java | ||
---|---|---|
13 | 13 |
|
14 | 14 |
import org.joda.time.Partial; |
15 | 15 |
|
16 |
import eu.etaxonomy.cdm.model.agent.Person; |
|
16 |
import eu.etaxonomy.cdm.model.agent.AgentBase; |
|
17 |
import eu.etaxonomy.cdm.model.common.Language; |
|
17 | 18 |
import eu.etaxonomy.cdm.model.common.LanguageString; |
18 | 19 |
import eu.etaxonomy.cdm.model.common.VersionableEntity; |
19 | 20 |
import eu.etaxonomy.cdm.model.location.NamedArea; |
21 |
import eu.etaxonomy.cdm.model.location.Point; |
|
20 | 22 |
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation; |
21 | 23 |
import eu.etaxonomy.cdm.model.occurrence.FieldUnit; |
24 |
import eu.etaxonomy.cdm.model.occurrence.GatheringEvent; |
|
22 | 25 |
|
23 | 26 |
/** |
24 | 27 |
* @author a.kohlbecker |
... | ... | |
45 | 48 |
this.baseEntity = baseEntity; |
46 | 49 |
if(baseEntity instanceof FieldUnit){ |
47 | 50 |
this.fieldUnit = (FieldUnit) baseEntity; |
51 |
if(fieldUnit.getGatheringEvent() == null){ |
|
52 |
fieldUnit.setGatheringEvent(GatheringEvent.NewInstance()); |
|
53 |
} |
|
48 | 54 |
} |
49 | 55 |
this.specimenTypeDesignations = specimenTypeDesignations; |
50 | 56 |
} |
... | ... | |
85 | 91 |
} |
86 | 92 |
|
87 | 93 |
// ====== FieldUnit Wrapper methods ====== // |
88 |
public Person getPrimaryCollector() { |
|
89 |
return fieldUnit.getPrimaryCollector(); |
|
90 |
} |
|
94 |
|
|
91 | 95 |
|
92 | 96 |
public String getFieldNumber() { |
93 | 97 |
return fieldUnit.getFieldNumber(); |
... | ... | |
103 | 107 |
|
104 | 108 |
// ====== GateringEvent Wrapper methods ====== // |
105 | 109 |
|
106 |
public LanguageString getLocality(){ |
|
107 |
return fieldUnit.getGatheringEvent().getLocality(); |
|
110 |
public String getLocality(){ |
|
111 |
if(fieldUnit.getGatheringEvent().getLocality() != null){ |
|
112 |
return fieldUnit.getGatheringEvent().getLocality().getText(); |
|
113 |
} |
|
114 |
return null; |
|
108 | 115 |
} |
109 | 116 |
|
110 |
public void setLocality(LanguageString locality){ |
|
111 |
fieldUnit.getGatheringEvent().setLocality(locality); |
|
117 |
public void setLocality(String locality){ |
|
118 |
fieldUnit.getGatheringEvent().setLocality( |
|
119 |
LanguageString.NewInstance(locality, Language.DEFAULT()) |
|
120 |
); |
|
112 | 121 |
} |
113 | 122 |
public NamedArea getCountry() { |
114 | 123 |
return fieldUnit.getGatheringEvent().getCountry(); |
... | ... | |
118 | 127 |
fieldUnit.getGatheringEvent().setCountry(country); |
119 | 128 |
} |
120 | 129 |
|
130 |
public Point getExactLocation() { |
|
131 |
return fieldUnit.getGatheringEvent().getExactLocation(); |
|
132 |
} |
|
133 |
|
|
134 |
public void setExactLocation(Point exactLocation) { |
|
135 |
fieldUnit.getGatheringEvent().setExactLocation(exactLocation); |
|
136 |
} |
|
137 |
|
|
121 | 138 |
public Integer getAbsoluteElevation() { |
122 | 139 |
return fieldUnit.getGatheringEvent().getAbsoluteElevation(); |
123 | 140 |
} |
... | ... | |
187 | 204 |
return fieldUnit.getGatheringEvent().getDistanceToGroundText(); |
188 | 205 |
} |
189 | 206 |
|
207 |
public AgentBase getCollector(){ |
|
208 |
return fieldUnit.getGatheringEvent().getActor(); |
|
209 |
} |
|
210 |
|
|
211 |
public void setCollector(AgentBase collector){ |
|
212 |
fieldUnit.getGatheringEvent().setActor(collector); |
|
213 |
} |
|
214 |
|
|
190 | 215 |
public void setDistanceToGroundText(String distanceToGroundText) { |
191 | 216 |
fieldUnit.getGatheringEvent().setDistanceToWaterSurfaceText(distanceToGroundText); |
192 | 217 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/SpecimenTypeDesignationWorkingsetEditorPresenter.java | ||
---|---|---|
13 | 13 |
import org.hibernate.Session; |
14 | 14 |
|
15 | 15 |
import eu.etaxonomy.cdm.model.common.VersionableEntity; |
16 |
import eu.etaxonomy.cdm.model.location.Country; |
|
16 | 17 |
import eu.etaxonomy.cdm.model.name.Registration; |
17 | 18 |
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation; |
18 | 19 |
import eu.etaxonomy.cdm.model.name.TypeDesignationBase; |
... | ... | |
20 | 21 |
import eu.etaxonomy.cdm.model.occurrence.DerivationEventType; |
21 | 22 |
import eu.etaxonomy.cdm.model.occurrence.FieldUnit; |
22 | 23 |
import eu.etaxonomy.cdm.model.occurrence.GatheringEvent; |
24 |
import eu.etaxonomy.cdm.vaadin.component.SelectFieldFactory; |
|
23 | 25 |
import eu.etaxonomy.cdm.vaadin.model.TypedEntityReference; |
24 | 26 |
import eu.etaxonomy.cdm.vaadin.model.registration.SpecimenTypeDesignationWorkingSetDTO; |
25 | 27 |
import eu.etaxonomy.cdm.vaadin.view.registration.RegistrationDTO; |
... | ... | |
37 | 39 |
extends AbstractEditorPresenter<SpecimenTypeDesignationWorkingSetDTO , SpecimenTypeDesignationWorkingsetPopupEditorView> { |
38 | 40 |
|
39 | 41 |
private static final long serialVersionUID = 4255636253714476918L; |
40 |
private Registration registration; |
|
41 |
|
|
42 | 42 |
|
43 | 43 |
|
44 |
/** |
|
45 |
* {@inheritDoc} |
|
46 |
*/ |
|
47 |
@Override |
|
48 |
public void handleViewEntered() { |
|
49 |
SelectFieldFactory selectFactory = new SelectFieldFactory(getRepo()); |
|
50 |
getView().getCountrySelectField().setContainerDataSource(selectFactory.buildBeanItemContainer(Country.uuidCountryVocabulary)); |
|
51 |
} |
|
44 | 52 |
|
45 | 53 |
/** |
46 | 54 |
* {@inheritDoc} |
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/SpecimenTypeDesignationWorkingsetPopupEditor.java | ||
---|---|---|
12 | 12 |
|
13 | 13 |
import org.springframework.security.core.GrantedAuthority; |
14 | 14 |
|
15 |
import com.vaadin.data.validator.DoubleRangeValidator; |
|
16 |
import com.vaadin.ui.AbstractSelect.ItemCaptionMode; |
|
17 |
import com.vaadin.ui.Component; |
|
15 | 18 |
import com.vaadin.ui.GridLayout; |
19 |
import com.vaadin.ui.ListSelect; |
|
20 |
import com.vaadin.ui.TextArea; |
|
21 |
import com.vaadin.ui.TextField; |
|
16 | 22 |
|
23 |
import eu.etaxonomy.cdm.vaadin.component.PartialDateField; |
|
24 |
import eu.etaxonomy.cdm.vaadin.component.common.MinMaxTextField; |
|
25 |
import eu.etaxonomy.cdm.vaadin.component.common.TeamOrPersonField; |
|
17 | 26 |
import eu.etaxonomy.cdm.vaadin.model.registration.SpecimenTypeDesignationWorkingSetDTO; |
18 | 27 |
import eu.etaxonomy.cdm.vaadin.security.AccessRestrictedView; |
19 | 28 |
import eu.etaxonomy.vaadin.mvp.AbstractPopupEditor; |
... | ... | |
38 | 47 |
} |
39 | 48 |
|
40 | 49 |
private static final long serialVersionUID = 5418275817834009509L; |
50 |
private ListSelect countrySelectField; |
|
41 | 51 |
|
42 | 52 |
|
53 |
/** |
|
54 |
* @return the countrySelectField |
|
55 |
*/ |
|
56 |
@Override |
|
57 |
public ListSelect getCountrySelectField() { |
|
58 |
return countrySelectField; |
|
59 |
} |
|
60 |
|
|
43 | 61 |
/** |
44 | 62 |
* {@inheritDoc} |
45 | 63 |
*/ |
... | ... | |
49 | 67 |
GridLayout grid = (GridLayout)getFieldLayout(); |
50 | 68 |
grid.setSpacing(true); |
51 | 69 |
grid.setMargin(true); |
70 |
grid.setColumns(3); |
|
71 |
grid.setRows(8); |
|
72 |
//grid.setWidth("600px"); |
|
52 | 73 |
|
53 | 74 |
//TODO typifyingAuthors |
54 | 75 |
|
55 |
// FieldUnit |
|
56 |
|
|
57 |
|
|
76 |
// FieldUnit + GatheringEvent |
|
77 |
|
|
78 |
int row = 0; |
|
79 |
countrySelectField = new ListSelect("Country"); |
|
80 |
addField(countrySelectField, "country", 1, row , 2, row); |
|
81 |
setToFullWidth(countrySelectField); |
|
82 |
countrySelectField.setItemCaptionMode(ItemCaptionMode.PROPERTY); |
|
83 |
countrySelectField.setItemCaptionPropertyId("label"); |
|
84 |
countrySelectField.setRows(1); |
|
85 |
|
|
86 |
// ------- |
|
87 |
|
|
88 |
row++; |
|
89 |
TextArea localityField = new TextArea("Locality"); |
|
90 |
addField(localityField, "locality", 0, row , 2, row); |
|
91 |
setToFullWidth(localityField); |
|
92 |
localityField.setRows(3); |
|
93 |
|
|
94 |
// TODO ExactLocation as PointField |
|
95 |
|
|
96 |
row++; |
|
97 |
MinMaxTextField absElevationMinMax = new MinMaxTextField("Altitude", "m"); |
|
98 |
absElevationMinMax.setWidth("100%"); |
|
99 |
absElevationMinMax.addSubComponentsStyleName(getDefaultComponentStyles()); |
|
100 |
grid.addComponent(absElevationMinMax, 0, row, 2, row); |
|
101 |
|
|
102 |
bindField(absElevationMinMax.getMinField(), "absoluteElevation"); |
|
103 |
bindField(absElevationMinMax.getMaxField(), "absoluteElevationMax"); |
|
104 |
bindField(absElevationMinMax.getTextField(), "absoluteElevationText"); |
|
105 |
|
|
106 |
row++; |
|
107 |
MinMaxTextField distanceToWaterSurfaceMinMax = new MinMaxTextField("Distance to water surface", "m"); |
|
108 |
distanceToWaterSurfaceMinMax.setWidth("100%"); |
|
109 |
distanceToWaterSurfaceMinMax.addSubComponentsStyleName(getDefaultComponentStyles()); |
|
110 |
grid.addComponent(distanceToWaterSurfaceMinMax, 0, row, 2, row); |
|
111 |
|
|
112 |
bindField(distanceToWaterSurfaceMinMax.getMinField(), "distanceToWaterSurface"); |
|
113 |
bindField(distanceToWaterSurfaceMinMax.getMaxField(), "distanceToWaterSurfaceMax"); |
|
114 |
bindField(distanceToWaterSurfaceMinMax.getTextField(), "distanceToWaterSurfaceText"); |
|
115 |
distanceToWaterSurfaceMinMax.getMaxField().addValidator(new DoubleRangeValidator("Negative values are not allowed here.", 0.0, Double.MAX_VALUE)); |
|
116 |
distanceToWaterSurfaceMinMax.getMinField().addValidator(new DoubleRangeValidator("Negative values are not allowed here.", 0.0, Double.MAX_VALUE)); |
|
117 |
|
|
118 |
row++; |
|
119 |
MinMaxTextField distanceToGroundMinMax = new MinMaxTextField("Distance to substrate", "m"); |
|
120 |
distanceToGroundMinMax.setWidth("100%"); |
|
121 |
distanceToGroundMinMax.addSubComponentsStyleName(getDefaultComponentStyles()); |
|
122 |
grid.addComponent(distanceToGroundMinMax, 0, row, 2, row); |
|
123 |
|
|
124 |
bindField(distanceToGroundMinMax.getMinField(), "distanceToGround"); |
|
125 |
bindField(distanceToGroundMinMax.getMaxField(), "distanceToGroundMax"); |
|
126 |
bindField(distanceToGroundMinMax.getTextField(), "distanceToGroundText"); |
|
127 |
|
|
128 |
row++; |
|
129 |
TeamOrPersonField collectorField = new TeamOrPersonField("Collector"); |
|
130 |
addField(collectorField, "collector", 0, row, 2, row); |
|
131 |
|
|
132 |
row++; |
|
133 |
PartialDateField collectionDateField = new PartialDateField("Collection date"); |
|
134 |
addField(collectionDateField, "gatheringDate", 0, row); |
|
135 |
TextField fieldNumberField = addTextField("Field number", "fieldNumber", 2, row); |
|
58 | 136 |
// |
137 |
} |
|
59 | 138 |
|
60 |
|
|
139 |
protected void setToFullWidth(Component component){ |
|
140 |
//component.setWidth(100, Unit.PERCENTAGE); |
|
61 | 141 |
} |
62 | 142 |
|
143 |
|
|
144 |
|
|
63 | 145 |
/** |
64 | 146 |
* {@inheritDoc} |
65 | 147 |
*/ |
... | ... | |
99 | 181 |
public Collection<Collection<GrantedAuthority>> allowedGrantedAuthorities() { |
100 | 182 |
return null; |
101 | 183 |
} |
184 |
|
|
185 |
/** |
|
186 |
* {@inheritDoc} |
|
187 |
*/ |
|
188 |
@Override |
|
189 |
public boolean isResizable() { |
|
190 |
return true; |
|
191 |
} |
|
192 |
|
|
193 |
|
|
194 |
|
|
102 | 195 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/SpecimenTypeDesignationWorkingsetPopupEditorView.java | ||
---|---|---|
8 | 8 |
*/ |
9 | 9 |
package eu.etaxonomy.cdm.vaadin.view.name; |
10 | 10 |
|
11 |
import com.vaadin.ui.ListSelect; |
|
12 |
|
|
11 | 13 |
import eu.etaxonomy.vaadin.mvp.ApplicationView; |
12 | 14 |
|
13 | 15 |
/** |
... | ... | |
17 | 19 |
*/ |
18 | 20 |
public interface SpecimenTypeDesignationWorkingsetPopupEditorView extends ApplicationView<SpecimenTypeDesignationWorkingsetEditorPresenter> { |
19 | 21 |
|
22 |
public ListSelect getCountrySelectField(); |
|
20 | 23 |
} |
src/main/java/eu/etaxonomy/vaadin/mvp/AbstractCdmPopupEditor.java | ||
---|---|---|
22 | 22 |
|
23 | 23 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
24 | 24 |
import eu.etaxonomy.cdm.vaadin.component.SelectFieldFactory; |
25 |
import eu.etaxonomy.vaadin.ui.view.PopupEditorFactory; |
|
26 | 25 |
|
27 | 26 |
/** |
28 | 27 |
* @author a.kohlbecker |
... | ... | |
40 | 39 |
|
41 | 40 |
private Button advancedModeButton; |
42 | 41 |
|
43 |
/** |
|
44 |
* set by the {@link PopupEditorFactory} |
|
45 |
*/ |
|
46 | 42 |
protected SelectFieldFactory selectFieldFactory; |
47 | 43 |
|
48 | 44 |
/** |
src/main/java/eu/etaxonomy/vaadin/mvp/AbstractPopupEditor.java | ||
---|---|---|
426 | 426 |
applyDefaultComponentStyles(component); |
427 | 427 |
} |
428 | 428 |
|
429 |
protected void bindField(Field field, String propertyId){ |
|
430 |
fieldGroup.bind(field, propertyId); |
|
431 |
} |
|
432 |
|
|
429 | 433 |
/** |
430 | 434 |
* @param component |
431 | 435 |
*/ |
src/main/webapp/VAADIN/themes/edit-valo/custom-fields.scss | ||
---|---|---|
56 | 56 |
@include icon-button-field-button($button-style-name, $button-count, $button-alignment, $button-width); |
57 | 57 |
} |
58 | 58 |
|
59 |
// ===================== Styles ==============================//
|
|
59 |
// ===================== Styles ===================== //
|
|
60 | 60 |
|
61 | 61 |
body .edit-valo { // increasing specifity to allow overriding the valo default field themes |
62 | 62 |
|
63 |
// TimePeriodField
|
|
63 |
// ------------ TimePeriodField ------------ //
|
|
64 | 64 |
.v-time-period-field { |
65 | 65 |
.margin-wrapper { |
66 | 66 |
@include composite-field-wrapper; |
... | ... | |
81 | 81 |
border-radius: $v-border-radius; |
82 | 82 |
} |
83 | 83 |
|
84 |
// v-switchable-textfield
|
|
84 |
// ------------ v-switchable-textfield ------------ //
|
|
85 | 85 |
.v-switchable-textfield { |
86 | 86 |
@include icon-button-field('v-textfield', 'v-switch', 1, 'right'); |
87 | 87 |
} |
88 | 88 |
|
89 |
// v-person-field
|
|
89 |
// ------------ v-person-field ------------ //
|
|
90 | 90 |
.v-person-field { |
91 | 91 |
.v-caption { |
92 | 92 |
display: block; |
... | ... | |
119 | 119 |
} |
120 | 120 |
} |
121 | 121 |
|
122 |
// team-or-person-field
|
|
122 |
// ------------ team-or-person-field ------------ //
|
|
123 | 123 |
.v-team-or-person-field { |
124 | 124 |
|
125 | 125 |
.toolbar { |
... | ... | |
132 | 132 |
} |
133 | 133 |
} |
134 | 134 |
|
135 |
// v-related-entity-list-select |
|
135 |
// ------------ v-related-entity-list-select ------------ // |
|
136 |
|
|
136 | 137 |
.v-related-entity-list-select { |
137 | 138 |
@include icon-button-field('v-select', 'v-button', 2, 'right', $v-unit-size); |
138 | 139 |
} |
139 | 140 |
|
140 |
// v-related-entity-combobox
|
|
141 |
// ------------ v-related-entity-combobox ------------ //
|
|
141 | 142 |
.v-related-entity-combobox { |
142 | 143 |
@include icon-button-field('v-filterselect', 'v-button', 2, 'right', $v-unit-size); |
143 | 144 |
.v-filterselect-button { |
... | ... | |
145 | 146 |
} |
146 | 147 |
} |
147 | 148 |
|
149 |
// ------------ minMaxTextField ------------ // |
|
150 |
.v-min-max-text-field { |
|
151 |
@include composite-field-wrapper; |
|
152 |
} |
|
153 |
|
|
148 | 154 |
} |
Also available in: Unified diff
ref #6724 SpecimenTypeDesignationWorkingsetEditor improvements