Component extension: client-side extend() not getting called

Can anyone suggest what might be calling the client-side connector’s extend() method in a component extension not to get called when the server side calls extend() on the server-side of the extension?

Here’s the server-side of the extension:

[font=Courier New]
public class Test extends AbstractExtension {

    public void extend (TextField tf) {
        super.extend (tf);

// We must override getState() to cast the state to TestState
public TestState getState() {
	return (TestState) super.getState();


This is the client-side connector, with the extend() method that’s supposed to get called on attachment, but that doesn’t happen:

[font=Courier New]
public class TestConnector extends AbstractExtensionConnector {

Widget widget;

 public Widget getWidget() {
    return widget;
// We must implement getState() to cast to correct type
public TestState getState () {
    return (TestState) super.getState ();

// Whenever the state changes in the server-side, this method is called
public void onStateChanged (StateChangeEvent stateChangeEvent) {
    super.onStateChanged (stateChangeEvent);

    // State is directly readable in the client after it is set in server
    final String text = getState ().text;
    ((HasText) getWidget()).setText (text);

protected void extend (ServerConnector target) {
    final Widget pw =((ComponentConnector) target).getWidget();
    widget = pw;
    ((HasText) pw).setText (getState().text);


and the demo application:

[font=Courier New]
@Title(“Test Add-on Demo”)
public class DemoUI extends UI {

protected void init(VaadinRequest request) {    	            	
	final VerticalLayout layout = new VerticalLayout();
    TextField tf = new TextField();
    Test extension = new Test();
    extension.extend (tf);
    layout.addComponent (tf);



The extension project is created using the Maven archetype
, amended to replace the widget with a connector to an extended component as described in the Book of Vaadin, section 16.7. I’ve tried it in Vaadin 7.0.7 and 7.1.2 with the same results.

Hello, have the same problem here :slight_smile: I would be very grateful if someone can give us any advice. Thanks.

It should get called by AbstractExtensionConnector.setParent(), which in turn is called by the hierarchy update. Internally, the server side method extend() sets the parent of the extension to be the component being extended.

My first guess would be that there is some problem with the extension and thus it gets omitted during GWT compilation. You could try to add the “-strict” parameter (or true in the Maven plug-in configuration if I remember correctly) and check widgetset compilation log.

Also try to add breakpoints to the methods involved (follow calls from extend() on the server side; on the client side in DevMode start from ApplicationConnection.handleUIDLMessage().updateConnectorHierarchy().

Hey, I just figured it out :slight_smile: Problem was, that my default widgetset.gwt.xml was in src/main/resources folder and when I put the client package witch connector class to the same src/main/resources, so widgetset was unable to link the client package properly.

I have a similar problem, but i can´t figure out what you actually changed.

I have DCWidgetSet.gwt.xml under src/main/resources/dc/framework/

My connector and Extension classes are under: src\main\java\dc\visao\framework\component\

Is there anything related to the path?

My connector and extension are simple copies of CapsLockWarningExtension, showed at:

My Extension extend method do get called, but the connector protected void extend(ServerConnector target) does NOT.

Any suggestions?

Unless you specify otherwise in your widgetset, all client side classes must be in a package called “client” (or its sub-packages) under the package containing the widgetset .gwt.xml file.

Server side classes typically should not be in that package.

Thanks Henry! I´ve moved my extension and connector classes to the correct package and now, its working.

Hi Henry,

I’m facing similar issue but with little twist.

  1. I’ve a multi module maven project with following two modules (and many others)
  2. My extension module has correct structure and it compiles withiout any problem.
  3. I’ve a module that inherits all of our custom components and compiles the widgetset.

Compilation of the module that generates the widgetset fails when it tries to compile (I think it should be just linking) the extension again because it cannot find the classes used in the annotation for the extension. Both Connect annotation and the argument passed to it are not visible to the GWT compiler and in my case they cannot be in client package.