Skip to content

Commit

Permalink
Added first release of java server side tools
Browse files Browse the repository at this point in the history
  • Loading branch information
Mirko Pasqualetti committed Jan 9, 2016
1 parent 1d6b0ff commit 0b85ff1
Show file tree
Hide file tree
Showing 33 changed files with 6,427 additions and 1 deletion.
17 changes: 17 additions & 0 deletions server/java/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre1.8.0_51">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0">
<attributes>
<attribute name="owner.project.facets" value="jst.web"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
1 change: 1 addition & 0 deletions server/java/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build/
36 changes: 36 additions & 0 deletions server/java/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>w2uitest</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>
12 changes: 12 additions & 0 deletions server/java/.settings/.jsdtscope
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="WebContent"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
<attribute name="hide" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind="output" path=""/>
</classpath>
7 changes: 7 additions & 0 deletions server/java/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
8 changes: 8 additions & 0 deletions server/java/.settings/org.eclipse.wst.common.component
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="w2uitest">
<wb-resource deploy-path="/" source-path="/WebContent" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
<property name="context-root" value="w2uitest"/>
<property name="java-output-path" value="/w2uitest/build/classes"/>
</wb-module>
</project-modules>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<runtime name="Apache Tomcat v7.0"/>
<fixed facet="wst.jsdt.web"/>
<fixed facet="jst.web"/>
<fixed facet="java"/>
<installed facet="java" version="1.8"/>
<installed facet="jst.web" version="3.0"/>
<installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Window
3 changes: 3 additions & 0 deletions server/java/WebContent/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Class-Path:

18 changes: 18 additions & 0 deletions server/java/WebContent/WEB-INF/web.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>w2ui java server side example</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>

<servlet>
<servlet-name>W2uiGridExample</servlet-name>
<servlet-class>com.w2ui.servlets.example.W2uiGridExample</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>W2uiGridExample</servlet-name>
<url-pattern>/users.list</url-pattern>
</servlet-mapping>


</web-app>
112 changes: 112 additions & 0 deletions server/java/WebContent/index.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="http://w2ui.com/src/w2ui.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script type="text/javascript" src="http://w2ui.com/src/w2ui.js"></script>
</head>
<body>
<div id="users" style="width: 100%; height: 600px;"></div>
</body>
<script>
$(function () {
// define and render grid
$('#users').w2grid({
name : 'users',
url : 'users.list',
header : 'List of Users',
show: {
header : true,
toolbar : true,
footer : true,
toolbarAdd : true,
toolbarDelete : true
},
columns: [
{ field: 'fname', caption: 'First Name', size: '150px', searchable: true },
{ field: 'lname', caption: 'Last Name', size: '150px', searchable: true },
{ field: 'email', caption: 'Email', size: '100%', searchable: true },
{ field: 'login', caption: 'Login', size: '150px', searchable: true }
],
onAdd: function (event) {
editUser(0);
},
onDblClick: function (event) {
editUser(event.recid);
}
});
// defined form
$().w2form({
name : 'user_edit',
url : 'users.php',
style : 'border: 0px; background-color: transparent;',
formHTML:
'<div class="w2ui-page page-0">'+
' <div class="w2ui-label">First Name:</div>'+
' <div class="w2ui-field">'+
' <input name="fname" type="text" size="35"/>'+
' </div>'+
' <div class="w2ui-label">Last Name:</div>'+
' <div class="w2ui-field">'+
' <input name="lname" type="text" size="35"/>'+
' </div>'+
' <div class="w2ui-label">Email:</div>'+
' <div class="w2ui-field">'+
' <input name="email" type="text" size="35"/>'+
' </div>'+
' <div class="w2ui-label">Login:</div>'+
' <div class="w2ui-field">'+
' <input name="login" type="text" size="25"/>'+
' </div>'+
' <div class="w2ui-label">Password:</div>'+
' <div class="w2ui-field">'+
' <input name="password" type="password" size="25"/>'+
' </div>'+
'</div>'+
'<div class="w2ui-buttons">'+
' <input type="button" value="Cancel" name="cancel">'+
' <input type="button" value="Save" name="save">'+
'</div>',
fields: [
{ name: 'fname', type: 'text', required: true },
{ name: 'lname', type: 'text', required: true },
{ name: 'email', type: 'email' },
{ name: 'login', type: 'text', required: true },
{ name: 'password', type: 'text', required: false },
],
actions: {
"save": function () {
this.save(function (data) {
if (data.status == 'success') {
w2ui['users'].reload();
$().w2popup('close');
}
// if error, it is already displayed by w2form
});
},
"cancel": function () {
$().w2popup('close');
},
}
});
});
function editUser(recid) {
$().w2popup('open', {
title : (recid == 0 ? 'Add User' : 'Edit User'),
body : '<div id="user_edit" style="width: 100%; height: 100%"></div>',
style : 'padding: 15px 0px 0px 0px',
width : 500,
height : 300,
onOpen : function (event) {
event.onComplete = function () {
w2ui['user_edit'].clear();
w2ui['user_edit'].recid = recid;
$('#w2ui-popup #user_edit').w2render('user_edit');
}
}
});
}
</script>
</html>
8 changes: 7 additions & 1 deletion server/java/readme.md
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
Contributions are welcome.
This example is an eclipse project; due to eclipse restrictions it does not include the w2ui.js of the repository
but i get the latest version from http:://w2ui.com/

The package org.json is taken from http://json.org/java/

To make your own Servlet for grid management derive it from com.w2ui.servlet.W2uiGridData

Loading

0 comments on commit 0b85ff1

Please sign in to comment.