Open SiteSearch 4.1.1
Final

ORG.oclc.mantis
Class MantisXML

java.lang.Object
  |
  +--ORG.oclc.mantis.MantisXML

public class MantisXML
extends Object


Field Summary
 boolean applet
           
 Hashtable appletEntities
           
 String appletParamList
           
 Hashtable appletPost
           
 String appName
           
 String appVersion
           
 Document clone
           
static int CLONE
           
 boolean displayWrapper
           
 netscape.javascript.JSObject js
           
 String lastTemplateName
           
 MantisUtil mu
           
 DataDir native_dir
           
 boolean raggedDisplay
           
 boolean showButtons
           
 Document template
           
static int TEMPLATE
           
 Hashtable user
           
 Document xmldoc
           
static int XMLDOC
           
 
Constructor Summary
MantisXML(Document xml, Document temp, Hashtable userObject)
          Create an instance of this class.
MantisXML(Document xml, Hashtable userObject)
          Create an instance of this class.
MantisXML(Document xml, Hashtable userObject, MantisUtil mu)
          Create an instance of this class.
MantisXML(Document xml, RequestManager req, MantisUtil mu)
          Create an instance of this class.
 
Method Summary
 Document addMantisTreeID(Document doc)
           
 Element addMantisTreeID(Document doc, Element el, boolean parentProtected)
           
 void addNode(Element el, String id)
          Add an exact replicate of the specified element (minus the data) to the parent's child list.
 void appendToAppletPost(String name, Object value)
          Add an object to the hashtable of the applet that simulates a form post.
static int autosize(ElementInfoObject eio)
          Get the correct height from looking at the specified hieght, total content, as well as the autosize flag.
 void buildAppletPost()
          Build a hashtable that contains all the form element data for the applet to use to update a record.
 void changeElementDisplay(Element el, String type)
          Change the display type of an element.
static void clean(Element el)
          Removes element specific data from the Element and all its subelements.
 void cleanLocalData(Element el)
           
static void cleanNonMantisElements(Element el)
           
static Document clone(Document doc)
          Footprint into clone
static Document clone(Document doc, boolean preserveLocalData)
           
static Element clone(Element el, Document doc)
          Make a copy of the specified element.
static Element clone(Element el, Document doc, boolean preserveLocalData)
           
 void cloneRecord()
          Clone a record in a database and give the clone an original ID.
protected  Element cloneStructure(Element el)
          Copy an Element and all of its subelements, then clean out some of the data that is element specific.
 String createAppletParams()
          Create the applet parameters that will be inserted into the MantisApplet.html page.
 void decreaseHeight(Element el)
          Decrease the value of an Element's MANTIS:height tag.
 void decreaseHeight(int id)
          Footprint into decreaseHeight.
 String display(Element el)
          Footprint into display.
 String display(ElementInfoObject eio)
           
protected  void display(ElementInfoObject eio, int level, StringBuffer out, boolean editable, boolean expanded, boolean templateEditor)
          Footprint into display
protected  void display(ElementInfoObject eio, int level, StringBuffer out, boolean editable, boolean expanded, boolean templateEditor, String action)
          This method creates HTML displays for the record viewer as well as the record editor.
protected  void displayAnchor(ElementInfoObject eio, StringBuffer out)
          Generate the HTML to display an anchor display.
 void displayContent(ElementInfoObject eio, boolean editable, String action, boolean templateEditor, StringBuffer out, StringBuffer buf, String id)
          Generate the HTML to display the content portion of an element's display in record view mode.
 void displayContentLabel(ElementInfoObject eio, StringBuffer buf, StringBuffer out, String id)
          Generate the HTML to display the label portion of an element's display in record view mode.
 void displayDataCheck(ElementInfoObject eio, StringBuffer out, boolean templateEditor)
          Generate the HTML to display the dataCheck portion of an element's display in record view mode.
 void displayEnlarger(ElementInfoObject eio, StringBuffer out, String id, boolean templateEditor)
          Generate the HTML to display enlarger buttons.
 void displayError(ElementInfoObject eio, StringBuffer out)
          Generate the HTML to display an error.
 void displayHeader(ElementInfoObject eio, StringBuffer msg, String action)
           
 void displayHeading(ElementInfoObject eio, StringBuffer out)
          Generate the HTML to display the heading portion of an element's display in record edit mode.
 void displayHook(ElementInfoObject eio, StringBuffer out, String id, boolean templateEditor)
          Generate the HTML to display the hook portion of an element's display.
 void displayLabel(ElementInfoObject eio, StringBuffer buf, StringBuffer out, String id, boolean templateEditor)
          Generate the HTML to display the label portion of an element's display.
 void displayListbox(ElementInfoObject eio, StringBuffer out, String id)
          Generate the HTML to display a listbox display.
protected  void displayListboxAlternate(ElementInfoObject eio, StringBuffer out, String id)
          Generate the HTML to display a listbox alternate display.
 void displayMailto(ElementInfoObject eio, StringBuffer out)
          Generate the HTML to display a mailto display.
 void displayRadio(ElementInfoObject eio, StringBuffer out, String id)
          Generate the HTML to display a radio button display.
 void displayReplicable(ElementInfoObject eio, StringBuffer out, String id, boolean templateEditor)
          Generate the HTML to display replication buttons.
 void displaySmartListbox(String value, String id, Vector list, StringBuffer out)
           
 void displaySmartListbox(String value, String id, Vector list, StringBuffer out, String javascript)
           
 void displaySmartListbox(String value, String id, Vector list, Vector values, StringBuffer out, String javascript)
           
 void displaySpacingElements(ElementInfoObject eio, StringBuffer out, boolean templateEditor)
          Generate the HTML to display the spacing element's portion of an element's display.
 void displayTableCell(ElementInfoObject eio, StringBuffer out, String id)
          This method creates the data segment of the element display.
 void displayWarning(ElementInfoObject eio, StringBuffer out)
          Generate the HTML to display a warning
 HookData doHooks(int which, String action)
          Setup method for runHooks.
 HookData doHooks(String action)
          Footprint to doHooks which defaults to the XMLDOC document.
 String escape(String str)
          Perform HTML escaping for >, <, &, " in the specified String.
static String escapeQuotes(String str)
          Escape any quotes found in a String with HTML entities.
 HookData export(MantisXML xmltree, Document xmldoc, String action)
           
static DataDir exportMARC(DataDir dir, Element el, TagFile tf, Hashtable user, MantisUtil mu)
           
static Element findChild(Element parent, String tag)
          Returns the child element of parent with the matching tagName or null.
static DataDir[] fromNative(DataDir dir, Element el, TagFile tf, Hashtable user, MantisUtil mu)
          Scans the immediate children of el for any that are hooks and runs the fromNative method of any hook it finds.
static Class getClass(String hook)
          Dynamically creates and instance of a class specified by it's fully qualified string name.
 Document getDoc()
           
 Element getElement(Element parent, String tag)
          Returns the child element of parent with the matching tagName.
 Element getElement(int elementID)
          Returns the element associatted with the integer provided.
 String getElementID(Element el)
          Get an element's ID as it would appear in HTML display.
 ElementInfoObject getElementInfo(Element el)
          Get an ElementInfoObject containg data from the specified element and all of its children.
 ElementInfoObject getElementInfo(Element el, boolean templateEditor)
           
 Object getEntity(String name)
          Get an object out of the user object.
 MantisInfo getInfo()
           
 String getLabelName(ElementInfoObject eio)
          Get the display label for an element.
 String getLabelName(ElementInfoObject eio, boolean doReplace)
           
 void getMantisLists(Element el)
          Collect all the lists that are specified in the element tree.
 String getNextID(int id)
          Get the id of the next element in the element tree.
 Element getNextOfType(Element el)
          Gets the next Element of the same type from the sibling list.
 String getPost(String name)
          Search the posted form data, whether from the applet or from the server.
 String getPreviousID(int id)
          Get the id of the previous element in the element tree.
 Element getPreviousOfType(Element el)
          Get the previous Element of the same type in the sibling list.
static String getRDFValue(Element el)
          Get the RDF:Value data from a specified Element.
 String getReplicate(int id)
          Replicate an element and create the HTML display for that new element.
 RequestManager getRequestManager()
           
 Element getRightMostSubnode(Element el)
          Get the right most subnode of the specified element.
 String getRightMostSubnode(int id)
          Footprint to getRightMostSubnode
static Element getStaticElement(Element parent, String tag)
          Returns the child element of parent with the matching tagName.
 Document getTemplate()
           
 Hashtable getUser()
          Get the user object.
static String getValue(Element el)
           
static String getValue(Element el, String tag)
           
 boolean hookWasClicked(Element el)
          Check to see if a hook was clicked by the user.
 void increaseHeight(Element el)
          Increase the value of an Element's MANTIS:height tag.
 void increaseHeight(int id)
          Footprint into increaseHeight.
 boolean isDisplayType(Element el, String type)
          Returns the results of a display check.
protected  boolean isFirstOfType(Element el)
          Check to see if there are other elements of the same type before the specified element in the parent's child list.
protected  boolean isLastOfType(Element el)
          Check to see if there are other elements of the same type after the specified element in the parent's child list.
protected static boolean isProtectedNamespace(Element el)
          Check to see if an element is in a protected namespace.
 void killElement(int actionNode)
          Remove an Element from the Element Tree with no checks.
 int lastNode()
           
 int levelsIn(Element el)
          Determine the depth of an element in the document.
 void mergeTemplate(int actionNode)
          Foot print into mergeTemplate.
protected  void moveNodeDown(Element el)
          Moves an Element down one level in the XML tree if it is not the last Element of type ELEMENT in the sibling list.
 void moveNodeDown(int actionNode)
          Footprint to moveNodeDown.
protected  void moveNodeIn(Element el)
          Moves an Element in one level in the XML tree if it not the first Element of type ELEMENT in its sibling list.
 void moveNodeIn(int actionNode)
          Footprint to moveNodeIn.
protected  void moveNodeOut(Element el)
          Moves an Element out one level in the XML tree if it is not a direct child of the root node.
 void moveNodeOut(int actionNode)
          Footprint to moveNodeOut.
protected  void moveNodeUp(Element el)
          Moves an Element up one level in the XML tree if it is not the first Element of type ELEMENT in the sibling list.
 void moveNodeUp(int actionNode)
          Footprint into moveNodeUp
 void narrowerWidth(Element el)
          Decrease the value of an Element's MANTIS:width tag.
 void narrowerWidth(int id)
          Footprint to narrowerWidth.
 boolean noautosize(int id)
          Check to see if textarea should be autosized.
 void preExport(MantisXML xmltree, Document xmldoc)
           
 void putEntity(String name, Object value)
          Put an object into the user object.
 void remakeHash(Element el)
          Get the data corresponding to the given element.
static DataDir remap(DataDir dir, Element el, TagFile tf, Hashtable user)
           
 void remove(int id)
          Remove an element from the document given its HTML identifier.
 void removeElement(Element el)
          Remove an element from the from the hashtable
 void removeElement(int id)
          Remove an element from the document.
protected  void removeNode(Element el)
          Removes an Element from its parent.
 void removeTokens(Element el)
           
 Element renameAndReturnElement(Element el, String tag)
           
 void renameElement(Element el, String tag)
           
 String replace(String str, String delim, String replace)
          Replace a string portion with an alternate string.
 void rmPost(String name)
          Remove an element from the posted form data.
 void setDoc(Document xml)
           
 void setElement(Element el, int id)
          Set an element mapping between an element and how it is displayed on an HTML page.
 void setJSObject(netscape.javascript.JSObject local_js)
          Set the js instance variable.
static void setStaticValue(Element el, String value, boolean templateEditor, boolean marc)
          Try to get rid of this method.
 void setTemplate(Document tmp)
           
 void setValue(Element el, String value)
          Footprint into setValue
 void setValue(Element el, String value, boolean templateEditor)
          Set the value of an Element with a specified value.
 void setWidgets(DataPairs widgets)
          Set the widgets object in this class.
 void toggleSection(Element el, int node)
          Toggles the section element value for the element associatted with the integer node.
 void toggleSection(int node)
          Footprint into toggleSection.
static DataDir toNative(DataDir dir, DataDir native_dir, Element el, TagFile tf, Hashtable user, MantisUtil mu)
           
 String toSGML()
           
static String toSGML(Element el)
           
 String toString()
          A footprint to the toString method.
 String toString(boolean editable)
          A footprint to the toString method.
 String toString(boolean editable, boolean templateEditor)
          A footprint to the toString method.
 String toString(boolean editable, DataPairs mywidgets)
          A footprint to the toString method.
 String toString(boolean editable, DataPairs mywidgets, String action)
          A footprint to the toString method.
 String toString(boolean editable, int document, boolean templateEditor)
          A footprint to the toString method.
 String toString(boolean editable, int document, boolean templateEditor, String action)
          Complete call of this method.
 String toString(String action)
          A footprint to the toString method.
static DataDir update(DataDir dir, Element el, TagFile tf, Hashtable user, MantisUtil mu)
           
 void updateElement(int id, String value)
          Update an element given its ID and new value.
 void updateNode(DataPairs widgets, int actionNode)
          Footprint into updateNode.
 void updateStructure(int id, String action)
          Updates an the structure or the content as well as the structure of an element according to the specified action.
 void updateTemplate(DataPairs widgets, Element el)
          Walk the element tree and get the corresponding values from the widgets.
 void updateTree(DataPairs widgets, int actionNode, String action)
          Footprint into updateTree.
 void updateTree(Element el, DataPairs widgets, int actionNode, String action, boolean templateEditor)
          Footprint into updateTree.
 void updateTree(Element el, int actionNode, String action, boolean templateEditor)
          Updates an element tree with updates provided from the widgets, as well as from the action generated from the user.
 void updateTree(int actionNode, String action)
          Footprint into updateTree.
 HookData view(MantisXML xmltree, Document xmldoc, String action)
           
 void widerWidth(Element el)
          Increase the value of an Element's MANTIS:width tag.
 void widerWidth(int id)
          Footprint to widerWidth.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

xmldoc

public Document xmldoc

clone

public Document clone

lastTemplateName

public String lastTemplateName

user

public Hashtable user

template

public Document template

XMLDOC

public static final int XMLDOC

TEMPLATE

public static final int TEMPLATE

CLONE

public static final int CLONE

mu

public MantisUtil mu

applet

public boolean applet

showButtons

public boolean showButtons

appletParamList

public String appletParamList

appletPost

public Hashtable appletPost

appletEntities

public Hashtable appletEntities

js

public netscape.javascript.JSObject js

appName

public String appName

appVersion

public String appVersion

displayWrapper

public boolean displayWrapper

native_dir

public DataDir native_dir

raggedDisplay

public boolean raggedDisplay
Constructor Detail

MantisXML

public MantisXML(Document xml,
                 Hashtable userObject)
Create an instance of this class.
Parameters:
xml - - The XML Document used throughout many public instance methods. This object drives the class as it contains the record itself, the database structure, as well as display information.
userObject - - A Hashtable containing session information.

MantisXML

public MantisXML(Document xml,
                 RequestManager req,
                 MantisUtil mu)
Create an instance of this class.
Parameters:
xml - - the XML Document used throughout many public instance methods. This object drives the class as it contains the record itself, the database structure, as well as display information.
req - - The JaSSI object that contains all the information about a given session.
mu - - A MantisUtil instance. Contains database information.

MantisXML

public MantisXML(Document xml,
                 Hashtable userObject,
                 MantisUtil mu)
Create an instance of this class.
Parameters:
xml - - The XML Document used throughout many public instance methods. This object drives the class as it contains the record itself, the database structure, as well as display information.
userObject - - A Hashtable containing session information.
mu - - A MantisUtil instance. Contains database information.

MantisXML

public MantisXML(Document xml,
                 Document temp,
                 Hashtable userObject)
Create an instance of this class.
Parameters:
xml - - The XML Document used throughout many public instance methods. This object drives the class as it contains the record itself, the database structure, as well as display information.
temp - - The XML Document that contains the record structure without any of the record data. Used to strip out the record content for updates to the database.
userObject - - A Hashtable containing session information.
Method Detail

isDisplayType

public boolean isDisplayType(Element el,
                             String type)
Returns the results of a display check.
Parameters:
el - - The Element being checked
type - - The display type being checked.
Returns:
- The result of the check.

isProtectedNamespace

protected static boolean isProtectedNamespace(Element el)
Check to see if an element is in a protected namespace.
Parameters:
el - - The element to check.
Returns:
- The result of the check.

isFirstOfType

protected boolean isFirstOfType(Element el)
Check to see if there are other elements of the same type before the specified element in the parent's child list.
Parameters:
el - - The element to check.
Returns:
- The result of the check.

isLastOfType

protected boolean isLastOfType(Element el)
Check to see if there are other elements of the same type after the specified element in the parent's child list.
Parameters:
el - - The element to check.
Returns:
- The result of the check.

hookWasClicked

public boolean hookWasClicked(Element el)
Check to see if a hook was clicked by the user.
Parameters:
el - - The parent of the hook in question.
Returns:
- If hook was clicked.

toSGML

public String toSGML()

toSGML

public static String toSGML(Element el)

toString

public String toString()
A footprint to the toString method. Creates an HTML display of the record in editable format.
Returns:
- A String containing the ready to be used HTML display of the record editor interface.
Overrides:
toString in class Object

toString

public String toString(boolean editable)
A footprint to the toString method. Creates an HTML display of the record.
Parameters:
editable - - A flag for displaying in edit or display mode.
Returns:
- A String containing the ready to be used HTML display of the record editor interface.

toString

public String toString(String action)
A footprint to the toString method. Creates an HTML display of the record in editable format.
Parameters:
action - - A String containing the action of the user.
Returns:
- A String containing the ready to be used HTML display of the record editor interface.

toString

public String toString(boolean editable,
                       boolean templateEditor)
A footprint to the toString method. Creates an HTML display of the record.
Parameters:
editable - - A flag for displaying in edit or display mode.
templateEditor - - A flag specifying if in template editor or record editor.
Returns:
- A String containing the ready to be used HTML display of the record editor interface.

toString

public String toString(boolean editable,
                       DataPairs mywidgets)
A footprint to the toString method. Creates an HTML display of the record.
Parameters:
editable - - A flag for displaying in edit or display mode.
mywidgets - - A DataPairs object containing the widgets from the previous HTML page.
Returns:
- A String containing the ready to be used HTML display of the record editor interface.

toString

public String toString(boolean editable,
                       DataPairs mywidgets,
                       String action)
A footprint to the toString method. Creates an HTML display of the record.
Parameters:
editable - - A flag for displaying in edit or display mode.
mywidgets - - A DataPairs object containing the widgets from the previous HTML page.
action - - A String containing the action of the user.
Returns:
- A String containing the ready to be used HTML display of the record editor interface.

toString

public String toString(boolean editable,
                       int document,
                       boolean templateEditor)
A footprint to the toString method. Creates an HTML display of the record.
Parameters:
editable - - A flag for displaying in edit or display mode.
document - - An integer specifying which document to display.
templateEditor - - Flag specifying which environment we are displaying into.

toString

public String toString(boolean editable,
                       int document,
                       boolean templateEditor,
                       String action)
Complete call of this method. Create the HTML code to display the edit or display screens for the given xml document.
Parameters:
editable - - A flag for displaying in edit or display mode.
document - - An integer specifying which document to display.
templateEditor - - Flag specifying which environment we are displaying into.
action - - A String containing the action of the user.
Returns:
- A String containing the ready to be used HTML display of the record editor interface.

displayLabel

public void displayLabel(ElementInfoObject eio,
                         StringBuffer buf,
                         StringBuffer out,
                         String id,
                         boolean templateEditor)
Generate the HTML to display the label portion of an element's display.
Parameters:
eio - - An ElementInfoObject containing Mantis element data.
buf - - Horizontal offset string.
out - - StringBuffer to receive the generated HTML.
id - - ID of an element from an HTML page.
templateEditor - - Flag specifying if in the Template Editor.

displayHook

public void displayHook(ElementInfoObject eio,
                        StringBuffer out,
                        String id,
                        boolean templateEditor)
Generate the HTML to display the hook portion of an element's display.
Parameters:
eio - - An ElementInfoObject containing Mantis element data.
out - - StringBuffer to receive the generated HTML.
id - - ID of an element from an HTML page.
templateEditor - - Flag specifying if in the Template Editor.

displaySpacingElements

public void displaySpacingElements(ElementInfoObject eio,
                                   StringBuffer out,
                                   boolean templateEditor)
Generate the HTML to display the spacing element's portion of an element's display.
Parameters:
eio - - An ElementInfoObject containing Mantis element data.
out - - StringBuffer to receive the generated HTML.
templateEditor - - Flag specifying if in the Template Editor.

displayContentLabel

public void displayContentLabel(ElementInfoObject eio,
                                StringBuffer buf,
                                StringBuffer out,
                                String id)
Generate the HTML to display the label portion of an element's display in record view mode.
Parameters:
eio - - An ElementInfoObject containing Mantis element data.
buf - - Horizontal offset string.
out - - StringBuffer to receive the generated HTML.
id - - ID of an element from an HTML page.

displayContent

public void displayContent(ElementInfoObject eio,
                           boolean editable,
                           String action,
                           boolean templateEditor,
                           StringBuffer out,
                           StringBuffer buf,
                           String id)
Generate the HTML to display the content portion of an element's display in record view mode.
Parameters:
eio - - An ElementInfoObject containing Mantis element data.
buf - - Horizontal offset string.
out - - StringBuffer to receive the generated HTML.
id - - ID of an element from an HTML page.

displayHeading

public void displayHeading(ElementInfoObject eio,
                           StringBuffer out)
Generate the HTML to display the heading portion of an element's display in record edit mode.
Parameters:
eio - - An ElementInfoObject containing Mantis element data.
out - - StringBuffer to receive the generated HTML.

displayDataCheck

public void displayDataCheck(ElementInfoObject eio,
                             StringBuffer out,
                             boolean templateEditor)
Generate the HTML to display the dataCheck portion of an element's display in record view mode.
Parameters:
eio - - An ElementInfoObject containing Mantis element data.
out - - StringBuffer to receive the generated HTML.
templateEditor - - Flag specifying whether in the Template Editor or not.

displayRadio

public void displayRadio(ElementInfoObject eio,
                         StringBuffer out,
                         String id)
Generate the HTML to display a radio button display.
Parameters:
eio - - An ElementInfoObject containing Mantis element data.
out - - StringBuffer to receive the generated HTML.
id - - ID of an element from an HTML page.

displayListbox

public void displayListbox(ElementInfoObject eio,
                           StringBuffer out,
                           String id)
Generate the HTML to display a listbox display.
Parameters:
eio - - An ElementInfoObject containing Mantis element data.
out - - StringBuffer to receive the generated HTML.
id - - ID of an element from an HTML page.

displaySmartListbox

public void displaySmartListbox(String value,
                                String id,
                                Vector list,
                                StringBuffer out)

displaySmartListbox

public void displaySmartListbox(String value,
                                String id,
                                Vector list,
                                StringBuffer out,
                                String javascript)

displaySmartListbox

public void displaySmartListbox(String value,
                                String id,
                                Vector list,
                                Vector values,
                                StringBuffer out,
                                String javascript)

displayError

public void displayError(ElementInfoObject eio,
                         StringBuffer out)
Generate the HTML to display an error.
Parameters:
eio - - An ElementInfoObject containing Mantis element data.
out - - StringBuffer to receive the generated HTML.

displayWarning

public void