arjacsoh
arjacsoh

Reputation: 9232

Avoid using deprecated vaadin 6 methods in vaadin 7

I am on a Project update from version vaadin 6 to vaadin 7. In the vaadin 7 version is used to a large extent the method getPaintable() from the class ApplicationConnection. Nevertheless it is deprecated in vaadin 7 . After examining the api and the official tutorial I have not detected and understood by what method or combination of methods it is replaced. If I want for example to do:

ComponentConnector paintable = this.client.getPaintable(uidl);

How can I excecute the above statement using excusively vaadin 7 (not deprecated) api?

Update:

The answer certifies my suspect that the method in ApplicationConnection getConnector(java.lang.String connectorId, int connectorType) should be used instead, but it is still missing, what is the int type connectorType and how one gets it. Any suggestion?

Update 2:

The replacement suggested in the answer seems reasonable and it might work but my worry is: Should we use generally UIDL class in vaadin 7? I have the impression that the method updateFromUIDL(UIDL uidl, ApplicationConnection client)should not be called in vaadin 7. How can we the get uidl.getId() , uidl.getTag(). I reckon also that uidl.getId() should be replaced by the method in AbstractConnector getConnectorId(). Am I right?

Upvotes: 1

Views: 748

Answers (1)

xwoker
xwoker

Reputation: 3171

Update:

After looking at the implementation of the deprecated getPaintable method, you should be able replace it with

ComponentConnector paintable = (ComponentConnector) getConnector(uidl.getId(),
            Integer.parseInt(uidl.getTag()));

But don't forget that this can be only a intermediate step. Vaadin 7 changes the general mechanism for Client-Server interaction of widgets:

The old mechanism with UIDL, paintContent() and changeVariables() is still there for a while to ease migration, but it is recommended to update your components to the new mechanisms, which also tend to result in much cleaner code. Using the old mechanisms requires implementing LegacyComponent.

If you compare the integration diagrams of Vaadin 6 with Vaadin 7, you will see how the general integration mechanism have changed.

Original Answer:

Vaadin dev ticket: Deprecate ApplicationConnection.getPaintable(UIDL)

Description:

Functionality from getPaintable(UIDL) should be moved to getPaintable(String paintableId) and getPaintable(UIDL) should be deprecated

Change Log:

#8439 Deprecated ApplicationConnect.getPaintable(UIDL) and added getConnector(String id, String connectorType) instead

Upvotes: 1

Related Questions