Project

General

Profile

« Previous | Next » 

Revision a8ce6934

Added by Andreas Kohlbecker almost 6 years ago

consistent readonly state of TeamOrPersonField in TaxonNameEditor

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/component/common/TeamOrPersonField.java
390 390
    public void setEditorReadOnly(boolean readOnly) {
391 391
        super.setReadOnly(readOnly);
392 392
        for(Component c : editorComponents){
393
            c.setReadOnly(readOnly);
393
            applyReadOnlyState(c, readOnly);
394 394
        }
395 395

  
396 396
    }
src/main/java/eu/etaxonomy/vaadin/component/CompositeCustomField.java
222 222
            return;
223 223
        }
224 224

  
225
        component.setReadOnly(readOnly);
226
        if(Button.class.isAssignableFrom(component.getClass())){
227
            component.setEnabled(!readOnly);
228
        }
225
        applyReadOnlyState(component, readOnly);
229 226
        if(HasComponents.class.isAssignableFrom(component.getClass())){
230 227
            for(Component nestedComponent : ((HasComponents)component)){
231 228
                setDeepReadOnly(readOnly, nestedComponent, ignore);
......
233 230
        }
234 231
    }
235 232

  
233
    /**
234
     * Sets the readonly state for the component but treats Buttons differently.
235
     * Buttons are also set to disabled to make them inactive.
236

  
237
     * @param readOnly
238
     * @param component
239
     */
240
    protected void applyReadOnlyState(Component component, boolean readOnly) {
241
        component.setReadOnly(readOnly);
242
        if(Button.class.isAssignableFrom(component.getClass())){
243
            component.setEnabled(!readOnly);
244
        }
245
    }
246

  
236 247
    @Override
237 248
    public String toString(){
238 249
        return this.getClass().getSimpleName() + ": " +

Also available in: Unified diff