pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roger L. Whitcomb" <Roger.Whitc...@ingres.com>
Subject RE: Update TabData - supposed to call listeners manually?
Date Tue, 14 Jun 2011 21:14:47 GMT
I had this same issue and ended up creating a new object every time. 

But, what if "setTabData" just checked for !equals()?  And then have
ButtonData implement "equals()" with "equals()" checks on the text, icon
and userData?  The "equals()" for "text" (String) does the right thing,
icon (Image) just does reference equality, as does the default for
"userData" (often null anyway).

But, having "setTabData" always do the notify might not be a bad thing,
although you might have to weigh the probability that the objects really
are the same vs. the cost of doing an unnecessary repaint.

Roger Whitcomb | Architect, Engineering | Roger.Whitcomb@ingres.com |
Ingres | 500 Arguello Street | Suite 200 | Redwood City | CA | 94063 |
USA  +1 650-587-5596 | fax: +1 650-587-5550

-----Original Message-----
From: Edvin Syse [mailto:edvin@sysedata.no] 
Sent: Tuesday, June 14, 2011 2:05 PM
To: user@pivot.apache.org
Subject: Re: Update TabData - supposed to call listeners manually?

Den 14.06.2011 23:01, skrev Greg Brown:
> b) A logical equality check may simply be unnecessary overhead. If a
caller has explicitly invoked a setter for a property, we might
reasonably assume that the caller genuinely wants to update the
property's value. Calling an equals() method on the value in that case
just incurs a needless performance hit.
> What do you think?

That's exactly my though! "If you called it, you probably meant it." And

the equals check is unnecessary overhead as you say :)

-- Edvin

View raw message