Hi Groovie,
2008/11/4 GroovieMan <[EMAIL PROTECTED]>:
>
> Salut Volker,
>
> (1) sorry to say this, but i need exactly an altering rendering
> of different controls. My job is to bring an Excel-Sheet
> into a web application, so -hello- the source (was) excel.
This should be possible with tc:sheet.
>
> Finally, it is not a true table that needs to be transfered.
> It is called a sheet, with a head, some groups of multiple-choice
> questions, that may consist of radio or check boxes and/or
> text fields, separated by some (sub) sections, that
> last not least will span over some colums.
> The layout of that sheet is data driven, somewhere in
> two database tables (the definition) and some other
> the values. The contents of questions may vary from
> associated context.
>
> So what we did, we defined a couple (~~6) template
> viewer, that define some viewer, that i have to switch-on/off
> in dependency of the viewer-type, that is availiable for each row.
>
>
>
> (2) Now to your argumentation:
>
>
> Volker Weber-5 wrote:
>>
>> Or how would you expect e.g. exel to render a column in one row but
>> not in the next?
>>
>
> From the technical point of view, your comment is
> not absolutly correct, cause each row does contain
> exactly the same content as the other rows. By using the
> rendered attribute i only tell the presentation layer not to
> show theses elements on screen, but -in fact- they exist!!!
Each tc:column contains a pattern how to render the content for each
row, setting rendered=false depending on the row
is not possible even in excel (afaik).
What should excel show at cell C5 if you set rendered coumn C in row 5
to false, but to true in rows 1-4 and 6-...?
You must render something, maybe just an empty panel, or you have to
cut a hole into your display.
>
> -finally this is my view, but not yours and you coded it!! -
>
>
> (3) So maybe the tc:sheet is not the appropriate way for a viewer,
> but ok, i am flexible. I decided to use a tc:sheet, cause it
> give me a common layout for indentation, but maybe a facelet
> could do this too.
>
> The question is now, which kind of tag (or combination
> of tags) could be useful, to implement the viewer.
You can use the tc:sheet as in my last example:
<tc:sheet ...>
<tc:column label="...">
<tc:panel>
<tc:panel rendered="#{currentLine.booleanBeanAttrib1}" >
<%-- content of cell when currentLine.booleanBeanAttrib1 is true --%>
</tc:panel>
<tc:panel rendered="#{!currentLine.booleanBeanAttrib1 &&
currentLine.booleanBeanAttrib2}" >
<%-- content of cell when currentLine.booleanBeanAttrib2 is true --%>
</tc:panel>
<tc:panel rendered="#{! (currentLine.booleanBeanAttrib1 ||
currentLine.booleanBeanAttrib2)}" >
<%-- content of cell otherwise --%>
</tc:panel>
</tc:panel>
</tc:column>
...
</tc:sheet>
This is an example of a c:choose with two c:when and a c:otherwise,
exact what you request in your first post.
> If do remeber of a tc:forEach tag, but i also noticed,
> that this tag is deprecated.
There is a foreach example, using c:foreach, somewhere in the tobagos
examples (i never looked into).
> As a consequence of this, if need somewhat like a for loop,
> that enrolls my List<ofLines> in the same way as your
> sheet you have done it. So coming back to the origin question,
> can i combine JSTL with Tobago, and what would be a good
> solution.
You can combine jstl with tobago, but not inside the sheet.
jstl is evaluated during "build component tree" phase of Simons
description. Once the component tree is created
the jstl is never evaluated again, but a component tree could be
rendered multiple times.
The rendering of sheets content is a rendering of each row multiple
times, this is after the (subview) was created,
and so changes in jstl are never evaluated again.
>
> Would it be possible to enroll a list in a tc:box and use a
> chosen over all of my possible views, containing tobago tags.
> What would i need to do, in order to make this viewer
> robust enough ?
I thing it is possible using a c:foreach to enroll your list if you
have no input elements in your cells,
because the row var of c:foreach did only exist on first rendering,
and only in jsf1.1 phases (afaik).
But i would prefer using tc:sheet.
Regards,
Volker
>
>
> Thank you
> Groovie
>
>
>
>
>
> Volker Weber-5 wrote:
>>
>> Hi Groovie,
>>
>> rendered works fine on tc:column.
>>
>> but you can't use the row variable for this, because the rendering of
>> a column can't depend on the row.
>> Or how would you expect e.g. exel to render a column in one row but
>> not in the next?
>>
>> I thing what you want is to render different content, row dependent,
>> in the same column? Than you should use the rendered not on the
>> column but on the out.
>>
>> <tc:column label="...">
>> <tc:panel>
>> <tc:out rendered="#{currentLine.booleanBeanAttrib1}" value="..."/>
>> <tc:out rendered="#{currentLine.booleanBeanAttrib2}" value="..."/>
>> <tc:out rendered="#{currentLine.booleanBeanAttrib3}" value="..."/>
>> </tc:panel>
>> </tc:column>
>>
>> The panel surrounding the tc:out is not needed, but without you will
>> get a warning about layout problems in the log file.
>>
>> Regards,
>>
>> Volker
>>
>>
>>
>>
>> 2008/11/4 GroovieMan <[EMAIL PROTECTED]>:
>>>
>>> Hy Volker,
>>>
>>> the use of rendered will fail with tc:sheet variables, for (maybe
>>> the same reason as the JSTL problem).
>>> <tc:columns rendered= ...> runs perfectly with variables,
>>> that have been defined as beans on inside faces-config.xml.
>>> For any reason, the use of variable-declaration inside the tc:sheet
>>> (here currentLine) fails barely.
>>> The variable instance seems to exist, cause JSF can locate
>>> somewhat by using the expression "currentLine.booleanBeanAttrib1",
>>> but the result is strange. Iff you use the debugger and place a
>>> breakpoint into the isBooleanBeanAttrib1 methode of your data-bean,
>>> then you may find out, that the method is never been called.
>>> Anyway the varibale #{currentLine.booleanBeanAttrib1} returns
>>> a true, ughh where did it come from ??? that's weired!!!
>>>
>>> In order to circumscribe the bug, i defined a listviewer boolean
>>> attribute
>>> and received the expected result.
>>>
>>> As a consequence of this, i assume that there is a bug in tobago,
>>> with the internal sheet-tag handling of the var(iable).
>>>
>>> Anyway any workaround is welcomed, cause this is a blocking-point
>>> for my work.
>>>
>>> Thank you all
>>> Groovie
>>>
>>> I opened a bug in Tobago for further discussing:
>>>
>>> https://issues.apache.org/jira/browse/TOBAGO-719
>>>
>>>
>>>
>>>
>>> Volker Weber-5 wrote:
>>>>
>>>>
>>>> you can't use jstl inside a tc:sheet, because it evaluates not at
>>>> rendering time.
>>>>
>>>> you can use the rendered attribute of tc:column :
>>>>
>>>> <tc:sheet value="#{listviewer.showLines}" id="sheet"
>>>> columns="1*;1*;1*;1*;1*;1*"
>>>> var="currentLine"
>>>> [... deleted...]
>>>> selectable="single" >
>>>>
>>>> <tc:column rendered="#{currentLine.booleanBeanAttrib1}"
>>>> label="#{overviewBundle.selsyslst_lst_nameId}"
>>>>
>>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/-TOBAGO--Usging-jstl-tags-inside-a-tobago-sheet-tag-tp20297480p20318017.html
>>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> inexso - information exchange solutions GmbH
>> Bismarckstraße 13 | 26122 Oldenburg
>> Tel.: +49 441 4082 356 |
>> FAX: +49 441 4082 355 | www.inexso.de
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/-TOBAGO--Usging-jstl-tags-inside-a-tobago-sheet-tag-tp20297480p20321265.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>
--
inexso - information exchange solutions GmbH
Bismarckstraße 13 | 26122 Oldenburg
Tel.: +49 441 4082 356 |
FAX: +49 441 4082 355 | www.inexso.de