/** * Get this control's itemset. * * @param propertyContext current context * @return itemset */ public Itemset getItemset(PropertyContext propertyContext) { try { // Non-relevant control does not return an itemset if (!isRelevant()) return null; if (isNorefresh()) { // Items are not automatically refreshed and stored globally // NOTE: Store them by prefixed id because the itemset might be different between XBL // template instantiations Itemset constantItemset = containingDocument.getControls().getConstantItems(getPrefixedId()); if (constantItemset == null) { constantItemset = XFormsItemUtils.evaluateItemset(propertyContext, XFormsSelect1Control.this); containingDocument.getControls().setConstantItems(getPrefixedId(), constantItemset); } return constantItemset; } else { // Items are stored in the control return itemsetProperty.getValue(propertyContext); } } catch (Exception e) { throw ValidationException.wrapException( e, new ExtendedLocationData(getLocationData(), "evaluating itemset", getControlElement())); } }
@Override public Object getBackCopy(PropertyContext propertyContext) { final XFormsSelect1Control cloned = (XFormsSelect1Control) super.getBackCopy(propertyContext); // If we have an itemset, make sure the computed value is used as basis for comparison if (itemsetProperty != null) cloned.itemsetProperty = new ConstantControlProperty<Itemset>(itemsetProperty.getValue(propertyContext)); return cloned; }
@Override protected void markDirtyImpl(XPathDependencies xpathDependencies) { super.markDirtyImpl(xpathDependencies); if (itemsetProperty != null) itemsetProperty.handleMarkDirty(); }