jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shawn Bayern <bay...@essentially.net>
Subject Re: Generic Tags for Image Tag Actions
Date Wed, 05 Dec 2001 19:02:29 GMT
Hi again!  A handful of thoughts --

I would suggest decoupling the interface with the page author from the
back-end implementation.  In almost all cases, the implementation can
adapt to whatever interface is deemed appropriate.

As for what the tags should look like...

> The first solution that comes to my mind is to have generic tag for the
> image and nested tags for the actions which in turn has nested tags for
> parameters. Nested tags are better since any number can be specified.

This is certainly one viable option.  I would suggest two modifications to
the design you proposed.  First, instead of <img:param> tags, most
individual parameters could be tag attributes.  This is just aesthetic;
it's more concise.  Second, why a single <img:action name="..."> tag
versus individual action tags:  <img:contrast>, <img:border>, and so on.
Here's a picture of "before" and "after:

You suggested:
> 	eg.
> 	<img:image fileName="somefile_in_the_domain.gif" > <!-- can be a file or
> folder -->
> 
> 		<img:action name="contrast">
> 			<img:param name="amount" value="10" />
> 		</img:action>
> 
> 		<img:action name="border">
> 			<img:param name="thickness" value="5" />
> 			<img:param name="color" value="125" />
> 		</img:action>
> 
> 		<img:action name="text-overlay">
> 			<img:param name="string" value="some text" />
> 			<img:param name="alignment" value="bottom" />
> 			<img:param name="fontName" value="serif" />
> 			<img:param name="fontSize" value="8" />
> 		</img:action>
> 
> 	</img:image>

With my modifications, this would become:

	<img:file path="somefile.gif">
	    <img:contrast value="10"/>
	    <img:border width="5" color="#888888"/>
	    <img:text value="Text!" valign="bottom" font="serif" size="8"/>
	</img:file>

Other, more minor included modifications:
  - more HTML-like attribute names (e.g., "width" instead of "thickness")
  - HTML-style color specification ("#888888" instead of "125")

Also, what do you mean by "can be a file or folder"?  If we want
thumbnailing as a particular feature, I'd suggest that be a specific tag,
or perhaps an explicit iteration (using JSTL):

	<file:directory path="/foo" var="dir">
	<c:forEach items="$dir" var="file">
	   <img:thumbnail src="$file"/>
	</c:forEach>

> The name-value parameters will be stored in the parent tag (prefixed with
> some text to make it unique) which will be finally
> be converted to a set of name value pair parameters in the image src url.
> 	for eg., <img
> src="/servlets/ImageServlet?action1=contrast&contrast_amount=10&action2=bord
> er&border_thickness=5&border_color=125&...." >
> 
> The Image servlet can create a hashtable with these name-value pairs.

Again, this involves reworking the servlet for each new image tag.  
Everyone who wants to add an image tag needs their hands in the servlet
too.

Now, the alternative, as I believe Tim suggested, is to reverse the order
and let the tags nest the other way; each image tag acts as a "filter" for
its body.  This alternative is certainly viable, but I believe it leads to
somewhat more complex syntax:  the "outer" tag should jump out at the page
author as the action being performed, not just a final filter.  
Furthermore, we've got just one level of nesting here, and the alternative
would require arbitrary depth for successive filters.

Shawn


--
To unsubscribe, e-mail:   <mailto:taglibs-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-dev-help@jakarta.apache.org>


Mime
View raw message