public Translator[] getDynamicAttributeTranslators(DynamicElement element) { List attributes = element.getAttributes(); Translator[] translators = new Translator[attributes.size()]; int i = 0; for (Iterator it = attributes.iterator(); it.hasNext();) { DynamicAttribute attribute = (DynamicAttribute) it.next(); translators[i++] = new DynamicAttributeTranslator(attribute.getName(), FacesConfigPackage.eINSTANCE.getDynamicElement_Attributes()); } return translators; }
public Object getMOFValue(EObject mofObject) { if (mofObject instanceof DynamicElement) { EList attributes = ((DynamicElement)mofObject).getAttributes(); for (final Iterator it = attributes.iterator(); it.hasNext();) { DynamicAttribute attribute = (DynamicAttribute) it.next(); if (fDOMNames[0].equals(attribute.getName())) { return attribute.getValue(); } } } return null; }
public void setMOFValue(Notifier owner, Object value, int newIndex) { if (owner instanceof DynamicElement) { DynamicAttribute attribute = FacesConfigFactory.eINSTANCE.createDynamicAttribute(); attribute.setName(fDOMNames[0]); attribute.setValue(value.toString()); EList attributes = ((DynamicElement)owner).getAttributes(); if (newIndex < 0 || newIndex >= attributes.size()) { attributes.add(attribute); } else { attributes.set(newIndex, attribute); } } // otherwise do nothing }