]> source.dussan.org Git - vaadin-framework.git/blob
4e9c5280b32e17e3d74c3c6f98955ce672b1ff1b
[vaadin-framework.git] /
1 window.com_vaadin_tests_components_javascriptcomponent_BasicJavaScriptComponent_ExampleWidget = function() {
2         var parentIds = [];
3         var connectorId = this.getConnectorId();
4         while(connectorId) {
5                 parentIds.push(connectorId);
6                 connectorId = this.getParentId(connectorId);
7         }
8         this.reportParentIds(parentIds);
9         
10         this.onStateChange = function() {
11                 var e = this.getElement();
12                 
13                 e.innerHTML = '';
14
15                 var row = 1;
16                 var log = function(text) {
17                         e.innerHTML = "<div>" + row++ + ". " + text + "</div>" + e.innerHTML;
18                 }
19                 
20                 log("Parent element className: " + this.getElement(this.getParentId()).className);
21                 
22                 var messages = this.getState().messages;
23                 for(var i = 0; i < messages.length; i++) {
24                         log("State message: " + messages[i]);
25                 }
26         }
27         
28         this.registerRpc({
29                 sendRpc: function(message) {
30                         this.getRpcProxy().sendRpc(message + " processed");
31                 }
32         });
33         
34         this.messageToClient = function(message) {
35                 this.messageToServer(message + " processed");
36         }
37 }