public Tag decorate(Tag tag) { if (XhtmlNamespace.equals(tag.getNamespace())) { String n = tag.getLocalName(); if ("a".equals(n)) { return new Tag(tag.getLocation(), HtmlLibrary.Namespace, "commandLink", tag.getQName(), tag.getAttributes()); return new Tag(tag.getLocation(), HtmlLibrary.Namespace, "form", tag.getQName(), tag.getAttributes()); TagAttribute attr = tag.getAttributes().get("type"); if (attr != null) { String t = attr.getValue(); TagAttributes na = removeType(tag.getAttributes()); if ("text".equals(t)) { return new Tag(tag.getLocation(), HtmlLibrary.Namespace, "inputText", tag .getQName(), na); return new Tag(tag.getLocation(), HtmlLibrary.Namespace, "inputSecret", tag .getQName(), na); return new Tag(tag.getLocation(), HtmlLibrary.Namespace, "inputHidden", tag .getQName(), na); return new Tag(tag.getLocation(), HtmlLibrary.Namespace, "commandButton", tag .getQName(), na);
/** * */ public TagException(Tag tag) { super(tag.toString()); }
public Tag(Tag orig, TagAttributes attributes) { this(orig.getLocation(), orig.getNamespace(), orig.getLocalName(), orig .getQName(), attributes); }
private final static String print(Tag tag, TagAttribute attr) { return tag.getLocation() + " <" + tag.getQName() + " " + attr.getQName() + "=\"" + attr.getValue() + "\">"; }
/** * Utility method for fetching the appropriate TagAttribute * * @param localName * name of attribute * @return TagAttribute if found, otherwise null */ protected final TagAttribute getAttribute(String localName) { return this.tag.getAttributes().get(localName); }
private String[] determineQName(Tag tag) { TagAttribute attr = tag.getAttributes().get("jsfc"); if (attr != null) { if (log.isLoggable(Level.FINE)) { log.fine(attr + " JSF Facelet Compile Directive Found"); } String value = attr.getValue(); String namespace, localName; int c = value.indexOf(':'); if (c == -1) { namespace = this.namespaceManager.getNamespace(""); localName = value; } else { String prefix = value.substring(0, c); namespace = this.namespaceManager.getNamespace(prefix); if (namespace == null) { throw new TagAttributeException(tag, attr, "No Namespace matched for: " + prefix); } localName = value.substring(c + 1); } return new String[] { namespace, localName }; } else { return new String[] { tag.getNamespace(), tag.getLocalName() }; } }
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; }
this.buffer.append(tag.getQName()); this.addInstruction(new StartElementInstruction(tag.getQName())); TagAttribute[] attrs = tag.getAttributes().getAll(); if (attrs.length > 0) { for (int i = 0; i < attrs.length; i++) {
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { this.unit.pushTag(new Tag(this.createLocation(), uri, localName, qName, this.createAttributes(attributes))); }
protected MetaRuleset createMetaRuleset(Class type) { MetaRuleset meta = super.createMetaRuleset(type); if (!UILibrary.Namespace.equals(this.tag.getNamespace())) { meta.add(new TagMetaData(type)); } meta.alias("class", "styleClass"); return meta; }
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 void applyMetadata(FaceletContext ctx, Object instance) { UIComponent c = (UIComponent) instance; Map attrs = c.getAttributes(); attrs.put("alias.element", tag.getQName()); if (this.attrs.length > 0) { attrs.put("alias.attributes", this.attrs); } }
private Tag trimNSAttributes(Tag tag) { TagAttribute[] attr = tag.getAttributes().getAll(); int remove = 0; for (int i = 0; i < attr.length; i++) { return new Tag(tag.getLocation(), tag.getNamespace(), tag .getLocalName(), tag.getQName(), new TagAttributes(attr));
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()]); }
/** * @param cause */ public TagException(Tag tag, Throwable cause) { super(tag.toString(), cause); }
/** * @param config */ public UserTagHandler(TagConfig config, URL location) { super(config); this.vars = this.tag.getAttributes().getAll(); this.location = location; Iterator itr = this.findNextByType(DefineHandler.class); if (itr.hasNext()) { handlers = new HashMap(); DefineHandler d = null; while (itr.hasNext()) { d = (DefineHandler) itr.next(); this.handlers.put(d.getName(), d); } } else { handlers = null; } }
public String toString() { return this.tag.toString(); } }
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 String toString() { return this.tag.toString(); }