Expand Vaadin Widget

I am trying to expand a tree component in Vaadin. Therefore, I created a client side class as:

import com.vaadin.terminal.gwt.client.ui.VTree; public class CustomVtree extends VTree { } 

Server Side Class:

 import com.vaadin.ui.ClientWidget; import com.vaadin.ui.Tree; @ClientWidget(CustomVtree.class) public class MyTree extends Tree { public MyTree() { super(); } } 

And I got [WARN] Widget class com.vaadin.sample.gwt.client.ui.CustomVtree was not found. The component com.vaadin.sample.gwt.client.ui.MyTree will not be included in the widgetset. [WARN] Widget class com.vaadin.sample.gwt.client.ui.CustomVtree was not found. The component com.vaadin.sample.gwt.client.ui.MyTree will not be included in the widgetset. What did I forget to do or what am I doing wrong? We welcome any help. Thanks

+4
source share
2 answers

Your classes look right, but nothing is missing: the GWT module descriptor file. Add this file to the com.vaadin.sample.gwt package, and here I call it MyWidgetset.gwt.xml. The contents of the file should look like this if you do not have add-ins in your project:

 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.7.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.7.0/distro-source/core/src/gwt-module.dtd"> <module> <inherits name="com.vaadin.terminal.gwt.DefaultWidgetSet" /> </module> 

And then you need to define in web.xml that you want to use this widget:

 <init-param> <description>Application widgetset</description> <param-name>widgetset</param-name> <param-value>com.vaadin.sample.gwt.MyWidgetset</param-value> </init-param> 

After these steps, GWT compilation should work.

+6
source

What is a package announcement?

When expanding the client component, the client class must

yourpackage.widgetset.client.ui

When compiling this package checks to find any widget and add it to your widget.

Then you need to change your web.xml to change the init-param tag.

Here's a resume summary to help you: Create a widget

+1
source

Source: https://habr.com/ru/post/1397869/


All Articles