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 boolean
m_ClassCrossRefLinks
whether to generate "fake" class cross reference links.protected StringBuilder
m_OutputBuffer
the buffer for assembling the help.protected UserMode
m_UserMode
the 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 void
addArgumentInfo(AbstractArgumentOption option, StringBuilder buffer)
Adds additional information about the argument, e.g., the class.protected void
addToolTip(AbstractOption option, StringBuilder buffer)
Breaks up the tool tip and adds it to the StringBuilder.boolean
getClassCrossRefLinks()
Returns whether to generate class cross-reference links for the help user interface.String
getDefaultFormatExtension()
Returns the default file extension (without the dot).String
getFormatDescription()
Returns the description of the file format.String[]
getFormatExtensions()
Returns the file extensions (without the dot).String
getOutput()
Returns the output generated from the visit.UserMode
getUserMode()
Returns the user mode to generate the help for.String
globalInfo()
Returns a string describing the object.protected void
initialize()
Initializes the visitor.protected String
initOutput()
Initializes the output data structure.static void
main(String[] args)
Executes the producer from commandline.protected void
postProduce()
Hook-method after visiting options.protected void
preProduce()
Hook-method before starting visiting options.protected void
preProduce(OptionManager manager, int index)
Hook method that gets called just before an option gets produced.StringBuilder
processOption(AbstractArgumentOption option)
Visits an argument option.StringBuilder
processOption(BooleanOption option)
Visits a boolean option.StringBuilder
processOption(ClassOption option)
Visits a class option.void
setClassCrossRefLinks(boolean value)
Sets whether to generate class cross-reference links for the help user interface.void
setUserMode(UserMode value)
Sets the user mode to generate the help for.protected String
toHTML(String s)
Turns the string into HTML.protected String
toHTML(String s, boolean nbsp)
Turns the string into HTML.String
toString()
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:
globalInfo
in interfaceOptionProducer<String,StringBuilder>
- Specified by:
globalInfo
in 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:
setUserMode
in interfaceUserModeSupporter
- Parameters:
value
- the user mode
-
getUserMode
public UserMode getUserMode()
Returns the user mode to generate the help for.- Specified by:
getUserMode
in interfaceUserModeSupporter
- Returns:
- the user mode
-
initOutput
protected String initOutput()
Initializes the output data structure.- Specified by:
initOutput
in classAbstractOptionProducer<String,StringBuilder>
- Returns:
- the created data structure
-
initialize
protected void initialize()
Initializes the visitor.- Overrides:
initialize
in classAbstractOptionProducer<String,StringBuilder>
-
getOutput
public String getOutput()
Returns the output generated from the visit.- Specified by:
getOutput
in interfaceOptionProducer<String,StringBuilder>
- Overrides:
getOutput
in 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:
processOption
in interfaceOptionProducer<String,StringBuilder>
- Specified by:
processOption
in 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:
processOption
in interfaceOptionProducer<String,StringBuilder>
- Specified by:
processOption
in 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:
processOption
in interfaceOptionProducer<String,StringBuilder>
- Specified by:
processOption
in 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:
preProduce
in 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:
preProduce
in classAbstractOptionProducer<String,StringBuilder>
- See Also:
AbstractOptionProducer.initOutput()
-
postProduce
protected void postProduce()
Hook-method after visiting options.
Default implementation does nothing.- Overrides:
postProduce
in classAbstractOptionProducer<String,StringBuilder>
-
toString
public String toString()
Returns the output generated from the visit.- Specified by:
toString
in interfaceOptionProducer<String,StringBuilder>
- Specified by:
toString
in 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:
getFormatDescription
in interfaceFileFormatHandler
- Returns:
- the description
-
getDefaultFormatExtension
public String getDefaultFormatExtension()
Returns the default file extension (without the dot).- Specified by:
getDefaultFormatExtension
in interfaceFileFormatHandler
- Returns:
- the default extension
-
getFormatExtensions
public String[] getFormatExtensions()
Returns the file extensions (without the dot).- Specified by:
getFormatExtensions
in 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
-
-