Creating a GWT component

Hi, i’m totally new in vaadin and i’m trying to develop a complex (sigh, i need so) component client-side,since would be helpful to use the designer and for others reason the decision is to develop a GWT base component and this seems ok since vaading is +=GWT.
I realized a really basic composite widget pure GWT and tryed to add this widget to the main vaadin portal.
the idea is that i finally have a project producing a war, complete of gwt.xml i can test and is working (really basic composite so far).
I tryed then following https://vaadin.com/wiki/-/wiki/Main/Integrating%20an%20existing%20GWT%20widget to create the server part in the vaadin portal project inheriting the gwt.xml and so on but I always have the same result:

Widgetset does not contain implementation for prj.pres.uc.myclass. Check its component connector’s @Connect mapping, widgetsets GWT module description file and re-compile your widgetset. In case you have downloaded a vaadin add-on package, you might want to refer to add-on instructions.

now…how can i trace back where I did something wrong since there’s no log that can helpme?

Just some things you could check.
Did you:

  • have a custom clientside widgetset in your app?
  • compile/recompile said widgetset after integrating the component?
  • setup the Connector and client side correctly(class paths in annotions for example)?
  • check your class paths again to see if maybe something is trying to access a wrong path?

Thanks Marius,
the point is that I’m trying to have in a project just pure GWT widget that means (maybe is wrong)

prj,gwt.xml
client/java that implements entry point (no annotations)
client/java that extends composite (no annotation)

in the other project (referencing both build classes and source), ie the vaadin site

gwt.xml with inherits of the other xml
java1 extending abstractcomponent
java2 extending abstractconnector @Connect(java1.class) with protected Widget createWidget() { return GWT.create(otherprjwidget.class);}
java3 extending abstractcomponentstate

all paths seems ok.

So if I understood what you’re trying to say:
You have a normal GWT Project in which you build your own custom Gwt component and now you’re trying to include this Component as a Vaadin Component? … and you “imported” the gwt files in the Vaadin Project as linked source folder?

First i would suggest trying to export the gwt project as a jar and then import it as a library in the Vaadin Project (or put it into WEB-INF/lib as the wiki article suggests). Even if it doesn’t solve the problem it in my opinion looks more clear.
Is your .gwt.xml of the Vaadin Project referenced as Widgetset in the vaadin web.xml?
Did you then make sure that said Widgetset was getting recompiled? (Should say something like Compiling Permutation…in the Console when compiling project)
Did you also refernce the gwt component in the Vaadin web.xml?

Yes, I already exported a jar and tryed using it the only thing (and this could be the problem) i didn’t is insert the gwt in web.xml because I actually don’t see it in the project (i’m using the annotation in the UI class).
Anyway in the meanwhile I’m also trying another way because after all my interest is have a separate project with the development of my component and since this component is complex in the client side I would use GWT parts.
Basically i could do all in a standard vaadin project and compile directly a widgetset or addon but here the separate problem stopping me in this way too:in a eclipse-vaadin project seems i can’t use the windowsbuilder editor to do the layout with a proper IDE!
So the super question become: what path is better in such scenario, to start a standard GWT project or a vaadin widget project? and then i will try solving the two stopping problems (compilation or editor support for GWT widgets classes)

Okay so you’re not using a web.xml but the UI annotations. I personally am someone who still uses the web.xml as i had and still have a few problems with it and can’t get it to work properly so i don’t know much about it. In that case did you somehow add the gwt in your Ui annotation? I think this might be the issue here. Maybe you could try replacing your annotation with a web.xml and see if it works then.

I would say that when you’re creating a gwt Component yourself you should do that part in a seperate GWT Project so that you can more easily see if it works. when your done building and testing it you can export the component in a library (like other gwt libraries for example gflot which was used in the wiki article). Then you can use your own component exactly the same way as gflot was used in the wiki article. This seems to be the best way in my opinion which is also good to seperate the GWT and Vaadin side. Building an own GWT Component inside a Vaadin Project in which you want to integrate this component as the client side of a Vaadin Component just sounds confusing.

Ok I restarted trying to understand every step and avoid any faith action…first problem:
I add the jar or the reference to the classes directory of the war directory…but the source code? I have to add the source too in the jar or reference them as well project to project (it’s all in the same workspace)? because by logic I won’t share source code, the component can be developed by anyone and not me but if I don’t share sources as well compiler of widget in the vaadin project (GWT it’s ok all the time and tested) says can’t find the entry point class i had to add to the gwt.xml as inherits

So I checked back with my Test Project where i integrated Google’s Visualization library in Vaadin and this is what i think you should do:

  1. Create your component in a GWT Project.
  2. Pack the Component (at least .class files and resources like .gwt.xml) have a look for example
    here
  3. Put the jar into your Vaadin Project’s WEB-INF/lib folder (src/main/webapp/WEB-INF/lib for a maven project which i used. For Ivy/no dependency mgmt i think it is WebContent/WEB-INF/lib)
  4. I was using Maven so i had to reference the jar as dependency (scope=system and systempath set). maybe the same is needed for Ivy or whatever dependency management you use if you use one.
  5. Reference your Component in your Widgetset.gwt.xml file (which schould be defined in your UI Annotation or web.xml) like
  6. Create Server side and connector class for the component
  7. For testing purposes add your component to a test UI
  8. Compile/Recompile widgetset and Build&Run the Project

I don’t get why you’re trying to add the jar to the war directory. The Files in this Folder will be created at compilation. You shouldn’t have to add your .java files in the jar, Just the compiled .class files and the Widgetset. That should be explained in the link i put in this post.
Your only trying to integrate a Widget in Vaadin right? Not an entire GWT UI Interface? …because the EntryPoint thing kinda sounds like you do.

Thanks again Marius, well I’m messing around with war/jar because I don’t have a perfect knoledge,i’m from the windows/M$ development :stuck_out_tongue: but by points:
I’m already doing exactly the steps you say to me, exception is that if I do a standard jar (without .java source files) I have (during the widget compilation of the vaadin project) the error saying it cannot find the entrypoint class of the other project.

I guess i understand why it needs the entrypoint class: I try to add the widget and to do it I insert in my gwt.xml file the inherits of the widgetset of the other project (the com.bla.bla.name_of_gwt_xml_without_extensions) that ofcourse reference as entrypoint (for test pourpose of the other project) the class that when I try to rebuild from vaadin is requested.

anyway for that i got the working around of insert in the jar i copy in lib the sources as well by now, i will worry about it later.

At this point all compilations run easy but… when i navigate to the page (state of the vaadin website) with the widget the rendering is

“Widgetset does not contain implementation for bla.blabla.bla.myServerClassfortheWidget. Check its component connector’s @Connect mapping, widgetsets GWT module description file and re-compile your widgetset. In case you have downloaded a vaadin add-on package, you might want to refer to add-on instructions.”

so, no problem finding my class implementing the abstractcomponent and seems there’s no connector…except i have implemented it;let’s call the servercomponent “UCAlpha”, the widget from the other project Beta

public class UCAlpha extends AbstractComponent{
…quite nothing

}

@Connect(UCAlpha.class)
public class UCAlphaConnector extends AbstractComponentConnector{

@Override
public UCAlphaState getState() {
    return (UCAlphaState) super.getState();
}

@Override
public Beta getWidget() {
    return (Beta) super.getWidget();
}

@Override
protected Widget createWidget() {
    return GWT.create(Beta.class);
}

…quite nothing else

}

I can’t see errors in this

Ok, I tryed to create a case test less complex and the result is that you need to put the ServerSide.java class in the same package of the gwt.xml…
so finally in case can be helpful for others, seems the structure should be

package a:
widgestset.gwt.xml
servercomponent
package a.client
connector
state
widget (extending the gwt widget you are importing)

grrrr what a waste of time for such stupid limitation!!! grrrrrrrr