You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by Eugene Kondrashev <eu...@gmail.com> on 2010/12/17 19:10:44 UTC

Accordion setSelectedIndex issue

Hi

I faced with issue while refreshing my accordion view.

Let say I have one accordion and one button refreshing accordions data and
setting index.


        nextCompanyButton.getButtonPressListeners().add(new
ButtonPressListener() {

            @Override
            public void buttonPressed(Button button) {
                companiesAccordion.getPanels().remove(0,
companiesAccordion.getPanels().getLength());

                CompanyViewController companyView =
UIComponents.companyView();
                companyView.load(new BeanAdapter(new Company()));
                Accordion.setLabel(companyView, "T1");
                companiesAccordion.getPanels().add(companyView);
                companyView = UIComponents.companyView();
                companyView.load(new BeanAdapter(new Company()));
                Accordion.setLabel(companyView, "T2");
                companiesAccordion.getPanels().add(companyView);
                companiesAccordion.setSelectedIndex(1);
            }
        });

As you can see, i'm removing all the panels and initing them from the
scrach.
So when i'm setting selection index to 0 it is ok no artifacts appears, but
if it is 1 accrodion is flipping. I mean the accordion area is getting blank
for a second or half and then is back to normal with right panel selected.
Seems like that half a second perion selection transition is done. But there
is no animation on screen.

So finally, I need to refresh my accordion and set correct panel index. Can
you tell me how can i do that without that flipping affect?
Perhaps I can turn off that selection animation while refresh or something?

Thanks, Eugene

Re: Accordion setSelectedIndex issue

Posted by Greg Brown <gk...@verizon.net>.
You discovered an interesting issue. I just checked in a fix - however, it looks like you are using Pivot 1.5 and the fix was made for 2.0. If you want to manually patch the source for 1.5.2, here is the diff:

http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraAccordionSkin.java?view=diff&r1=1050963&r2=1050964&pathrev=1050964

G

On Dec 18, 2010, at 10:10 AM, Eugene Kondrashev wrote:

> Please see in attachment the demo.
> 
> 2010/12/18 Greg Brown <gk...@verizon.net>
> Any chance you could provide a simple app that demonstrates the issue?
> 
> On Dec 17, 2010, at 1:10 PM, Eugene Kondrashev wrote:
> 
> > Hi
> >
> > I faced with issue while refreshing my accordion view.
> >
> > Let say I have one accordion and one button refreshing accordions data and setting index.
> >
> >
> >         nextCompanyButton.getButtonPressListeners().add(new ButtonPressListener() {
> >
> >             @Override
> >             public void buttonPressed(Button button) {
> >                 companiesAccordion.getPanels().remove(0, companiesAccordion.getPanels().getLength());
> >
> >                 CompanyViewController companyView = UIComponents.companyView();
> >                 companyView.load(new BeanAdapter(new Company()));
> >                 Accordion.setLabel(companyView, "T1");
> >                 companiesAccordion.getPanels().add(companyView);
> >                 companyView = UIComponents.companyView();
> >                 companyView.load(new BeanAdapter(new Company()));
> >                 Accordion.setLabel(companyView, "T2");
> >                 companiesAccordion.getPanels().add(companyView);
> >                 companiesAccordion.setSelectedIndex(1);
> >             }
> >         });
> >
> > As you can see, i'm removing all the panels and initing them from the scrach.
> > So when i'm setting selection index to 0 it is ok no artifacts appears, but if it is 1 accrodion is flipping. I mean the accordion area is getting blank for a second or half and then is back to normal with right panel selected. Seems like that half a second perion selection transition is done. But there is no animation on screen.
> >
> > So finally, I need to refresh my accordion and set correct panel index. Can you tell me how can i do that without that flipping affect?
> > Perhaps I can turn off that selection animation while refresh or something?
> >
> > Thanks, Eugene
> 
> 
> <AccordionTest.java>


Re: Accordion setSelectedIndex issue

Posted by Eugene Kondrashev <eu...@gmail.com>.
Please see in attachment the demo.

2010/12/18 Greg Brown <gk...@verizon.net>

> Any chance you could provide a simple app that demonstrates the issue?
>
> On Dec 17, 2010, at 1:10 PM, Eugene Kondrashev wrote:
>
> > Hi
> >
> > I faced with issue while refreshing my accordion view.
> >
> > Let say I have one accordion and one button refreshing accordions data
> and setting index.
> >
> >
> >         nextCompanyButton.getButtonPressListeners().add(new
> ButtonPressListener() {
> >
> >             @Override
> >             public void buttonPressed(Button button) {
> >                 companiesAccordion.getPanels().remove(0,
> companiesAccordion.getPanels().getLength());
> >
> >                 CompanyViewController companyView =
> UIComponents.companyView();
> >                 companyView.load(new BeanAdapter(new Company()));
> >                 Accordion.setLabel(companyView, "T1");
> >                 companiesAccordion.getPanels().add(companyView);
> >                 companyView = UIComponents.companyView();
> >                 companyView.load(new BeanAdapter(new Company()));
> >                 Accordion.setLabel(companyView, "T2");
> >                 companiesAccordion.getPanels().add(companyView);
> >                 companiesAccordion.setSelectedIndex(1);
> >             }
> >         });
> >
> > As you can see, i'm removing all the panels and initing them from the
> scrach.
> > So when i'm setting selection index to 0 it is ok no artifacts appears,
> but if it is 1 accrodion is flipping. I mean the accordion area is getting
> blank for a second or half and then is back to normal with right panel
> selected. Seems like that half a second perion selection transition is done.
> But there is no animation on screen.
> >
> > So finally, I need to refresh my accordion and set correct panel index.
> Can you tell me how can i do that without that flipping affect?
> > Perhaps I can turn off that selection animation while refresh or
> something?
> >
> > Thanks, Eugene
>
>

Re: Accordion setSelectedIndex issue

Posted by Greg Brown <gk...@verizon.net>.
Any chance you could provide a simple app that demonstrates the issue?

On Dec 17, 2010, at 1:10 PM, Eugene Kondrashev wrote:

> Hi
> 
> I faced with issue while refreshing my accordion view.
> 
> Let say I have one accordion and one button refreshing accordions data and setting index.
> 
> 
>         nextCompanyButton.getButtonPressListeners().add(new ButtonPressListener() {
> 
>             @Override
>             public void buttonPressed(Button button) {
>                 companiesAccordion.getPanels().remove(0, companiesAccordion.getPanels().getLength());
> 
>                 CompanyViewController companyView = UIComponents.companyView();
>                 companyView.load(new BeanAdapter(new Company()));
>                 Accordion.setLabel(companyView, "T1");
>                 companiesAccordion.getPanels().add(companyView);
>                 companyView = UIComponents.companyView();
>                 companyView.load(new BeanAdapter(new Company()));
>                 Accordion.setLabel(companyView, "T2");
>                 companiesAccordion.getPanels().add(companyView);
>                 companiesAccordion.setSelectedIndex(1);
>             }
>         });
> 
> As you can see, i'm removing all the panels and initing them from the scrach.
> So when i'm setting selection index to 0 it is ok no artifacts appears, but if it is 1 accrodion is flipping. I mean the accordion area is getting blank for a second or half and then is back to normal with right panel selected. Seems like that half a second perion selection transition is done. But there is no animation on screen.
> 
> So finally, I need to refresh my accordion and set correct panel index. Can you tell me how can i do that without that flipping affect?
> Perhaps I can turn off that selection animation while refresh or something?
> 
> Thanks, Eugene


Re: Accordion setSelectedIndex issue

Posted by Chris Bartlett <cb...@gmail.com>.
I am not in a position to be able to see how this manifests, but it sounds
like it could be this issue  https://issues.apache.org/jira/browse/PIVOT-572

If so, you might be able to hack together a workaround using a CardPane and
maintaining 2 Accordions.  The card pane would show the one that is in a
good visual state while you populate the empty one, then toggle the
CardPane's selection to the newly populated one, and clear the first
accordion ready for the next set of changes.  A very clunky double-buffering
effect...

Or if you want to take a look into the issue itself, you'll probably need
http://svn.apache.org/repos/asf/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraAccordionSkin.java
http://svn.apache.org/repos/asf/pivot/trunk/wtk/src/org/apache/pivot/wtk/Accordion.java

Chris

On 18 December 2010 01:10, Eugene Kondrashev <eu...@gmail.com>wrote:

> Hi
>
> I faced with issue while refreshing my accordion view.
>
> Let say I have one accordion and one button refreshing accordions data and
> setting index.
>
>
>         nextCompanyButton.getButtonPressListeners().add(new
> ButtonPressListener() {
>
>             @Override
>             public void buttonPressed(Button button) {
>                 companiesAccordion.getPanels().remove(0,
> companiesAccordion.getPanels().getLength());
>
>                 CompanyViewController companyView =
> UIComponents.companyView();
>                 companyView.load(new BeanAdapter(new Company()));
>                 Accordion.setLabel(companyView, "T1");
>                 companiesAccordion.getPanels().add(companyView);
>                 companyView = UIComponents.companyView();
>                 companyView.load(new BeanAdapter(new Company()));
>                 Accordion.setLabel(companyView, "T2");
>                 companiesAccordion.getPanels().add(companyView);
>                 companiesAccordion.setSelectedIndex(1);
>             }
>         });
>
> As you can see, i'm removing all the panels and initing them from the
> scrach.
> So when i'm setting selection index to 0 it is ok no artifacts appears, but
> if it is 1 accrodion is flipping. I mean the accordion area is getting blank
> for a second or half and then is back to normal with right panel selected.
> Seems like that half a second perion selection transition is done. But there
> is no animation on screen.
>
> So finally, I need to refresh my accordion and set correct panel index. Can
> you tell me how can i do that without that flipping affect?
> Perhaps I can turn off that selection animation while refresh or something?
>
> Thanks, Eugene
>