/** Add an initialization attribute for the tag. * This method must be called after the setTag() method */ public void addAttribute(String name, Expression expression) { if (log.isDebugEnabled()) { log.debug("adding attribute name: " + name + " expression: " + expression); } attributes.put(name, new ExpressionAttribute(name,expression)); }
private AttributesImpl buildAttributes(JellyContext context) { AttributesImpl actual = new AttributesImpl(); for (ExpressionAttribute att : attributes.values()) { Expression expression = att.exp; String v = expression.evaluateAsString(context); if (v==null) continue; // treat null as no attribute actual.addAttribute(att.nsURI, att.name, att.qname(),"CDATA", v); } if (EMIT_LOCATION) { actual.addAttribute("","file","file","CDATA",String.valueOf(getFileName())); actual.addAttribute("","line","line","CDATA",String.valueOf(getLineNumber())); // try to obtain the meaningful part of the script and put it in CSS with a // class name like "jelly-foo-bar-xyz" given "file://path/to/src/tree/src/main/resources/foo/bar/xyz.jelly" String form = getFileName().replace('\\','/'); for (String suffix : SUFFIX) { int idx = form.lastIndexOf(suffix); if (idx>0) form=form.substring(idx+suffix.length()); } int c = actual.getIndex("class"); if (c>=0) actual.setValue(c, actual.getValue(c)+" "+form); else actual.addAttribute("","class","class","CDATA",form); } return actual; } };
private AttributesImpl buildAttributes(JellyContext context) { AttributesImpl actual = new AttributesImpl(); for (ExpressionAttribute att : attributes.values()) { Expression expression = att.exp; String v = expression.evaluateAsString(context); if (v==null) continue; // treat null as no attribute actual.addAttribute(att.nsURI, att.name, att.qname(),"CDATA", v); } if (EMIT_LOCATION) { actual.addAttribute("","file","file","CDATA",String.valueOf(getFileName())); actual.addAttribute("","line","line","CDATA",String.valueOf(getLineNumber())); // try to obtain the meaningful part of the script and put it in CSS with a // class name like "jelly-foo-bar-xyz" given "file://path/to/src/tree/src/main/resources/foo/bar/xyz.jelly" String form = getFileName().replace('\\','/'); for (String suffix : SUFFIX) { int idx = form.lastIndexOf(suffix); if (idx>0) form=form.substring(idx+suffix.length()); } int c = actual.getIndex("class"); if (c>=0) actual.setValue(c, actual.getValue(c)+" "+form); else actual.addAttribute("","class","class","CDATA",form); } return actual; } };
/** Add an initialization attribute for the tag. * This method must be called after the setTag() method */ public void addAttribute(String name, Expression expression) { if (log.isDebugEnabled()) { log.debug("adding attribute name: " + name + " expression: " + expression); } attributes.put(name, new ExpressionAttribute(name,expression)); }
/** Add an initialization attribute for the tag. * This method must be called after the setTag() method */ public void addAttribute(String name, Expression expression) { if (log.isDebugEnabled()) { log.debug("adding attribute name: " + name + " expression: " + expression); } attributes.put(name, new ExpressionAttribute(name,expression)); }
/** Add an initialization attribute for the tag. * This method must be called after the setTag() method */ public void addAttribute(String name, String prefix, String nsURI, Expression expression) { if (log.isDebugEnabled()) { log.debug("adding attribute name: " + name + " expression: " + expression); } if(name.indexOf(':')==-1) name = prefix + ':' + name; attributes.put(name, new ExpressionAttribute(name,prefix,nsURI,expression)); }
/** Add an initialization attribute for the tag. * This method must be called after the setTag() method */ public void addAttribute(String name, String prefix, String nsURI, Expression expression) { if (log.isDebugEnabled()) { log.debug("adding attribute name: " + name + " expression: " + expression); } if(name.indexOf(':')==-1) name = prefix + ':' + name; attributes.put(name, new ExpressionAttribute(name,prefix,nsURI,expression)); }
/** Add an initialization attribute for the tag. * This method must be called after the setTag() method */ public void addAttribute(String name, String prefix, String nsURI, Expression expression) { if (log.isDebugEnabled()) { log.debug("adding attribute name: " + name + " expression: " + expression); } if(name.indexOf(':')==-1) name = prefix + ':' + name; attributes.put(name, new ExpressionAttribute(name,prefix,nsURI,expression)); }