Project

General

Profile

« Previous | Next » 

Revision 1fc42b13

Added by Andreas Kohlbecker over 5 years ago

ref #7566 solving problem with unselectable entities due to eagerly selection clearing in updateToolBarButtonStates()

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/component/common/TeamOrPersonField.java
78 78

  
79 79
    private BeanFieldGroup<Team> fieldGroup  = new BeanFieldGroup<>(Team.class);
80 80

  
81
    private CdmFilterablePagingProvider<AgentBase, Person> pagingProviderPerson;
82

  
83 81
    private TeamOrPersonBaseCaptionGenerator.CacheType cacheType;
84 82

  
85 83
    protected List<Component> editorComponents = Arrays.asList(removeButton, personButton, teamButton, teamOrPersonSelect);
......
119 117
    protected Component initContent() {
120 118

  
121 119
        teamOrPersonSelect.addValueChangeListener(e -> {
120
            teamOrPersonSelect.refresh();
122 121
            setValue(teamOrPersonSelect.getValue(), false, true);
123
            updateToolBarButtonStates();
124 122
        });
125 123
        teamOrPersonSelect.setWidthUndefined();
126 124

  
127 125
        removeButton.addClickListener(e -> {
126
            teamOrPersonSelect.clear();
128 127
            setValue(null, false, true);
129
            updateToolBarButtonStates();
130 128
        });
131 129
        removeButton.setDescription("Remove");
132 130

  
......
162 160
    }
163 161

  
164 162
    private void updateToolBarButtonStates(){
163

  
165 164
        TeamOrPersonBase<?> val = getInternalValue();
166 165
        boolean userCanCreate = UserHelperAccess.userHelper().userHasPermission(Person.class, "CREATE");
167 166

  
168 167
        teamOrPersonSelect.setVisible(val == null);
169
        if(teamOrPersonSelect.getValue() != val){
170
            teamOrPersonSelect.clear();
171
        }
172 168
        removeButton.setVisible(val != null);
173 169
        personButton.setEnabled(userCanCreate && val == null);
174 170
        teamButton.setEnabled(userCanCreate && val == null);

Also available in: Unified diff