org.activemath.webapp.view.tools
Class TransformTool

java.lang.Object
  extended by org.activemath.webapp.view.tools.TransformTool

public class TransformTool
extends Object

View tool for accessing the presentation system.


Field Summary
protected static Logger log
           
 
Constructor Summary
TransformTool()
           
TransformTool(Formatter formatter, Writer writer, AppModel model)
           
 
Method Summary
 Formatter getFormatter()
           
 String getGapDetectionDummy(String itemId)
          Returns a string representation of a dummy item's missing properties
 Object getItem(MBaseID itemId)
          Return an item bean tailored to this view.
 Object getItem(String itemId)
          Return an item bean tailored to this view.
 Map getKnowledgeMap()
           
 void setKnowledgeMap(Map knowledgeMap)
           
 void transformElement(org.jdom.Element element)
          Write a translated, Velocity-processed content fragment as UTF-8.
 void transformItem(String itemId)
           
 void transformItem(String itemId, boolean doVelocity)
           
 String transformItemToString(String itemId)
          Write a translated, Velocity-processed content fragment as UTF-8.
 String transformItemToString(String itemId, boolean doVelocity)
           
 void transformString(String content)
           
 void transformString(String content, Writer writer)
          Same as transformItem, but taking as source the given string.
 String transformStringToString(String content)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static Logger log
Constructor Detail

TransformTool

public TransformTool()

TransformTool

public TransformTool(Formatter formatter,
                     Writer writer,
                     AppModel model)
Method Detail

getFormatter

public Formatter getFormatter()

getItem

public Object getItem(String itemId)
Return an item bean tailored to this view.


getGapDetectionDummy

public String getGapDetectionDummy(String itemId)
Returns a string representation of a dummy item's missing properties

Parameters:
itemId - the virtual content identifier of the item

getItem

public Object getItem(MBaseID itemId)
Return an item bean tailored to this view. Used be Search.


transformItemToString

public String transformItemToString(String itemId)
Write a translated, Velocity-processed content fragment as UTF-8. The fragment is run through Velocity, so the result of the XSL transformation can contain variables like $user.id which will be resolved in the current request context. Velocity processing is not done for Latex, as the Latex output can easily be non-valid input for Velocity.


transformItemToString

public String transformItemToString(String itemId,
                                    boolean doVelocity)

transformItem

public void transformItem(String itemId)

transformItem

public void transformItem(String itemId,
                          boolean doVelocity)

transformStringToString

public String transformStringToString(String content)

transformString

public void transformString(String content)

transformString

public void transformString(String content,
                            Writer writer)
Same as transformItem, but taking as source the given string. The DOM tree has to be built in order to process the fragment with org.activemath.webapp.content.preproc.Preprocessor. Otherwise it would be enough (plus exception handling) to do return formatter.xslTransform(content).

Parameters:
content - XML fragment as UTF-8 text.
writer - for output of transformed text (UTF-8)

transformElement

public void transformElement(org.jdom.Element element)
Write a translated, Velocity-processed content fragment as UTF-8.

Parameters:
element - JDOM Element.

getKnowledgeMap

public Map getKnowledgeMap()

setKnowledgeMap

public void setKnowledgeMap(Map knowledgeMap)