Extension example not working (Book of vaadin)


The extension example in the book of vaadin does not work. I wrote simple extension example so it is not working too. Please help! Maybe i missed something i don’t know. I need help asap. Thanks.
Here is my code.

// TestExtension2UI.java
public class Testextension2UI extends UI {

    protected void init(VaadinRequest request) {
     final VerticalLayout layout = new VerticalLayout();

        Label label = new Label("Hello");
        new TestExtension().extend(label);

// TestExtension.java
public class TestExtension extends AbstractExtension {
    public void extend(Label target) {    

// TestConnector.java
public class TestConnector extends AbstractExtensionConnector {
    protected void extend(ServerConnector target) {
        VLabel label = (VLabel) ((ComponentConnector)target).getWidget();
        Element e = DOM.createDiv();

Emir Cem


at a quick glance I don’t see problems in your code. How exactly does it not work? Have you recompiled the widgetset and confirmed from the compiler output that the client-side class of the extension is actually contained in the widgetset?

i recompiled the widgetset then i debug app, extend method in the TestConnector never called. I can’t figure out what is missing.

I found solution.

Widget set compilation, as described in Section 13.3, “Client-Side Module Descriptor”, requires using a special project structure, where the client-side classes are located under a client package under the package of the module descriptor.


I copied your code verbatim, compiled the widgetset and ran the application. The extension seems to be called properly, meaning that if I run it in development mode, I get a break point in the client-side extend method triggered.

However, the actual functionality does not work. That’s because your extension sets the inner HTML of the Label to something, and right after that the LabelConnector will set it to “Hello”, wiping away the DIV added by your extension. So I think you need to rework your approach a bit.