<title>BaseBrowser Design</title>
<h1>BaseBrowser</h1>

<code>
<pre>
class BaseBrowser: public MonoGlyph, public Observer {
public:
  BaseBrowser(BaseBrowser*, const char*); 
  virtual ~BaseBrowser(); 

  virtual void wind(Window*);  
  virtual Window* wind(); 
  virtual Glyph * view() = 0; 

  virtual char* title(); 
  virtual BaseBrowser * parent(); 
  virtual Observable* app(); 
  virtual void update(Observable*){}; 
  virtual void curTable(char*); 
  virtual const char* curTable(); 

  virtual uInt minColumns(); 
  virtual uInt minRows(); 
  virtual uInt rowWidth(); 
  virtual uInt colWidth(); 
  virtual uInt elWidth(); 
  virtual const char * defaultFormat(DataType); 
  virtual char* formatColumn(const char*); 
  virtual char* formatRow(const char*); 
  virtual char* formatElement(const char*); 
  virtual char blankChar(); 
};
</pre>
</code>

BaseBrowser is the class from which most classes in the Table Browser system
are derived.  BaseBrowsers are intended to encapsulate the following behaviors:

<ol>
<li> Single glyph embedded within window
<li> Element in a hierarchical system of BaseBrowsers
<li> Consistent formatting of output
</ol>

<h2> Single glyph embedded within window functions</h2>

The functions wind() and view() are responsible for giving the BaseBrowser 
this functionality.  The wind() functions take and set the parent window, and 
the view() function returns a glyph which will become the body of the 
BaseBrowser.<p>

<h2>Element in a hierarchical system of BaseBrowsers functions</h2>

The functions title(), parent(), app(), update(Observable*), and curTable() 
work together to make a BaseBrowser act as a node in a hierarchy.  title() 
returns the title of the BaseBrowser (given it in its constructor).  parent() 
returns the parent of the BaseBrowser (also given in the constructor).<p>

app() and update(Observable*) work together to create an InterViews 
observer/observable protocol between all BaseBrowsers in a hierarchy and the 
<a href="TableApp">TableApp</a> at the top of the hierarchy.curTable(char*)
and curTable() work with app() and update(Observable*) to determine which
BaseBrowsers should respond to a given update.  Whenever a BaseBrowser modifies
its data, it should call curTable(title()).  This will cause the 
<a href="TableApp">TableApp</a> object to set the _curTable string to the title
of the calling BaseBrowser and then call update(Observable*) on all its 
BaseBrowsers.  To determine whether do update its display when update is
called, each BaseBrowser performs a strcmp(curTable(), title()).  If the
curTable() is the title of the BaseBrowser, an update is needed.  Otherwise,
the update message may be safely ignored.<p>

<h2>Consistent formatting of output</h2>

minColumns() and minRows() return the minimum number of columns and rows,
respectively, that should be displayed.  The default is 10 columns and 20 rows.
rowWidth(), colWidth(), and elWidth() define default widths (in characters) for
rows, columns, and elements, respectively.  By default, the rowWidth is 7, 
colWidth is 10, and elWidth = colWidth.  defaultFormat(DataType) returns a 
default printf format specifier for a given DataType.  formatColumn, formatRow,
and formatElement return their argument, left justified and padded with spaces
to colWidth(), rowWidth(), and elWidth() spaces.  blankChar() returns the
character used to denote a blank cell.  By default, this is '~'.<p>



