You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by Brendan cheng <cc...@hotmail.com> on 2012/01/08 04:43:17 UTC

Remove component from Accordion

Hi,
I was trying to remove a component from an Accordion but failed.After a trace, I found your code in Accordion class as
  @Override
    public Sequence<Component> remove(int index, int count) {
        for (int i = index, n = index + count; i < n; i++) {
            Component component = get(i);


            if (panels.indexOf(component) >= 0) {
                throw new UnsupportedOperationException();
            }
        }


        // Call the base method to remove the components
        return super.remove(index, count);
    }
which if the component index to be removed is greater than or equal to zero will throw a UnsupportedOperationException.Is that mean, we can't remove component from accordion or it is a bug?
Regards,
Brendan 		 	   		  

Re: Remove component from Accordion

Posted by Roger and Beth Whitcomb <Ro...@rbwhitcomb.com>.
Yes, I think the code you cited is only disallowing the removal of the
accordion panels themselves, not the subcomponents under them.

~Roger

On 1/7/12 11:51 PM, Brendan cheng wrote:
> I found a way to remove component. it is from getPanels() of Accordion.
>
> ------------------------------------------------------------------------
> From: ccp999@hotmail.com
> To: user@pivot.apache.org
> Subject: Remove component from Accordion
> Date: Sun, 8 Jan 2012 03:43:17 +0000
>
> Hi,
>
> I was trying to remove a component from an Accordion but failed.
> After a trace, I found your code in Accordion class as
>
> @Override
>
> public Sequence<Component> remove(int index, int count) {
>
> for (int i = index, n = index + count; i < n; i++) {
>
> Component component = get(i);
>
>
> if (panels.indexOf(component) >= 0) {
>
> throw new UnsupportedOperationException();
>
> }
>
> }
>
>
> // Call the base method to remove the components
>
> return super.remove(index, count);
>
> }
>
>
> which if the component index to be removed is greater than or equal to
> zero will throw a UnsupportedOperationException.
>
> Is that mean, we can't remove component from accordion or it is a bug?
>
>
> Regards,
>
>
> Brendan
>

RE: Remove component from Accordion

Posted by Brendan cheng <cc...@hotmail.com>.
I found a way to remove component.  it is from getPanels() of Accordion.

From: ccp999@hotmail.com
To: user@pivot.apache.org
Subject: Remove component from Accordion
Date: Sun, 8 Jan 2012 03:43:17 +0000







Hi,
I was trying to remove a component from an Accordion but failed.After a trace, I found your code in Accordion class as
  @Override
    public Sequence<Component> remove(int index, int count) {
        for (int i = index, n = index + count; i < n; i++) {
            Component component = get(i);


            if (panels.indexOf(component) >= 0) {
                throw new UnsupportedOperationException();
            }
        }


        // Call the base method to remove the components
        return super.remove(index, count);
    }
which if the component index to be removed is greater than or equal to zero will throw a UnsupportedOperationException.Is that mean, we can't remove component from accordion or it is a bug?
Regards,
Brendan