Return-Path: Delivered-To: apmail-myfaces-users-archive@www.apache.org Received: (qmail 27339 invoked from network); 11 Oct 2007 18:43:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Oct 2007 18:43:21 -0000 Received: (qmail 64694 invoked by uid 500); 11 Oct 2007 18:43:04 -0000 Delivered-To: apmail-myfaces-users-archive@myfaces.apache.org Received: (qmail 64244 invoked by uid 500); 11 Oct 2007 18:43:02 -0000 Mailing-List: contact users-help@myfaces.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "MyFaces Discussion" Delivered-To: mailing list users@myfaces.apache.org Received: (qmail 64233 invoked by uid 99); 11 Oct 2007 18:43:02 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Oct 2007 11:43:02 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jeross@hotmail.co.uk designates 65.54.246.230 as permitted sender) Received: from [65.54.246.230] (HELO bay0-omc3-s30.bay0.hotmail.com) (65.54.246.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Oct 2007 18:43:03 +0000 Received: from BLU119-W35 ([10.6.22.70]) by bay0-omc3-s30.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 11 Oct 2007 11:42:20 -0700 Message-ID: Content-Type: multipart/alternative; boundary="_93dbf83a-e37f-497c-939e-43dfb34d94c0_" X-Originating-IP: [86.134.94.131] From: Joe Rossi To: Subject: [|Trinidad] RE: Problem auto-refreshing tables Date: Thu, 11 Oct 2007 18:42:20 +0000 Importance: Normal In-Reply-To: References: MIME-Version: 1.0 X-OriginalArrivalTime: 11 Oct 2007 18:42:20.0946 (UTC) FILETIME=[74EC2720:01C80C36] X-Virus-Checked: Checked by ClamAV on apache.org --_93dbf83a-e37f-497c-939e-43dfb34d94c0_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Any pointers on this one from the Trinidad experts? This is about to really= start hitting my project deliverables :-( My gut feel is that it Trinidad is comparing old state to new state to work= out whether or not to send a PPR update to the table and it's somehow fail= ing if the last row is removed? If one of the Trinidad gurus points me in t= he right direction of the code I will debug into it. btw - it appears that the same problem occurs with removing the last row of= a branch in a tree table. From: jeross@hotmail.co.uk To: users@myfaces.apache.org Subject: Problem auto-refreshing tables Date: Tue, 2 Oct 2007 18:39:34 +0000 =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= I'm hitting a problem with auto-refreshing of tables using Trinidad 1.2.1, = facelets and JSF 1.2 (Sun RI). I've condensed the scenario down to a small = test case shown below. The summary is: - I have a page which displays a table containing a collection of objects=20 - Each row of the table contains two command links - one to edit the row an= d another to delete the row - Both links pop-up a dialog with details of the row. Hitting the "save" bu= tton on the dialog will either save the edit changes (if invoked from the e= dit link) or delete the row (if invoked from the delete link). - The table has a partialTriggers attribute which attempts to refresh the t= able contents whenever a row is edited or deleted (i.e. partialTriggers con= tains the ids of the edit and delete links) - Everything appears to work fine apart from deletion of the last row in th= e table whereby the table does not automatically refresh.=20 Is this a bug or am I doing something silly? Is there a better way to achie= ve what I'm trying to do? thanks in advance for any help. Here's the source code: widgetList.xhtml (page containing the table):=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D = = = = = widgetDial= og.xhtml (the dialog that gets popped up when edit or delete is clicked):= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D = = WidgetList.java (backing bean for the main page - manages the collection of= widgets)=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3Dpublic class WidgetList{ public WidgetLis= t() { _createInitialTestValues(); } public List getWidgetLi= st() { return _widgetBeans; } public Widget getNewWidgetBean() { = Widget widget =3D new Widget(this, ""); widget.setOperation("create");= return widget; } private void _createInitialTestValues() { _wid= getBeans.add(new Widget(this, "w1")); _widgetBeans.add(new Widget(this, = "w2")); _widgetBeans.add(new Widget(this, "w3")); } private List _widgetBeans =3D new ArrayList();}Widget.java (backing bean for = the individual rows)=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D/** * Widget is a test bean */= public class Widget{ public Widget(WidgetList widgetList, String name) { = _widgetList =3D widgetList; _name =3D name; } public String getNa= me() { return _name; } public void setName(String name) { _name = =3D name; } public String getOperation() { return _operation; } pub= lic void setOperation(String operation) { assert(operation.equals("edit= ") || operation.equals("create") || operation.equals("delete")); _operat= ion =3D operation; } public String commitAction() { if (_operation.eq= uals("create")) { _widgetList.getWidgetList().add(this); } if= (_operation.equals("delete")) { _widgetList.getWidgetList().remove= (this); } if (_operation.equals("edit")) { // no change to ow= ning collection } TrinidadFacesUtils.endDialog(_widgetList); retur= n null; } public String cancelAction() { TrinidadFacesUtils.endDial= og(this); return null; } @Override public boolean equals(Object= obj) { if (obj instanceof Widget) { Widget w =3D (Widget) obj;= return _name.equals(w._name); } return false; } @Override pu= blic int hashCode() { return _name.hashCode(); } @Override public St= ring toString() { return _name; } private String _name; private Stri= ng _operation =3D "edit"; private WidgetList _widgetList;}=0A= =0A= =0A= =0A= =0A= Do you know a place like the back of your hand? Share local knowledge with = BackOfMyHand.com=0A= _________________________________________________________________ Feel like a local wherever you go. http://www.backofmyhand.com= --_93dbf83a-e37f-497c-939e-43dfb34d94c0_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Any pointers on = this one from the Trinidad experts? This is about to really start hitting m= y project deliverables :-(

My gut feel is that it Trinidad is compar= ing old state to new state to work out whether or not to send a PPR update = to the table and it's somehow failing if the last row is removed? If one of= the Trinidad gurus points me in the right direction of the code I will deb= ug into it.

btw - it appears that the same problem occurs with remov= ing the last row of a branch in a tree table.




From: jeross@hotmail.co.uk
To: users@myfa= ces.apache.org
Subject: Problem auto-refreshing tables
Date: Tue, 2 O= ct 2007 18:39:34 +0000

=0A= =0A= = =0A= =0A= =0A= =0A=
=0A= =0A=
=0A=
I'm hitting a problem with auto-refreshing= of tables using Trinidad 1.2.1, facelets and JSF 1.2 (Sun RI). I've conden= sed the scenario down to a small test case shown below. The summary is:
=
- I have a page which displays a table containing a collection of objec= ts
- Each row of the table contains two command links - one to edit the= row and another to delete the row
- Both links pop-up a dialog with det= ails of the row. Hitting the "save" button on the dialog will either save t= he edit changes (if invoked from the edit link) or delete the row (if invok= ed from the delete link).
- The table has a partialTriggers attribute wh= ich attempts to refresh the table contents whenever a row is edited or dele= ted (i.e. partialTriggers contains the ids of the edit and delete links)- Everything appears to work fine apart from deletion of the last row in t= he table whereby the table does not automatically refresh.

Is this = a bug or am I doing something silly? Is there a better way to achieve what = I'm trying to do?

thanks in advance for any help.

Here's the = source code:

widgetList.xhtml (page containing the table):<= br style=3D"font-family: Courier New,Courier,Monospace;">=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml= 1-strict.dtd">
<tr:d= ocument id=3D"testForm" title=3D"test form"
  xmlns:h=3D"http://java.sun.com/jsf/html"  xmlns:f=3D"http://java.sun.c= om/jsf/core"
  xmlns:= ui=3D"http://java.sun.com/jsf/facelets"
  xmlns:tr=3D"http://myfaces.apache.org/trinidad">
  <tr:panelBorderL= ayout>
<= span style=3D"font-family: Courier New,Courier,Monospace;">  &nbs= p; <tr:form id=3D"widgetListForm">

      <tr:panelGroupLayout layou= t=3D"vertical">
 &= nbsp;      <tr:commandButton text=3D"Create New= Widget"
   = ;       action=3D"dialog:widgetDialog"=
     &n= bsp;    useWindow=3D"true" partialSubmit=3D"true"
      =     windowHeight=3D"300" windowWidth=3D"400"
       = ;   id=3D"createWidgetCommand">
          &= lt;tr:setActionListener from=3D"#{widgetListBean.newWidgetBean}"
      =       to=3D"#{pageFlowScope.widgetBean}" />
     = ;     <tr:setActionListener from=3D"#{'create'}"
     = ;       to=3D"#{pageFlowScope.widgetBean.oper= ation}" />
  =       </tr:commandButton>

        <tr:commandButt= on text=3D"Refresh Page" id=3D"refreshCommand">
        </tr= :commandButton>

    =     <tr:table id=3D"widgetTable" var=3D"widgetBean"
     &= nbsp;    value=3D"#{widgetListBean.widgetList}" rowBandingIn= terval=3D"1"
  &= nbsp;       partialTriggers=3D"refreshCommand= createWidgetCommand widgetTable:editWidgetCommand widgetTable:deleteWidget= Command">

  &= nbsp;       <tr:column>

       = ;     <f:facet name=3D"header">
       = ;       <tr:outputText value=3D"Widget Nam= e" />
   = ;         </f:facet>
     &nbs= p;      <tr:outputText value=3D"#{widgetBean.na= me}" />
=   &nb= sp;       </tr:column>
       = ;   <tr:column>
            &l= t;f:facet name=3D"header">
            = ;  <tr:outputText value=3D"Actions" />
        &nb= sp;   </f:facet>
            &= lt;tr:panelGroupLayout layout=3D"horizontal">
        &nbs= p;     <tr:commandLink action=3D"dialog:widgetDialog= "
    =             useWindo= w=3D"true" partialSubmit=3D"true"
           &= nbsp;    windowHeight=3D"300" windowWidth=3D"400"
      =           id=3D"editWidgetComm= and"
   &nb= sp;            short= Desc=3D"Edit the widget.">
            = ;    <tr:image source=3D"/skins/tn/images/ico_edit.gif" /= >
   &nb= sp;            <t= r:setActionListener from=3D"#{'edit'}"
          &n= bsp;       to=3D"#{widgetBean.operation}" /&g= t;
    = ;            <tr:= setActionListener from=3D"#{widgetBean}"
          =         to=3D"#{pageFlowScope.widgetBean= }" />
   = ;           </tr:comma= ndLink>
=   &nb= sp;           <tr:comm= andLink action=3D"dialog:widgetDialog"
          &n= bsp;     useWindow=3D"true" partialSubmit=3D"true"
     =            windowHeight= =3D"300" windowWidth=3D"400"
            =     id=3D"deleteWidgetCommand"
         &= nbsp;      shortDesc=3D"Delete the widget.">

    &n= bsp;           <tr:ima= ge source=3D"/skins/tn/images/ico_delete.gif" />
        &= nbsp;       <tr:setActionListener from=3D"= #{'delete'}"
  &= nbsp;           &nbs= p;   to=3D"#{widgetBean.operation}" />
        &= nbsp;       <tr:setActionListener from=3D"= #{widgetBean}"
  = ;            &n= bsp;   to=3D"#{pageFlowScope.widgetBean}" />
       = ;       </tr:commandLink>
      &nb= sp;     </tr:panelGroupLayout>
       &n= bsp;  </tr:column>
        </tr:table>

      </tr:panelGroupLayo= ut>
    = </tr:form>

  </tr:panelBorder= Layout>
= </tr:documen= t>


widgetDialog.xhtml (the dialog that gets popped up whe= n edit or delete is clicked):
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
<!DOCTYPE html
PUB= LIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">=
<tr:document id=3D"testDialog= " title=3D"Dialog"
  = xmlns:h=3D"http://java.sun.com/jsf/html"
  xmlns:f=3D"http://java.sun.com/jsf/core"
  xmlns:ui=3D"http://java.sun.com= /jsf/facelets"
  xmln= s:tr=3D"http://myfaces.apache.org/trinidad">
  <tr:form id=3D"widgetDialogForm">=

    <tr:panelFormLayout id=3D"w= idgetDialogForm" inlineStyle=3D"width:20%">
      <tr:inputText label= =3D"Widget Code"
 &nb= sp;      value=3D"#{pageFlowScope.widgetBean.name}= "
    =     id=3D"nameField" required=3D"true" showRequired=3D"true"=
    &= nbsp;   requiredMessageDetail=3D"Widget name must be entered."

    &n= bsp;   maximumLength=3D"10"/>

=       <f:facet name=3D"footer">
      &n= bsp; <tr:panelButtonBar>
          <tr:commandB= utton id=3D"saveCommand"
&= nbsp;           text=3D"#= {pageFlowScope.widgetBean.operation}"
          &nb= sp; action=3D"#{pageFlowScope.widgetBean.commitAction}" />
      &nb= sp;   <tr:commandButton id=3D"cancelCommand" text=3D"Cancel"
    &n= bsp;       action=3D"#{pageFlowScope.widgetBe= an.cancelAction}"
 &n= bsp;          immediate=3D"tru= e" />
   = ;     </tr:panelButtonBar>

      </f:facet><= /span>
    </tr= :panelFormLayout>
 = ; </tr:form>
</tr= :document>


WidgetList.java (backing bean for the main pag= e - manages the collection of widgets)
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
public class WidgetList
{


  public WidgetList()
  {
    _createInitialTestValues();
  }
 
&= nbsp; public List<Widget> getWidgetList()
  {
    return _widgetBeans;
  }
<= span style=3D"font-family: Courier New,Courier,Monospace;">  public Wi= dget getNewWidgetBean()
&n= bsp; {
    = Widget widget =3D new Widget(this, "");

    widget.setOperation("create");
    return widget;
  }
 
  private void _createInitialTestValues()
  {
    _widgetBeans.add(new Widget(this, "w1")= );
    _wid= getBeans.add(new Widget(this, "w2"));
    _widgetBeans.add(new Widget(this, "w3"));
  }

  private List<Widget> _widgetBeans =3D new Arr= ayList<Widget>();
}<= /span>


Widget.java (backing bean for the individual rows)<= br style=3D"font-family: Courier New,Courier,Monospace;">=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

/**
=  * Widget = is a test bean
 */
public class Widget=
{
  public Widget(WidgetList widgetList, String name)=
  {
    _widgetList =3D widget= List;
    _= name =3D name;

  }
 
  public String getName()
  {
    return _name;
  }
  public void setName(String name)
  {
    _name =3D name;
  }
&n= bsp; public String getOperation()
  {
 &nb= sp;  return _operation;
  }
  public = void setOperation(String operation)
  {
 &= nbsp;  assert(operation.equals("edit") || operation.equals("create") |= | operation.equals("delete"));
    _operation =3D operation;
  }

  pub= lic String commitAction()
=   {
   = ; if (_operation.equals("create"))

    {
      _widgetList.getWidgetList().add(this);
    }
    if (_operati= on.equals("delete"))
 = ;   {
 &nbs= p;    _widgetList.getWidgetList().remove(this);
    }
    if (_operation.equals(= "edit"))
   = ; {

   &nbs= p;  // no change to owning collection
    }
    TrinidadFacesUtils.endDialog(_widgetList);

    return null;
  }
 
  {
 = ;   TrinidadFacesUtils.endDialog(this);
   
    return null;
  }
 
  @Ove= rride
  public boolea= n equals(Object obj)

 = ; {
    if = (obj instanceof Widget)
&n= bsp;   {
 &= nbsp;    Widget w =3D (Widget) obj;
      return _name.equals= (w._name);
=   &nb= sp; }
    r= eturn false;

  }

  @Override
  public int hashCode()
  {
    return _name.hashCode();
  }

  @Ove= rride
  public String= toString()

  {
    return _name= ;
  }

  private String _name;
  private String _operation =3D "edit";
  private WidgetList _widgetLis= t;
}


=0A= =0A= =0A= =0A= =0A=


Do you know a place like the back of your hand? Share local k= nowledge with Ba= ckOfMyHand.com=0A=

Do you know a place like the back of your hand? Sh= are local knowledge with BackOfMyHand.com = --_93dbf83a-e37f-497c-939e-43dfb34d94c0_--