Last change
on this file since 443 was
443,
checked in by hendrikvanantwerpen, 12 years ago
|
Reorganized for Node --- the SVN gods hate us all!
Lost all historical info on moved files, because SVN is a f *.
Also we have Node now, serving both the static content and forwarding
database requests.
|
File size:
1.5 KB
|
Line | |
---|
1 | define([ |
---|
2 | 'dojo/_base/declare', |
---|
3 | 'dijit/registry' |
---|
4 | ],function(declare,registry){ |
---|
5 | |
---|
6 | var Content = declare(null,{ |
---|
7 | _started: false, |
---|
8 | _container: null, |
---|
9 | _previousContent: null, |
---|
10 | startup: function() { |
---|
11 | if ( this._started ) { return; } |
---|
12 | |
---|
13 | this._container = registry.byId('content'); |
---|
14 | if ( !this._container || !this._container.addChild ) { |
---|
15 | throw new Error("Cannot find container widget with id 'content'."); |
---|
16 | } |
---|
17 | |
---|
18 | this._toaster = registry.byId('toaster'); |
---|
19 | if ( !this._toaster || !this._toaster.setContent ) { |
---|
20 | throw new Error("Cannot find toaster widget with id 'toaster'."); |
---|
21 | } |
---|
22 | |
---|
23 | this._started = true; |
---|
24 | }, |
---|
25 | set: function(widget) { |
---|
26 | if ( !this._started ) { |
---|
27 | throw new Error('Call startup() before setting content.'); |
---|
28 | } |
---|
29 | if ( this._previousContent ) { |
---|
30 | this._previousContent.destroyRecursive(); |
---|
31 | this._previousContent = null; |
---|
32 | } |
---|
33 | widget.region = 'center'; |
---|
34 | this._container.addChild(widget); |
---|
35 | this._previousContent = widget; |
---|
36 | }, |
---|
37 | notify: function(text,type) { |
---|
38 | if ( !this._started ) { |
---|
39 | throw new Error('Call startup() before setting content.'); |
---|
40 | } |
---|
41 | this._toaster.setContent(text,type || 'message'); |
---|
42 | } |
---|
43 | }); |
---|
44 | |
---|
45 | return new Content(); |
---|
46 | }); |
---|
Note: See
TracBrowser
for help on using the repository browser.