RE: Is there way to ask if compionent is connect to UI?

If you call isAttached() or getUI() != null this should tell you if the the component is connected to some UI. Does this solve your problem?

I have problem on vaadin 7 application design, because one component
is removed from layout and sometimes layout is not connect to UI.
Vaadin 7 fails on that. I have hack made on file AbstractClientConnector.java
so that it don’t fail anymore.

Is there way to ask “is this component connect to UI”?

I try this:
if (getContentArea().isAttached()) {
getContentArea().removeAllComponents();
}
some reason still fails on second command.
Contentarea is VerticalLayout.

if (getContentArea().isAttached() && getContentArea().getUI() != null) {
getContentArea().removeAllComponents();
}
Still error, some componet on contentarea messing things up… on attach() call.

Hi,

The call to isAttached() should tell you if the component is attached to some UI, I can’t tell what the issue is in this particular application. Can you provide some minimum example where this happens? What kind of exception do you get?