/[classpath]/classpath/javax/swing/text/BoxView.java
ViewVC logotype

Diff of /classpath/javax/swing/text/BoxView.java

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

revision 1.2.2.5 by gnu_andrew, Wed Nov 2 00:44:02 2005 UTC revision 1.2.2.6 by gnu_andrew, Sun Nov 27 21:00:42 2005 UTC
# Line 307  public class BoxView Line 307  public class BoxView
307        {        {
308          copy.setBounds(inside);          copy.setBounds(inside);
309          childAllocation(i, copy);          childAllocation(i, copy);
310          if (!copy.isEmpty())          if (!copy.isEmpty()
311                && g.hitClip(copy.x, copy.y, copy.width, copy.height))
312            paintChild(g, copy, i);            paintChild(g, copy, i);
313        }        }
314    }    }
# Line 475  public class BoxView Line 476  public class BoxView
476    protected View getViewAtPoint(int x, int y, Rectangle r)    protected View getViewAtPoint(int x, int y, Rectangle r)
477    {    {
478      View result = null;      View result = null;
   
479      int count = getViewCount();      int count = getViewCount();
480      Rectangle copy = new Rectangle(r);      Rectangle copy = new Rectangle(r);
481    
# Line 489  public class BoxView Line 489  public class BoxView
489              break;              break;
490            }            }
491        }        }
492        
493        if (result == null && count > 0)
494          return getView(count - 1);
495      return result;      return result;
496    }    }
497    
# Line 497  public class BoxView Line 499  public class BoxView
499     * Computes the allocation for a child <code>View</code>. The parameter     * Computes the allocation for a child <code>View</code>. The parameter
500     * <code>a</code> stores the allocation of this <code>CompositeView</code>     * <code>a</code> stores the allocation of this <code>CompositeView</code>
501     * and is then adjusted to hold the allocation of the child view.     * and is then adjusted to hold the allocation of the child view.
502     *     *
503     * @param index the index of the child <code>View</code>     * @param index
504     * @param a the allocation of this <code>CompositeView</code> before the     *          the index of the child <code>View</code>
505     *        call, the allocation of the child on exit     * @param a
506       *          the allocation of this <code>CompositeView</code> before the
507       *          call, the allocation of the child on exit
508     */     */
509    protected void childAllocation(int index, Rectangle a)    protected void childAllocation(int index, Rectangle a)
510    {    {
# Line 736  public class BoxView Line 740  public class BoxView
740        yLayoutValid = false;        yLayoutValid = false;
741      super.preferenceChanged(child, width, height);      super.preferenceChanged(child, width, height);
742    }    }
743      
744      /**
745       * Maps the document model position <code>pos</code> to a Shape
746       * in the view coordinate space.  This method overrides CompositeView's
747       * method to make sure the children are allocated properly before
748       * calling the super's behaviour.
749       */
750      public Shape modelToView(int pos, Shape a, Position.Bias bias)
751          throws BadLocationException
752      {
753        // Make sure everything is allocated properly and then call super
754        if (!isAllocationValid())
755          {
756            Rectangle bounds = a.getBounds();
757            setSize(bounds.width, bounds.height);
758          }
759        return super.modelToView(pos, a, bias);
760      }
761  }  }

Legend:
Removed from v.1.2.2.5  
changed lines
  Added in v.1.2.2.6

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