3 Replies Latest reply on May 12, 2009 12:14 PM by venuvanama

    How to disable rich:listShuttle

    venuvanama Newbie

      Hi,

      I am a new user of rich faces, we are using rich:listShuttle on some of our screens. We need to disable this component when a user without update privileges is using the screen. I am not sure how to disable this component.

      We are using rich faces 3.3.0

      Here is an example of listShuttle we are using:

      <rich:listShuttle id="fqdnPoliciesShuttle"
      var="item"
      sourceValue="#{createFqdnBean.sourcePolicies}"
      targetValue="#{createFqdnBean.targetPolicies}"
      orderControlsVisible="false"
      fastOrderControlsVisible="false"
      copyAllControlLabel=""
      copyControlLabel=""
      removeControlLabel=""
      removeAllControlLabel=""
      converter="#{policyConverter}">
      <f:facet name="sourceCaption">
      <h:outputText value="NAMS Policies" />
      </f:facet>
      <f:facet name="targetCaption">
      <h:outputText value="Fqdn Policies" />
      </f:facet>
      <rich:column>
      <h:outputText value="#{item.name}" />
      </rich:column>
      </rich:listShuttle>

      Thanks for your help.

      Venu

        • 1. Re: How to disable rich:listShuttle
          Tim Evers Master

          I have generally found that rather then trying to change an input component to readonly based on permissions, just don't render that component at all.

          So your page would look like this:

          <rich:listShuttle rendered="#{User.hasPermission}">
          
          </rich:listShuttle>
          <h:panelGrid rendered="#{not User.hasPermission}">
          ...
          </h:panelGrid>
          


          So here, you would show the list shuttle if the user has the permission. Otherwise just show a standard table.

          However, I can see that if you have the requirement for the user without the permission to see what is on both sides of the shuttle then this solution may not be good for you.

          If this is the case then I'm not sure what you can do, I mean you can do things like:
          controlsType="none"
          

          But this will only hide the buttons. Double clicking on a row will still copy it. I can't seem to stop that behaviour.

          So yeah, I think reall your solution at the moment would be to just render 2 different components based on the user's permissions.

          • 2. Re: How to disable rich:listShuttle
            Ilya Shaikovsky Master

            use next attributes
            controlType=none
            switchByDblClick=false
            switchByClick=false

            B.t.w. request for disabled state already reported but not implemented yet. But the workaround above should works fine for you.

            • 3. Re: How to disable rich:listShuttle
              venuvanama Newbie

              Thanks Kragoth and ilya_shaikovsky for your suggestions, this will definitely help me.

              Venu