All Projects → raydac → go-gwt-example

raydac / go-gwt-example

Licence: Apache-2.0 license
Example of GWT as frontend for Golang application

Programming Languages

java
68154 projects - #9 most used programming language
go
31211 projects - #10 most used programming language
HTML
75241 projects
CSS
56736 projects

Projects that are alternatives of or similar to go-gwt-example

Gwt Eclipse Plugin
GWT Eclipse Plugin Documentation
Stars: ✭ 100 (+488.24%)
Mutual labels:  gwt
Traccar Web
Traccar Web UI mod
Stars: ✭ 154 (+805.88%)
Mutual labels:  gwt
domino-jackson
Jackson with Annotation processing
Stars: ✭ 46 (+170.59%)
Mutual labels:  gwt
Elemental2
Type checked access to browser APIs for Java code.
Stars: ✭ 115 (+576.47%)
Mutual labels:  gwt
Gwt Polymer Elements
Polymer Web Components for GWT. A collection of Material Design widgets for desktop and mobile.
Stars: ✭ 153 (+800%)
Mutual labels:  gwt
Bitcoin Transaction Explorer
Simple and pure block explorer you can run on top of a full node
Stars: ✭ 165 (+870.59%)
Mutual labels:  gwt
Autorest
Auto RESTful Service Proxy Generator for GWT
Stars: ✭ 76 (+347.06%)
Mutual labels:  gwt
vavr-gwt
GWT module for Vavr
Stars: ✭ 20 (+17.65%)
Mutual labels:  gwt
Gwt Maven Plugin
Starting fresh on building GWT projects with Maven
Stars: ✭ 153 (+800%)
Mutual labels:  gwt
picocog
A tiny code generation library (< 8 KB) written in Java, useful for any purpose, but ideal for JSR-269
Stars: ✭ 82 (+382.35%)
Mutual labels:  gwt
Gwt Maven Archetypes
Stars: ✭ 134 (+688.24%)
Mutual labels:  gwt
Gwt Maven Plugin
Legacy GWT Maven Plugin
Stars: ✭ 145 (+752.94%)
Mutual labels:  gwt
Vue Gwt
Vue.js Components/Custom Elements in Java with GWT. Developed at https://www.genmymodel.com.
Stars: ✭ 194 (+1041.18%)
Mutual labels:  gwt
Gwt Jackson
gwt-jackson is a JSON parser for GWT. It uses Jackson 2.x annotations to customize the serialization/deserialization process.
Stars: ✭ 110 (+547.06%)
Mutual labels:  gwt
j4ts
Core Java APIs for TypeScript / JavaScript / JSweet
Stars: ✭ 92 (+441.18%)
Mutual labels:  gwt
Apollo
Genome annotation editor with a Java Server backend and a Javascript client that runs in a web browser as a JBrowse plugin.
Stars: ✭ 93 (+447.06%)
Mutual labels:  gwt
Dashbuilder
Dashboard composition tooling based on the Uberfire framework
Stars: ✭ 163 (+858.82%)
Mutual labels:  gwt
gdx-freetype-gwt
Freetype for gwt
Stars: ✭ 41 (+141.18%)
Mutual labels:  gwt
webfx
A JavaFX application transpiler. Write your Web Application in JavaFX and WebFX will transpile it in pure JS.
Stars: ✭ 210 (+1135.29%)
Mutual labels:  gwt
Swellrt
SwellRT main project. Server, JavaScript and Java clients
Stars: ✭ 205 (+1105.88%)
Mutual labels:  gwt

golang-gwt

Introduction

Golang doesn't provide any GUI out of the box, there are some 3rd party libraries for that but unfortunately not many of them work in real cross-platform manner or provide rich set of features and nice GUI. Fortunately today we have WEB as modern cross-platform UI technology which provides even more than we need.

In 2010 I took a part in a big project which strongly used GWT for frontend part and I decided that it would be interesting to try to organize GUI for a golang application through GWT which would be used as frontend (also it would make possibility to use powerful GWT extensions like GWT-Ext or Smart-GWT). Of course it sounds very heterogenic and usually such projects make pain (especially in Golang which doesn't provide strong possibilities for build and dependency management out of the box) but because GWT is a Java based technology then it is possible to use Maven to build both Java part and Golang part in the same project without problems (Golang part will be built through mvn-golang plugin).

Project structure

The Project contains two parts

  • frontend part written in GWT, all stuff related to the front end part is situated in the frontend folder
  • backend part written in Golang, al stuff related to the backend part is situated in the backend folder

It is not just regular web service because:

  • it starts on 127.0.0.1 local address
  • it doesn't have fixed port number, just after start it looks for free port and open default web browser by providing formed page URL
  • it will be closed in 5 seconds after GUI part in browser is closed by user

Frontend part

The Part doesn't have any magic and implemented as a single web age aplication which shows text field and button. If enter some text into the text field and then press the send button then the entered text will be sent to the Golang part and the returned result will be shown just under the text field. Also the timer label situated just under the text feld shows the current time gotten from the Goang part. The Compiled part takes a bit more space tha it could be ecause I ave trned off GWT obfuscation to provide better diagnostic information. All communication with the backend part is based on GET and POST requests, there is not any web-socket use.

Backend part

It is a just simple Golang application implementing web server. Just after start it finds first free port and use it to start inside web server on local address 127.0.0.1, after that it opens the link to the inside main web page in default system browser. If it doesn't get requests from its frontend part during 5 seconds then it guesses that its frontend part has been closed and end execution.
As third party libraries I use below listed ones:

  • open-golang to open default system browser for provded URL
  • go-bindata to pack frontend static data into executable file

Requirements for build

It requires pre-installed Java SDK 1.8+ and Maven 3.0.3+ on your machine. Because the project uses mvn-golang-wrapper it will automatically download GoLang SDK.
NB! Java is needed only for build purposes! As the build result there will be just standard Golang executable file which can be delivered and started without any Java!

How to build

You can just clone the project through git clone https://github.com/raydac/go-gwt-example.git and then execute mvn command inside cloned folder (the project has default goals clean install)

Where to look for executable file?

After build you can open backend/bin folder and there will be backend-1.0.0-SNAPSHOT or backend-1.0.0-SNAPSHOT.exe executable file which is the result file. If to execute such file then default system browser will be started and frontend part will be shown.

screenshot

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].