Project

General

Profile

« Previous | Next » 

Revision 9cd8700e

Added by Andreas Kohlbecker over 5 years ago

ref #7547 ref #7554 list entry buttons enablement uses sharedState.readonly and ignores datasource readonly

View differences:

src/main/java/eu/etaxonomy/vaadin/component/ToManyRelatedEntitiesListSelect.java
455 455
                // edit
456 456
                Button editCreateButton = ((Button)buttonGroup.getComponent(0));
457 457
                editCreateButton.setDescription(field.getValue() == null ? "New" : "Edit");
458
                editCreateButton.setEnabled(!isReadOnly() && (field.getValue() == null
458
                editCreateButton.setEnabled(!getState().readOnly && (field.getValue() == null
459 459
                        || field.getValue() != null && testEditButtonPermission(field.getValue())));
460 460
            }
461 461
            // add
462
            buttonGroup.getComponent(addButtonIndex).setEnabled(!isReadOnly() && (isLast || isOrderedCollection));
462
            buttonGroup.getComponent(addButtonIndex).setEnabled(!getState().readOnly && (isLast || isOrderedCollection));
463 463
            // remove
464 464
            // can be always true, removing the last entry causes an new empty entry to be added.
465
            buttonGroup.getComponent(addButtonIndex + 1).setEnabled(!isReadOnly());
465
            buttonGroup.getComponent(addButtonIndex + 1).setEnabled(!getState().readOnly);
466 466
            // up
467 467
            if(isOrderedCollection && buttonGroup.getComponentCount() >  addButtonIndex + 2){
468
                buttonGroup.getComponent(addButtonIndex + 2).setEnabled(!isReadOnly() && !isFirst);
468
                buttonGroup.getComponent(addButtonIndex + 2).setEnabled(!getState().readOnly && !isFirst);
469 469
                // down
470
                buttonGroup.getComponent(addButtonIndex + 3).setEnabled(!isReadOnly()  && !isLast);
470
                buttonGroup.getComponent(addButtonIndex + 3).setEnabled(!getState().readOnly  && !isLast);
471 471
            }
472 472
        }
473 473
    }
......
684 684
        updateButtonStates();
685 685
    }
686 686

  
687

  
687 688
    /**
688 689
     * @return the editPermissionTester
689 690
     */

Also available in: Unified diff