Gregg,

FYI, I don't think Trinidad is adding the "content:".   Perhaps
Tiles 2.0 is (I've not looked at the newer version).

-- Adam


On 9/3/07, Gregg Leichtman <[EMAIL PROTECTED]> wrote:
>
>  I have found a bug in the generated JavaScript for the Select*Shuttle
> components. A patch follows:
>
>  TrShuttleProxy._getDescArray = function(listName) {
>  //  var descArray = window[listName.replace(':','_') + '_desc'];
>    var descArray = window[listName.replace(/:/g,'_') + '_desc']; // gsl fix
>    return descArray;
>  }
>
>  where listName is content:shuttle1:leading.
>
>  The problem is that the listName is not using a global replace; therefore
> only the first ':' is being replaced. This worked fine in ADF Faces before
> porting to Trinidad where the listName was just "shuttle1:leading". Note,
> however, that Trinidad now adds an additional "content" prefix to the
> generated inline JavaScript variables:
>
>  content_shuttle1_leading_desc=new Array('The First Item
> Desc',
>  'The Second Item Desc',
>  'The Third Item Desc','');
>  content_shuttle1_trailing_desc=new Array('');
>
>  This means that a global replace needs to be done to create the proper
> variable name for matching in the JavaScript code. I will report this on
> Jira for the Trinidad project.
>
>  I don't have access to the latest snapshots. The last one I see is from
> July 11th at:
>
>
> http://people.apache.org/repo/m2-snapshot-repository/org/apache/myfaces/trinidad/trinidad-impl/1.2.1-SNAPSHOT/
>
>  If this has been fixed already, then please clear my bug report which
> should have the side benefit of letting people know that the bug has been
> found and fixed already.
>
>                                     -=> Gregg <=-
>
>  Gregg Leichtman wrote:
>
> I am trying to get the leadingDescShown and trailingDescShown attributes
> to work for the Trinidad v1.2.1 SelectOrderShuttle. I have the shuttle
> working for everything except for displaying the description of a
> selected item in the textarea below the leading or trailing shuttle. I'm
> running under Linux and Eclipse 3.3 Europa using J2EE5 with JSF 1.2 and
> Tiles 2.0.4. I have a tile as follows:
>
> <%@ taglib uri="http://java.sun.com/jsf/core"; prefix="f" %>
> <%@ taglib uri="http://java.sun.com/jsf/html"; prefix="h" %>
> <%@ taglib uri="http://tiles.apache.org/tags-tiles";
> prefix="tiles" %>
> <%@ taglib uri="http://myfaces.apache.org/tomahawk";
> prefix="t" %>
> <%@ taglib uri="http://myfaces.apache.org/trinidad";
> prefix="tr"%>
>
> <tr:form>
>  <tr:panelGroupLayout layout="vertical">
>  <f:facet name="separator">
>  <tr:separator />
>  </f:facet>
>  <tr:messages/>
>  <tr:selectOrderShuttle id="shuttle1"
>  label="Selected Values"
>  leadingHeader="Available values:"
>  leadingDescShown="true"
>  trailingHeader="Selected values:"
>  trailingDescShown="true"
>  binding="#{editor.component}"
>  valueChangeListener="#{list.valueChanged}"
>  value="#{list.stringArray}">
>  <tr:selectItem shortDesc="The First Item Desc"
> longDesc="Long Desc 1" label="First" value="foo"/>
>  <tr:selectItem shortDesc="The Second Item Desc"
> longDesc="Long Desc 2" label="Second" value="bar"/>
>  <tr:selectItem shortDesc="The Third Item Desc"
> longDesc="Long Desc 3" label="Third" value="baz"/>
>  </tr:selectOrderShuttle>
>  <tr:message for="shuttle1"/>
>  <tr:commandButton text="Submit"/>
>  </tr:panelGroupLayout>
> </tr:form>
>
> The layout page uses f:view wrapping trh:html, trh:head and trh:body.
> The trh:body element wraps one of several subviews which wrap several
> tiles one of which is the above tile.
>
> An excerpt from the generated page looks like this:
>
>  ...
>
>  <form id="content:j_id_jsp_709084578_0pc4"
> name="content:j_id_jsp_709084578_0pc4" style="margin:0px"
> method="POST" onkeypress="return
> _submitOnEnter(event,'content:j_id_jsp_709084578_0pc4');"
> action="/tutoring/tickerManagerPage.do"><!--Start:
> org.apache.myfaces.trinidad.Panel["j_id_jsp_709084578_1pc4"]--><div><!--Start:
> org.apache.myfaces.trinidad.Messages["j_id_jsp_709084578_3pc4"]--><span
> id="content:j_id_jsp_709084578_3pc4"></span><div><!--Start:
> org.apache.myfaces.trinidad.Object["j_id_jsp_709084578_2pc4"]-->
>  <hr class="af_separator">
>  </div><script>var _shuttle_no_items='There are no items to move.';var
> _shuttle_no_items_selected='Please select the items to move
> first.';</script><!--Start:
> org.apache.myfaces.trinidad.SelectOrder["shuttle1"]--><table
> cellpadding="0" cellspacing="0" border="0" width="10%" summary=""
> id="content:shuttle1" class="af_selectManyShuttle"><tr>
>  <td class="x9u" valign="bottom">Available values:</td>
>
>
>  <td></td>
>
>  <td class="x9u" valign="bottom">Selected values:</td>
>  </tr><tr>
>  <td><!--Start:
> org.apache.myfaces.trinidad.SelectOrder["shuttle1"]--><table
> class="af_selectOrderShuttle_box" style="width:100%"
> cellpadding="0" cellspacing="0" border="0" summary=""><tbody><tr>
>  <td class="af_selectOrderShuttle_box-top-start"></td>
>
>  <td class="af_selectOrderShuttle_box-top"></td>
>
>  <td class="af_selectOrderShuttle_box-top-end"></td>
>  </tr><tr>
>
>  <td class="af_selectOrderShuttle_box-start"></td>
>
>  <td class="x59"><div class="x55"><table cellpadding="0" border="0"
> summary=""><tr>
>  <td nowrap valign="middle"><!--Start:
> org.apache.myfaces.trinidad.SelectOrder["shuttle1"]--><span
> class="x1i">
>  <select multiple id="content:shuttle1:leading"
> name="content:shuttle1:leading" title="Available values:"
> ondblclick="TrShuttleProxy._moveItems('content:shuttle1:leading','content:shuttle1:trailing','content:j_id_jsp_709084578_0pc4');"
> onchange="TrShuttleProxy._displayDesc('content:shuttle1:leading','content:j_id_jsp_709084578_0pc4');"
> class="x1y" size="10">
>  <option value="0" title="The First Item Desc">First</option>
>
>  <option value="1" title="The Second Item Desc">Second</option>
>
>  <option value="2" title="The Third Item Desc">Third</option>
>
>
>  <option value="">_______________</option>
>  </select>
>  <!--Start:
> org.apache.myfaces.trinidad.SelectOrder["shuttle1"]--><label
> for="content:shuttle1:leading" class="x8v">Available
> values:</label></span></td>
>  </tr><tr>
>  <td nowrap valign="middle"></td>
>
>  <td><img src="/tutoring/adf/images/t.gif" alt="" width="1"
> height="8"></td>
>  </tr><tr>
>  <td nowrap valign="middle" colspan="3"><span
> class="x0">Description</span><div></div>
>
>  <textarea rows="2" id="content:shuttle1:leading:desc"
> name="content:shuttle1:leading:desc" readonly cols="18"
> wrap="soft"></textarea>
>  <!--Start:
> org.apache.myfaces.trinidad.SelectOrder["shuttle1"]--><label
> for="content:shuttle1:leading:desc"
> class="x8v">Description</label></td>
>
>  <td><img src="/tutoring/adf/images/t.gif" alt="" width="1"
> height="68"></td>
>  </tr></table></div></td>
>
>  <td class="af_selectOrderShuttle_box-end"></td>
>  </tr><tr>
>  <td class="af_selectOrderShuttle_box-bottom-start"></td>
>
>  <td class="af_selectOrderShuttle_box-bottom"></td>
>
>
>  <td class="af_selectOrderShuttle_box-bottom-end"></td>
>  </tr></tbody></table></td>
>
>  <td align="center" valign="middle" nowrap style="padding:5px"><a
> href="javascript:TrShuttleProxy._moveItems('content:shuttle1:leading','content:shuttle1:trailing');"><img
> src="/tutoring/images/starsSkin/move.png" width="16"
> height="16" border="0" style="display:block" title="Move selected items to
> other list" alt="Move selected items to other list"></a><a
> href="javascript:TrShuttleProxy._moveItems('content:shuttle1:leading','content:shuttle1:trailing');"
> class="xi" title="Move selected items to other list">Move</a><div
> style="margin-top:5px"></div><a
> href="javascript:TrShuttleProxy._moveAllItems('content:shuttle1:leading','content:shuttle1:trailing');"><img
> src="/tutoring/images/starsSkin/moveAll.png" width="16"
> height="16" border="0" style="display:block" title="Move all items to other
> list" alt="Move all items to other list"></a><a
> href="javascript:TrShuttleProxy._moveAllItems('content:shuttle1:leading','content:shuttle1:trailing');"
> class="xi" title="Move all items to other list">Move All</a><div
> style="margin-top:5px"></div><a
> href="javascript:TrShuttleProxy._moveItems('content:shuttle1:trailing','content:shuttle1:leading');"><img
> src="/tutoring/image
> s/starsSkin/remove.png" width="16" height="16" border="0"
> style="display:block" title="Remove selected items from list" alt="Remove
> selected items from list"></a><a
> href="javascript:TrShuttleProxy._moveItems('content:shuttle1:trailing','content:shuttle1:leading');"
> class="xi" title="Remove selected items from list">Remove</a><div
> style="margin-top:5px"></div><a
> href="javascript:TrShuttleProxy._moveAllItems('content:shuttle1:trailing','content:shuttle1:leading');"><img
> src="/tutoring/images/starsSkin/removeAll.png" width="16"
> height="16" border="0" style="display:block" title="Remove all items from
> list" alt="Remove all items from list"></a><a href=<
> a class="moz-txt-link-rfc2396E"
> href="javascript:TrShuttleProxy._moveAllItems('content:shuttle1:trailing','content:shuttle1:leading');">"javascript:TrShuttleProxy._moveAllItems('content:shuttle1:trailing','content:shuttle1:leading');"
> class="xi" title="Remove all items from list">Remove All</a></td>
>
>  <td><!--Start:
> org.apache.myfaces.trinidad.SelectOrder["shuttle1"]--><table
> class="af_selectOrderShuttle_box" style="width:100%"
> cellpadding="0" cellspacing="0" border="0" summary=""><tbody><tr>
>  <td class="af_selectOrderShuttle_box-top-start"></td>
>
>  <td class="af_selectOrderShuttle_box-top"></td>
>
>  <td class="af_selectOrderShuttle_box-top-end"></td>
>
>  </tr><tr>
>  <td class="af_selectOrderShuttle_box-start"></td>
>
>  <td class="x59"><div class="x55"><table cellpadding="0" border="0"
> summary=""><tr>
>  <td nowrap valign="middle"><!--Start:
> org.apache.myfaces.trinidad.SelectOrder["shuttle1"]--><span
> class="x1i">
>  <select multiple id="content:shuttle1:trailing"
> name="content:shuttle1:trailing" title="Selected values:"
> ondblclick="TrShuttleProxy._moveItems('content:shuttle1:trailing','content:shuttle1:leading','content:j_id_jsp_709084578_0pc4');"
> onchange="TrShuttleProxy._displayDesc('content:shuttle1:trailing','content:j_id_jsp_709084578_0pc4');"
> class="x1y" size="10">
>  <option value="">_______________</option>
>  </select>
>  <!--Start:
> org.apache.myfaces.trinidad.SelectOrder["shuttle1"]--><label
> for="content:shuttle1:trailing" class="x8v">Selected
> values:</label></span></td>
>
>
>  <td align="center" valign="middle"><a
> href="javascript:TrShuttleProxy._orderTopBottomList(0,'content:shuttle1:trailing');"><img
> src="/tutoring/images/starsSkin/reordertop_enabled.png"
> width="16" height="16" border="0" title="Move selected items to top of list"
> alt="Move selected items to top of list"></a><br><a
> href="javascript:TrShuttleProxy._orderList(0,'content:shuttle1:trailing');"><img
> src="/tutoring/images/starsSkin/reorderup_enabled.png"
> width="16" height="16" border="0" title="Move selected items up one in list"
> alt="Move selected items up one in list"></a><img
> src="/tutoring/adf/images/t.gif" alt="" width="1"
> height="15"><br><a
> href="javascript:TrShuttleProxy._orderList(1,'content:shuttle1:trailing');"><img
> src="/tutoring/images/starsSkin/reorderdown_enabled.png"
> width="16" height="16" border="0" title="Move selected items down one in
> list" alt="Move selected items down one in list"></a><br><a
> href="javascript:TrShuttleProxy._orderTopBottomList(1,'content:shuttle1:trailing');"><img
> src="/tutoring/images/starsSkin/reorderbottom_enabled.png"
> width="16" height="16" border="0" title="Move selected items to bottom of
> list" alt="Move selected items to bottom of list"></a></td>
>
>  <td></td>
>  </tr><tr>
>  <td nowrap valign="middle"></td>
>
>  <td><img src="/tutoring/adf/images/t.gif" alt="" width="1"
> height="8"></td>
>  </tr><tr>
>  <td nowrap valign="middle" colspan="3"><span
> class="x0">Description</span><div></div>
>  <textarea rows="2" id="content:shuttle1:trailing:desc"
> name="content:shuttle1:trailing:desc" readonly cols="18"
> wrap="soft"></textarea>
>
>  <!--Start:
> org.apache.myfaces.trinidad.SelectOrder["shuttle1"]--><label
> for="content:shuttle1:trailing:desc"
> class="x8v">Description</label></td>
>
>  <td><img src="/tutoring/adf/images/t.gif" alt="" width="1"
> height="68"></td>
>  </tr></table></div></td>
>
>  <td class="af_selectOrderShuttle_box-end"></td>
>  </tr><tr>
>  <td class="af_selectOrderShuttle_box-bottom-start"></td>
>
>  <td class="af_selectOrderShuttle_box-bottom"></td>
>
>  <td class="af_selectOrderShuttle_box-bottom-end"></td>
>
>  </tr></tbody></table><input type="hidden"
> name="content:shuttle1:leading:items" value="0;1;2;"><input
> type="hidden" name="content:shuttle1:trailing:items"
> value=""><script>content_shuttle1_leading_desc=new
> Array('The First Item Desc','The Second Item Desc','The Third Item
> Desc','');content_shuttle1_trailing_desc=new
> Array('');window["_content_j_id_jsp_709084578_0pc4_content_shuttle1_orig"]=TrShuttleProxy._copyLists('content_shuttle1','content_j_id_jsp_709084578_0pc4');</script></td>
>  </tr></table><!--Start:
> org.apache.myfaces.trinidad.SelectOrder["shuttle1"]--><label
> for="content:shuttle1" class="x8v">Selected Values</label><div><!--Start:
> org.apache.myfaces.trinidad.Object["j_id_jsp_709084578_2pc4"]-->
>  <hr class="af_separator">
>  </div><!--Start:
> org.apache.myfaces.trinidad.Message["j_id_jsp_709084578_8pc4"]--><span
> class="x89"><span id="content:shuttle1::msg" style="display:none;"
> class="x8e"></span></span><div><!--Start:
> org.apache.myfaces.trinidad.Object["j_id_jsp_709084578_2pc4"]-->
>  <hr class="af_separator">
>  </div><!--Start:
> org.apache.myfaces.trinidad.Command["j_id_jsp_709084578_9pc4"]-->
>  <button type="button"
> onclick="submitForm('content:j_id_jsp_709084578_0pc4',1,{source:'content:j_id_jsp_709084578_9pc4'});return
> false;" class="x6l">Submit</button>
>
>  </div><input type="hidden"
> name="org.apache.myfaces.trinidad.faces.FORM"
> value="content:j_id_jsp_709084578_0pc4"><span
> id="_content:j_id_jsp_709084578_0pc4_Postscript"><input
> type="hidden" name="javax.faces.ViewState"
> value="!7dd856e8"><script>function
> _content_j_id_jsp_709084578_0pc4Validator(){return
> true;}var
> content_j_id_jsp_709084578_0pc4_SF={};</script><script>var
> _content_j_id_jsp_709084578_0pc4_Reset=['_resetItems(\'content_shuttle1\',\'content_j_id_jsp_709084578_0pc4\');'];</script></span><script>_submitFormCheck();</script>
>  </form>
>  ...
>
> I have not included the generated Trinidad JavaScript, but I have
> confirmed that it is generated at
>
> http://localhost:8080/myWebApp/adf/jsLibs/DebugCommon1_2_1.js
> where
> JavaScript debug output from Trinidad is turned on.
>
> I noticed that the live demo does work for the SelectManyShuttle when
> you turn on the leading and trailingDescShown attributes using the
> embedded attribute editor. I also noticed that the generated live demo
> JavaScript code appears to be different than the generated code that I
> am seeing in my HTML.
>
> I can see that there is a hidden input element with its onchange
> attribute set to:
>
> onchange="TrShuttleProxy._displayDesc('content:shuttle1:trailing','content:j_id_jsp_709084578_0pc4');"
>
> and that there is inline JavaScript generated as:
>
>  <script>content_shuttle1_leading_desc=new Array('The First
> Item Desc',
>  'The Second Item Desc',
>  'The Third Item Desc','');
>  content_shuttle1_trailing_desc=new Array('');
> window["_content_j_id_jsp_709084578_0pc4_content_shuttle1_orig"]=
> TrShuttleProxy._copyLists('content_shuttle1','content_j_id_jsp_709084578_0pc4');
>  </script>
>
>
> I could grab the generated source and the generated JavaScript and put
> the two together, but I'm hesitant to go to them much reverse
> engineering effort, if someone can see the problem and offer a solution
> or offer a simple example first.
>
> Has anyone else succeeded in getting the SelectOrderShuttle leading or
> trailingDescShown textarea working? If so, can you see what I have
> failed to do or alternatively post a "small" example that works with
> Trinidad v1.2.1?
>
> I have also tried a SelectManyShuttle and everything works with it as
> well except, of course, displaying the description in the text area.
>
>  -=> Gregg <=-
>
>
>
>
>
>

Reply via email to