All Projects → OrienteerBAP → vuecket

OrienteerBAP / vuecket

Licence: Apache-2.0 license
Power of Vue.JS married with magic of Apache Wicket

Programming Languages

java
68154 projects - #9 most used programming language
javascript
184084 projects - #8 most used programming language
HTML
75241 projects
CSS
56736 projects
Vue
7211 projects

Projects that are alternatives of or similar to vuecket

Re Web
Experimental web framework for ReasonML & OCaml
Stars: ✭ 237 (+664.52%)
Mutual labels:  web-framework
Flutter
Flutter makes it easy and fast to build beautiful apps for mobile and beyond
Stars: ✭ 133,413 (+430264.52%)
Mutual labels:  web-framework
wicket-orientdb
Everything you need to work with Apache Wicket and OrientDB
Stars: ✭ 33 (+6.45%)
Mutual labels:  wicket
Clevergo
👅 CleverGo is a lightweight, feature rich and high performance HTTP router for Go.
Stars: ✭ 246 (+693.55%)
Mutual labels:  web-framework
Flask
The Python micro framework for building web applications.
Stars: ✭ 57,408 (+185087.1%)
Mutual labels:  web-framework
helloworld-web
Hello World web application in 39 different ways in Java
Stars: ✭ 18 (-41.94%)
Mutual labels:  wicket
Sanic
Async Python 3.7+ web server/framework | Build fast. Run fast.
Stars: ✭ 15,660 (+50416.13%)
Mutual labels:  web-framework
farrow
A Type-Friendly Web Framework for Node.js
Stars: ✭ 748 (+2312.9%)
Mutual labels:  web-framework
Angular
The modern web developer’s platform
Stars: ✭ 78,336 (+252596.77%)
Mutual labels:  web-framework
jaulp-wicket
This project is a collection of Apache Wicket components and utilities.
Stars: ✭ 14 (-54.84%)
Mutual labels:  wicket
Cayenne
Mirror of Apache Cayenne
Stars: ✭ 250 (+706.45%)
Mutual labels:  web-framework
Yew
Yew is a modern Rust framework for creating multi-threaded front-end web apps with WebAssembly.
Stars: ✭ 18,243 (+58748.39%)
Mutual labels:  web-framework
igloo-parent
Our core toolbox based on Spring, Hibernate, Wicket and Bootstrap.
Stars: ✭ 15 (-51.61%)
Mutual labels:  wicket
Spirit
Modern modular library for building web applications
Stars: ✭ 241 (+677.42%)
Mutual labels:  web-framework
poggit
GitHub application for managing PocketMine-family plugins, and website for sharing plugins.
Stars: ✭ 96 (+209.68%)
Mutual labels:  web-framework
Cphalcon7
Dao7 - Web framework for PHP7.x,项目接洽 QQ 176013762
Stars: ✭ 237 (+664.52%)
Mutual labels:  web-framework
geofiddle
Geometric conversions between different formats and projections
Stars: ✭ 15 (-51.61%)
Mutual labels:  wicket
fano
Pascal web application framework
Stars: ✭ 90 (+190.32%)
Mutual labels:  web-framework
rocket
Light-weight web framework for Go
Stars: ✭ 26 (-16.13%)
Mutual labels:  web-framework
blogs
Demo application for blog posts at www.wicketinaction.com
Stars: ✭ 56 (+80.65%)
Mutual labels:  wicket

vuecket

Power of Vue.JS married with magic of Apache Wicket

Vuecket allows to be reactive on frontend and backend without coding of REST services.

Content

  1. Progress and Plans
  2. Guiding Principles
  3. Enabling Vuecket
  4. Association of Wicket and Vue Components
  5. Server-side methods
  6. Subscribing to Vue Events
  7. Watch data changes
  8. Data Fibers

Other documentation:

Current Progress and Plans

  • Loading of Vue components code
    • From JSON configuration
    • From Vue files
    • From NPM packages
  • Support of propogation of Vue events to server side: $on, $once, $watch
  • Support of data channels between server side and client
    • One Time - upon Vue component load
    • Observe - push changes to server side IMobel if they are changed on client one
    • Periodical refresh from server side
    • WebSocket based refresh from server side
  • Support of server based Vue methods

Guiding Principles

Vuecket idealogy following the following principals:

  1. Be declarative, not imperative
    • You can use VueJS 3rd party libraries and get benefits out of Vuecket even without modifying them
    • In a similar way, you can use 3rd party Apache Wicket component and just by adding VueBehavior (Behavior provided by Vuecket) you enable Vuecket benefits
  2. Provide 80% of functionality Out Of the Box, but do have good extension points for the remaining 20%

As you can see, btw, both Vue.Js and Apache Wicket fit this Guiding Principles as well.

Enabling Vuecket

Add the following dependency into your pom.xml:

<dependency>
   <groupId>org.orienteer.vuecket</groupId>
   <artifactId>vuecket</artifactId>
   <version>${project.version}</version>
</dependency>

If you are using SNAPSHOT version, please make sure that the following repository is included into your pom.xml:

<repository>
	<id>Sonatype Nexus</id>
	<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
	<releases>
		<enabled>false</enabled>
	</releases>
	<snapshots>
		<enabled>true</enabled>
	</snapshots>
</repository>

Association of Wicket and Vue Components

To start using of Vuecket power you should associate your server-side component(Wicket) and client-side component(Vue.js). You have 2 ways how to do that:

  • either through Annotations
  • or java code.

Vue.js components can be also defined by:

  • JSON description
  • VUE file
  • NPM package

Annotations

The following code will allow you to make from common Wicket Label component which supports Markdown

@VueNpm(packageName = "vue-markdown", path = "dist/vue-markdown.js", enablement = "Vue.use(VueMarkdown)")
public class VueMarkdown extends Label {

	public VueMarkdown(String id, IModel<?> model) {
		super(id, model);
	}

	public VueMarkdown(String id, Serializable label) {
		super(id, label);
	}

	public VueMarkdown(String id) {
		super(id);
	}
	
	@Override
	protected void onComponentTag(ComponentTag tag) {
		tag.setName("vue-markdown");
		super.onComponentTag(tag);
	}
}

Check the following annotations: @VueJson, @VueFile and @VueNpm

Directly on Wicket Componet

add(new VueComponent<String>("app")
      .setVueDescriptor("{ data: { message : 'Hello Vue'}}")
);

add(new VueComponent<String>("app2")
      .setVueDescriptor(new PackageResourceReference(HomePage.class,"HomePage.app2.vue"))
);

add(new Label("app3").add(new VueBehavior(new VueJsonDescriptor("{ data: { message : 'Hello Vue'}}"))));

Server-side methods

Vuecket can work transparantly for Vue code. But you can add more spice by invoking server based methods from your Vue code.

There are 2 ways how you can use Vuecket server methods:

  • vcInvoke - asynchronous invokation of server method. No reply from server expected. But server side method has possiblity to "push" some changes to the client side, if needed.
  • vcCall - return Promise which will contain response from server side

Example from test Vuecket application:

add(new VueComponent<Object>("app5") {
	@VueMethod("count")
	public void updateCountModel(IVuecketMethod.Context ctx, int count) {
		IVuecketMethod.pushDataPatch(ctx, "server", "Hello from server #"+count);
	}
}.setVueDescriptor("{ data: { count : 0, server: 'Hello from client side' }}"));
<div>
	<h1>App #5</h1>
	<div wicket:id="app5">
		<button @click="count++; vcInvoke('count', count)">Clicked {{count}} times</button>
		{{ server }}
	</div>
</div>

Subscribing to Vue Events

It might be helpful to subscribe to particular Vue Events on server side. To do that you can use @VueOn and @VueOnce annotations for methods which needs to be invoked if event occur on client side. Example:

@VueOn("increase")
public void showIncrease(int count) {
	System.out.println("On Increase called. Recieved count = "+count);
}
<button @click="$emit('increase', count)">Test Emit</button>

Watch data changes

In the similiar way you can subscribe server side method to changes of data on client side by using @VueWatch annotation

@VueWatch("count")
public void countChanged(Integer newCount, Integer oldCount) {
	System.out.println("Count changed from "+oldCount+" to "+newCount);
}
<button @click="count++">Clicked {{count}} times</button>

Data Fibers

Data fiber is a way to synchronize data between server side and browser. There are different types of data-fibers

  • load - data will be provided only for initial Vue component loading
  • observe - data will be sent back to server upon any change
  • refresh - data periodically checked for changes and if there are any - they will be uploaded
  • wspush - data pushed to client server through WebSocket if there are changes (NOT YET SUPPORTED)

Example:

//Value of this model will be initially load to all connected clients and then kept update upon changes
private static final IModel<String> HELLO_MODEL = Model.of("Hello from server");
...
VueComponent<Object> app6 = new VueComponent<Object>("app6", HELLO_MODEL)
				.setVueDescriptor("{ data: { text : 'Hello Vue'}}")
				.addDataFiber("text");  // <===Pay attention to this call. It binds default IModel to 'text' data fiber
app6.add(new VueMarkdown("markdown", ""));
add(app6);
<div>
	<h1>App #6</h1>
	<div wicket:id="app6">
		<textarea v-model="text"></textarea>
		<vue-markdown wicket:id="markdown" v-bind:source="text">Application 6</vue-markdown>
	</div>
</div>
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].