2 Replies Latest reply on Dec 7, 2008 1:24 PM by Nick Belaevski

    setRendered(true) dont work on custom component

    jaabax Newbie

      hi
      i have the following problem

      i've created a custom component called MessageTip
      MessageTip has 2 components inside.. a HtmlAjaxCommandLink and a HtmlPanel (not rendered yet)... the idea is when i click in the command link, the htmlpanel is showed to the user..

      i put MessageTip in a jar.. i'm extending using Maven.. so i'm with the default structure.. it

      so i call my component

      <d:messageTip controller="TestBean" />
      


      i pass the managed bean to the controller atributte.. the managed bean that will turn the visibility to true after i click in the command link .. it extends the control class that has the main implementation..
      inside the managed bean i have

      //TestBean IS INSIDE MY PROJECT.. IS A JAVA FILE
      
      public class TestBean extends MessageTipController {
       public void openPopup(ActionEvent event){
       super.openPopup(event);
       }
      }
      
      //SelectOneListingController IS IN THE JAR AND IS .CLASS .. A PIECE OF MY FRAMEWORK
      
      public abstract class SelectOneListingController {
      
      public static UIComponent findParentComponent(UIComponent child, Class type) {
       do {
       child = child.getParent();
       if (child == null)
       return null;
       } while (!type.isInstance(child));
       return child;
       }
      
       public void openPopup(ActionEvent event) {
       UIMessageTip uMessageTip = (UIMessageTip )
       findParentComponent(event.getComponent(), UIMessageTip .class);
      // call setRendered(true); on the htmlPANEL
       uMessageTip.getPopup().setRendered(true);
       }
      }
      
      


      TestBean extends MessageTipController and call the super.openPopup() to set the visibility of HTMLPanel to true
      any exception occurs but the htmlPanel is not rendered on the screen
      anyone knows why?

      what i need to set the visibility of my custom component inside de JAR to true?

      srry about the english
      thanks




        • 1. Re: setRendered(true) dont work on custom component
          jaabax Newbie

          srry.. the correct code is

          //TestBean IS INSIDE MY PROJECT.. IS A JAVA FILE
          
          public class TestBean extends MessageTipController {
           public void openPopup(ActionEvent event){
           super.openPopup(event);
           }
          }
          
          //MessageTipController IS IN THE JAR AND IS .CLASS .. A PIECE OF MY FRAMEWORK
          
          public abstract class MessageTipController {
          
          public static UIComponent findParentComponent(UIComponent child, Class type) {
           do {
           child = child.getParent();
           if (child == null)
           return null;
           } while (!type.isInstance(child));
           return child;
           }
          
           public void openPopup(ActionEvent event) {
           UIMessageTip uMessageTip = (UIMessageTip )
           findParentComponent(event.getComponent(), UIMessageTip .class);
          // call setRendered(true); on the htmlPANEL
           uMessageTip.getHtmlPanel().setRendered(true);
           }
          }
          


          • 2. Re: setRendered(true) dont work on custom component
            Nick Belaevski Master

            Hello,

            Does this work if you use h:commandLink instead of a4j:commandLink?