classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cp-patches]: Patch: JTree fix


From: Lillian Angel
Subject: Re: [cp-patches]: Patch: JTree fix
Date: Thu, 13 Oct 2005 12:09:21 -0400

Fixed more NPEs. It appears that after the latest painting fixes,
editing does not paint properly :( I will look into this.\



2005-10-13  Lillian Angel  <address@hidden>

        * javax/swing/plaf/basic/BasicTreeUI.java
        (getPreferredSize): Added check to prevent NPE.
        (mousePressed): Likewise.
        (paintRecursive): Likewise.
        (paintExpandedControlIcons): Likewise.
        (paintRow): Fixed painting location of textarea.


On Thu, 2005-10-13 at 10:17 -0400, Lillian Angel wrote:
> Sorry about that. I fixed this.
> Also, it seemed that the width was not being calculated properly, so the
> labels were cut off. I fixed this too.
> 
> 
> 2005-10-13  Lillian Angel  <address@hidden>
> 
>         * javax/swing/plaf/basic/BasicTreeUI.java
>         (getPathForRow): Added check to prevent NPE.
>         (getRowCount): Likewise.
>         (getRowForPath): Likewise.
>         (getPreferredSize): Adjusted width depending on x location and
>         icon.
>         (paintRecursive): Likewise.
>         (getPreviousNode): Added check to prevent NPE.
>         (getNextVisibleNode): Likewise.
> 
> 
> On Wed, 2005-10-12 at 23:10 +0200, Mark Wielaard wrote:
> > Hi Lillian,
> > 
> > On Wed, 2005-10-05 at 17:28 -0400, Lillian Angel wrote:
> > > Fixed up BasicTreeUI because it was not efficent when painting.
> > > 
> > > 2005-10-05  Lillian Angel  <address@hidden>
> > > 
> > >         * javax/swing/plaf/metal/MetalTreeUI.java
> > >         (installUI): Fixed to call toggleExpandState instead.
> > >         * javax/swing/plaf/basic/BasicTreeUI.java
> > >         (getPathForRow): Used currentVisiblePath to get Path.
> > >         (getRowForPath): Used currentVisiblePath to get row.
> > >         (getRowCount): Returned currentVisiblePath length.
> > >         (updateLayoutCacheExpandedNodes): Took out unneeded code.
> > >         (installUI): Fixed to call toggleExpandState instead.
> > >         (getPreferredSize): Made more efficent by using 
> > >   currentVisiblePath.
> > >         (toggleExpandState): Called updateCurrentVisiblePath.
> > >         (getCellLocation): Made more efficent.
> > >         (paintNode): Removed.
> > >         (paintRecursive): Made more efficent, changed paintNode calls to
> > >         paintRow.
> > >         (getNextVisibleNode): Reimplemented to use currentVisiblePath.
> > >         (getPreviousVisibleNode): Likewise.
> > >         (paintRow): Implemented.
> > >         (updateCurrentVisiblePath): New helper used to cache the current
> > >         visible path.
> > 
> > This broke junit for me (see stack trace below). The problem is that
> > newly introduces currentVisiblePath field can be NULL, but is used in
> > various places without checking whether or not it is NUll.
> > 
> > java.lang.NullPointerException
> >    at javax.swing.plaf.basic.BasicTreeUI.getPreferredSize 
> > (BasicTreeUI.java:1474)
> >    at javax.swing.plaf.basic.BasicTreeUI.getPreferredSize 
> > (BasicTreeUI.java:1457)
> >    at javax.swing.JComponent.getPreferredSize (JComponent.java:1083)
> >    at javax.swing.JViewport.getViewSize (JViewport.java:297)
> >    at javax.swing.plaf.basic.BasicScrollPaneUI.syncScrollPaneWithViewport 
> > (BasicScrollPaneUI.java:434)
> >    at 
> > javax.swing.plaf.basic.BasicScrollPaneUI$ViewportChangeHandler.stateChanged 
> > (BasicScrollPaneUI.java:160)
> >    at javax.swing.JViewport.fireStateChanged (JViewport.java:623)
> >    at javax.swing.JViewport.revalidate (JViewport.java:422)
> >    at javax.swing.JComponent$1.run (JComponent.java:2111)
> >    at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:191)
> >    at java.awt.EventQueue.dispatchEvent (EventQueue.java:465)
> >    at java.awt.EventDispatchThread.run (EventDispatchThread.java:75)
> > 
> _______________________________________________
> Classpath-patches mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/classpath-patches

Attachment: patch.diff
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]