forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorsten Scherler <thors...@apache.org>
Subject Re: using view/viewHelper
Date Sat, 16 Apr 2005 13:51:55 GMT
Hi Diwaker,

firstly thanks for taking the time to test and give feedback. That is
helping us so much. :)

On Fri, 2005-04-15 at 21:53 -0700, Diwaker Gupta wrote: 
> > I made some changes to add custom css to the view.
> > 
> > <forrest:css url="someCss.css"/>
> 
> Life's good so far. Now, from what I see, it seems that the nugget for
> generating "tabs" is currently not doing much (atleast it doesn't
> generate any content for me. did I miss anything?) Is this intentional
> or you just haven't gotten around to it yet Thorsten?)
> 

Ok, what do you mean with the nugget "tabs"? 

Do you mean 
<forrest:contract name="nav-main"/>?

Wow, it took me a while to understand what is going on. ;-)

Try in your project forrest.properties:
project.skin=leather-dev

Explanation:
I know I am one of the main responsible for the naming of the elements,
but I am now the same opinion like Juan Jose Pablos. We need some naming
convention to make it easier to understand the view concept. I will try
to use the official J2EE naming convention to explain the view elements.

nugget -> 
businessHelper class/implementation - a class/implementation which will
access businessServices to produce models for the presentation model. In
other word it is a data producing factory.
NOTE: Right now we are using the default forrest businessHelper (defined
by the skin you are using). You spotted one contract that depends on a
businessHelper implementation of leather-dev (tab2menu.xsl). I will
create a businessHelper plugin to overcome this problem.

fbits/contract ->
viewHelper class/implementation - a class/implementation which will
access the presentation model and transform its models. In other words
it is a presentation producing factory.
NOTE: The <forrest:contract name="nav-main"/> expects a certain model
(now produced by leather-dev - tab2menu.xsl) to transform it. In the
future this dependency will be on a businessHelper implementation that
has to be defined in the view. For now it depends on leather-dev. I
guess leather-dev is still not dead till the businessHelper plugin comes
(which will implement the businessHelper of leather-dev). ;-)

> Of course, I think we can have a good debate on whats the best way to
> generate XHTML content for the tabs to make it "most amenable" to CSS
> skinning. Personally, I would just output each tab in its own div
> element, with class attributes denoting the selected tab. One can then
> use CSS to structure/color them appropriately.
> 

:)

Ok, you may want to try another feature that is coming with
forrest:views.

NOTE: All following explanations/steps assume you use the default
configuration of forrest. 

1.) Create in src/documentation the folder resources/templates. ...or
more generally speaking create ${project.resources-dir}/templates.

2.) Copy
http://svn.apache.org/viewcvs.cgi/forrest/trunk/plugins/org.apache.forrest.plugin.viewHelper/resources/templates/nav-main.ft?view=markup
to this folder.

3.) Add after the <xsl:template name="nav-main-body"/> something like 
<xsl:template match="ul[@id='nav-main']">
<div id="nav-main">
  <xsl:apply-templates select="li"/>
</div>
</xsl:template>
<xsl:template match="li[not(@class)]">
<div class="base-not-selected">
  <xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="li[@class='current']">
<div class="current">
  <xsl:apply-templates/>
</div>
</xsl:template>

4.) Change the css in <xsl:template name="nav-main-css">. I tried but
the result is not nice. If you succeed please change the name of the
contract to "nav-main-div", add the patch to the issue-tracker and I add
the new contract to the viewHelper plugin. ;-)

HTH

salu2
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


Mime
View raw message