The mentioned function in subject is a very good handler about
programatically registering components in seaside.
But I found that, in line 4 (of code snippet 1 at bottom), the class
WAApplication is hardcoded so it makes duplicated and non needed work if you
subclass WAApplication and want to still use it to register components.
For example, I can subclass WAApplication (named for example
MyWAApplication) and WAAdmin (named MyWAAdmin) to handle my own stuff.
But since it is hardcoded into its WAAdmin parent method, the child method
is a copy/paste of the original one, just changing the application class
name, which is double and unneeded work in my opinion.
That being said, I have a proposal:
In the same way, WAAdmin has class side methods like "defaultDispatcher", I
propose a method like
WAAdmin class>>defaultApplicationClass
^ WAApplication
That way, subclassing WAApplication is as simple as subclassing WAAdmin with
only changing the method defaultApplicationClass to be returning the class
you want to use, so with the above, the change proposal is at code snippet 2
below.
(Code snippet 1)
WAAdmin class>>register: aComponentClass asApplicationAt: aString in:
aDispatcher
"Use this to programmatically register a component as an
application."
| application |
application := self register: WAApplication at: aString in:
aDispatcher.
self configureNewApplication: application.
application preferenceAt: #rootClass put: aComponentClass.
^ application
(Code snippet 2)
WAAdmin class>>register: aComponentClass asApplicationAt: aString in:
aDispatcher
"Use this to programmatically register a component as an
application."
| application |
application := self register: (self defaultApplicationClass) at:
aString in: aDispatcher.
self configureNewApplication: application.
application preferenceAt: #rootClass put: aComponentClass.
^ application
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside