New Version of HTML-APIs released

The NetBeans Team has announced the upcoming new version of the HTML for Java APIs. Version 1.1 brings one major change with it: You can now bind models to a specific Element of the DOM tree identified by it’s id. This makes it easier to structure your ViewModel.

Here’s a simple example:

<div id="one">
  <input data-bind="value: name" />
</div>

<div id="two">
  <input data-bind="value: name" />
</div>

And your model class looks like this:

@Model{name="Person", properties={@Property(name="name", type= String.class)}}
public class PersonModel{}

Then you can bind different ViewModel Instances to the different parts of the View:

Person vm = new Person("Tom");
Models.applyBindings(vm,"one");
Person vm2 = new Person("Dick");
Models.applyBindings(vm2,"two");

Check out the API doc with all changes here.