Calculations.count notfies its listeners on each change of the list during a GlazedLists.replaceAllSorted

View: New views
6 Messages — Rating Filter:   Alert me  

Calculations.count notfies its listeners on each change of the list during a GlazedLists.replaceAllSorted

by philk :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have a count calclualtion on my source even list.
If I refill the list (in a Master/Details scenario) the counter is changed for each addition. On change of the counter I refresh the number of items in my title bar. The fact the the counters change event is called for each change results in an ever increasing/decreasing counter which.
I was thinking about removing the listener during the adding process. Or is there a more elegant way to do that?

re: Calculations.count notfies its listeners on each change of the list during a GlazedLists.replaceAllSorted

by Kevin Day-7 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
I kind of like watching the counter go up and down :-)
 
Some random thoughts:
 
While dropping and adding the PCL would work, it doesn't feel like the right solution to me.
 
One way to do this would be to wrap the calculation in another calculation that incorporates a delayed firing mechanism, or one that fires the change from a different thread.  If firing from a different thread, have the calculation grab a read lock on the source list to obtain the value.  This should block until the list updates are all complete.
 
I'm kind of thinking of something along the lines of:
 
Calculations.waitUntilPipelineUnlocks(Calculation source, ReadLock lock)
 
something like that??
 
Any other thoughts out there in GL land?
 
- K
----------------------- Original Message -----------------------
  
From: philk phil.kursawe@...
Cc: 
Date: Thu, 25 Jun 2009 06:25:31 -0700 (PDT)
Subject: Calculations.count notfies its listeners on each change of the list during a GlazedLists.replaceAllSorted
  

I have a count calclualtion on my source even list.
If I refill the list (in a Master/Details scenario) the counter is changed
for each addition. On change of the counter I refresh the number of items in
my title bar. The fact the the counters change event is called for each
change results in an ever increasing/decreasing counter which.
I was thinking about removing the listener during the adding process. Or is
there a more elegant way to do that?
--
View this message in context: http://www.nabble.com/Calculations.count-notfies-its-listeners-on-each-change-of-the-list-during-a-GlazedLists.replaceAllSorted-tp24203222p24203222.html
Sent from the GlazedLists - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@...

Re: Calculations.count notfies its listeners on each change of the list during a GlazedLists.replaceAllSorted

by Sam Berlin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

One trick we've done occasionally when we know that things are going to change very frequently in tables is to not make all lists observable for all bean properties.  Instead, we listen for specific changes and set a javax.swing.Timer to trigger a repaint in a few milliseconds in response to a list-changed (or other) event.  The Timer isn't set to repeat.  Multiple list-change (or other) events just coalesce into a single Timer trigger, which causes a single repaint (which in turn causes the table to re-render visible items, getting the most recent values).

It's not pretty, but it works wonders.

Sam

On Thu, Jun 25, 2009 at 2:04 PM, Kevin Day <kevin@...> wrote:
I kind of like watching the counter go up and down :-)
 
Some random thoughts:
 
While dropping and adding the PCL would work, it doesn't feel like the right solution to me.
 
One way to do this would be to wrap the calculation in another calculation that incorporates a delayed firing mechanism, or one that fires the change from a different thread.  If firing from a different thread, have the calculation grab a read lock on the source list to obtain the value.  This should block until the list updates are all complete.
 
I'm kind of thinking of something along the lines of:
 
Calculations.waitUntilPipelineUnlocks(Calculation source, ReadLock lock)
 
something like that??
 
Any other thoughts out there in GL land?
 
- K
----------------------- Original Message -----------------------
  
From: philk phil.kursawe@...
Cc: 
Date: Thu, 25 Jun 2009 06:25:31 -0700 (PDT)
Subject: Calculations.count notfies its listeners on each change of the list during a GlazedLists.replaceAllSorted
  

I have a count calclualtion on my source even list.
If I refill the list (in a Master/Details scenario) the counter is changed
for each addition. On change of the counter I refresh the number of items in
my title bar. The fact the the counters change event is called for each
change results in an ever increasing/decreasing counter which.
I was thinking about removing the listener during the adding process. Or is
there a more elegant way to do that?
--
View this message in context: http://www.nabble.com/Calculations.count-notfies-its-listeners-on-each-change-of-the-list-during-a-GlazedLists.replaceAllSorted-tp24203222p24203222.html
Sent from the GlazedLists - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@...


re: Calculations.count notfies its listeners on each change of the list during a GlazedLists.replaceAllSorted

by Kevin Day-7 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Another option here would be to use a freezable list, but that seems like overkill for this particular behavior.
 
- K
 
----------------------- Original Message -----------------------
  
From: philk phil.kursawe@...
Cc: 
Date: Thu, 25 Jun 2009 06:25:31 -0700 (PDT)
Subject: Calculations.count notfies its listeners on each change of the list during a GlazedLists.replaceAllSorted
  

I have a count calclualtion on my source even list.
If I refill the list (in a Master/Details scenario) the counter is changed
for each addition. On change of the counter I refresh the number of items in
my title bar. The fact the the counters change event is called for each
change results in an ever increasing/decreasing counter which.
I was thinking about removing the listener during the adding process. Or is
there a more elegant way to do that?
--
View this message in context: http://www.nabble.com/Calculations.count-notfies-its-listeners-on-each-change-of-the-list-during-a-GlazedLists.replaceAllSorted-tp24203222p24203222.html
Sent from the GlazedLists - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@...

Re: re: Calculations.count notfies its listeners on each change of the list during a GlazedLists.replaceAllSorted

by philk :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Spawning the counter on a new thread sounds like overkill to me too. I was under the impression that when I have a write lock in the source list, the counter would not be notified? Any thoughts about that by the creators or GL?

Thanks guys for providing some solutions.

Kevin Day wrote:





Another option here would be to use a freezable list, but that seems like overkill for this particular behavior.
 
- K
 

----------------------- Original Message -----------------------
  
From: philk <phil.kursawe@gmail.com>
To:  users@glazedlists.dev.java.net
Cc: 
Date: Thu, 25 Jun 2009 06:25:31 -0700 (PDT)
Subject: Calculations.count notfies its listeners on each change of the list during a GlazedLists.replaceAllSorted
  
I have a count calclualtion on my source even list. If I refill the list (in a Master/Details scenario) the counter is changed for each addition. On change of the counter I refresh the number of items in my title bar. The fact the the counters change event is called for each change results in an ever increasing/decreasing counter which. I was thinking about removing the listener during the adding process. Or is there a more elegant way to do that? -- View this message in context: http://www.nabble.com/Calculations.count-notfies-its-listeners-on-each-change-of-the-list-during-a-GlazedLists.replaceAllSorted-tp24203222p24203222.html Sent from the GlazedLists - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@glazedlists.dev.java.net For additional commands, e-mail: users-help@glazedlists.dev.java.net


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glazedlists.dev.java.net
For additional commands, e-mail: users-help@glazedlists.dev.java.net

re[3]: Calculations.count notfies its listeners on each change of the list during a GlazedLists.replaceAllSorted

by Kevin Day-7 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
I could be wrong here, but I'm pretty sure that the calculation receives it's notification as part of the event pipeline processing, which means that the event would arrive on the thread that initiated the list change (so locks don't really come into play).  Instead of hitting a totally new thread, I was thinking more along the lines of SWT's equivalent of the event dispatch thread...  (more along the line of the Timer suggestion posted earlier today).
 
Or toss a transaction or freezable list at it...
 
The thing is, these are 'live' lists, so the primary use-case would involve the calculations updating as the lists change...
 
- K
 
----------------------- Original Message -----------------------
  
From: philk phil.kursawe@...
Cc: 
Date: Thu, 25 Jun 2009 12:00:17 -0700 (PDT)
Subject: Re: re: Calculations.count notfies its listeners on each change of the list during a GlazedLists.replaceAllSorted
  

Spawning the counter on a new thread sounds like overkill to me too. I was
under the impression that when I have a write lock in the source list, the
counter would not be notified? Any thoughts about that by the creators or
GL?

Thanks guys for providing some solutions.


Kevin Day wrote:

>
>
>
>
>
>
>
> Another option here would be to use a freezable list, but that seems like
> overkill for this particular behavior.
> &nbsp;
> - K
> &nbsp;
>
> ----------------------- Original Message -----------------------
> &nbsp;&nbsp;
> From:&nbsp;philk
> To:&nbsp;
users@...
> Cc:&nbsp;
> Date:&nbsp;Thu, 25 Jun 2009 06:25:31 -0700 (PDT)
> Subject:&nbsp;Calculations.count notfies its listeners on each change of
> the list during a GlazedLists.replaceAllSorted
> &nbsp;&nbsp;
> I have a count calclualtion on my source even list. If I refill the list
> (in a Master/Details scenario) the counter is changed for each addition.
> On change of the counter I refresh the number of items in my title bar.
> The fact the the counters change event is called for each change results
> in an ever increasing/decreasing counter which. I was thinking about
> removing the listener during the adding process. Or is there a more
> elegant way to do that? -- View this message in context:
> http://www.nabble.com/Calculations.count-notfies-its-listeners-on-each-change-of-the-list-during-a-GlazedLists.replaceAllSorted-tp24203222p24203222.html
> Sent from the GlazedLists - User mailing list archive at Nabble.com.
> --------------------------------------------------------------------- To
> unsubscribe, e-mail: users-unsubscribe@... For
> additional commands, e-mail: users-help@...
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>
>

--
View this message in context: http://www.nabble.com/Calculations.count-notfies-its-listeners-on-each-change-of-the-list-during-a-GlazedLists.replaceAllSorted-tp24203222p24209214.html
Sent from the GlazedLists - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@...