]>
git.argeo.org Git - gpl/argeo-slc.git/blob - org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/components/ViewPane.js
25e8f10e6b186651ca8a6c1d3a7ff32f0668dc44
5 * This is the main application class of your custom application "sparta"
7 qx
.Class
.define("org.argeo.ria.components.ViewPane",
9 extend
: qx
.ui
.container
.Composite
,
10 implement
: [org
.argeo
.ria
.components
.ILoadStatusable
],
12 construct : function(application
, viewId
, viewTitle
, splitPaneData
){
14 this.setApplication(application
);
15 this.setViewId(viewId
);
16 this._defaultViewTitle
= viewTitle
;
17 this.setViewTitle(viewTitle
);
18 var viewSelection
= new org
.argeo
.ria
.components
.ViewSelection(viewId
);
19 this.setViewSelection(viewSelection
);
21 this.setSplitPaneData(splitPaneData
);
28 application
: {init
: null},
30 viewTitle
: {init
:"", event
:"changeViewTitle"},
31 viewSelection
: { nullable
:false },
32 ownScrollable
: {init
: false},
33 splitPaneData
: {init
: null},
34 commands
: {init
: null, nullable
:true}
38 *****************************************************************************
40 *****************************************************************************
45 createGui : function(){
46 this.setLayout(new qx
.ui
.layout
.VBox());
47 this.header
= new qx
.ui
.container
.Composite();
48 this.header
.setLayout(new qx
.ui
.layout
.Dock());
49 this.header
.set({appearance
:"app-header"});
50 this.headerLabel
= new qx
.ui
.basic
.Label(this.getViewTitle());
51 this.header
.add(this.headerLabel
, {edge
:"west"});
52 this.addListener("changeViewTitle", function(e
){
53 this.headerLabel
.setContent(e
.getData());
55 this.add(this.header
);
56 this.setDecorator(new qx
.ui
.decoration
.Single(1,"solid","#000"));
58 // Open close button of splitPane, not very useful at the moment.
59 if(this.getSplitPaneData()){
60 var data = this.getSplitPaneData();
61 var imgName = (data.orientation=="horizontal"?"go-left":"go-bottom");
62 var image = new qx.ui.basic.Image("resource/slc/"+imgName+".png");
63 image.addListener("click", function(e){
64 var image = e.getTarget();
65 var data = this.getSplitPaneData();
66 var functionDim = (data.orientation=="horizontal"?"Width":"Height");
67 var objectToResize = data.object || this;
68 var crtDim = objectToResize["get"+functionDim]();
69 var minimize = (data.orientation=="horizontal"?"go-right":"go-top");
70 var maximize = (data.orientation=="horizontal"?"go-left":"go-bottom");
71 if(crtDim > data.min){
72 objectToResize["set"+functionDim](data.min);
73 image.setSource("resource/slc/"+minimize+".png");
74 this.origDimension = crtDim;
76 if(this.origDimension){
77 objectToResize["set"+functionDim](this.origDimension);
78 image.setSource("resource/slc/"+maximize+".png");
82 this.header.add(image,{edge:"east"});
87 setContent : function(content
){
88 var addScrollable
= (content
.addScroll
?content
.addScroll():false);
90 this.setOwnScrollable(true);
91 this.scrollable
= new qx
.ui
.container
.Scroll(content
);
92 this.add(this.scrollable
, {flex
: 1});
94 this.content
= content
;
95 this.add(this.content
, {flex
:1});
99 setOnLoad : function(load
){
101 this.loadImage
= new qx
.ui
.basic
.Image('resource/slc/ajax-loader.gif');
104 this.header
.add(this.loadImage
, {edge
:"east"});
106 this.header
.remove(this.loadImage
);
111 if(this.getOwnScrollable() && this.scrollable
){
112 this.remove(this.scrollable
);
113 }else if(this.content
){
114 this.remove(this.content
);
116 if(this.getCommands()){
117 org
.argeo
.ria
.event
.CommandsManager
.getInstance().removeCommands(this.getCommands());
118 this.setCommands(null);
120 this.setViewTitle(this._defaultViewTitle
);