I'm getting
java.lang.NoClassDefFoundError: com/vaadin/data/util/converter/Converter$ConversionException
error. I have made Person class as entity, and my application class is like this:
public class SimplejpaApplication extends Application {
#Override
public void init() {
// TODO Auto-generated method stub
VerticalLayout layout = new VerticalLayout();
JPAContainer<Person> persons =
JPAContainerFactory.make(Person.class, "book-examples");
persons.addEntity(new Person("Marie-Louise Meilleur", 117));
Table personTable = new Table("The Persistent People",persons);
layout.addComponent(personTable);
setMainWindow(new Window("simple",layout));
}
I'm using vaadin-jpacontainer-agpl-3.0-3.0.0-alpha2.jar
Can someone tell why this error happening? thank you.
Converter class is from Vaadin 7 but you are using Vaadin 6. You need to use vaadin-jpacontainer-agpl-3.0-2.1.0 for Vaadin 6.
Or you can upgrade your project to Vaadin 7 and use vaadin-jpacontainer-agpl-3.0-3.0.0-alpha2.jar.
Both jar files can be downloaded from Vaadin add-on page https://vaadin.com/directory#addon/vaadin-jpacontainer.
Related
I am getting the following error when I deploy a Vaadin 14 web application on Tomcat 9.0.46
Caused by: com.vaadin.flow.server.AmbiguousRouteConfigurationException: Navigation targets must have unique routes, found navigation targets 'xx.SForceFindPaymentView' and 'xx.SForceFindPaymentView' with parameter have the same route.
The class is defined as follows:
#Route(value = "sf-find-payment", layout = MainLayout.class)
#PageTitle("Find Payment")
public class SForceFindPaymentView extends FindPaymentView implements HasUrlParameter<String>, IAAPConnection {
And the parent class is defined as follows:
#PageTitle("Find Payment")
#Route(value = "find-payment", layout = MainLayout.class)
public class FindPaymentView extends VerticalLayout implements HasUrlParameter<String>, IAAPConnection {
The only difference between the parent class and the derived class is the way the parameters are handled in the setParameter() method.
The setParameter method has the following signature
#Override
public void setParameter(final BeforeEvent event, #OptionalParameter final String parameter) {
The odd thing is if I delete the war and redeploy the exact same war file the problem goes away and the application installs successfully.
I tried removing the #OptionalParameter annotation but that made no difference. The error message seems to see two routes for the same class, one with a parameter and one without so I thought if I removed the #OptionalParameter in both the parent and derived class, that might help but it made no difference.
Grateful for any suggestions.
I need to add pusher object to vertical layout in Vaadin 13
sources: https://vaadin.com/directory/component/icepush/samples
public class Playboard extends VerticalLayout
{
private ICEPush pusher;
public Playboard() throws ExecutionException, InterruptedException{
generateGUI();
}
private void generateGUI() throws ExecutionException, InterruptedException {
..................
.................
pusher = new ICEPush();
VerticalLayout playboard = new VerticalLayout();
playboard.add(pusher); //Cannot resolve method
...........
............
}
Why would you want to do so? It states at add-on page that
A component that adds push support to Vaadin!
Vaadin(both 7-8 versions as well as Flow 10+, which you are using) has a built-in support for Push currently, so there is no need to use a mentioned add-on. In the simplest case, all you need to do to get push working for your view is to add an annotation. There is a good official documentation on push:
Server Push Configuration
Asynchronous Updates
But,anyway, as mentioned in the previous answer you can't use the add-on with V13,since it's available only for Vaadin 6 and 7
You can't - this is for the so called Vaadin Platform (Vaadin 6-8). You have to find a web component replacement for that feature, write your own, or maybe sometime in the future there will be tooling to retrofit the old components into Vaadin Flow.
In my vaadin application I need to implement a fixed header, that changes size depending on the scroll position of the UI.
While there are geters for scroll position in Vaadin 8, there seems to be no functionallity implemented to listen for scroll events. So I tried to implement a JavaScript connector, that just informs the server-side UI, that the user has scrolled, so the server-side UI can then notify the Header as a scrollListener.
So far thats what I planned, but I just can't find out, how to implement my connector in a way that it.
is active after the site got requested by a Client.
is able to call my server-side UI.onScrollEvent() method.
Does anyone know, how the described behavior could be implemented?
Thank you for your help in advance.
After I ran into a few issues with implementaton of a custom widget to achieve, I went for a different approach, using extensions in a vaadin-sense. Here is the truncated code for what I did.
(Vaadin requires the client-side connector code shown later in this post to be in a Widget package. I'm not entirely sure if the server-side component has to be in one too, but for conformity reasons with the usual widget-skeleton I put it into one)
So in the package for the widget:
package my.company.project.scrollUI;
import com.vaadin.server.AbstractExtension;
import com.vaadin.ui.UI;
import my.company.project.scrollUI.client.scrollUI.ScrollUIServerRpc;
public class ScrollUI extends AbstractExtension {
private ScrollUIServerRpc rpc = new ScrollUIServerRpc() {
#Override
public void onScroll() {
//do whatever you need for your implementation
...
}
};
public ScrollUI() {
registerRpc(rpc);
}
public void extend(UI ui) {
super.extend(ui);
}
}
as usual the .gwt.xml file in the package folder, nothing special here:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd">
<module>
<inherits name="com.vaadin.DefaultWidgetSet" />
</module>
In the package for the client-side code to be compiled to JavaScript:
package my.company.project.scrollUI.client.scrollUI;
import com.vaadin.shared.communication.ServerRpc;
public Interface ScrollUIServerRpc extends ServerRpc {
public void onScroll();
}
And finally the connector for the extension:
package my.company.project.scrollUI.client.scrollUI;
import com.google.gwt.event.dom.client.ScrollEvent;
import com.google.gwt.event.dom.client.ScrollHandler;
import com.google.gwt.user.client.ui.Widget;
import com.vaadin.client.ComponentConnector;
import com.vaadin.client.ServerConnector;
import com.vaadin.client.communication.RpcProxy;
import com.vaadin.client.extensions.AbstractExtensionConnector;
import com.vaadin.shared.ui.Connect;
#Connect(ScrollUI.class)
public class ScrollUIConnector extends AbstractExtensionConnector {
ScrollUIServerRpc rpc = RpcProxy.create(ScrollUIServerRpc.class, this);
#Override
protected void extend(ServerConnector target) {
final Widget ui = ((ComponentConnector) target).getWidget();
ui.addDomHandler(new ScrollHandler() {
#Override
public void onScroll(ScrollEvent event) {
rpc.onScroll();
}
}, ScrollEvent.getType());
}
}
Now don't forget to compile the Widgetset and everything is good to go to be used for your actual UI like all other vaadin extensions:
public class MyUI extends com.vaadin.ui.UI {
#Override
protected void init(VaadinRequest vaadinRequest) {
ScrollUI scrollUI = new ScrollUI();
scrollUI.extend(this);
//everything else that needs to be done
...
}
//everything else that Needs to be done
...
}
I hope this was helpfull for anyone with a similar issue.
I have done this once few years ago by extending the layout component that wrapped the part of UI where I needed this. In GWT there is gwtproject.org/javadoc/latest/com/google/gwt/event/dom/client/… which can be used in DOM handler. So yes, GWT provides suitable client side event. I then used RPC call to server side, where I triggered the corresponding server side event, which I could listen in other parts of the app. The code is not public, but there is LazyLayout add-on that has similar type of implementation, which you could check as reference for your implementation.
https://github.com/alump/LazyLayouts/blob/master/lazylayouts-addon/src/main/java/org/vaadin/alump/lazylayouts/client/LazyVerticalLayoutConnector.java
I am using Vaadin-7 and this answer was not fix for me .
I am trying to import my js file under myproject/WebContent/js/test.js . I used #JavaScript in my UI class as below..
#Theme("myTheme")
#SuppressWarnings("serial")
#Title("VaadinTest")
#JavaScript("js/test.js")
public class VaadinTest extends UI {
#Override
protected void init(VaadinRequest request) {
final VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
setContent(layout);
}
}
But I got "NetworkError: 404 Not Found - http://localhost:8080/myproject/APP/PUBLISHED/js/test.js" error log in my firebug console.
So , how can I import js files from my custom directories ?
PS: Please don't be force me to create APP/PUBLISHED/ directory manually ! Thanks.
You can use app://:
#JavaScript({ "app://js/test.js" })
or use:
#JavaScript({ "vaadin://js/test.js" })
Generated url inside VAADIN folder:
http://localhost:8080/myproject/VAADIN/js/test.js
the file you refer to must be reachable by the classloader relative to the package you are using it in. according to your example, lets say your package of VaadinTest is com.example.app and you want to access it as js/test.js you have to put it in the directory com/example/app/js/test.js in a "root" for the classloader to find it (e.g. src/main/java,groovy or where resources are loaded from in your config).
I know we can use components with the admin generator (thanks to ~ symbol).
However, in the components.class.php, how to call the auto-generated class ?
At this moment, I'm using this :
require_once dirname(__FILE__).'/../lib/commissionGeneratorConfiguration.class.php';
require_once dirname(__FILE__).'/../lib/commissionGeneratorHelper.class.php';
class commissionComponents extends autoCommissionComponents
{
}
But I obtain this error :
Fatal error: Class 'autoCommissionComponents' not found in /home/site/liguelorraine/apps/saSecureLigueLorraine/modules/commission/actions/components.class.php on line 7
There are no automatically generated component classes. Just extends sfComponents as usual.