org.ceryle.ui.help
Class HelpProcess

java.lang.Object
  extended by java.lang.Thread
      extended by org.ceryle.ui.help.HelpProcess
All Implemented Interfaces:
Runnable

public class HelpProcess
extends Thread

Extends Thread to create a help, evaluation or tutorial process. This is a sequence of actions specified by an XHTML-based script, where each activity is established by markup as shown in the following example. Each <div> element is considered as one slide of a slide show if it contains a class attribute whose value is "help". The <div> content can include XHTML markup (though links do not currently function).

   <div class="help" id="q1" title="Question 1"><!-- ............................ -->
   <p>
   This is question one of the tutorial.
   Please turn to page 7 of your study guide, then stand on your head for
   ten minutes. If you do not feel rested and assured, see your doctor. When
   finished, go to question two by clicking on the <b>Next</b> button.
   </p>
   <script type="text/x-ceryle-helpscript">
   OPENGRAPH "systemId"
   GRAPHSELECT "id"
   </script>
   </div>
 
The <script> content is line-delimited list of HelpActions (which can be combined recursively), each containing an interpretable case-sensitive keyword followed by optional parameters (depending on the keyword), designed to initiate a specific action within the help processor.

See the HelpDialog for a list of available HelpActions.

Since:
JDK1.4
Version:
$Id: HelpProcess.java,v 3.25 2007-06-20 01:28:23 altheim Exp $
Author:
Murray Altheim

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
static String helpClass
          The 'class' attribute value key indicating that a <div> is to be used as a Help slide.
protected  HelpDialog m_dlog
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
HelpProcess(HelpDialog dialog)
          Constructor for the default Help process (the one shown upon opening Help).
HelpProcess(HelpDialog dialog, String scriptfile)
          Constructor for a help process.
HelpProcess(HelpDialog dialog, String cid, String nid)
          Constructor for a help process whose Collection and document IDs are provided.
 
Method Summary
 void close()
          Called to end the sequence.
protected  void fireCounterUpdate()
          Indicates a change to the slide counter.
protected  void index()
          Open the first action.
protected  int indexOf(HelpAction action)
          Returns the index number of the provided action, -1 if it is not contained in the list.
 boolean isDefault()
          Returns true if this is the default process.
 boolean isEvaluation()
          Returns true if this is identified as an evaluation process.
protected  boolean load(String id)
          Process the action indicated by the supplied ID, returning true if loaded.
protected  void next()
          Process the next action.
protected  void previous()
          Process the previous action.
protected  List process(String cid, String nid)
          Processes the DOM Document resulting from parsing the XHTML file, given a TypedInputSource source containing its identifier.
protected  List process(TypedInputSource source)
          Processes the DOM Document resulting from parsing the XHTML file, given a TypedInputSource source containing its identifier.
protected  void processImages(Element elt)
          Provided an Element, process any descendant <img> elements' src attributes to provide a base file: URL that connects with the resource directory.
 void run()
          Begin thread.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

helpClass

public static String helpClass
The 'class' attribute value key indicating that a <div> is to be used as a Help slide. Default is "help".


m_dlog

protected HelpDialog m_dlog
Constructor Detail

HelpProcess

public HelpProcess(HelpDialog dialog)
Constructor for the default Help process (the one shown upon opening Help).


HelpProcess

public HelpProcess(HelpDialog dialog,
                   String cid,
                   String nid)
Constructor for a help process whose Collection and document IDs are provided.


HelpProcess

public HelpProcess(HelpDialog dialog,
                   String scriptfile)
Constructor for a help process.

Method Detail

run

public void run()
Begin thread. Runs a manually-steppable loop (traversed by the 'index', 'prev', 'next', and 'end' buttons).

Specified by:
run in interface Runnable
Overrides:
run in class Thread

isDefault

public boolean isDefault()
Returns true if this is the default process.


isEvaluation

public boolean isEvaluation()
Returns true if this is identified as an evaluation process.


indexOf

protected int indexOf(HelpAction action)
Returns the index number of the provided action, -1 if it is not contained in the list.


index

protected void index()
Open the first action. If there is an action whose ID is "index", it will be loaded instead. If the current counter is at the first action, nothing happens.


load

protected boolean load(String id)
Process the action indicated by the supplied ID, returning true if loaded. If the ID doesn't match any action, a warning is indicated and nothing happens.


previous

protected void previous()
Process the previous action. If the current counter is at the first action, nothing happens.


next

protected void next()
Process the next action. If the current counter is at the last action, nothing happens.


fireCounterUpdate

protected void fireCounterUpdate()
Indicates a change to the slide counter.


process

protected List process(String cid,
                       String nid)
Processes the DOM Document resulting from parsing the XHTML file, given a TypedInputSource source containing its identifier. Following parsing, the Document object is then queried for individual questions, each built as a HelpAction object containing a title, body, and optional list of actions. The resulting List is returned.


process

protected List process(TypedInputSource source)
Processes the DOM Document resulting from parsing the XHTML file, given a TypedInputSource source containing its identifier. Following parsing, the Document object is then queried for individual questions, each built as a HelpAction object containing a content body and optional list of actions. The resulting List is returned.


processImages

protected void processImages(Element elt)
Provided an Element, process any descendant <img> elements' src attributes to provide a base file: URL that connects with the resource directory. The directory is ./resource/help/img/. If the image has a full URL rather than just a filename, it is left unmodified.


close

public void close()
Called to end the sequence.



The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.