You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by kshitiz <k....@gmail.com> on 2012/04/15 20:56:01 UTC

Wicket cannot find id in inner enclosure...but has no problem in outer one!!!

Hi,

I have two enclosure with one closing another one like this:

*<wicket:enclosure child="userType">
	<table>
                
                
*                    <tr>
                        <td></td>
                    </tr>
*                    <wicket:enclosure child="post">
                    
*                    <tr>
                    
                    </tr>
                    
                    </wicket:enclosure>
                    <div wicket:id="noPostLabel"></div>
                
            </table>
            </wicket:enclosure>

Here is the java code:

*ListView<UserTypeDomain> userTypeDomainListView = new
ListView<UserTypeDomain>("userType", userTypeDomainList) 
		{ 
*
			@Override
            protected void populateItem(ListItem<UserTypeDomain> item) 
			{             
				
                item.add(new Label("organization", new
PropertyModel<UserTypeDomain>(item.getModel(), "organization")));    // (4)
                
                
                int organizationId =
((UserTypeDomain)item.getModelObject()).getOrganizationId();
                
                List<PostDomain> postDomainList = null;
					postDomainList = postService.getPosts(organizationId, unitId, batchId,
locationId, iModel.getObject().getKey());
				}
				
				// user posts in each user type
*                ListView<PostDomain> postDomainListView = new
ListView<PostDomain>("post", postDomainList) 
                {
*
					@Override 
                    protected void populateItem(ListItem<PostDomain> item) 
                    {
                    	String post =
((PostDomain)item.getModelObject()).getPost();
                    	
                    	item.add(new Label("text", post));
                    }
                };
               
postDomainListView.setVisible(!postDomainListView.getList().isEmpty());
                add(postDomainListView);
                
                Label noPostLabel = new Label("noPostLabel", "No posts
shared till now...!!!");
                noPostLabel.setVisible(!postDomainListView.isVisible());
                add(noPostLabel);
            }           
    };
   
userTypeDomainListView.setVisible(!userTypeDomainListView.getList().isEmpty());
    add(userTypeDomainListView);
    this.createModelForUserType();
    
}

Now, when there is no user type, then the code works fine but when there is
a type but no posts are there..i.e. inner enclosure tab is called, then the
error comes:

Root cause:

*org.apache.wicket.WicketRuntimeException: Could not find child with id:
post in the wicket:enclosure*
     at
org.apache.wicket.markup.html.internal.Enclosure.checkChildComponent(Enclosure.java:249)
     at
org.apache.wicket.markup.html.internal.Enclosure.getChildComponent(Enclosure.java:228)
     at
org.apache.wicket.markup.html.internal.Enclosure.onInitialize(Enclosure.java:133)
     at org.apache.wicket.Component.fireInitialize(Component.java:932)
....

I am not able to understand...is there any syntax mystake. I have read that
it was a bug in earlier versions of wicket but I am using 1.5. Please help
me what is causing this error...?

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-cannot-find-id-in-inner-enclosure-but-has-no-problem-in-outer-one-tp4559666p4559666.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: Wicket cannot find id in inner enclosure...but has no problem in outer one!!!

Posted by Colin Rogers <Co...@objectconsulting.com.au>.
Nice one! No worries! :D

-----Original Message-----
From: kshitiz [mailto:k.agarwal4@gmail.com]
Sent: Thursday, 19 April 2012 4:10 AM
To: users@wicket.apache.org
Subject: RE: Wicket cannot find id in inner enclosure...but has no problem in outer one!!!

Your guess is right....thank you for the help....

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-cannot-find-id-in-inner-enclosure-but-has-no-problem-in-outer-one-tp4559666p4568555.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org

EMAIL DISCLAIMER This email message and its attachments are confidential and may also contain copyright or privileged material. If you are not the intended recipient, you may not forward the email or disclose or use the information contained in it. If you have received this email message in error, please advise the sender immediately by replying to this email and delete the message and any associated attachments. Any views, opinions, conclusions, advice or statements expressed in this email message are those of the individual sender and should not be relied upon as the considered view, opinion, conclusions, advice or statement of this company except where the sender expressly, and with authority, states them to be the considered view, opinion, conclusions, advice or statement of this company. Every care is taken but we recommend that you scan any attachments for viruses.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: Wicket cannot find id in inner enclosure...but has no problem in outer one!!!

Posted by kshitiz <k....@gmail.com>.
Your guess is right....thank you for the help....

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-cannot-find-id-in-inner-enclosure-but-has-no-problem-in-outer-one-tp4559666p4568555.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: Wicket cannot find id in inner enclosure...but has no problem in outer one!!!

Posted by Colin Rogers <Co...@objectconsulting.com.au>.
Hey there,

This is just a guess!!

Why are you creating a new SelectOption?;

        SelectOption selectedOption = new SelectOption(selectOption[0].getKey(), "Selected Value");

when you could just use the one that exists (selectOption[0])? The PropertyModel doesn't make sense, ether. I'd remove that line above, and the property model and maybe go for, in total;

        ChoiceRenderer<SelectOption> choiceRenderer = new ChoiceRenderer<SelectOption>("value", "key");
        final IModel<SelectOption> iModel = new Model<SelectOption>(selectOption[0]);
        final DropDownChoice<SelectOption> postCategoriesDropDown = new DropDownChoice<SelectOption>("postCategories", iModel, Arrays.asList(selectOption), choiceRenderer);


Like I said, it's a guess, but those things look strange to me... sure other people could help better. Hope it helps...

Cheers,
Col.

-----Original Message-----
From: kshitiz [mailto:k.agarwal4@gmail.com]
Sent: Wednesday, 18 April 2012 2:51 AM
To: users@wicket.apache.org
Subject: Re: Wicket cannot find id in inner enclosure...but has no problem in outer one!!!

I have removed inner enclosure and its working fine. I am facing another problem. This is my code:

ChoiceRenderer<SelectOption> choiceRenderer = new ChoiceRenderer<SelectOption>("value", "key");
            SelectOption selectedOption = new
SelectOption(selectOption[0].getKey(), "Selected Value");
            final IModel<SelectOption> iModel = new PropertyModel<SelectOption>(selectedOption.getValue(), "value");
            final DropDownChoice<String> postCategoriesDropDown = new DropDownChoice("postCategories", iModel, Arrays.asList(selectOption), choiceRenderer);

Select Option is :

public class SelectOption {

        private int key;
          private String value;

          public SelectOption(int key, String value) {
            this.key = key;
            this.value = value;
          }
/ getters and setters
}

Now here, drop down is being rendered in markup..

*<select wicket:id="postCategories">
                    </select>
*

But the as given in the code, I want a particular value to come as default value. But the default one is coming out 'Choose One'. What is the issue??
But


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-cannot-find-id-in-inner-enclosure-but-has-no-problem-in-outer-one-tp4559666p4565376.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org

EMAIL DISCLAIMER This email message and its attachments are confidential and may also contain copyright or privileged material. If you are not the intended recipient, you may not forward the email or disclose or use the information contained in it. If you have received this email message in error, please advise the sender immediately by replying to this email and delete the message and any associated attachments. Any views, opinions, conclusions, advice or statements expressed in this email message are those of the individual sender and should not be relied upon as the considered view, opinion, conclusions, advice or statement of this company except where the sender expressly, and with authority, states them to be the considered view, opinion, conclusions, advice or statement of this company. Every care is taken but we recommend that you scan any attachments for viruses.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket cannot find id in inner enclosure...but has no problem in outer one!!!

Posted by kshitiz <k....@gmail.com>.
I have removed inner enclosure and its working fine. I am facing another
problem. This is my code:

ChoiceRenderer<SelectOption> choiceRenderer = new
ChoiceRenderer<SelectOption>("value", "key");
	    SelectOption selectedOption = new
SelectOption(selectOption[0].getKey(), "Selected Value");
	    final IModel<SelectOption> iModel = new
PropertyModel<SelectOption>(selectedOption.getValue(), "value");
	    final DropDownChoice<String> postCategoriesDropDown = new
DropDownChoice("postCategories", iModel, Arrays.asList(selectOption),
choiceRenderer);

Select Option is :

public class SelectOption {
	
	private int key;
	  private String value;

	  public SelectOption(int key, String value) {
	    this.key = key;
	    this.value = value;
	  }
/ getters and setters
}

Now here, drop down is being rendered in markup..

*<select wicket:id="postCategories">
                    </select>
*

But the as given in the code, I want a particular value to come as default
value. But the default one is coming out 'Choose One'. What is the issue??
But


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-cannot-find-id-in-inner-enclosure-but-has-no-problem-in-outer-one-tp4559666p4565376.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket cannot find id in inner enclosure...but has no problem in outer one!!!

Posted by Martin Grigorov <mg...@apache.org>.
See org.apache.wicket.markup.html.basic.EnclosureContainer

On Tue, Apr 17, 2012 at 9:48 AM, Wilhelmsen Tor Iver <To...@arrive.no> wrote:
>> Hi, can anyone tell me any other alternative of enclosure if the above problem cant be bugged out??
>
> You can do explicitly what the enclosure does more conveniently, by using a WebMarkupContainer where isvisible() delegates to the child's isVisible().
>
> - Tor Iver
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: Wicket cannot find id in inner enclosure...but has no problem in outer one!!!

Posted by Wilhelmsen Tor Iver <To...@arrive.no>.
> Hi, can anyone tell me any other alternative of enclosure if the above problem cant be bugged out??

You can do explicitly what the enclosure does more conveniently, by using a WebMarkupContainer where isvisible() delegates to the child's isVisible().

- Tor Iver

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket cannot find id in inner enclosure...but has no problem in outer one!!!

Posted by kshitiz <k....@gmail.com>.
Hi, can anyone tell me any other alternative of enclosure if the above
problem cant be bugged out??

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-cannot-find-id-in-inner-enclosure-but-has-no-problem-in-outer-one-tp4559666p4562050.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org