|
Replies:
11
-
Last Post:
Jul 6, 2006 8:37 AM
by: janaudy
|
|
|
|
|
|
|
Flashing cells
Posted:
Jun 30, 2006 9:04 AM
|
|
|
Hi,
A long time ago, I posted this: http://forums.java.net/jive/thread.jspa?threadID=8010&messageID=56392#56392
I am still not sure what is the best way to implement this flashing behaviour. At the highlighter level or at the renderer?
Thinking of a financial application where you could have several dozens updates per second on the UI.
What do you guys think?
|
|
|
|
|
|
|
RE: Flashing cells
Posted:
Jun 30, 2006 9:12 AM
in response to: janaudy
|
|
|
My gut feeling is to use a renderer. Let us know what you end up using and why!
Richard
>I am still not sure what is the best way to implement this >flashing behaviour. At the highlighter level or at the renderer? > >Thinking of a financial application where you could have several dozens >updates per second on the UI. > >What do you guys think?
--------------------------------------------------------------------- To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net For additional commands, e-mail: jdnc-help@jdnc.dev.java.net
|
|
|
|
|
|
|
|
RE: Flashing cells
Posted:
Jun 30, 2006 9:16 AM
in response to: Richard Bair
|
|
|
Lemme clarify. The renderer is going to be reused for multiple cells, so you can't have logic in the renderer that actually flashes. What I mean by use the renderer is, let the renderer decide whether to show the text or not.
For example, you should have some other timer, separate from the table, highlighters, or renderers that alternates whether a cell is painted or not (causing the flashing). Have it call repaint on the table, passing the exact cell that needs to be repainted so that performance is decent. Let the renderer figure out whether the text should be shown or not (when the renderer is created, point it to some object that knows whether the text should be painted or not.
Richard
>My gut feeling is to use a renderer. Let us know what you end up using and >why! > >Richard > >>I am still not sure what is the best way to implement this >>flashing behaviour. At the highlighter level or at the renderer? >> >>Thinking of a financial application where you could have several dozens >>updates per second on the UI. >> >>What do you guys think? > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net >For additional commands, e-mail: jdnc-help@jdnc.dev.java.net >
--------------------------------------------------------------------- To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net For additional commands, e-mail: jdnc-help@jdnc.dev.java.net
|
|
|
|
|
|
|
|
Re: Flashing cells
Posted:
Jul 1, 2006 3:39 AM
in response to: Richard Bair
|
|
|
Richard Bair wrote:
> For example, you should have some other timer, separate from the table, > highlighters, or renderers that alternates whether a cell is painted or not > (causing the flashing).
huuuh? Flashing by not showing anything in one of the alternating states? Never seen such a drastic measure, I'd assume it would scare the hell out of users <g> My general rule is to never put too much weight into a renderer, it's there for rendering the given value, nothing else.
While I don't like flashing at all, it's usually done by alternating the colors which - in swingx context - is the responsibility of highlighters. I agree that performance might detoriate with high frequency repaints, so what's needed is a dedicated controller to decide when to start/stop yet another flashing. Everything more than one, two rhythms probably will drive users crazy.
We (mainly Patrick and me) had a nice discussion about rendering/decorating a couple of months ago:
http://forums.java.net/jive/thread.jspa?messageID=102458
slightly buried in a longer thread about a different topic . The relevant part (for this) starts when Patrick jumps in. There's some sample code for layered alert modes - involving f.i. color, font, and background "flashing".
Color fading sounds like an interesting idea. Hmm .. should check if that's possible via highlighters as well - probably would require a more focused notification from highlighters, though.
Cheers Jeanette
--------------------------------------------------------------------- To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net For additional commands, e-mail: jdnc-help@jdnc.dev.java.net
|
|
|
|
|
|
|
|
Re: Flashing cells
Posted:
Jun 30, 2006 9:18 AM
in response to: janaudy
|
|
|
I am sure could use the timing framework to change the background/foreground colors of the cell.
Just a thought, but you might want to consider a slightly subtler alert mechanism besides flashing cells - especially if there would be multiple cells flashing a lot on the screen. From an interaction design standpoint, 'flashing' is better suited to controls in the periphery, otherwise, you could have some usability issues.
Just my .02.
--Bill
On 6/30/06, jdnc-interest@javadesktop.org <jdnc-interest@javadesktop.org> wrote: > > Hi, > > A long time ago, I posted this: > http://forums.java.net/jive/thread.jspa?threadID=8010&messageID=56392#56392 > > > I am still not sure what is the best way to implement this > flashing behaviour. At the highlighter level or at the renderer? > > Thinking of a financial application where you could have several dozens > updates per second on the UI. > > What do you guys think? > [Message sent by forum member 'janaudy' (janaudy)] > > http://forums.java.net/jive/thread.jspa?messageID=128858 > > --------------------------------------------------------------------- > To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net > For additional commands, e-mail: jdnc-help@jdnc.dev.java.net > > [att1.html]
|
|
|
|
|
|
|
|
Re: Flashing cells
Posted:
Jun 30, 2006 9:26 AM
in response to: Bill Snyder
|
|
|
A somewhat less jarring "flashing" could be to fade in/ fade out. Colors have an alpha channel, so in theory he could animate the alpha channel using the timing framework, causing a nice fade effect on the color used to render the cell.
>I am sure could use the timing framework to change the >background/foreground >colors of the cell. > >Just a thought, but you might want to consider a slightly subtler alert >mechanism besides flashing cells - especially if there would be multiple >cells flashing a lot on the screen. From an interaction design standpoint, >'flashing' is better suited to controls in the periphery, otherwise, you >could have some usability issues. > >Just my .02. > >--Bill > > >On 6/30/06, jdnc-interest@javadesktop.org <jdnc-interest@javadesktop.org> >wrote: >> >>Hi, >> >>A long time ago, I posted this: >>http://forums.java.net/jive/thread.jspa?threadID=8010&messageID=56392#56392 >> >> >>I am still not sure what is the best way to implement this >>flashing behaviour. At the highlighter level or at the renderer? >> >>Thinking of a financial application where you could have several dozens >>updates per second on the UI. >> >>What do you guys think? >>[Message sent by forum member 'janaudy' (janaudy)] >> >>http://forums.java.net/jive/thread.jspa?messageID=128858 >> >>--------------------------------------------------------------------- >>To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net >>For additional commands, e-mail: jdnc-help@jdnc.dev.java.net >> >>
--------------------------------------------------------------------- To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net For additional commands, e-mail: jdnc-help@jdnc.dev.java.net
|
|
|
|
|
|
|
|
Re: Flashing cells
Posted:
Jul 5, 2006 6:58 AM
in response to: Richard Bair
|
|
|
A much less shocking flashing technique is to add a border to the cell renderer and then alternate using the cell background color and the cell foreground color.
If there are multiple cells and possibly other things on a window that need to flash they should all flash together and the rate should be at least 1 second on/off. Having multiple flash rates or a single rate that is faster can cause problems for some users especially those with vision issues and /or are prone to seisures(sp?).
|
|
|
|
|
|
|
|
Re: Flashing cells
Posted:
Jul 3, 2006 7:14 AM
in response to: janaudy
|
|
|
I would let the table model drive this using the timer framework. On the timer event or first cell state change, do fireTableCellUpdated. Then it is up to the table view to decide if a repaint is necessary. The renderer only uses the state of the data object (normal/inverted) to decide how to paint it.
|
|
|
|
|
|
|
|
|
|
Re: Flashing cells
Posted:
Jul 5, 2006 5:44 AM
in response to: janaudy
|
|
|
adding a forward link to a thread Patrick split-off:
http://forums.java.net/jive/thread.jspa?threadID=16572
> This seems simpler and more flexible: > > "Jazz Up Your JTables with Reusable Classes" > http://www.devx.com/DevX/10MinuteSolution/17167/0/page/4 >
ehh ... simpler and more flexible relative to what? You can't mean SwingX - because SwingX does all the work for you behind the scenes. Plus it does so much more flexible than the fixed, per-component-type DecoratingRenderer <--> DecorationProvider couple advocated in the article.
Cheers Jeanette
--------------------------------------------------------------------- To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net For additional commands, e-mail: jdnc-help@jdnc.dev.java.net
|
|
|
|
|
|
|
|
Re: Flashing cells
Posted:
Jul 5, 2006 9:48 AM
in response to: janaudy
|
|
|
Myself and former colleagues have done exactly what you're looking to do for exactly the same reason (a financial app). Updates flash when a cell in the TableModel changes and fade out smoothly. The cells will flash green for positive increments, red for negative increments and blue for a non-scalar change (like a string). Additionally, the Table supports arbitrary cell-level, column-level and row-level highlighting based on whatever business-logic you need. We've spent quite a bit of time optimising the application and it is at the point now where a substantial proportion of the cells can be animating at 5fps without causing the CPU of a modern machine to sweat (there are many performance tweaks over the standard swing repaint mechanism).
To briefly describe the mechanism: prepareRenderer is overridden to set background colour of the renderers. The renderers themselves know nothing about the colours. There is a timer thread which runs between 1.25fps and 5fps depending on available CPU to perform the fade effects. The repaint manager is bypassed because it does such a bad job of this particular use case.
You can see the code in detail by looking at the source code at: https://bhavaya.openadaptor.org/source/browse/bhavaya/src/java/org/bhavaya/ui/table/HighlightedTable.java (I really must thank my former boss for open sourcing this). It is fairly integrated into the rest of the library but I've heard of the code being successfully decoupled for general use at Barclays Capital. Of course, you might just want the whole financial app framework 
You can see a demo of this in action at: https://bhavaya.openadaptor.org/builder/demo.jnlp (I think it still works)
Regards, Brendon McLean.
|
|
|
|
|
|
|
|
Re: Flashing cells
Posted:
Jul 6, 2006 8:37 AM
in response to: brendonm
|
|
|
Brendon,
Thank you for sharing this code with us. Have you tried your component with the JXTable class?
Thierry
|
|
|
|
|