/** * Find a TagAttribute that matches the passed namespace and local name. * * @param ns * namespace of the desired attribute * @param localName * local name of the attribute * @return a TagAttribute found, otherwise null */ public TagAttribute get(String ns, String localName) { if (ns != null && localName != null) { int idx = Arrays.binarySearch(this.ns, ns); if (idx >= 0) { TagAttribute[] uia = (TagAttribute[]) this.nsattrs.get(idx); for (int i = 0; i < uia.length; i++) { if (localName.equals(uia[i].getLocalName())) { return uia[i]; } } } } return null; }
protected MetaRuleset createSubComponentMetaRuleset(Class aClass) { MetaRuleset metaRuleset = super.createMetaRuleset(aClass); TagAttribute [] attrs = tag.getAttributes().getAll(); for (int i = 0; i < attrs.length; i++) { TagAttribute attr = attrs[i]; if (!(attr.getLocalName().equals(Attributes.CONVERTER) || attr.getLocalName().equals(Attributes.VALUE))) { metaRuleset.ignore(attr.getLocalName()); } } return metaRuleset; }
public MetaRulesetImpl(Tag tag, Class type) { this.tag = tag; this.type = type; this.attributes = new HashMap(); this.mappers = new ArrayList(); this.rules = new ArrayList(); // setup attributes TagAttribute[] attrs = this.tag.getAttributes().getAll(); for (int i = 0; i < attrs.length; i++) { attributes.put(attrs[i].getLocalName(), attrs[i]); } // add default rules this.rules.add(BeanPropertyTagRule.Instance); }
public TagMetaData(Class type) { Set s = new HashSet(); TagAttribute[] ta = tag.getAttributes().getAll(); for (int i = 0; i < ta.length; i++) { if ("class".equals(ta[i].getLocalName())) { s.add("styleClass"); } else { s.add(ta[i].getLocalName()); } } try { PropertyDescriptor[] pd = Introspector.getBeanInfo(type) .getPropertyDescriptors(); for (int i = 0; i < pd.length; i++) { if (pd[i].getWriteMethod() != null) { s.remove(pd[i].getName()); } } } catch (Exception e) { // do nothing } this.attrs = (String[]) s.toArray(new String[s.size()]); }
private static TagAttributes removeType(TagAttributes attrs) { TagAttribute[] o = attrs.getAll(); TagAttribute[] a = new TagAttribute[o.length - 1]; int p = 0; for (int i = 0; i < o.length; i++) { if (!"type".equals(o[i].getLocalName())) { a[p++] = o[i]; } } return new TagAttributes(a); }
protected MetaRuleset createMetaRuleset(Class aClass) { MetaRuleset metaRuleset = super.createMetaRuleset(aClass); TagAttribute [] attrs = tag.getAttributes().getAll(); for (int i = 0; i < attrs.length; i++) { TagAttribute attr = attrs[i]; if (!attr.getLocalName().equals("rendered")) { metaRuleset.ignore(attr.getLocalName()); } } return metaRuleset; } }
protected MetaRuleset createMetaRuleset(Class aClass) { MetaRuleset metaRuleset = super.createMetaRuleset(aClass); if (UISeparator.class.isAssignableFrom(aClass)) { metaRuleset.ignore(Attributes.LABEL); return metaRuleset; } else { TagAttribute[] attrs = tag.getAttributes().getAll(); for (int i = 0; i < attrs.length; i++) { TagAttribute attr = attrs[i]; metaRuleset.ignore(attr.getLocalName()); } return metaRuleset; } } }
private Tag trimJSFCAttribute(Tag tag) { TagAttribute attr = tag.getAttributes().get("jsfc"); if (attr != null) { TagAttribute[] oa = tag.getAttributes().getAll(); TagAttribute[] na = new TagAttribute[oa.length - 1]; int p = 0; for (int i = 0; i < oa.length; i++) { if (!"jsfc".equals(oa[i].getLocalName())) { na[p++] = oa[i]; } } return new Tag(tag, new TagAttributes(na)); } return tag; }
VariableMapper varMapper = new VariableMapperWrapper(orig); for (int i = 0; i < this.vars.length; i++) { varMapper.setVariable(this.vars[i].getLocalName(), this.vars[i] .getValueExpression(ctx, Object.class));