/** Helper to add on all extra non-core attributes against the widgets. */
  private void getExtraAttributes(
      Map<String, RenderParameter> attrs,
      TemplateElement element,
      String[] allowedAttributes,
      String propertySet) {
    Map<String, String> props = element.getPropertySet(propertySet);

    for (int j = 0; j < 3; j++) {
      String[] attrsToTest = null;
      if (j == 0) attrsToTest = stdEventAttrs;
      if (j == 1) attrsToTest = defAttrs;
      if (j == 2) attrsToTest = allowedAttributes;

      for (int i = 0; i < attrsToTest.length; i++) {
        String name = attrsToTest[i];
        Object v = null;

        // See if setting or a property
        if (element.hasSetting(name)) {
          v = element.getSetting(name, Object.class);
        } else if (props != null && props.containsKey(name)) {
          v = props.get(name);
        }

        // Handlers need parameter
        if (v != null) {
          if (j == 0) {
            name = name.toLowerCase();
            v = v.toString() + "(this);";
          }
          attrs.put(name, ExpressionParameter.createSimpleOrExpression(v.toString()));
        }
      }
    }
  }