cancel
Showing results for 
Search instead for 
Did you mean: 

Checkbox inside a:richList

cybermakoki
Champ in-the-making
Champ in-the-making
Hi all,

I'm desperate, i can't put a checkbox inside alfresco tag richlist, this is my code:

<h:selectBooleanCheckbox id="col19-check" value="#{r['dm:selected']}" />

I'm getting all the time this error:  Base is null: r

It's possible that this could be a bug?

Need help please  Smiley Sad  Smiley Sad  Smiley Sad
18 REPLIES 18

savic_prvoslav
Champ on-the-rise
Champ on-the-rise
<h:selectBooleanCheckbox id="col19-check" value="#{r.selected}" />

In Browsebean  add property evaluator for selected and implement how to calculate value for this and that is that.

cybermakoki
Champ in-the-making
Champ in-the-making
Yes, but i can't modify BrowseBean.java …

savic_prvoslav
Champ on-the-rise
Champ on-the-rise
well you override it with class thatextent thath bean

cybermakoki
Champ in-the-making
Champ in-the-making
I've tried that and doesn't works… it only works if you render the content with a h:dataTable

savic_prvoslav
Champ on-the-rise
Champ on-the-rise
f
aces-config-custom.xml
<managed-bean>
      <description>The bean that holds folder browse state.</description>
      <managed-bean-name>BrowseBean</managed-bean-name>
      <managed-bean-class>package.CustomBrowseBean</managed-bean-class>
      <managed-bean-scope>session</managed-bean-scope>…..

public class CustomBrowseBean extends BrowseBean {
getWindowsView() {

//for each node that is returned add this.
cont.get(i).addPropertyResolver("selected", resolover );

}
}

public NodePropertyResolver resolover = new NodePropertyResolver() {

   /**
    *
    */
   private static final long serialVersionUID = 903502146868126457L;

   @Override
   public Object get(Node node) {

   resolove the falue, return true or false;
   }
    };

cybermakoki
Champ in-the-making
Champ in-the-making
Thank you for your reply, but I don't understand this:

getWindowsView() {

//for each node that is returned add this.
cont.get(i).addPropertyResolver("selected", resolover );

}

I don't know how to use "getWindowsView()" method and I don't know how does the NodePropertyResolver works…

Can you help a bit more please? Smiley Sad

savic_prvoslav
Champ on-the-rise
Champ on-the-rise
public List<Node> getNodes();
public List<Node> getContent();

override this two methods like this

public List<Node> getNodes()
{
List<Node> list= super.getNodes();
for(int i=0;i<list.size();i++)
{
list.get(i).addpropres..("selected",resolover );
}
}

public NodePropertyResolver resolover = new NodePropertyResolver() {

   /**
    *
    */
   private static final long serialVersionUID = 903502146868126457L;

   @Override
   public Object get(Node node) {

   CHECK YOUR MODEL TO SEE IF NODE IS SELECTED OR NOT.
   }
    };

ps: This is more then enough to fix your problem. have fun.

cybermakoki
Champ in-the-making
Champ in-the-making
hi again..

I've tried your code but I'm getting NullPointerException Smiley Sad

this is de custombean:

package es.sic.beans;

import java.util.List;

import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.bean.BrowseBean;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.NodePropertyResolver;

public class CustomBrowseBean extends BrowseBean{

   /**
    *
    */
      
   private static final long serialVersionUID = 1L;
   public static QName PROPERTY_SELECCIONADO = QName.createQName("extension.dm", "propSelected");
   @Override
   public List<Node> getContent() {
      
         List<Node> list= super.getNodes();
      for(int i=0;i<list.size();i++)
      {
         list.get(i).addPropertyResolver("selected",resolver);
      }
      
      return list;

   }
   
   public NodePropertyResolver resolver = new NodePropertyResolver() {
         /**
          *
          */
         private static final long serialVersionUID = 903502146868126457L;

         @Override
         public Object get(Node node) {
            boolean selected = DefaultTypeConverter.INSTANCE.booleanValue(getNodeService().getProperty(node.getNodeRef(), PROPERTY_SELECTED));
            if(selected){
               return true;
            }else{
               return false;
            }
         }
   };
}

and this is browse.jsp:

   <h:selectBooleanCheckbox id="col10-check" value="#{r.selected}" />


and getting this error:


javax.faces.FacesException: javax.faces.el.EvaluationException: Cannot get value for expression '#{r.selected}'
at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:425)
at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:211)
at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:132)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:140)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(AuthenticationFilter.java:95)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.apache.jasper.JasperException: javax.faces.el.EvaluationException: Cannot get value for expression '#{r.selected}'
at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:419)
… 19 more
Caused by: javax.faces.el.EvaluationException: Cannot get value for expression '#{r.selected}'
at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:405)
at javax.faces.component.UIOutput.getValue(UIOutput.java:80)
at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getObjectValue(RendererUtils.java:186)
at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getBooleanValue(RendererUtils.java:152)
at org.apache.myfaces.shared_impl.renderkit.html.HtmlCheckboxRendererBase.encodeEnd(HtmlCheckboxRendererBase.java:62)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:539)
at org.alfresco.web.ui.common.Utils.encodeRecursive(Utils.java:174)
at org.alfresco.web.ui.common.Utils.encodeRecursive(Utils.java:169)
at org.alfresco.web.ui.common.renderer.data.RichListRenderer$DetailsViewRenderer.renderListRow(RichListRenderer.java:292)
at org.alfresco.web.ui.common.renderer.data.RichListRenderer.encodeChildren(RichListRenderer.java:118)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:527)
at javax.faces.webapp.UIComponentTag.encodeChildren(UIComponentTag.java:483)
at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:364)
at org.apache.jsp.jsp.browse.browse_jsp._jspx_meth_a_005frichList_005f1(browse_jsp.java:4734)
at org.apache.jsp.jsp.browse.browse_jsp._jspService(browse_jsp.java:1127)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
… 29 more
Caused by: javax.faces.el.EvaluationException: Exception getting value of property selected of base of type : org.alfresco.web.bean.repository.MapNode
at org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:99)
at org.apache.myfaces.el.ELParserHelper$MyPropertySuffix.evaluate(ELParserHelper.java:535)
at org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)
at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:386)
… 46 more
Caused by: java.lang.NullPointerException
at org.alfresco.service.cmr.repository.datatype.TypeConverter.booleanValue(TypeConverter.java:188)
at es.sic.beans.CustomBrowseBean$1.get(CustomBrowseBean.java:40)
at org.alfresco.web.bean.repository.QNameNodeMap.get(QNameNodeMap.java:117)
at org.alfresco.web.bean.repository.MapNode.get(MapNode.java:157)
at org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:81)
… 49 more

cybermakoki
Champ in-the-making
Champ in-the-making
I've correct the mistake, but the problem is still there,

I'me getting the same error: Base is null: r

I think that the richlist is getting the checkbox as if there is only one checkbox… when i select one and submit the form, all the checks are checked…