Project

General

Profile

Revision 63851d14

ID63851d14bf7e7fb863e8bbabd319f51eb15da0c5
Parent b3e9c172
Child 91d58d15

Added by Katja Luther over 2 years ago

ref #8293: update drop down when selection of area changed

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/detail/DistributionDetailElement.java
66 66
		selection_namedArea = formFactory.createSelectionElement(NamedArea.class, //getConversationHolder(),
67 67
				formElement, "Area",
68 68
				entity.getArea(), EntitySelectionElement.NOTHING, style);
69

  
69 70
		ICdmFormElement parent = this.getParentElement();
70 71
		NamedArea area = entity.getArea();
71
        PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewInstance(PreferenceSubject.ROOT+"NamedArea["+area.getUuid().toString() + "]"+PreferenceSubject.ROOT), PreferencePredicate.AvailableDistributionStatus);
72
		List<DefinedTermBase> inputList = getStatusListForArea(area);
73
        combo_presenceAbsence = formFactory.createDefinedTermComboElement(inputList, this, "Distribution Status", entity.getStatus(), style);
74

  
75
        //combo_presenceAbsence = formFactory.createTermComboElement(PresenceAbsenceTerm.class, this, "Distribution Status", entity.getStatus(), style);
76
        createTimePeriod(formElement, entity, style);
77
        if (entity.getFeature().getRecommendedModifierEnumeration() != null && !entity.getFeature().getRecommendedModifierEnumeration().isEmpty()){
78
            createModifier(formElement, entity, style);
79
        }else{
80
            createFreetextModifier(formElement, entity, style);
81
        }
82
	}
83

  
84
    public List<DefinedTermBase> getStatusListForArea(NamedArea area) {
85
        PrefKey key;
86
		if (area!= null){
87
		    key = CdmPreference.NewKey(PreferenceSubject.NewInstance(PreferenceSubject.ROOT+"NamedArea["+area.getUuid().toString() + "]"+PreferenceSubject.ROOT), PreferencePredicate.AvailableDistributionStatus);
88
		}else{
89
		    key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.AvailableDistributionStatus);
90
		}
72 91
        CdmPreference pref = CdmPreferenceCache.instance().get(key);
73 92
        // if there is no preference for the area, look for the general
74 93
        if (pref == null){
......
87 106

  
88 107

  
89 108
        List<DefinedTermBase> inputList = CdmStore.getTermManager().getTerms(uuidList, PresenceAbsenceTerm.class);
90
        combo_presenceAbsence = formFactory.createDefinedTermComboElement(inputList, this, "Distribution Status", entity.getStatus(), style);
91
        //combo_presenceAbsence = formFactory.createTermComboElement(PresenceAbsenceTerm.class, this, "Distribution Status", entity.getStatus(), style);
92
        createTimePeriod(formElement, entity, style);
93
        if (entity.getFeature().getRecommendedModifierEnumeration() != null && !entity.getFeature().getRecommendedModifierEnumeration().isEmpty()){
94
            createModifier(formElement, entity, style);
95
        }else{
96
            createFreetextModifier(formElement, entity, style);
97
        }
98
	}
109
        return inputList;
110
    }
99 111

  
100 112
	/** {@inheritDoc} */
101 113
	@Override
......
103 115
	    super.handleEvent(eventSource);
104 116
	    if(eventSource == selection_namedArea){
105 117
			getEntity().setArea(selection_namedArea.getEntity());
118

  
119
	        if (selection_namedArea.getEntity()!= null){
120
	            List<DefinedTermBase> inputList = getStatusListForArea(selection_namedArea.getEntity());
121
	            //combo_presenceAbsence.removeElements();
122
	            combo_presenceAbsence.setTerms(inputList);
123
	        }
124

  
106 125
		}else if(eventSource == combo_presenceAbsence){
107 126
			getEntity().setStatus((PresenceAbsenceTerm)combo_presenceAbsence.getSelection());
108 127
		}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)