Project

General

Profile

« Previous | Next » 

Revision e5d18094

Added by Katja Luther about 5 years ago

ref #8136: move not designated checkbox

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CheckboxElement.java
131 131
	/** {@inheritDoc} */
132 132
	@Override
133 133
	public void setBackground(Color color) {
134
		checkbox.setBackground(color);
134
	    if (checkbox.isDisposed()){
135
	        return;
136
	    }
137
	    checkbox.setBackground(color);
135 138
		if (label != null) {
136 139
            label.setBackground(color);
137 140
        }
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/AbstractTypeDesignationElement.java
70 70

  
71 71
	    if (this.entity != null && this.entity.isLectoType()){
72 72
	        if (selection_reference == null){
73
	            removeNotDesignatedControls();
73 74
    	        selection_reference = formFactory
74 75
                        .createSelectionElement(Reference.class, formElement, "Status Reference",
75 76
                                entity.getCitation(), EntitySelectionElement.ALL, SWT.NULL);
76 77

  
77 78
                text_referenceDetail = formFactory.createTextWithLabelElement(
78 79
                    formElement, "Status Reference Detail", entity.getCitationMicroReference(), SWT.NULL);
80
                checkbox_notDesignated = formFactory.createCheckbox(formElement, "Not Designated", entity.isNotDesignated(), SWT.NONE);
79 81
	        }
80 82
        }else{
81 83
            if (selection_reference != null){
......
139 141
          }
140 142
        }
141 143

  
144
    }
145

  
146
    public void removeNotDesignatedControls(){
147
        for (Iterator<ICdmFormElement> iterator = getElements().iterator();iterator.hasNext();) {
148
            ICdmFormElement childElement = iterator.next();
149
            // recursion
150
           if (childElement instanceof CheckboxElement && ((CheckboxElement)childElement).equals(this.checkbox_notDesignated)) {
151
                childElement.removeElements();
152

  
153
                // unregister selection arbitrator
154
                if(childElement instanceof ISelectableElement){
155
                    SelectionArbitrator selectionArbitrator = ((ISelectableElement) childElement).getSelectionArbitrator();
156
                    if(selectionArbitrator != null){
157
                        formFactory.destroySelectionArbitrator(selectionArbitrator);
158
                    }
159
                }
160

  
161
                // unregister from property changes
162
                formFactory.removePropertyChangeListener(childElement);
163
                checkbox_notDesignated = null;
164
           }
165

  
166
        }
167

  
142 168
    }
143 169
    @Override
144 170
    public void handleEvent(Object eventSource) {
......
150 176
            getEntity().setCitationMicroReference(text_referenceDetail.getText());
151 177
            setEntity(entity);
152 178
        }
179
        if (eventSource == checkbox_notDesignated) {
180
            getEntity().setNotDesignated(checkbox_notDesignated.getSelection());
181
        }
153 182
    }
154 183

  
155 184
}

Also available in: Unified diff