Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe

Commits:

1 changed file:

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;
    48 48
     import fr.ird.observe.dto.reference.ReferentialDtoReference;
    
    49 49
     import fr.ird.observe.services.ObserveServicesProvider;
    
    50 50
     import fr.ird.observe.services.service.ObserveService;
    
    51
    +import io.ultreia.java4all.jaxx.widgets.combobox.JaxxComboBox;
    
    51 52
     import io.ultreia.java4all.util.SingletonSupplier;
    
    52 53
     import org.apache.logging.log4j.LogManager;
    
    53 54
     import org.apache.logging.log4j.Logger;
    
    ... ... @@ -60,8 +61,10 @@ import javax.swing.Icon;
    60 61
     import javax.swing.JButton;
    
    61 62
     import javax.swing.JComponent;
    
    62 63
     import javax.swing.JMenuItem;
    
    64
    +import javax.swing.JTextField;
    
    63 65
     import javax.swing.SwingUtilities;
    
    64 66
     import java.awt.Component;
    
    67
    +import java.awt.Container;
    
    65 68
     import java.awt.FocusTraversalPolicy;
    
    66 69
     import java.awt.KeyboardFocusManager;
    
    67 70
     import java.beans.PropertyChangeListener;
    
    ... ... @@ -442,9 +445,30 @@ public abstract class ContentUIHandler<U extends ContentUI> implements ObserveSe
    442 445
                 focusAdjusting = true;
    
    443 446
                 try {
    
    444 447
                     getModel().setFormFocusOwner(newValue);
    
    448
    +                //FIXME on contentTable should also check we are in entry form
    
    449
    +                if (getDataSourceEditor().getModel().isFocusOnNavigation()) {
    
    450
    +                    return;
    
    451
    +                }
    
    452
    +                if ("ComboBox.textField".equals(newValue.getName())) {
    
    453
    +                    if (!getModel().getStates().isReadingMode()) {
    
    454
    +                        // we are on jaxx combo box, let's open popup
    
    455
    +                        Container parent = newValue.getParent();
    
    456
    +                        if (parent!=null) {
    
    457
    +                            parent = parent.getParent();
    
    458
    +                            if (parent!=null) {
    
    459
    +                                JaxxComboBox<?> combo = (JaxxComboBox<?>) parent;
    
    460
    +                                log.debug(String.format("On a JaxxComboBox: %s on edit mode, will open popup", combo.getName()));
    
    461
    +                                ((JTextField)newValue).setCaretPosition(0);
    
    462
    +                                combo.getCombobox().setPopupVisible(true);
    
    463
    +                            }
    
    464
    +                        }
    
    465
    +                    }
    
    466
    +                }
    
    445 467
                 } finally {
    
    446 468
                     focusAdjusting = false;
    
    447 469
                 }
    
    470
    +        } else {
    
    471
    +            log.debug(String.format("%sCan't set focus owner: %s", prefix,newValue));
    
    448 472
             }
    
    449 473
         }
    
    450 474
     
    
    ... ... @@ -460,7 +484,7 @@ public abstract class ContentUIHandler<U extends ContentUI> implements ObserveSe
    460 484
                 return;
    
    461 485
             }
    
    462 486
     
    
    463
    -        log.debug(String.format("%sSet form focus on %s", prefix, focusComponent));
    
    487
    +        log.info(String.format("%sSet form focus on %s", prefix, focusComponent));
    
    464 488
             if (focusComponent != null) {
    
    465 489
                 focusAdjusting = true;
    
    466 490
                 SwingUtilities.invokeLater(() -> {