Class Library: Other Web Data Objects

Icon. Describes a user-interface icon.

package earthstones
import java.awt.*;
java.applet.*;
class declaration public class Icon extends Object
variables protected Container webApp = null; Reference to the main (host) applet.
private String name = ""; Icon's name as defined in the Site.web file.
private String file = ""; Source file for icon's image. Assumed to be relative the the website's base directory.
private String hint = ""; Optional hint message to be displayed upon mouse-enter.
constructors Icon(Container app, String name, String file, String hint)
methods public String name() Returns name variable.
public String file() Returns file variable.
public String hint() Returns hint variable.
public void setName(String name) Sets name variable.
public void setFile(String file) Sets file variable.
public void setHint(String hint) Sets hint variable.

GImage. Describes an image along with an associated caption.

package earthstones
import java.awt.*;
java.applet.*;
class declaration public class GImage extends Object
variables protected Container webApp = null; Reference to the main (host) applet.
String image = ""; Source file for image. Assumed to be relative the the website's base directory.
String title = ""; Optional title to appear in wrapped caption beneath image. Shown in bold face.
String desc = ""; Optional extended descripton to appear in wrapped caption beneath image. Shown in normal face. Is appended to title following ". " when the title string is not blank.
int top = 0; Offset between top of frame and top of image.
int width = 0; int height = 0; If set, these values specify the image's width and height. Otherwise, default image sizes are set. See documentation for the ImagePanel class for information about default values.
String orient = null; When set, specifies image orientation: portrait ("PTR") or landscape ("LSC"). Used by ImagePanel in setting default image dimensions.
float scale = 1.00f; Optional scale factor (in addition to resfactor).
boolean isRandom = false; Set to true by Page when the image has been randomly selected.
boolean isInsert = false; Set to true for inserted images (will set default image size to 150 x 210).
private Panel panel; The user-interface representation of the GImage object.
constructors GImage(Container app, String orient, String image, String title, String desc,
int top, int width, int height, float scale, boolean insrt)
GImage(Container app, String orient, String image, String title, String desc,
int top, int width, int height, float scale)
GImage(Container app, String orient, String image, String title, String desc,
int top)
GImage(Container app, String orient, String image, String title, String desc)
GImage(Container app, String orient, String image, String title,
String desc, boolean insrt)
GImage(Container app)
methods public void init() 1) If scale is 0.00f, resets to 1.00f.
2) If title is not blank, appends a period and space to title.
public Dimension size() Calls show(new Panel(), 0, 0) to "show" image on a new (hidden) panel and returns its dimensions.
public synchronized Panel show(Panel aPanel, int x, int y) Returns panel aPanel displaying GImage object at location (x, y); aPanel is resized to accomodate the offset (x, y) as well as the size of GImage.
public Panel show(int x, int y) Returns a panel displaying GImage at location (x, y).
public Panel show() Returns a panel displaying GImage at location (0, top).

Link. Describes a user-interface icon.

package earthstones
import java.awt.*;
java.applet.*;
java.util.*;
java.net.*;
class declaration public class Link extends Object
variables protected Container webApp = null; Reference to the main (host) applet.
Document document = null; The document object in which the link occurs.
String href = null; Link's URL. If not an absolute reference (i.e., typically beginning with http://, is assumed to be relative to the HTML document containing the link.
One additional form is supported as well. Both Internet Explorer and Netscape Navigator allow URLs of the form: href="javascript: myFunction(myparam)" which execute the javascript function myFunction(). Link's execute() command uses the same syntax but interpret's myFunction() in Java instead. Three such method calls are currently supported:
1) showPage(String sc, String ch, String pg) which displays page pg of chapter ch or section sc and implements this HtmlWeb method.
2) HtmlWeb.showPortfolio(int chNum) which displays chapter number chNum (zero-based) of the "Portfolio" chapter and implements this HtmlWeb method. The method changeChapter(chNum) is treated as an alias for showPortfolio(chNum).
3) showByRes(file) where file is a string of the form myFile.htm. This method expects to find and displays the file myFile_xxxx.htm where xxxx is the width specification of the viewer's screen resolution. Thus, for a resolution of 1024x768, the file myFile_1024.htm is displayed. The file specification may contain an optional path. If an absolution URL is specified, that path is used. Otherwise, the path is interpreted as relative to the HTML document in which the link is found. This command duplicates the behavior of the SelectRes applet.
String target = null; Specifies the window into which the link is to be loaded. Must be a valid frame specified with the <frame> tag or be one of the following:
blank, to load into a new browser window;
parent, to load into the parent of the window containing the link;
top, to load into the current top window;
or self, to load into the link's current window.
The literal values blank, etc., may be preceeded by an optional underscore character ("_").
Important Notes:
1) JDoc interprets target=self as a message to update() its document window. In all other cases, JDoc will pass the URL to the server using Java's showDocument() method, to be processed as any other request. This could result in a new document being loaded into the frame containing the JDoc/JSite applet without a way to get back to the applet. To prevent this, always use target=blank to invoke a new browser window when you wish to allow the user to link to another site and then return.
2) See the execute() method below for note on the handling of ftp: and mailto: hyperlinks in applications.
String hint = null; Optional hint message to be displayed upon mouse-enter.
boolean plainText = false; Set if the link tag <a> contains the PLAINTEXT attribute.
Vector hotSpots = null; A vector whose elements are Rectangle objects corresponding to the bounding coordinates of hyperlinked text.
WebFont font = null; The font (including size, style, and color attributes) in which the hyperlinked text will be rendered.
constructors Link(Container app, Document doc)
Link(Container app, Document doc, String ref)
Link(Container app, Document doc, String ref, String hnt)
Link(Container app, Document doc, String ref, String hnt, String trgt)
methods public void init() Creates the link's font variable and initializes its attributes to those set by the defaultLinkColor and defaultLinkStyle variables of the main applet's Site instance.
public Link copy() Creates and returns a new Link object with the same attributes as the current link.
public void addHotSpot(Rectangle rect) Initializes link's hotSpots vector if this has not already been done and adds rectangle rect to it.
public void execute() 1) If the value of the href variable is one of the javascript:... forms described above, the action of execute() is as described.
2) Otherwise, the Java method showDocument(href, target) is executed.
Notes:
1) The commands javascript:showPage... and javascript:showPortfolio... are implemented by sending a show() method to the corresponding Page object. Therefore, they execute the cascade of update() message which updates the entire user interface (e.g., typically the graphic panel) as well as the document panel. In all other cases, the execute() method updates only the document panel.
2) Currently hyperlinks specifying ftp: and mailto: protocols are not executed if they occur in an application rather than an applet; instead, the user is alerted to the fact that this feature is not implemented.
public Link setAttrib(Index attrib) Uses the Index attrib of name-value pairs from the link's <a> tag to set the link's variables.

TextList. TextList is defined for convenience in keeping track of the attributes and structure of an HTML bulleted list (defined in the <UL> tag) although the text data (specified in <LI> tags) are stored as Paragraph objects. In parsing the HTML stream the Document object simply uses a stack (literally, a Java Stack object ) of TextList objects to store the list's font, compact, and bullet attributes and thus represent the skeleton outline of nested text lists. This stack object is also used by Document to increase or decrease the paragraph's indent variable as new nested levels are added to or deleted from the stack.

package earthstones
import java.awt.*;
java.applet.*;
class declaration public class TextList extends Object
variables protected Container webApp = null; Reference to the main (host) applet.
WebFont font; The list's font. Set to web site defaults in constructor().
boolean compact = false; If set, space between list items is removed by eliminating the extra interparagraph spacing.
String bullet = ""; The list's bullet character. May be set to blank by using the BLANKBULLET attribute of the <LI> tag.
boolean wrapBullet = false; If set, bullet is wrapped by paragraph text (i.e., only first line is indented by bullet). Set by <ul wrapbullet> tag.
constructors TextList(Container app)

Hint. Defines a message which appear when mouse enters certain user-interface elements (e.g., hyperlinked text, icon buttons).

package earthstones
import java.awt.*;
java.applet.*;
java.applet.*;
class declaration public class Hint extends TextBox
variables TextPanel panel = null; User-interface panel into which hint message is rendered.
String text = ""; Hint message to be displayed upon mouse-enter.
int width = 0; The width of the hint message.
int ruleHeight = 1; Height of ruling lines above and below message.
Color ruleColor; Color of ruling lines.
Color bgColor; Hint's background color.
constructors Hint(Container app)
Hint(Container app, int wid, String txt)
methods public void init() 1) Sets and initializes the panel variable.
2) Sets variables ruleColor and bgColor to the values of defaultAccentColor and defaultHintColor set in main applet's instance of Site.
3) Sets the Hint's data variable to new Paragraph(webApp, width, panel). By specifying the panel into which the paragraph will be rendered as a parameter, hint panel will have the desired characteristics.
4) Adds a TextString object to the data variable whose font characteristics are defined by the baseFont and baseFontSize attributes of the main applet's Web instance and whose font color is that set by the defaultLinkColor variable of its Site instance.
public Panel show(int x, int y) Renders hint into panel using the specified rule height and color and sets its location to the coordinates (x, y).