الانتقال إلى المحتوى

How To Control <Af:panelspliter> At Runtime


tarek_fathi

Recommended Posts

I have a panel splitter layout component on my page and i want to enable/disable this splitter at run time from within a managed bean


In my managed bean I made this method 



    public  void doDiscloseSplit(PhaseEvent phaseEvent){       
         String currViewId = phaseEvent.getFacesContext().getViewRoot().getViewId();
         System.out.println("current view id="+currViewId);
         if (!currViewId.equals(this.getViewId())) {  
           spliter.setDisabled(false); 
           System.out.println("spliter is now false");
         }   
   }


but this method throws a runtime exception
javax.el.ELException: java.lang.NullPointerException

رابط هذا التعليق
شارك

عادة ال panel Splitter بيستخدم معاها collapsed وليس Disabled وهو اخفاء احد ال Panes وجعل الاخرى تمتد لتملا الصفحه باكملها ولكن بغض النظر عن collapsed او disable فاستخدام الميثود غير صحيح بالمرة لان الصح تستخدم ميثود زى isCollapsed او isDisabled او isPositionedFromEnd وكلهم بيرجعوا boolean وفى البروبرتى الخاصه بال disable او ال collapse او ال PositionedFromEnd فى ال property Inspector اعمل bind للخصائص دى على الميثود بتاعتك اللى فى ال managed Bean

رابط هذا التعليق
شارك

Hello Tarek,
it seems that you are using a phase listener.
in this case make sure that you have successfully used the binding attribute of the splitter to point to your variable <spliter>.
i think you forgot to do this and the null pointer is occurring because of null spliter.
we normally use such technique where the splitter resides in a template

رابط هذا التعليق
شارك

انضم إلى المناقشة

يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.

زائر
أضف رد على هذا الموضوع...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   تمت استعادة المحتوى السابق الخاص بك.   مسح المحرر

×   You cannot paste images directly. Upload or insert images from URL.

جاري التحميل
×
×
  • أضف...

برجاء الإنتباه

بإستخدامك للموقع فأنت تتعهد بالموافقة على هذه البنود: سياسة الخصوصية