/[classpath]/classpath/javax/swing/plaf/basic/BasicTextUI.java
ViewVC logotype

Diff of /classpath/javax/swing/plaf/basic/BasicTextUI.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10.2.9 by gnu_andrew, Sun Aug 7 18:34:11 2005 UTC revision 1.10.2.10 by gnu_andrew, Sat Sep 10 15:31:52 2005 UTC
# Line 150  public abstract class BasicTextUI extend Line 150  public abstract class BasicTextUI extend
150      }      }
151    
152      /**      /**
153         * Indicates that the preferences of one of the child view has changed.
154         * This calls revalidate on the text component.
155         *
156         * @param view the child view which's preference has changed
157         * @param width <code>true</code> if the width preference has changed
158         * @param height <code>true</code> if the height preference has changed
159         */
160        public void preferenceChanged(View view, boolean width, boolean height)
161        {
162          textComponent.revalidate();
163        }
164    
165        /**
166       * Sets the real root view.       * Sets the real root view.
167       *       *
168       * @param v the root view to set       * @param v the root view to set
# Line 157  public abstract class BasicTextUI extend Line 170  public abstract class BasicTextUI extend
170      public void setView(View v)      public void setView(View v)
171      {      {
172        if (view != null)        if (view != null)
173          view.setParent(null);          view.setParent(null);
174                
175        if (v != null)        if (v != null)
176          v.setParent(this);          v.setParent(null);
177    
178        view = v;        view = v;
179      }      }
180    
181      /**      /**
182         * Returns the real root view, regardless of the index.
183         *
184         * @param index not used here
185         *
186         * @return the real root view, regardless of the index.
187         */
188        public View getView(int index)
189        {
190          return view;
191        }
192    
193        /**
194         * Returns <code>1</code> since the RootView always contains one
195         * child, that is the real root of the View hierarchy.
196         *
197         * @return <code>1</code> since the RootView always contains one
198         *         child, that is the real root of the View hierarchy
199         */
200        public int getViewCount()
201        {
202          if (view != null)
203            return 1;
204          else
205            return 0;
206        }
207    
208        /**
209       * Returns the <code>Container</code> that contains this view. This       * Returns the <code>Container</code> that contains this view. This
210       * normally will be the text component that is managed by this TextUI.       * normally will be the text component that is managed by this TextUI.
211       *       *
# Line 244  public abstract class BasicTextUI extend Line 284  public abstract class BasicTextUI extend
284       * @return the position in the document that corresponds to the screen       * @return the position in the document that corresponds to the screen
285       *         coordinates <code>x, y</code>       *         coordinates <code>x, y</code>
286       */       */
287      public int viewToModel(float x, float y, Shape a, Position.Bias b)      public int viewToModel(float x, float y, Shape a, Position.Bias[] b)
288      {      {
289        return view.viewToModel(x, y, a, b);        return view.viewToModel(x, y, a, b);
290      }      }
# Line 326  public abstract class BasicTextUI extend Line 366  public abstract class BasicTextUI extend
366      {      {
367        Dimension size = textComponent.getSize();        Dimension size = textComponent.getSize();
368        rootView.changedUpdate(ev, new Rectangle(0, 0, size.width, size.height),        rootView.changedUpdate(ev, new Rectangle(0, 0, size.width, size.height),
369                               BasicTextUI.this);                               rootView.getViewFactory());
370      }      }
371            
372      /**      /**
# Line 338  public abstract class BasicTextUI extend Line 378  public abstract class BasicTextUI extend
378      {      {
379        Dimension size = textComponent.getSize();        Dimension size = textComponent.getSize();
380        rootView.insertUpdate(ev, new Rectangle(0, 0, size.width, size.height),        rootView.insertUpdate(ev, new Rectangle(0, 0, size.width, size.height),
381                              BasicTextUI.this);                              rootView.getViewFactory());
382        int caretPos = textComponent.getCaretPosition();        int caretPos = textComponent.getCaretPosition();
383        if (caretPos >= ev.getOffset())        if (caretPos >= ev.getOffset())
384          textComponent.setCaretPosition(caretPos + ev.getLength());          textComponent.setCaretPosition(caretPos + ev.getLength());
# Line 353  public abstract class BasicTextUI extend Line 393  public abstract class BasicTextUI extend
393      {      {
394        Dimension size = textComponent.getSize();        Dimension size = textComponent.getSize();
395        rootView.removeUpdate(ev, new Rectangle(0, 0, size.width, size.height),        rootView.removeUpdate(ev, new Rectangle(0, 0, size.width, size.height),
396                              BasicTextUI.this);                              rootView.getViewFactory());
397        int caretPos = textComponent.getCaretPosition();        int caretPos = textComponent.getCaretPosition();
398        if (caretPos >= ev.getOffset())        if (caretPos >= ev.getOffset())
399          textComponent.setCaretPosition(ev.getOffset());          textComponent.setCaretPosition(ev.getOffset());
# Line 979  public abstract class BasicTextUI extend Line 1019  public abstract class BasicTextUI extend
1019    protected final void setView(View view)    protected final void setView(View view)
1020    {    {
1021      rootView.setView(view);      rootView.setView(view);
1022        view.setParent(rootView);
1023    }    }
1024    
1025    /**    /**
# Line 999  public abstract class BasicTextUI extend Line 1040  public abstract class BasicTextUI extend
1040      Element elem = doc.getDefaultRootElement();      Element elem = doc.getDefaultRootElement();
1041      if (elem == null)      if (elem == null)
1042        return;        return;
1043      setView(factory.create(elem));      View view = factory.create(elem);
1044        setView(view);
1045    }    }
1046  }  }

Legend:
Removed from v.1.10.2.9  
changed lines
  Added in v.1.10.2.10

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26