/** * Retreive the last known index stored before removal. */ int getLastKnownIndex(BeanProp prop) { BeanProperty bp = this.getBeanProperty(prop); if (bp != null) return bp.lastIndex; else return -1; }
/** * Used when we remove a property to set the index it used to be * in the BeanProp bindings array. This is how when we build on event * that reference an element which has been removed we know about * its previous index. */ void setLastKnownIndex(BeanProp prop, int index) { BeanProperty bp = this.getBeanProperty(prop); if (bp != null) bp.lastIndex = index; }
/** * This method returns the bean associated to the BeanProp object. * Since there can be only one Node per BeanProp (single content as * one bean or one distinct Node per each element if indexed prop), * there is only one entry for this BeanProp object. * * The object returned can be either a bean or a wrapper object. */ Object getBean(BeanProp prop) { BeanProperty bp = this.getBeanProperty(prop); if (bp != null) return bp.value; else return null; }
/** * Return the value of the attribute. Get the value from the DOM Node * or from the cache, depending on the existance of the DOM Node. */ String getAttributeValue(BeanProp prop, String name) { if (this.node != null) { // Get the value from the DOM Node Attr a = ((Element)this.node).getAttributeNode(name); if (a != null) return a.getValue(); else return null; } else { // Get the value from the cache BeanProperty bp = this.getBeanProperty(prop); if (bp != null && bp.attributes != null) { CacheAttr ca = findCacheAttr(bp, name); if (ca != null) return ca.value; } } return null; }
BeanProperty bp = this.getBeanProperty(prop); if (bp.attributes == null) bp.attributes = new ArrayList();
/** * Fill the attribute with the default values - this is typically * called when a new property is created, before it is synced into * a DOM Node. This makes the attributes cached and when the property * is turned into a DOM node, the attributes are also created. */ void setDefaultAttributeValues(BeanProp prop) { BeanProperty bp = this.getBeanProperty(prop); if (bp != null) { // Set the default values BaseAttribute[] ap = prop.getAttributes(); for (int i=0; i<ap.length; i++) { String value = ap[i].getDefaultValue(); if (value != null) this.setAttributeValue(prop, ap[i].getDtdName(), value); } } }
BeanProperty bp = this.getBeanProperty(prop);
BeanProperty bp = this.getBeanProperty(prop);