home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 144 / DPCS0200.iso / Internet / Supanet / system / swing.jar / javax / swing / text / html / ListView.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-11-05  |  2.1 KB  |  60 lines

  1. package javax.swing.text.html;
  2.  
  3. import java.awt.Graphics;
  4. import java.awt.Rectangle;
  5. import java.awt.Shape;
  6. import javax.swing.text.BoxView;
  7. import javax.swing.text.CompositeView;
  8. import javax.swing.text.Element;
  9.  
  10. public class ListView extends BlockView {
  11.    private StyleSheet.ListPainter listPainter;
  12.  
  13.    public ListView(Element var1) {
  14.       super(var1, 1);
  15.       StyleSheet var2 = ((BlockView)this).getStyleSheet();
  16.       this.listPainter = var2.getListPainter(((BlockView)this).getAttributes());
  17.    }
  18.  
  19.    public float getAlignment(int var1) {
  20.       switch (var1) {
  21.          case 0:
  22.             return 0.5F;
  23.          case 1:
  24.             return 0.5F;
  25.          default:
  26.             throw new IllegalArgumentException("Invalid axis: " + var1);
  27.       }
  28.    }
  29.  
  30.    public void paint(Graphics var1, Shape var2) {
  31.       super.paint(var1, var2);
  32.       Rectangle var3 = var2.getBounds();
  33.       Rectangle var4 = var1.getClipBounds();
  34.       if (var4.x + var4.width < var3.x + ((CompositeView)this).getLeftInset()) {
  35.          Rectangle var5 = var3;
  36.          var3 = ((CompositeView)this).getInsideAllocation(var2);
  37.          int var6 = ((CompositeView)this).getViewCount();
  38.          int var7 = var4.y + var4.height;
  39.  
  40.          for(int var8 = 0; var8 < var6; ++var8) {
  41.             var5.setBounds(var3);
  42.             ((BoxView)this).childAllocation(var8, var5);
  43.             if (var5.y >= var7) {
  44.                break;
  45.             }
  46.  
  47.             if (var5.y + var5.height >= var4.y) {
  48.                this.listPainter.paint(var1, (float)var5.x, (float)var5.y, (float)var5.width, (float)var5.height, this, var8);
  49.             }
  50.          }
  51.       }
  52.  
  53.    }
  54.  
  55.    protected void paintChild(Graphics var1, Rectangle var2, int var3) {
  56.       this.listPainter.paint(var1, (float)var2.x, (float)var2.y, (float)var2.width, (float)var2.height, this, var3);
  57.       super.paintChild(var1, var2, var3);
  58.    }
  59. }
  60.