More refactoring (added early returns)
Signed-off-by: Jonathan Philip Knoblauch <JonathanPhilip.Knoblauch@bosch-si.com>
This commit is contained in:
@@ -92,9 +92,12 @@ public class RsqlParserValidationOracle implements RsqlValidationOracle {
|
||||
}
|
||||
|
||||
private static Collection<? extends SuggestToken> getLogicalOperatorSuggestion(final String rsqlQuery) {
|
||||
final int currentQueryLength = rsqlQuery.length();
|
||||
// only return and/or suggestion when there is a space at the end
|
||||
if (!rsqlQuery.endsWith(" ")) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (rsqlQuery.endsWith(" ")) {
|
||||
final int currentQueryLength = rsqlQuery.length();
|
||||
// only return and/or suggestion when there is a space at the end
|
||||
final Collection<String> tokenImages = TokenDescription.getTokenImage(TokenDescription.LOGICAL_OP);
|
||||
final List<SuggestToken> logicalOps = new ArrayList<>(tokenImages.size());
|
||||
for (final String tokenImage : tokenImages) {
|
||||
|
||||
@@ -379,10 +379,14 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
|
||||
}
|
||||
|
||||
private void onSearchIconClick() {
|
||||
if (!queryTextField.isValidationError()) {
|
||||
queryTextField.showValidationInProgress();
|
||||
queryTextField.getExecutor().execute(queryTextField.new StatusCircledAsync(UI.getCurrent()));
|
||||
|
||||
if (queryTextField.isValidationError()) {
|
||||
return;
|
||||
}
|
||||
|
||||
queryTextField.showValidationInProgress();
|
||||
queryTextField.getExecutor().execute(queryTextField.new StatusCircledAsync(UI.getCurrent()));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -54,14 +54,16 @@ public class AutoCompleteTextFieldConnector extends AbstractExtensionConnector {
|
||||
@Override
|
||||
public void showSuggestions(final SuggestionContextDto suggestContext) {
|
||||
select.clearItems();
|
||||
if (suggestContext != null) {
|
||||
final List<SuggestTokenDto> suggestions = suggestContext.getSuggestions();
|
||||
if (suggestions != null && !suggestions.isEmpty()) {
|
||||
select.addItems(suggestions, textFieldWidget, panel, rpc);
|
||||
panel.showRelativeTo(textFieldWidget);
|
||||
select.moveSelectionDown();
|
||||
return;
|
||||
}
|
||||
if (suggestContext == null) {
|
||||
panel.hide();
|
||||
return;
|
||||
}
|
||||
final List<SuggestTokenDto> suggestions = suggestContext.getSuggestions();
|
||||
if (suggestions != null && !suggestions.isEmpty()) {
|
||||
select.addItems(suggestions, textFieldWidget, panel, rpc);
|
||||
panel.showRelativeTo(textFieldWidget);
|
||||
select.moveSelectionDown();
|
||||
return;
|
||||
}
|
||||
panel.hide();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user