home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 March / pcp161a.iso / handson / files / copyjava.exe / com / sun / java / swing / text / DefaultTextUI$RootView.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-02-26  |  3.8 KB  |  139 lines

  1. package com.sun.java.swing.text;
  2.  
  3. import com.sun.java.swing.event.DocumentEvent;
  4. import java.awt.Container;
  5. import java.awt.Graphics;
  6. import java.awt.Rectangle;
  7. import java.awt.Shape;
  8.  
  9. class DefaultTextUI$RootView extends View {
  10.    // $FF: synthetic field
  11.    private final DefaultTextUI this$0;
  12.    private View view;
  13.  
  14.    DefaultTextUI$RootView(DefaultTextUI var1) {
  15.       super((Element)null);
  16.       this.this$0 = var1;
  17.       this.this$0 = var1;
  18.    }
  19.  
  20.    void setView(View var1) {
  21.       if (this.view != null) {
  22.          this.view.setParent((View)null);
  23.       }
  24.  
  25.       this.view = var1;
  26.       if (this.view != null) {
  27.          this.view.setParent(this);
  28.       }
  29.  
  30.    }
  31.  
  32.    public float getPreferredSpan(int var1) {
  33.       return this.view != null ? this.view.getPreferredSpan(var1) : 10.0F;
  34.    }
  35.  
  36.    public void preferenceChanged(View var1, boolean var2, boolean var3) {
  37.       this.this$0.editor.revalidate();
  38.    }
  39.  
  40.    public float getAlignment(int var1) {
  41.       return this.view != null ? this.view.getAlignment(var1) : 0.0F;
  42.    }
  43.  
  44.    public void paint(Graphics var1, Shape var2) {
  45.       if (this.view != null) {
  46.          Rectangle var3 = var2.getBounds();
  47.          this.view.setSize((float)var3.width, (float)var3.height);
  48.          this.view.paint(var1, var2);
  49.       }
  50.  
  51.    }
  52.  
  53.    public void setParent(View var1) {
  54.       throw new StateInvariantError("Can't set parent on root view");
  55.    }
  56.  
  57.    public int getViewCount() {
  58.       return 1;
  59.    }
  60.  
  61.    public View getView(int var1) {
  62.       return this.view;
  63.    }
  64.  
  65.    public Shape getChildAllocation(int var1, Shape var2) {
  66.       return var2;
  67.    }
  68.  
  69.    public Shape modelToView(int var1, Shape var2) throws BadLocationException {
  70.       return this.view != null ? this.view.modelToView(var1, var2) : null;
  71.    }
  72.  
  73.    public int viewToModel(float var1, float var2, Shape var3) {
  74.       return this.view != null ? this.view.viewToModel(var1, var2, var3) : -1;
  75.    }
  76.  
  77.    public void insertUpdate(DocumentEvent var1, Shape var2, ViewFactory var3) {
  78.       if (this.view != null) {
  79.          this.view.insertUpdate(var1, var2, var3);
  80.       }
  81.  
  82.    }
  83.  
  84.    public void removeUpdate(DocumentEvent var1, Shape var2, ViewFactory var3) {
  85.       if (this.view != null) {
  86.          this.view.removeUpdate(var1, var2, var3);
  87.       }
  88.  
  89.    }
  90.  
  91.    public void changedUpdate(DocumentEvent var1, Shape var2, ViewFactory var3) {
  92.       if (this.view != null) {
  93.          this.view.changedUpdate(var1, var2, var3);
  94.       }
  95.  
  96.    }
  97.  
  98.    public Document getDocument() {
  99.       return this.this$0.editor.getDocument();
  100.    }
  101.  
  102.    public int getStartOffset() {
  103.       return this.view != null ? this.view.getStartOffset() : this.getElement().getStartOffset();
  104.    }
  105.  
  106.    public int getEndOffset() {
  107.       return this.view != null ? this.view.getEndOffset() : this.getElement().getEndOffset();
  108.    }
  109.  
  110.    public Element getElement() {
  111.       return this.view != null ? this.view.getElement() : this.this$0.editor.getDocument().getDefaultRootElement();
  112.    }
  113.  
  114.    public View breakView(int var1, float var2, Shape var3) {
  115.       throw new StateInvariantError("Can't break root view");
  116.    }
  117.  
  118.    public int getResizeWeight(int var1) {
  119.       return this.view != null ? this.view.getResizeWeight(var1) : 0;
  120.    }
  121.  
  122.    public void setSize(float var1, float var2) {
  123.       if (this.view != null) {
  124.          this.view.setSize(var1, var2);
  125.       }
  126.  
  127.    }
  128.  
  129.    public Container getContainer() {
  130.       return this.this$0.editor;
  131.    }
  132.  
  133.    public ViewFactory getViewFactory() {
  134.       EditorKit var1 = this.this$0.getEditorKit();
  135.       ViewFactory var2 = var1.getViewFactory();
  136.       return (ViewFactory)(var2 != null ? var2 : this.this$0);
  137.    }
  138. }
  139.