Class Library: Other User-Interface Elements II (Private Classes)
DocFooter. A private class defined by JDocViewer. Creates some simple navigation tools.
package | earthstones | |
import | java.awt.*; java.applet.*; java.net.*; java.util.*; |
|
class declaration | class DocFooter extends Panel | |
variables | The footer's components: | |
TextField Source; | Text box for displaying name of document's source file. | |
Button Show; | Button toggles between rendering HTML document and showing its source code. | |
Button Contents; | Button returns to display of table of contents file. | |
Private variables used by DocFooter: | ||
private int width = 0; | The footer's width. | |
private WebApplet parentApp; | The footer's parent applet (i.e., an instance of JDocViewer). | |
constructors | DocFooter(WebApplet app, int wid) | Note that the value wid passed here has already been scaled. |
methods | init() | 1) Scales footer's height and sets
background color (lightGray). 2) Creates Source component and sets its isEditable variable to false. 3) Creates the Show button. 4) Creates the Contents button. |
public boolean handleEvent(Event event) | Handles the Show and Contents button events. |
ViewerAppFooter. A private class defined by JDocViewerApp. This is the application counterpart of DocFooter.
package | earthstones | |
import | java.awt.*; java.applet.*; java.net.*; java.util.*; |
|
class declaration | class ViewerAppFooter extends Panel | |
variables | The footer's components: | |
TextField Source; | Text box for displaying name of document's source file. | |
Button Show; | Button toggles between rendering HTML document and showing its source code. | |
Button Contents; | Button returns to display of table of contents file. | |
Private variables used by ViewerAppFooter: | ||
private int width = 0; | The footer's width. | |
private WebFrame parentApp; | The footer's parent applet (i.e., an instance of JDocViewerApp). | |
constructors | ViewerAppFooter(WebFrame app, int wid) | Note that the value wid passed here has already been scaled. |
methods | init() | 1) Scales footer's height and sets
background color (lightGray). 2) Creates Source component and sets its isEditable variable to false. 3) Creates the Show button. 4) Creates the Contents button. |
public boolean handleEvent(Event event) | Handles the Show and Contents button events. |
SectionPanel. A private class defined by BannerPanel. Creates a stack of ImagePanel objects which identify the current section in BannerPanel.
package | earthstones | |
import | java.awt.*; java.applet.*; java.net.*; java.util.*; |
|
class declaration | class SectionPanel extends CardPanel | |
constructors | public SectionPanel(Container app, int x, int y) | |
public SectionPanel(Container app, int x, int y, int width, int height) | ||
methods | public String getState() | Extracts and returns string representing section panel's current state from WebSite's current page. |
public Component load(String name) | Loads component object from disk. It is called by superclass CardPanel's update() method if the panel needs updating. |
ChapterPanel. A private class defined by BannerPanel. Creates a stack of ImagePanel objects which (optionally) identify the current chapter in BannerPanel.
package | earthstones | |
import | java.awt.*; java.applet.*; java.net.*; java.util.*; |
|
class declaration | class ChapterPanel extends CardPanel | |
constructors | public ChapterPanel(Container app, int x, int y) | |
public ChapterPanel(Container app, int x, int y, int width, int height) | ||
methods | public String getState() | Extracts and returns string representing chapter panel's current state from WebSite's current page. |
public Component load(String name) | Loads component object from disk. It is called by superclass CardPanel's update() method if the panel needs updating. |
FooterCards. A private class defined by FooterPanel. Creates a stack of EventManagerPanel objects which represent the footers defined in the Site.web file.
package | earthstones | |
import | java.awt.*; java.applet.*; java.net.*; java.util.*; |
|
class declaration | class FooterCards extends CardPanel | |
constructors | FooterCards(Container app, int x, int y, int width, int height) | |
methods | public String getState() | Extracts and returns string representing chapter panel's current state from WebSite's current page. |
public Component load(String name) | Loads all of footer's component objects from disk (see FooterPanel documentation for a list of components). It is called by superclass CardPanel's update() method if the panel needs updating. | |
public synchronized void update() | The superclass CardPanel assumes that it has just one panel to update. Here that method is extended to allow FooterCards to update all of its component panels. | |
public static void preload() | This method requires implementation only under the conditions of EarthStones' Version 2 website which required use of javascript calls and made it necessary to insure that certain objects were "preloaded". |
IconButton. A private class defined by FooterPanel. Creates a stack of ImageButton objects which permit the user to move to another chapter/section. The user is responsible for defining the appropriate behavior in this method's action() method.
package | earthstones | |
import | java.awt.*; java.applet.*; java.net.*; java.util.*; |
|
class declaration | class IconButton extends CardPanel | |
constructors | IconButton(Container app, int x, int y) | The first constructor uses CardPanel's default setting of autoScale = true. The update() method insures that the panel's size is set to that of its button component. |
IconButton(Container app, int x, int y, int
width, int height) { super(app, x, y, width, height) |
||
methods | public String getState() | Extracts and returns string representing IconButton's current state from WebSite's current page. |
public Component load(String name) | Loads an IconButton panel from the disk when called by the CardPanel's update method. | |
public synchronized boolean action(Event evt, Object arg) | Handles the IconButton's user events. |
NavigationButton. A private class defined by FooterPanel. Creates a stack of ImageButton objects which allow the user to move to previous/next chapter/page.The user is responsible for defining the appropriate behavior in this method's action() method.
package | earthstones | |
import | java.awt.*; java.applet.*; java.net.*; java.util.*; |
|
class declaration | class NavigationButton extends CardPanel | Note: This class uses
CardPanel to define a stack of alternative button objects to be shown in the panel.
Although in this case its instances will consist of just a single non-blank button image (e.g., the "next" arrow), it is convenient to use the CardPanel object to capitalize on its capacity to show blank or null images. |
constructors | NavigationButton(Container app, int x, int y) | The first constructor uses CardPanel's default setting of autoScale = true. The update() method insures that the panel's size is set to that of its button component. |
NavigationButton(Container app, int x, int
y, int width, int height) { super(app, x, y, width, height) |
||
methods | public String getState() | Extracts and returns string representing NavigationButton's current state from WebSite's current page. |
public Component load(String name) | Loads a NavigationButton panel from the disk when called by the CardPanel's update method. | |
public synchronized boolean action(Event evt, Object arg) | Handles the NavigationButton's user events. |
NavigationChoice. A private class defined by FooterPanel. Creates a stack of WebChoice objects (i.e., listboxes) which presents chapter/page lists for the viewer's selection. The user is responsible for defining the appropriate behavior in this method's action() method.
package | earthstones | |
import | java.awt.*; java.applet.*; java.net.*; java.util.*; |
|
class declaration | class NavigationChoice extends CardPanel | |
constructors | NavigationChoice(Container app, int x, int y, int width) | These constructors do not define the height of the NavigationChoice which is set automatically in WebChoice depending upon the fontSize used by the component (which, in turn, varies with the user's screen resolution). |
methods | public String getState() | Extracts and returns string representing NavigationChoice's current state from WebSite's current page. |
public Component load(String name) | Loads a NavigationChoice panel from the disk when called by the CardPanel's update method. | |
public synchronized boolean action(Event evt, Object arg) | Handles the NavigationChoice's user events. | |
public void update() | Unlike the other extensions of CardPanel,
the parent class' update() method is overridden here because of quirkly sizing of choice components in certain browsers/platforms. Resizes the current WebChoice component. |