Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: c485f84c by Tony Chemit at 2020-12-18T11:10:44+01:00 Comportement des combobox - Closes #1642 - - - - - 1 changed file: - client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/ContentUIHandler.java Changes: ===================================== client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/ContentUIHandler.java ===================================== @@ -48,6 +48,7 @@ import fr.ird.observe.dto.form.Form; import fr.ird.observe.dto.reference.ReferentialDtoReference; import fr.ird.observe.services.ObserveServicesProvider; import fr.ird.observe.services.service.ObserveService; +import io.ultreia.java4all.jaxx.widgets.combobox.JaxxComboBox; import io.ultreia.java4all.util.SingletonSupplier; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -60,8 +61,10 @@ import javax.swing.Icon; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JMenuItem; +import javax.swing.JTextField; import javax.swing.SwingUtilities; import java.awt.Component; +import java.awt.Container; import java.awt.FocusTraversalPolicy; import java.awt.KeyboardFocusManager; import java.beans.PropertyChangeListener; @@ -442,9 +445,30 @@ public abstract class ContentUIHandler<U extends ContentUI> implements ObserveSe focusAdjusting = true; try { getModel().setFormFocusOwner(newValue); + //FIXME on contentTable should also check we are in entry form + if (getDataSourceEditor().getModel().isFocusOnNavigation()) { + return; + } + if ("ComboBox.textField".equals(newValue.getName())) { + if (!getModel().getStates().isReadingMode()) { + // we are on jaxx combo box, let's open popup + Container parent = newValue.getParent(); + if (parent!=null) { + parent = parent.getParent(); + if (parent!=null) { + JaxxComboBox<?> combo = (JaxxComboBox<?>) parent; + log.debug(String.format("On a JaxxComboBox: %s on edit mode, will open popup", combo.getName())); + ((JTextField)newValue).setCaretPosition(0); + combo.getCombobox().setPopupVisible(true); + } + } + } + } } finally { focusAdjusting = false; } + } else { + log.debug(String.format("%sCan't set focus owner: %s", prefix,newValue)); } } @@ -460,7 +484,7 @@ public abstract class ContentUIHandler<U extends ContentUI> implements ObserveSe return; } - log.debug(String.format("%sSet form focus on %s", prefix, focusComponent)); + log.info(String.format("%sSet form focus on %s", prefix, focusComponent)); if (focusComponent != null) { focusAdjusting = true; SwingUtilities.invokeLater(() -> { View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/c485f84c32a2207a2d64fd1f52... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/c485f84c32a2207a2d64fd1f52... You're receiving this email because of your account on gitlab.com.