Package adams.core.option
Class HtmlHelpProducer
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.option.AbstractOptionProducer<String,StringBuilder>
-
- adams.core.option.HtmlHelpProducer
-
- All Implemented Interfaces:
CleanUpHandler,FileFormatHandler,LoggingSupporter,OptionProducer<String,StringBuilder>,UserModeSupporter,SizeOfHandler,Serializable
public class HtmlHelpProducer extends AbstractOptionProducer<String,StringBuilder> implements FileFormatHandler, UserModeSupporter
Generates the help for the GUI, i.e., HTML output.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanm_ClassCrossRefLinkswhether to generate "fake" class cross reference links.protected StringBuilderm_OutputBufferthe buffer for assembling the help.protected UserModem_UserModethe user mode to generate the help for.-
Fields inherited from class adams.core.option.AbstractOptionProducer
m_Input, m_LastGenerated, m_Output, m_OutputVariableValues, m_SkippedProperties, m_UsePropertyNames
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description HtmlHelpProducer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddArgumentInfo(AbstractArgumentOption option, StringBuilder buffer)Adds additional information about the argument, e.g., the class.protected voidaddToolTip(AbstractOption option, StringBuilder buffer)Breaks up the tool tip and adds it to the StringBuilder.booleangetClassCrossRefLinks()Returns whether to generate class cross-reference links for the help user interface.StringgetDefaultFormatExtension()Returns the default file extension (without the dot).StringgetFormatDescription()Returns the description of the file format.String[]getFormatExtensions()Returns the file extensions (without the dot).StringgetOutput()Returns the output generated from the visit.UserModegetUserMode()Returns the user mode to generate the help for.StringglobalInfo()Returns a string describing the object.protected voidinitialize()Initializes the visitor.protected StringinitOutput()Initializes the output data structure.static voidmain(String[] args)Executes the producer from commandline.protected voidpostProduce()Hook-method after visiting options.protected voidpreProduce()Hook-method before starting visiting options.protected voidpreProduce(OptionManager manager, int index)Hook method that gets called just before an option gets produced.StringBuilderprocessOption(AbstractArgumentOption option)Visits an argument option.StringBuilderprocessOption(BooleanOption option)Visits a boolean option.StringBuilderprocessOption(ClassOption option)Visits a class option.voidsetClassCrossRefLinks(boolean value)Sets whether to generate class cross-reference links for the help user interface.voidsetUserMode(UserMode value)Sets the user mode to generate the help for.protected StringtoHTML(String s)Turns the string into HTML.protected StringtoHTML(String s, boolean nbsp)Turns the string into HTML.StringtoString()Returns the output generated from the visit.-
Methods inherited from class adams.core.option.AbstractOptionProducer
checkInput, cleanUp, doProduce, doProduce, generateLoggingString, getCurrentValue, getInput, getOptionIdentifier, getOutputVariableValues, getSkippedProperties, getUsePropertyNames, isDefaultValue, loggingLevelTipText, outputVariableValuesTipText, postProduce, produce, produce, reset, runProducer, setLoggingLevel, setOutputVariableValues, setSkippedProperties, toString, write
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.option.OptionProducer
getLoggingLevel
-
-
-
-
Field Detail
-
m_OutputBuffer
protected StringBuilder m_OutputBuffer
the buffer for assembling the help.
-
m_ClassCrossRefLinks
protected boolean m_ClassCrossRefLinks
whether to generate "fake" class cross reference links.
-
m_UserMode
protected UserMode m_UserMode
the user mode to generate the help for.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceOptionProducer<String,StringBuilder>- Specified by:
globalInfoin classAbstractOptionProducer<String,StringBuilder>- Returns:
- a description suitable for displaying in the gui
-
setClassCrossRefLinks
public void setClassCrossRefLinks(boolean value)
Sets whether to generate class cross-reference links for the help user interface.- Parameters:
value- true if to generate
-
getClassCrossRefLinks
public boolean getClassCrossRefLinks()
Returns whether to generate class cross-reference links for the help user interface.- Returns:
- true if to generate
-
setUserMode
public void setUserMode(UserMode value)
Sets the user mode to generate the help for.- Specified by:
setUserModein interfaceUserModeSupporter- Parameters:
value- the user mode
-
getUserMode
public UserMode getUserMode()
Returns the user mode to generate the help for.- Specified by:
getUserModein interfaceUserModeSupporter- Returns:
- the user mode
-
initOutput
protected String initOutput()
Initializes the output data structure.- Specified by:
initOutputin classAbstractOptionProducer<String,StringBuilder>- Returns:
- the created data structure
-
initialize
protected void initialize()
Initializes the visitor.- Overrides:
initializein classAbstractOptionProducer<String,StringBuilder>
-
getOutput
public String getOutput()
Returns the output generated from the visit.- Specified by:
getOutputin interfaceOptionProducer<String,StringBuilder>- Overrides:
getOutputin classAbstractOptionProducer<String,StringBuilder>- Returns:
- the output
- See Also:
AbstractOptionProducer.initOutput()
-
toHTML
protected String toHTML(String s)
Turns the string into HTML. Line feeds are automatically converted into <br>.- Parameters:
s- the string to convert to HTML- Returns:
- the HTML string
- See Also:
HtmlUtils.markUpURLs(String, boolean)
-
toHTML
protected String toHTML(String s, boolean nbsp)
Turns the string into HTML. Line feeds are automatically converted into <br>.- Parameters:
s- the string to convert to HTMLnbsp- whether to convert leading blanks to non-breaking spaces- Returns:
- the HTML string
- See Also:
HtmlUtils.markUpURLs(String, boolean)
-
addToolTip
protected void addToolTip(AbstractOption option, StringBuilder buffer)
Breaks up the tool tip and adds it to the StringBuilder.- Parameters:
option- the current option to obtain the data frombuffer- the buffer to add the tool tip to
-
addArgumentInfo
protected void addArgumentInfo(AbstractArgumentOption option, StringBuilder buffer)
Adds additional information about the argument, e.g., the class.- Parameters:
option- the current option to obtain the data frombuffer- the buffer to add the information to
-
processOption
public StringBuilder processOption(BooleanOption option)
Visits a boolean option.- Specified by:
processOptionin interfaceOptionProducer<String,StringBuilder>- Specified by:
processOptionin classAbstractOptionProducer<String,StringBuilder>- Parameters:
option- the boolean option- Returns:
- the last internal data structure that was generated
-
processOption
public StringBuilder processOption(ClassOption option)
Visits a class option.- Specified by:
processOptionin interfaceOptionProducer<String,StringBuilder>- Specified by:
processOptionin classAbstractOptionProducer<String,StringBuilder>- Parameters:
option- the class option- Returns:
- the last internal data structure that was generated
-
processOption
public StringBuilder processOption(AbstractArgumentOption option)
Visits an argument option.- Specified by:
processOptionin interfaceOptionProducer<String,StringBuilder>- Specified by:
processOptionin classAbstractOptionProducer<String,StringBuilder>- Parameters:
option- the argument option- Returns:
- the last internal data structure that was generated
-
preProduce
protected void preProduce(OptionManager manager, int index)
Hook method that gets called just before an option gets produced.
Default implementation does nothing- Overrides:
preProducein classAbstractOptionProducer<String,StringBuilder>- Parameters:
manager- the option managerindex- the index of the option
-
preProduce
protected void preProduce()
Hook-method before starting visiting options. Adds header and global info to the output buffer.- Overrides:
preProducein classAbstractOptionProducer<String,StringBuilder>- See Also:
AbstractOptionProducer.initOutput()
-
postProduce
protected void postProduce()
Hook-method after visiting options.
Default implementation does nothing.- Overrides:
postProducein classAbstractOptionProducer<String,StringBuilder>
-
toString
public String toString()
Returns the output generated from the visit.- Specified by:
toStringin interfaceOptionProducer<String,StringBuilder>- Specified by:
toStringin classAbstractOptionProducer<String,StringBuilder>- Returns:
- the output, null in case of an error
-
getFormatDescription
public String getFormatDescription()
Returns the description of the file format.- Specified by:
getFormatDescriptionin interfaceFileFormatHandler- Returns:
- the description
-
getDefaultFormatExtension
public String getDefaultFormatExtension()
Returns the default file extension (without the dot).- Specified by:
getDefaultFormatExtensionin interfaceFileFormatHandler- Returns:
- the default extension
-
getFormatExtensions
public String[] getFormatExtensions()
Returns the file extensions (without the dot).- Specified by:
getFormatExtensionsin interfaceFileFormatHandler- Returns:
- the extensions
-
main
public static void main(String[] args)
Executes the producer from commandline.- Parameters:
args- the commandline arguments, use -help for help
-
-