开发者

Vaadin Widgetset compilation – Widget implementing an external interface

开发者 https://www.devze.com 2023-04-12 09:15 出处:网络
We’re trying to implement the MVP pattern using a custom Vaadin widget. In order to avoid duplicating interfaces, our first approach was making the Vaadin server-side component to implement the view

We’re trying to implement the MVP pattern using a custom Vaadin widget. In order to avoid duplicating interfaces, our first approach was making the Vaadin server-side component to implement the view interface. But when I compile the widgetset, I got the following error:

Widgetset does not contain implementation for com.enterprise.designer.vaadin.widget.workflow.Workflow. Check its @ClientWidget 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. Unrendered UIDL:
com.enterprise.designer.vaadin.widget.workflow.Workflow(NO CLIENT IMPLEMENTATION FOUND) id=PID2 caption=Editorongo actionCount=1 workflowAction_0_id=1 workflowAction_0_name=addStartNode workflowAction_0_y=75.0 workflowAction_0_x=50.0

If I comment the interface (and the imports) it works ok, even if I uncomment them after building the widgetset. The code (with import/implements commented) looks like the following:

import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
//import com.enterprise.designer.workflow.presenter.WorkflowDrawArea;
//import com.enterprise.platform.i18n.api.Language;
//import com.enterprise.platform.mvp.api.ViewEventNotifier;
//import com.enterprise.platform.r13n.api.Region;
//import com.enterprise.vaadin.mvp.VaadinView;
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
import com.vaadin.terminal.Resource;
import com.vaadin.ui.AbstractComponent;
import com.vaadin.ui.Component;

@com.vaadin.ui.ClientWidget(com.enterprise.designer.vaadin.widget.workflow.client.ui.VWorkflow.class)
public class Workflow extends AbstractComponent 
//implements WorkflowDrawArea.Display, VaadinView 
{
. . .

The lo开发者_开发百科g doesn’t show any error (except for sources for validation api, but the same errors are shown when I comment the interface and it works ok). I tried both compiling form Eclipse plugin and from command line.

Any idea? Thanks in advance.

Crosspost: https://vaadin.com/forum/-/message_boards/view_message/817539


I found a workaround. If I create an intermediate class for the widget, it compiles OK. And creating a sub class of that widget and using it form Vaadin application works ok, so I can make such subclass implementing the interface from an external project:

 ________________________________
|com.vaadin.ui.AbstractComponent |
|________________________________|
              ^
             /|\
              |
              |
 ____________________________________________
|com.enterprise.designer.vaadin.widget.Dummy |
|--------------------------------------------|
|     <@com.vaadin.ui.ClientWidget >         |
|____________________________________________|
         ^
        /|\   ______________________________________
         |   | com.enterprise.vaadin.mvp.VaadinView |
         |   |______________________________________|
         |                         ^
         |                        /|\
         |                         | implements
         |                         |
 _________________________________________________________
| com.enterprise.designer.vaadin.widget.workflow.Workflow |
|_________________________________________________________|
    |
    |                  ________________________
    |                 | com.vaadin.Application |
    |uses             |________________________|
    |                           ^
    |                          /|\
    |                           |
    |                           |
 _____________________________________________________
| com.enterprise.designer.vaadin.widget.MyApplication |
|_____________________________________________________|

In this diagram, Dummy is the Vaadin widget (which implements the paintContent method) and Workflow is the subclass implementing the interface form other project (VaadinView). The Vaadin application (MyApplication) uses Worflow class directly.

However, it would be nice solving the problem without this workaround :)


If you get some think like "NO CLIENT IMPLEMENTATION FOUND", it mean during widgetset compilations were some errors. I have same problem, complication was OK, but no effect for application. After debugging I found problem, in my app was used drools library and inside this lib was compiler with same name as in gwt-dev libraries and during widgetset compilation compiler takes wrong class to compile widgetset and as result widgetset compile with errors. Drools library in app should be included all time and only way to solve this problem was compile widgetset manually. If you use Eclipse you should add in module new "Java application" with:

Project: {your project}

Main class: com.google.gwt.dev.Compiler

Program arguments: -gen {your project location (like C:\workspace**)}\target.generated -logLevel INFO -style OBF -war {your project location}\src\main\webapp\VAADIN\widgetsets -localWorkers 4 {your project custom widgetset location in java packages(like com.***.widgetset.CustomWidgetset)}

After this in project class path in "Libraries" add external jar gwt-dev-2.3.0.jar(or other version) on top of all libraries, this needed only to be sure that compiler take right java class and in "Source" change for all available folder field "Included:*/.java" to "Included:(All)"

It should help solve your problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号