/** 
 * This is the widget superclass for the Grapher package.  It is the base class for all 
 * widgets in the Grapher package.
 */
function PrtAbstract_Widget() {
  // Properties:
  //    Constants:
   this.EVENT_RECEIVER_METHOD = "GloScope.objGrapher.receiveEvent"; 
  /*-
   * These colors are used for the borders and plotted points of each ContainerDiv in the graph.
   * We use the array literal definition instead of the object one and we put this declaration
   * in the prototype because we do not
   * need to dynamically change the size nor contents of the array. 
   * NOTE: The last color (black) is provided to enable shifting the color sequence
   * for development testing so that the border color index can be shifted up by one where 
   * it is assigned in ContainerDiv, so that it is different from the plotting color, to
   * enable definite checking of  
   * proper alignment with borders on different platforms.
   */
   this.GRAPH_COLORS = [ "#FFFF00", "#FF9900", "#FF3300", "#33FFFF", 
                         "#FF00CC", "#CC99FF", "#FFFFFF", "#3399FF", 
                         "#006600", "#CCCCCC", "#FF99FF", "#009999", 
                         "#000000"];  
  //    Variables:
   this.strHtml = "";
   this.objDomRef = null;
   //   Methods:
   this.getHtml         = abstract_Widget_getHtml;
   this.updateDom       = abstract_Widget_updateDom; 
   this.getData         = abstract_Widget_getData;
   this.getDomObj       = abstract_Widget_getDomObj;
   this.cleanReference  = abstract_Widget_cleanReference;
   this.getFillerMarkup = abstract_Widget_getFillerMarkup;
   //      Constructor method:
   this.abstract_Widget = abstract_Widget;
}


/** 
 * Each widgets must have a getHtml method that returns the markup that 
 * represents it on the screen.  This method must be overridden by extending classes.
 * @return string  The HTML mentioned above.
 */
function abstract_Widget_getHtml() {
  return this.strHtml;
}


/**
 * This method returns the document object associated with 
 * the widget.  If the widget is composite, then it returns the 
 * container in which the composite elements are contained.
 */
function abstract_Widget_getDomObj() {
  if (this.objDomRef == null) {
    this.objDomRef = GloScope.CrossPlatformCode.getReferenceToDocProperty(window.top.canvas, this.strId);
    return this.objDomRef;
  } else {
    return this.objDomRef;
  } 
}


/**
 * This method removes the DOM reference of the widget.
 */
function abstract_Widget_cleanReference() {
  this.objDomRef = null;
}


/*-
 * The updateDom method is always overridden if it is used at all.
 * It updates predetermined properties in the DOM object of the widget.
 */
function abstract_Widget_updateDom() {
  if (this.getDomObj()) {
    return true;
  } else {
    return false;
  }
}


/** 
 * Each widgets must have a getData method that returns the data that 
 * the widget is responsible for.  If used, this method must be 
 * overridden by extending classes.
 * @return anyValue  The data held by the widget.
 */
function abstract_Widget_getData() {
  return;
}

// Static values:
abstract_Widget.prototype = new PrtAbstract_Widget();
abstract_Widget.getFillerMarkup = abstract_Widget_getFillerMarkup;
/** 
 * This is the class constructor of the widget class.
 * It is made to be invoked as a 'this.' method in the constructor
 * of extending classes.
 */
function abstract_Widget() {
  // Bestow unique copies of any objects on extending classes here via the 'new' keyword.
}


/**
 * This method provides the HTML code needed for an otherwise empty div
 * to render correctly.  
 * @param intHeight  The height of the filler table.
 * @param intWidth  The width of the filler table.
 * @param strContents  OPTIONAL  The contents of the table.
 * @return string  The HTML for the filler table.
 */
function abstract_Widget_getFillerMarkup(intHeight, intWidth, strContents) {
  return (GloScope.CrossPlatformCode.getFillerMarkup(intHeight, intWidth, strContents));
}





