2 * A Basic IView implementation displaying a fake list of result and opening
3 * an org.argeo.ria.sample.Applet
5 qx
.Class
.define("org.argeo.ria.sample.List",
7 extend
: qx
.ui
.container
.Composite
,
8 implement
: [org
.argeo
.ria
.components
.IView
],
10 construct : function(){
11 this.base(arguments
, new qx
.ui
.layout
.VBox());
12 var model
= new qx
.ui
.table
.model
.Simple();
13 model
.setColumns(["Test Case", "Date"]);
14 this.table
= new qx
.ui
.table
.Table(model
, {
15 tableColumnModel: function(obj
){
16 return new qx
.ui
.table
.columnmodel
.Resize(obj
)
24 * The viewPane containing this applet.
30 * The applet commands.
36 icon
: "resource/slc/media-playback-start.png",
37 shortcut
: "Control+o",
40 toolbar
: "selection",
41 callback : function(e
){
42 var viewsManager
= org
.argeo
.ria
.components
.ViewsManager
.getInstance();
43 var classObj
= org
.argeo
.ria
.sample
.Applet
;
44 var rowData
= viewsManager
.getViewPaneSelection("list").getNodes();
45 var iView
= viewsManager
.initIViewClass(classObj
, "applet", rowData
[0]);
48 selectionChange : function(viewId
, rowData
){
49 if(viewId
!= "list") return;
50 this.setEnabled(false);
51 if(rowData
== null || !rowData
.length
) return;
52 this.setEnabled(true);
60 check
:"org.argeo.ria.components.ViewSelection"
62 instanceId
: {init
:"0"},
63 instanceLabel
: {init
:"Sample List"}
67 init : function(viewPane
, data
){
68 this.setView(viewPane
);
69 this.setViewSelection(new org
.argeo
.ria
.components
.ViewSelection(viewPane
.getViewId()));
74 // Customize table appearance
77 statusBarVisible
: false,
78 showCellFocusIndicator
:false,
79 columnVisibilityButtonVisible
:false,
80 contextMenu
: org
.argeo
.ria
.event
.CommandsManager
.getInstance().createMenuFromIds(["opentest", "download", "copytocollection", "deletetest"]),
81 decorator
: new qx
.ui
.decoration
.Background("#fff")
85 // Link table selection changes to the standard viewSelection mechanism
87 var selectionModel
= this.table
.getSelectionManager().getSelectionModel();
88 selectionModel
.addListener("changeSelection", function(e
){
89 var viewSelection
= this.getViewSelection();
90 viewSelection
.clear();
91 if(!selectionModel
.getSelectedCount()){
94 var ranges
= selectionModel
.getSelectedRanges();
95 var rowData
= this.table
.getTableModel().getRowData(ranges
[0].minIndex
);
96 viewSelection
.addNode(rowData
);
100 // Add table to the GUI component
102 this.add(this.table
, {flex
:1});
105 // Now create fake rows
107 var model
= this.table
.getTableModel();
115 addScroll : function(){