here is my groovy file 

package gov.hhs.acf.web.util;


import java.util.ArrayList;
import java.util.List;


import org.apache.wicket.Component;
import org.apache.wicket.MarkupContainer;
import org.apache.wicket.markup.IMarkupResourceStreamProvider;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.util.resource.IResourceStream;
import org.apache.wicket.util.resource.StringResourceStream;


class UserMenuItems implements MenuItems {

        
        List<Component> components ;
        
        
        void myInit(){
                components= new ArrayList<Component>();
                components.add (new OMBCircularPanel());
                components.add (new SendComments());
        }  
        
        @Override
        public List<Component> getComponents() {
                myInit();
                return components;
        }
        
                
        private abstract  class CustomPanel  extends  Panel implements 
IMarkupResourceStreamProvider{
                public CustomPanel() {
                        super(MenuItems.menuItemId);
                }
                public IResourceStream getMarkupResourceStream(MarkupContainer
container,Class<?> containerClass){
                        return new StringResourceStream(getMarkUp());
                }

                protected abstract String getMarkUp();
        }

        private  class OMBCircularPanel   extends  CustomPanel {
                public OMBCircularPanel() {
                        super();
                }
                @Override
                protected String getMarkUp() {
                        return """
                                <wicket:panel>
                                        
http://www.whitehouse.gov/sites/default/files/omb/assets/a133/a133_revised_2007.pdf
A-133 OMB Circular 
                                </wicket:panel>
                        """;
                }
        }

        private  class SendComments   extends    CustomPanel  {
                public SendComments() {
                        super();
                }
                @Override
                protected String getMarkUp() {
                        return """
                                <wicket:panel>
                                         mailto:[email protected] Send 
Comments 
                                </wicket:panel>
                        """;
                }
        }

}



this is a simple class creating some wicket panels . 

When I  call getComponents , I get this exception 

Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
        at
gov.hhs.acf.web.util.UserMenuItems$OMBCircularPanel.<init>(UserMenuItems.groovy:48)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at
org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
        at
org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:107)
        at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:52)
        at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:192)
        at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:200)
        at gov.hhs.acf.web.util.UserMenuItems.myInit(UserMenuItems.groovy:24)
        at gov.hhs.acf.web.util.UserMenuItems$myInit.callCurrent(Unknown Source)
        at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:44)
        at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:143)
        at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:147)
        at
gov.hhs.acf.web.util.UserMenuItems.getComponents(UserMenuItems.groovy:30)
        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:597)
        at
org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler.invoke(LazyInitProxyFactory.java:416)
        at org.apache.wicket.proxy.$Proxy142.getComponents(Unknown Source)
        at gov.hhs.acf.web.pages.common.BasePage.basePageInit(BasePage.java:164)
        at gov.hhs.acf.web.pages.common.BasePage.<init>(BasePage.java:60)
        at gov.hhs.acf.web.pages.common.HomePage.<init>(HomePage.java:40)
        ... 48 more



please somebody help me what is the error referring to, I donot have any
method called init  I tried debugger  and noticed the  exception is thrown
before it reaches  super class constructor  .

the same code when I replace """....."""  with normal java string works well
, please tell me what is going wrong  , I want   this as groovy becasue I
want to dynamically load  MenuItems and change them without restarting the
server  

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/wicket-groovy-guru-s-please-help-me-tp2965146p2965146.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to