Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#318 Adding, removing then adding a panel again doesn't work

v1.2 RC2
open
Jay Conter
5
2010-01-29
2010-01-29
Anonymous
No

Exception below given when adding a panel to another, then later removing, then adding again in a separate instance of the application:
I believe this to be because although the reference in the parent panel is removed, the parent is not removed from the child, and the check performed before throwing this error is panel.getParent()!=null
java.lang.IllegalArgumentException: cannot add component to multiple containers or twice to the same container
at thinwire.ui.AbstractContainer$ChildList.add(AbstractContainer.java:84)
at thinwire.ui.AbstractContainer$ChildList.add(AbstractContainer.java:42)
at java.util.AbstractList.add(Unknown Source)
at thinwire.apps.tester.Main$1.propertyChange(Main.java:124)
at thinwire.ui.EventListenerImpl.fireEvent(EventListenerImpl.java:310)
at thinwire.ui.EventListenerImpl.firePropertyChange(EventListenerImpl.java:231)
at thinwire.ui.AbstractComponent.firePropertyChange(AbstractComponent.java:135)
at thinwire.ui.Tree$Item.setSelected(Tree.java:189)
at thinwire.render.web.TreeRenderer.componentChange(TreeRenderer.java:149)
at thinwire.render.web.EventProcessor.processUserActionEvent(EventProcessor.java:132)
at thinwire.render.web.EventProcessor.run(EventProcessor.java:88)

Discussion

  • ses
    ses
    2010-01-31

    This was posted by myself, I have since realised this was a programming error in my application - I was sharing the child panel by using an enum with it as one of the members and not creating a new one for each instance of the application. As a result this had the effect of the panel being added twice to the same parent panel.