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 / BasicTextUI$RootView.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  3.9 KB  |  184 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.event.DocumentEvent;
  8. import javax.swing.text.AttributeSet;
  9. import javax.swing.text.BadLocationException;
  10. import javax.swing.text.Document;
  11. import javax.swing.text.EditorKit;
  12. import javax.swing.text.Element;
  13. import javax.swing.text.Position;
  14. import javax.swing.text.View;
  15. import javax.swing.text.ViewFactory;
  16.  
  17. class BasicTextUI$RootView extends View {
  18.    private View view;
  19.    // $FF: synthetic field
  20.    private final BasicTextUI this$0;
  21.  
  22.    BasicTextUI$RootView(BasicTextUI var1) {
  23.       super((Element)null);
  24.       this.this$0 = var1;
  25.    }
  26.  
  27.    void setView(View var1) {
  28.       if (this.view != null) {
  29.          this.view.setParent((View)null);
  30.       }
  31.  
  32.       this.view = var1;
  33.       if (this.view != null) {
  34.          this.view.setParent(this);
  35.       }
  36.  
  37.    }
  38.  
  39.    public AttributeSet getAttributes() {
  40.       return null;
  41.    }
  42.  
  43.    public float getPreferredSpan(int var1) {
  44.       return this.view != null ? this.view.getPreferredSpan(var1) : 10.0F;
  45.    }
  46.  
  47.    public float getMinimumSpan(int var1) {
  48.       return this.view != null ? this.view.getMinimumSpan(var1) : 10.0F;
  49.    }
  50.  
  51.    public float getMaximumSpan(int var1) {
  52.       return (float)Integer.MAX_VALUE;
  53.    }
  54.  
  55.    public void preferenceChanged(View var1, boolean var2, boolean var3) {
  56.       this.this$0.editor.revalidate();
  57.    }
  58.  
  59.    public float getAlignment(int var1) {
  60.       return this.view != null ? this.view.getAlignment(var1) : 0.0F;
  61.    }
  62.  
  63.    public void paint(Graphics var1, Shape var2) {
  64.       if (this.view != null) {
  65.          Rectangle var3 = var2 instanceof Rectangle ? (Rectangle)var2 : var2.getBounds();
  66.          this.view.setSize((float)var3.width, (float)var3.height);
  67.          this.view.paint(var1, var2);
  68.       }
  69.  
  70.    }
  71.  
  72.    public void setParent(View var1) {
  73.       throw new Error("Can't set parent on root view");
  74.    }
  75.  
  76.    public int getViewCount() {
  77.       return 1;
  78.    }
  79.  
  80.    public View getView(int var1) {
  81.       return this.view;
  82.    }
  83.  
  84.    public int getViewIndex(int var1, Position.Bias var2) {
  85.       return 0;
  86.    }
  87.  
  88.    public Shape getChildAllocation(int var1, Shape var2) {
  89.       return var2;
  90.    }
  91.  
  92.    public Shape modelToView(int var1, Shape var2, Position.Bias var3) throws BadLocationException {
  93.       return this.view != null ? this.view.modelToView(var1, var2, var3) : null;
  94.    }
  95.  
  96.    public Shape modelToView(int var1, Position.Bias var2, int var3, Position.Bias var4, Shape var5) throws BadLocationException {
  97.       return this.view != null ? this.view.modelToView(var1, var2, var3, var4, var5) : null;
  98.    }
  99.  
  100.    public int viewToModel(float var1, float var2, Shape var3, Position.Bias[] var4) {
  101.       if (this.view != null) {
  102.          int var5 = this.view.viewToModel(var1, var2, var3, var4);
  103.          return var5;
  104.       } else {
  105.          return -1;
  106.       }
  107.    }
  108.  
  109.    public int getNextVisualPositionFrom(int var1, Position.Bias var2, Shape var3, int var4, Position.Bias[] var5) throws BadLocationException {
  110.       if (this.view != null) {
  111.          int var6 = this.view.getNextVisualPositionFrom(var1, var2, var3, var4, var5);
  112.          if (var6 != -1) {
  113.             var1 = var6;
  114.          } else {
  115.             var5[0] = var2;
  116.          }
  117.       }
  118.  
  119.       return var1;
  120.    }
  121.  
  122.    public void insertUpdate(DocumentEvent var1, Shape var2, ViewFactory var3) {
  123.       if (this.view != null) {
  124.          this.view.insertUpdate(var1, var2, var3);
  125.       }
  126.  
  127.    }
  128.  
  129.    public void removeUpdate(DocumentEvent var1, Shape var2, ViewFactory var3) {
  130.       if (this.view != null) {
  131.          this.view.removeUpdate(var1, var2, var3);
  132.       }
  133.  
  134.    }
  135.  
  136.    public void changedUpdate(DocumentEvent var1, Shape var2, ViewFactory var3) {
  137.       if (this.view != null) {
  138.          this.view.changedUpdate(var1, var2, var3);
  139.       }
  140.  
  141.    }
  142.  
  143.    public Document getDocument() {
  144.       return this.this$0.editor.getDocument();
  145.    }
  146.  
  147.    public int getStartOffset() {
  148.       return this.view != null ? this.view.getStartOffset() : this.getElement().getStartOffset();
  149.    }
  150.  
  151.    public int getEndOffset() {
  152.       return this.view != null ? this.view.getEndOffset() : this.getElement().getEndOffset();
  153.    }
  154.  
  155.    public Element getElement() {
  156.       return this.view != null ? this.view.getElement() : this.this$0.editor.getDocument().getDefaultRootElement();
  157.    }
  158.  
  159.    public View breakView(int var1, float var2, Shape var3) {
  160.       throw new Error("Can't break root view");
  161.    }
  162.  
  163.    public int getResizeWeight(int var1) {
  164.       return this.view != null ? this.view.getResizeWeight(var1) : 0;
  165.    }
  166.  
  167.    public void setSize(float var1, float var2) {
  168.       if (this.view != null) {
  169.          this.view.setSize(var1, var2);
  170.       }
  171.  
  172.    }
  173.  
  174.    public Container getContainer() {
  175.       return this.this$0.editor;
  176.    }
  177.  
  178.    public ViewFactory getViewFactory() {
  179.       EditorKit var1 = this.this$0.getEditorKit(this.this$0.editor);
  180.       ViewFactory var2 = var1.getViewFactory();
  181.       return (ViewFactory)(var2 != null ? var2 : this.this$0);
  182.    }
  183. }
  184.