Project

General

Profile

« Previous | Next » 

Revision 2dd23a3c

Added by Andreas Kohlbecker about 6 years ago

ref #6871 adding button for validations

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/view/name/TaxonNamePopupEditor.java
50 50

  
51 51
    private final static int GRID_COLS = 4;
52 52

  
53
    private final static int GRID_ROWS = 12;
53
    private final static int GRID_ROWS = 13;
54 54

  
55 55
    private static final boolean HAS_BASIONYM_DEFAULT = false;
56 56

  
......
78 78

  
79 79
    private CheckBox basionymToggle;
80 80

  
81
    private CheckBox validationToggle;
82

  
81 83
    private ListSelect rankSelect;
82 84

  
83 85
    private TeamOrPersonField combinationAuthorshipField;
......
213 215
        basionymToggle.setStyleName(getDefaultComponentStyles());
214 216
        grid.addComponent(basionymToggle, 2, row, 3, row);
215 217
        grid.setComponentAlignment(basionymToggle, Alignment.BOTTOM_LEFT);
218

  
219
        row++;
220
        validationToggle = new CheckBox("With validation");
221
        validationToggle.addValueChangeListener(e -> {
222
                boolean enable = e.getProperty().getValue() != null && (Boolean)e.getProperty().getValue();
223
                exCombinationAuthorshipField.setVisible(enable);
224
            });
225
        grid.addComponent(validationToggle, 2, row, 3, row);
226
        grid.setComponentAlignment(validationToggle, Alignment.BOTTOM_LEFT);
227

  
216 228
        row++;
217 229
        // fullTitleCache
218 230
        fullTitleCacheFiled = addSwitchableTextField("Full title cache", "fullTitleCache", "protectedFullTitleCache", 0, row, GRID_COLS-1, row);
......
328 340
        if(taxonName != null){
329 341
            if(modesActive.contains(TaxonNamePopupEditorMode.suppressReplacementAuthorshipData)){
330 342
                basionymAuthorshipField.setVisible(taxonName.getBasionymAuthorship() != null);
343
                exBasionymAuthorshipField.setVisible(taxonName.getExBasionymAuthorship() != null);
331 344
            }
332 345
            updateFieldVisibility(taxonName.getRank());
333 346
        }
......
354 367
                || taxonName.getBasionymAuthorship() != null
355 368
                || taxonName.getExBasionymAuthorship() != null;
356 369
        basionymToggle.setValue(showBasionymSection);
370
        basionymToggle.setReadOnly(showBasionymSection);
371

  
372
        boolean showExAuthors = taxonName.getExCombinationAuthorship() != null;
373
        validationToggle.setValue(showExAuthors);
374
        validationToggle.setReadOnly(showExAuthors);
357 375

  
358 376
        if(isModeEnabled(TaxonNamePopupEditorMode.suppressReplacementAuthorshipData)){
359 377
            combinationAuthorshipField.setVisible(taxonName.getCombinationAuthorship() != null);
......
461 479
        return basionymToggle;
462 480
    }
463 481

  
482
    /**
483
     * {@inheritDoc}
484
     */
485
    @Override
486
    public void setReadOnly(boolean readOnly) {
487
        boolean basionymToggleReadonly = basionymToggle.isReadOnly();
488
        boolean validationToggleReadonly = validationToggle.isReadOnly();
489
        super.setReadOnly(readOnly);
490
        // preserve old readonly states if they were true
491
        if(basionymToggleReadonly){
492
            basionymToggle.setReadOnly(true);
493
        }
494
        if(validationToggleReadonly){
495
            validationToggle.setReadOnly(true);
496
        }
497
    }
498

  
499

  
500

  
464 501

  
465 502
}

Also available in: Unified diff