Re: Another same probleme with wicket:enclosure tag[SOLVED]

2013-11-14 Thread Selom
Hi !!

Ok for  closing this topic.

 I created a custom panel.



and the PanelAgent.html like this.




//In web Page class

 private  PanelAgent panelInfosAgent = new
PanelAgent("panelInfosAgent",new Model(Agent.emptyAgent())){ 
 @Override
 protected void onConfigure(){
if (agentBySesame==null){
this.setVisible(false);
}
else {
setVisible(true);
}
}
 };
 
 Then in the web page html

 

 



And it works as expected.
That's a best pratices I think.
Next time. 


Selom wrote
> When  formulaireRechercheAgent is submitted, formulaireAgent come with 
*
> null  value model. 
*
>  
> Do you mind tell me what wrong with this code ?





--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Another-same-probleme-with-wicket-enclosure-tag-tp4662371p4662425.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Another same probleme with wicket:enclosure tag

2013-11-13 Thread Selom
Now I replace the label by a form like this 

 
 private  FormulaireAgent formulaireAgent = new
FormulaireAgent("formulaireAgent", new Agent()){
 
 @Override
 protected void onConfigure(){
if (agentBySesame==null){
this.setVisible(false);
}
else {
setVisible(true);
}
}
 };
 
 
 

  public  class FormulaireAgent extends Form{
public FormulaireAgent(final String id, Agent 
agent) {  
super(id, new 
CompoundPropertyModel(agent));
add(new Label("idNomPrenom", agent.getPrenom() 
+ "   " +
agent.getNom()));   
add(new Label("idCorps", agent.getCorps()));
add(new Label("idAffectations", 
agent.getAffectation()));
add(new Label("idNaissance", 
agent.getDateNaisAsString()));
add(new Label("idEntreeEtab", 
agent.getDateEntreeAsString()));
add(new Label("idDateConvoc", 
agent.getDateConvocAsString()));
add(new Label("idDateVM", 
agent.getDateVMasString()));

}

}



// Buttons //
formulaireRechercheAgent.add(new 
AjaxButton("btnRecherche", new
Model("Rechercher")) {

private static final long 
serialVersionUID = 1L;

@Override
public void onSubmit(AjaxRequestTarget 
target, Form form)
{

//selected agent
Agent modelObject =
formulaireRechercheAgent.getModelObject();

setAgentBySesame(modelObject);

*formulaireAgent.setDefaultModelObject(getAgentBySesame());*

formulaireAgent.setVisible(true);   

target.add(formulaireAgent);

target.add(formulaireRechercheAgent.getParent());

}//onsubmit


A piece od the html file.





When  formulaireRechercheAgent is submitted, formulaireAgent come with *null 
value model. * 
Do you mind tell me what wrong with this code ?







--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Another-same-probleme-with-wicket-enclosure-tag-tp4662371p4662395.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Another same probleme with wicket:enclosure tag

2013-11-13 Thread Selom
You are right,

adding  add(labelAgentMailpro) beforesolved  the problem.

Thank you very much.





--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Another-same-probleme-with-wicket-enclosure-tag-tp4662371p4662378.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Another same probleme with wicket:enclosure tag

2013-11-13 Thread Selom
Hello,
Thanks you for yours  reply.

Of course, I want to show my label if  only if the form 
formulaireRechercheAgent is submitted successfully.


I believe the  form is not called yet , since I can not reach the html page.

Sincerly yours.
 






--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Another-same-probleme-with-wicket-enclosure-tag-tp4662371p4662375.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Another same probleme with wicket:enclosure tag

2013-11-13 Thread Sven Meier
You'll have to add the label beforehand, either keep it invisible before 
submit or add a placeholder instead.


Sven

On 11/13/2013 11:48 AM, Selom wrote:

Hello,
Thanks you for yours  reply.

Of course, I want to show my label if  only if the form
formulaireRechercheAgent is submitted successfully.


I believe the  form is not called yet , since I can not reach the html page.

Sincerly yours.
  







--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Another-same-probleme-with-wicket-enclosure-tag-tp4662371p4662375.html
Sent from the Users forum mailing list archive at Nabble.com.

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




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



Re: Another same probleme with wicket:enclosure tag

2013-11-13 Thread Sven Meier

You're adding the label after the submit only

@Override
public void onSubmit(AjaxRequestTarget target, Form form)
{

formulaireRechercheAgent.add(labelAgentMailpro);
}


Sven

On 11/13/2013 11:23 AM, Selom wrote:

Hi,

Need your help ...


  in   MyPage .java  {

//bla bla ...

private class FormulaireRechercheAgent extends Form{

public FormulaireRechercheAgent(String id) {
super(id,new CompoundPropertyModel(new Agent()));
}   
}



  final  Label  labelAgentMailpro = new Label("agentMailpro"){

 @Override
 protected void onConfigure(){
if (agentBySesame==null){
this.setVisible(false);
}
}
 };

// another bla bla


 final FormulaireRechercheAgent formulaireRechercheAgent = new
FormulaireRechercheAgent("formulaireRechercheAgent");
 formulaireRechercheAgent.add(new AjaxButton("btnRecherche", new
Model("Rechercher"))
 {

private static final long 
serialVersionUID = 1L;

@Override
public void onSubmit(AjaxRequestTarget 
target, Form form)
{

		 //selected agent

Agent modelObject = 
formulaireRechercheAgent.getModelObject();

setAgentBySesame(getLdapAgentsDao().findAgentBySesame(modelObject.getSesame()));


formulaireRechercheAgent.add(labelAgentMailpro);

labelAgentMailpro.setDefaultModelObject(agentBySesame.getEmailPro());
 // target.add(labelAgentMailpro);
 
target.add(formulaireRechercheAgent.getParent());
  
//target.add(formulaireRechercheAgent);


}//onsubmit

@Override
protected void onError(AjaxRequestTarget target, 
Form form)
{
//bla bla

}



});

}


  MyPage.html







   





When I call MyPage then it failed.

Root cause:

org.apache.wicket.WicketRuntimeException: Could not find child with id:
agentMailpro in the wicket:enclosure
at
org.apache.wicket.markup.html.internal.Enclosure.checkChildComponent(Enclosure.java:250)
at
org.apache.wicket.markup.html.internal.Enclosure.getChildComponent(Enclosure.java:228)
at
org.apache.wicket.markup.html.internal.Enclosure.onInitialize(Enclosure.java:132)
at org.apache.wicket.Component.fireInitialize(Component.java:864)
at
org.apache.wicket.MarkupContainer.internalInitialize(MarkupContainer.java:955)
at
org.apache.wicket.MarkupContainer.addedComponent(MarkupContainer.java:932)
at org.apache.wicket.MarkupContainer.add(MarkupContainer.java:174)
at org.apache.wicket.MarkupContainer.autoAdd(MarkupContainer.java:258)
at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1379)
at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1554)
at
org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1529)
at
org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1484)
at
org.apache.wicket.markup.html.form.Form.onComponentTagBody(Form.java:1683)
at
org.apache.wicket.markup.html.panel.DefaultMarkupSourcingStrategy.onComponentTagBody(DefaultMarkupSourcingStrategy.java:71)
at org.apache.wicket.Component.internalRenderComponent(Component.java:2549)
at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1493)
at org.apache.wicket.Component.internalRender(Component.java:2379)
at org.apache.wicket.Component.render(Component.java:2307)
at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1390)
at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1554)
at
org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1529)
at
org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:

Another same probleme with wicket:enclosure tag

2013-11-13 Thread Selom
Hi,

Need your help ...


 in   MyPage .java  {

//bla bla ...

private class FormulaireRechercheAgent extends Form{

public FormulaireRechercheAgent(String id) {
super(id,new CompoundPropertyModel(new Agent()));
}   
}


 
 final  Label  labelAgentMailpro = new Label("agentMailpro"){
 
 @Override
 protected void onConfigure(){
if (agentBySesame==null){
this.setVisible(false);
}
}
 };
 
// another bla bla

 
 final FormulaireRechercheAgent formulaireRechercheAgent = new
FormulaireRechercheAgent("formulaireRechercheAgent");
 formulaireRechercheAgent.add(new AjaxButton("btnRecherche", new
Model("Rechercher"))
 {

private static final long 
serialVersionUID = 1L;

@Override
public void onSubmit(AjaxRequestTarget 
target, Form form)
{
   
 //selected agent
Agent modelObject = 
formulaireRechercheAgent.getModelObject();

setAgentBySesame(getLdapAgentsDao().findAgentBySesame(modelObject.getSesame()));


formulaireRechercheAgent.add(labelAgentMailpro);
   
labelAgentMailpro.setDefaultModelObject(agentBySesame.getEmailPro());
 // target.add(labelAgentMailpro);
 
target.add(formulaireRechercheAgent.getParent());
  
//target.add(formulaireRechercheAgent);


}//onsubmit

@Override
protected void onError(AjaxRequestTarget 
target, Form form)
{
//bla bla 

}



});

}


 MyPage.html







 





When I call MyPage then it failed.

Root cause:

org.apache.wicket.WicketRuntimeException: Could not find child with id:
agentMailpro in the wicket:enclosure
at
org.apache.wicket.markup.html.internal.Enclosure.checkChildComponent(Enclosure.java:250)
at
org.apache.wicket.markup.html.internal.Enclosure.getChildComponent(Enclosure.java:228)
at
org.apache.wicket.markup.html.internal.Enclosure.onInitialize(Enclosure.java:132)
at org.apache.wicket.Component.fireInitialize(Component.java:864)
at
org.apache.wicket.MarkupContainer.internalInitialize(MarkupContainer.java:955)
at
org.apache.wicket.MarkupContainer.addedComponent(MarkupContainer.java:932)
at org.apache.wicket.MarkupContainer.add(MarkupContainer.java:174)
at org.apache.wicket.MarkupContainer.autoAdd(MarkupContainer.java:258)
at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1379)
at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1554)
at
org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1529)
at
org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1484)
at
org.apache.wicket.markup.html.form.Form.onComponentTagBody(Form.java:1683)
at
org.apache.wicket.markup.html.panel.DefaultMarkupSourcingStrategy.onComponentTagBody(DefaultMarkupSourcingStrategy.java:71)
at org.apache.wicket.Component.internalRenderComponent(Component.java:2549)
at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1493)
at org.apache.wicket.Component.internalRender(Component.java:2379)
at org.apache.wicket.Component.render(Component.java:2307)
at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1390)
at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1554)
at
org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1529)
at
org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1484)
at
org.apache.wicket.markup.html.panel.DefaultMarkupSourcingStrategy.onComponentTagBody(DefaultMarkupSourcingStrategy.java:71)
at org.apache.wicket.Component.internalRenderComponent(Component.java:2549)
at org.apache.wicket.MarkupConta