|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.dpml.cli.util.HelpFormatter
Presents on screen help based on the application's Options
Field Summary | |
static int |
DEFAULT_DESCRIPTION_WIDTH
The default minimum description width. |
static Set |
DEFAULT_DISPLAY_USAGE_SETTINGS
The default DisplaySettings used to select the help lines in the main body of help |
static Set |
DEFAULT_FULL_USAGE_SETTINGS
The default DisplaySettings used to select the elements to display in the displayed line of full usage information. |
static int |
DEFAULT_FULL_WIDTH
The default screen width |
static String |
DEFAULT_GUTTER_CENTER
The default screen furniture right of screen |
static String |
DEFAULT_GUTTER_LEFT
The default screen furniture left of screen |
static String |
DEFAULT_GUTTER_RIGHT
The default screen furniture between columns |
static Set |
DEFAULT_LINE_USAGE_SETTINGS
The default DisplaySettings used to select the elements of usage per help line in the main body of help |
Constructor Summary | |
HelpFormatter()
Creates a new HelpFormatter using the defaults |
|
HelpFormatter(String gutterLeft,
String gutterCenter,
String gutterRight,
int fullWidth)
Creates a new HelpFormatter using the specified parameters |
|
HelpFormatter(String gutterLeft,
String gutterCenter,
String gutterRight,
int fullWidth,
int descriptionWidth)
Creates a new HelpFormatter using the specified parameters |
Method Summary | |
Comparator |
getComparator()
Return the comparator. |
Set |
getDisplaySettings()
Return the display settings. |
String |
getDivider()
Return the divider. |
OptionException |
getException()
Return the option exception |
String |
getFooter()
Return the footer text. |
Set |
getFullUsageSettings()
Return the full usage display settings. |
Group |
getGroup()
Return the group. |
String |
getGutterCenter()
Return the gutter center string. |
String |
getGutterLeft()
Return the gutter left string. |
String |
getGutterRight()
Return the gutter right string. |
String |
getHeader()
Return the header string. |
Set |
getLineUsageSettings()
Return the line usage settings. |
int |
getPageWidth()
Return the page width. |
PrintWriter |
getPrintWriter()
Return the print writer. |
String |
getShellCommand()
Return the shell command. |
protected static void |
pad(String text,
int width,
Writer writer)
Pad the supplied string. |
void |
print()
Prints the Option help. |
void |
printDivider()
Prints the m_divider text |
void |
printException()
Prints any error message. |
void |
printFooter()
Prints a m_footer string if necessary |
void |
printGutterLeft()
Prints the left gutter string |
void |
printGutterRight()
Prints the right gutter string |
void |
printHeader()
Prints a m_header string if necessary |
void |
printHelp()
Prints detailed help per option. |
void |
printUsage()
Prints a single line of usage information (wrapping if necessary) |
protected void |
printWrapped(String text)
Prints a string wrapped if necessary |
void |
setComparator(Comparator comparator)
The Comparator to use when sorting Options |
void |
setDisplaySettings(Set displaySettings)
The DisplaySettings used to select the help lines in the main body of help |
void |
setDivider(String divider)
Sets the string to use as a m_divider between sections of help |
void |
setException(OptionException exception)
Sets the exception to document |
void |
setFooter(String footer)
Sets the footer text of the help screen |
void |
setFullUsageSettings(Set fullUsageSettings)
The DisplaySettings used to select the elements to display in the displayed line of full usage information. |
void |
setGroup(Group group)
Sets the Group of Options to document |
void |
setHeader(String header)
Sets the header text of the help screen |
void |
setLineUsageSettings(Set lineUsageSettings)
Sets the DisplaySettings used to select elements in the per helpline usage strings. |
void |
setPrintWriter(PrintWriter out)
Set the print writer. |
void |
setShellCommand(String shellCommand)
Sets the command string used to invoke the application |
protected static List |
wrap(String text,
int width)
Return a list of strings resulting from the wrapping of a supplied target string. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int DEFAULT_FULL_WIDTH
public static final int DEFAULT_DESCRIPTION_WIDTH
public static final String DEFAULT_GUTTER_LEFT
public static final String DEFAULT_GUTTER_CENTER
public static final String DEFAULT_GUTTER_RIGHT
public static final Set DEFAULT_FULL_USAGE_SETTINGS
DisplaySetting
public static final Set DEFAULT_LINE_USAGE_SETTINGS
DisplaySetting
public static final Set DEFAULT_DISPLAY_USAGE_SETTINGS
Constructor Detail |
public HelpFormatter()
public HelpFormatter(String gutterLeft, String gutterCenter, String gutterRight, int fullWidth)
gutterLeft
- the string marking left of screengutterCenter
- the string marking center of screengutterRight
- the string marking right of screenfullWidth
- the width of the screenpublic HelpFormatter(String gutterLeft, String gutterCenter, String gutterRight, int fullWidth, int descriptionWidth)
gutterLeft
- the string marking left of screengutterCenter
- the string marking center of screengutterRight
- the string marking right of screenfullWidth
- the width of the screendescriptionWidth
- the minimum description widthMethod Detail |
public void print() throws IOException
IOException
- if an error occurspublic void printException() throws IOException
IOException
- if an error occurspublic void printHelp() throws IOException
IOException
- if an error occurspublic void printUsage() throws IOException
IOException
- if an error occurspublic void printHeader() throws IOException
IOException
- if an error occurspublic void printFooter() throws IOException
IOException
- if an error occursprotected void printWrapped(String text) throws IOException
text
- the string to wrap
IOException
- if an error occurspublic void printGutterLeft()
public void printGutterRight()
public void printDivider()
protected static void pad(String text, int width, Writer writer) throws IOException
text
- the text to padwidth
- the padding widthwriter
- the writer
IOException
- if an I/O error occursprotected static List wrap(String text, int width)
text
- the target string to wrapwidth
- the wrappping width
public void setComparator(Comparator comparator)
comparator
- Comparator to use when sorting Optionspublic void setDisplaySettings(Set displaySettings)
displaySettings
- the settings to useDisplaySetting
public void setDivider(String divider)
divider
- the dividing stringpublic void setException(OptionException exception)
exception
- the exception that occuredpublic void setFooter(String footer)
footer
- the footer textpublic void setFullUsageSettings(Set fullUsageSettings)
fullUsageSettings
- the full usage settingsDisplaySetting
public void setGroup(Group group)
group
- the options to documentpublic void setHeader(String header)
header
- the m_footer textpublic void setLineUsageSettings(Set lineUsageSettings)
lineUsageSettings
- the DisplaySettings to useDisplaySetting
public void setShellCommand(String shellCommand)
shellCommand
- the invocation commandpublic Comparator getComparator()
public Set getDisplaySettings()
public String getDivider()
public OptionException getException()
public String getFooter()
public Set getFullUsageSettings()
public Group getGroup()
public String getGutterCenter()
public String getGutterLeft()
public String getGutterRight()
public String getHeader()
public Set getLineUsageSettings()
public int getPageWidth()
public String getShellCommand()
public void setPrintWriter(PrintWriter out)
out
- the PrintWriter to write topublic PrintWriter getPrintWriter()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |