Skip to content

Instantly share code, notes, and snippets.

@dhavaln
Created September 29, 2011 16:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dhavaln/2b9848463355e7ae7d70 to your computer and use it in GitHub Desktop.
Save dhavaln/2b9848463355e7ae7d70 to your computer and use it in GitHub Desktop.
Vaadin jQuery Test
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Vaadin with jQuery</title>
<script type="text/javascript"
src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<script type="text/javascript"
src="http://cdn.jquerytools.org/1.2.3/jquery.tools.min.js"></script>
<!-- Define the application configuration -->
<script type="text/javascript">
//
var vaadin = {};
vaadin.vaadinConfigurations = {};
vaadin.vaadinConfigurations["jquerytest"] = {
appUri : '/vaadin-jquery-test/VAADIN',
pathInfo : '/',
versionInfo : {
vaadinVersion : "6.0.0-NONVERSIONED",
applicationVersion : "NONVERSIONED"
}
};
//
</script>
<!-- Load the widget set, that is, the Client-Side Engine -->
<script language='javascript'
src='/vaadin-jquery-test/VAADIN/widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet/com.vaadin.terminal.gwt.DefaultWidgetSet.nocache.js'></script>
</head>
<body>
<!-- An invisible history frame is needed for page/fragment history in browser -->
<iframe tabIndex="-1" id="__gwt_historyFrame"
style="position:absolute;width:0;height:0;border:0;overflow:hidden;"
src="javascript:false"></iframe>
<!-- So here comes the div element in which the Vaadin application is embedded. -->
<div id="jquerytest" style="height: 400px;"></div>
</body>
<script type="text/javascript">
$(document).ready(function() {
// Trap Vaadin button click event in JavaScript
$(".name").live("mouseover", function() {
$(this).attr("title", "Please enter your name").tooltip({
position : "center right",
effect : "fade",
offset : [ -2, 10 ],
opacity : 0.7
});
});
});
</script>
</html>
import com.vaadin.Application;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class Vaadin_jquery_testApplication extends Application {
@Override
public void init() {
Window mainWindow = new Window("Vaadin_jquery_test Application");
VerticalLayout vl = new VerticalLayout();
TextField tf = new TextField();
tf.addStyleName("name");
vl.addComponent(tf);
mainWindow.addComponent(vl);
setMainWindow(mainWindow);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>vaadin-jquery-test</display-name>
<context-param>
<description>
Vaadin production mode</description>
<param-name>productionMode</param-name>
<param-value>false</param-value>
</context-param>
<servlet>
<servlet-name>Vaadin_jquery_test Application</servlet-name>
<servlet-class>com.vaadin.terminal.gwt.server.ApplicationServlet</servlet-class>
<init-param>
<description>
Vaadin application class to start</description>
<param-name>application</param-name>
<param-value>com.example.vaadin_jquery_test.Vaadin_jquery_testApplication</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>Vaadin_jquery_test Application</servlet-name>
<url-pattern>/VAADIN/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>
@dhavaln
Copy link
Author

dhavaln commented Sep 29, 2011

in the test index.html file is at (eclipse project home)/WebContent/index.html

Simple URL should load the application: http://localhost:8080/(application name)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment