/* This is the JS code that goes together with the markup found in XmlResourceParserTest.class.xml */ // create the constructor for the prototype (super class) var MyListPanel = BiXmlResourceParser.getClassFromDocument( application.getResourceById("test-class-xml").getDocument() ); _p = MyListPanel.prototype; _p._className = "MyListPanel"; // override addXmlNode to add list items into the list _p.addXmlNode = function ( oNode, oXmlResourceParser ) { if ( oNode.nodeType == 1 ) // ELEMENT { var list = this.getComponentById( "list" ); var c = oXmlResourceParser.fromNode( oNode ); if ( c instanceof BiListItem ) list.add( c ); else BiComponent.prototype.addXmlNode.apply( this, arguments ); } }; // create getter and setter for caption so we can set the caption _p.setCaption = function ( s ) { var label = this.getComponentById( "label" ); label.setText( s ); }; _p.getCaption = function () { var label = this.getComponentById( "label" ); return label.getText(); }; _p.close = function () { alert( "Close " + this.getCaption() ); };