]> git.argeo.org Git - gpl/argeo-slc.git/blob - server/org.argeo.slc.ria/src/argeo-ria-lib/sample/class/org/argeo/ria/sample/Applet.js
Move to src
[gpl/argeo-slc.git] / server / org.argeo.slc.ria / src / argeo-ria-lib / sample / class / org / argeo / ria / sample / Applet.js
1 /**
2 * A simple Hello World applet for documentation purpose.
3 * The only associated command is the "Close" command.
4 */
5 qx.Class.define("org.argeo.ria.sample.Applet",
6 {
7 extend : qx.ui.container.Composite,
8 implement : [org.argeo.ria.components.IView],
9
10 construct : function(){
11 this.base(arguments);
12 this.setLayout(new qx.ui.layout.VBox());
13 this.passedStatus = "PASSED";
14 this.failedStatus = "FAILED";
15 },
16
17 properties :
18 {
19 /**
20 * The viewPane inside which this applet is added.
21 */
22 view : {
23 init : null
24 },
25 /**
26 * Commands definition, see {@link org.argeo.ria.event.CommandsManager#definitions}
27 */
28 commands : {
29 init : {
30 "close" : {
31 label : "Close Result",
32 icon : "resource/slc/window-close.png",
33 shortcut : "Control+w",
34 enabled : true,
35 menu : "Applet",
36 toolbar : "result",
37 callback : function(e){
38 // Call service to delete
39 this.getView().empty();
40 },
41 command : null
42 }
43 }
44 },
45 viewSelection : {
46 nullable:false,
47 check:"org.argeo.ria.components.ViewSelection"
48 },
49 instanceId : {init:"Hello Applet"},
50 instanceLabel : {init:"Hello"}
51
52 },
53
54 members :
55 {
56 /**
57 * Called at applet creation. Just registers viewPane.
58 * @param viewPane {org.argeo.ria.components.ViewPane} The viewPane.
59 */
60 init : function(viewPane, data){
61 this.setView(viewPane);
62 this.setViewSelection(new org.argeo.ria.components.ViewSelection(viewPane.getViewId()));
63 this.data = data;
64 this.setInstanceId(data[0]);
65 this.setInstanceLabel("Hello applet #"+data[0]);
66 },
67
68 /**
69 * Load a given row : the data passed must be a simple data array.
70 * @param data {Element} The text xml description.
71 */
72 load : function(){
73 this.createHtmlGui("<b>Hello World ! Data ID is : "+this.getInstanceId()+"</b>");
74 },
75
76 addScroll : function(){
77 return false;
78 },
79
80 close : function(){
81 return false;
82 },
83
84 /**
85 * Create a simple HtmlElement and and insert the html string..
86 * Not used but sample.
87 * @param htmlText {String} Html code to display.
88 */
89 createHtmlGui : function(htmlText){
90 var htmlElement = new qx.ui.embed.Html(htmlText);
91 htmlElement.setOverflowX("auto");
92 htmlElement.setOverflowY("auto");
93 this.add(htmlElement, {flex:1});
94 }
95
96 }
97 });