[Chameleon] widgets w/o SharedResource?

Paul Spencer pspencer at dmsolutions.ca
Wed Oct 20 19:03:29 EDT 2004


Ken, good question!  it is indeed possible to use these widgets without 
the associated SharedResource.  The samples 
(sample_basic_plainbuttons.html) can show you how :)

The current architecture is very flexible, but that does lead to 
confusion.  You have two ways of creating buttons (static or dynamic) 
and two ways of representing them (basic or multistate) which leads to 
four possibilities:

* basic, static buttons:

   you must specify an image="" for the widget but no styleresource. 
The image is used as the entire button, i.e. you have pre-rendered the 
button.  If the widget is part of a toolset, then it is rendered with a 
radio button to show it is selected.  If not, then it is wrapped with an 
<a> tag to make it 'clickable'.

* basic, dynamic buttons:

   you specify a styleresource which is used to generate the image 
dynamically.  Same basic behaviour (single image, radio button or 
clickable).

* multistate, static buttons:

   you specify multiple images for the button using sub tags to specify 
the image to be used for normal, hover and selected states.  There is no 
styleresource, so the images are assumed to be complete.  For toolset 
buttons, the selected button will assume the 'selected' state after a 
page load.

* multistate, dynamic buttons:

   you specify both a styleresource AND subtags for multiple states. 
Images for each state are dynamically generated from the associated 
styleresource.

Some further notes:

   dynamic buttons are really useful for multilingual sites and in cases 
where you want to play with the design of buttons without having to make 
loads of pre-generated images.  For instance, you want all the buttons 
to have a different background colour or to be slightly larger, dynamic 
buttons make this easy because all buttons can be changed with one 
change  in the template.  In contrast, making this change to static 
buttons might mean hours of work for a graphic artist!

   popupstyleresource is also an attribute of several widgets (such as 
the ErrorReport) and is used to style the buttons in the popups.  If you 
do not specify a popupstyleresource then the styleresource will be used. 
  If no styleresource is supplied then the buttons will be rendered as 
<input type="button">

   For button-based widgets like ErrorReport, if you do not specify an 
image but you do specify a label, then the label should be output 
wrapped in an <a> tag (this was a recent change in cvs).

Cheers,

Paul

Ken-ichi wrote:
> Is it possible to use widgets like ErrorReport and LegendTemplate 
> WITHOUT specifying the TextButton SharedResource?  I'm trying to put 
> together a very basic primer on Chameleon for some colleagues, so, 
> unlike previous attempts with Chameleon where I just copied things from 
> the samples dir, I tried writing a template de novo.  I'm trying to use 
> the minimal set of attributes for each widget tag, i.e. the ones in red 
> on the documentation page, but for widgets like ErrorReport and 
> LegendTemplate, Chameleon outputs no widget, no code, and no error.  
> Only when I include the TextButton SharedResource, the styleresource 
> attribute, and the popupstyleresource attribute does the widget actually 
> show up.
> 
> Is this normal behavior?  If so, it should really be listed on the 
> widget docs page.  If not, any idea what I'm doing wrong?  Here's an 
> example of a non-functional tag:
> 
> <cwc2 type="ErrorReport" popupwidth="500" popupheight="400"/>
> 
> which should be ok according to
> 
> http://maptools.org/chameleon/index.phtml?page=CWC2WidgetDocs.html#ERRORREPORT 
> 
> 
> This is all under 1.99b2.  Thanks.
> 
> -Ken-ichi
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/chameleon
> 


More information about the Chameleon mailing list