Simple NonVisualComponent Development Example

NEST.define("com.nxstinc.nest.component.example", {
MyAlert : function() {
	var clazz = function(id) {
		this.id = id;
		this.text = "Alert";
	};
	
	clazz.prototype = NEST.inherits("com.nxstinc.nest.component.NonVisualComponent");

	clazz.prototype.paint = function(context) {
		// If no UI element then implementation is not required
	};
	
	// Invoked method brought by external event
	clazz.prototype.alert = function() {
		alert(this.text);
	};
	
	// #ifdef designing
	clazz.prototype.editor = function() {
		var d = {
			palette : {
				category : "Example",
				alias : undefined,
				priority : 2,
			},
			property : {
				text : {
					type : "string",
					category : "Setup",
					priority : 1,
				},
			},
			event : {
				onAfterAlert : {
					priority : 1,
				},
			},
			method : {
				alert : {
					priority : 1,
				},
			},
		};
		return d;
	};
	// #endif designing

	return clazz;
}
});