Tuesday, November 27, 2007

CSS Dock Menu in Seaside

Found some time this evening to wrap the CSS Dock menu demo in Seaside. It's really easy to wrap existing JavaScript/CSS components into Smalltalk classes. Here is a small tip:

  • implement a subclass of WAFileLibrary (like MyComponentFileLibrary)
  • go to http://localhost:port/seaside/config and select "Configure" on the files entry
  • select "Configure" on your new MyComponentFileLibrary class and upload files

As you will notice Seaside automatically converts the images, scripts or other resources into methods on your WAFileLibrary subclass.
You can then access the resource in your code using the "MyComponentFileLibrary / resourceMethod".

If you want to add the script to the html output overwrite the #updateRoot: message in your WAComponent subclass.

You can grab the code for the dock menu demo directly from here or browse the SeasideExamples project. It's actually in Squeak but the two classes could easily be ported to other Seaside platforms like VisualWorks. I also uploaded a demo to integrate the virtual earth control (IE only) into a seaside application.

The SeasideExamples project was initiated by Phillipe and is open for read/write, feel free to upload your examples.

No comments: