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

Commits:

17 changed files:

Changes:

  • client-core/pom.xml
    ... ... @@ -372,6 +372,10 @@
    372 372
           <artifactId>class-mapping</artifactId>
    
    373 373
         </dependency>
    
    374 374
     
    
    375
    +    <dependency>
    
    376
    +      <groupId>io.ultreia.java4all</groupId>
    
    377
    +      <artifactId>java-bean</artifactId>
    
    378
    +    </dependency>
    
    375 379
         <dependency>
    
    376 380
           <groupId>io.ultreia.java4all</groupId>
    
    377 381
           <artifactId>java-lang</artifactId>
    
    ... ... @@ -380,6 +384,7 @@
    380 384
         <dependency>
    
    381 385
           <groupId>io.ultreia.java4all</groupId>
    
    382 386
           <artifactId>java-util</artifactId>
    
    387
    +      <scope>runtime</scope>
    
    383 388
         </dependency>
    
    384 389
     
    
    385 390
         <!-- jaxx dependencies -->
    

  • client-core/src/main/i18n/getters/java.getter
    1
    +DateTimeEditor.action.reset.tip
    
    1 2
     aboutframe.changelog
    
    2 3
     observe.action.about
    
    3 4
     observe.action.about.tip
    

  • client-core/src/main/i18n/getters/jaxx.getter
    1
    +TimeEditor.H
    
    1 2
     observe.action.apply
    
    2 3
     observe.action.auto.copy.to.clipboard
    
    3 4
     observe.action.auto.copy.to.clipboard.tip
    

  • client-core/src/main/java/fr/ird/observe/client/ui/ObserveCommon.jcss
    ... ... @@ -55,6 +55,10 @@ TimeEditor {
    55 55
       i18nProperty:"";
    
    56 56
     }
    
    57 57
     
    
    58
    +UnlimitedTimeEditor {
    
    59
    +  i18nProperty:"";
    
    60
    +}
    
    61
    +
    
    58 62
     NumberEditor {
    
    59 63
       autoPopup:{config.isAutoPopupNumberEditor()};
    
    60 64
       showPopupButton:{config.isShowNumberEditorButton()};
    

  • client-core/src/main/java/fr/ird/observe/client/ui/content/ContentUIInitializer.java
    ... ... @@ -38,6 +38,7 @@ import fr.ird.observe.client.ui.actions.content.GoToTab6UIAction;
    38 38
     import fr.ird.observe.client.ui.actions.content.GoToTabUIActionSupport;
    
    39 39
     import fr.ird.observe.client.ui.util.BooleanEditor;
    
    40 40
     import fr.ird.observe.client.ui.util.UIHelper;
    
    41
    +import fr.ird.observe.client.ui.util.time.UnlimitedTimeEditor;
    
    41 42
     import fr.ird.observe.client.ui.util.tripMap.ObserveMapPane;
    
    42 43
     import fr.ird.observe.client.validation.ObserveSwingValidator;
    
    43 44
     import fr.ird.observe.dto.I18nEnumHelper;
    
    ... ... @@ -314,6 +315,8 @@ public class ContentUIInitializer<E extends IdDto, UI extends ContentUI<E, UI>>
    314 315
                 }
    
    315 316
                 if (o instanceof TemperatureEditor) {
    
    316 317
                     init((TemperatureEditor) o);
    
    318
    +            }if (o instanceof UnlimitedTimeEditor) {
    
    319
    +                init((UnlimitedTimeEditor) o);
    
    317 320
                 }
    
    318 321
     
    
    319 322
             }
    
    ... ... @@ -353,6 +356,9 @@ public class ContentUIInitializer<E extends IdDto, UI extends ContentUI<E, UI>>
    353 356
                 editor.setLabelFor((Component) objectById);
    
    354 357
             }
    
    355 358
         }
    
    359
    +    private void init(UnlimitedTimeEditor editor) {
    
    360
    +        editor.init();
    
    361
    +    }
    
    356 362
     
    
    357 363
         protected void initBlockLayerUI(String... doNotBlockComponentIds) {
    
    358 364
     //        ui.getBlockLayerUI().setAcceptedComponentTypes(UIHelper.ACCEPTABLE_COMPONENTS_TYPE);
    

  • client-core/src/main/java/fr/ird/observe/client/ui/content/data/longline/CatchLonglineUI.jaxx
    ... ... @@ -50,6 +50,7 @@
    50 50
         fr.ird.observe.client.ui.util.JComment
    
    51 51
     
    
    52 52
         fr.ird.observe.client.ui.actions.content.CatchSetDefaultTimerTimeOnBoard
    
    53
    +    fr.ird.observe.client.ui.util.time.UnlimitedTimeEditor
    
    53 54
     
    
    54 55
         org.nuiton.jaxx.widgets.number.NumberEditor
    
    55 56
         io.ultreia.java4all.jaxx.widgets.combobox.JaxxComboBox
    
    ... ... @@ -391,14 +392,14 @@
    391 392
     
    
    392 393
               <tab id='branchlineTab' i18nProperty="">
    
    393 394
     
    
    394
    -            <JPanel layout="{new BorderLayout()}">
    
    395
    -              <Table id='branchlineForm' fill='both' insets='3' constraints='BorderLayout.NORTH'>
    
    395
    +            <JPanel id='branchlinePanel' layout="{new BorderLayout()}">
    
    396
    +              <Table id='branchlineForm' fill='both' constraints='BorderLayout.NORTH'>
    
    396 397
     
    
    397 398
                     <!-- depthRecorder -->
    
    398 399
                     <!-- hookLost -->
    
    399 400
                     <!-- traceCutOff -->
    
    400 401
                     <row>
    
    401
    -                  <cell columns="3">
    
    402
    +                  <cell columns="2">
    
    402 403
                         <JPanel layout="{new GridLayout()}">
    
    403 404
                           <JCheckBox id='depthRecorder'/>
    
    404 405
                           <JCheckBox id='hookLost'/>
    
    ... ... @@ -414,16 +415,15 @@
    414 415
                       <cell anchor='east'>
    
    415 416
                         <JCheckBox id='timer'/>
    
    416 417
                       </cell>
    
    417
    -                  <cell columns="2">
    
    418
    -                    <TimeEditor id='timeSinceContact' constructorParams='this'/>
    
    418
    +                  <cell>
    
    419
    +                    <UnlimitedTimeEditor id='timeSinceContact'/>
    
    419 420
                       </cell>
    
    420 421
                     </row>
    
    421 422
     
    
    422 423
                     <!-- timerTimeOnBoard -->
    
    423 424
                     <row>
    
    425
    +                  <cell/>
    
    424 426
                       <cell>
    
    425
    -                  </cell>
    
    426
    -                  <cell columns="3">
    
    427 427
                         <DateTimeEditor id='timerTimeOnBoard' constructorParams='this'/>
    
    428 428
                       </cell>
    
    429 429
                     </row>
    
    ... ... @@ -433,22 +433,15 @@
    433 433
                       <cell anchor='west'>
    
    434 434
                         <JLabel id='baitHaulingStatusLabel'/>
    
    435 435
                       </cell>
    
    436
    -                  <cell anchor='east' weightx="1" fill="both" columns="2">
    
    437
    -                    <JaxxComboBox id='baitHaulingStatus' constructorParams='this'
    
    438
    -                                  genericType='BaitHaulingStatusReference'/>
    
    436
    +                  <cell anchor='east' weightx="1" fill="both">
    
    437
    +                    <JaxxComboBox id='baitHaulingStatus' constructorParams='this' genericType='BaitHaulingStatusReference'/>
    
    439 438
                       </cell>
    
    440 439
                     </row>
    
    441
    -
    
    442
    -                <row>
    
    443
    -                  <cell columns="3">
    
    444
    -                    <JPanel id='branchlineActions' layout="{new GridLayout()}">
    
    445
    -                      <JButton id='resetBranchline' onActionPerformed='getHandler().resetBranchline()'/>
    
    446
    -                      <JButton id='saveBranchline' onActionPerformed='getHandler().saveBranchline()'/>
    
    447
    -                    </JPanel>
    
    448
    -                  </cell>
    
    449
    -                </row>
    
    450
    -
    
    451 440
                   </Table>
    
    441
    +              <JPanel id='branchlineActions' layout="{new GridLayout()}" constraints='BorderLayout.SOUTH'>
    
    442
    +                <JButton id='resetBranchline' onActionPerformed='getHandler().resetBranchline()'/>
    
    443
    +                <JButton id='saveBranchline' onActionPerformed='getHandler().saveBranchline()'/>
    
    444
    +              </JPanel>
    
    452 445
                 </JPanel>
    
    453 446
     
    
    454 447
               </tab>
    

  • client-core/src/main/java/fr/ird/observe/client/ui/content/data/longline/CatchLonglineUI.jcss
    ... ... @@ -293,11 +293,15 @@ JCheckBox {
    293 293
       enabled:{!tableModel.isCreate() && tableEditBean.getBranchline() != null};
    
    294 294
     }
    
    295 295
     
    
    296
    -#branchlineForm {
    
    296
    +#branchlinePanel {
    
    297 297
       border:{new TitledBorder( (String) null)};
    
    298 298
       visible:{!tableModel.isCreate() && tableEditBean.getBranchline() != null};
    
    299 299
     }
    
    300 300
     
    
    301
    +#branchlineForm {
    
    302
    +  visible:{!tableModel.isCreate() && tableEditBean.getBranchline() != null};
    
    303
    +}
    
    304
    +
    
    301 305
     #depthRecorder {
    
    302 306
       horizontalTextPosition:{JCheckBox.LEFT};
    
    303 307
       _branchlineBeanPropertyName:{BranchlineDto.PROPERTY_DEPTH_RECORDER};
    
    ... ... @@ -327,7 +331,7 @@ JCheckBox {
    327 331
       bean:{model};
    
    328 332
       enabled:{BooleanUtils.isTrue(branchlineBean.getTimer())};
    
    329 333
       time:{model.getBranchlineTimeSinceContact()};
    
    330
    -  showTimeEditorSlider:false;
    
    334
    +  showReset:true;
    
    331 335
     }
    
    332 336
     
    
    333 337
     #timerTimeOnBoard {
    
    ... ... @@ -335,6 +339,7 @@ JCheckBox {
    335 339
       propertyDate: {BranchlineDto.PROPERTY_TIMER_TIME_ON_BOARD};
    
    336 340
       bean:{branchlineBean};
    
    337 341
       showTimeEditorSlider:false;
    
    342
    +  showReset:true;
    
    338 343
     }
    
    339 344
     
    
    340 345
     #baitHaulingStatus {
    

  • client-core/src/main/java/fr/ird/observe/client/ui/content/data/longline/CatchLonglineUIHandler.java
    ... ... @@ -60,7 +60,6 @@ import fr.ird.observe.dto.referential.longline.CatchFateLonglineReference;
    60 60
     import fr.ird.observe.dto.referential.longline.HealthStatusReference;
    
    61 61
     import fr.ird.observe.dto.result.SaveResultDto;
    
    62 62
     import fr.ird.observe.spi.DtoModelHelper;
    
    63
    -import io.ultreia.java4all.util.Dates;
    
    64 63
     import org.apache.commons.lang3.BooleanUtils;
    
    65 64
     import org.apache.logging.log4j.LogManager;
    
    66 65
     import org.apache.logging.log4j.Logger;
    
    ... ... @@ -69,7 +68,6 @@ import org.nuiton.jaxx.runtime.spi.UIHandler;
    69 68
     import org.nuiton.jaxx.validator.swing.SwingValidator;
    
    70 69
     import org.nuiton.jaxx.validator.swing.SwingValidatorMessage;
    
    71 70
     import org.nuiton.jaxx.validator.swing.SwingValidatorMessageTableModel;
    
    72
    -import org.nuiton.util.DateUtil;
    
    73 71
     import org.nuiton.validator.NuitonValidatorScope;
    
    74 72
     
    
    75 73
     import javax.swing.JComponent;
    
    ... ... @@ -82,9 +80,7 @@ import java.awt.Component;
    82 80
     import java.awt.Container;
    
    83 81
     import java.beans.PropertyChangeListener;
    
    84 82
     import java.util.ArrayList;
    
    85
    -import java.util.Calendar;
    
    86 83
     import java.util.Collections;
    
    87
    -import java.util.Date;
    
    88 84
     import java.util.HashSet;
    
    89 85
     import java.util.List;
    
    90 86
     import java.util.Objects;
    
    ... ... @@ -102,27 +98,45 @@ import static io.ultreia.java4all.i18n.I18n.t;
    102 98
      */
    
    103 99
     public class CatchLonglineUIHandler extends ContentTableUIHandler<SetLonglineCatchDto, CatchLonglineDto, CatchLonglineUI> implements UIHandler<CatchLonglineUI> {
    
    104 100
     
    
    105
    -    /** Logger */
    
    101
    +    /**
    
    102
    +     * Logger
    
    103
    +     */
    
    106 104
         private static final Logger log = LogManager.getLogger(CatchLonglineUIHandler.class);
    
    107
    -
    
    105
    +    private static final String GROUPED_TRIP_TYPE_ID = "fr.ird.observe.entities.referentiel.longline.TripType#1239832686136#0.1";
    
    108 106
         // Compute valid state of tab from the error table
    
    109 107
         protected final TableModelListener computeTabValidStateListener;
    
    110
    -
    
    111 108
         private final PropertyChangeListener catchFateChanged;
    
    112
    -
    
    113 109
         private final PropertyChangeListener branchlineChanged;
    
    114
    -
    
    115 110
         private final PropertyChangeListener depredatedChanged;
    
    116 111
         private final PropertyChangeListener timerChanged;
    
    117
    -
    
    118 112
         private final PropertyChangeListener sizeTableModelModified;
    
    119
    -
    
    120 113
         private final PropertyChangeListener weightTableModelModified;
    
    121
    -
    
    122 114
         private final JAXXContextEntryDef<LonglinePositionHelper<CatchLonglineDto>> POSITION_HELPER_ENTRY =
    
    123 115
                 UIHelper.newContextEntryDef("CatchLonglineUI-positionHelper", LonglinePositionHelper.class);
    
    124 116
     
    
    125
    -    private static final String GROUPED_TRIP_TYPE_ID = "fr.ird.observe.entities.referentiel.longline.TripType#1239832686136#0.1";
    
    117
    +    static class TablePopupSupport extends AutotSelectRowAndShowPopupActionSupport {
    
    118
    +
    
    119
    +        private final CatchLonglineUI ui;
    
    120
    +
    
    121
    +        TablePopupSupport(CatchLonglineUI ui) {
    
    122
    +            super(ui.getTableScrollPane(), ui.getTable(), ui.getTablePopup());
    
    123
    +            this.ui = ui;
    
    124
    +        }
    
    125
    +
    
    126
    +        @Override
    
    127
    +        protected void beforeOpenPopup(int modelRowIndex, int modelColumnIndex) {
    
    128
    +
    
    129
    +            CatchLonglineTableModel model = (CatchLonglineTableModel) getTable().getModel();
    
    130
    +
    
    131
    +            boolean canMoveUp = !ui.getModel().isCanSaveRow() && modelRowIndex > 0;
    
    132
    +            boolean canMoveDown = !ui.getModel().isCanSaveRow() && modelRowIndex < model.getRowCount() - 1;
    
    133
    +
    
    134
    +            ui.getMoveUp().setEnabled(canMoveUp);
    
    135
    +            ui.getMoveDown().setEnabled(canMoveDown);
    
    136
    +
    
    137
    +        }
    
    138
    +
    
    139
    +    }
    
    126 140
     
    
    127 141
         CatchLonglineUIHandler() {
    
    128 142
             super(DataContextType.SetLongline);
    
    ... ... @@ -236,7 +250,9 @@ public class CatchLonglineUIHandler extends ContentTableUIHandler<SetLonglineCat
    236 250
                                             evt -> ui.getBranchlineValidator().setChanged(true));
    
    237 251
     
    
    238 252
             ui.getTimerTimeOnBoard().getSliderHidorToolBar().setVisible(true);
    
    253
    +        ui.getTimerTimeOnBoard().getSliderHidor().setVisible(false);
    
    239 254
             ui.getTimerTimeOnBoard().getSliderHidorToolBar().add(ui.getSetDefaultTimerTimeOnBoard());
    
    255
    +//        ui.getTimeSinceContact().getReset().setVisible(true);
    
    240 256
         }
    
    241 257
     
    
    242 258
         @Override
    
    ... ... @@ -248,9 +264,6 @@ public class CatchLonglineUIHandler extends ContentTableUIHandler<SetLonglineCat
    248 264
     
    
    249 265
             super.openUI();
    
    250 266
     
    
    251
    -        getUi().getTimeSinceContact().getSliderHidor().setVisible(false);
    
    252
    -        getUi().getTimerTimeOnBoard().getSliderHidor().setVisible(false);
    
    253
    -
    
    254 267
             // Reset all sections
    
    255 268
             LonglinePositionHelper<CatchLonglineDto> positionHelper = POSITION_HELPER_ENTRY.getContextValue(getUi());
    
    256 269
             getUi().getSection().setData(positionHelper.getSections());
    
    ... ... @@ -276,36 +289,34 @@ public class CatchLonglineUIHandler extends ContentTableUIHandler<SetLonglineCat
    276 289
     
    
    277 290
         public void saveBranchline() {
    
    278 291
     
    
    279
    -        if (log.isInfoEnabled()) {
    
    280
    -            log.info("Saved modified branchline");
    
    281
    -        }
    
    292
    +        log.info("Saved modified branchline");
    
    282 293
     
    
    283 294
             CatchLonglineUI ui = getUi();
    
    284 295
     
    
    285 296
             BranchlineDto branchline = ui.getBranchlineBean();
    
    286 297
     
    
    298
    +        CatchLonglineUIModel model = getModel();
    
    287 299
             if (BooleanUtils.isTrue(branchline.getTimer())) {
    
    288
    -            Calendar calendar = Calendar.getInstance();
    
    289
    -            calendar.setTime(getModel().getBranchlineTimeSinceContact());
    
    290
    -            int minutes = calendar.get(Calendar.MINUTE);
    
    291
    -            int hours = calendar.get(Calendar.HOUR_OF_DAY);
    
    292
    -            branchline.setTimeSinceContact(minutes + 60L * hours);
    
    300
    +            Integer branchlineTimeSinceContact = model.getBranchlineTimeSinceContact();
    
    301
    +            branchline.setTimeSinceContact(branchlineTimeSinceContact == null ? null : branchlineTimeSinceContact.longValue());
    
    293 302
             } else {
    
    294 303
                 branchline.setTimeSinceContact(null);
    
    295 304
             }
    
    296
    -        if (log.isInfoEnabled()) {
    
    297
    -            log.info("Time since contact: " + branchline.getTimeSinceContact());
    
    298
    -        }
    
    305
    +        log.info(String.format("Save with time since contact: %d", branchline.getTimeSinceContact()));
    
    299 306
     
    
    300 307
             String openSetLonglineId = getDataContext().getSelectedSetLonglineId();
    
    301 308
             SaveResultDto saveResult = getBranchlineService().save(openSetLonglineId, branchline);
    
    302 309
             saveResult.toDto(branchline);
    
    310
    +        boolean modified = model.isModified();
    
    303 311
     
    
    304 312
             // on recopie le last update car c'est le laste update de SetLongline qui est renvoyé.
    
    305 313
             getBean().setLastUpdateDate(saveResult.getLastUpdateDate());
    
    306 314
     
    
    307 315
             getUi().getBranchlineValidator().setChanged(false);
    
    308
    -
    
    316
    +        if (!modified) {
    
    317
    +            ui.getValidator().setChanged(false);
    
    318
    +            model.setModified(false);
    
    319
    +        }
    
    309 320
         }
    
    310 321
     
    
    311 322
         void updateCatchAcquisitionMode(CatchAcquisitionMode newMode) {
    
    ... ... @@ -488,7 +499,7 @@ public class CatchLonglineUIHandler extends ContentTableUIHandler<SetLonglineCat
    488 499
                 ui.getMainTabbedPane().setSelectedIndex(0);
    
    489 500
     
    
    490 501
                 NavigationTree treeHelper = getNavigationTree();
    
    491
    -            NavigationTreeNodeSupport selectedNode = treeHelper.getSelectedNode();
    
    502
    +            NavigationTreeNodeSupport<?> selectedNode = treeHelper.getSelectedNode();
    
    492 503
                 while (!(selectedNode instanceof TripLonglineNavigationTreeNode)) {
    
    493 504
                     selectedNode = selectedNode.getParent();
    
    494 505
                 }
    
    ... ... @@ -825,9 +836,6 @@ public class CatchLonglineUIHandler extends ContentTableUIHandler<SetLonglineCat
    825 836
                 return;
    
    826 837
             }
    
    827 838
     
    
    828
    -        //tchemit-20191104 there is a bug on time editor, need to reset by hand the hour and minute editor
    
    829
    -        ui.getTimeSinceContact().reset();
    
    830
    -
    
    831 839
             CatchLonglineUI ui = getUi();
    
    832 840
     
    
    833 841
             BranchlineDto branchline = ui.getBranchlineBean();
    
    ... ... @@ -836,9 +844,7 @@ public class CatchLonglineUIHandler extends ContentTableUIHandler<SetLonglineCat
    836 844
             CatchLonglineUIModel model = getModel();
    
    837 845
             if (newValue == null) {
    
    838 846
     
    
    839
    -            if (log.isInfoEnabled()) {
    
    840
    -                log.info("Remove branchline");
    
    841
    -            }
    
    847
    +            log.info("Remove branchline");
    
    842 848
                 branchline.removePropertyChangeListener(BranchlineDto.PROPERTY_TIMER, timerChanged);
    
    843 849
                 branchlineValidator.setBean(null);
    
    844 850
                 branchline.clear();
    
    ... ... @@ -846,9 +852,7 @@ public class CatchLonglineUIHandler extends ContentTableUIHandler<SetLonglineCat
    846 852
     
    
    847 853
             } else {
    
    848 854
     
    
    849
    -            if (log.isInfoEnabled()) {
    
    850
    -                log.info("Use branchline: " + newValue);
    
    851
    -            }
    
    855
    +            log.info(String.format("Use branchline: %s", newValue));
    
    852 856
                 branchline.addPropertyChangeListener(BranchlineDto.PROPERTY_TIMER, timerChanged);
    
    853 857
                 String setLonglineId = getDataContext().getSelectedSetLonglineId();
    
    854 858
     
    
    ... ... @@ -859,18 +863,12 @@ public class CatchLonglineUIHandler extends ContentTableUIHandler<SetLonglineCat
    859 863
                     ui.getValidator().setBean(getBean());
    
    860 864
                 }
    
    861 865
     
    
    862
    -            Date timeSinceContactDate = null;
    
    866
    +            Long timeSinceContact=null;
    
    863 867
                 if (Objects.equals(true, branchline.getTimer())) {
    
    864
    -                Long timeSinceContact = branchline.getTimeSinceContact();
    
    865
    -                if (timeSinceContact != null) {
    
    866
    -                    timeSinceContactDate = DateUtil.createDate(0, (int) (timeSinceContact % 60), (int) (timeSinceContact / 60f), 0, 0, 0);
    
    867
    -                }
    
    868
    -            }
    
    869
    -            if (timeSinceContactDate == null) {
    
    870
    -                timeSinceContactDate = DateUtil.createDate(0, 0, 0, 0, 0, 0);
    
    868
    +                timeSinceContact = branchline.getTimeSinceContact();
    
    871 869
                 }
    
    872
    -            log.info("Set time since contact: " + timeSinceContactDate);
    
    873
    -            model.setBranchlineTimeSinceContact(timeSinceContactDate);
    
    870
    +            log.info(String.format("Set time since contact: %d", timeSinceContact));
    
    871
    +            model.setBranchlineTimeSinceContact(timeSinceContact==null?null:timeSinceContact.intValue());
    
    874 872
                 branchlineValidator.setBean(branchline);
    
    875 873
             }
    
    876 874
     
    
    ... ... @@ -943,7 +941,6 @@ public class CatchLonglineUIHandler extends ContentTableUIHandler<SetLonglineCat
    943 941
     
    
    944 942
         }
    
    945 943
     
    
    946
    -
    
    947 944
         private void onSizeTableModelModified(Boolean newValue) {
    
    948 945
     
    
    949 946
             if (newValue) {
    
    ... ... @@ -1042,41 +1039,19 @@ public class CatchLonglineUIHandler extends ContentTableUIHandler<SetLonglineCat
    1042 1039
             model.setBranchlineTabValid(branchlineTabValid);
    
    1043 1040
     
    
    1044 1041
         }
    
    1042
    +
    
    1045 1043
         void onTimerChanged(Boolean newValue) {
    
    1046 1044
             if (Objects.equals(true, newValue)) {
    
    1047 1045
                 // with timer
    
    1048
    -            ui.getModel().setBranchlineTimeSinceContact(Dates.createDate(0, 0, 0, 0, 0, 0));
    
    1046
    +            ui.getModel().setBranchlineTimeSinceContact(0);
    
    1049 1047
             } else {
    
    1050 1048
                 // without timer
    
    1051 1049
                 ui.getModel().setBranchlineTimeSinceContact(null);
    
    1052 1050
             }
    
    1053 1051
         }
    
    1052
    +
    
    1054 1053
         @Override
    
    1055 1054
         protected CatchLonglineTableModel getTableModel() {
    
    1056 1055
             return (CatchLonglineTableModel) super.getTableModel();
    
    1057 1056
         }
    
    1058
    -
    
    1059
    -    static class TablePopupSupport extends AutotSelectRowAndShowPopupActionSupport {
    
    1060
    -
    
    1061
    -        private final CatchLonglineUI ui;
    
    1062
    -
    
    1063
    -        TablePopupSupport(CatchLonglineUI ui) {
    
    1064
    -            super(ui.getTableScrollPane(), ui.getTable(), ui.getTablePopup());
    
    1065
    -            this.ui = ui;
    
    1066
    -        }
    
    1067
    -
    
    1068
    -        @Override
    
    1069
    -        protected void beforeOpenPopup(int modelRowIndex, int modelColumnIndex) {
    
    1070
    -
    
    1071
    -            CatchLonglineTableModel model = (CatchLonglineTableModel) getTable().getModel();
    
    1072
    -
    
    1073
    -            boolean canMoveUp = !ui.getModel().isCanSaveRow() && modelRowIndex > 0;
    
    1074
    -            boolean canMoveDown = !ui.getModel().isCanSaveRow() && modelRowIndex < model.getRowCount() - 1;
    
    1075
    -
    
    1076
    -            ui.getMoveUp().setEnabled(canMoveUp);
    
    1077
    -            ui.getMoveDown().setEnabled(canMoveDown);
    
    1078
    -
    
    1079
    -        }
    
    1080
    -
    
    1081
    -    }
    
    1082 1057
     }

  • client-core/src/main/java/fr/ird/observe/client/ui/content/data/longline/CatchLonglineUIModel.java
    ... ... @@ -111,7 +111,7 @@ public class CatchLonglineUIModel extends ContentTableUIModel<SetLonglineCatchDt
    111 111
     
    
    112 112
         protected boolean branchlineTabValid;
    
    113 113
     
    
    114
    -    protected Date branchlineTimeSinceContact;
    
    114
    +    protected Integer branchlineTimeSinceContact;
    
    115 115
     
    
    116 116
         public CatchLonglineUIModel(CatchLonglineUI ui) {
    
    117 117
             super(SetLonglineCatchDto.class, CatchLonglineDto.class);
    
    ... ... @@ -189,31 +189,19 @@ public class CatchLonglineUIModel extends ContentTableUIModel<SetLonglineCatchDt
    189 189
             firePropertyChange(PROPERTY_BRANCHLINE_TAB_VALID, null, branchlineTabValid);
    
    190 190
         }
    
    191 191
     
    
    192
    -    public Date getBranchlineTimeSinceContact() {
    
    192
    +    public Integer getBranchlineTimeSinceContact() {
    
    193 193
             return branchlineTimeSinceContact;
    
    194 194
         }
    
    195 195
     
    
    196
    -    public void setBranchlineTimeSinceContact(Date branchlineTimeSinceContact) {
    
    197
    -        Date oldValue = getBranchlineTimeSinceContact();
    
    196
    +    public void setBranchlineTimeSinceContact(Integer branchlineTimeSinceContact) {
    
    197
    +        Integer oldValue = getBranchlineTimeSinceContact();
    
    198 198
             this.branchlineTimeSinceContact = branchlineTimeSinceContact;
    
    199 199
             firePropertyChange(PROPERTY_BRANCHLINE_TIME_SINCE_CONTACT, oldValue, branchlineTimeSinceContact);
    
    200
    -
    
    201 200
         }
    
    202 201
     
    
    203 202
         @Override
    
    204 203
         protected CatchLonglineTableModel createTableModel(ObserveContentTableUI<SetLonglineCatchDto, CatchLonglineDto, ?> ui, List<ContentTableMeta<CatchLonglineDto>> contentTableMetas) {
    
    205 204
             return new CatchLonglineTableModel(ui, contentTableMetas);
    
    206 205
         }
    
    207
    -//
    
    208
    -//    @Override
    
    209
    -//    protected BinderModelBuilder<CatchLonglineDto, CatchLonglineDto> prepareChildLoador(String binderName) {
    
    210
    -//
    
    211
    -//        BinderModelBuilder<CatchLonglineDto, CatchLonglineDto> builder = super.prepareChildLoador(binderName);
    
    212
    -//
    
    213
    -//        builder.addCollectionStrategy(Binder.CollectionStrategy.duplicate, CatchLonglineDto.PROPERTY_PREDATOR);
    
    214
    -//
    
    215
    -//        return builder;
    
    216
    -//
    
    217
    -//    }
    
    218 206
     
    
    219 207
     }

  • client-core/src/main/java/fr/ird/observe/client/ui/util/time/UnlimitedTimeEditor.jaxx
    1
    +<!--
    
    2
    +  #%L
    
    3
    +  JAXX :: Widgets DateTime
    
    4
    +  %%
    
    5
    +  Copyright (C) 2008 - 2020 Code Lutin, Ultreia.io
    
    6
    +  %%
    
    7
    +  This program is free software: you can redistribute it and/or modify
    
    8
    +  it under the terms of the GNU General Public License as
    
    9
    +  published by the Free Software Foundation, either version 3 of the
    
    10
    +  License, or (at your option) any later version.
    
    11
    +
    
    12
    +  This program is distributed in the hope that it will be useful,
    
    13
    +  but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14
    +  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15
    +  GNU General Public License for more details.
    
    16
    +
    
    17
    +  You should have received a copy of the GNU General Public
    
    18
    +  License along with this program.  If not, see
    
    19
    +  <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    20
    +  #L%
    
    21
    +  -->
    
    22
    +
    
    23
    +<JPanel layout='{new BorderLayout()}' implements='org.nuiton.jaxx.runtime.bean.BeanScopeAware'>
    
    24
    +
    
    25
    +    <import>
    
    26
    +        java.util.Calendar
    
    27
    +        java.util.Date
    
    28
    +        java.awt.BorderLayout
    
    29
    +    </import>
    
    30
    +
    
    31
    +    <!-- model -->
    
    32
    +    <UnlimitedTimeEditorModel id='model'/>
    
    33
    +
    
    34
    +    <!-- spinner hour editor -->
    
    35
    +    <SpinnerNumberModel id="hourModel" constructorParams="0, 0, 100, 1"/>
    
    36
    +
    
    37
    +    <!-- spinner minute editor -->
    
    38
    +    <SpinnerNumberModel id="minuteModel" constructorParams="0, 0, 59, 1"/>
    
    39
    +
    
    40
    +    <!-- flag to show or hide reset button -->
    
    41
    +    <Boolean id='showReset' javaBean='false'/>
    
    42
    +
    
    43
    +    <script><![CDATA[
    
    44
    +public void init() { handler.init(this); }
    
    45
    +
    
    46
    +@Override
    
    47
    +public Object getBean() { return model.getBean(); }
    
    48
    +
    
    49
    +@Override
    
    50
    +public void setBean(Object bean) { model.setBean(bean); }
    
    51
    +
    
    52
    +public void setPropertyTime(String property) { model.setPropertyTime(property); }
    
    53
    +
    
    54
    +public void setTime(Integer time) { model.setTime(time); }
    
    55
    +
    
    56
    +public void setLabel(String label) { timeLabel.setText(label); }
    
    57
    +
    
    58
    +public void reset() { handler.reset(); }
    
    59
    +]]>
    
    60
    +    </script>
    
    61
    +
    
    62
    +    <BeanValidator id='validator' autoField='true' bean='model'>
    
    63
    +        <field name='time' component='editorPanel'/>
    
    64
    +    </BeanValidator>
    
    65
    +    <JPanel id='leftPanel' constraints='BorderLayout.WEST' layout='{new BorderLayout()}'>
    
    66
    +        <JLabel id='timeLabel' constraints='BorderLayout.WEST'/>
    
    67
    +        <JToolBar id='toolbarReset' constraints='BorderLayout.CENTER'>
    
    68
    +            <JButton id='reset'/>
    
    69
    +        </JToolBar>
    
    70
    +    </JPanel>
    
    71
    +    <JPanel id='editorPanel' constraints='BorderLayout.EAST'>
    
    72
    +        <JSpinner id='hourEditor' onStateChanged='model.setHours((Integer)((JSpinner)event.getSource()).getValue())'/>
    
    73
    +        <JLabel id='labelH'/>
    
    74
    +        <JSpinner id='minuteEditor' onStateChanged='model.setMinutes((Integer)((JSpinner)event.getSource()).getValue())'/>
    
    75
    +      <JToolBar id="sliderHidorToolBar"/>
    
    76
    +    </JPanel>
    
    77
    +
    
    78
    +</JPanel>

  • client-core/src/main/java/fr/ird/observe/client/ui/util/time/UnlimitedTimeEditor.jcss
    1
    +/*
    
    2
    + * #%L
    
    3
    + * JAXX :: Widgets DateTime
    
    4
    + * %%
    
    5
    + * Copyright (C) 2008 - 2014 CodeLutin
    
    6
    + * %%
    
    7
    + * This program is free software: you can redistribute it and/or modify
    
    8
    + * it under the terms of the GNU General Public License as
    
    9
    + * published by the Free Software Foundation, either version 3 of the
    
    10
    + * License, or (at your option) any later version.
    
    11
    + *
    
    12
    + * This program is distributed in the hope that it will be useful,
    
    13
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15
    + * GNU General Public License for more details.
    
    16
    + *
    
    17
    + * You should have received a copy of the GNU General Public
    
    18
    + * License along with this program.  If not, see
    
    19
    + * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    20
    + * #L%
    
    21
    + */
    
    22
    +
    
    23
    +JToolBar {
    
    24
    +  borderPainted:false;
    
    25
    +  floatable:false;
    
    26
    +  focusable:false;
    
    27
    +  opaque:false;
    
    28
    +}
    
    29
    +
    
    30
    +JButton {
    
    31
    +  borderPainted:false;
    
    32
    +  opaque:false;
    
    33
    +  focusable:false;
    
    34
    +}
    
    35
    +
    
    36
    +#title {
    
    37
    +  horizontalAlignment:center;
    
    38
    +}
    
    39
    +
    
    40
    +#hourModel {
    
    41
    +  value:{model.getHours()};
    
    42
    +}
    
    43
    +
    
    44
    +#hourEditor {
    
    45
    +  model:{hourModel};
    
    46
    +  enabled:{isEnabled()};
    
    47
    +}
    
    48
    +
    
    49
    +#labelH {
    
    50
    +  text:"TimeEditor.H";
    
    51
    +  horizontalAlignment:center;
    
    52
    +}
    
    53
    +
    
    54
    +#minuteModel {
    
    55
    +  value:{model.getMinutes()};
    
    56
    +}
    
    57
    +
    
    58
    +#minuteEditor {
    
    59
    +  model:{minuteModel};
    
    60
    +  enabled:{isEnabled()};
    
    61
    +}
    
    62
    +
    
    63
    +#toolbarReset {
    
    64
    +  visible:{isShowReset()};
    
    65
    +}
    
    66
    +
    
    67
    +#reset {
    
    68
    +  enabled:{isEnabled()};
    
    69
    +}

  • client-core/src/main/java/fr/ird/observe/client/ui/util/time/UnlimitedTimeEditorHandler.java
    1
    +package fr.ird.observe.client.ui.util.time;
    
    2
    +
    
    3
    +/*-
    
    4
    + * #%L
    
    5
    + * ObServe :: Client core
    
    6
    + * %%
    
    7
    + * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io
    
    8
    + * %%
    
    9
    + * This program is free software: you can redistribute it and/or modify
    
    10
    + * it under the terms of the GNU General Public License as
    
    11
    + * published by the Free Software Foundation, either version 3 of the
    
    12
    + * License, or (at your option) any later version.
    
    13
    + *
    
    14
    + * This program is distributed in the hope that it will be useful,
    
    15
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17
    + * GNU General Public License for more details.
    
    18
    + *
    
    19
    + * You should have received a copy of the GNU General Public
    
    20
    + * License along with this program.  If not, see
    
    21
    + * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    22
    + * #L%
    
    23
    + */
    
    24
    +
    
    25
    +import fr.ird.observe.client.ui.util.time.actions.UnlimitedTimeEditorResetAction;
    
    26
    +import io.ultreia.java4all.lang.Setters;
    
    27
    +import org.apache.logging.log4j.LogManager;
    
    28
    +import org.apache.logging.log4j.Logger;
    
    29
    +import org.nuiton.jaxx.runtime.spi.UIHandler;
    
    30
    +import org.nuiton.jaxx.widgets.MutateOnConditionalPropertyChangeListener;
    
    31
    +
    
    32
    +import java.lang.reflect.Method;
    
    33
    +import java.util.Objects;
    
    34
    +import java.util.function.Predicate;
    
    35
    +
    
    36
    +/**
    
    37
    + * Created on 20/01/2021.
    
    38
    + *
    
    39
    + * @author Tony Chemit - dev@tchemit.fr
    
    40
    + * @since 7.6.7
    
    41
    + */
    
    42
    +public class UnlimitedTimeEditorHandler implements UIHandler<UnlimitedTimeEditor> {
    
    43
    +
    
    44
    +    private static final Logger log = LogManager.getLogger(UnlimitedTimeEditorHandler.class);
    
    45
    +    private UnlimitedTimeEditor ui;
    
    46
    +
    
    47
    +    @Override
    
    48
    +    public void afterInit(UnlimitedTimeEditor ui) {
    
    49
    +        this.ui = Objects.requireNonNull(ui);
    
    50
    +        UnlimitedTimeEditorResetAction.init(ui, ui.getReset(), UnlimitedTimeEditorResetAction.class);
    
    51
    +    }
    
    52
    +
    
    53
    +    public void init(UnlimitedTimeEditor ui) {
    
    54
    +        log.debug(String.format("%s - init UnlimitedTimeEditor", ui.getName()));
    
    55
    +        UnlimitedTimeEditorModel model = ui.getModel();
    
    56
    +        String property = model.getPropertyTime();
    
    57
    +        if (property == null || property.isEmpty()) {
    
    58
    +            ui.setPropertyTime(ui.getName());
    
    59
    +        }
    
    60
    +        ui.setEnabled(true);
    
    61
    +        Predicate<UnlimitedTimeEditorModel> predicate = model.canUpdateBeanValuePredicate();
    
    62
    +
    
    63
    +        Object bean = ui.getBean();
    
    64
    +        if (property != null && bean != null) {
    
    65
    +
    
    66
    +            Method mutator = Setters.getMutator(bean, property);
    
    67
    +            Objects.requireNonNull(mutator, "could not find mutator for " + property);
    
    68
    +
    
    69
    +            // When model time date changed, let's push it back in bean
    
    70
    +            model.addPropertyChangeListener(
    
    71
    +                    UnlimitedTimeEditorModel.PROPERTY_TIME,
    
    72
    +                    new MutateOnConditionalPropertyChangeListener<>(model, mutator, predicate));
    
    73
    +        }
    
    74
    +    }
    
    75
    +
    
    76
    +    public void reset() {
    
    77
    +        ui.getHourEditor().setValue(0);
    
    78
    +        ui.getMinuteEditor().setValue(0);
    
    79
    +        ui.getModel().setTime(null);
    
    80
    +    }
    
    81
    +
    
    82
    +}

  • client-core/src/main/java/fr/ird/observe/client/ui/util/time/UnlimitedTimeEditorModel.java
    1
    +package fr.ird.observe.client.ui.util.time;
    
    2
    +
    
    3
    +/*-
    
    4
    + * #%L
    
    5
    + * ObServe :: Client core
    
    6
    + * %%
    
    7
    + * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io
    
    8
    + * %%
    
    9
    + * This program is free software: you can redistribute it and/or modify
    
    10
    + * it under the terms of the GNU General Public License as
    
    11
    + * published by the Free Software Foundation, either version 3 of the
    
    12
    + * License, or (at your option) any later version.
    
    13
    + *
    
    14
    + * This program is distributed in the hope that it will be useful,
    
    15
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17
    + * GNU General Public License for more details.
    
    18
    + *
    
    19
    + * You should have received a copy of the GNU General Public
    
    20
    + * License along with this program.  If not, see
    
    21
    + * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    22
    + * #L%
    
    23
    + */
    
    24
    +
    
    25
    +import com.google.common.base.Preconditions;
    
    26
    +import io.ultreia.java4all.bean.AbstractJavaBean;
    
    27
    +import org.nuiton.jaxx.widgets.ModelToBean;
    
    28
    +
    
    29
    +import java.util.function.Predicate;
    
    30
    +
    
    31
    +/**
    
    32
    + * Created on 20/01/2021.
    
    33
    + *
    
    34
    + * @author Tony Chemit - dev@tchemit.fr
    
    35
    + * @since 7.6.7
    
    36
    + */
    
    37
    +public class UnlimitedTimeEditorModel extends AbstractJavaBean implements ModelToBean {
    
    38
    +
    
    39
    +    public static final String PROPERTY_TIME = "time";
    
    40
    +    public static final String PROPERTY_HOURS = "hours";
    
    41
    +    public static final String PROPERTY_MINUTES = "minutes";
    
    42
    +    public static final String PROPERTY_VALUE_IS_ADJUSTING = "valueIsAdjusting";
    
    43
    +    /**
    
    44
    +     * State to be able to custom the model. will be pass to {@code false} by the {@link UnlimitedTimeEditorHandler#init(UnlimitedTimeEditor)}.
    
    45
    +     */
    
    46
    +    protected final boolean fillState = true;
    
    47
    +    /**
    
    48
    +     * Optional bean where to push back dates.
    
    49
    +     */
    
    50
    +    protected Object bean;
    
    51
    +    /**
    
    52
    +     * Optional bean property where to push back the time date.
    
    53
    +     */
    
    54
    +    protected String propertyTime;
    
    55
    +    /**
    
    56
    +     * Time in minutes.
    
    57
    +     */
    
    58
    +    protected Integer time = null;
    
    59
    +    /**
    
    60
    +     * To stop propagate events when we are doing some modifications on the model.
    
    61
    +     */
    
    62
    +    protected boolean valueIsAdjusting;
    
    63
    +
    
    64
    +    public String getPropertyTime() {
    
    65
    +        return propertyTime;
    
    66
    +    }
    
    67
    +
    
    68
    +    public void setPropertyTime(String propertyTime) {
    
    69
    +        Preconditions.checkState(fillState, "cant change *propertyTimeDate* property once the fillState is off.");
    
    70
    +        this.propertyTime = propertyTime;
    
    71
    +    }
    
    72
    +
    
    73
    +    @Override
    
    74
    +    public Object getBean() {
    
    75
    +        return bean;
    
    76
    +    }
    
    77
    +
    
    78
    +    public void setBean(Object bean) {
    
    79
    +        Preconditions.checkState(fillState, "cant change *bean* property once the fillState is off.");
    
    80
    +        this.bean = bean;
    
    81
    +    }
    
    82
    +
    
    83
    +    public Integer getTime() {
    
    84
    +        return time;
    
    85
    +    }
    
    86
    +
    
    87
    +    public void setTime(Integer time) {
    
    88
    +        if (!isValueIsAdjusting()) {
    
    89
    +            Integer oldHours = getHours();
    
    90
    +            Integer oldMinutes = getMinutes();
    
    91
    +            setTime(getHours(time), getMinutes(time));
    
    92
    +            firePropertyChange(PROPERTY_HOURS, oldHours, getHours());
    
    93
    +            firePropertyChange(PROPERTY_MINUTES, oldMinutes, getMinutes());
    
    94
    +        }
    
    95
    +    }
    
    96
    +
    
    97
    +    public int getHours() {
    
    98
    +        return getHours(time);
    
    99
    +    }
    
    100
    +
    
    101
    +    public void setHours(Integer hour) {
    
    102
    +        if (!isValueIsAdjusting()) {
    
    103
    +            Integer oldValue = getHours();
    
    104
    +            setTime(hour, getMinutes());
    
    105
    +            firePropertyChange(PROPERTY_HOURS, oldValue, hour);
    
    106
    +
    
    107
    +        }
    
    108
    +    }
    
    109
    +
    
    110
    +    public int getMinutes() {
    
    111
    +        return getMinutes(time);
    
    112
    +    }
    
    113
    +
    
    114
    +    public void setMinutes(Integer minutes) {
    
    115
    +        if (!isValueIsAdjusting()) {
    
    116
    +            Integer oldValue = getMinutes();
    
    117
    +            setTime(getHours(), minutes);
    
    118
    +            firePropertyChange(PROPERTY_MINUTES, oldValue, minutes);
    
    119
    +        }
    
    120
    +    }
    
    121
    +
    
    122
    +    public boolean isValueIsAdjusting() {
    
    123
    +        return valueIsAdjusting;
    
    124
    +    }
    
    125
    +
    
    126
    +    public void setValueIsAdjusting(boolean valueIsAdjusting) {
    
    127
    +        boolean oldValue = isValueIsAdjusting();
    
    128
    +        this.valueIsAdjusting = valueIsAdjusting;
    
    129
    +        fireValueIsAdjusting(oldValue);
    
    130
    +    }
    
    131
    +
    
    132
    +    public int getHours(Integer time) {
    
    133
    +        return time == null ? 0 : time / 60;
    
    134
    +    }
    
    135
    +
    
    136
    +    public int getMinutes(Integer time) {
    
    137
    +        return time == null ? 0 : time % 60;
    
    138
    +    }
    
    139
    +
    
    140
    +    protected void setTime(Integer hour, Integer minute) {
    
    141
    +        Integer oldTime = getTime();
    
    142
    +        setValueIsAdjusting(true);
    
    143
    +        try {
    
    144
    +            if (hour == null || minute == null) {
    
    145
    +                this.time = null;
    
    146
    +            } else {
    
    147
    +                this.time = hour * 60 + minute;
    
    148
    +            }
    
    149
    +        } finally {
    
    150
    +            setValueIsAdjusting(false);
    
    151
    +            fireTime(oldTime);
    
    152
    +        }
    
    153
    +    }
    
    154
    +
    
    155
    +    protected void fireTime(Integer oldTime) {
    
    156
    +        firePropertyChange(PROPERTY_TIME, oldTime, getTime());
    
    157
    +    }
    
    158
    +
    
    159
    +    protected void fireValueIsAdjusting(boolean oldValue) {
    
    160
    +        firePropertyChange(PROPERTY_VALUE_IS_ADJUSTING, oldValue, isValueIsAdjusting());
    
    161
    +    }
    
    162
    +
    
    163
    +    protected Predicate<UnlimitedTimeEditorModel> canUpdateBeanValuePredicate() {
    
    164
    +        return input -> !isValueIsAdjusting();
    
    165
    +    }
    
    166
    +}

  • client-core/src/main/java/fr/ird/observe/client/ui/util/time/actions/UnlimitedTimeEditorResetAction.java
    1
    +package fr.ird.observe.client.ui.util.time.actions;
    
    2
    +
    
    3
    +/*-
    
    4
    + * #%L
    
    5
    + * ObServe :: Client core
    
    6
    + * %%
    
    7
    + * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io
    
    8
    + * %%
    
    9
    + * This program is free software: you can redistribute it and/or modify
    
    10
    + * it under the terms of the GNU General Public License as
    
    11
    + * published by the Free Software Foundation, either version 3 of the
    
    12
    + * License, or (at your option) any later version.
    
    13
    + *
    
    14
    + * This program is distributed in the hope that it will be useful,
    
    15
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17
    + * GNU General Public License for more details.
    
    18
    + *
    
    19
    + * You should have received a copy of the GNU General Public
    
    20
    + * License along with this program.  If not, see
    
    21
    + * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    22
    + * #L%
    
    23
    + */
    
    24
    +
    
    25
    +import fr.ird.observe.client.ui.util.time.UnlimitedTimeEditor;
    
    26
    +import org.nuiton.jaxx.runtime.swing.SwingUtil;
    
    27
    +import org.nuiton.jaxx.runtime.swing.action.JComponentActionSupport;
    
    28
    +
    
    29
    +import java.awt.event.ActionEvent;
    
    30
    +
    
    31
    +import static io.ultreia.java4all.i18n.I18n.n;
    
    32
    +
    
    33
    +/**
    
    34
    + * Created on 20/01/2021.
    
    35
    + *
    
    36
    + * @author Tony Chemit - dev@tchemit.fr
    
    37
    + * @since 7.6.7
    
    38
    + */
    
    39
    +public class UnlimitedTimeEditorResetAction extends JComponentActionSupport<UnlimitedTimeEditor> {
    
    40
    +
    
    41
    +    public UnlimitedTimeEditorResetAction() {
    
    42
    +        super(null, n("DateTimeEditor.action.reset.tip"), "combobox-reset", SwingUtil.findKeyStroke("beancombobox.reset", "ctrl pressed D"));
    
    43
    +    }
    
    44
    +
    
    45
    +    @Override
    
    46
    +    protected void doActionPerformed(ActionEvent e, UnlimitedTimeEditor ui) {
    
    47
    +        ui.reset();
    
    48
    +    }
    
    49
    +
    
    50
    +    @Override
    
    51
    +    public void init() {
    
    52
    +        defaultInit(ui.getInputMap(UnlimitedTimeEditor.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT), ui.getActionMap());
    
    53
    +    }
    
    54
    +}

  • observe-i18n/src/main/i18n/translations/observe_en_GB.properties
    1 1
     ClientConfig.description=ObServe configuration
    
    2 2
     ObserveWebApplicationConfig.description=ObServe Web configuration
    
    3
    +TimeEditor.H=H
    
    3 4
     observe.action.about=About
    
    4 5
     observe.action.about.tip=About ObServe...
    
    5 6
     observe.action.admin.cancel=Cancel wizard
    

  • observe-i18n/src/main/i18n/translations/observe_es_ES.properties
    1 1
     ClientConfig.description=Configuración de ObServe
    
    2 2
     ObserveWebApplicationConfig.description=Configuración de Observe web
    
    3
    +TimeEditor.H=H
    
    3 4
     observe.action.about=Acerca de
    
    4 5
     observe.action.about.tip=Acerca de ObServe...
    
    5 6
     observe.action.admin.cancel=Anular el asistente
    

  • observe-i18n/src/main/i18n/translations/observe_fr_FR.properties
    1 1
     ClientConfig.description=Configuration d'ObServe
    
    2 2
     ObserveWebApplicationConfig.description=Observe web Configuration
    
    3
    +TimeEditor.H=H
    
    3 4
     observe.action.about=À propos
    
    4 5
     observe.action.about.tip=À propos d'ObServe...
    
    5 6
     observe.action.admin.cancel=Annulation de l'assistant