All Projects → manolo → Gwt Api Generator

manolo / Gwt Api Generator

Licence: apache-2.0
Generator for creating GWT JSInterop clients from Polymer Web Components

Programming Languages

javascript
184084 projects - #8 most used programming language
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Gwt Api Generator

vaadin-split-layout
The Web Component which allows you to partition a layout into resizeable areas. Part of the Vaadin components.
Stars: ✭ 40 (-18.37%)
Mutual labels:  polymer, webcomponents
polymerx-cli
⚡ Unlock the power of Polymer 3, Web Components and modern web tools.
Stars: ✭ 30 (-38.78%)
Mutual labels:  polymer, webcomponents
vaadin-checkbox
The Web Component for customized checkboxes. Part of the Vaadin components.
Stars: ✭ 18 (-63.27%)
Mutual labels:  polymer, webcomponents
auth-ajax
Auth token handling for Polymer
Stars: ✭ 15 (-69.39%)
Mutual labels:  polymer, webcomponents
Vaadin Core
An evolving set of free, open source web components for building mobile and desktop web applications in modern browsers.
Stars: ✭ 382 (+679.59%)
Mutual labels:  webcomponents, polymer
multiselect-combo-box
A multi select combo box web component based on Polymer and the vaadin-combo-box
Stars: ✭ 41 (-16.33%)
Mutual labels:  polymer, webcomponents
vaadin-icons
Vaadin Icons is a collection of 600+ unique icons designed for web applications
Stars: ✭ 59 (+20.41%)
Mutual labels:  polymer, webcomponents
file-fire
Simple way to upload and download files from Firebase Storage.
Stars: ✭ 13 (-73.47%)
Mutual labels:  polymer, webcomponents
Google Chart
Google Charts API web components
Stars: ✭ 284 (+479.59%)
Mutual labels:  webcomponents, polymer
Apollo Elements
🚀🌛 Use the Launch Platform 👩‍🚀👨‍🚀
Stars: ✭ 278 (+467.35%)
Mutual labels:  webcomponents, polymer
toggle-icon
toggle-icon is a custom element created with Polymer. It provides an extremely powerful and customizable switch that looks like a paper-icon-button.
Stars: ✭ 21 (-57.14%)
Mutual labels:  polymer, webcomponents
Vaadin
An evolving set of open source web components for building mobile and desktop web applications in modern browsers.
Stars: ✭ 424 (+765.31%)
Mutual labels:  webcomponents, polymer
skeleton-carousel
Carousel component. Horizontal and vertical swipe navigation
Stars: ✭ 31 (-36.73%)
Mutual labels:  polymer, webcomponents
vaadin-context-menu
The responsive Web Component for showing context dependent items for any element on the page. Part of the Vaadin components.
Stars: ✭ 26 (-46.94%)
Mutual labels:  polymer, webcomponents
lego
🚀 Web-components made lightweight & Future-Proof.
Stars: ✭ 69 (+40.82%)
Mutual labels:  polymer, webcomponents
dom-repeat-n
[Polymer 1.x] A template element that repeat n times its content.
Stars: ✭ 20 (-59.18%)
Mutual labels:  polymer, webcomponents
polymer-ui-router
UI-router wrapper for Web Components
Stars: ✭ 24 (-51.02%)
Mutual labels:  polymer, webcomponents
scheduler-component
A Web Component wrapper for FullCalendar library that uses Polymer version 2.0 and ES6.
Stars: ✭ 24 (-51.02%)
Mutual labels:  polymer, webcomponents
vaadin-text-field
The themable Web Component providing input controls. Part of the Vaadin components.
Stars: ✭ 29 (-40.82%)
Mutual labels:  polymer, webcomponents
Awesome Polymer
A collection of awesome Polymer resources.
Stars: ✭ 384 (+683.67%)
Mutual labels:  webcomponents, polymer

gwt-api-generator

gwt-api-generator is a tool that produces GWT Java APIs for JavaScript libraries provided as input, assuming their APIs are decorated with JSDoc annotations.

Currently the generator only supports Web Components written in Polymer 1.0 syntax. Support for other type of JavaScript sources might be added in the future.

Original motivation behind the project was to provide GWT community an easy access to the elements in Vaadin Elements collection.

Notice: Vaadin transferred the ownership of this library to the community by 20 Apr 2017, thus Vaadin no longer provides support or does active development on it.

Installation and Usage

  • Installation
$ npm install -g vaadin/gwt-api-generator

If you've installed node and npm using sudo, installing packages globally will also require you to use sudo. See http://givan.se/do-not-sudo-npm/ how to remedy the situation.

  • Generating java code for bower packages installed in your bower_components folder

    $ bower install my-web-component
    $ gwt-api-generator
    
  • Generating java code for a complete library

    $ gwt-api-generator --package=PolymerElements/paper-elements
    
  • Generating resources with a custom groupId and artifactId

    $ gwt-api-generator --package=PolymerElements/paper-elements \
                      --groupId=com.foo --artifactId=bar
    
  • Generating resources for a non-maven structure

    $ gwt-api-generator --package=PolymerElements/paper-elements
                        --javaDir=src --resourcesDir=src
    
  • Generating maven pom.xml file and packaging the result as a ready-to-use .jar file

    $ gwt-api-generator --package=PolymerElements/paper-elements --pom
    $ mvn package
    

Pre-built packages

Paper, Iron, App, Platinum, and Vaadin-Core elements

Vaadin officially maintains and supports a pre-built package deployed at Maven Central repository containing all the resources needed for using Polymer paper-elements, app-elements, platinum-elements, iron-elements and vaadin-core-elements in a GWT application.

Build script, demo and usage instructions for the project are available here.

You also might see all these components in action using the Show Case application

Using your own Web Components in your App.

Whether you need a 3 party element not included in the prebuilt packages or you want to maintain your own set of components, you can setup your maven project to automatically generate Java interfaces during the build process just following the next steps.

  1. Create a package.json with the gwt-api-generator package dependency:

     {
       "name": "my-app",
       "description": "my-app",
       "version": "1.0",
       "license": "my-prefered-license",
       "dependencies": {
         "gwt-api-generator": "vaadin/gwt-api-generator"
       }
     }
    
  2. Create a bower.json to add all 3rd party elements your application depends on, in this example we add a library for binding data to pouchdb/couchdb databases:

     {
       "name": "my-app",
       "description": "my-app",
       "main": "",
       "license": "my-prefered-license",
       "dependencies": {
         "vaadin-pouchdb": "manolo/vaadin-pouchdb"
       }
     }
    
  3. Make your maven build script to automatically install node, npm and bower, download all elements, generate java classes and bundle static stuff in your package:

     <!-- install node, npm, bower, and your components -->
     <plugin>
       <groupId>com.github.eirslett</groupId>
       <artifactId>frontend-maven-plugin</artifactId>
       <executions>
         <execution>
           <id>install node and npm</id>
           <phase>generate-resources</phase>
           <goals>
             <goal>install-node-and-npm</goal>
           </goals>
           <configuration>
             <nodeVersion>v6.2.0</nodeVersion>
           </configuration>
         </execution>
         <execution>
           <id>npm install</id>
           <goals>
             <goal>npm</goal>
           </goals>
           <configuration>
             <arguments>install</arguments>
           </configuration>
         </execution>
         <execution>
           <id>bower install</id>
           <goals>
             <goal>bower</goal>
           </goals>
           <configuration>
             <arguments>install</arguments>
           </configuration>
         </execution>
       </executions>
     </plugin>
    
     <!-- Generate java code for all web downloaded components -->
     <plugin>
       <artifactId>maven-antrun-plugin</artifactId>
       <version>1.7</version>
       <executions>
         <execution>
           <phase>generate-resources</phase>
           <configuration>
             <target>
               <exec
                 dir="${project.basedir}"
                 executable="node_modules/.bin/gwt-api-generator">
               </exec>
             </target>
           </configuration>
           <goals>
             <goal>run</goal>
           </goals>
         </execution>
       </executions>
     </plugin>
    

About GWT 2.7/2.8 compatibility

Vaadin gwt-api-generator produces @JsType interfaces for JS Element level access from Java Objects.

Since JsInterop was a feature experimental in GWT-2.7.0 and stable in GWT-2.8.0, and its implementation has absolutly changed from the experimental to the stable API, we have decided not to support old releases anymore, starting with gwt-api-generator 1.2.1.

Modifying the bower_components folder

The gwt-polymer-elements library is bundled with all web components placed in a the bower_components folder. Though, the developer might change this location by setting the window.gwtBowerLocation property, or by calling the Polymer.setGwtBowerLocation(location) method in the application entry point.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].