Package adams.core.option
Class HtmlParametersProducer
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.option.AbstractOptionProducer<String,StringBuilder>
-
- adams.core.option.HtmlParametersProducer
-
- All Implemented Interfaces:
CleanUpHandler
,FileFormatHandler
,LoggingSupporter
,OptionProducer<String,StringBuilder>
,SizeOfHandler
,Serializable
public class HtmlParametersProducer extends AbstractOptionProducer<String,StringBuilder> implements FileFormatHandler
Generates HTML output of the parameters of an object (non-recursive).- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<Class,Boolean>
m_BlackListed
the cache for checks.protected Class[]
m_BlackListedClasses
blacklisted classes.protected boolean
m_ClassCrossRefLinks
whether to generate "fake" class cross reference links.protected StringBuilder
m_OutputBuffer
the buffer for assembling the help.-
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 HtmlParametersProducer()
-
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.Class[]
getBlackListedClasses()
Returns the classes (interface or superclass) to prevent from being processed.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.String
globalInfo()
Returns a string describing the object.protected void
initialize()
Initializes the visitor.protected String
initOutput()
Initializes the output data structure.protected boolean
isBlacklisted(Class cls)
Checks whether the class is blacklisted.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.protected void
reset()
Resets the members.void
setBlackListedClasses(Class[] value)
Sets the classes (interface or superclass) to prevent from being processed.void
setClassCrossRefLinks(boolean value)
Sets whether to generate class cross-reference links for the help user interface.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, 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_BlackListedClasses
protected Class[] m_BlackListedClasses
blacklisted classes.
-
-
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
-
setBlackListedClasses
public void setBlackListedClasses(Class[] value)
Sets the classes (interface or superclass) to prevent from being processed.- Parameters:
value
- the classes
-
getBlackListedClasses
public Class[] getBlackListedClasses()
Returns the classes (interface or superclass) to prevent from being processed.- Returns:
- the classes
-
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>
-
reset
protected void reset()
Resets the members.- Overrides:
reset
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
-
isBlacklisted
protected boolean isBlacklisted(Class cls)
Checks whether the class is blacklisted.- Parameters:
cls
- the class to check- Returns:
- true if blacklisted
-
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
-
-