ItEr28S11AltaEtiquetasTipoEtiquetaItEr27S11: [FixBug] Bandbox search label for label name and label type name
This commit is contained in:
parent
78f18bd877
commit
d3759e7ccc
1 changed files with 9 additions and 3 deletions
|
|
@ -132,18 +132,24 @@ public class AssignedLabelsToOrderElementController extends
|
|||
*/
|
||||
public void onSearchLabels(InputEvent event) {
|
||||
bdLabels.setVariable("selectedLabel", null, true);
|
||||
List<Label> filteredLabels = labelsStartWith(event.getValue());
|
||||
List<Label> filteredLabels = matchesString(event.getValue());
|
||||
lbLabels.setModel(new SimpleListModel(filteredLabels));
|
||||
lbLabels.invalidate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Find {@link Label} which name or type start with prefix
|
||||
*
|
||||
* @param prefix
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private List<Label> labelsStartWith(String prefix) {
|
||||
private List<Label> matchesString(String prefix) {
|
||||
List<Label> result = new ArrayList<Label>();
|
||||
List<Label> labels = (List<Label>) bdLabels.getVariable("allLabels",
|
||||
true);
|
||||
for (Label label : labels) {
|
||||
if (label.getName().startsWith(prefix)) {
|
||||
if (label.getName().contains(prefix)
|
||||
|| label.getType().getName().contains(prefix)) {
|
||||
result.add(label);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue