Revision 05dc6688
Added by Alex Theys almost 12 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/userecords/UseRecordDetailElement.java | ||
---|---|---|
5 | 5 |
import java.util.List; |
6 | 6 |
import java.util.Map; |
7 | 7 |
import java.util.Set; |
8 |
import java.util.UUID; |
|
9 |
|
|
10 | 8 |
import org.apache.log4j.Logger; |
11 | 9 |
import org.eclipse.swt.events.SelectionEvent; |
12 | 10 |
import org.eclipse.swt.events.SelectionListener; |
13 |
import org.eclipse.ui.forms.widgets.Section; |
|
14 |
|
|
15 |
import eu.etaxonomy.cdm.api.service.IMarkerService; |
|
16 |
import eu.etaxonomy.cdm.api.service.IService; |
|
17 |
import eu.etaxonomy.cdm.api.service.ITermService; |
|
18 |
import eu.etaxonomy.cdm.api.service.IVocabularyService; |
|
19 |
import eu.etaxonomy.cdm.model.common.DefinedTermBase; |
|
20 | 11 |
import eu.etaxonomy.cdm.model.common.Language; |
21 | 12 |
import eu.etaxonomy.cdm.model.common.LanguageString; |
22 | 13 |
import eu.etaxonomy.cdm.model.common.Marker; |
23 |
import eu.etaxonomy.cdm.model.common.MarkerType; |
|
24 |
import eu.etaxonomy.cdm.model.common.TermVocabulary; |
|
25 | 14 |
import eu.etaxonomy.cdm.model.description.CategoricalData; |
26 |
import eu.etaxonomy.cdm.model.description.DescriptionElementBase; |
|
27 | 15 |
import eu.etaxonomy.cdm.model.description.Modifier; |
28 | 16 |
import eu.etaxonomy.cdm.model.description.State; |
29 | 17 |
import eu.etaxonomy.cdm.model.description.StateData; |
30 |
import eu.etaxonomy.cdm.remote.controller.VocabularyController; |
|
31 | 18 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
32 |
import eu.etaxonomy.taxeditor.store.TermManager; |
|
33 | 19 |
import eu.etaxonomy.taxeditor.store.TermStore; |
34 | 20 |
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement; |
35 | 21 |
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; |
36 |
import eu.etaxonomy.taxeditor.ui.element.CheckboxElement; |
|
37 | 22 |
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; |
38 |
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EntityDetailType; |
|
39 | 23 |
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; |
40 | 24 |
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailElement; |
41 |
import eu.etaxonomy.taxeditor.ui.section.description.StateDataSection; |
|
42 |
import eu.etaxonomy.taxeditor.ui.section.description.detail.AbstractDetailedDescriptionDetailElement; |
|
43 | 25 |
|
44 | 26 |
//public class UseRecordDetailElement extends AbstractDetailedDescriptionDetailElement<CategoricalData> { |
45 | 27 |
public class UseRecordDetailElement extends |
... | ... | |
173 | 155 |
return termsToAdd; |
174 | 156 |
} |
175 | 157 |
|
176 |
private Modifier plantPartSelection() { |
|
177 |
/*if(!getEntity().getModifiers().isEmpty()) { |
|
178 |
for (Modifier modifier : getEntity().getModifiers()) { |
|
179 |
if (modifier.getMarkers() != null) { |
|
180 |
for (Marker marker : modifier.getMarkers()) { |
|
181 |
if(marker.getMarkerType().getTitleCache().equals("Plant Part")) { |
|
182 |
return modifier; |
|
183 |
} |
|
184 |
else { |
|
185 |
return null; |
|
186 |
} |
|
187 |
} |
|
188 |
} |
|
189 |
else { |
|
190 |
return null; |
|
191 |
} |
|
192 |
|
|
193 |
} |
|
194 |
} else { |
|
195 |
return null; |
|
196 |
} |
|
197 |
return null;*/ |
|
198 |
//for testing purposes |
|
199 |
int countMods = 0; |
|
200 |
Modifier modiftoreturn = Modifier.NewInstance(); |
|
201 |
if (!getEntity().getModifiers().isEmpty()) { |
|
202 |
for (Modifier modifier : getEntity().getModifiers()){ |
|
203 |
if(countMods == 0) { |
|
204 |
modiftoreturn = modifier; |
|
205 |
} |
|
206 |
countMods++; |
|
207 |
} |
|
208 |
return modiftoreturn; |
|
209 |
} |
|
210 |
return null; |
|
211 |
|
|
212 |
} |
|
213 |
|
|
214 |
private Modifier countrySelection() { |
|
215 |
/*if(!getEntity().getModifiers().isEmpty()) { |
|
216 |
for (Modifier modifier : getEntity().getModifiers()) { |
|
217 |
if (modifier.getMarkers() != null) { |
|
218 |
for (Marker marker : modifier.getMarkers()) { |
|
219 |
if(marker.getMarkerType().getTitleCache().equals("Country")) { |
|
220 |
return modifier; |
|
221 |
} |
|
222 |
else { |
|
223 |
return null; |
|
224 |
} |
|
225 |
} |
|
226 |
} |
|
227 |
else { |
|
228 |
return null; |
|
229 |
} |
|
230 |
|
|
231 |
} |
|
232 |
} else { |
|
233 |
return null; |
|
234 |
} |
|
235 |
return null;*/ |
|
236 |
//for testing purposes |
|
237 |
int countMods = 0; |
|
238 |
Modifier modiftoreturn = Modifier.NewInstance(); |
|
239 |
if (!getEntity().getModifiers().isEmpty()) { |
|
240 |
for (Modifier modifier : getEntity().getModifiers()){ |
|
241 |
if(countMods == 1) { |
|
242 |
modiftoreturn = modifier; |
|
243 |
} |
|
244 |
countMods++; |
|
245 |
} |
|
246 |
return modiftoreturn; |
|
247 |
} |
|
248 |
return null; |
|
249 |
} |
|
250 |
|
|
251 |
private Modifier humanGroupSelection() { |
|
252 |
/*if(!getEntity().getModifiers().isEmpty()) { |
|
253 |
for (Modifier modifier : getEntity().getModifiers()) { |
|
254 |
if (modifier.getMarkers() != null) { |
|
255 |
for (Marker marker : modifier.getMarkers()) { |
|
256 |
if(marker.getMarkerType().getTitleCache().equals("Human Group")) { |
|
257 |
return modifier; |
|
258 |
} |
|
259 |
else { |
|
260 |
return null; |
|
261 |
} |
|
262 |
} |
|
263 |
} |
|
264 |
else { |
|
265 |
return null; |
|
266 |
} |
|
267 |
|
|
268 |
} |
|
269 |
} else { |
|
270 |
return null; |
|
271 |
} |
|
272 |
return null;*/ |
|
273 |
//for testing purposes |
|
274 |
int countMods =0; |
|
275 |
Modifier modiftoreturn = Modifier.NewInstance(); |
|
276 |
if (!getEntity().getModifiers().isEmpty()) { |
|
277 |
for (Modifier modifier : getEntity().getModifiers()){ |
|
278 |
if (countMods == 2) { |
|
279 |
modiftoreturn = modifier; |
|
280 |
} |
|
281 |
countMods++; |
|
282 |
} |
|
283 |
return modiftoreturn; |
|
284 |
} |
|
285 |
return null; |
|
286 |
} |
|
287 |
|
|
288 |
private Modifier ethnicGroupSelection() { |
|
289 |
/*if(!getEntity().getModifiers().isEmpty()) { |
|
290 |
for (Modifier modifier : getEntity().getModifiers()) { |
|
291 |
if (modifier.getMarkers() != null) { |
|
292 |
for (Marker marker : modifier.getMarkers()) { |
|
293 |
if(marker.getMarkerType().getTitleCache().equals("Human Group")) { |
|
294 |
return modifier; |
|
295 |
} |
|
296 |
else { |
|
297 |
return null; |
|
298 |
} |
|
299 |
} |
|
300 |
} |
|
301 |
else { |
|
302 |
return null; |
|
303 |
} |
|
304 |
|
|
305 |
} |
|
306 |
} else { |
|
307 |
return null; |
|
308 |
} |
|
309 |
return null;*/ |
|
310 |
//for testing purposes |
|
311 |
int countMods =0; |
|
312 |
Modifier modiftoreturn = Modifier.NewInstance(); |
|
313 |
if (!getEntity().getModifiers().isEmpty()) { |
|
314 |
for (Modifier modifier : getEntity().getModifiers()){ |
|
315 |
if (countMods == 3) { |
|
316 |
modiftoreturn = modifier; |
|
317 |
} |
|
318 |
countMods++; |
|
319 |
} |
|
320 |
return modiftoreturn; |
|
321 |
} |
|
322 |
return null; |
|
323 |
} |
|
324 |
|
|
325 |
private State useCategorySelection() { |
|
326 |
/*if (!getEntity().getStates().isEmpty()) { |
|
327 |
for (StateData statedata : getEntity().getStates()) { |
|
328 |
if (statedata.getModifyingText().get(CdmStore.getDefaultLanguage()) != null) { |
|
329 |
if(statedata.getModifyingText().get(CdmStore.getDefaultLanguage()).getText() == "Use Category") { |
|
330 |
if(statedata.getState() !=null) { |
|
331 |
return statedata.getState(); |
|
332 |
} |
|
333 |
} |
|
334 |
} |
|
335 |
} |
|
336 |
} |
|
337 |
else { |
|
338 |
return null; |
|
339 |
} |
|
340 |
return null;*/ |
|
341 |
//for testing purposes |
|
342 |
int countStates =0; |
|
343 |
for (StateData state : getEntity().getStates()) { |
|
344 |
if (countStates == 0) { |
|
345 |
return state.getState(); |
|
346 |
} |
|
347 |
countStates++; |
|
348 |
} |
|
349 |
return null; |
|
350 |
} |
|
351 |
|
|
352 |
|
|
353 |
|
|
354 |
private State useSubCategorySelection() { |
|
355 |
/*if (!getEntity().getStates().isEmpty() && combo_UseCategory.getSelection() != null) { |
|
356 |
for (StateData statedata : getEntity().getStates()) { |
|
357 |
if (stateData.getModifyingText().get(CdmStore.getDefaultLanguage()) != null) { |
|
358 |
if(statedata.getModifyingText().get(CdmStore.getDefaultLanguage()).getText() == "Use SubCategory") { |
|
359 |
if(statedata.getState() !=null) { |
|
360 |
return statedata.getState(); |
|
361 |
} |
|
362 |
|
|
363 |
} |
|
364 |
} |
|
365 |
} |
|
366 |
} |
|
367 |
else { |
|
368 |
return null; |
|
369 |
} |
|
370 |
return null;*/ |
|
371 |
//for testing purposes |
|
372 |
int countStates =0; |
|
373 |
for (StateData state : getEntity().getStates()) { |
|
374 |
if ((countStates == 1)) { |
|
375 |
return state.getState(); |
|
376 |
} |
|
377 |
countStates++; |
|
378 |
} |
|
379 |
return null; |
|
380 |
|
|
381 |
} |
|
382 |
|
|
383 |
|
|
384 |
|
|
385 |
|
|
386 |
private List<Modifier> setPlantPartsComboTerms(List<Modifier> listOfTerms) { |
|
387 |
List<Modifier> termsToAdd = new ArrayList<Modifier>(); |
|
388 |
for (Modifier term : listOfTerms) { |
|
389 |
|
|
390 |
if ((term.getPartOf() != null) && (term.getPartOf().getTitleCache().equals("Plant Part"))) { |
|
391 |
termsToAdd.add(term); |
|
392 |
} |
|
393 |
else if ((term.getVocabulary() != null) && (term.getVocabulary().getTitleCache().equals("Plant Part"))) { |
|
394 |
termsToAdd.add(term); |
|
395 |
} |
|
396 |
} |
|
397 |
|
|
398 |
return termsToAdd; |
|
399 |
} |
|
400 |
|
|
401 |
private List<Modifier> setCountryComboTerms(List <Modifier> listOfTerms) { |
|
402 |
List<Modifier> termsToAdd = new ArrayList<Modifier>(); |
|
403 |
for (Modifier term : listOfTerms) { |
|
404 |
|
|
405 |
if ((term.getPartOf() != null) && (term.getPartOf().getTitleCache().equals("Country"))) { |
|
406 |
termsToAdd.add(term); |
|
407 |
} |
|
408 |
else if ((term.getVocabulary() != null) && (term.getVocabulary().getTitleCache().equals("Country"))) { |
|
409 |
termsToAdd.add(term); |
|
410 |
} |
|
411 |
} |
|
412 |
|
|
413 |
return termsToAdd; |
|
414 |
} |
|
415 | 158 |
|
416 | 159 |
|
417 | 160 |
private List<State> setUseCategoryComboTerms(List<State> listOfTerms) { |
... | ... | |
507 | 250 |
return termsToAdd; |
508 | 251 |
} |
509 | 252 |
|
510 |
|
|
511 |
private List<Modifier> setHumanGroupComboTerms(List<Modifier> listOfTerms) { |
|
512 |
List<Modifier> termsToAdd = new ArrayList<Modifier>(); |
|
513 |
for (Modifier term : listOfTerms) { |
|
514 |
|
|
515 |
if ((term.getPartOf() != null) && (term.getPartOf().getTitleCache().equals("Human Group"))) { |
|
516 |
termsToAdd.add(term); |
|
517 |
} |
|
518 |
else if ((term.getVocabulary() != null) && (term.getPartOf() == null) && (term.getVocabulary().getTitleCache().equals("Human Group"))) { |
|
519 |
termsToAdd.add(term); |
|
520 |
} |
|
521 |
} |
|
522 |
|
|
523 |
return termsToAdd; |
|
524 |
} |
|
525 |
|
|
526 |
|
|
527 | 253 |
/** {@inheritDoc} */ |
528 | 254 |
@Override |
529 | 255 |
public void handleEvent(Object eventSource) { |
... | ... | |
551 | 277 |
getEntity().addState(stateData); |
552 | 278 |
isChanged = true; |
553 | 279 |
} |
554 |
/*else { |
|
555 |
StateData stateData = StateData |
|
556 |
.NewInstance(combo_UseCategory.getSelection()); |
|
557 |
stateData.setState(combo_UseCategory.getSelection()); |
|
558 |
//stateData.addModifyingText("Use Category", CdmStore.getDefaultLanguage()); |
|
559 |
stateData.putModifyingText(CdmStore.getDefaultLanguage(),"Use Category"); |
|
560 |
getEntity().addState(stateData); |
|
561 |
} |
|
562 |
|
|
563 |
} else { |
|
564 |
StateData stateData = StateData |
|
565 |
.NewInstance(combo_UseCategory.getSelection()); |
|
566 |
stateData.setState(combo_UseCategory.getSelection()); |
|
567 |
//stateData.addModifyingText("Use Category", CdmStore.getDefaultLanguage()); |
|
568 |
stateData.putModifyingText(CdmStore.getDefaultLanguage(), "Use Category"); |
|
569 |
getEntity().addState(stateData); |
|
570 |
}*/ |
|
280 |
|
|
571 | 281 |
} |
572 | 282 |
} |
573 | 283 |
} |
... | ... | |
619 | 329 |
getEntity().addState(stateData); |
620 | 330 |
isChanged = true; |
621 | 331 |
} |
622 |
/*else { |
|
623 |
StateData stateData = StateData |
|
624 |
.NewInstance(combo_UseSubCategory.getSelection()); |
|
625 |
stateData.setState(combo_UseSubCategory.getSelection()); |
|
626 |
//stateData.addModifyingText("Use SubCategory", CdmStore.getDefaultLanguage()); |
|
627 |
stateData.putModifyingText(CdmStore.getDefaultLanguage(),"Use SubCategory"); |
|
628 |
getEntity().addState(stateData); |
|
629 |
} |
|
630 |
|
|
631 |
} else { |
|
632 |
StateData stateData = StateData |
|
633 |
.NewInstance(combo_UseSubCategory.getSelection()); |
|
634 |
stateData.setState(combo_UseSubCategory.getSelection()); |
|
635 |
//stateData.addModifyingText("Use SubCategory", CdmStore.getDefaultLanguage()); |
|
636 |
stateData.putModifyingText(CdmStore.getDefaultLanguage(), "Use SubCategory"); |
|
637 |
getEntity().addState(stateData); |
|
638 |
}*/ |
|
332 |
|
|
639 | 333 |
} |
640 | 334 |
} |
641 | 335 |
} |
... | ... | |
644 | 338 |
StateData stateData = StateData |
645 | 339 |
.NewInstance(combo_UseSubCategory.getSelection()); |
646 | 340 |
stateData.setState(combo_UseSubCategory.getSelection()); |
647 |
//stateData.addModifyingText("Use SubCategory", CdmStore.getDefaultLanguage()); |
|
648 |
//LanguageString languageString = LanguageString.NewInstance("Use SubCategory", CdmStore.getDefaultLanguage()); |
|
649 |
//IService object = (IService) CdmStore.getCurrentApplicationConfiguration().getBean(IService.class.getName()); |
|
650 |
//object.save(languageString); |
|
651 |
//stateData.putModifyingText(languageString); |
|
652 | 341 |
stateData.putModifyingText(CdmStore.getDefaultLanguage(), "Use SubCategory"); |
653 | 342 |
getEntity().addState(stateData); |
654 | 343 |
} |
... | ... | |
680 | 369 |
getEntity().addModifier(combo_PlantPart.getSelection()); |
681 | 370 |
isChanged = true; |
682 | 371 |
} |
683 |
/*if (modifier.getMarkers() != null) { |
|
684 |
for (Marker marker : modifier.getMarkers()) { |
|
685 |
if (marker.getMarkerType().getTitleCache().equals("Plant Part")) { |
|
686 |
getEntity().removeModifier(modifier); |
|
687 |
Modifier plantPart = combo_PlantPart.getSelection(); |
|
688 |
plantPart.addMarker(marker); |
|
689 |
getEntity().addModifier(plantPart); |
|
690 |
isChanged = true; |
|
691 |
//getEntity().addModifier(combo_PlantPart.getSelection()); |
|
692 |
} |
|
693 |
/*else { |
|
694 |
|
|
695 |
Marker markerPlantPart = Marker.NewInstance(markerType, false); |
|
696 |
Modifier plantPart = combo_PlantPart.getSelection(); |
|
697 |
plantPart.addMarker(markerPlantPart); |
|
698 |
getEntity().addModifier(plantPart); |
|
699 |
//getEntity().addModifier(combo_PlantPart.getSelection()); |
|
700 |
} |
|
701 |
|
|
702 |
|
|
703 |
} |
|
704 |
|
|
705 |
} |
|
706 |
/*else { |
|
707 |
//MarkerType markerType = MarkerType.NewInstance("Plant Part", "Plant Part", null); |
|
708 |
Marker marker = Marker.NewInstance(markerType, false); |
|
709 |
Modifier plantPart = combo_PlantPart.getSelection(); |
|
710 |
plantPart.addMarker(marker); |
|
711 |
getEntity().addModifier(plantPart); |
|
712 |
//getEntity().addModifier(combo_PlantPart.getSelection()); |
|
713 |
}*/ |
|
714 |
|
|
372 |
|
|
715 | 373 |
} |
716 | 374 |
} |
717 | 375 |
if(isChanged == false) { |
718 |
//MarkerType markerType = MarkerType.NewInstance("Plant Part", "Plant Part", null); |
|
719 |
//Marker marker = Marker.NewInstance(markerType, false); |
|
720 |
//CdmStore.getService(IMarkerService.class).saveOrUpdate(marker); |
|
376 |
|
|
721 | 377 |
Modifier plantPart = combo_PlantPart.getSelection(); |
722 |
//plantPart.addMarker(marker); |
|
723 |
//CdmStore.getService(ITermService.class).saveOrUpdate(plantPart); |
|
724 | 378 |
getEntity().addModifier(plantPart); |
725 |
|
|
726 |
//getEntity().addModifier(combo_PlantPart.getSelection()); |
|
727 | 379 |
} |
728 | 380 |
} else { |
729 | 381 |
Set<Modifier> modifiers = getEntity().getModifiers(); |
... | ... | |
741 | 393 |
if (eventSource == combo_Country) { |
742 | 394 |
if (combo_Country.getSelection() != null) { |
743 | 395 |
boolean isChanged = false; |
744 |
//MarkerType markerType = MarkerType.NewInstance("Country", "Country", null); |
|
745 | 396 |
Set<Modifier> modifiers = getEntity().getModifiers(); |
746 | 397 |
if(!modifiers.isEmpty()) { |
747 | 398 |
for (Modifier modifier : modifiers) { |
... | ... | |
750 | 401 |
getEntity().addModifier(combo_Country.getSelection()); |
751 | 402 |
isChanged = true; |
752 | 403 |
} |
753 |
/*if (modifier.getMarkers() != null) { |
|
754 |
for (Marker marker : modifier.getMarkers()) { |
|
755 |
if (marker.getMarkerType().getTitleCache().equals("Country")) { |
|
756 |
getEntity().removeModifier(modifier); |
|
757 |
Modifier country = combo_Country.getSelection(); |
|
758 |
country.addMarker(marker); |
|
759 |
getEntity().addModifier(country); |
|
760 |
isChanged = true; |
|
761 |
//getEntity().addModifier(combo_Country.getSelection()); |
|
762 |
} |
|
763 |
/*else { |
|
764 |
|
|
765 |
Marker markerCountry = Marker.NewInstance(markerType, false); |
|
766 |
Modifier country = combo_Country.getSelection(); |
|
767 |
country.addMarker(markerCountry); |
|
768 |
getEntity().addModifier(country); |
|
769 |
//getEntity().addModifier(combo_Country.getSelection()); |
|
770 |
} |
|
771 |
|
|
772 |
|
|
773 |
} |
|
774 |
|
|
775 |
}*/ |
|
776 |
/*else { |
|
777 |
//MarkerType markerType = MarkerType.NewInstance("Country", "Country", null); |
|
778 |
Marker marker = Marker.NewInstance(markerType, false); |
|
779 |
Modifier country = combo_Country.getSelection(); |
|
780 |
country.addMarker(marker); |
|
781 |
getEntity().addModifier(country); |
|
782 |
//getEntity().addModifier(combo_Country.getSelection()); |
|
783 |
}*/ |
|
784 |
|
|
404 |
|
|
785 | 405 |
} |
786 | 406 |
} |
787 | 407 |
if (isChanged == false) { |
788 |
//MarkerType markerType = MarkerType.NewInstance("Country", "Country", null); |
|
789 |
//Marker marker = Marker.NewInstance(markerType, false); |
|
790 | 408 |
Modifier country = combo_Country.getSelection(); |
791 |
//country.addMarker(marker); |
|
792 | 409 |
getEntity().addModifier(country); |
793 |
//getEntity().addModifier(combo_Country.getSelection()); |
|
794 | 410 |
} |
795 | 411 |
} else { |
796 | 412 |
Set<Modifier> modifiers = getEntity().getModifiers(); |
... | ... | |
802 | 418 |
} |
803 | 419 |
} |
804 | 420 |
} |
805 |
|
|
806 | 421 |
} |
807 | 422 |
} |
808 | 423 |
if (eventSource == combo_HumanGroup) { |
809 | 424 |
if (combo_HumanGroup.getSelection() != null) { |
810 | 425 |
boolean isChanged = false; |
811 |
//MarkerType markerType = MarkerType.NewInstance("Human Group", "Human Group", null); |
|
812 | 426 |
Set<Modifier> modifiers = getEntity().getModifiers(); |
813 | 427 |
if(!modifiers.isEmpty()) { |
814 | 428 |
for (Modifier modifier : modifiers) { |
... | ... | |
817 | 431 |
getEntity().addModifier(combo_HumanGroup.getSelection()); |
818 | 432 |
isChanged = true; |
819 | 433 |
} |
820 |
/*if (modifier.getMarkers() != null) { |
|
821 |
for (Marker marker : modifier.getMarkers()) { |
|
822 |
if (marker.getMarkerType().getTitleCache().equals("Human Group")) { |
|
823 |
getEntity().removeModifier(modifier); |
|
824 |
Modifier humanGroup = combo_HumanGroup.getSelection(); |
|
825 |
humanGroup.addMarker(marker); |
|
826 |
getEntity().addModifier(humanGroup); |
|
827 |
isChanged = true; |
|
828 |
//getEntity().addModifier(combo_HumanGroup.getSelection()); |
|
829 |
} |
|
830 |
/*else { |
|
831 |
|
|
832 |
Marker markerHumanGroup = Marker.NewInstance(markerType, false); |
|
833 |
Modifier humanGroup = combo_HumanGroup.getSelection(); |
|
834 |
humanGroup.addMarker(markerHumanGroup); |
|
835 |
getEntity().addModifier(humanGroup); |
|
836 |
//getEntity().addModifier(combo_HumanGroup.getSelection()); |
|
837 |
} |
|
838 |
|
|
839 |
|
|
840 |
} |
|
841 |
|
|
842 |
}*/ |
|
843 |
/*else { |
|
844 |
//MarkerType markerType = MarkerType.NewInstance("Human Group", "Human Group", null); |
|
845 |
Marker marker = Marker.NewInstance(markerType, false); |
|
846 |
Modifier humanGroup = combo_HumanGroup.getSelection(); |
|
847 |
humanGroup.addMarker(marker); |
|
848 |
getEntity().addModifier(humanGroup); |
|
849 |
//getEntity().addModifier(combo_HumanGroup.getSelection()); |
|
850 |
}*/ |
|
851 |
|
|
852 | 434 |
} |
853 | 435 |
} |
854 | 436 |
if(isChanged == false){ |
855 |
//MarkerType markerType = MarkerType.NewInstance("Human Group", "Human Group", null); |
|
856 |
//Marker marker = Marker.NewInstance(markerType, false); |
|
857 | 437 |
Modifier humanGroup = combo_HumanGroup.getSelection(); |
858 |
//humanGroup.addMarker(marker); |
|
859 | 438 |
getEntity().addModifier(humanGroup); |
860 |
//getEntity().addModifier(combo_HumanGroup.getSelection()); |
|
861 | 439 |
} |
862 | 440 |
combo_EthnicGroup.setEnabled(true); |
863 | 441 |
} else { |
... | ... | |
870 | 448 |
itr.remove(); |
871 | 449 |
} |
872 | 450 |
} |
873 |
|
|
874 |
|
|
875 |
/*for (Modifier modifier : modifiers) { |
|
876 |
if(GetVocabularyType(modifier, "Human Group")) { |
|
877 |
getEntity().removeModifier(modifier); |
|
878 |
|
|
879 |
} |
|
880 |
if(GetVocabularyType(modifier, "Ethnic Group")) { |
|
881 |
getEntity().removeModifier(modifier); |
|
882 |
|
|
883 |
} |
|
884 |
}*/ |
|
885 | 451 |
} |
886 | 452 |
List<Modifier> emptyListToResetComboBox = new ArrayList<Modifier>(); |
887 | 453 |
Modifier emptyMod = Modifier.NewInstance(); |
... | ... | |
894 | 460 |
if (eventSource == combo_EthnicGroup) { |
895 | 461 |
if (combo_EthnicGroup.getSelection() != null) { |
896 | 462 |
boolean isChanged = false; |
897 |
//MarkerType markerType = MarkerType.NewInstance("Ethnic Group", "Ethnic Group", null); |
|
898 | 463 |
Set<Modifier> modifiers = getEntity().getModifiers(); |
899 | 464 |
if(!modifiers.isEmpty()) { |
900 | 465 |
for (Modifier modifier : modifiers) { |
... | ... | |
903 | 468 |
getEntity().addModifier(combo_EthnicGroup.getSelection()); |
904 | 469 |
isChanged = true; |
905 | 470 |
} |
906 |
/*if (modifier.getMarkers() != null) { |
|
907 |
for (Marker marker : modifier.getMarkers()) { |
|
908 |
if (marker.getMarkerType().getTitleCache().equals("Ethnic Group")) { |
|
909 |
getEntity().removeModifier(modifier); |
|
910 |
Modifier ethnicGroup = combo_EthnicGroup.getSelection(); |
|
911 |
ethnicGroup.addMarker(marker); |
|
912 |
getEntity().addModifier(ethnicGroup); |
|
913 |
isChanged = true; |
|
914 |
//getEntity().addModifier(combo_EthnicGroup.getSelection()); |
|
915 |
} |
|
916 |
/*else { |
|
917 |
|
|
918 |
Marker markerEthnicGroup = Marker.NewInstance(markerType, false); |
|
919 |
Modifier ethnicGroup = combo_EthnicGroup.getSelection(); |
|
920 |
ethnicGroup.addMarker(markerEthnicGroup); |
|
921 |
getEntity().addModifier(ethnicGroup); |
|
922 |
//getEntity().addModifier(combo_EthnicGroup.getSelection()); |
|
923 |
} |
|
924 |
|
|
925 |
|
|
926 |
} |
|
927 |
|
|
928 |
}*/ |
|
929 |
/*else { |
|
930 |
//MarkerType markerType = MarkerType.NewInstance("Ethnic Group", "Ethnic Group", null); |
|
931 |
Marker marker = Marker.NewInstance(markerType, false); |
|
932 |
Modifier ethnicGroup = combo_EthnicGroup.getSelection(); |
|
933 |
ethnicGroup.addMarker(marker); |
|
934 |
getEntity().addModifier(ethnicGroup); |
|
935 |
//getEntity().addModifier(combo_EthnicGroup.getSelection()); |
|
936 |
}*/ |
|
937 |
|
|
938 | 471 |
} |
939 | 472 |
} |
940 | 473 |
if(isChanged == false) { |
941 |
//MarkerType markerType = MarkerType.NewInstance("Ethnic Group", "Ethnic Group", null); |
|
942 |
//Marker marker = Marker.NewInstance(markerType, false); |
|
943 | 474 |
Modifier ethnicGroup = combo_EthnicGroup.getSelection(); |
944 |
//ethnicGroup.addMarker(marker); |
|
945 | 475 |
getEntity().addModifier(ethnicGroup); |
946 |
//getEntity().addModifier(combo_EthnicGroup.getSelection()); |
|
947 | 476 |
} |
948 | 477 |
} else { |
949 | 478 |
Set<Modifier> modifiers = getEntity().getModifiers(); |
... | ... | |
951 | 480 |
for (Modifier modifier : modifiers) { |
952 | 481 |
if(GetVocabularyType(modifier, "Ethnic Group")) { |
953 | 482 |
getEntity().removeModifier(modifier); |
954 |
|
|
955 | 483 |
} |
956 |
|
|
957 | 484 |
} |
958 | 485 |
} |
959 |
|
|
960 | 486 |
} |
961 | 487 |
} |
962 | 488 |
} |
... | ... | |
973 | 499 |
return false; |
974 | 500 |
} |
975 | 501 |
|
976 |
/*private boolean GetVocabularyType(Modifier term, String level2,String vocabularyExpected) { |
|
977 |
if ((term.getPartOf() != null) && (term.getPartOf().getTitleCache().equals(vocabularyExpected))) { |
|
978 |
return true; |
|
979 |
} |
|
980 |
else if ((term.getVocabulary() != null) && (term.getPartOf() == null) &&(term.getVocabulary().getTitleCache().equals(vocabularyExpected))) { |
|
981 |
return true; |
|
982 |
} |
|
983 |
return false; |
|
984 |
}*/ |
|
502 |
|
|
985 | 503 |
|
986 | 504 |
/** {@inheritDoc} */ |
987 | 505 |
@Override |
988 | 506 |
public void setEntity(CategoricalData entity) { |
989 |
// section_stateData.setEntity(entity); |
|
990 | 507 |
super.setEntity(entity); |
991 | 508 |
} |
992 | 509 |
|
993 | 510 |
@Override |
994 | 511 |
public void widgetSelected(SelectionEvent e) { |
995 | 512 |
Object eventSource = e.getSource(); |
996 |
//This is causing an error on purpose fix the if statement below |
|
997 |
|
|
998 |
//e.getselection(); |
|
999 |
//if(eventSource == combo_UseCategory.getControls()) { |
|
1000 | 513 |
for (Object object: combo_UseCategory.getControls()) { |
1001 | 514 |
if (object == eventSource) { |
1002 | 515 |
State selectedUseCategory = combo_UseCategory.getSelection(); |
... | ... | |
1010 | 523 |
if (modifyingText.get(CdmStore.getDefaultLanguage()) |
1011 | 524 |
.getText() == "Use SubCategory") { |
1012 | 525 |
getEntity().removeState(existingStateData); |
1013 |
//combo_UseSubCategory.setSelected(false); |
|
1014 | 526 |
combo_UseSubCategory.setSelection(null); |
1015 | 527 |
combo_UseSubCategory.getSelection(); |
1016 | 528 |
} |
... | ... | |
1020 | 532 |
|
1021 | 533 |
List<State> newSubCategories = setUseCategoryComboTerms(TermStore.getTerms(State.class, null, false),selectedUseCategory); |
1022 | 534 |
combo_UseSubCategory.setTerms(newSubCategories); |
1023 |
/*State emptyState = State.NewInstance(); |
|
1024 |
combo_UseSubCategory.setSelection(emptyState); |
|
1025 |
combo_UseSubCategory.setSelection(newSubCategories.get(0)); |
|
1026 |
combo_UseSubCategory.setSelection(null);*/ |
|
1027 |
|
|
1028 |
//combo_UseSubCategory.setTerms(newSubCategories); |
|
1029 |
|
|
1030 | 535 |
} |
1031 | 536 |
} |
1032 | 537 |
} |
... | ... | |
1038 | 543 |
} |
1039 | 544 |
} |
1040 | 545 |
} |
1041 |
/* |
|
1042 |
State selectedUseCategory = combo_UseCategory.getSelection(); |
|
1043 |
if (selectedUseCategory != null) { |
|
1044 |
combo_UseSubCategory.setTerms(setUseCategoryComboTerms(TermStore.getTerms(State.class, null, false),selectedUseCategory)); |
|
1045 |
|
|
1046 |
} |
|
1047 |
//} |
|
1048 |
if (eventSource == combo_HumanGroup) { |
|
1049 |
Modifier selectedHumanGroup = combo_HumanGroup.getSelection(); |
|
1050 |
if (selectedHumanGroup != null) { |
|
1051 |
combo_EthnicGroup.setTerms(setEthnicGroupComboTerms(TermStore.getTerms(Modifier.class, null, false), selectedHumanGroup)); |
|
1052 |
} |
|
1053 |
} |
|
1054 |
*/ |
|
1055 |
|
|
1056 | 546 |
} |
1057 | 547 |
|
1058 | 548 |
@Override |
Also available in: Unified diff
AT: commiting latest changes to the Palm Use data extension