In the Vaadin framework (v7.1.9), how do we remove a Component
from it's parent?
I'm only aware of the removeComponent
function, but that requires me to get a handle on the parent (ugly):
ComponentContainer parent = (ComponentContainer) child.getParent();
parent.removeComponent(child);
I tried to just detach
the child but that removed it from the 'application' without removing the Component
from the UI.
HashSet
,ArrayList
...). – HelmsHashSet
orArrayList
, you don't need to cast.remove
is defined inCollection
. In Vaadin,removeComponent
is defined inComponentContainer
.. butComponent.getParent()
returns aHasComponents
object instead. To me, this is either a flaw in the API or this isn't the way to do what I want to do. What do you guys think? – SondraSingleComponentContainer
and notHasComponents
.Panel
for example. But I'm not working on vaadin only using it. May I ask you in what situation you have a component and don't know its parent? – HelmsremoveComponent
method without any casts – Azote