home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &… the Search for Life CD 3 / 0_CD-ROM.iso / install / jre1_3 / lib / rt.jar / javax / swing / plaf / basic / BasicHTML$Renderer.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  2.7 KB  |  115 lines

  1. package javax.swing.plaf.basic;
  2.  
  3. import java.awt.Container;
  4. import java.awt.Graphics;
  5. import java.awt.Rectangle;
  6. import java.awt.Shape;
  7. import javax.swing.JComponent;
  8. import javax.swing.text.AttributeSet;
  9. import javax.swing.text.BadLocationException;
  10. import javax.swing.text.Document;
  11. import javax.swing.text.Element;
  12. import javax.swing.text.Position;
  13. import javax.swing.text.View;
  14. import javax.swing.text.ViewFactory;
  15.  
  16. class BasicHTML$Renderer extends View {
  17.    private int width;
  18.    private View view;
  19.    private ViewFactory factory;
  20.    private JComponent host;
  21.  
  22.    BasicHTML$Renderer(JComponent var1, ViewFactory var2, View var3) {
  23.       super((Element)null);
  24.       this.host = var1;
  25.       this.factory = var2;
  26.       this.view = var3;
  27.       this.view.setParent(this);
  28.       this.setSize(this.view.getPreferredSpan(0), this.view.getPreferredSpan(1));
  29.    }
  30.  
  31.    public AttributeSet getAttributes() {
  32.       return null;
  33.    }
  34.  
  35.    public float getPreferredSpan(int var1) {
  36.       return var1 == 0 ? (float)this.width : this.view.getPreferredSpan(var1);
  37.    }
  38.  
  39.    public float getMinimumSpan(int var1) {
  40.       return this.view.getMinimumSpan(var1);
  41.    }
  42.  
  43.    public float getMaximumSpan(int var1) {
  44.       return (float)Integer.MAX_VALUE;
  45.    }
  46.  
  47.    public void preferenceChanged(View var1, boolean var2, boolean var3) {
  48.       this.host.revalidate();
  49.       this.host.repaint();
  50.    }
  51.  
  52.    public float getAlignment(int var1) {
  53.       return this.view.getAlignment(var1);
  54.    }
  55.  
  56.    public void paint(Graphics var1, Shape var2) {
  57.       Rectangle var3 = var2.getBounds();
  58.       this.view.setSize((float)var3.width, (float)var3.height);
  59.       this.view.paint(var1, var2);
  60.    }
  61.  
  62.    public void setParent(View var1) {
  63.       throw new Error("Can't set parent on root view");
  64.    }
  65.  
  66.    public int getViewCount() {
  67.       return 1;
  68.    }
  69.  
  70.    public View getView(int var1) {
  71.       return this.view;
  72.    }
  73.  
  74.    public Shape modelToView(int var1, Shape var2, Position.Bias var3) throws BadLocationException {
  75.       return this.view.modelToView(var1, var2, var3);
  76.    }
  77.  
  78.    public Shape modelToView(int var1, Position.Bias var2, int var3, Position.Bias var4, Shape var5) throws BadLocationException {
  79.       return this.view.modelToView(var1, var2, var3, var4, var5);
  80.    }
  81.  
  82.    public int viewToModel(float var1, float var2, Shape var3, Position.Bias[] var4) {
  83.       return this.view.viewToModel(var1, var2, var3, var4);
  84.    }
  85.  
  86.    public Document getDocument() {
  87.       return this.view.getDocument();
  88.    }
  89.  
  90.    public int getStartOffset() {
  91.       return this.view.getStartOffset();
  92.    }
  93.  
  94.    public int getEndOffset() {
  95.       return this.view.getEndOffset();
  96.    }
  97.  
  98.    public Element getElement() {
  99.       return this.view.getElement();
  100.    }
  101.  
  102.    public void setSize(float var1, float var2) {
  103.       this.width = (int)var1;
  104.       this.view.setSize(var1, var2);
  105.    }
  106.  
  107.    public Container getContainer() {
  108.       return this.host;
  109.    }
  110.  
  111.    public ViewFactory getViewFactory() {
  112.       return this.factory;
  113.    }
  114. }
  115.