Exemplo n.º 1
0
 /**
  * Return a parameter by its name. If the parameter is not defined, returns null
  *
  * @param name Parameter name to be used.
  * @return a parameter by its name. If the parameter is not defined, returns null.
  */
 protected Object getParameter(String name) {
   return tag.getParam(name);
 }
Exemplo n.º 2
0
 /**
  * Sets a parameter for the fragment. The object set as parameter value must not be changed during
  * all the execution, otherwise the result won't be as expected. That is, if this object has a
  * method that changes its content, this method must not be called by the Formatter during the
  * service() method. Otherwise, all the rendering performed by the fragmentValue tag will use the
  * *last* version of the object, the one existing after the invocation of service method, which is
  * probably not expected.
  *
  * <p>Example, of a iterating formatter: <code>
  * StringBuffer sb = new StringBuffer();<br>
  * for( int i= 0; i<10; i++){<br>
  * sb.delete(0,sb.length())<br>
  * sb.append( i );<br>
  * setAttribute("index",sb);<br>
  * renderFragment("output");<br>
  * }<br>     *
  * </code> will generate an output like : 10 10 10 10 10 10 10 10 10 10 while the expected output
  * is: 0 1 2 3 4 5 6 7 8 9
  *
  * <p>So, use objects and don't change them. This is usually easy to accomplish, by using
  * different instances, in the example above, replace sb.delete(0,sb.length()) with sb = new
  * StringBuffer();
  *
  * @param name Name of the parameter.
  * @param value It's value. Must not be changed during all the execution.
  */
 protected void setAttribute(String name, double value) {
   if (log.isDebugEnabled()) log.debug("Setting of attribute " + name + " scheduled.");
   tag.addProcessingInstruction(
       ProcessingInstruction.getSetParameterInstruction(name, new Double(value)));
 }
Exemplo n.º 3
0
 protected void setAttributeInterpreter(FormaterTagDynamicAttributesInterpreter interpreter) {
   tag.addProcessingInstruction(
       ProcessingInstruction.getAddAttributesInterpreterInstruction(interpreter));
 }
Exemplo n.º 4
0
 protected void writeToOut(String text) {
   if (log.isDebugEnabled()) log.debug("Writting '" + text + "' to output,  scheduled.");
   tag.addProcessingInstruction(ProcessingInstruction.getWriteToOutInstruction(text));
 }
Exemplo n.º 5
0
 protected void includePage(String pageName) {
   if (log.isDebugEnabled()) log.debug("Including of page " + pageName + " scheduled.");
   tag.addProcessingInstruction(ProcessingInstruction.getIncludePageInstruction(pageName));
 }
Exemplo n.º 6
0
 /**
  * Orders the processing of fragment with given name.
  *
  * @param fragmentName Name of the fragment to be rendered.
  */
 protected void renderFragment(String fragmentName) {
   if (log.isDebugEnabled()) log.debug("Rendering of fragment " + fragmentName + " scheduled.");
   tag.addProcessingInstruction(ProcessingInstruction.getRenderFragmentInstruction(fragmentName));
 }