7 Replies Latest reply on Jan 1, 2009 6:07 PM by nathandennis

    scollableDateTable binding issues

    nathandennis

      im having trouble with the scrollable data table binding attribute.

      seam 2.1.0sp1
      richfaces snap 3.3.0 > 12/19
      jboss 4.2.2


      javax.el.ELException: /maintenance/include/lookup.xhtml @46,62 binding="#{phyEditAction.stable}": java.lang.IllegalArgumentException: argument type mismatch
       at com.sun.facelets.el.TagValueExpression.setValue(TagValueExpression.java:101)
       at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:237)
       ... 94 more
      Caused by: java.lang.IllegalArgumentException: argument type mismatch
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at javax.el.BeanELResolver.setValue(BeanELResolver.java:108)
       at javax.el.CompositeELResolver.setValue(CompositeELResolver.java:68)
       at com.sun.faces.el.FacesCompositeELResolver.setValue(FacesCompositeELResolver.java:93)
       at org.jboss.el.parser.AstPropertySuffix.setValue(AstPropertySuffix.java:73)
       at org.jboss.el.parser.AstValue.setValue(AstValue.java:84)
       at org.jboss.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:249)
       at com.sun.facelets.el.TagValueExpression.setValue(TagValueExpression.java:93)
       ... 95 more
      
      


      backin bean
      import org.richfaces.component.UIScrollableDataTable;
      import org.richfaces.model.selection.SimpleSelection;
      ........
      
      @Stateful
      @Name("phyEditAction")
      @Scope(ScopeType.CONVERSATION)
      public class PhyEditAction implements PhyEditLocal{
       private SimpleSelection selection = new SimpleSelection();
       private UIScrollableDataTable stable;
      
      ...........
      public SimpleSelection getSelection() {
       return selection;
       }
      
       public void setSelection(SimpleSelection selection) {
       this.selection = selection;
       }
       public String takeSelection() {
       this.phy = null;
       Iterator<Object> iterator = getSelection().getKeys();
       while (iterator.hasNext()){
       Object key = iterator.next();
       stable.setRowKey(key);
       if (stable.isRowAvailable() && this.phy ==null) {
       this.phy = ((Phy) stable.getRowData());
       }
       }
       selectPhy(null);
       return null;
       }
      
       public UIScrollableDataTable getStable() {
       return stable;
       }
      
       public void setStable(UIScrollableDataTable stable) {
       this.stable = stable;
       }

      there is also an interface for this bean.


       <rich:modalPanel id="lookupmp" autosized="false"
       height="400"
       width="320"
       top="20" style="padding:0px;height:">
       <f:facet name="header" style="height:20px;">
       <h:outputText value="#{messages['maintenance.phy.phylook.mptitle']}" />
       </f:facet>
      
       <f:facet name="controls">
       <h:graphicImage value="/img/error.gif"
       style="cursor:pointer;border:0px;"
       onclick="Richfaces.hideModalPanel('lookupmp');"/>
       </f:facet>
       <rich:panel style="text-align:left;">
       <s:div id="lookupcontainer" style="position:relative;top:0px;left:0px;">
       <s:div rendered="#{phyEditAction.phySearchsw}" style="padding:0px;z-index:300;">
       <h:form>
       <rich:scrollableDataTable
       frozenColCount="1" height="300px"
       width="300px"
       id="phyList"
       rows="20" columnClasses="colMnm,colName"
       value="#{phyEditAction.phySearchList}" var="p"
       first="0"
       rowKeyVar="rkv"
       binding="#{phyEditAction.stable}"
       selection="#{phyEditAction.selection}">
       <rich:column id="make">
       <f:facet name="header"><h:outputText styleClass="headerText"
       value="#{messages['maintenance.phy.label.phyMnm']}" /></f:facet>
       <h:outputText value="#{p.phyMnm}" />
       </rich:column>
       <rich:column id="model">
       <f:facet name="header"><h:outputText styleClass="headerText"
       value="#{messages['maintenance.phy.label.phyName']}" /></f:facet>
       <h:outputText value="#{p.phyName}" />
       </rich:column>
       </rich:scrollableDataTable>
       <br/>
       <a:commandButton value="Show Current Selection" reRender="mainpanel"
       action="#{phyEditAction.takeSelection}" >
       <s:conversationId/>
       <rich:componentControl for="lookupmp" operation="hide" event="oncomplete"/>
       </a:commandButton>
       </h:form>
       </s:div>
       </s:div>
       </rich:panel>
       </rich:modalPanel>
      


      i have read everything i could find in the doc.. got the example code out of the trunk.. im new to creating jsf components dynamically... i must be missing something. i even tried using a UIComponent as the backing because some something i read in the doc then casting it to the scrollable table.. didnt work.

      any help would be greatly appreciated.

        • 1. Re: scollableDateTable binding issues
          nathandennis

          i found something in the seam doc that is relevant.
          http://docs.jboss.com/seam/2.0.1.GA/reference/en/html/conversations.html#d0e5182

          so i restructured it correctly by moving the jsf bindings into an event bean

          
          @Name("phyScroll")
          @Scope(ScopeType.EVENT)
          public class PhyScroll implements PhyScrollLocal{
          
           private SimpleSelection selection = new SimpleSelection();
           private UIScrollableDataTable stable;
          
           @In(required=false)
           private PhyEditLocal phyEditAction;
          
          
          
           public String takeSelection() {
           this.phyEditAction.setPhy(null);
          ..... getter and setters
          


          the unfortunate thing is i get the same error.

          ERROR [STDERR] enance/include/phylookup.xhtml @46,58 binding="#{phyScroll.stable}": java.lang.IllegalArgumentException: argument type mismatch
           at com.sun.facelets.el.TagValueExpression.setValue(TagValueExpression.java:101)
           at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:237)
           ... 94 more
          Caused by: java.lang.IllegalArgumentException: argument type mismatch
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:585)
           at javax.el.BeanELResolver.setValue(BeanELResolver.java:108)
           at javax.el.CompositeELResolver.setValue(CompositeELResolver.java:68)
           at com.sun.faces.el.FacesCompositeELResolver.setValue(FacesCompositeELResolver.java:93)
           at org.jboss.el.parser.AstPropertySuffix.setValue(AstPropertySuffix.java:7
          

          has anyone actually made this work? any help greatly appreciated

          • 2. Re: scollableDateTable binding issues
            nbelaevski

            Hello,

            Looks like classloaders misconfiguration. Try to use UIComponent as bean property type.

            • 3. Re: scollableDateTable binding issues
              nathandennis

              thanks for the reply...

              i cant say if it worked or not because i ran into the SimpleSelector exception referenced in the other new scrollabledatatable thread.
              but at least my error changed.

              • 4. Re: scollableDateTable binding issues
                nbelaevski

                Nathan,

                What if you remove selection binding and try UIComponent?

                • 5. Re: scollableDateTable binding issues
                  nathandennis

                  im sorry i dont completely follow. do you mean change the datatype on the backing bean or remove the jsf selection binding completely?

                  it will render without the selection binding,,, but im not sure how to retrieve the selections without it. all the examples use the selection binding. I'm lost when it comes to using UIComponent.

                  if this is the solution can you give a simple example of how to do this or direct us to a place where we can find one?

                  i was going to have to find an example for scrollable datatable's binding attribute using UIComponent anyway.

                  thanks for the reply and any help.

                  • 6. Re: scollableDateTable binding issues
                    nbelaevski

                    Nathan,

                    I meant to say that you can remove selection="#{...}" from your page code if it causes issues, change property type to UIComponent and check if binding now works fine. That is just to check if that works.

                    Please post environment information as described in http://www.jboss.com/index.html?module=bb&op=viewtopic&t=147992

                    • 7. Re: scollableDateTable binding issues
                      nathandennis

                      its issue has become a border line cross post... let's work out of
                      http://www.jboss.com/index.html?module=bb&op=viewtopic&t=147992

                      since the other guy that had the issue will be watching that one as well. i will link this post on the other thread to keep track of the above code...

                      thanks for the response.