gui package


Package Contract

This package is responsible for creating a graphical user interface, GUI. The starting point of this package is the KSApplet which contains an InterfaceWindow, which contains all the components for the GUI.

This interface has two very important jobs. One is to construct a two-dimensional display that still represents all the dimensions that have been computed in the WebpageDB. The other important job is to monitor all the user's activities in the GUI and to then pass the relevant information to the Generalizer. The Generalizer is another top actor who's responsibilities are to adjust the values in the database to reflect the user's interests. An good analogy for the Generalizer is to view it as a "teacher", one that adjust your "values" until you get it right.

There are three "sub-packages" within this package, they are the action package, event package, and the preview package. These packages each have their own package description page describing their responsibilities.

Package-Level CRC

Collaborators:
webpageDB, tools, gui.action, gui.event, gui.preview.

Responsibilities:

Class-Level CRCs

The gui package contains the following classes:
* AudioControl
* CloseUp
* Icon
* CloseUpViewport
* CloseUpMouseHandler
* CollapsibleToolBar
* Context
* Dial
* DialMouseHandler
* TickLabel
* Line
* IconSet
* ImageManager
* InterfaceWindow
* BoundsChangeListener
* KSApplet
* Location
* Overview
* AddButtonHandler
* RemoveButtonHandler
* OverviewMouseHandler
* OverviewViewport
* PageImporter
* UrlAdder
* BookmarksAdder
* Plotter
* Relationships
* Preferences
* StatusBar
* UserInterface
* WindowCloser

Class AudioControl (under development)

* Responsibilities:
* Collaborators:
* Variables and Methods:
public void play(String audioFileName)

Class CloseUp

* Responsibilities:
This class is a container for three components that the user sees:
CloseUpViewport
The CloseUpViewport provides an area to draw Icons, these represent pages, close to the user's current location in the space of pages.
CollapsibleToolBar
The CollapsibleToolBar provides a container to hold buttons and dials that the user can choose to display or collapse. The CloseUp constructor decides what is included in the toolBar. This toolBar is provided to allow the user to effect the behavior of the system and to personalize the viewport.
PagePreview
The PagePreview is a window that will appear above the CloseUpViewport to display a quick preview of a page. This window is displayed when the user allows the mouse cursor to remain over an Icon in the CloseUpViewport. To view the page the user clicks the mouse in the PagePreview window causing the page to be loaded into the Netscape browser. The PagePreview window disappears when the user moves the mouse cursor off of the PagePreview window.
This class also acts as the intermediate messenger for all three of the components. Allowing each component to notify the others of user activity. The Generalizer, an actor that changes the space of pages according to user activity, is notified of these activities.
* Constructors:
CloseUp(Vector graphOfPageSpace, Location initialLocation, InterfaceWindow parentWindow)
Return a CloseUp with the given graph and location.
* Variables and Methods:
void doLayout()
Overrides the superclass' doLayout(). Sets the sizes and positions of the components.
void paint(Graphics graphicsContext)
Repaints the components of the CloseUp.
void centerChanged(Location newCenter)
Called by the InterfaceWindow when the user changes the centerLocation of the closeUp view via the Overview.
Notifies the CloseUpViewport of the change.
void viewportScrolled(Location newCenter)
Called by the CloseUpViewport when the user scrolls the viewport location.
This information is passed to the registered listeners.
void documentMovedByUser(Document documentMoved, Location oldLocation, Location newLocation)
Called by the CloseUpViewport when the user moves an icon. The Generalizer is notified of this activity.
void displayPagePreview(Document documentToView, Location whereLocation)
Called by the CloseUpViewport when the user wants a PagePreview
Opens the PagePreview at the whereLocation to display a simple view of the documentToView.
The Generalizer is notified of this activity.
void removePagePreview()
Called by the PagePreview when the user moves the mouse off the PagePreview window.
void addCloseUpListener(CloseUpListener newListener)
Register a CloseUpListener.
void removeCloseUpListener(CloseUpListener oldListener)
Unregister a CloseUpListener.

Class Icon

* Responsibilities:
An instance of this class holds information about an icon to be displayed. Each icon represents a page in the space of pages.
* Constructors
Icon(Point upperLeftCorner, int width, int height, Color color, Document document)
Returns an Icon with the fields initialized.
Icon(Document document)
Returns an Icon with only the document field initialized. The other fields get default values.
* Variables and Methods:
various get methods for the fields.
boolean containsPoint(Point pointToCheck)
Determines if the point to check is inside the icon's boundaries.
void moveTo(Point newLocation)
Allows an Icon to be moved by supplying a new Point for the upper left corner of the icon.

Class CloseUpViewport

* Responsibilities:
This class draws the Icons that are near the user's current location in the space of pages, providing a closeup view.
The Icons represent pages in the space of pages, each maintaining the following properties: location, color, hue, and dimensions. The properties are used to indicate the contents of the pages to the user.
Here are the activities that can occur in the CloseUpViewport:
Move the location of an Icon
The user is allowed to move the location of Icons by clicking on an icon and dragging it to a new location. When this occurs this class will notify the CloseUp of the change.
Scroll the location of the viewport:
To scroll the viewport the user needs to move the mouse to one of the four edges of the viewport. The CloseUp is notified of the center changing in the viewport.
Preview a simplified version of a page:
If the location of the mouse remains over an Icon for a small amount of time the viewport will notify the CloseUp that a preview of the corresponding page should be displayed.
* Constructors:
CloseUpViewport(CloseUp closeUpAbove, IconSet graphOfPageSpace, Location currentLocation)
Returns a ViewPort representing the graph centered around the currentLocation.
* Variables and Methods:
void paint(Graphics graphicsContext)
Repaints all the icons.
void centerChanged(Location newCenter)
Called by the CloseUp, which had been notified that the user changed location in the space of pages via one of the other components in the GUI.
The Icons displayed in the viewport are changed to correspond to the new center location.

The following methods are called by the CloseUpMouseHandler, defined at the bottom of this page, to notify the viewport of mouse activity:
void notifyOfMousePressed(Point mousePoint)
If the click is on an icon then draggingIcon is set to true to notify the other methods of this state condition. Also other variables are set to value relating to the icon moving.
void notifyOfMouseDragging(Point mousePoint)
If draggingIcon is true then movingIcon is moved to the new location designated by the mousePoint.
void notifyOfMouseReleased(Point mousePoint)
If an icon had been dragged then the variables are reset.
void notifyOfMouseMovement(Point mousePoint)
Determines if location is above an Icon. If so a thread is created to go to sleep for a designated amount of time (that is, one second). If the mouse has not moved off of the Icon in that time then the CloseUp is notified to display the corresponding page in the CloseUp's PagePreview.
Private Methods:
void determineIconsViewable()
Using the graphOfPageSpace a Vector of Icons is constructed, keyed on the xValue of the icon.
void paintIcons(Graphics graphicsContext)
Called by paint to paint all the Icons.
int pointOnAnIcon(Point location)
Determines if the point is within the boundaries of an icon in the icon hashtable.

Class CloseUpMouseHandler

* Responsibilities:
This class monitors all MouseEvents for the CloseUpViewport.
If the user is dragging the mouse then once the drag movement is finished the CloseUpViewport is notified of the event, passing the starting and ending points.
If the user is not dragging the mouse then the mouse location is passed to the ClosUpViewport.
The reasons these activities are monitored are stated in the CloseUpViewport class definition above.
* Variables and Methods:
void mousePressed(MouseEvent event)
Stores the point where the user clicked.
void mouseReleased(MouseEvent event)
If the mouse is being dragged then the startPoint and endPoint of the drag movement is passed to the CloseUp. Reset dragging to false and startPoint to null.
void mouseDragged(MouseEvent event)
Mark the boolean variable, dragging, to true.
void mouseMoved(MouseEvent event)
If dragging is false then send the point location to the CloseUp.

Class CollapsibleToolBar

* Responsibilities:
This class is a ToolBar that can be collapsed and expanded. To change the state, click on the button at the bottom of the ToolBar. The state changes happen slow enough to give the impression of a window shade rolling up or down.
You can't add a layout manager to the CollapsibleToolBar. The controls stacked in a single column. They're each given an equal amount of space. The button at the bottom is as wide as the others but half as tall.
When the CollapsibleToolBar is expanded, all the controls are visible. When it is collapsed, only the collapse/expand button is visible.
* Constructor
public CollapsibleToolBar()
Public Methods:
public void setLayout(LayoutManager manager)
public boolean isCollapsed()
public void collapse()
public void expand()
public void toggle()
Protected Methods:
protected void addImpl(Component component, Object constraints, int index)
Bugs
1. There is an AWT bug in the releases before 1.1.4 that was causing the topmost component to be put in the wrong place after the toolbar is collapsed and expanded again. The workaround included in doLayout() makes sure that the call to setBounds() will change the Component's size or location.
2. Components can only be added while the ToolBar is expanded.

Class Context (under development)

* Responsibilities:
To store user activities in order so that the system, particularly the Generalizer, can try to better understand the implications of the user's activities in the space of pages.
* Constructors:
public Context()
Public Methods:
public int similarityTo(Document document)
public void addPagePreview(PagePreview page)
public PagePreview getNextPagePreview()
public boolean pageAlreadyPreviewed(Document document)
public void addBrowserPage(Document document)

Class Dial

* Responsibilities:
A Dial is a graphical component used to display a value to the user and let them change that value. It looks like the speedometer of a car, with a needle indicating the present value. A label is displayed at the bottom of the control.
The number of tickmarks on the dial can be set when the Dial is created. A default of 9 is used if no value is given.
The user can change the value of the Dial simply by dragging the needle with the mouse or clicking the spot they want the needle to go to. When they do so, any registered DialListeners will be sent a DialEvent.
* Constructors
public Dial(String label, int minValue, int maxValue, int currentValue)
public Dial(String label, int minValue, int maxValue, int currentValue, int numberOfTickmarks)
* Variables and Methods:
Accessors
public void setValue(int value)
public int getValue()
public void setLabel(String string)
public String getLabel()
public void setDialColor(Color color)
public Color getDialColor()
public void setNeedleColor(Color color)
public Color getNeedleColor()
public void setMaximum(int max)
public int getMaximum()
public void setMinimum(int min)
public int getMinimum()
DialListeners
public void addDialListener(DialListener listener)
Register an event listener.
public void removeDialListener(DialListener listener)
Unregister an event listener.
Painting
public void paint(Graphics graphicsContext)
Paint the Dial.
Protected methods
protected void prepareDrawing(Graphics graphicsContext)
prepareDrawing() re-computes the layout of the Dial if anything has changed.
protected void drawDial(Graphics graphicsContext)
drawDial() paints the Dial on the screen.
protected void forceNextRedraw()
This method should be called when some parameter changes that will affect the Dial's appearance, but isn't normally checked for by prepareDrawing() when it decides to recompute things. It forces prepareDrawing() to recompute everything next time it's called.
Private Methods:
Line computeRadialSegment(float value, int innerRadius, int outerRadius)
This is a helper method. It finds the line segment on the radius that represents the given value. The length of the segment will be outerRadius - innerRadius.

Class DialMouseHandler

* Responsibilities:
The DialMouseHandler is used to process MouseEvents using methods from the MouseListener and MouseMotionListener interfaces.
* Variables and Methods:
public void mousePressed(MouseEvent event)
If they clicked on the needle, begin dragging. Otherwise, if they clicked on the Dial area, move the needle so it's under the mouse.
public void mouseReleased(MouseEvent event)
Stop dragging the mouse.
public void mouseDragged(MouseEvent event)
If they last clicked on the needle, change the value of the Dial so the needle is under the mouse.
public void mouseMoved(MouseEvent event)
We need this method because we can't inherit from both MouseAdapter and MouseMotionAdapter. Do nothing.
private void moveNeedle(Point coordinate)
Compute the new needle location and change the value of the Dial so it's on the line between the origin and the given coordinate.

Class TickLabel

* Responsibilities:
The TickLabel class holds a label's String and the (x, y) coordinates of the point the String is to be drawn from on the Dial. It has no methods besides the constructor.
* Constructor
public TickLabel(int value, FontMetrics fontMetrics, Line tick)
From the value and the associated tickmark line, compute where the label should be drawn.

Class Line

* Responsibilities:
The Line class holds the coordinates of the endpoints of a line.
* Constructors
public Line()
public Line(int x1, int y1, int x2, int y2)
* Variables and Methods:
public void translate(int newX, int newY)
public boolean containsPoint(Point point)
public boolean nearPoint(Point point, int threshold)
public void translate(int newX, int newY)
Shift the line by (newX, newY).
public boolean containsPoint(Point point)
Return true if the Point is on this Line.
public boolean nearPoint(Point point, int threshold)
Return true if the Point is within threshold pixels of the Line.

Class IconSet

* Responsibilities:
IconSet contains a Vector of Icons. It also provides a convenient way to get the maximum size of the space taken up by the icons.
* Constructor
public IconSet(Vector icons)
Store the icons and compute the dimensions of their space.
public Dimension getSize()
Return the size of the icon space.
public Vector getIcons()
Return the icons.

Class ImageManager

* Responsibilities:
This class provides a convenient way to fetch java.awt.Image and com.sun.java.swing.ImageGlyph objects. All of its methods are static, and it is not meant to be instantiated.
You must call setBaseURL() before any Images can be loaded. setBaseURL() defines the top-level directory under which images are stored.
The reason this class is called ImageManager and not ImageLoader is that the underlying method that gets images, ImageGlyph.createImageGlyph(), caches the images it downloads. So if two requests are made for the same URL, only the first one results in a download.
* Constructors
protected ImageManager()
You don't need to instantiate an ImageManager.
Public Methods:
public static void setBaseURL(URL newBaseURL)
Define the top-level directory under which images are stored.
public static void setBaseURL(String urlString)
Define the top-level directory under which images are stored. A MalformedURLException is thrown if urlString is invalid.
public static URL getBaseURL()
Return the base URL.
public static ImageGlyph getImageGlyph(String path)
Fetch an image and return it as an ImageGlyph. Return null if an error occurs.
public static Image getImage(String path)
Fetch an image and return it as an Image. Return null if an error occurs.

Class InterfaceWindow

* Responsibilities:
The InterfaceWindow is the Frame that holds the objects that make up the system's user interface. It contains a CloseUp, a StatusBar, Preferences, and a Plotter.
The CloseUp handles the display, and can access the StatusBar with the getStatusBar() method if it wants to show a message.
When the InterfaceWindow is created, it first checks for a saved Preferences object in a page called ".ks-prefs" If none exists, a new Preferences object is created with default settings. The CloseUp is responsible for recording changes in the Preferences object that may need to saved for the next session. The actual saving of the Preferences is done by the KSApplet when it quits. It will call the InterfaceWindow's savePreferences() method.
The InterfaceWindow is also responsible for listening to the database for changes. When a change is announced it will position the icons using its Plotter and pass them to the CloseUp.
InterfaceWindow implements the UserInterface interface, which means it allows UserActionListeners to register and unregister themselves. The CloseUp can call getUserActionListeners() when it needs to advertise a UserAction.
* Constructor
public InterfaceWindow(WebpageDB database)
Create a new InterfaceWindow and make it match the saved Preferences (if any were saved). Add a StatusBar and CloseUp, and pass the graph from the database to the CloseUp.
* Variables and Methods:
public void doLayout()
Since we're not using a layout manager, we must override this method (from Container) and do the layout by hand.
Methods implementing the UserInterface interface
public void addUserActionListener(UserActionListener listener)
Add another UserActionListener.
public void removeUserActionListener(UserActionListener listener)
Remove a UserActionListener from the list.
public void databaseChanged(WebpageDB database)
The database has changed, so update the interface.
Accessors
UserActionListener getUserActionListeners()
This method allows other objects in the package to send UserActions to our registered UserActionListeners.
Preferences getPreferences()
This method allows other objects in the package to get or set the preferences.
void savePreferences()
Save the preferences.
StatusBar getStatusBar()
This method allows other objects in the package to access the statusBar.
void addURL(String url)
Generate a UserAction so this URL will be added to the database.

Class BoundsChangeListener

* Responsibilities:
This class listens for changes in the InterfaceWindow's size or positions and records the new values in the Preferences.
* Constructor
public BoundsChangeListener(InterfaceWindow window)
* Variables and Methods:
public void componentResized(ComponentEvent event)
Record the new window size.
public void componentMoved(ComponentEvent event)
Record the new window location.

Class KSApplet

* Responsibilities:
The KSApplet starts the on-line portion of the system. Using parameters to the applet tag (dbhost and dbport), it attempts to get a reference to the WebpageDB via RMI. If it succeeds, it creates an InterfaceWindow and a Generalizer, and the user can begin using the system.
* Constructors
public void init()
Checks to see if a preference page exists, connects to the webpage database via an RMI socket, starts up an InterfaceWindow.
* Variables and Methods:
public void stop()
Save the Preferences when we quit.

Class Location

* Responsibilities:
Basically a glorified Point used to give Icons locations in the viewports.
* Variables and Methods:
public Location()
public Location(double x, double y)
public Location(Point point)
public Location(Location location)
public boolean equals(Location location)

Class Overview

* Responsibilities:
The Overview shows the user a picture of the entire space, but with little detail. It has two buttons above its picture of the space. The first one allows the user to create a new "landmark", which is a little cross that can remind them of a favorite spot in the space of pages. The other button can be used to destroy an existing landmark.
An OverviewViewport takes care of the details of drawing. It manages the icons and landmarks. The point at the center of the CloseUp is also displayed in the OverviewViewport, as a landmark.
The coordinates of landmarks and icons are in "icon coordinates", not raw pixels. (Icon coordinates are coordinates in the "space" occupied by the icons.) There are two reasons for this. First, the icons almost always require more space than the number of pixels available to the viewport, and we want to see them all. Secondly, if the viewport is resized, we want them all to remain visible and maintain the same positions relative to each other.
When the remove button is pressed, the cursor changes and the next landmark the user clicks on will be removed. After that, or if either button is pressed again, normal functionality resumes. The current state is recorded in the variable called state. It's value is either NORMAL_STATE or REMOVE_STATE.
A RemoveButtonHandler object listens for when the remove button is pressed or raised, and sets the state. An AddButtonHandler object listens for when the add button is pressed. If we're in NORMAL_STATE, it tells the viewport to add a landmark where the center point is. If we're in REMOVE_STATE, it puts us back in NORMAL_STATE.
MouseEvents are processed by an OverviewMouseHandler object. It allows the user to drag landmarks around. When the mouse is pressed and we're in NORMAL_STATE, the center is moved. When the mouse is pressed in REMOVE_STATE, the OverviewMouseHandler looks for a landmark close to the point clicked on. If there is one, it is removed.
Overview is a CloseUpListener, which means it can be notified when the center of the CloseUp changes or the zoom changes.
* Constructor
public Overview(IconSet icons, Vector landmarks, double initialZoom)
* Variables and Methods:
public void doLayout()
Override Panel's doLayout() because we're not using a layout manager. Set the sizes and positions of the components.
public void setIcons(IconSet icons)
Install a new set of icons.
Methods implementing the CloseUpListener interface
public void centerChanged(Location location)
Record the center of the CloseUp. (In icon coordinates, not pixels!)
public void zoomChanged(double zoomRatio)
Record the new zoom ratio.
Registering OverviewListeners
public void addOverviewListener(OverviewListener newListener)
Register an OverviewListener.
public void removeOverviewListener(OverviewListener oldListener)
Unregister an OverviewListener.
State
public int getState()
What state are we in?
void setState(int newState)
Change the state of the Overview. If we're changing to the remove state, the cursor will change. If we're changing to the normal state, the cursor is reset.

Class AddButtonHandler implements ActionListener

* Responsibilities:
This class controls what happens when addButton is pressed. When we're in the normal state, a new landmark is added under the center landmark. Otherwise we return to the normal state.
* Variables and Methods:
public void actionPerformed(ActionEvent event)

Class RemoveButtonHandler implements ActionListener

* Responsibilities:
This class controls what happens when removeButton is clicked on. When it is pressed, we go to REMOVE_STATE. When it's raised we go back to NORMAL_STATE.
* Variables and Methods:
public void actionPerformed(ActionEvent event)

Class OverviewMouseHandler extends MouseAdapter implements MouseMotionListener

* Responsibilities:
This class handles all MouseEvents. It implements methods from the MouseListener and MouseMotionListener interfaces.
* Variables and Methods:
public void mousePressed(MouseEvent event)
Handle mouse clicks.
public void mouseReleased(MouseEvent event)
If the mouse is released and they were dragging a landmark, we need to move it.
public void mouseDragged(MouseEvent event)
While dragging a landmark, remove it and update the center landmark's location.
public void mouseMoved(MouseEvent event)
This method must be included because we can't inherit from both MouseAdapter and MouseMotionAdapter. Do nothing.
private boolean near(Location location1, Location location2, int distance)
Return true if the two Locations are within distance pixels.

Class OverviewViewport

* Responsibilities:
The OverviewViewport class manages the part of the Overview below the buttons. It is not a public class. It draws dots where the icons are and crosses where the landmarks and center of the CloseUp are.
To prevent the crosses from being hidden by the colors of the icon dots behind them, they change color. The crosses for landmarks slowly pulse from white to blue and back. The cross for the center of the CloseUp pulses quickly from red to green and back. A Clock object (from the tools package) is used to time the pulses.
The coordinates of landmarks and icons are in "icon coordinates", not raw pixels. (Icon coordinates are coordinates in the "space" occupied by the icons.) There are two reasons for this. First, the icons almost always require more space than the number of pixels available to the viewport, and we want to see them all. Secondly, if the viewport is resized, we want them all to remain visible and maintain the same positions relative to each other.
Variables scaleX and scaleY record the conversion factors used to switch between icon coordinates and screen coordinates at the moment. Use determineScaleFactors() to compute their values. Divide by scaleX or scaleY to convert an icon coordinate to pixels, and multiply by them to convert pixels to icon coordinates. Other classes can use the scalePoint() method to convert a Point in screen coordinates to a Location in icon coordinates.
* Constructor
OverviewViewport(IconSet icons, Vector landmarks)
* Variables and Methods:
public Enumeration getLandmarks()
public void setCenterLocation(Location location)
public void setClockRate(double newRate)
public Location scalePoint(Point point)
public void addLandmarkAtCenter()
public void addLandmark(Location unscaledLandmark)
public void removeLandmark(Location oldLandmark)
public void setIcons(IconSet icons)
public void paint(Graphics graphicsContext)
public void drawIcons(Graphics graphicsContext)
public void drawLandmarks(Graphics graphicsContext)
public void tick()
Accessors
public Enumeration getLandmarks()
Return an Enumeration of the landmarks.
public void setCenterLocation(Location location)
Update the center location variable.
public void setClockRate(double newRate)
Change the clock to run at a speed that reflects the new clockRate.
Landmark Management
public Location scalePoint(Point point)
Return a Location corresponding to this Point in the icon coordinate system.
public void addLandmarkAtCenter()
Add a landmark where the center is.
public void addLandmark(Location unscaledLandmark)
Add a landmark (in screen coordinates) to the list.
public void removeLandmark(Location oldLandmark)
Remove a landmark from the list.
Icons
public void setIcons(IconSet icons)
Use a new IconSet.
Painting
public void paint(Graphics graphicsContext)
Draw the viewport.
public void drawIcons(Graphics graphicsContext)
Draw dots where the icons are.
public void drawLandmarks(Graphics graphicsContext)
Draw the landmarks.
Method implementing the ClockObserver interface
public void tick()
Called when it's time to change the landmarks' colors. On each tick we change the color of the center landmark. Every time the center landmark completes a cycle we change the color of the other landmarks as well.
Private Methods: private void drawLandmark(Graphics graphicsContext, Location landmark, Color color, int distance)
Draw a landmark.
private void determineScaleFactors()
Determine the scaling factors.

Class PageImporter

* Responsibilities:
A PageImporter is a modal dialog box that lets the user add URLs to the space of pages. Buttons allow them to add either a single URL or all the URLs from a page.
There are no methods other than the constructor. Events are handled by instances of two classes called UrlAdder and BookmarksAdder. These Adder classes listen to the buttons and act appropriately when they are pressed.
New URLs are passed to the InterfaceWindow that created this object via InterfaceWindow.addURL().
* Constructor
public PageImporter(InterfaceWindow interfaceWindow)

Class UrlAdder implements ActionListener

* Responsibilities:
This class will cause the URL in the TextField to be added to the database when the "Add URL" button is pressed.
* Variables and Methods:
public UrlAdder(InterfaceWindow interfaceWindow, TextField text)
public void actionPerformed(ActionEvent event)

Class BookmarksAdder implements ActionListener, FilenameFilter

* Responsibilities:
This class will create a FileDialog when the "Add URLs From Page" button is pressed. When a page is chosen, all links it contains will be added to the system's database.
* Variables and Methods:
public BookmarksAdder(InterfaceWindow interfaceWindow)
public void actionPerformed(ActionEvent event)
public boolean accept(File directory, String name)
From the FilenameFilter interface.
private void addLinksFromFile(File bookmarkPage)
Add every link in the given page to the database.
private void processAnchorTag(HtmlTag tag)
If this tag contains a link, add it to the database.

Class Plotter (under development!)

* Variables and Methods:
public Vector plot(Vector documents)
plot() will create a Vector of Icons given a Vector of Documents. It will calculate the location and size of each Icon.
Here's how it works: first, we look for pairs of Documents that are most similar to each other. We make icons for each pair, remove them from the Vector, and put the icons in a cluster. (A cluster is a group of similar icons. The icons in a cluster all use the same coordinate system.)
After that, we go through the remaining Documents, create their icons, and put their icons in the cluster that contains the icon of the Document most similar to them. If no cluster contains the icon of the Document most similar to them, a new cluster is created.
The last step is to use merge() to combine all the clusters together. The final conglomerate cluster is returned by plot().
private Vector clusterWith(Vector clusters, Document document)
Return the cluster from the list that contains the icon for this Document.
private void computeIconSize(Icon icon)
Set the size of this icon based on its hittage.
private void computeIconsBounds(Icon iconOne, Icon iconTwo)
Set the size and location of these icons. It is assumed that the first element of iconOne's similarity list is iconTwo.
private Icon getDocumentIcon(Vector cluster, Document document)
private Vector merge(Vector smallCluster, Vector largeCluster)
Merge the two clusters into one.

Class Relationship (under development, associated with Plotter)

* Responsibilities:
To serve as a placeholder for information about the relationship between two Icons (pages).

Class Preferences

* Responsibilities:
A Preferences object is used to store information about the user interface between sessions, so it can be restored later.
Preferences objects can be obtained either by calling the constructor or with the static method load(). load(), which should be passed a page name, will return the Preferences object that was stored in the page. Preferences objects can be stored using the save() method.
* Constructor
public Preferences()
* Variables and Methods:
public static Preferences load(String pagename)
public void save(String pagename) throws IOException
public int getSettingOfDial()
public void setSettingOfDial(int newSetting)
public Location getCenterOfCloseup()
public void setCenterOfCloseup(Location newCenter)
public Dimension getWindowSize()
public void setWindowSize(Dimension newSize)
public Point getWindowLocation()
public void setWindowLocation(Point newLocation)
public Vector getLandmarks()
public void setLandmarks(Vector newLandmarks)
public Context getContext()
public void setContext(Context newContext)
public Preferences()
Construct a Preferences with default values.
public static Preferences load(String pagename)
Load the Preferences object saved in the specified page. Return null if an error occurs.
public void save(String pagename) throws IOException
Save this Preferences object to the specified page. If something goes wrong, an IOException will be thrown.

Class StatusBar

* Responsibilities:
A StatusBar is simply a non-editable TextField. Use getText() and setText() to get or set the String it is displaying. StatusBar has the same constructors as TextField.
* Variables and Methods:
public StatusBar()
public StatusBar(int columns)
public StatusBar(String text, int columns)
public void setEditable(boolean ignored)
A StatusBar is never editable. Do nothing.

Class UserInterface

* Responsibilities:
This interface should be implemented by any user interface to the space of pages, so the interface can change without affecting other components.
* Variables and Methods:
// From the DatabaseListener interface. Called when the database changes.
public void databaseChanged(WebpageDB database);
// Methods to maintain the list of UserActionListeners.
public void addUserActionListener(UserActionListener listener);
public void removeUserActionListener(UserActionListener listener);

Class WindowCloser

* Responsibilities:
The WindowCloser is a utility class. Register it as a WindowListener to some window, or as an ActionListener to a "Close" or "Cancel" button on a window, and the window will be closed and disposed of at the appropriate time.
* Constructor
public WindowCloser(Window window)
* Variables and Methods:
public void windowClosing(WindowEvent event)
public void actionPerformed(ActionEvent event)
public WindowCloser(Window window)
public void windowClosing(WindowEvent event)
public void actionPerformed(ActionEvent event)

Message Interactions

Message Interactions with other packages
Message Interactions between classes in the package

last | | to sitemap | | up one level | | next