[aida] Tutorial, WebStyle

Dirk Verleysen dirk.verleysen at roots.be
Mon Sep 24 16:52:11 CEST 2007

Yes... ObjectStudio uses the VM from VisualWork so that shouldn't be a problem but ObjectStudio still has it's own special behavior for some classes. I volunteered to do some testing with OS8 to see whether there were any special problems.

-----Oorspronkelijk bericht-----
Van: aida-bounces op aidaweb.si [mailto:aida-bounces op aidaweb.si] Namens Janko Mivšek
Verzonden: maandag 24 september 2007 13:53
Aan: AIDA/Web general discussion list
Onderwerp: Re: [aida] Tutorial, WebStyle


Perfect! I just put your patch into a code. But interesting is that I 
didn't come to that error yet by myself, even that I'm using namespaces too.

About ObjectStudio: does that mean that you'll run Aida on ObjectStudio?

Best regards

Dirk Verleysen wrote:
> Janko,
> The problem is the namespace. My classes are in the Phenix.SKH namespace. I changed the method WebApplication class>>newFromNameFor:on: to
> newFromNameFor: anObject on: aSession
> 	"Try to create of AnObjectApp instance if exist."
> 	| className class |
> 	className := (anObject class fullName, 'App') asSymbol.
> 	class := [className asQualifiedReference value] on: Error do: [:ex | ^nil].
> 	(class allSuperclasses includes: WebApplication) ifFalse: [^nil].
> 	^class new observee: anObject; session: aSession; postInitialize.
> And I get my first book :-).
> I also decided to start using ObjectStudio 8. Since there is no GUI involved I might be able to
give the OS8-team some usefull feedback.
> Dirk
> -----Oorspronkelijk bericht-----
> Van: aida-bounces op aidaweb.si [mailto:aida-bounces op aidaweb.si] Namens Janko Mivšek
> Verzonden: donderdag 20 september 2007 23:07
> Aan: AIDA/Web general discussion list
> Onderwerp: Re: [aida] Tutorial, WebStyle
> Hi Dirk,
> Dirk Verleysen wrote:
>> I get a bit further but now I get "Cannot find aWebApplication for object aClubBook". 
>  > My mainView method in ClubBookApp is not accessed.
> Actually even and instance of ClubBookApp was not created. This error is 
>   an indication that Aida didn't manage to find an App class for your 
> domain object. Your domain object class is ClubBook and you also created 
> a presentation class ClubBookApp (by simply adding App to the domain 
> class name). This should work, so problem must be somewhere else. On VW 
> could be a namespace problem. Did you put both ClubBook and ClubBook on 
> some namespace other than default?
> Try to debug that problem by putting a breakpoint in Object>>webAppFor: 
> or even better in WebApplication class>>newFor:on: This later method 
> (actually #newFromNameFor:) searches for an App class by composing a 
> name from domain object class name and then instantiate the found class 
> to get a presentation object for your domain one.
>> This is my simple mainView method
>> viewMain
>>         | e |
>>         e := WebElement new.
>> 	 self halt.
>> 	 self title: 'Club Book'.
>>         e addTextH1: 'Club Book'.
>>         self pageFrameWith: e title: 'Club Book'
> This method looks correct.
>> As mentioned in the tutorial I subclassed my ClubBookApp from WebApplication. 
>  > Now it appears that pageFrameWith:title: is not implemented on
>  > WebApplication so I would think that the tutorial example wouldn't 
> work either.
> #pageFrameWith:title: is implemented in WebStyle. And WebStyle is not a 
> subclass of WebApplication but method search anyway goes to WebStyle. 
> Namely, a #doesNotUnderstand is overiden in WebApplication to redirect 
> all unknown methods to an instance of WebStyle (or its subclass) which 
> is registered in AIDASite style instvar.
> Why so?
> Well, this sounds a bit complicated and harder to debug but you will 
> soon get used to. But this approach has many more advantages:
>     1. WebStyle deals (as a name suggests)  with styling (CSS) of your 
> web site. And styling is separated from content by separating app and 
> style classes too. As is HTML separated from CSS in any well formed web 
> pages those days.
>     2. You can also separate style on site-by-site basis. That means 
> that you can have the same Apps for many sites but sites are still 
> looking differently, because they are using different styling. This is 
> achieved by sublclassing WebStyle and registering a new class in 
> AIDASite settings.
>     3. Web hosting of many web sites on one image is very easy with this 
> approach.
> For instance, if you want to make your own CSS style for your ClubBook 
> application, you:
> 1. make your own style class by subclassing WebStyle, like ClubStyle
> 2. (AIDASite named: 'aidademo') styleClass: 'ClubStyle'.
> 3. now override css* methods in ClubStyle with your own CSS
> 4. You can also change #pageFrameWith:title: to have a different framing 
> of your web pages (different header, footer, navigation bar etc).
> I hope that explains a bit one of main mysteries but also main features 
> of Aida.
> Best regards
> Janko

Janko Mivšek
Smalltalk Web Application Server
Aida mailing list
Aida op aidaweb.si

More information about the Aida mailing list