Skip to content

Commit

Permalink
SuggestionField and SuggestionPickerField does not show suggestions i…
Browse files Browse the repository at this point in the history
…nside screen fragment which placed inside dialog. #2970
  • Loading branch information
akhodyko authored and Gleb Gorelov committed Jul 17, 2020
1 parent cd6f49d commit fe62612
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import com.haulmont.cuba.core.global.MetadataTools;
import com.haulmont.cuba.core.global.UserSessionSource;
import com.haulmont.cuba.gui.ComponentsHelper;
import com.haulmont.cuba.gui.components.SuggestionField;
import com.haulmont.cuba.gui.components.data.meta.EntityValueSource;
import com.haulmont.cuba.gui.executors.BackgroundTask;
Expand All @@ -26,19 +27,15 @@
import com.haulmont.cuba.gui.executors.TaskLifeCycle;
import com.haulmont.cuba.gui.screen.FrameOwner;
import com.haulmont.cuba.gui.screen.Screen;
import com.haulmont.cuba.gui.screen.ScreenFragment;
import com.haulmont.cuba.gui.screen.UiControllerUtils;
import com.haulmont.cuba.web.widgets.CubaSuggestionField;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;

import javax.inject.Inject;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.function.Function;

import static com.haulmont.cuba.web.gui.components.WebLookupField.NULL_STYLE_GENERATOR;
Expand Down Expand Up @@ -308,6 +305,10 @@ protected void showSuggestions(List<V> suggestions, boolean userOriginated) {
lastDialog = dialogScreen;
}

if(frameOwner instanceof ScreenFragment) {
frameOwner = ComponentsHelper.getScreen((ScreenFragment) frameOwner);
}

if (lastDialog == null || Objects.equals(frameOwner, lastDialog)) {
component.showSuggestions(suggestions, userOriginated);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.haulmont.bali.events.Subscription;
import com.haulmont.cuba.core.entity.Entity;
import com.haulmont.cuba.core.global.UserSessionSource;
import com.haulmont.cuba.gui.ComponentsHelper;
import com.haulmont.cuba.gui.components.SecuredActionsHolder;
import com.haulmont.cuba.gui.components.SuggestionPickerField;
import com.haulmont.cuba.gui.executors.BackgroundTask;
Expand All @@ -27,19 +28,15 @@
import com.haulmont.cuba.gui.executors.TaskLifeCycle;
import com.haulmont.cuba.gui.screen.FrameOwner;
import com.haulmont.cuba.gui.screen.Screen;
import com.haulmont.cuba.gui.screen.ScreenFragment;
import com.haulmont.cuba.gui.screen.UiControllerUtils;
import com.haulmont.cuba.web.widgets.CubaPickerField;
import com.haulmont.cuba.web.widgets.CubaSuggestionPickerField;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.inject.Inject;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.function.Consumer;
import java.util.function.Function;

Expand Down Expand Up @@ -294,6 +291,10 @@ protected void showSuggestions(List<V> suggestions, boolean userOriginated) {
lastDialog = dialogScreen;
}

if(frameOwner instanceof ScreenFragment) {
frameOwner = ComponentsHelper.getScreen((ScreenFragment) frameOwner);
}

if (lastDialog == null || Objects.equals(frameOwner, lastDialog)) {
getComponent().showSuggestions(suggestions, userOriginated);
}
Expand Down

0 comments on commit fe62612

Please sign in to comment.