AT: commiting latest changes to the Palm Use data extension
authora.theys <a.theys@localhost>
Fri, 3 Feb 2012 17:19:55 +0000 (17:19 +0000)
committera.theys <a.theys@localhost>
Fri, 3 Feb 2012 17:19:55 +0000 (17:19 +0000)
1  2 
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/userecords/UseRecordDetailElement.java

index b2235424fd0e035619e582ba3e494c9737bb1d5a,0000000000000000000000000000000000000000..f008e4c0441c968cff312e843cb07f880ffb42e8
mode 100644,000000..100644
--- /dev/null
@@@ -1,943 -1,0 +1,995 @@@
-                               if (modifier.getMarkers() != null) {\r
 +package eu.etaxonomy.taxeditor.ui.section.userecords;\r
 +\r
 +import java.util.ArrayList;\r
 +import java.util.List;\r
 +import java.util.Map;\r
 +import java.util.Set;\r
 +import java.util.UUID;\r
 +\r
 +import org.apache.log4j.Logger;\r
 +import org.eclipse.swt.events.SelectionEvent;\r
 +import org.eclipse.swt.events.SelectionListener;\r
 +import org.eclipse.ui.forms.widgets.Section;\r
 +\r
++import eu.etaxonomy.cdm.api.service.IMarkerService;\r
 +import eu.etaxonomy.cdm.api.service.IService;\r
++import eu.etaxonomy.cdm.api.service.ITermService;\r
 +import eu.etaxonomy.cdm.api.service.IVocabularyService;\r
 +import eu.etaxonomy.cdm.model.common.DefinedTermBase;\r
 +import eu.etaxonomy.cdm.model.common.Language;\r
 +import eu.etaxonomy.cdm.model.common.LanguageString;\r
 +import eu.etaxonomy.cdm.model.common.Marker;\r
 +import eu.etaxonomy.cdm.model.common.MarkerType;\r
 +import eu.etaxonomy.cdm.model.common.TermVocabulary;\r
 +import eu.etaxonomy.cdm.model.description.CategoricalData;\r
 +import eu.etaxonomy.cdm.model.description.DescriptionElementBase;\r
 +import eu.etaxonomy.cdm.model.description.Modifier;\r
 +import eu.etaxonomy.cdm.model.description.State;\r
 +import eu.etaxonomy.cdm.model.description.StateData;\r
 +import eu.etaxonomy.cdm.remote.controller.VocabularyController;\r
 +import eu.etaxonomy.taxeditor.store.CdmStore;\r
 +import eu.etaxonomy.taxeditor.store.TermManager;\r
 +import eu.etaxonomy.taxeditor.store.TermStore;\r
 +import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;\r
 +import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;\r
 +import eu.etaxonomy.taxeditor.ui.element.CheckboxElement;\r
 +import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;\r
 +import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EntityDetailType;\r
 +import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;\r
 +import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailElement;\r
 +import eu.etaxonomy.taxeditor.ui.section.description.StateDataSection;\r
 +import eu.etaxonomy.taxeditor.ui.section.description.detail.AbstractDetailedDescriptionDetailElement;\r
 +\r
 +//public class UseRecordDetailElement extends AbstractDetailedDescriptionDetailElement<CategoricalData> {\r
 +public class UseRecordDetailElement extends\r
 +              AbstractCdmDetailElement<CategoricalData> implements SelectionListener {\r
 +\r
 +      private static final Logger logger = Logger\r
 +                      .getLogger(DescriptionElementDetailElement.class);\r
 +\r
 +      // private CheckboxElement checkbox_orderRelevant;\r
 +      private TermComboElement<State> combo_UseCategory;\r
 +      private TermComboElement<State> combo_UseSubCategory;\r
 +      private TermComboElement<Modifier> combo_PlantPart;\r
 +      private TermComboElement<Modifier> combo_Country;\r
 +      private TermComboElement<Modifier> combo_HumanGroup;\r
 +      private TermComboElement<Modifier> combo_EthnicGroup;\r
 +      // private AbstractDetailedDescriptionDetailElement detailElement;\r
 +\r
 +      /*\r
 +       * public UseRecordDetailElement(CdmFormFactory formFactory, ICdmFormElement\r
 +       * formElement, CategoricalData entity, int style) { super(formFactory,\r
 +       * formElement, entity, style); }\r
 +       */\r
 +      /*\r
 +       * public UseRecordDetailElement(CdmFormFactory formFactory, ICdmFormElement\r
 +       * formElement, int style) {\r
 +       */\r
 +      public UseRecordDetailElement(CdmFormFactory formFactory,\r
 +                      ICdmFormElement formElement) {\r
 +              super(formFactory, formElement);\r
 +      }\r
 +\r
 +      /** {@inheritDoc} */\r
 +      @Override\r
 +      protected void createControls(ICdmFormElement formElement,\r
 +                      CategoricalData entity, int style) {\r
 +\r
 +              // State state = State.NewInstance("Tato", "Toto", "Titi");\r
 +              // checkbox_orderRelevant = formFactory.createCheckbox(formElement,\r
 +              // "Order Relevant", entity.getOrderRelevant(), style);\r
 +              combo_UseCategory = formFactory.createTermComboElement(State.class,     this, "Use Category", null, style);\r
 +              combo_UseCategory.addSelectionListener(this);\r
 +              combo_UseSubCategory = formFactory.createTermComboElement(State.class, this, "Use SubCategory", null, style);\r
 +              combo_Country   = formFactory.createTermComboElement(Modifier.class, this, "Country", null, style);\r
 +              combo_PlantPart = formFactory.createTermComboElement(Modifier.class, this, "Plant Part", null, style);\r
 +              combo_HumanGroup = formFactory.createTermComboElement(Modifier.class, this, "Human Group", null, style);\r
 +              combo_HumanGroup.addSelectionListener(this);\r
 +              combo_EthnicGroup = formFactory.createTermComboElement(Modifier.class, this, "Ethnic Group", null, style);\r
 +              \r
 +\r
 +              List<State> termsUseCategory = setUseCategoryComboTerms(TermStore.getTerms(State.class, null, false));\r
 +              combo_UseCategory.setTerms(termsUseCategory);\r
 +              combo_UseCategory.setSelection(stateSelection("Use Category"));\r
 +              \r
 +              List<State> termsSubCategory = setUseCategoryComboTerms(TermStore.getTerms(State.class, null, false), combo_UseCategory.getSelection());\r
 +              \r
 +              if (termsSubCategory != null) {\r
 +                      \r
 +                      combo_UseSubCategory.setTerms(termsSubCategory);\r
 +                      combo_UseSubCategory.setSelection(stateSelection("Use SubCategory"));\r
 +                      combo_UseSubCategory.setEnabled(true);\r
 +              }\r
 +              else {\r
 +                      combo_UseSubCategory.setEnabled(false);\r
 +              }\r
 +              \r
 +              List<Modifier> plantPartsToAdd = setModifierComboTerms(TermStore.getTerms(Modifier.class, null, false), "Plant Part");\r
 +              combo_PlantPart.setTerms(plantPartsToAdd);\r
 +              combo_PlantPart.setSelection(modifierSelection("Plant Part"));\r
 +              \r
 +              List<Modifier> countriesToAdd = setModifierComboTerms(TermStore.getTerms(Modifier.class, null, false), "Country");\r
 +              combo_Country.setTerms(countriesToAdd);\r
 +              combo_Country.setSelection(modifierSelection("Country"));\r
 +              \r
 +              List<Modifier> humanGroupToAdd = setModifierComboTerms(TermStore.getTerms(Modifier.class, null, false), "Human Group");\r
 +              combo_HumanGroup.setTerms(humanGroupToAdd);\r
 +              combo_HumanGroup.setSelection(modifierSelection("Human Group"));\r
 +              \r
 +              List<Modifier> ethnicGroupToAdd = setEthnicGroupComboTerms(TermStore.getTerms(Modifier.class, null, false), combo_HumanGroup.getSelection());\r
 +              if (ethnicGroupToAdd != null) {\r
 +                      combo_EthnicGroup.setTerms(ethnicGroupToAdd);\r
 +                      combo_EthnicGroup.setSelection(modifierSelection("Ethnic Group"));\r
 +                      combo_EthnicGroup.setEnabled(true);\r
 +              } else {\r
 +                      combo_EthnicGroup.setEnabled(false);\r
 +              }\r
 +\r
 +      }\r
 +\r
 +      private Modifier modifierSelection(String comboCategory) {\r
 +              if(!getEntity().getModifiers().isEmpty()) {\r
 +                      for (Modifier modifier : getEntity().getModifiers()) {\r
-                                               else {\r
++                              if(GetVocabularyType(modifier, comboCategory)) {\r
++                                      return modifier;\r
++                              }\r
++                              \r
++                              \r
++                              /*if (modifier.getMarkers() != null) {\r
 +                                      for (Marker marker : modifier.getMarkers()) {\r
 +                                              if(marker.getMarkerType().getTitleCache().equals(comboCategory)) {\r
 +                                                      return modifier;\r
 +                                              }\r
-                               }\r
-                               else {\r
++                                              /*else {\r
 +                                                      return null;\r
 +                                              }\r
 +                                      }\r
-                               }\r
++                              }*/\r
++                              /*else {\r
 +                                      return null;\r
-                                       if(statedata.getModifyingText().get(CdmStore.getDefaultLanguage()).getText() == comboCategory) {\r
++                              }*/\r
 +                                      \r
 +                      }\r
 +              } else {\r
 +                      return null;\r
 +              }\r
 +              return null;\r
 +              \r
 +      }\r
 +      \r
 +      private State stateSelection(String comboCategory) {\r
 +              if (!getEntity().getStates().isEmpty()) {\r
 +                      for (StateData statedata : getEntity().getStates()) {\r
 +                              if (statedata.getModifyingText().get(CdmStore.getDefaultLanguage()) != null) {\r
-                       else if ((term.getVocabulary() != null) && (term.getVocabulary().getTitleCache().equals(modType))) {\r
++                                      String testString = statedata.getModifyingText().get(CdmStore.getDefaultLanguage()).getText();\r
++                                      if(testString.equals(comboCategory)) {\r
 +                                              if(statedata.getState() !=null) {\r
 +                                                      return statedata.getState();\r
 +                                              }\r
 +                                      }\r
 +                              }                               \r
 +                      }\r
 +              }\r
 +              else {\r
 +                      return null;\r
 +              }\r
 +              return null;\r
 +              \r
 +      }\r
 +      \r
 +      private List<Modifier> setModifierComboTerms(List<Modifier> listOfTerms, String modType) {\r
 +              List<Modifier> termsToAdd = new ArrayList<Modifier>();\r
 +              for (Modifier term : listOfTerms) {\r
 +\r
 +                      if ((term.getPartOf() != null) && (term.getPartOf().getTitleCache().equals(modType))) {\r
 +                              termsToAdd.add(term);\r
 +                      }\r
-                               MarkerType markerType = MarkerType.NewInstance("Plant Part", "Plant Part", null);\r
++                      else if ((term.getVocabulary() != null) && (term.getPartOf() == null) && (term.getVocabulary().getTitleCache().equals(modType))) {\r
 +                              termsToAdd.add(term);\r
 +                      }\r
 +              }\r
 +              \r
 +              return termsToAdd;\r
 +      }\r
 +      \r
 +      private Modifier plantPartSelection() {\r
 +              /*if(!getEntity().getModifiers().isEmpty()) {\r
 +                      for (Modifier modifier : getEntity().getModifiers()) {\r
 +                              if (modifier.getMarkers() != null) {\r
 +                                      for (Marker marker : modifier.getMarkers()) {\r
 +                                              if(marker.getMarkerType().getTitleCache().equals("Plant Part")) {\r
 +                                                      return modifier;\r
 +                                              }\r
 +                                              else {\r
 +                                                      return null;\r
 +                                              }\r
 +                                      }\r
 +                              }\r
 +                              else {\r
 +                                      return null;\r
 +                              }\r
 +                                      \r
 +                      }\r
 +              } else {\r
 +                      return null;\r
 +              }\r
 +              return null;*/\r
 +              //for testing purposes\r
 +              int countMods = 0;\r
 +              Modifier modiftoreturn = Modifier.NewInstance();\r
 +              if (!getEntity().getModifiers().isEmpty()) {\r
 +                      for (Modifier modifier : getEntity().getModifiers()){\r
 +                              if(countMods == 0) {\r
 +                                      modiftoreturn = modifier;\r
 +                              }\r
 +                              countMods++;\r
 +                      }\r
 +                      return modiftoreturn;\r
 +              }\r
 +              return null;\r
 +              \r
 +      }\r
 +      \r
 +      private Modifier countrySelection() {\r
 +              /*if(!getEntity().getModifiers().isEmpty()) {\r
 +              for (Modifier modifier : getEntity().getModifiers()) {\r
 +                      if (modifier.getMarkers() != null) {\r
 +                              for (Marker marker : modifier.getMarkers()) {\r
 +                                      if(marker.getMarkerType().getTitleCache().equals("Country")) {\r
 +                                              return modifier;\r
 +                                      }\r
 +                                      else {\r
 +                                              return null;\r
 +                                      }\r
 +                              }\r
 +                      }\r
 +                      else {\r
 +                              return null;\r
 +                      }\r
 +                              \r
 +              }\r
 +      } else {\r
 +              return null;\r
 +      }\r
 +      return null;*/\r
 +      //for testing purposes\r
 +      int countMods = 0;\r
 +      Modifier modiftoreturn = Modifier.NewInstance();\r
 +      if (!getEntity().getModifiers().isEmpty()) {\r
 +              for (Modifier modifier : getEntity().getModifiers()){\r
 +                      if(countMods == 1) {\r
 +                              modiftoreturn = modifier;\r
 +                      }\r
 +                      countMods++;\r
 +              }\r
 +              return modiftoreturn;\r
 +      }\r
 +      return null;\r
 +      }\r
 +      \r
 +      private Modifier humanGroupSelection() {\r
 +              /*if(!getEntity().getModifiers().isEmpty()) {\r
 +              for (Modifier modifier : getEntity().getModifiers()) {\r
 +                      if (modifier.getMarkers() != null) {\r
 +                              for (Marker marker : modifier.getMarkers()) {\r
 +                                      if(marker.getMarkerType().getTitleCache().equals("Human Group")) {\r
 +                                              return modifier;\r
 +                                      }\r
 +                                      else {\r
 +                                              return null;\r
 +                                      }\r
 +                              }\r
 +                      }\r
 +                      else {\r
 +                              return null;\r
 +                      }\r
 +                              \r
 +              }\r
 +      } else {\r
 +              return null;\r
 +      }\r
 +      return null;*/\r
 +      //for testing purposes\r
 +      int countMods =0;\r
 +      Modifier modiftoreturn = Modifier.NewInstance();\r
 +      if (!getEntity().getModifiers().isEmpty()) {\r
 +              for (Modifier modifier : getEntity().getModifiers()){\r
 +                      if (countMods == 2) {\r
 +                              modiftoreturn = modifier;\r
 +                      }\r
 +                      countMods++;\r
 +              }\r
 +              return modiftoreturn;\r
 +      }\r
 +      return null;\r
 +      }\r
 +      \r
 +      private Modifier ethnicGroupSelection() {\r
 +              /*if(!getEntity().getModifiers().isEmpty()) {\r
 +              for (Modifier modifier : getEntity().getModifiers()) {\r
 +                      if (modifier.getMarkers() != null) {\r
 +                              for (Marker marker : modifier.getMarkers()) {\r
 +                                      if(marker.getMarkerType().getTitleCache().equals("Human Group")) {\r
 +                                              return modifier;\r
 +                                      }\r
 +                                      else {\r
 +                                              return null;\r
 +                                      }\r
 +                              }\r
 +                      }\r
 +                      else {\r
 +                              return null;\r
 +                      }\r
 +                              \r
 +              }\r
 +      } else {\r
 +              return null;\r
 +      }\r
 +      return null;*/\r
 +      //for testing purposes\r
 +      int countMods =0;\r
 +      Modifier modiftoreturn = Modifier.NewInstance();\r
 +      if (!getEntity().getModifiers().isEmpty()) {\r
 +              for (Modifier modifier : getEntity().getModifiers()){\r
 +                      if (countMods == 3) {\r
 +                              modiftoreturn = modifier;\r
 +                      }\r
 +                      countMods++;\r
 +              }\r
 +              return modiftoreturn;\r
 +      }\r
 +      return null;\r
 +      }\r
 +\r
 +      private State useCategorySelection() {\r
 +              /*if (!getEntity().getStates().isEmpty()) {\r
 +                      for (StateData statedata : getEntity().getStates()) {\r
 +                              if (statedata.getModifyingText().get(CdmStore.getDefaultLanguage()) != null) {\r
 +                                      if(statedata.getModifyingText().get(CdmStore.getDefaultLanguage()).getText() == "Use Category") {\r
 +                                              if(statedata.getState() !=null) {\r
 +                                                      return statedata.getState();\r
 +                                              }\r
 +                                      }\r
 +                              }                               \r
 +                      }\r
 +              }\r
 +              else {\r
 +                      return null;\r
 +              }\r
 +              return null;*/\r
 +              //for testing purposes\r
 +              int countStates =0;\r
 +              for (StateData state : getEntity().getStates()) {\r
 +                      if (countStates == 0) {\r
 +                              return state.getState();\r
 +                      }\r
 +                      countStates++;\r
 +              }\r
 +              return null;\r
 +      }\r
 +      \r
 +\r
 +      \r
 +      private State useSubCategorySelection() {\r
 +              /*if (!getEntity().getStates().isEmpty() && combo_UseCategory.getSelection() != null) {\r
 +                      for (StateData statedata : getEntity().getStates()) {\r
 +                              if (stateData.getModifyingText().get(CdmStore.getDefaultLanguage()) != null) {\r
 +                                      if(statedata.getModifyingText().get(CdmStore.getDefaultLanguage()).getText() == "Use SubCategory") {\r
 +                                              if(statedata.getState() !=null) {\r
 +                                                      return statedata.getState();\r
 +                                              }\r
 +                                              \r
 +                                      }\r
 +                              }                               \r
 +                      }\r
 +              }\r
 +              else {\r
 +                      return null;\r
 +              }\r
 +              return null;*/\r
 +              //for testing purposes\r
 +              int countStates =0;\r
 +              for (StateData state : getEntity().getStates()) {\r
 +                      if ((countStates == 1)) {\r
 +                              return state.getState();\r
 +                      }\r
 +                      countStates++;\r
 +              }\r
 +              return null;\r
 +              \r
 +      }\r
 +\r
 +      \r
 +      \r
 +      \r
 +      private List<Modifier> setPlantPartsComboTerms(List<Modifier> listOfTerms) {\r
 +              List<Modifier> termsToAdd = new ArrayList<Modifier>();\r
 +              for (Modifier term : listOfTerms) {\r
 +\r
 +                      if ((term.getPartOf() != null) && (term.getPartOf().getTitleCache().equals("Plant Part"))) {\r
 +                              termsToAdd.add(term);\r
 +                      }\r
 +                      else if ((term.getVocabulary() != null) && (term.getVocabulary().getTitleCache().equals("Plant Part"))) {\r
 +                              termsToAdd.add(term);\r
 +                      }\r
 +              }\r
 +              \r
 +              return termsToAdd;\r
 +      }\r
 +      \r
 +      private List<Modifier> setCountryComboTerms(List <Modifier> listOfTerms) {\r
 +              List<Modifier> termsToAdd = new ArrayList<Modifier>();\r
 +              for (Modifier term : listOfTerms) {\r
 +\r
 +                      if ((term.getPartOf() != null) && (term.getPartOf().getTitleCache().equals("Country"))) {\r
 +                              termsToAdd.add(term);\r
 +                      }\r
 +                      else if ((term.getVocabulary() != null) && (term.getVocabulary().getTitleCache().equals("Country"))) {\r
 +                              termsToAdd.add(term);\r
 +                      }\r
 +              }\r
 +              \r
 +              return termsToAdd;\r
 +      }\r
 +\r
 +\r
 +      private List<State> setUseCategoryComboTerms(List<State> listOfTerms) {\r
 +              List<State> termsToAdd = new ArrayList<State>();\r
 +              for (State term : listOfTerms) {\r
 +\r
 +                      if ((term.getPartOf() != null) && (term.getPartOf().getTitleCache().equals("Use Category"))) {\r
 +                              termsToAdd.add(term);\r
 +                      }\r
 +                      else if ((term.getVocabulary() !=null) && (term.getPartOf() == null) && (term.getVocabulary().getTitleCache().equals("Use Category"))) {\r
 +                              termsToAdd.add(term);\r
 +                      }\r
 +              }\r
 +              return termsToAdd;\r
 +\r
 +      }\r
 +\r
 +      private List<State> setUseCategoryComboTerms(List<State> listOfTerms,\r
 +                      State selectedUseCategory) {\r
 +              List<State> termsToAdd = new ArrayList<State>();\r
 +              if (combo_UseCategory.getSelection() != null) {\r
 +                      \r
 +                      for (State term : listOfTerms) {\r
 +                              if ((term.getPartOf() != null) && (term.getPartOf().getTitleCache().equals(selectedUseCategory.getTitleCache()))) {\r
 +                                      termsToAdd.add(term);\r
 +                              }\r
 +                              else if ((term.getVocabulary() !=null) && (term.getVocabulary().getTitleCache().equals(selectedUseCategory.getTitleCache()))) {\r
 +                                      termsToAdd.add(term);\r
 +                              }\r
 +      \r
 +                      }\r
 +              }\r
 +              else if (!getEntity().getStates().isEmpty()) {\r
 +                      for (StateData stateData : getEntity().getStates()) {\r
 +                              if (stateData.getModifyingText().get(CdmStore.getDefaultLanguage()) != null) {\r
 +                                      if ((stateData.getState() != null) && (stateData.getModifyingText().get(CdmStore.getDefaultLanguage()).getText() == "Use Category")) {\r
 +                                              for (State term : listOfTerms) {\r
 +                                                      if ((term.getPartOf() != null) && (term.getPartOf().getTitleCache().equals(stateData.getState().getTitleCache()))) {\r
 +                                                              termsToAdd.add(term);\r
 +                                                      } else if ((term.getVocabulary() != null) && (term.getVocabulary().getTitleCache().equals(stateData.getState().getTitleCache()))) {\r
 +                                                              termsToAdd.add(term);\r
 +                                                      }\r
 +                                              }\r
 +                                              \r
 +                                      }\r
 +                              }\r
 +                      }\r
 +                      \r
 +              }\r
 +                      \r
 +              else {\r
 +                      return null;\r
 +              }\r
 +\r
 +              return termsToAdd;\r
 +      }\r
 +      \r
 +      private List<Modifier> setEthnicGroupComboTerms(List<Modifier> listOfTerms,\r
 +                      Modifier selectedHumangroup) {\r
 +              List<Modifier> termsToAdd = new ArrayList<Modifier>();\r
 +              if (combo_HumanGroup.getSelection() != null) {\r
 +                      for (Modifier term : listOfTerms) {\r
 +      \r
 +                              if ((term.getPartOf() != null) && (term.getPartOf().getTitleCache().equals(selectedHumangroup.getTitleCache()))) {\r
 +                                      termsToAdd.add(term);\r
 +                              }\r
 +                              else if ((term.getVocabulary() != null) && (term.getVocabulary().getTitleCache().equals(selectedHumangroup.getTitleCache()))) {\r
 +                                      termsToAdd.add(term);\r
 +                              }\r
 +                      }\r
 +              }\r
 +              else if (!getEntity().getModifiers().isEmpty()) {\r
 +                      for (Modifier modifier : getEntity().getModifiers()) {\r
 +                              if (modifier.getMarkers() != null) {\r
 +                                      for (Marker marker : modifier.getMarkers()) {\r
 +                                              if(marker.getMarkerType().getTitleCache().equals("Human Group")) {\r
 +                                                      for (Modifier term : listOfTerms) {\r
 +                                                              if ((term.getPartOf() != null) && (term.getPartOf().getTitleCache().equals(modifier.getTitleCache()))) {\r
 +                                                                      termsToAdd.add(modifier);\r
 +                                                              } else if ((term.getVocabulary() != null) && (term.getVocabulary().getTitleCache().equals(modifier.getTitleCache()))) {\r
 +                                                                      termsToAdd.add(modifier);\r
 +                                                              }\r
 +                                                      }\r
 +                                                      \r
 +                                              }\r
 +                                      }\r
 +                              }\r
 +                      }\r
 +              } else {\r
 +                      return null;\r
 +              }\r
 +              \r
 +              return termsToAdd;\r
 +      }\r
 +\r
 +      \r
 +      private List<Modifier> setHumanGroupComboTerms(List<Modifier> listOfTerms) {\r
 +              List<Modifier> termsToAdd = new ArrayList<Modifier>();\r
 +              for (Modifier term : listOfTerms) {\r
 +\r
 +                      if ((term.getPartOf() != null) && (term.getPartOf().getTitleCache().equals("Human Group"))) {\r
 +                              termsToAdd.add(term);\r
 +                      }\r
 +                      else if ((term.getVocabulary() != null) && (term.getPartOf() == null) && (term.getVocabulary().getTitleCache().equals("Human Group"))) {\r
 +                              termsToAdd.add(term);\r
 +                      }\r
 +              }\r
 +              \r
 +              return termsToAdd;\r
 +      }\r
 +\r
 +\r
 +      /** {@inheritDoc} */\r
 +      @Override\r
 +      public void handleEvent(Object eventSource) {\r
 +              /*\r
 +               * if(eventSource == checkbox_orderRelevant){\r
 +               * getEntity().setOrderRelevant(checkbox_orderRelevant.getSelection());\r
 +               * }\r
 +               */\r
 +              if (eventSource == combo_UseCategory) {\r
 +                      if (combo_UseCategory.getSelection() != null) {\r
 +                              boolean isChanged = false;\r
 +                              if (!getEntity().getStates().isEmpty()) {\r
 +                                      for (StateData existingStateData : getEntity().getStates()) {\r
 +                                              Map<Language, LanguageString> modifyingText = existingStateData\r
 +                                                              .getModifyingText();\r
 +      \r
 +                                              if (modifyingText.get(CdmStore.getDefaultLanguage()) != null) {\r
 +                                                      if (modifyingText.get(CdmStore.getDefaultLanguage())\r
 +                                                                      .getText() == "Use Category") {\r
 +                                                              getEntity().removeState(existingStateData);\r
 +                                                              StateData stateData = StateData.NewInstance(combo_UseCategory.getSelection());\r
 +                                                              stateData.setState(combo_UseCategory.getSelection());\r
 +                                                              //stateData.addModifyingText("Use Category", CdmStore.getDefaultLanguage());\r
 +                                                              stateData.putModifyingText(CdmStore.getDefaultLanguage(),"Use Category");\r
 +                                                              getEntity().addState(stateData);\r
 +                                                              isChanged = true;\r
 +                                                      } \r
 +                                                      /*else {\r
 +                                                              StateData stateData = StateData\r
 +                                                                              .NewInstance(combo_UseCategory.getSelection());\r
 +                                                              stateData.setState(combo_UseCategory.getSelection());\r
 +                                                              //stateData.addModifyingText("Use Category", CdmStore.getDefaultLanguage());\r
 +                                                              stateData.putModifyingText(CdmStore.getDefaultLanguage(),"Use Category");\r
 +                                                              getEntity().addState(stateData);\r
 +                                                      }\r
 +      \r
 +                                              } else {\r
 +                                                      StateData stateData = StateData\r
 +                                                                      .NewInstance(combo_UseCategory.getSelection());\r
 +                                                      stateData.setState(combo_UseCategory.getSelection());\r
 +                                                      //stateData.addModifyingText("Use Category", CdmStore.getDefaultLanguage());\r
 +                                                      stateData.putModifyingText(CdmStore.getDefaultLanguage(), "Use Category");\r
 +                                                      getEntity().addState(stateData);\r
 +                                              }*/\r
 +                                              }\r
 +                                      }\r
 +                              }\r
 +                              \r
 +                              \r
 +                              if (isChanged == false) {\r
 +                                      StateData stateData = StateData\r
 +                                                      .NewInstance(combo_UseCategory.getSelection());\r
 +                                      stateData.setState(combo_UseCategory.getSelection());\r
 +                                      //stateData.addModifyingText("Use Category", CdmStore.getDefaultLanguage());\r
 +                                      //LanguageString languageString = LanguageString.NewInstance("Use Category", CdmStore.getDefaultLanguage());\r
 +                                      //IService object = (IService) CdmStore.getCurrentApplicationConfiguration().getBean(IService.class.getName());\r
 +                                      //object.save(languageString);\r
 +                                      stateData.putModifyingText(CdmStore.getDefaultLanguage(), "Use Category");\r
 +                                      getEntity().addState(stateData);\r
 +                              }\r
 +                              combo_UseSubCategory.setEnabled(true);\r
 +      \r
 +                      }\r
 +              }\r
 +              if (eventSource == combo_UseSubCategory) {\r
 +                      if (combo_UseSubCategory.getSelection() != null) {\r
 +                              boolean isChanged = false;\r
 +                              if (!getEntity().getStates().isEmpty()) {\r
 +                                      for (StateData existingStateData : getEntity().getStates()) {\r
 +                                              Map<Language, LanguageString> modifyingText = existingStateData\r
 +                                                              .getModifyingText();\r
 +      \r
 +                                              if (modifyingText.get(CdmStore.getDefaultLanguage()) != null) {\r
 +                                                      if (modifyingText.get(CdmStore.getDefaultLanguage())\r
 +                                                                      .getText() == "Use SubCategory") {\r
 +                                                              getEntity().removeState(existingStateData);\r
 +                                                              StateData stateData = StateData.NewInstance(combo_UseSubCategory.getSelection());\r
 +                                                              stateData.setState(combo_UseSubCategory.getSelection());\r
 +                                                              //stateData.addModifyingText("Use SubCategory", CdmStore.getDefaultLanguage());\r
 +                                                              stateData.putModifyingText(CdmStore.getDefaultLanguage(),"Use SubCategory");\r
 +                                                              getEntity().addState(stateData);\r
 +                                                              isChanged = true;\r
 +                                                      } \r
 +                                                      /*else {\r
 +                                                              StateData stateData = StateData\r
 +                                                                              .NewInstance(combo_UseSubCategory.getSelection());\r
 +                                                              stateData.setState(combo_UseSubCategory.getSelection());\r
 +                                                              //stateData.addModifyingText("Use SubCategory", CdmStore.getDefaultLanguage());\r
 +                                                              stateData.putModifyingText(CdmStore.getDefaultLanguage(),"Use SubCategory");\r
 +                                                              getEntity().addState(stateData);\r
 +                                                      }\r
 +      \r
 +                                              } else {\r
 +                                                      StateData stateData = StateData\r
 +                                                                      .NewInstance(combo_UseSubCategory.getSelection());\r
 +                                                      stateData.setState(combo_UseSubCategory.getSelection());\r
 +                                                      //stateData.addModifyingText("Use SubCategory", CdmStore.getDefaultLanguage());\r
 +                                                      stateData.putModifyingText(CdmStore.getDefaultLanguage(), "Use SubCategory");\r
 +                                                      getEntity().addState(stateData);\r
 +                                              }*/\r
 +                                              }\r
 +                                      }\r
 +                              }\r
 +                              \r
 +                              if (isChanged == false){\r
 +                                      StateData stateData = StateData\r
 +                                                      .NewInstance(combo_UseSubCategory.getSelection());\r
 +                                      stateData.setState(combo_UseSubCategory.getSelection());\r
 +                                      //stateData.addModifyingText("Use SubCategory", CdmStore.getDefaultLanguage());\r
 +                                      //LanguageString languageString = LanguageString.NewInstance("Use SubCategory", CdmStore.getDefaultLanguage());\r
 +                                      //IService object = (IService) CdmStore.getCurrentApplicationConfiguration().getBean(IService.class.getName());\r
 +                                      //object.save(languageString);\r
 +                                      //stateData.putModifyingText(languageString);\r
 +                                      stateData.putModifyingText(CdmStore.getDefaultLanguage(), "Use SubCategory");\r
 +                                      getEntity().addState(stateData);\r
 +                              }\r
 +      \r
 +                      }\r
 +              }\r
 +              if (eventSource == combo_PlantPart) {\r
 +                      if (combo_PlantPart.getSelection() != null) {\r
 +                              boolean isChanged = false;\r
-                                               if (modifier.getMarkers() != null) {\r
++                              //MarkerType markerType = MarkerType.NewInstance("Plant Part", "Plant Part", null);\r
 +                              Set<Modifier> modifiers = getEntity().getModifiers();\r
 +                              if(!modifiers.isEmpty()) {\r
 +                                      for (Modifier modifier : modifiers) {\r
-                                                               }*/\r
++                                              if(GetVocabularyType(modifier, "Plant Part")) {\r
++                                                      getEntity().removeModifier(modifier);\r
++                                                      getEntity().addModifier(combo_PlantPart.getSelection());\r
++                                                      isChanged = true;\r
++                                              }\r
++                                              /*if (modifier.getMarkers() != null) {\r
 +                                                      for (Marker marker : modifier.getMarkers()) {\r
 +                                                              if (marker.getMarkerType().getTitleCache().equals("Plant Part")) {\r
 +                                                                      getEntity().removeModifier(modifier);\r
 +                                                                      Modifier plantPart = combo_PlantPart.getSelection();\r
 +                                                                      plantPart.addMarker(marker);\r
 +                                                                      getEntity().addModifier(plantPart);\r
 +                                                                      isChanged = true;\r
 +                                                                      //getEntity().addModifier(combo_PlantPart.getSelection());\r
 +                                                              } \r
 +                                                              /*else {\r
 +                                                                      \r
 +                                                                      Marker markerPlantPart = Marker.NewInstance(markerType, false);\r
 +                                                                      Modifier plantPart = combo_PlantPart.getSelection();\r
 +                                                                      plantPart.addMarker(markerPlantPart);\r
 +                                                                      getEntity().addModifier(plantPart);\r
 +                                                                      //getEntity().addModifier(combo_PlantPart.getSelection());\r
-                                       Marker marker = Marker.NewInstance(markerType, false);\r
++                                                              }\r
 +                                                                      \r
 +                                                                      \r
 +                                                      }\r
 +                                                              \r
 +                                              }\r
 +                                              /*else {\r
 +                                                      //MarkerType markerType = MarkerType.NewInstance("Plant Part", "Plant Part", null);\r
 +                                                      Marker marker = Marker.NewInstance(markerType, false);\r
 +                                                      Modifier plantPart = combo_PlantPart.getSelection();\r
 +                                                      plantPart.addMarker(marker);\r
 +                                                      getEntity().addModifier(plantPart);\r
 +                                                      //getEntity().addModifier(combo_PlantPart.getSelection());\r
 +                                              }*/\r
 +                                                      \r
 +                                      }       \r
 +                              }\r
 +                              if(isChanged == false) {\r
 +                                      //MarkerType markerType = MarkerType.NewInstance("Plant Part", "Plant Part", null);\r
-                                       plantPart.addMarker(marker);\r
++                                      //Marker marker = Marker.NewInstance(markerType, false);\r
++                                      //CdmStore.getService(IMarkerService.class).saveOrUpdate(marker);\r
 +                                      Modifier plantPart = combo_PlantPart.getSelection();\r
-                               MarkerType markerType = MarkerType.NewInstance("Country", "Country", null);\r
++                                      //plantPart.addMarker(marker);\r
++                                      //CdmStore.getService(ITermService.class).saveOrUpdate(plantPart);\r
 +                                      getEntity().addModifier(plantPart);\r
++                                      \r
 +                                      //getEntity().addModifier(combo_PlantPart.getSelection());\r
 +                              }\r
 +                      }\r
 +              }\r
 +              if (eventSource == combo_Country) {\r
 +                      if (combo_Country.getSelection() != null) {\r
 +                              boolean isChanged = false;\r
-                                               if (modifier.getMarkers() != null) {\r
++                              //MarkerType markerType = MarkerType.NewInstance("Country", "Country", null);\r
 +                              Set<Modifier> modifiers = getEntity().getModifiers();\r
 +                              if(!modifiers.isEmpty()) {\r
 +                                      for (Modifier modifier : modifiers) {\r
-                                                               }*/\r
++                                              if(GetVocabularyType(modifier, "Country")) {\r
++                                                      getEntity().removeModifier(modifier);\r
++                                                      getEntity().addModifier(combo_Country.getSelection());\r
++                                                      isChanged = true;\r
++                                              }\r
++                                              /*if (modifier.getMarkers() != null) {\r
 +                                                      for (Marker marker : modifier.getMarkers()) {\r
 +                                                              if (marker.getMarkerType().getTitleCache().equals("Country")) {\r
 +                                                                      getEntity().removeModifier(modifier);\r
 +                                                                      Modifier country = combo_Country.getSelection();\r
 +                                                                      country.addMarker(marker);\r
 +                                                                      getEntity().addModifier(country);\r
 +                                                                      isChanged = true;\r
 +                                                                      //getEntity().addModifier(combo_Country.getSelection());\r
 +                                                              } \r
 +                                                              /*else {\r
 +                                                                      \r
 +                                                                      Marker markerCountry = Marker.NewInstance(markerType, false);\r
 +                                                                      Modifier country = combo_Country.getSelection();\r
 +                                                                      country.addMarker(markerCountry);\r
 +                                                                      getEntity().addModifier(country);\r
 +                                                                      //getEntity().addModifier(combo_Country.getSelection());\r
-                                               }\r
++                                                              }\r
 +                                                                      \r
 +                                                                      \r
 +                                                      }\r
 +                                                              \r
-                                       Marker marker = Marker.NewInstance(markerType, false);\r
++                                              }*/\r
 +                                              /*else {\r
 +                                                      //MarkerType markerType = MarkerType.NewInstance("Country", "Country", null);\r
 +                                                      Marker marker = Marker.NewInstance(markerType, false);\r
 +                                                      Modifier country = combo_Country.getSelection();\r
 +                                                      country.addMarker(marker);\r
 +                                                      getEntity().addModifier(country);\r
 +                                                      //getEntity().addModifier(combo_Country.getSelection());\r
 +                                              }*/\r
 +                                                      \r
 +                                      }       \r
 +                              }\r
 +                              if (isChanged == false) {\r
 +                                      //MarkerType markerType = MarkerType.NewInstance("Country", "Country", null);\r
-                                       country.addMarker(marker);\r
++                                      //Marker marker = Marker.NewInstance(markerType, false);\r
 +                                      Modifier country = combo_Country.getSelection();\r
-                               MarkerType markerType = MarkerType.NewInstance("Human Group", "Human Group", null);\r
++                                      //country.addMarker(marker);\r
 +                                      getEntity().addModifier(country);\r
 +                                      //getEntity().addModifier(combo_Country.getSelection());\r
 +                              }\r
 +                      }\r
 +              }\r
 +              if (eventSource == combo_HumanGroup) {\r
 +                      if (combo_HumanGroup.getSelection() != null) {\r
 +                              boolean isChanged = false;\r
-                                               if (modifier.getMarkers() != null) {\r
++                              //MarkerType markerType = MarkerType.NewInstance("Human Group", "Human Group", null);\r
 +                              Set<Modifier> modifiers = getEntity().getModifiers();\r
 +                              if(!modifiers.isEmpty()) {\r
 +                                      for (Modifier modifier : modifiers) {\r
-                                                               }*/\r
++                                              if(GetVocabularyType(modifier, "Human Group")) {\r
++                                                      getEntity().removeModifier(modifier);\r
++                                                      getEntity().addModifier(combo_HumanGroup.getSelection());\r
++                                                      isChanged = true;\r
++                                              }\r
++                                              /*if (modifier.getMarkers() != null) {\r
 +                                                      for (Marker marker : modifier.getMarkers()) {\r
 +                                                              if (marker.getMarkerType().getTitleCache().equals("Human Group")) {\r
 +                                                                      getEntity().removeModifier(modifier);\r
 +                                                                      Modifier humanGroup = combo_HumanGroup.getSelection();\r
 +                                                                      humanGroup.addMarker(marker);\r
 +                                                                      getEntity().addModifier(humanGroup);\r
 +                                                                      isChanged = true;\r
 +                                                                      //getEntity().addModifier(combo_HumanGroup.getSelection());\r
 +                                                              } \r
 +                                                              /*else {\r
 +                                                                      \r
 +                                                                      Marker markerHumanGroup = Marker.NewInstance(markerType, false);\r
 +                                                                      Modifier humanGroup = combo_HumanGroup.getSelection();\r
 +                                                                      humanGroup.addMarker(markerHumanGroup);\r
 +                                                                      getEntity().addModifier(humanGroup);\r
 +                                                                      //getEntity().addModifier(combo_HumanGroup.getSelection());\r
-                                               }\r
++                                                              }\r
 +                                                                      \r
 +                                                                      \r
 +                                                      }\r
 +                                                              \r
-                                       Marker marker = Marker.NewInstance(markerType, false);\r
++                                              }*/\r
 +                                              /*else {\r
 +                                                      //MarkerType markerType = MarkerType.NewInstance("Human Group", "Human Group", null);\r
 +                                                      Marker marker = Marker.NewInstance(markerType, false);\r
 +                                                      Modifier humanGroup = combo_HumanGroup.getSelection();\r
 +                                                      humanGroup.addMarker(marker);\r
 +                                                      getEntity().addModifier(humanGroup);\r
 +                                                      //getEntity().addModifier(combo_HumanGroup.getSelection());\r
 +                                              }*/\r
 +                                                      \r
 +                                      }       \r
 +                              }\r
 +                              if(isChanged == false){\r
 +                                      //MarkerType markerType = MarkerType.NewInstance("Human Group", "Human Group", null);\r
-                                       humanGroup.addMarker(marker);\r
++                                      //Marker marker = Marker.NewInstance(markerType, false);\r
 +                                      Modifier humanGroup = combo_HumanGroup.getSelection();\r
-                               MarkerType markerType = MarkerType.NewInstance("Ethnic Group", "Ethnic Group", null);\r
++                                      //humanGroup.addMarker(marker);\r
 +                                      getEntity().addModifier(humanGroup);\r
 +                                      //getEntity().addModifier(combo_HumanGroup.getSelection());\r
 +                              }\r
 +                      }\r
 +                      combo_EthnicGroup.setEnabled(true);\r
 +              }\r
 +              if (eventSource == combo_EthnicGroup) {\r
 +                      if (combo_EthnicGroup.getSelection() != null) {\r
 +                              boolean isChanged = false;\r
-                                               if (modifier.getMarkers() != null) {\r
++                              //MarkerType markerType = MarkerType.NewInstance("Ethnic Group", "Ethnic Group", null);\r
 +                              Set<Modifier> modifiers = getEntity().getModifiers();\r
 +                              if(!modifiers.isEmpty()) {\r
 +                                      for (Modifier modifier : modifiers) {\r
-                                                               }*/\r
++                                              if(GetVocabularyType(modifier, combo_HumanGroup.getSelection().getTitleCache())) {\r
++                                                      getEntity().removeModifier(modifier);\r
++                                                      getEntity().addModifier(combo_EthnicGroup.getSelection());\r
++                                                      isChanged = true;\r
++                                              }\r
++                                              /*if (modifier.getMarkers() != null) {\r
 +                                                      for (Marker marker : modifier.getMarkers()) {\r
 +                                                              if (marker.getMarkerType().getTitleCache().equals("Ethnic Group")) {\r
 +                                                                      getEntity().removeModifier(modifier);\r
 +                                                                      Modifier ethnicGroup = combo_EthnicGroup.getSelection();\r
 +                                                                      ethnicGroup.addMarker(marker);\r
 +                                                                      getEntity().addModifier(ethnicGroup);\r
 +                                                                      isChanged = true;\r
 +                                                                      //getEntity().addModifier(combo_EthnicGroup.getSelection());\r
 +                                                              } \r
 +                                                              /*else {\r
 +                                                                      \r
 +                                                                      Marker markerEthnicGroup = Marker.NewInstance(markerType, false);\r
 +                                                                      Modifier ethnicGroup = combo_EthnicGroup.getSelection();\r
 +                                                                      ethnicGroup.addMarker(markerEthnicGroup);\r
 +                                                                      getEntity().addModifier(ethnicGroup);\r
 +                                                                      //getEntity().addModifier(combo_EthnicGroup.getSelection());\r
-                                               }\r
++                                                              }\r
 +                                                                      \r
 +                                                                      \r
 +                                                      }\r
 +                                                              \r
-                                       Marker marker = Marker.NewInstance(markerType, false);\r
++                                              }*/\r
 +                                              /*else {\r
 +                                                      //MarkerType markerType = MarkerType.NewInstance("Ethnic Group", "Ethnic Group", null);\r
 +                                                      Marker marker = Marker.NewInstance(markerType, false);\r
 +                                                      Modifier ethnicGroup = combo_EthnicGroup.getSelection();\r
 +                                                      ethnicGroup.addMarker(marker);\r
 +                                                      getEntity().addModifier(ethnicGroup);\r
 +                                                      //getEntity().addModifier(combo_EthnicGroup.getSelection());\r
 +                                              }*/\r
 +                                                      \r
 +                                      }       \r
 +                              }\r
 +                              if(isChanged == false) {\r
 +                                      //MarkerType markerType = MarkerType.NewInstance("Ethnic Group", "Ethnic Group", null);\r
-                                       ethnicGroup.addMarker(marker);\r
++                                      //Marker marker = Marker.NewInstance(markerType, false);\r
 +                                      Modifier ethnicGroup = combo_EthnicGroup.getSelection();\r
-                                                                       combo_UseSubCategory.setSelected(false);\r
++                                      //ethnicGroup.addMarker(marker);\r
 +                                      getEntity().addModifier(ethnicGroup);\r
 +                                      //getEntity().addModifier(combo_EthnicGroup.getSelection());\r
 +                              }\r
 +                      }\r
 +              }\r
 +      }\r
 +      \r
 +      \r
 +\r
++      private boolean GetVocabularyType(Modifier term, String vocabularyExpected) {\r
++                      if ((term.getPartOf() != null) && (term.getPartOf().getTitleCache().equals(vocabularyExpected))) {\r
++                              return true;\r
++                      }\r
++                      else if ((term.getVocabulary() != null) && (term.getVocabulary().getTitleCache().equals(vocabularyExpected))) {\r
++                              return true;\r
++                      }\r
++              return false;\r
++      }\r
++      \r
++      /*private boolean GetVocabularyType(Modifier term, String level2,String vocabularyExpected) {\r
++              if ((term.getPartOf() != null) && (term.getPartOf().getTitleCache().equals(vocabularyExpected))) {\r
++                      return true;\r
++              }\r
++              else if ((term.getVocabulary() != null) && (term.getPartOf() == null) &&(term.getVocabulary().getTitleCache().equals(vocabularyExpected))) {\r
++                      return true;\r
++              }\r
++      return false;\r
++}*/\r
++\r
 +      /** {@inheritDoc} */\r
 +      @Override\r
 +      public void setEntity(CategoricalData entity) {\r
 +              // section_stateData.setEntity(entity);\r
 +              super.setEntity(entity);\r
 +      }\r
 +\r
 +      @Override\r
 +      public void widgetSelected(SelectionEvent e) {\r
 +              Object eventSource = e.getSource();\r
 +              //This is causing an error on purpose fix the if statement below\r
 +              \r
 +              //e.getselection();\r
 +              //if(eventSource == combo_UseCategory.getControls()) {\r
 +              for (Object object: combo_UseCategory.getControls()) {\r
 +                      if (object == eventSource) {\r
 +                              State selectedUseCategory = combo_UseCategory.getSelection();\r
 +                              if (selectedUseCategory != null) {\r
 +                                      if (!getEntity().getStates().isEmpty()) {\r
 +                                              for (StateData existingStateData : getEntity().getStates()) {\r
 +                                                      Map<Language, LanguageString> modifyingText = existingStateData\r
 +                                                                      .getModifyingText();\r
 +              \r
 +                                                      if (modifyingText.get(CdmStore.getDefaultLanguage()) != null) {\r
 +                                                              if (modifyingText.get(CdmStore.getDefaultLanguage())\r
 +                                                                              .getText() == "Use SubCategory") {\r
 +                                                                      getEntity().removeState(existingStateData);\r
++                                                                      //combo_UseSubCategory.setSelected(false);\r
++                                                                      combo_UseSubCategory.setSelection(null);\r
 +                                                                      combo_UseSubCategory.getSelection();\r
 +                                                              }\r
 +                                                      }\r
 +                                              }\r
 +                                      }\r
 +                                      \r
 +                                      List<State> newSubCategories = setUseCategoryComboTerms(TermStore.getTerms(State.class, null, false),selectedUseCategory);\r
 +                                      combo_UseSubCategory.setTerms(newSubCategories);\r
 +                                      /*State emptyState = State.NewInstance();\r
 +                                      combo_UseSubCategory.setSelection(emptyState);\r
 +                                      combo_UseSubCategory.setSelection(newSubCategories.get(0));\r
 +                                      combo_UseSubCategory.setSelection(null);*/\r
 +                                      \r
 +                                      //combo_UseSubCategory.setTerms(newSubCategories);\r
 +                                      \r
 +                              }\r
 +                      }\r
 +              }\r
 +              for (Object object: combo_HumanGroup.getControls()) {\r
 +                      if (object == eventSource) {\r
 +                              Modifier selectedHumanGroup = combo_HumanGroup.getSelection();\r
 +                              if (selectedHumanGroup != null) {\r
 +                                      combo_EthnicGroup.setTerms(setEthnicGroupComboTerms(TermStore.getTerms(Modifier.class, null, false), selectedHumanGroup));\r
 +                              }\r
 +                      }\r
 +              }\r
 +              /*      \r
 +                      State selectedUseCategory = combo_UseCategory.getSelection();\r
 +                      if (selectedUseCategory != null) {\r
 +                      combo_UseSubCategory.setTerms(setUseCategoryComboTerms(TermStore.getTerms(State.class, null, false),selectedUseCategory));\r
 +\r
 +                      }\r
 +              //}\r
 +              if (eventSource == combo_HumanGroup) {\r
 +                      Modifier selectedHumanGroup = combo_HumanGroup.getSelection();\r
 +                      if (selectedHumanGroup != null) {\r
 +                              combo_EthnicGroup.setTerms(setEthnicGroupComboTerms(TermStore.getTerms(Modifier.class, null, false), selectedHumanGroup));\r
 +                      }\r
 +              }\r
 +              */\r
 +\r
 +      }\r
 +\r
 +      @Override\r
 +      public void widgetDefaultSelected(SelectionEvent e) {\r
 +              // TODO Auto-generated method stub\r
 +\r
 +      }\r
 +\r
 +}\r