org.sandev.generator
Class HelpFileGenerator

java.lang.Object
  extended by org.sandev.generator.GeneratorCommon
      extended by org.sandev.generator.HelpFileGenerator
All Implemented Interfaces:
org.sandev.sandbuild.SandGenerator

public class HelpFileGenerator
extends GeneratorCommon
implements org.sandev.sandbuild.SandGenerator

Write out a help file with anchor points for all structs and fields within structs. Output is to the webapp/docs area of the deployment project. Any supporting links or images must be relative to there.


Field Summary
 
Fields inherited from class org.sandev.generator.GeneratorCommon
CONTEXT_CONFIGURATION, CONTEXT_CONTROL, CONTEXT_FRAMEWORK, CONTEXT_MESSAGING, CONTEXT_PERSISTENCE, CONTEXT_UI, DEFAULT_LINE_LENGTH, MESSAGE_INTERFACES
 
Constructor Summary
HelpFileGenerator()
           
 
Method Summary
 void cleanup(org.sandev.sandbuild.SandDecl[] decls, java.io.File baseDir, boolean changed, java.lang.String extra)
          Clean up the file we wrote.
 void generate(org.sandev.sandbuild.SandDecl[] decls, java.io.File baseDir, boolean changed, java.util.Collection dirtyFiles, java.lang.String extra)
          Create the helpfile html document with anchors for each struct and field based on their print names.
static com.sun.javadoc.ClassDoc getClassDocForRef(java.lang.String classname)
          Given the class name of a struct, return the the associated ClassDoc by looking it up in the global struct decls.
protected  java.io.File getHelpfile(boolean verifyDir)
          Return the name of the helpfile we are writing.
static java.lang.String getMetatype(com.sun.javadoc.FieldDoc fd)
          Given a field doc, return its metatype in parentheses, or the empty string if no metatype defined.
static java.lang.String getRange(com.sun.javadoc.FieldDoc fd)
          Given a FieldDoc, return the range specification, or the empty string if no range defined.
static java.lang.String getStringlen(com.sun.javadoc.FieldDoc fd)
          Given a FieldDoc, return the average and maximum length of the string.
 void writeFieldHelp(java.io.PrintStream out, com.sun.javadoc.FieldDoc fd, java.lang.String classPrintname)
          Write out the help for a given field.
protected  void writeHelpEntries(java.io.PrintStream out, org.sandev.sandbuild.SandDecl[] decls)
          Write out each of the entries for the helpfile.
protected  void writeHelpEntries(java.io.PrintStream out, org.sandev.sandbuild.SandDeclTreeWrapper root)
          Given an entry tree, write it out with its children.
protected  void writeHelpEntry(java.io.PrintStream out, org.sandev.sandbuild.SandDecl sd)
          Given a struct declaration, write out a description of it.
 void writeHelpfile(java.io.File helpfile, org.sandev.sandbuild.SandDecl[] decls)
          Write the helpfile.
static void writeTypeSummary(java.io.PrintStream out, com.sun.javadoc.FieldDoc fd, boolean indent)
          Given a FieldDoc, write out a summary paragraph describing the type, allowable values and any other helpful info from the declarations.
 
Methods inherited from class org.sandev.generator.GeneratorCommon
capitalize, copyfile, deletefile, filterHTMLLine, findStructDeclByShortname, getDeclaredFields, getFields, getInheritanceHierarchy, getLastAppProject, getLastUtilDir, getLongInstanceName, getPrintStream, getSandProject, getShortInstanceName, getUtilPackage, getVisibleFields, hasSubStructs, isArray, isBasic, isLongReferenceArray, isMessageInterface, isParentAbstract, isPrimitive, isRootStruct, isVowel, log, nextToken, pluralize, rangeEscape, removePlatformDecls, trackFileDelete, trackFileWrite, uncapitalize, writeDefaultCtor, writeDescription, writeHTMLContents, writeMessageImports, writeSectionName, writeStandardCommentID, writeXHTMLFooter, writeXHTMLFooter, writeXHTMLHeader, writeXHTMLHeader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HelpFileGenerator

public HelpFileGenerator()
Method Detail

generate

public void generate(org.sandev.sandbuild.SandDecl[] decls,
                     java.io.File baseDir,
                     boolean changed,
                     java.util.Collection dirtyFiles,
                     java.lang.String extra)
              throws org.sandev.sandbuild.SandGeneratorException
Create the helpfile html document with anchors for each struct and field based on their print names. Anchors with spaces in them work, and the assumption is that the print names won't have any otherwise problematic characters.

Specified by:
generate in interface org.sandev.sandbuild.SandGenerator
Throws:
org.sandev.sandbuild.SandGeneratorException

cleanup

public void cleanup(org.sandev.sandbuild.SandDecl[] decls,
                    java.io.File baseDir,
                    boolean changed,
                    java.lang.String extra)
             throws org.sandev.sandbuild.SandGeneratorException
Clean up the file we wrote.

Specified by:
cleanup in interface org.sandev.sandbuild.SandGenerator
Throws:
org.sandev.sandbuild.SandGeneratorException

getHelpfile

protected java.io.File getHelpfile(boolean verifyDir)
Return the name of the helpfile we are writing. Verify the directory exists if indicated.


writeHelpfile

public void writeHelpfile(java.io.File helpfile,
                          org.sandev.sandbuild.SandDecl[] decls)
                   throws org.sandev.sandbuild.SandGeneratorException
Write the helpfile.

Throws:
org.sandev.sandbuild.SandGeneratorException

writeHelpEntries

protected void writeHelpEntries(java.io.PrintStream out,
                                org.sandev.sandbuild.SandDecl[] decls)
                         throws org.sandev.sandbuild.SandGeneratorException
Write out each of the entries for the helpfile.

Throws:
org.sandev.sandbuild.SandGeneratorException

writeHelpEntries

protected void writeHelpEntries(java.io.PrintStream out,
                                org.sandev.sandbuild.SandDeclTreeWrapper root)
                         throws org.sandev.sandbuild.SandGeneratorException
Given an entry tree, write it out with its children.

Throws:
org.sandev.sandbuild.SandGeneratorException

writeHelpEntry

protected void writeHelpEntry(java.io.PrintStream out,
                              org.sandev.sandbuild.SandDecl sd)
                       throws org.sandev.sandbuild.SandGeneratorException
Given a struct declaration, write out a description of it.

Throws:
org.sandev.sandbuild.SandGeneratorException

writeFieldHelp

public void writeFieldHelp(java.io.PrintStream out,
                           com.sun.javadoc.FieldDoc fd,
                           java.lang.String classPrintname)
                    throws org.sandev.sandbuild.SandGeneratorException
Write out the help for a given field.

Throws:
org.sandev.sandbuild.SandGeneratorException

getClassDocForRef

public static com.sun.javadoc.ClassDoc getClassDocForRef(java.lang.String classname)
Given the class name of a struct, return the the associated ClassDoc by looking it up in the global struct decls.


writeTypeSummary

public static void writeTypeSummary(java.io.PrintStream out,
                                    com.sun.javadoc.FieldDoc fd,
                                    boolean indent)
Given a FieldDoc, write out a summary paragraph describing the type, allowable values and any other helpful info from the declarations.


getMetatype

public static java.lang.String getMetatype(com.sun.javadoc.FieldDoc fd)
Given a field doc, return its metatype in parentheses, or the empty string if no metatype defined.


getRange

public static java.lang.String getRange(com.sun.javadoc.FieldDoc fd)
Given a FieldDoc, return the range specification, or the empty string if no range defined.


getStringlen

public static java.lang.String getStringlen(com.sun.javadoc.FieldDoc fd)
Given a FieldDoc, return the average and maximum length of the string.