Revision af0633ea
Added by Andreas Kohlbecker about 5 years ago
src/main/java/eu/etaxonomy/cdm/service/TaxonNameStringFilterablePagingProvider.java | ||
---|---|---|
13 | 13 |
import java.util.HashMap; |
14 | 14 |
import java.util.List; |
15 | 15 |
import java.util.Map; |
16 |
import java.util.Objects; |
|
16 | 17 |
import java.util.UUID; |
17 | 18 |
|
18 | 19 |
import org.apache.log4j.Logger; |
... | ... | |
233 | 234 |
@Override |
234 | 235 |
public UUID idFor(String stringRepresentation) { |
235 | 236 |
if(lastPagedEntityUUIDs == null){ |
236 |
findEntities(0, stringRepresentation); |
|
237 |
int pages = Math.max(1, size(stringRepresentation)); |
|
238 |
for(int i = 0; i < pages; i++){ |
|
239 |
findEntities(i, stringRepresentation); |
|
240 |
} |
|
237 | 241 |
} |
238 | 242 |
return lastPagedEntityUUIDs.get(stringRepresentation); |
239 | 243 |
} |
src/main/java/eu/etaxonomy/vaadin/component/WeaklyRelatedEntityCombobox.java | ||
---|---|---|
8 | 8 |
*/ |
9 | 9 |
package eu.etaxonomy.vaadin.component; |
10 | 10 |
|
11 |
import java.util.Objects; |
|
11 | 12 |
import java.util.Optional; |
12 | 13 |
import java.util.UUID; |
13 | 14 |
|
... | ... | |
196 | 197 |
*/ |
197 | 198 |
@Override |
198 | 199 |
public void setValue(String newFieldValue) throws com.vaadin.data.Property.ReadOnlyException, ConversionException { |
199 |
lazySelect.refresh(); |
|
200 |
if(lazySelect.getOptions().contains(newFieldValue)){ |
|
201 |
lazySelect.setValue(newFieldValue); |
|
200 |
if(!Objects.equals(newFieldValue, lazySelect.getValue())){ |
|
201 |
lazySelect.refresh(); |
|
202 |
if(contains(newFieldValue)){ |
|
203 |
lazySelect.setValue(newFieldValue); |
|
204 |
} |
|
205 |
lazySelect.markAsDirty(); |
|
202 | 206 |
} |
203 |
lazySelect.markAsDirty(); |
|
204 | 207 |
} |
205 | 208 |
|
209 |
/** |
|
210 |
* @param newFieldValue |
|
211 |
* @return |
|
212 |
*/ |
|
213 |
private boolean contains(String newFieldValue) { |
|
214 |
UUID id = filterablePagingProvider.idFor(newFieldValue); |
|
215 |
return id != null; |
|
216 |
} |
|
217 |
|
|
218 |
|
|
206 | 219 |
@Override |
207 | 220 |
public boolean isValueInOptions(){ |
208 | 221 |
return lazySelect.getOptions().contains(lazySelect.getValue()); |
Also available in: Unified diff
ref #8176 WeaklyRelatedEntityCombobox solving minor performance on setValue