[ 
https://issues.apache.org/jira/browse/PIVOT-766?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13057184#comment-13057184
 ] 

Chris Bartlett commented on PIVOT-766:
--------------------------------------

Full unit test to follow, but this simple test demonstrates the behaviour

Accordion accordion = new Accordion();
accordion.getAccordionListeners().add(new AccordionListener.Adapter() {
        @Override
        public void panelsRemoved(Accordion accordion, int index, 
Sequence<Component> removed) {
                System.out.println(String.format("panelsRemoved %s", removed));
        }
});
System.out.println("No remove event expected & none fired");
accordion.getPanels().remove(null);

System.out.println("\nNo remove event expected, but one is fired");
accordion.getPanels().remove(0, 0);

System.out.println("\nRemove event expected & fired");
accordion.getPanels().add(new Label());
accordion.getPanels().remove(0, 1);


> Many WTK implementations of Sequence fire xxxRemoved() events even if no 
> items are actually removed.
> ----------------------------------------------------------------------------------------------------
>
>                 Key: PIVOT-766
>                 URL: https://issues.apache.org/jira/browse/PIVOT-766
>             Project: Pivot
>          Issue Type: Bug
>          Components: wtk
>    Affects Versions: 2.0
>         Environment: n/a
>            Reporter: Chris Bartlett
>            Assignee: Chris Bartlett
>            Priority: Minor
>             Fix For: 2.1
>
>
> Many WTK implementations of org.apache.pivot.collections.Sequence fire 
> xxxRemoved() events, even if no items are actually removed.
> The events will include an empty list of items that were 'removed', but it 
> would be preferable to simply suppress the event.
> All other WTK Sequence implementations that I checked already suppress such 
> non-events.
> Fixes required for the following classes
> org.apache.pivot.wtk.Accordion.PanelSequence
> org.apache.pivot.wtk.Form.Section
> org.apache.pivot.wtk.Form.SectionSequence
> org.apache.pivot.wtk.GridPane.Row
> org.apache.pivot.wtk.GridPane.RowSequence
> org.apache.pivot.wtk.Menu.Section
> org.apache.pivot.wtk.Menu.SectionSequence
> org.apache.pivot.wtk.MenuBar.ItemSequence
> org.apache.pivot.wtk.TabPane.TabSequence
> org.apache.pivot.wtk.Window.ActionMappingSequence
> org.apache.pivot.wtk.Window.IconImageSequence

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to