Re: More data on Problem with nested tables
Andras Balogh <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Message-ID | <[email protected]> |
Hello Werner,
Your HTML seems wrong to me, just copy pasted in DW and shows a lot
of tags placed incorrectly.
I found 2 <tbody> and </tbody> tags in wrong place, i think these should
be <table> tags .
Also make sure you close your iterative models in the same level
where you opened them (i.e. if you opened
in a TR than end it in a same level TR element)
I hope it helps a little bit,
Andras.
Werner Koch wrote:
>Hi all,
>
>sorry if this reappears as a new Thread, I think I am not yet up with
>handling this list. How do I reply through the web interface, as I seem not
>getting any mails directly at my place?
>
>First, because you asked for it, the HTML template. This is only the part
>with this Iterator problem:
>
><table cellpadding="0" cellspacing="0" border="0" width="444">
> <tr class="Dir::Iterate_Start.GeoCodeView Dir::Iterate_Next.GeoCodeView">
> <td>
> <table>
> <tbody id="carrierElement">
> <tr id="lineMainSpacer0"
>class="Dir::Set_Attr.GeoCodeView.lineMainSpacer.id">
> <td><img src="../../images/main/pixel_trans.gif" alt=""
>width="1" height="15" border="0"></td>
> </tr>
> <tr id="lineMainElement0"
>class="Dir::Set_Attr.GeoCodeView.lineMainElement.id">
> <td>
> <table cellpadding="0" cellspacing="0" border="0" width="444">
> <tbody id="carrierMainElement0"
>class="Dir::Set_Attr.GeoCodeView.carrierMainElement.id">
> <tr class="Dir::Iterate_Start.GeoCodeCoordinate
>Dir::Iterate_Next.GeoCodeCoordinate">
> <td>
> <tbody>
> <tr id="lineMainSpacer0_0"
>class="Dir::Set_Attr.GeoCodeCoordinate.lineMainSpacer.id">
> <td colspan="4"><img
>src="../../images/main/pixel_trans.gif" alt="" width="1" height="3"
>border="0"></td>
> </tr>
> <tr id="lineMainElement0_0"
>class="Dir::Set_Attr.GeoCodeCoordinate.lineMainElement.id">
> <td class="flow" width="27"><a id="addElement0_0"
>onmouseover="showTip('Zeilen hinzufügen (Koordinaten)');"
>onmouseout="showTip();" href="javascript:appendElement(0);"
>class="Dir::Set_Attr.EditMetaData.CoordinateAddTipLabel.onmouseover
>Dir::Get_Data.EditMetaData.AddLineLabel
>Dir::Set_Attr.GeoCodeView.append.href
>Dir::Set_Attr.GeoCodeCoordinate.addElement.id">+</a> <a
>id="removeElement0_0" onmouseover="showTip('Zeilen entfernen
>(Koordinaten)');" onmouseout="showTip();"
>href="javascript:removeElement(0);"
>class="Dir::Set_Attr.EditMetaData.CoordinateRemoveTipLabel.onmouseover
>Dir::Get_Data.EditMetaData.RemoveLineLabel
>Dir::Set_Attr.GeoCodeView.remove.href
>Dir::Set_Attr.GeoCodeCoordinate.removeElement.id">-</a></td>
> <td height="18" class="flow" width="115">X km/m, Y
>km/m</td>
> <td class="flow" width="275"><input type="text"
>name="coordinateXkm0_0" id="coordinateXkm0_0" class="input60
>Dir::Set_Attr.EditMetaData.input60.class
>Dir::Set_Attr.EditMetaData.ReadOnly.readonly
>Dir::Set_Attr.GeoCodeCoordinate.coordinateXkm.name
>Dir::Set_Attr.GeoCodeCoordinate.coordinateXkm.id" maxlength="3"
>onfocus="this.select();"><img src="../../images/main/pixel_trans.gif" alt=""
>width="5" height="1" border="0"><input type="text" name="coordinateXm0_0"
>id="coordinateXm0_0" class="input60 Dir::Set_Attr.EditMetaData.input60.class
>Dir::Set_Attr.EditMetaData.ReadOnly.readonly
>Dir::Set_Attr.GeoCodeCoordinate.coordinateXm.name
>Dir::Set_Attr.GeoCodeCoordinate.coordinateXm.id" maxlength="3"
>onfocus="this.select();"><img src="../../images/main/pixel_trans.gif" alt=""
>width="5" height="1" border="0"><input type="text" name="coordinateYkm0_0"
>id="coordinateYkm0_0" class="input60
>Dir::Set_Attr.EditMetaData.input60.class
>Dir::Set_Attr.EditMetaData.ReadOnly.readonly
>Dir::Set_Attr.GeoCodeCoordinate.coordinateYkm.name
>Dir::Set_Attr.GeoCodeCoordinate.coordinateYkm.id" maxlength="3"
>onfocus="this.select();"><img src="../../images/main/pixel_trans.gif" alt=""
>width="5" height="1" border="0"><input type="text" name="coordinateYm0_0"
>id="coordinateYm0_0" class="input60 Dir::Set_Attr.EditMetaData.input60.class
>Dir::Set_Attr.EditMetaData.ReadOnly.readonly
>Dir::Set_Attr.GeoCodeCoordinate.coordinateYm.name
>Dir::Set_Attr.GeoCodeCoordinate.coordinateYm.id" maxlength="3"
>onfocus="this.select();"></td>
> <td width="23" style="padding-left: 5px;"><a
>id="addMainElement0_0" onmouseover="showTip('Zeile hinzufügen
>(Koordinaten)');" onmouseout="showTip();"
>href="javascript:appendMainElement(0,0);"
>class="Dir::Set_Attr.EditMetaData.GeologyAddTipLabel.onmouseover
>Dir::Get_Data.EditMetaData.AddLineLabel
>Dir::Set_Attr.GeoCodeCoordinate.addMainElement.id
>Dir::Set_Attr.GeoCodeCoordinate.append.href">+</a> <a
>id="removeMainElement0_0" onmouseover="showTip('Zeile entfernen
>(Koordinaten)');" onmouseout="showTip();"
>href="javascript:removeMainElement(0,0);"
>class="Dir::Set_Attr.EditMetaData.GeologyRemoveTipLabel.onmouseover
>Dir::Get_Data.EditMetaData.RemoveLineLabel
>Dir::Set_Attr.GeoCodeCoordinate.removeMainElement.id
>Dir::Set_Attr.GeoCodeCoordinate.remove.href">-</a></td>
> </tr>
> </tbody>
> </td>
> </tr>
> <tr class="Dir::Iterate_End.GeoCodeCoordinate
>Dir::Discard"></tr>
> </tbody>
> </table>
> </td>
> </tr>
> <tr id="lineSubElement0"
>class="Dir::Set_Attr.GeoCodeView.lineSubElement.id">
> <td>
> <table cellpadding="0" cellspacing="0" border="0" width="444">
> <tbody id="carrierSubElement0"
>class="Dir::Set_Attr.GeoCodeView.carrierSubElement.id">
> <tr class="Dir::Iterate_Start.GeoCodeCode
>Dir::Iterate_Next.GeoCodeCode">
> <td>
> <tbody>
> <tr id="lineSubSpacer0_0">
> <td colspan="5"><img
>src="../../images/main/pixel_trans.gif" alt="" width="1" height="3"
>border="0"></td>
> </tr>
> <tr id="lineSubElement0_0"
>class="Dir::Set_Attr.GeoCodeCode.lineSubElement.id">
> <td class="flow" width="27"> </td>
> <td height="18" class="flow
>Dir::Get_Data.EditMetaData.GeologyLabel" width="115">Schlagwortliste(n)</td>
> <td><input type="text" name="geocode0_0"
>id="geocode0_0" class="input300 Dir::Set_Attr.EditMetaData.input300.class
>Dir::Set_Attr.EditMetaData.ReadOnly.readonly
>Dir::Set_Attr.GeoCodeCode.geocode.id Dir::Set_Attr.GeoCodeCode.geocode.name"
>onfocus="this.select();" value=""><img
>src="../../images/main/pixel_trans.gif" alt="" width="3" height="1"
>border="0"></td>
> <td><a href="javascript:getGeoCode('geocode0_0');"
>onmouseover="showTip('Detailinfo');" onmouseout="showTip();"
>class="Dir::Set_Attr.EditMetaData.DetailInfoLabel.onmouseover"><img
>src="../../images/icons/icon_external_on.gif" alt="" width="11" height="16"
>border="0"></a></td>
> <td width="23" style="padding-left: 5px;"><a
>id="addSubElement0_0" onmouseover="showTip('Zeile hinzufügen
>(Schlagwortliste(n))');" onmouseout="showTip();"
>href="javascript:appendSubElement(0,0);"
>class="Dir::Set_Attr.EditMetaData.GeologyAddTipLabel.onmouseover
>Dir::Set_Attr.GeoCodeCode.addSubElement.id
>Dir::Set_Attr.GeoCodeCode.append.href">+</a> <a
>id="removeSubElement0_0" onmouseover="showTip('Zeile entfernen');"
>onmouseout="showTip();" href="javascript:removeSubElement(0,0);"
>class="Dir::Set_Attr.EditMetaData.GeologyRemoveTipLabel.onmouseover
>Dir::Set_Attr.GeoCodeCode.removeSubElement.id
>Dir::Set_Attr.GeoCodeCode.remove.href">-</a></td>
> </tr>
> </tbody>
> </td>
> </tr>
> <tr class="Dir::Iterate_End.GeoCodeCode
>Dir::Discard"></tr>
> </tbody>
> </table>
> </td>
> </tr>
> </tbody>
> </table>
> </td>
> </tr>
> <tr class="Dir::Iterate_End.GeoCodeView Dir::Discard"></tr>
></table>
>
>Sorry for the mess, but I didn't design this HTML ;-).
>
>Then about the needed magic for the models. First some remarks about what I
>can see here:
>- The models get invoked
> - First GeoCodeView
> - Then GeoCodeCoordinate
> - Then GeoCodeCode
>- When GeoCodeCoordinate is through with it's first Iteration, I see that
>hasNext() is invoked and returns true, and instead of beeing reapplied
>- GeoCodeCoordinate starts, until it is through, in my test case with
>hasNext() returning false
>- Now I expect at least that GeoCodeView is beeing hasNext()ed, but this
>does not happen (but does when the inner models are not attached).
>- I am rather confident, that the Models write into the page, because I can
>see the getItem() returning what I expect, and I am also seeing proper data
>in the result page where I put just for answering this question some garbage
>into the template.
>- The magic link between childs and parent is done in my case through two
>Session objects, which are kept up to date with the current iteration of all
>Models concerned, and the different Iteration counts for the inside models
>for the different outside Iterations.
>- As I said, when I don't attach the inner Models, then the outer Model
>executes as expected.
>
>I also tried to search the complete mail archive, but couldn't find anything
>relevant to my case (this is of course my problem, otherwise I wouldn't be
>in trouble right now I guess).
>
>Just to illustrate, one of those inner Iterators.
>
>public class GeoCodeView
> extends AbstractIterativeTemplateModel
>{
> private static final String MODEL_NAME = "GeoCodeView";
>
> private GeologyInfoMetaData[] m_metaData = null;
>
> private DocumentIteratorPosition m_iteratorPosition = null;
>
> public GeoCodeView()
> {
> super();
> }
>
> public String getName()
> {
> return GeoCodeView.MODEL_NAME;
> }
>
> public Object getItem(String key)
> {
> String result = null;
> if(key.equals("remove") || key.equals("append"))
> result = "javascript:" + key + "Element(" +
>String.valueOf(m_iteratorPosition.getGeologyInfoPosition()) + ")";
> else
> result = key +
>String.valueOf(m_iteratorPosition.getGeologyInfoPosition());
> System.out.println("GeoCodeView, getItem: " + result);
> return result;
> }
>
> public void preIterate()
> {
> this.m_metaData =
>(GeologyInfoMetaData[])this.getViewContext().getRequest().
> getSession().getAttribute(SessionAttributes.DOCUMENT_META_DATA);
> this.m_iteratorPosition =
>(DocumentIteratorPosition)this.getViewContext().getRequest().
>
>getSession().getAttribute(SessionAttributes.DOCUMENT_ITERATOR_POSITION);
> this.m_iteratorPosition.resetGeologyInfoPosition();
> }
>
> public boolean hasNext()
> {
> boolean result = false;
> if((this.m_metaData.length - 1) >
>this.m_iteratorPosition.getGeologyInfoPosition())
> result = true;
> System.out.println("GeoCodeView hasNext(): " + String.valueOf(result));
> return result;
> }
>
> public void loadNext()
> {
> this.m_iteratorPosition.incrementGeologyInfoPosition();
> }
>
> public void postIterate()
> {
> }
>}
>
>This just writes out mostly id attributes at the moment, keeping track of
>the iterations, data will follow.
>
>To find out myself something more, a pointer where there is a simple
>introduction to logging in Barracuda might be helpful. By simple I mean
>something like:
>- Get those jars
>- Put them there
>- Replace <foo> with <bar> where <foo> means <baz>
>- Restart Tomcat
>
>Then I would already thank for the interest from your part. I like to point
>out that the Baccaruda approach looks very promising to me, even though I
>only looked at the template part until now. Thank you also for this.
>
>Best regards, Werner
>
>_______________________________________________
>Barracuda mailing list
>[email protected]
>http://barracudamvc.org/lists/listinfo/barracuda
>
>
>