Project

General

Profile

« Previous | Next » 

Revision 36632b22

Added by Katja Luther about 5 years ago

ref #8223: disable name/taxon if existing taxon/name is selected

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/TaxonNodeDetailElement.java
107 107
//    				.createSelectionElement(Classification.class,//getConversationHolder(),
108 108
//    				        formElement, "Classification",
109 109
//    						null, EntitySelectionElement.DELETABLE, style);
110

  
110 111
    		selection_parentTaxonNode = formFactory
111 112
    				.createTaxonNodeSelectionElement(getConversationHolder(), formElement, "Parent", parentTreeNode,
112 113
    						EntitySelectionElement.DELETABLE, style);
113 114

  
115

  
116

  
117
    		selection_Ref = formFactory
118
                    .createSelectionElement(Reference.class,
119
                            formElement, "Parent Child Relation Source", null,
120
                            EntitySelectionElement.DELETABLE, style);
121

  
122

  
123
            microReference = formFactory.createTextWithLabelElement(formElement,"Detail", "", style);
124
            microReference.setText(getEntity().getMicroReference());
125

  
114 126
    		selection_reuseExistingTaxon = formFactory
115 127
    				.createSelectionElement(Taxon.class,//getConversationHolder(),
116 128
    				        formElement,
......
135 147

  
136 148
    		}
137 149
	    }else{
138
	        TextWithLabelElement textClassification = formFactory.createTextWithLabelElement(formElement,"Classification", entity.getClassification().getTitleCache(), style);
139
	        textClassification.setEnabled(false);
140

  
150
	        if (entity.getParent().getTaxon() == null){
151
	            TextWithLabelElement textParent = formFactory.createTextWithLabelElement(formElement,"Classification", entity.getClassification().getTitleCache(), style);
152
                textParent.setEnabled(false);
153
	        }else{
154
	            TextWithLabelElement textParent = formFactory.createTextWithLabelElement(formElement,"Parent", entity.getParent().getTaxon().getTitleCache(), style);
155
	            textParent.setEnabled(false);
156
	        }
141 157
//	        TextWithLabelElement textTaxon = formFactory.createTextWithLabelElement(formElement,"Taxon", taxon.getTitleCache(), style);
142 158
//	        textTaxon.setEnabled(false);
143 159

  
......
157 173

  
158 174
	    }
159 175

  
160
	    selection_Ref = formFactory
161
                .createSelectionElement(Reference.class,//getConversationHolder(),
162
                        formElement, "Parent Child Relation Source", null,
163
                        EntitySelectionElement.DELETABLE, style);
164
        microReference = formFactory.createTextWithLabelElement(formElement,"Detail", "", style);
165
        microReference.setText(getEntity().getMicroReference());
176

  
166 177
        if (!isCreateNew()){
167
            selection_Ref.setEntity(entity.getReference());
178
            if (entity.getReference() != null){
179
                selection_Ref.setEntity(entity.getReference());
180
            }
168 181
        }
169 182
        parentTreeNode = entity.getParent();
170 183

  
......
225 238
		    selectionNodeAgentRelation.setEntity(entity);
226 239
		    selectionNodeAgentRelation.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
227 240
		}
228
//		checkbox_openInEditor = formFactory.createCheckbox(formElement,
229
//		        "Open in Editor", true, style);
230
//		setOpenInEditor(true);
241

  
231 242
	}
232 243

  
233 244
	private void preFillTaxonName() {
......
283 294
		        }
284 295
		        checkbox_publish.setSelected(getTaxon().isPublish());
285 296
            }
297
		    boolean enabled = selection_reuseExistingTaxon.getEntity() == null;
298
		    if (selection_reuseExistingName != null){
299
		        selection_reuseExistingName.setEnabled(enabled);
300
            }
301
	        textNewTaxonName.setEnabled(enabled);
286 302
			complete = true;
287 303
		} else if (eventSource == selection_reuseExistingName) {
288 304
		    boolean enabled = selection_reuseExistingName.getEntity() == null;
......
339 355
		return classification;
340 356
	}
341 357

  
342
//	public boolean isOpenInEditor() {
343
//		return openInEditor;
344
//	}
358

  
345 359

  
346 360
	public ITaxonTreeNode getParentTreeNode() {
347 361
		return parentTreeNode;

Also available in: Unified diff