HV intro (was Re: Squeak SSP-- huh?)

goran.hultgren at bluefish.se goran.hultgren at bluefish.se
Thu Apr 4 10:59:36 UTC 2002


You where fast to reply! :-)

Avi Bryant <avi at beta4.com> wrote:
> On Thu, 4 Apr 2002 goran.hultgren at bluefish.se wrote:
> 
> > In HV you build webpages much like you build UIs programmatically - you
> > know - create window, add button, add field etc. Here is a small example
> > from some of my current code, it is a page with a form for editing a
> > "channel" object:
> >
> > default
> > 	"Edit a channel."
> >
> > 	| b resource protocol name description |
> > 	b _ self builder.
> > 	b start; h1: model name; postForm.
> > 	b html: 'Type: ', model type name asString, ' Address: ', model
> > computeAddress printString.
> > 	name _ b br; br; html: 'Name: '; inputTextValue: model name.
> > 	description _ b br; html: 'Description: '; inputTextValue: model
> > description.
> > 	resource _ b br; html: 'Resource: '; selectObjects: model account
> > resourcesWithoutTypes value: model resource.
> > 	protocol _ b br; html: 'Protocol: '; selectObjects: model
> > availableProtocols value: model protocol.
> > 	b br; submit: 'Save'; reset: 'Restore'; endForm; linkBackParent; hr;
> > srcLink; end.
> > 	b ifPost: [
> > 		model name ~= name value ifTrue:[model name: name value].
> > 		model description: description value.
> > 		model resource: resource value.
> > 		model protocol: protocol value.
> > 		^self redirectToDefault
> > 	].
> > 	^b
> 
> Göran,
> 
> I thought you might be interested in how the above method would look in
> Seaside.  It could in fact be entirely done in HTML - you would need a
> Seaside component class with a 'model' instance variable and the following
> #html method:
>
> html
> ^ '
>   <h1>[model.name]</h1>
>   <form action="@reload">
>    Type: [model.type.name]
>    Address: [model.computeAddress]
>    <br><br>
>    Name: <input type="text" name="@model.name">
>    <br>
>    Description: <input type="text" name="@model.description">
>    <br>
>    Resource:
>     <select list="@resource/model.account.resourcesWithoutTypes">
>       <option item="@model.resource">[resource]</option>
>     </select>
>    <br>
>    <input type="submit" value="Save">
>    <input type="reset" value="Restore">
>   </form>
>   <a action="@return">(back)</a>
>  '
> 
> The semantics are the same - submitting the form will reload the current
> page (that's the 'action="@reload"' part) and will update all the model's
> values.  And I think I the HTML is the same, although I may be wrong about
> exactly what your builder outputs.

Interesting indeed! Good to see that some of my ideas obviously have
counterparts in your work - then I can't be totally off base.

The main "problem" with HV (and Seaside doesn't have that problem I
guess since it focuses on HTML instead of Smalltalk) is how it would
coexist with external "HTML editors" like Dreamweaver etc. I haven't
botheres with it yet though since I am doing prototyping and don't need
fancy layout.

My idea though is to have different implementations of the builder - my
current builder would be the "basic builder" doing just simple HTML.
Then perhaps a more advanced builder could begin by loading some form of
template page and still be able to "glue it all together" so that my
method above would still work exactly as written now.

> Cheers,
> Avi

Cheers, Göran

PS. How does Seaside integrate with Squeak? Can you edit the pages in a
browser like SSP does? Can you do "senders of" etc? I guess that those
things would be the weaknesses of Seaside compared to HV - if there are
any. :-) DS



More information about the Squeak-dev mailing list