All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class semper.util.browser.Browser

java.lang.Object
   |
   +----semper.util.browser.Browser

public abstract class Browser
extends Object
implements MenuLaunchable
This class implements a generic browser for viewing (and possibly handling) SEMPER objects like payment transaction records, certificates, and more complex objects such as deals, which may consist of several transactions themselves.

The basic scenario for browsing looks as follows:

  1. The user launches the SEMPER browser by selecting it from the application menu on the Tinguin. It should be possible to select the type of objects to be browsed as well. This is currently done by having an entry for each type of objects, called Payments, Certificates, Deals, and so on. The user is allowed to have various of these browsing sessions open at the same time.
  2. For the selected type of objects, the responsible SEMPER module will be called to get a list of all relevant objects. These objects are all Browseable objects, which ensures that certain methods are available. An example of a basic method is exportToHTML(), which may produce a String formatted in HTML to be shown on the Tinguin. Another example is a method exportToASCII() that returns a String in ASCII. These methods will be called by the browser during the browsing process.
    The responsible module knows where and how the objects are stored and may return all of them in an array or Vector.
  3. Once the Browseable objects have been loaded by the browser, all of them or a suitable subset will be displayed in a main browser window. The browser window is equipped with several facilities that enable the user to walk through the objects, and to perform specific actions on them. The objects are sorted according to specified criteria, e.g., by date. This may give rise to more windows, or even completely separate sessions, that operate on user-selected objects. For today's Tinguin (March 1998), there are not that many ways to provide browsing primitives with the same look-and-feel as on popular OSs such as Windows 95.
  4. The normal way to stop browsing will be to quit the main browser window.

Other features of the browser are concerned with the export of the information to a file, such that the information can be used outside SEMPER. Future enhancements of this type of export could support mechanisms that enable people to import SEMPER payment transactions into their financial (bookkeeping) applications.

The first implementation of the Browser is planned to simply use the Tinguin. The goal is to make it easy to replace this with an implementation that uses the Java AWT directly or other toolkits such as JFC. In the latter case, the Tinguin may still be used to show possible error messages, hence even if advanced windowing is used, the Tinguin may still be used for some basic interactions (including starting up the browser application).

Technically the objects that implement a kind of browser for SEMPER should be subclasses of the browser class. Thus, when there is need for browsing through Browseables they can call the interact method from the Browser class. Using method overloading two options are offered concerning actions upon Browseable objects. The term actions includes various kinds of sorting, or several methods that depend on the Browseable. The two options are the following :

  1. All actions can be provided by the object that implements the Browseable interface. On that occasion the browser developer should call the method public void interact(Browseable[], String) of the Browser class.
  2. A different object that implements the BrowseableActions interface can provide the actions. On that occasion the browser developer should call the method public void interact(Browseable[], BrowseableActions, String) of the Browser class.

In case there is need for 'recursive' invocations of the generic browser, the method public void interact(Browseable[], String, TinguinSession) can be called
(a) to avoid that new sessions are created continuously and (b) to make all the windows visible at the same time (if they belong to different sessions they cannot be viewed at the same time).

See Also:
Browseable, BrowseableActions

Variable Index

 o PAGE_LENGTH
Number of entries that are displayed by the Browser, page by page.
 o PROGRESS_BAR_INTERVAL_MILLIS
Number of millisecs between successive updates of the progress bar.
 o PROGRESS_BAR_INTERVAL_NUMBER
Number of Browseables between successive updates of the progress bar.
 o removal

Constructor Index

 o Browser()

Method Index

 o getInput(TinguinSession, String, String, String)
Let user enter some info on a Tinguin window with a header, some auxiliary text, and a prompt.
 o interact(Browseable[], BrowseableActions, String)
Starts interaction with the user via a TINGUIN session.
 o interact(Browseable[], String)
Starts interaction with the user via a TINGUIN session.
 o interact(Browseable[], String, TinguinSession)
Starts interaction with the user via a TINGUIN session.
 o interact1(Browseable[], BrowseableActions, String)
Browse the objects page by page, interacting with the user via a TINGUIN session.
 o interact1(Browseable[], BrowseableActions, String, TinguinSession)
Browse the objects page by page, interacting with the user via a TINGUIN session.
 o interact2(TinguinSession, Browseable[], int[], int, BrowseableActions)
Browse the objects one by one, interacting with the user via a TINGUIN session.
 o launch()
Performs the actions intended corresponding to the menu item by which this method was invoked.
 o select(Browseable[])
Select all the non-null Browseables of the given array of Browseables.

Variables

 o PROGRESS_BAR_INTERVAL_NUMBER
 public static final int PROGRESS_BAR_INTERVAL_NUMBER
Number of Browseables between successive updates of the progress bar. To be used during reading (by the subclasses of Browser).

See Also:
PROGRESS_BAR_INTERVAL_MILLIS
 o PROGRESS_BAR_INTERVAL_MILLIS
 public static final int PROGRESS_BAR_INTERVAL_MILLIS
Number of millisecs between successive updates of the progress bar. To be used during reading (by the subclasses of Browser).

See Also:
PROGRESS_BAR_INTERVAL_MILLIS
 o PAGE_LENGTH
 public static final int PAGE_LENGTH
Number of entries that are displayed by the Browser, page by page. A page by page approach is used to avoid problems with the current Tinguin, such as OutOfMemory errors if there are many entries, and also slow operation in that case.

 o removal
 public static boolean removal

Constructors

 o Browser
 public Browser()

Methods

 o interact
 public void interact(Browseable browseables[],
                      String name) throws Exception
Starts interaction with the user via a TINGUIN session.

Parameters:
browseables - array of Browseable objects.
name - the formal name of the Browseable (e.g.Certificate, Transaction, Deal).
Throws: Exception
for now we just pass up all the exceptions.
 o interact
 public void interact(Browseable browseables[],
                      BrowseableActions actions,
                      String name) throws Exception
Starts interaction with the user via a TINGUIN session.

Parameters:
browseables - array of Browseable objects.
actions - define actions upon the browseable objects. If it is null, the actions are defined within the browseables.
name - the formal name of the Browseable (e.g.Certificate, Transaction, Deal).
Throws: Exception
for now we just pass up all the exceptions.
 o interact
 public void interact(Browseable browseables[],
                      String name,
                      TinguinSession display) throws Exception
Starts interaction with the user via a TINGUIN session.

Parameters:
browseables - array of Browseable objects.
name - the formal name of the Browseable (e.g.Certificate, Transaction, Deal).
display - Tinguin session to display the information.
Throws: Exception
for now we just pass up all the exceptions.
 o interact1
 public void interact1(Browseable browseables[],
                       BrowseableActions actions,
                       String name) throws Exception
Browse the objects page by page, interacting with the user via a TINGUIN session.

Parameters:
browseables - array of Browseable objects.
actions - define actions upon the browseable objects. If it is null, the actions are defined within the browseables.
name - the formal name of the Browseable (e.g.Certificate, Transaction, Deal).
Throws: Exception
for now we just pass up all the exceptions.
 o interact1
 public void interact1(Browseable browseables[],
                       BrowseableActions actions,
                       String name,
                       TinguinSession dis) throws Exception
Browse the objects page by page, interacting with the user via a TINGUIN session.

Parameters:
browseables - array of Browseable objects.
actions - define actions upon the browseable objects. If it is null, the actions are defined within the browseables.
name - the formal name of the Browseable (e.g.Certificate, Transaction, Deal).
dis - The Tinguin session for displaying the information.
Throws: Exception
for now we just pass up all the exceptions.
 o interact2
 public void interact2(TinguinSession dis,
                       Browseable browseables[],
                       int p[],
                       int target,
                       BrowseableActions actions) throws Exception
Browse the objects one by one, interacting with the user via a TINGUIN session. Only the selection indicated by array p is shown.

Parameters:
dis - Tinguin session to use for displaying the information.
browseables - array of Browseable objects
p - array of indices into browseables
target - index of object to display first.
actions - define actions upon the browseable objects. If it is null, the actions are defined within the browseables.
Throws: Exception
for now we just pass up all the exceptions
 o getInput
 protected static String getInput(TinguinSession display,
                                  String heading,
                                  String text,
                                  String prompt)
Let user enter some info on a Tinguin window with a header, some auxiliary text, and a prompt. The user must choose "OK" or "Cancel".

Returns:
String (==null if Cancel)
 o select
 protected static int[] select(Browseable xs[])
Select all the non-null Browseables of the given array of Browseables.

Parameters:
xs - array of Browseables, possibly with null entries.
Returns:
index array p such that
  1. 0 <= p[i] < xs.lenghth for 0 <= i < p.length
  2. # null entries in xs is equal to xs.length - p.length
  3. p contains no duplicate indices

All Packages  Class Hierarchy  This Package  Previous  Next  Index