pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Chatelain <schat...@gmail.com>
Subject Re: Activity Indicator in accordion header
Date Mon, 21 Mar 2011 13:28:49 GMT
Hello Chris,

Thank you for your answer but there is still something that I do not

In fact I tried different approaches: first I had a timer calling
Accordion.setHeaderData() each time with a different icon, and that didn't
work even if setting the header data will definitely invalidate the header's
area, will it not ?  In this case the behavior was the same as with the
ActivityIndicator : refresh only when moving the mouse on the Accordion.

Then I tried to setup a ScheduledCallback directly in my
AnimatedHeaderRenderer to invalidate the ActivityIndicator (by calling
invalidate()), still the same behavior, and finally I set up a
ScheduledCallback in my application, invalidating the Accordion itself but
still no luck.

But if I call myAccordion.repaint() instead of myAccordion.invalidate(),it
works. But I really don't like this solution because it means that I need
not only the AnimatedHeaderRenderer but also a ScheduledCallback at the
level of the class containing the Accordion using the custom renderer.

Other tests I made, in the ScheduledCallback defined in the
AnimatedHeaderRenderer (see attached file for the full code):
public void run() {
                //does not work : parent is always null
//                Component parent =
//                if (parent != null) {
//                    parent.repaint();
//                }

                //does not work : ancestor is always null
//                Container ancestor =
//                if (ancestor != null) {
//                    ancestor.repaint();
//                }

                //does not work : refresh only when hovering the mouse on
the Accordion, immediate or not
//                AnimatedHeaderRenderer.this.repaint();

                //does not work : refresh only when hovering the mouse on
the Accordion
//                AnimatedHeaderRenderer.this.invalidate();

                //does not work : refresh only when hovering the mouse on
the Accordion, immediate or not
//                indicator.repaint();

                //does not work : refresh only when hovering the mouse on
the Accordion
//                indicator.invalidate();

So I do not understand why myAccordion.repaint() works where
myAccordion.invalidate() doesn't. I don't understand either why parent and
ancestor of the AnimatedHeaderRenderer  are always null.

What am I missing ? Do you have any idea about what to do to make it work
from inside the AnimatedHeaderRenderer  class ?



On Mon, Mar 21, 2011 at 12:44 PM, Chris Bartlett <cbartlett.x@gmail.com>wrote:

> Simon,
> I think that a renderer will only be used when the area it is responsible
> for is invalidated or repainted.  If the Accordion's skin doesn't think it
> needs to repaint the header, then it wont, and therefore ActivityIndicator
> will not animate.
> Have a look at the default ActivityIndicator skin to see the callback it
> sets up to take care of the animation. You might want to use some similar
> code to schedule repaints of the Accordion's header when the
> ActivityIndicator is active.
> http://svn.apache.org/repos/asf/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraActivityIndicatorSkin.java
> Chris
> On 21 March 2011 15:16, Simon Chatelain <schatela@gmail.com> wrote:
>> Hello all,
>> I am trying to display an animated component inside the headers of an
>> accordion. For that I defined a subclass of AccordionHeaderDataRenderer
>> inserting a ActivityIndicator at first position in the header.
>> But the activity indicator animation is not refreshed unless I move the
>> mouse cursor over the header. What am I doing wrong and is there a way to do
>> that ?
>> You can find in attachment a sample application showing the described
>> behavior.
>> Thanks
>> Simon

View raw message