One thing I suggest you get away from is hard-coding your component
ids in your constructors.  I've looked at a lot of examples and most
folks let the caller supply the ids.  I think that might also be
what's confusing you here.  I don't know if it's bad to hard-code the
fragment id in your fragment class' constructor, but I'd let the
caller hand you the actual component id (that way it's reusable).  So,
I'd change it like this:

public CustomMenuComponent(String id) {
  super(id,"frag1");
  add(repeatingView);
}

I really think you're confusing yourself with all of this nesting,
though.  It doesn't look like you need all of this craziness.  If you
really don't like repeating the link-containing-a-label stuff, then
feel free to use a Fragment, but I don't know that the custom menu
stuff is needed.  Try this:

protected class MenuLink extends Fragment
{
  public LinkWithLabel(String id, Class<? extends WebPage> targetPage,
IModel<String> labelModel)
  {
    super(id, "linkWithLabel", MyPage.this);
    BookmarkablePageLink link = new BookmarkablePageLink("link", targetPage);
    link.add(new Label("label", labelModel));
    add(link);
  }
}

In your markup, you'll have:

<wicket:fragment id="menuLink">
  <a href="#" wicket:id="link"><label wicket:id="label"></a>
</wicket:fragment>

This code is off the top of my head, so there may be some compiler
errors, but you get the idea.

On Fri, Oct 10, 2008 at 11:17 AM, miro <[EMAIL PROTECTED]> wrote:
>
> here is the link
>
> http://pastebin.com/m4c9ed66b
>
> jwcarman wrote:
>>
>> Ahhh, ok.  I don't know that I've ever had that issue before.  How
>> about doing a pastebin (http://pastebin.com/).  Put your code in there
>> and send us a link?
>>
>> On Fri, Oct 10, 2008 at 10:51 AM, miro <[EMAIL PROTECTED]> wrote:
>>>
>>> -tag is just to   show html , if i donot put that browser would parse
>>> that
>>> html and we dont get to see actual html code .
>>>
>>> jwcarman wrote:
>>>>
>>>> What is <span-tag>?
>>>>
>>>> On Fri, Oct 10, 2008 at 10:42 AM, miro <[EMAIL PROTECTED]> wrote:
>>>>>
>>>>> This   is what i did to use fragment
>>>>>
>>>>>
>>>>>        protected class CustomMenuComponent extends Fragment {
>>>>>                private String headerlabel;
>>>>>                private RepeatingView   repeatingView = new
>>>>> RepeatingView("repater");
>>>>>
>>>>>                public CustomMenuComponent() {
>>>>>                        super("custmenu","frag1");
>>>>>                        add(repeatingView);
>>>>>                }
>>>>>
>>>>>                protected void addCustomLink(CustomLinkComponenet
>>>>> customLinkComponenet){
>>>>>
>>>>>                        repeatingView.add(customLinkComponenet);
>>>>>                }
>>>>>
>>>>>                protected Label getHeader(){
>>>>>                        return new Label("hl",headerlabel);
>>>>>                }
>>>>>        }
>>>>>
>>>>>        protected class CustomLinkComponenet extends  Fragment  {
>>>>>                String displayName;
>>>>>                Class  clazz;
>>>>>                public CustomLinkComponenet(String displayName, Class
>>>>> clazz) {
>>>>>                        super("customlink","frag2");
>>>>>                        this.displayName=displayName;
>>>>>                        this.clazz=clazz;
>>>>>                        add(getBookmarkablePageLink());
>>>>>                        add(getDisplayNameLabel());
>>>>>                }
>>>>>
>>>>>                protected BookmarkablePageLink
>>>>> getBookmarkablePageLink(){
>>>>>                        return new BookmarkablePageLink("link", clazz);
>>>>>                }
>>>>>
>>>>>                protected  Label  getDisplayNameLabel(){
>>>>>                        return new Label("lbl",displayName);
>>>>>                }
>>>>>        }
>>>>>  in my page constructor
>>>>>
>>>>>                RicolaGroupbox  ricolaGroupbox= new
>>>>> RicolaGroupbox("csrHome","ESP");
>>>>>
>>>>>                CustomMenuComponent  customMenuComponent= new
>>>>> CustomMenuComponent();
>>>>>                customMenuComponent.addCustomLink(new
>>>>> CustomLinkComponenet("Storage
>>>>> Inbox",Index.class));
>>>>>
>>>>>
>>>>>                ricolaGroupbox.add(customMenuComponent);
>>>>>               add(ricolaGroupbox);
>>>>>
>>>>> and  changed html
>>>>> to this
>>>>>
>>>>>        <table-tag class="ricAppIndex"><tr-tag><td-tag>
>>>>>            <div-tag wicket:id="csrHome">
>>>>>                    <table-tag>
>>>>>                        <tr-tag>
>>>>>                            <td-tag>
>>>>>                                                <span-tag
>>>>> wicket:id="custmenu">
>>>>>                                                </span-tag>
>>>>>                            </td-tag>
>>>>>                        </tr-tag>
>>>>>                    </table-tag>
>>>>>            </div-tag>
>>>>>        </td-tag></tr-tag></table-tag>
>>>>>
>>>>>
>>>>>        <wicket:fragment wicket:id="frag1">
>>>>>                <span-tag wicket:id="custmenu">
>>>>>                   <ul-tag>
>>>>>                                <li-tag wicket:id="repater">
>>>>>                                </li-tag>
>>>>>                   </ul-tag>
>>>>>                </span-tag>
>>>>>        </wicket:fragment>
>>>>>
>>>>>        <wicket:fragment wicket:id="frag2">
>>>>>                        <span-tag wicket:id="customlink">
>>>>>                                <A-tag href="#"
>>>>> wicket:id="link"><label-tag
>>>>> wicket:id="lbl"></label-tag></A-tag>
>>>>>                        </span-tag>
>>>>>        </wicket:fragment>
>>>>>
>>>>> am I doing right for using fragment ?  and
>>>>> this is the exception iam getting
>>>>> org.apache.wicket.markup.MarkupException: Unable to find component with
>>>>> id
>>>>> 'custmenu' in [MarkupContainer [Component id = custmenu, page =
>>>>> com.uprr.app.csr.webapp.pages.Index, path =
>>>>> 0:csrHome:custmenu.Index$CustomMenuComponent, isVisible = true,
>>>>> isVersioned
>>>>> = true]]. This means that you declared wicket:id=custmenu in your
>>>>> markup,
>>>>> but that you either did not add the component to your page at all, or
>>>>> that
>>>>> the hierarchy does not match.
>>>>>
>>>>>
>>>>>
>>>>> Nino.Martinez wrote:
>>>>>>
>>>>>> Hi
>>>>>>
>>>>>> like so:
>>>>>>
>>>>>> class$innerclass.html
>>>>>>
>>>>>> example
>>>>>>
>>>>>> MyPanel$MyInnerPanel.html
>>>>>>
>>>>>> Or just have the panels in their own classes...
>>>>>>
>>>>>> If you take a look at the wizard example(wicket library) theres an
>>>>>> example there on a wizard with panels..
>>>>>>
>>>>>> miro wrote:
>>>>>>> I have custom components
>>>>>>>
>>>>>>>      protected class CustomMenuComponent extends Panel {
>>>>>>>              private String headerlabel;
>>>>>>>              private RepeatingView   repeatingView = new
>>>>>>> RepeatingView("repater");
>>>>>>>
>>>>>>>              public CustomMenuComponent() {
>>>>>>>                      super("custmenu");
>>>>>>>                      add(repeatingView);
>>>>>>>              }
>>>>>>>
>>>>>>>              protected void addCustomLink(CustomLinkComponenet
>>>>>>> customLinkComponenet){
>>>>>>>                      repeatingView.add(customLinkComponenet);
>>>>>>>              }
>>>>>>>
>>>>>>>              protected Label getHeader(){
>>>>>>>                      return new Label("hl",headerlabel);
>>>>>>>              }
>>>>>>>      }
>>>>>>>
>>>>>>>      protected class CustomLinkComponenet extends  Panel  {
>>>>>>>              String displayName;
>>>>>>>              Class  clazz;
>>>>>>>              public CustomLinkComponenet(String displayName, Class
>>>>>>> clazz) {
>>>>>>>                      super("customlink");
>>>>>>>                      this.displayName=displayName;
>>>>>>>                      this.clazz=clazz;
>>>>>>>                      add(getBookmarkablePageLink());
>>>>>>>                      add(getDisplayNameLabel());
>>>>>>>              }
>>>>>>>
>>>>>>>              protected BookmarkablePageLink
>>>>>>> getBookmarkablePageLink(){
>>>>>>>                      return new BookmarkablePageLink("link", clazz);
>>>>>>>              }
>>>>>>>
>>>>>>>              protected  Label  getDisplayNameLabel(){
>>>>>>>                      return new Label("lbl",displayName);
>>>>>>>              }
>>>>>>>      }
>>>>>>> html for  component  CustomMenuComponent
>>>>>>>
>>>>>>>              <span-TAG wicket:id="custmenu">
>>>>>>>                 <ul-TAG>
>>>>>>>                              <li-TAG wicket:id="repater"></li-TAG>
>>>>>>>                 </ul-TAG>
>>>>>>>                 </span-TAG>
>>>>>>> html for component   CustomLinkComponenet
>>>>>>>
>>>>>>>                                      <span-TAG
>>>>>>> wicket:id="customlink">
>>>>>>>                                              <A-TAG  href="#"
>>>>>>> wicket:id="link">
>>>>>>>                                                         <label-TAG
>>>>>>> wicket:id="lbl"></label-TAG>
>>>>>>>                                                 </A-TAG>
>>>>>>>                                      </span-TAG>
>>>>>>> please help me with the options of   specifying this html for the
>>>>>>> components
>>>>>>> . I want to tie html along with the components in the java file
>>>>>>> itself
>>>>>>> is
>>>>>>> it possible ?
>>>>>>>
>>>>>>
>>>>>> --
>>>>>> -Wicket for love
>>>>>>
>>>>>> Nino Martinez Wael
>>>>>> Java Specialist @ Jayway DK
>>>>>> http://www.jayway.dk
>>>>>> +45 2936 7684
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/html-along-with-the-component-tp19918507p19919684.html
>>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/html-along-with-the-component-tp19918507p19919849.html
>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>
> --
> View this message in context: 
> http://www.nabble.com/html-along-with-the-component-tp19918507p19920357.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to