home *** CD-ROM | disk | FTP | other *** search
/ Best Tools for JAVA / Best Tools for JAVA.iso / JAVA_ALL / HOTJAVA_ / HOTJAVA / CLASSSRC / BROWSER / DISPLA~1.JAV < prev    next >
Encoding:
Text File  |  1995-08-11  |  1.6 KB  |  56 lines

  1. /*
  2.  * @(#)DisplayItemTagRef.java    1.10 95/03/20 Jonathan Payne
  3.  *
  4.  * Copyright (c) 1994 Sun Microsystems, Inc. All Rights Reserved.
  5.  *
  6.  * Permission to use, copy, modify, and distribute this software
  7.  * and its documentation for NON-COMMERCIAL purposes and without
  8.  * fee is hereby granted provided that this copyright notice
  9.  * appears in all copies. Please refer to the file "copyright.html"
  10.  * for further important copyright and licensing information.
  11.  *
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
  13.  * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
  14.  * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  15.  * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
  16.  * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
  17.  * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
  18.  */
  19.  
  20. package browser;
  21.  
  22. import net.www.html.Tag;
  23. import awt.*;
  24.  
  25. /**
  26.  * Class DisplayItemTagRef is the superclass of all hotjava tag
  27.  * refs which result in the creation of display items.  Subclassers
  28.  * must override the buildDisplayItem method, and often that's all
  29.  * they need to override.
  30.  * @see ImgTagRef
  31.  * @see HRTagRef
  32.  * @see Document
  33.  * @version 1.10, 20 Mar 1995
  34.  * @author Jonathan Payne
  35.  */
  36.  
  37. public class DisplayItemTagRef extends WRTagRef {
  38.     DisplayItem    di;
  39.  
  40.     public DisplayItemTagRef(Tag t, int pos, boolean isEnd) {
  41.     super(t, pos, isEnd);
  42.     }
  43.  
  44.     abstract void buildDisplayItem(WRFormatter f);
  45.  
  46.     public void apply(WRFormatter f) {
  47.     if (di == null) {
  48.         buildDisplayItem(f);
  49.     }
  50.     if (di != null) {
  51.         f.addDisplayItem(di, true);
  52.         f.addCharacterSpacing(' ');
  53.     }
  54.     }
  55. }
  56.