Creating a CustomNode is very easy. A template is unnecessary. But when this CustomNode shall be Resizable things start to become a little bit more complicated.

Therefore I have created a template that can be used:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
public class MyCustomNode extends CustomNode, Resizable {
  override var width on replace { requestLayout() }
  override var height on replace { requestLayout() }
  override var layoutBounds = bind BoundingBox {
        width: this.width
        height: this.height
    }  

  init {
    children =[
      Rectangle {
        width: bind width
        height: bind height      
      }
    ]
  }

  override function getPrefWidth( number ) {
    //return your pref width - hard coded values are ok for most cases
  }

  override function getPrefHeight( number ) {
    //return your pref height - hard coded values are ok for most cases
  }

  /*
  //It is not absolutly necessary to override those methods, but strongly recommended.
  override function getMaxWidth() {
    //Return the max width
  }

  override function getMaxHeight() {
    //Return the max height
  }

  override function getMinWidth() {
    //Return the min width
  }

  override function getMinHeight() {
    //Return the min height
  }*/

}

There is a post containing a template for CustomControls here.