#aidademo implementation

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

#aidademo implementation

Prashanth Hebbar
Hello Janko:
 
On Mon, Jan 19, 2009 at 11:15 PM, Janko Mivšek <[hidden email]> wrote:
 
Prashanth Hebbar wrote:
 
>     Your model is almost a replica of that from Aida tutorial, so you should
>     made it working without a problem if you followed and understood the
>     tutorial well. So, in ANewsApp implement the same view methods as they
>     are in ADemoAddressApp.
>
>
> Prashanth: Yes it is. I am able to open
> http://localhost:8888/aidademo.html and get my viewMain. However,
> trouble is when I am trying to link one of the items on the left nav bar
> with addLinkTo: site aidademo text: 'Mission' view: #mission.
> Here "aidademo" is not recognized.
 
 
site aidademo? Do you have a method #aidademo implemented somewhere? in
AIDASite?
 
Prashanth: no. I implemented #aidademo (just copied #demo) but still the mission page points to demo.html. Here's the code fragment from #navBarMainLinksElement:
 
addLinkTo: self site aidademo text: 'Mission' view: #mission;
 
Here's the #viewMission code:
 
viewMission
| e |
 e := WebElement new.
 e addTextH1: 'Content Accounting & Protection Society'. e addBreak.
 e add: self missionElement.
 self pageFrameWith: e title: 'CAPS - Mission'
 and the code for aidademo:
 
aidademo
 ^self userServices at: #WebDemo
  ifAbsent:
   [self addUserService: WebDemo new named: #WebDemo.
   self urlResolver defaultURL: '/aidademo.html' forObject: self aidademo.
   ^self aidademo]
 I am little confused with the need to implement an aidademo method in AIDASite. what are we referencing when we are actually executing:
(AIDASite named 'aidademo') urlResolver...
 
does this mean that "named:" can have anyName as value? In that case, I kept getting an error with #styleClass:
 
Regards.
 
--
Prashanth Hebbar
Bangalore
 

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: #aidademo implementation

Janko Mivšek
Prashanth Hebbar wrote:

>     site aidademo? Do you have a method #aidademo implemented somewhere? in
>     AIDASite?

> Prashanth: no. I implemented #aidademo (just copied #demo) but still the
> mission page points to demo.html. Here's the code fragment from
> #navBarMainLinksElement:
>  
>
>     addLinkTo: self site aidademo text: 'Mission' view: #mission;
>      
>
> Here's the #viewMission code:
>  
>
>     viewMission
>     | e |
>      e := WebElement new.
>      e addTextH1: 'Content Accounting & Protection Society'. e addBreak.
>      e add: self missionElement.
>      self pageFrameWith: e title: 'CAPS - Mission'

This method you implemented in WebDemoApp, right?

>
>  and the code for aidademo:
>
>     aidademo
>      ^self userServices at: #WebDemo
>       ifAbsent:
>        [self addUserService: WebDemo new named: #WebDemo.
>        self urlResolver defaultURL: '/aidademo.html' forObject: self
>     aidademo.
>        ^self aidademo]

Well, you actually reuse the already registered WebDemo, that's why
addLinkTo: resloves always to the old Url :)

Which is also ok, if you just extended WebDemoApp with additional view?
If you like to have another WebDemo instance, then correct above method:

        ^self userServices at: #AnotherDemo
        ...
        self addUserService: WebDemo new named: #AnotherDemo
        ...

>  I am little confused with the need to implement an aidademo method in
> AIDASite. what are we referencing when we are actually executing:
> (AIDASite named 'aidademo') urlResolver...

Yes, this is actually a double registration of root domain object. Why?
Because the registration in AIDASite's user services is considered more
safe, more strong than just in url resolver. Remember, loosing a
reference to a root object is a fatal event, you can loose a while
domain model at the next garbage collection cycle.

In tutorial registering the root object is only to url resolver because
of simplicity, but if you look at the real Aida systems, all root
objects are primary registered elsewhere, mostly in AIDASite user services.

> does this mean that "named:" can have anyName as value? In that case, I
> kept getting an error with #styleClass:

(AIDASite named: 'site name') is a method to find the instance of
AIDASite with that name. If you look at the implementation, it first
asks SwazooServer for its singleton, then ask it to find the site.

Janko

--
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida