org.activemath.presentation.preproc
Class SymbolDeclarationsTask

java.lang.Object
  extended by org.activemath.presentation.preproc.SymbolDeclarationsTask
All Implemented Interfaces:
Task

public class SymbolDeclarationsTask
extends Object
implements Task

This stateful task is responsible for the insertion the symbol pseudo-declarations at the end of the element being processed for all the symbols that appear inside the named element (as OMS elements) so that the presentation can show the title of the symbol under the mouse. At close time, this list is inserted.

This task assumes that the JDOM objects are, actually, of the package org.activemath.omdocjdom and uses the facilities of OJoms, considered to be a reference element.

The symbol pseudo declarations are mock-up symbol declarations, they are made as elements symbolForCommonName, in the ActiveMath internal namespace (OJConstants.AM_INTERNAL_NS). The attributes are ID (an absolute ID), name and theory, the sole children are the OJConstants.ELNM_commonname elements extracted from the database.

Purpose

For the presentation to be able to provide tool-tips containing the name of the symbol under the mouse, the common-name, in all available languages, are to be given. The elements created here are, then, picked by the stylesheet and used in the rendering of symbols.

Version:

Field Summary
static String CVS_ID
           
static boolean DEBUG
           
static org.jdom.output.XMLOutputter debugOutputter
           
 MBaseRef mbaseRef
           
 List omss
          the list pointing to all OMS elements
 org.jdom.Element root
           
protected static Logger thisLogCat
           
 
Constructor Summary
SymbolDeclarationsTask(org.jdom.Element root, MBaseRef mbaseRef)
           
 
Method Summary
 void close()
          Performs the actual insertion of symbol-declarations which are fetched from MBase.
static TaskFactory giveFactory(MBaseRef mbaseRef)
           
 void open()
          Invoked by the pre-processor at the beginning of PreProcessor.run(org.jdom.Element, java.util.Map).
 boolean perform(ListIterator kidsIt, org.jdom.Element elt, Map properties)
          Inserts a reference to the OMS (if it is one) in the list, otherwise returns to continue deeper.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CVS_ID

public static final String CVS_ID
See Also:
Constant Field Values

thisLogCat

protected static Logger thisLogCat

DEBUG

public static final boolean DEBUG

debugOutputter

public static final org.jdom.output.XMLOutputter debugOutputter

root

public final org.jdom.Element root

mbaseRef

public final MBaseRef mbaseRef

omss

public final List omss
the list pointing to all OMS elements

Constructor Detail

SymbolDeclarationsTask

public SymbolDeclarationsTask(org.jdom.Element root,
                              MBaseRef mbaseRef)
Method Detail

giveFactory

public static TaskFactory giveFactory(MBaseRef mbaseRef)

open

public void open()
Description copied from interface: Task
Invoked by the pre-processor at the beginning of PreProcessor.run(org.jdom.Element, java.util.Map).

Specified by:
open in interface Task

perform

public boolean perform(ListIterator kidsIt,
                       org.jdom.Element elt,
                       Map properties)
Inserts a reference to the OMS (if it is one) in the list, otherwise returns to continue deeper.

Specified by:
perform in interface Task
Parameters:
kidsIt - the iterator of all elements child of the same parent, currently enumerating this element may be null in which case the parent was not enumerated (i.e. when elt is the element called on PreProcessor.run(org.jdom.Element, java.util.Map).
elt - the element to process
properties - An object that lives during the performance and can be used to extract and store states and parameters for the processing action. Typical values include the user and session (as string in keys and value). Properties are passed at startup (i.e. in TaskFactory.make(org.jdom.Element, java.util.Map) and at each perform, they are the same object throughout.

close

public void close()
Performs the actual insertion of symbol-declarations which are fetched from MBase.

Specified by:
close in interface Task