Class Library: Major User-Interface Elements

BannerPanel. The banner panel at the top of the JSite web page which identifies its content.

package earthstones
import java.awt.*;
java.applet.*;
java.net.*;
java.util.*;
class declaration public class BannerPanel extends WebPanel
variables private String currentState; A string representing the banner's current state; the getState() method extracts this information from the WebSite's current page.
Panel's components:
ImagePanel LineImage; The panel that renders the image file "images/Line.JPG"
ImagePanel LogoImage; The panel that renders the image file "images/Logo.JPG"
SectionPanel Section; The panel that renders the image file sectionId + "/images/Banner.JPG"
ChapterPanel Chapter; The panel that renders the image file sectionId + "/" + chapterId + "images/Header.JPG"
constructors BannerPanel(Container app)
BannerPanel(Container app, int x, int y,
int width, int height)
This constructor takes values for the panel's location and dimensions and then uses WebPanel's automatic scaling features to scale panel for the user's screen resolution.
methods public void init() Initializes panel by constructing its component panels.
public String currentState() Returns panel's current state.
public String getState() Extracts and returns string representing banner's current state from WebSite's current page.
public void update() Responds to update message by:
1) Getting (new) state string
2) Comparing state to value of currentState
3) If currentState has not yet been set or if it is not the same as the new state, dispatches update() messages to its components section and chapter
4) Reseting currentState to state

FooterPanel. The footer panel at the bottom of the JSite web page which presents user-interaction elements for navigating throughout the web site.

package earthstones
import java.awt.*;
java.applet.*;
java.net.*;
java.util.*;
class declaration public class FooterPanel extends WebPanel
variables private String currentState; A string representing the banner's current state; the getState() method extracts this information from the WebSite's current page.
Panel's components:
Components defined here:
FooterCards panel; The set of one or more "cards", each representing an alternative footer configuration (e.g., panel:Default, panel:Portfolio).
ImagePanel Line; The panel that renders the
image file "images/Line.JPG"
Components defined in panel:Portfolio:
NavigationButton prevChp; Selects previous chapter
ImagePanel ChaptersLbl; Displays the "Chapters" label in the image file "images/Chapters.JPG"
NavigationButton nextChp; Selects next chapter
NavigationChoice ChapterList; The listbox containing the list of chapters for the current section
NavigationButton prevPg; Selects previous page
ImagePanel PagesLbl; Displays the "Pages" label in the image file "images/Pages.JPG"
NavigationButton nextPg; Selects next page
NavigationChoice PageList; The listbox containing the list of pages for the current chapter
IconButton Inquiries; Launches the email window for user inquiries about the current page contents
IconButton HomePage; Returns user to website's home page
Components defined in panel:Default:
IconButton nextImage; Displays next random image in graphic panel
IconButton jumpTo; Jumps to portfolio page corresponding to current image in graphic panel
IconButton toSection; Moves to new website section; specific action depends upon current context.
IconButton toChapter; Moves to new website chapter within current section; specific action depends upon current context.
constructors FooterPanel(Container app)
FooterPanel(Container app, int x, int y,
int width, int height)
This constructor takes values for the panel's location and dimensions and then uses WebPanel's automatic scaling features to scale panel for the user's screen resolution.
methods public void init() Initializes footer panel by constructing its two top-level component panels: Line and panel. All the rest of the work is done in panel's class FooterPanel and its component objects.
public String currentState() Returns panel's current state.
public String getState() Extracts and returns string representing footer's current state from WebSite's current page.
public void update() Responds to update message by:
1) Getting (new) state string
2) Comparing state to value of currentState
3) If currentState has not yet been set or if it is not the same as the new state, dispatches update() messages to its components section and chapter
4) Reseting currentState to state

GraphicPanel. The graphic panel typically occupying the left portion of the JSite page and displaying a graphic image. Note: This class is now used only by the Graphic applet deployed by HtmlWeb. JSite's Web subclass JavaWeb instead uses an instance of DocumentPanel as its user-interface graphic panel.

package earthstones
import java.awt.*;
java.applet.*;
java.net.*;
java.util.*;
class declaration public class GraphicPanel extends WebPanel
variables private GImage currentState; The panel's current state; the getState() method extracts this information from the WebSite's current page.
Panel's components:
Panel panel; User-interface representation of image object GImage
constructors GraphicPanel(Container app)
GraphicPanel(Container app, int x, int y,
int width, int height)
This constructor takes values for the panel's location and dimensions and then uses WebPanel's automatic scaling features to scale panel for the user's screen resolution.
methods public void init() Initializes panel by constructing its component panels.
public GImage currentState() Returns panel's current state.
public String getState() Extracts and returns panel's current state from WebSite's current page.
public void update() Responds to update message by:
1) Getting (new) state string
2) Comparing state to value of currentState
3) If currentState has not yet been set or if it is not the same as the new state, dispatches update() messages to its components section and chapter
4) Reseting currentState to state

DocumentPanel. JSite's web page uses an instance of this class as its document panel typically occupying the right portion of the page and displaying an HTML document containing text as well as other elements such as images, tables, and forms in a scrolling panel. JSite also employs a second instance of this class as its left-hand graphic panel which typically displays a large graphic image but which may be used to display an alternative HTML document instead. DocumentPanel also implements update() methods capable of responding to this method call from other Java objects (e.g., instances of Web or Applet) or via javascript calls. Note: This is the only EarthStones' class that uses non core-Java classes (i.e., classes that are not part of the java.* packages). In this case several classes from Symantec's symantec.* packages are used.

package earthstones
import java.awt.*;
java.applet.*;
java.net.*;
java.util.*;
import symantec.itools.awt.*;
class declaration public class DocumentPanel extends ScrollingPanel implements Runnable
constants public static final int scrollBarWidth = 15; The width of a (vertical) scroll bar (this value is independent of screen resolution).
These constants define the DocumentPanel's modes.
public static final int DOCUMENT = 0; Typical right-hand document panel displaying HTML document.
public static final int GRAPHIC_DOC = 2; Left-hand panel displaying graphic image.
public static final int GRAPHIC = 3; Typical left-hand graphic panel displaying graphic image.
public static final int NOTDOC = 3; Mask for non document (i.e., graphic image) display.
public static final int ISGRAPHIC = 2; Mask for left-hand (graphic) panel regardless of its display.
variables private Document currentState; The current document object; the getState() method extracts this information from the WebSite's current page.
protected Container webApp The main (host) applet which serves as the key to WebSite indices
Panel's components:
Panel panel; User-interface representation of document object Document
Variables unique to DocumentPanel:
protected boolean isLoaded = false; Set by run() when load() has been called.
protected int height = 0; Total height of panel.
protected mode = DOCUMENT; The default mode.
boolean scroll = true; When set, panel includes vertical scrollbar. This default value is reset in init() for GRAPHIC mode.
boolean hscroll = false; When set, panel includes horizontal scrollbar
boolean plainText = false; when set, document is shown as plain text (i.e., displays HTML source code)
constructors DocumentPanel(Container app) The default constructor. Unlike the other major user-interface components, the dimensions of the DocumentPanel are not set at the time the object is instantiated. Use setHeight() to set panel's height after calling the constructor. Panel's width is resized as needed (e.g., automatically by JavaWeb in the method update(doc, scrl, hscrl) below.
DocumentPanel(Container app, boolean alt) This form of the constructor allows the panel to be set as the alternative document altDoc.
methods public void init() Initializes panel by setting its background color to white. Resets scroll to false for GRAPHIC mode.
public void load() Creates and initializes the panel variable and resizes the document panel to (size().width, height).
public void setHeight(int ht) Sets the height variable and resizes panel to (size().width, height).
public void run() This method is invoked by the applet's Web instance and allows panel to be updated in its own thread.
It does the following:
1) If isLoaded has not been set, calls load() and sets isLoaded.
2) Calls update().
public Document currentState() Returns the currentState variable.
public String getState() Returns a new Document object representing the panel's current state. The document's parameters are set in Document.init() based on parameters defined by WebSite.webs(webApp).thePage. The panel's mode is passed as a parameter when the new Document object is created and this information is used to determine whether a graphic image or an HTML document will be loaded.
public void update() Responds to update message by:
1) Getting (new) state value.
2) Comparing state to value of currentState
3) If currentState has not yet been set or if it is not the same as the new state, calling update(state, scroll, hscroll).
4) Reseting currentState to state
This parameterless form of update can be used when current state information is available in WebSite.webs(webApp).[cont]
thePage.

Note: if software is an unregistered evaluation copy, default page display is overridden and a registration form is presented to the user instead.
update(Document doc, boolean scrl, boolean hscrl) The next three forms of update() require that the currentState (i.e., the document to be shown) is passed as a parameter. This method handles resizing the width of the DocumentPanel to accomodate the width of the document which it displays.
update(Document doc, boolean scrl) Calls update(doc, scrl, false).
update(Document doc) Calls update(doc, true, false).

SplashPanel. SplashPanel manages the display of a splash screen when an applet or application is launched. When considerable time is needed to download EarthStones' classes over the web, the panel can be run in LOGON mode which draws the panel's display a letter at a time in banner-animation fashion and launches an animated progress bar if more time is needed. This is the default mode for JSite. Otherwise the panel runs in SPLASH mode which quickly paints the sign-on message.

When its REGCHECK or LOGON_REGCHECK modes are selected, the splash panel checks for a valid license for an evaluation copy of the software and displays the appropriate messages to the user.

For applets and applications using a Web instance to manage the user-interface, the splash panel is
automatically displayed if the loadSplash parameter is set in the applet's tag or application's command line. Registration checking is invoked by hard-coding the assignment

Web.regCheck = true.

In all cases the panel is automatically dismissed when the interface panels have been loaded.

package earthstones
import java.awt.*;
java.applet.*;
java.net.*;
java.util.*;
class declaration public class SplashPanel extends Panel implements Runnable
static constants public static final int SPLASH = 1; Program splash mode (default except for JSite).
public static final int LOGON = 3; Web logon mode (JSite default).
public static final int REGCHECK = 5; Registration check mode for evaluation copy of software.
public static final int LOGON_REGCHECK = 7; Web logon and reg check mode.
public static final int ISLOGON = 2; Mask for website logon modes.
public static final int ISCHECK = 4; Mask for reg check modes.
variables Splash panel defines three public variables which are read/set by program's Web instance.
boolean stop = false; Set by parentApp's Web instance when it is ready to kill splash panel.
boolean canKill = false; Set by splash panel when it is ready to be killed; read by Web instance.
boolean isLoaded = false; Set by splash panel which its load() method has finished.
Of SplashPanel's private variables, only the next three can be set by the user in the object's constructors.
private Container parentApp A reference to the applet or application which deploys SplashPanel.
private boolean isScaled = true; When set, parentApp has already been scaled for viewer's screen resolution.
private int mode = SPLASH; This default value is resets:
1) By JSite when instantiating SplashPanel.
2) By Web to add registration checking if needed through a call to setMode().
SplashPanel defines many additional private variables. However, none of them is modifiable through set() methods and they are not described here. The source code for SplashPanel is supplied with the JDoc and JSite products so programmers may modify it as needed.
constructors SplashPanel(Container apl, boolean scaled) Here apl is the applet or application deploying SplashPanel and scaled is a boolean value indicating whether or not the parent applet has already been scaled for the user's screen resolution at the time the constructor is called.
SplashPanel(Container apl, boolean scaled, int md) Also specifies the panel's mode variable.
methods Although SplashPanel defines many methods, few should be called directly by the user and these are documented here. In most cases SplashPanel is deployed by constructing it and calling its startSplash() method and is terminated by setting its public variables stop and canKill The source code for SplashPanel is supplied with the JDoc and JSite products so programmers can otherwise modify it as needed.
public void startSplash() Runs the splash panel in its own thread and calls show(). This method is not invoked automatically to permit the panel to be created and added to the program's window in the correct z-order regardless of whether loadSplash is set. In the case where loadSplash is false but registration checking is enabled, startSplash() is called by Web.checkRegistration().
public void setMode(int val) Sets mode to one of the object's mode constants.
public void hide() Hides splash panel.