1 | jsx3.util.Logger.getLogger("org.isocat").info("Loading class[org.isocat.gui.Info]"); |
---|
2 | |
---|
3 | /** |
---|
4 | * The Info dialog controller |
---|
5 | * @author Menzo.Windhouwer@mpi.nl |
---|
6 | */ |
---|
7 | jsx3.lang.Class.defineClass("org.isocat.gui.Info", null, [], function(Info, Info_prototype) { |
---|
8 | |
---|
9 | /** |
---|
10 | * The class logger |
---|
11 | */ |
---|
12 | Info.log = jsx3.util.Logger.getLogger("org.isocat.gui.Info"); |
---|
13 | |
---|
14 | /** |
---|
15 | * Get the Info text |
---|
16 | */ |
---|
17 | Info.getText = function() { |
---|
18 | /* |
---|
19 | * Get the info |
---|
20 | */ |
---|
21 | var uri = "http://localhost:8080/isocat/interface/JSXAPPS/ISOcat/xml/info.xml"; |
---|
22 | org.isocat.gui.Info.log.info("loading uri["+uri+"]"); |
---|
23 | |
---|
24 | var req = new jsx3.net.Request(new Date().getTime()); |
---|
25 | req.open("GET", uri, false); |
---|
26 | req.send(); |
---|
27 | |
---|
28 | return req.getResponseText(); |
---|
29 | }; |
---|
30 | |
---|
31 | /** |
---|
32 | * The root block of the component |
---|
33 | */ |
---|
34 | Info_prototype.view; |
---|
35 | |
---|
36 | /** |
---|
37 | * The Info text |
---|
38 | */ |
---|
39 | Info_prototype.text; |
---|
40 | |
---|
41 | /** |
---|
42 | * The close button |
---|
43 | */ |
---|
44 | Info_prototype.close; |
---|
45 | |
---|
46 | /** |
---|
47 | * Constructor |
---|
48 | */ |
---|
49 | Info_prototype.init = function(view) { |
---|
50 | org.isocat.gui.Info.log.info("initialize Info["+this+"]"); |
---|
51 | |
---|
52 | this.view = view; |
---|
53 | org.isocat.gui.Info.log.info("- Info view["+this.view+"]"); |
---|
54 | this.text = this.view.getDescendantOfName("info"); |
---|
55 | org.isocat.gui.Info.log.info("- Info text["+this.text+"]"); |
---|
56 | this.close = this.view.getDescendantOfName("close"); |
---|
57 | org.isocat.gui.Info.log.info("- close button["+this.close+"]"); |
---|
58 | |
---|
59 | this.text.setText(org.isocat.gui.Info.getText()); |
---|
60 | |
---|
61 | org.isocat.gui.Info.log.info("initialized Info["+this+"]"); |
---|
62 | |
---|
63 | this.view.controller = this; |
---|
64 | |
---|
65 | // create message |
---|
66 | var message = { |
---|
67 | jss: "org.pagebus.msg.Message", |
---|
68 | jssv: "1.0.0", |
---|
69 | header: { }, |
---|
70 | body: this |
---|
71 | }; |
---|
72 | |
---|
73 | // publish the message using PageBus |
---|
74 | window.PageBus.publish("org.isocat.gui.Info.init", message); |
---|
75 | }; |
---|
76 | |
---|
77 | /** |
---|
78 | * Set focus to the first field |
---|
79 | */ |
---|
80 | Info_prototype.focus = function() { |
---|
81 | this.view.focus(); |
---|
82 | // TIBCO hack: first the dialog needs to claim focus, then we can move the focus to the close button, the sleep takes care of the delay |
---|
83 | jsx3.sleep(function() { this.close.focus(); },"focusInfo",this,true); |
---|
84 | }; |
---|
85 | |
---|
86 | }); |
---|