]>
git.argeo.org Git - gpl/argeo-slc.git/blob - server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/monitor/UploadView.js
1 qx
.Class
.define("org.argeo.slc.ria.monitor.UploadView", {
2 extend
: qx
.ui
.container
.Composite
,
3 implement
: [org
.argeo
.ria
.components
.IView
],
7 * The commands definition Map that will be automatically added and wired to the menubar and toolbar.
8 * See {@link org.argeo.ria.event.CommandsManager#definitions} for the keys to use for defining commands.
15 check
:"org.argeo.ria.components.ViewSelection"
20 instanceId
: {init
:""},
21 instanceLabel
: {init
:""}
24 construct : function(){
26 this.setLayout(new qx
.ui
.layout
.Basic
);
31 * The implementation should contain the GUI initialisation.
32 * This is the role of the manager to actually add the graphical component to the pane,
33 * so it's not necessary to do it here.
34 * @param viewPane {org.argeo.ria.components.ViewPane} The pane manager
35 * @param data {Mixed} Any object or data passed by the initiator of the view
38 init : function(viewPane
, data
){
39 this.setView(viewPane
);
40 this.setViewSelection(new org
.argeo
.ria
.components
.ViewSelection(viewPane
.getViewId()));
41 this.form
= new org
.argeo
.ria
.components
.upload
.UploadForm("uploadFrm", org
.argeo
.slc
.ria
.SlcApi
.getInstallModuleService());
42 this.form
.setLayout(new qx
.ui
.layout
.HBox(5));
43 this.fileWidget
= new org
.argeo
.ria
.components
.upload
.UploadField("uploadFile", "Choose a file");
45 this.form
.addListener("completed", function(e
){
46 this.fileWidget
.setFieldValue("");
47 var response
= this.form
.getIframeHtmlContent();
49 this.displayMessage(response
, 4000);
51 this.form
.addListener("sending", function(e
){
52 this.debug("Sending...");
53 this.displayMessage("Sending...");
55 this.fileWidget
.addListener("changeFieldValue", function(e
){
57 this.submitButton
.setEnabled(true);
61 this.submitButton
= new qx
.ui
.form
.Button("Upload");
62 this.submitButton
.setEnabled(false);
63 this.submitButton
.addListener("execute", function(e
){
64 if(this.fileWidget
.getFieldValue()!=""){
69 this.fileWidget
.getTextField().setWidth(200);
70 this.form
.add(this.fileWidget
);
71 this.form
.add(this.submitButton
);
72 this.messageLabel
= new qx
.ui
.basic
.Label("");
73 this.messageLabel
.setRich(true);
74 this.messageLabel
.setPadding(4,4,4,20);
75 this.form
.add(this.messageLabel
);
76 this.add(this.form
, {left
: 20, top
:20});
79 displayMessage : function(message
, timer
){
80 this.messageLabel
.setContent("<i>"+qx
.lang
.String
.stripTags(message
)+"</i>");
82 qx
.event
.Timer
.once(function(){
83 this.messageLabel
.setContent("");
88 * The implementation should contain the real data loading (i.o. query...)
95 * Whether this component is already contained in a scroller (return false) or not (return true).
98 addScroll : function(){return true;},
100 * Called at destruction time
101 * Perform all the clean operations (stopping polling queries, etc.)
103 close : function(){return true;}