User Help


User Help

The user help file is the easiest part of the documentation component. Some developers have used plain text and passed, but do a little more that that. Remember, this part of your project is for the users, so don't get technical. Just tell them what to click and in what order they should do so. Figure 5.1 illustrates user help for the project.

Figure 5.1. An example of user help.

graphics/05fig01.jpg

The example in Listing 5.1 of user help code looks clean, is brief, and meets the requirements. Don't get fancy with too many images, although a screenshot or two is fine.

Listing 5.1 A Sample Help File
 <!--**************************************************************** XHTML tags that contain a trailing slash (e.g., <br />) are not understood by the version of the JTextPane class used in the book because it relies on the class javax.swing.text.html.HTMLEditorKit which provides only HTML 3.2 support. ****************************************************************--> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Super Bowl Reservation System</title> <style type="text/css">  body {   background-color: #ffffff;  } span.c1 {color: #CC6600; font-family: Arial} </style> </head> <body topmargin="0" leftmargin="0"> <table border="0"        cellpadding="0"        cellspacing="0"        width="604"> <tr valign="top"> <td width="16"> <p>&nbsp;</p> </td> <td width="100%"> <h1>Super Bowl User Help</h1> <strong>Welcome to the Super Bowl Reservation System (SBRS)</strong> <p>Learn about this application and how to use it.<br> <br> SBRS is ready to help you plan the right trip at the right price, right from your desktop. If you are planning a trip to the Super Bowl, this application will help you.<br> <br> Here is a step-by-step guide to making reservations on SBRS:<br> <br> <span class="c1"><strong>Start planning your trip</strong></span><br> To plan a great trip to the Super Bowl, you must first plan it. Make sure you account for food, hotel, flight, and traffic. You'll appreciate the benefits of advance planning. And if you're traveling with children, talk to them about the trip BEFORE you leave.<br> <br> <span class="c1"><strong>Search a seat</strong></span> <br> You can search for seats right from the main screen. <br><br> <strong>Search Available Seats</strong></p> <ol> <li> In the &quot;Search Seats&quot; area, select a Level in which you wish to sit (or &quot;any&quot; to match all levels).</li> <li>Select the Aisle in which you wish to sit (or &quot;any&quot; to match all aisles).</li> <li> Click  the &quot;Search Seats&quot; button. </li> </ol> <p>OR</p> <ol> <li> In the table in the bottom half of the screen, you can click on any Level or Aisle value to update the Level and Aisle values shown in the Search Seats area. </li> <li> Click  the &quot;Search Seats&quot; button. </li> </ol> <p>Either set of steps will show all seats that match your criteria.</p> <p><span class="c1"><strong>Reserve a seat</strong></span></p> <ol> <li> If you don't immediately see the seat you want, please follow the above instructions to search for seats that interest you. </li> <li> Click on a seat in the table. You can click anywhere in the row corresponding to that seat. </li> <li> This action will enter the seat number under the &quot;Reserve Seats&quot; section in the upper left. </li> <li> Now type in the number of seats you want to reserve. Note that the maximum number of seats available is displayed in parentheses to the immediate right of &quot;How Many Seats.&quot; </li> <li> Click on the &quot;Reserve Seat&quot; button. </li> <li> The number of seats you reserve will be deducted from the &quot;Available&quot; column. </li> </ol> <span class="c1"><strong>We're here if you need us</strong> </span> <br> When you have questions, call us for the information   you need.<br>  <br>   Our customer support representatives are ready to assist   you 24&nbsp;hours a day, 7&nbsp;days a week. Fill out our    support and feedback form and we'll respond within 4   hours, guaranteed. If you need immediate assistance, call   us at (800) 555-6666 or (111) 555-0000.<br>  <br>   <strong>Candidate</strong><br>   <em>Alain Trottier</em><br>   <em>Sun Certified Java Developer</em></td> </tr> </table> </body> </html> 

Javadoc Code Comments

Javadoc documentation has been mentioned in previous chapters, but in this chapter, you see the five main uses of javadoc: file, class, method, field, and statement headers. Table 5.1 offers a quick review of the special tags that Javadoc pulls from the source comments and where you are likely to use these tags.

Table 5.1. Javadoc Tags

Tag

File

Package

Class

Method

Field

@author

X

X

X

   

{@docRoot}

X

X

X

X

X

@deprecated

 

X

X

X

X

@exception

     

X

 

{@inheritDoc}

     

X

 

{@link}

X

X

X

X

X

{@linkplain}

X

X

X

X

X

@param

     

X

 

@return

     

X

 

@see

X

X

X

X

X

@serial

 

X

X

 

X

@serialData

     

X

 

@serialField

       

X

@since

X

X

X

X

X

@throws

     

X

 

{@value}

       

X

@version

X

X

X

   

Custom

         

The following list defines the tags shown in Table 5.1:

  • @author ” Adds an "Author-authorName" entry to the generated documents.

  • {@docRoot} ” Represents the relative path to the generated document's (destination) root directory from any generated page. Notice that this feature inserted an extra slash in J2SE 1.4.0 but has been fixed in 1.4.1.

  • @deprecated ” Adds a comment indicating that this API should no longer be used (even though it might continue to work).

  • @exception ” The @exception tag is a synonym for @throws .

  • {@inheritDoc} ” Inherits documentation from the nearest superclass into the current doc comment (broken in J2SE 1.4.0, but fixed in 1.4.1).

  • {@link} ” Inserts an inline link with a visible text label that points to the documentation for the specified package, class, or member name of a referenced class.

  • {@linkplain} ” Identical to {@link} , except the link's label is displayed in plain text instead of code font.

  • @param ” Adds a parameter to the "Parameters" section.

  • @return ” Adds a "Returns" section with the description text. This text should describe the return type and permissible range of values.

  • @see ” Adds a "See Also" heading with a link or text entry that points to the reference. A doc comment can contain any number of @see tags, which are all grouped under the same heading.

  • @serial ” Used in the doc comment for a default serializable field. An optional field description should explain the meaning of the field.

  • @serialData ” The data description documents the types and order of data in the serialized form.

  • @serialField ” Documents an ObjectStreamField component of a serializable class's serialPersistentFields member.

  • @throws ” Adds a "Throws" subheading to the generated documentation (same as @exception ).

  • {@value} ” When used in a static field comment, it displays the value of the constant.

  • @version ” Adds a "Version" subheading with the specified version text to the generated docs.

graphics/alert_icon.gif

Be sure you add a javadoc comment header to every file, class, and method in your project's source code. You don't have to touch the supplied files unless you choose to modify instead of extend them.


The following are examples from the SDK source javadoc documentation. The majority of the javadoc comments go into what some call "block headers." The first one goes at the top of the file and describes the file. The rest are placed immediately preceding the declarations for the class, method, and field.

File Header

Each source file should begin with a multiline comment that mentions its purpose, author, and date. The following is an example of a package header javadoc comment:

 j 
Class Header

The following is an example of a class header javadoc comment from the SDK WeakReference class source:

 /**  * Weak reference objects, which do not prevent their  * referents from being made finalizable, finalized, and  * then reclaimed.  Weak references are most  * often used to implement canonicalizing mappings.  *  * <p> Suppose that the garbage collector determines at a  * certain point in time that an object is  * <a href="package-summary.html#reachability">weakly  * reachable</a>.  At that time it will automatically clear  * all weak references to that object and all weak  * references to any other weakly reachable objects  * from which that object is reachable through a chain of  * strong and soft references.  At the same time, it will  * declare all the formerly weakly reachable objects to  * be finalizable.  At the same time or at some later time,  * it will enqueue those newly cleared weak references that  * are registered with reference queues.  *  * @author   some author  * @version  some date  * @since    1.2  */ public class WeakReference extends Reference { 
Method Header

The following is an example of a method header javadoc comment from the SDK Pattern class source:

 /**  * Compiles the given regular expression into a pattern  * with the given flags.  </p>  *  * @param  regex  *         The expression to be compiled  *  * @param  flags  *         Match flags, a bit mask that may include  *         {@link #CASE_INSENSITIVE},  *         {@link #MULTILINE}, {@link #DOTALL},  *         {@link #UNICODE_CASE}, and {@link #CANON_EQ}  *  * @throws  IllegalArgumentException  *         If bit values other than those corresponding  *         to the defined match flags are set in  *         <tt>flags</tt>  *  * @throws  PatternSyntaxException  *          If the expression's syntax is invalid  */ public static Pattern compile(String regex, int flags){     return new Pattern(regex, flags); } 
Field Header

The following is an example of a field header javadoc comment from the SDK Pattern class source:

 /**  * Enables case-insensitive matching.  *  * <p> By default, case-insensitive matching assumes  * that only characters in the US-ASCII charset are  * being matched.  Unicode-aware case-insensitive  * matching can be enabled by specifying the {@link  * #UNICODE_CASE} flag with this flag.  *  * <p> Case-insensitive matching can also be enabled  * via the embedded flag expression&nbsp;<tt>(?i)</tt>.  *  * <p> Specifying this flag could impose a slight  * performance penalty.  </p>  */ public static final int CASE_INSENSITIVE = 0x02; 


JavaT 2 Developer Exam CramT 2 (Exam CX-310-252A and CX-310-027)
JavaT 2 Developer Exam CramT 2 (Exam CX-310-252A and CX-310-027)
ISBN: N/A
EAN: N/A
Year: 2003
Pages: 187

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net