Exemplo n.º 1
0
  private static ValidationException handleXPathException(
      Exception e, String xpathString, String description, LocationData locationData) {
    final ValidationException validationException =
        ValidationException.wrapException(
            e, new ExtendedLocationData(locationData, description, "expression", xpathString));

    // Details of ExtendedLocationData passed are discarded by the constructor for
    // ExtendedLocationData above,
    // so we need to explicitly add them.
    if (locationData instanceof ExtendedLocationData)
      validationException.addLocationData(locationData);

    return validationException;
  }
  /**
   * 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()));
    }
  }