Re: Get return value of ajax event in Wicket 6.9.1

2013-11-13 Thread Daniela L
Hi,
I have another problem regarding this question.
Now every time the page is left the message  Do you want to leave the
page is popping up,
but when the user correctly fills the form on the page and hits the submit
button
he should be redirected to another page showing the result of his input.
I have tryed this to remove the behavior for a correct submit but the
message is still popping up:

mySubmitButton = new Button(mySubmitButton ) {

@Override
public void onSubmit() {
try {
myTextField.remove(pageExitWarningBehavior);
//tryed both
//pageExitWarningBehavior.detach(myTextField);
   }
};


2013/11/12 Daniela L danigal...@gmail.com

 Hi,
 thank you so much for your help this works fantastic.
 I am so happy I was trying around with this for days :-)


 2013/11/11 Martin Grigorov mgrigo...@apache.org

 respond() is the callback method that Wicket will notify.
 But you need to trigger an Ajax call first. This is done with the Wicket
 Ajax API: Wicket.Ajax.get(...).

 Just try with the line I've added in your JS code


 On Mon, Nov 11, 2013 at 4:04 PM, Daniela L danigal...@gmail.com wrote:

  I thought adding respond was the ajax call to the server, am I wrong?
  I didn't work much with ajax, i am sorry
 
 
  2013/11/11 Martin Grigorov mgrigo...@apache.org
 
   Did you do what I suggested you ?
  
  
   On Mon, Nov 11, 2013 at 3:49 PM, Daniela L danigal...@gmail.com
 wrote:
  
Hi,
   
I have tryed to change to AbstractDefaultAjaxBehavior like I
 described
below, but respond is never called. What am I doing wrong?
   
   
Hi,
   
as far as I have understood this can only be achieved, if I subclass
AbstractDefaultAjaxBehavior like this?
   
public class PageExitWarningBehavior extends
  AbstractDefaultAjaxBehavior
{
@Override
protected void respond(AjaxRequestTarget target) {
   
AppointmentSession.get().releaseSavedBlockedFreeCalendarEvent();
  }
   
   
Hi,
   
You need to make an Ajax call to the server.
   
   
On Mon, Nov 11, 2013 at 2:10 PM, Daniela L danigal...@gmail.com
danigal...@gmail.comdanigal...@gmail.com danigal...@gmail.com
wrote:
   
   
Hi,
this is my first question, so i hope I get everything right.
   
I am trying to catch the event of the user closing the browser
 window
  in
wicket.
   
I followed this example:
   
   
  
 
 http://stackoverflow.com/questions/16527463/call-java-component-from-javascript-and-retreive-value
   
and I managed to get the example working so the message is
 displayed,
   but I
have no idea how to get the event triggered by the javascript
 function
  in
wicket. I need this because when the user closes the browser window
 I
   want
to update some data in my database.
Here is what I have tryed:
   
   
 RequiredTextFieldString myTextField = new
RequiredTextFieldString(myTextField);
 myTextField.setOutputMarkupPlaceholderTag(true);
 myTextField.add(new PageExitWarningBehavior(){
@Override
public void onEvent(Component component, IEvent?
 event)
{
//this isn't ever called
MySession.get().releaseBlockedDataFromDatabase();
}
});
   
public class PageExitWarningBehavior extends Behavior  {
@Override
public void renderHead(Component component, IHeaderResponse
response) {
super.renderHead(component, response);
response.render(new
OnDomReadyHeaderItem(window.onbeforeunload = function (e) {
   
   
  + Wicket.Ajax.get({u: '+getCallbackUrl()+',
   async:
false});
   
   
  + var message = 'Your confirmation message goes
here.',
   
  + e = e || window.event; + if (e) {
   
  + e.returnValue = message; + } + return
  message;
   +
};));
}
}
   
What am I missing? Thank you very much in advance
   
  
 





Re: Get return value of ajax event in Wicket 6.9.1

2013-11-13 Thread Martin Grigorov
Hi,

#onSubmit() would be called after the user agrees to leave the page.

You can set some JS variable/flag when the submit button is used and
depending on this flag do not ask for confirmation in onbeforerender.


On Wed, Nov 13, 2013 at 10:02 AM, Daniela L danigal...@gmail.com wrote:

 Hi,
 I have another problem regarding this question.
 Now every time the page is left the message  Do you want to leave the
 page is popping up,
 but when the user correctly fills the form on the page and hits the submit
 button
 he should be redirected to another page showing the result of his input.
 I have tryed this to remove the behavior for a correct submit but the
 message is still popping up:

 mySubmitButton = new Button(mySubmitButton ) {

 @Override
 public void onSubmit() {
 try {
 myTextField.remove(pageExitWarningBehavior);
 //tryed both
 //pageExitWarningBehavior.detach(myTextField);
}
 };


 2013/11/12 Daniela L danigal...@gmail.com

  Hi,
  thank you so much for your help this works fantastic.
  I am so happy I was trying around with this for days :-)
 
 
  2013/11/11 Martin Grigorov mgrigo...@apache.org
 
  respond() is the callback method that Wicket will notify.
  But you need to trigger an Ajax call first. This is done with the Wicket
  Ajax API: Wicket.Ajax.get(...).
 
  Just try with the line I've added in your JS code
 
 
  On Mon, Nov 11, 2013 at 4:04 PM, Daniela L danigal...@gmail.com
 wrote:
 
   I thought adding respond was the ajax call to the server, am I wrong?
   I didn't work much with ajax, i am sorry
  
  
   2013/11/11 Martin Grigorov mgrigo...@apache.org
  
Did you do what I suggested you ?
   
   
On Mon, Nov 11, 2013 at 3:49 PM, Daniela L danigal...@gmail.com
  wrote:
   
 Hi,

 I have tryed to change to AbstractDefaultAjaxBehavior like I
  described
 below, but respond is never called. What am I doing wrong?


 Hi,

 as far as I have understood this can only be achieved, if I
 subclass
 AbstractDefaultAjaxBehavior like this?

 public class PageExitWarningBehavior extends
   AbstractDefaultAjaxBehavior
 {
 @Override
 protected void respond(AjaxRequestTarget target) {

 AppointmentSession.get().releaseSavedBlockedFreeCalendarEvent();
   }


 Hi,

 You need to make an Ajax call to the server.


 On Mon, Nov 11, 2013 at 2:10 PM, Daniela L danigal...@gmail.com
 danigal...@gmail.comdanigal...@gmail.com 
 danigal...@gmail.com
 wrote:


 Hi,
 this is my first question, so i hope I get everything right.

 I am trying to catch the event of the user closing the browser
  window
   in
 wicket.

 I followed this example:


   
  
 
 http://stackoverflow.com/questions/16527463/call-java-component-from-javascript-and-retreive-value

 and I managed to get the example working so the message is
  displayed,
but I
 have no idea how to get the event triggered by the javascript
  function
   in
 wicket. I need this because when the user closes the browser
 window
  I
want
 to update some data in my database.
 Here is what I have tryed:


  RequiredTextFieldString myTextField = new
 RequiredTextFieldString(myTextField);
  myTextField.setOutputMarkupPlaceholderTag(true);
  myTextField.add(new PageExitWarningBehavior(){
 @Override
 public void onEvent(Component component, IEvent?
  event)
 {
 //this isn't ever called
 MySession.get().releaseBlockedDataFromDatabase();
 }
 });

 public class PageExitWarningBehavior extends Behavior  {
 @Override
 public void renderHead(Component component,
 IHeaderResponse
 response) {
 super.renderHead(component, response);
 response.render(new
 OnDomReadyHeaderItem(window.onbeforeunload = function (e) {


   + Wicket.Ajax.get({u:
 '+getCallbackUrl()+',
async:
 false});


   + var message = 'Your confirmation message goes
 here.',

   + e = e || window.event; + if (e) {

   + e.returnValue = message; + } + return
   message;
+
 };));
 }
 }

 What am I missing? Thank you very much in advance

   
  
 
 
 



Re: quick CRUD application

2013-11-13 Thread Marco Di Sabatino Di Diodoro
Hi,

take a look at Apache Syncope. 
Apache Syncope is an Open Source system for managing digital identities. The 
console is implemented with Apache Wicket.

BR
Marco


Il giorno 12/nov/2013, alle ore 23:39, saty satya...@gmail.com ha scritto:

 Ok, thanks
 
 
 
 
 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/quick-CRUD-application-tp4662346p4662350.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
 

-- 
Dott. Marco Di Sabatino Di Diodoro
Tel. +39 3939065570

Tirasa S.r.l.
Viale D'Annunzio 267 - 65127 Pescara
Tel +39 0859116307 / FAX +39 085973
http://www.tirasa.net

Apache Syncope PMC Member
http://people.apache.org/~mdisabatino/



Re: Wicket localization in stateful pages

2013-11-13 Thread Martin Grigorov
 So I tried to pass it using page parameters. Also, I have updated dynamic
label model to LoadableDetachableModel.

This is an option for you. See
http://www.wicket-library.com/wicket-examples-6.0.x/mappers/en_US
There are three links (EN, DE and BG). The demo uses LocaleFirstMapper to
set the locale in the session depending on the current url.


On Mon, Nov 11, 2013 at 7:02 PM, meduolis meduol...@gmail.com wrote:

 Storing it in page will not work as it will reset each time I call
 setResponsePage.
 Storing it in data base will not work also, because locale will became
 global for all visitors.
 So I tried to pass it using page parameters. Also, I have updated dynamic
 label model to LoadableDetachableModel.

 This time I got different result, but still, not what I expected.

 Back action restores locale from page parameter one step behind the value
 stored in session,
 so I got different values each time I go back.
 Attaching updated version, if there is still someone who will to help me:
 versionLocale.zip
 
 http://apache-wicket.1842946.n4.nabble.com/file/n4662326/versionLocale.zip
 



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Back-button-issue-when-localizing-in-stateful-pages-tp4662260p4662326.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: quick CRUD application

2013-11-13 Thread Ernesto Reinaldo Barreiro
There was something like

http://wicketopia.sourceforge.net/

I don not know if it still actively maintained. I personally did some
experiments creating Wicket auto-CRUDs on project

https://code.google.com/p/antilia/

Which is now defunct. This is not very difficult to achieve using panel and
repeaters and reading information from entity metadata. Another thing is
how useful such a thing is: except for rapid prototyping.



On Tue, Nov 12, 2013 at 10:09 PM, saty satya...@gmail.com wrote:

 Hi,

 Is it possible to develop/generate a quick CRUD application using wicket,
 something like the OpenXawa does or even JSF

 Thanks




 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/quick-CRUD-application-tp4662346.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




-- 
Regards - Ernesto Reinaldo Barreiro


Wicket 6 reset Form fields

2013-11-13 Thread Vadimus
Hi everyone.

I use Wicket 6.11.0. 

I designed my own component BaseDialog.
BaseDialog.java

/public class BaseDialog extends Panel {

private WebMarkupContainer dialogDiv;
private AbstractDefaultAjaxBehavior beforeOpen;
private IndicatingAjaxButton sbt;
private FormVoid form;
private FeedbackPanel fpanel;

/**
 * 
 */
private static final long serialVersionUID = -7300515046330284598L;

@SuppressWarnings(serial)
public BaseDialog(String id) {
super(id);

this.dialogDiv = new TransparentWebMarkupContainer(myModal);
this.dialogDiv.setOutputMarkupId(true);
this.dialogDiv.setMarkupId(myModal);

this.add(dialogDiv);

form = new FormVoid(dlgForm);


form.setOutputMarkupId(true);
form.setMarkupId(dlgForm);

dialogDiv.add(form);

TransparentWebMarkupContainer ch = new 
TransparentWebMarkupContainer(
childContent);
ch.setMarkupId(childContent);
ch.setOutputMarkupId(true);
dialogDiv.add(ch);
ch.add(form);

this.sbt = new IndicatingAjaxButton(sbmtBtn, form) {
@Override
protected void onSubmit(AjaxRequestTarget target, 
Form? form) {
form.success(asdasdas);
target.add(fpanel);
}

@Override
protected void onError(AjaxRequestTarget target, 
Form? form) {
form.error(error);
target.add(fpanel);
}

};

fpanel = new FeedbackPanel(feedback);
fpanel.setOutputMarkupId(true);
form.add(fpanel);

form.setDefaultButton(this.sbt);

this.sbt.setMarkupId(sbmtBtn);
this.sbt.setOutputMarkupId(true);
this.sbt.setDefaultFormProcessing(true);

dialogDiv.add(this.sbt);
// form.add(this.sbt);

this.beforeOpen = new AbstractDefaultAjaxBehavior() {

@Override
protected void respond(AjaxRequestTarget target) {
OnBeforeOpen();
target.add(form);
}
};

this.add(this.beforeOpen);

}

public JsScope GetOpenDialogScope() {

MapString, Object parameters = new HashMapString, Object();
parameters.put(beforeOpenUrl, 
this.beforeOpen.getCallbackUrl());
parameters.put(dialogId, this.dialogDiv.getMarkupId());

return JsScope.quickScope($.ajax({ +  async : false, + url 
: '
+ this.beforeOpen.getCallbackUrl() + 
'}).done(function() {});
+ $('# + this.dialogDiv.getMarkupId() + 
').modal();

);
}

protected void OnBeforeOpen() {

}

@Override
public void renderHead(IHeaderResponse response) {
super.renderHead(response);
Bootstrap.renderHead(response);
}
}
/

BaseDialog.html 
/html xmlns:wicket=http://wicket.apache.org;
body
wicket:panel
div wicket:id=myModal class=modal hide fade tabindex=-1
role=dialog aria-labelledby=myModalLabel 
aria-hidden=true
div class=modal-header
button type=button class=close 
data-dismiss=modal
aria-hidden=trueX/button

Modal header

/div
div wicket:id=childContent class=modal-body 
container
form wicket:id=dlgForm
div wicket:id=feedback/div
wicket:child /
/form
/div
div class=modal-footer
button class=btn data-dismiss=modal
aria-hidden=trueClose/button
button class=btn wicket:id=sbmtBtnSave 
changes/button
/div
/div
/wicket:panel
/body
/html/

Then I designed AddDepartmentDlg which inherits BaseDialog.

AddDepartmentDlg.java

/public class AddDepartmentDlg extends BaseDialog {

/**
 * 
 */

@SpringBean(name = departmentService)
private IDepartmentService depSrv;
private TextFieldString name;
private TextFieldString descr;
private SchTree 

Re: Wicket 6 reset Form fields

2013-11-13 Thread Martin Grigorov
Hi,

Next time please use any paste bin service with syntax highlighting. It is
much easier to read the code than here.


On Wed, Nov 13, 2013 at 10:54 AM, Vadimus sottomar...@gmail.com wrote:

 Hi everyone.

 I use Wicket 6.11.0.

 I designed my own component BaseDialog.
 BaseDialog.java

 /public class BaseDialog extends Panel {

 private WebMarkupContainer dialogDiv;
 private AbstractDefaultAjaxBehavior beforeOpen;
 private IndicatingAjaxButton sbt;
 private FormVoid form;
 private FeedbackPanel fpanel;

 /**
  *
  */
 private static final long serialVersionUID = -7300515046330284598L;

 @SuppressWarnings(serial)
 public BaseDialog(String id) {
 super(id);

 this.dialogDiv = new
 TransparentWebMarkupContainer(myModal);
 this.dialogDiv.setOutputMarkupId(true);
 this.dialogDiv.setMarkupId(myModal);

 this.add(dialogDiv);

 form = new FormVoid(dlgForm);


 form.setOutputMarkupId(true);
 form.setMarkupId(dlgForm);

 dialogDiv.add(form);

 TransparentWebMarkupContainer ch = new
 TransparentWebMarkupContainer(
 childContent);
 ch.setMarkupId(childContent);
 ch.setOutputMarkupId(true);
 dialogDiv.add(ch);
 ch.add(form);

 this.sbt = new IndicatingAjaxButton(sbmtBtn, form) {
 @Override
 protected void onSubmit(AjaxRequestTarget target,
 Form? form) {
 form.success(asdasdas);
 target.add(fpanel);
 }

 @Override
 protected void onError(AjaxRequestTarget target,
 Form? form) {
 form.error(error);
 target.add(fpanel);
 }

 };

 fpanel = new FeedbackPanel(feedback);
 fpanel.setOutputMarkupId(true);
 form.add(fpanel);

 form.setDefaultButton(this.sbt);

 this.sbt.setMarkupId(sbmtBtn);
 this.sbt.setOutputMarkupId(true);
 this.sbt.setDefaultFormProcessing(true);

 dialogDiv.add(this.sbt);
 // form.add(this.sbt);

 this.beforeOpen = new AbstractDefaultAjaxBehavior() {

 @Override
 protected void respond(AjaxRequestTarget target) {
 OnBeforeOpen();
 target.add(form);
 }
 };

 this.add(this.beforeOpen);

 }

 public JsScope GetOpenDialogScope() {

 MapString, Object parameters = new HashMapString,
 Object();
 parameters.put(beforeOpenUrl,
 this.beforeOpen.getCallbackUrl());
 parameters.put(dialogId, this.dialogDiv.getMarkupId());

 return JsScope.quickScope($.ajax({ +  async : false, +
 url : '
 + this.beforeOpen.getCallbackUrl() +
 '}).done(function() {});
 + $('# + this.dialogDiv.getMarkupId() +
 ').modal();

 );
 }

 protected void OnBeforeOpen() {

 }

 @Override
 public void renderHead(IHeaderResponse response) {
 super.renderHead(response);
 Bootstrap.renderHead(response);
 }
 }
 /

 BaseDialog.html
 /html xmlns:wicket=http://wicket.apache.org;
 body
 wicket:panel
 div wicket:id=myModal class=modal hide fade
 tabindex=-1
 role=dialog aria-labelledby=myModalLabel
 aria-hidden=true
 div class=modal-header
 button type=button class=close
 data-dismiss=modal
 aria-hidden=trueX/button

 Modal header

 /div
 div wicket:id=childContent class=modal-body
 container
 form wicket:id=dlgForm
 div wicket:id=feedback/div
 wicket:child /
 /form
 /div
 div class=modal-footer
 button class=btn data-dismiss=modal
 aria-hidden=trueClose/button
 button class=btn
 wicket:id=sbmtBtnSave changes/button
 /div
 /div
 /wicket:panel
 /body
 /html/

 Then I designed AddDepartmentDlg which inherits BaseDialog.

 AddDepartmentDlg.java

 /public class 

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 FormAgent{

public FormulaireRechercheAgent(String id) {
super(id,new CompoundPropertyModelAgent(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
ModelString(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

form wicket:id=formulaireRechercheAgent


wicket:enclosure child=agentMailpro


/wicket:enclosure 

/form



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)

How to set the page title?

2013-11-13 Thread mike.hua
Dear All:  Can I change the page title(*set .. between head tag*) in
java code?  What shoul I do?  Thanks a lot!Mike



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-set-the-page-title-tp4662372.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'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 FormAgent{

public FormulaireRechercheAgent(String id) {
super(id,new CompoundPropertyModelAgent(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
ModelString(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

form wicket:id=formulaireRechercheAgent


wicket:enclosure child=agentMailpro


/wicket:enclosure   

/form



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

Re: How to set the page title?

2013-11-13 Thread Ernesto Reinaldo Barreiro
head
title wicket:id=title/title

and

public abstract class BasePage extends WebPage {
private static final long serialVersionUID = 1L;

@SuppressWarnings(serial)
public BasePage(final PageParameters parameters) {
super(parameters);
 add( new Label(title, getTitle() ) );

?


On Wed, Nov 13, 2013 at 11:29 AM, mike.hua hz...@sohu.com wrote:

 Dear All:  Can I change the page title(*set .. between head tag*) in
 java code?  What shoul I do?  Thanks a lot!Mike



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/How-to-set-the-page-title-tp4662372.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




-- 
Regards - Ernesto Reinaldo Barreiro


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 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: How to set the page title?

2013-11-13 Thread mike.hua
Dear Ernesto:
  *My page extends a parent container.*When I code that,the Exception
happened.
  Sorry, I've forgotten to say that.
Mike

The error message is Last cause: The component(s) below failed to render.
Possible reasons could be that: 1) you have added a component in code but
forgot to reference it in the markup (thus the component will never be
rendered), 2) if your components were added in a parent container then make
sure the markup for the child container includes them in wicket:extend.1.
[Component id = pageTitle]



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-set-the-page-title-tp4662372p4662377.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: How to set the page title?

2013-11-13 Thread Ernesto Reinaldo Barreiro
Add it to the parent container... make getTitle() abstract and override it
on extensions?


On Wed, Nov 13, 2013 at 12:07 PM, mike.hua hz...@sohu.com wrote:

 Dear Ernesto:
   *My page extends a parent container.*When I code that,the Exception
 happened.
   Sorry, I've forgotten to say that.
 Mike

 The error message is Last cause: The component(s) below failed to render.
 Possible reasons could be that: 1) you have added a component in code but
 forgot to reference it in the markup (thus the component will never be
 rendered), 2) if your components were added in a parent container then make
 sure the markup for the child container includes them in wicket:extend.1.
 [Component id = pageTitle]



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/How-to-set-the-page-title-tp4662372p4662377.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




-- 
Regards - Ernesto Reinaldo Barreiro


Re: How to set the page title?

2013-11-13 Thread mike.hua
Here is the related codes:
Child page html:
?xml version=1.0 encoding=utf-8 ?
!DOCTYPE html PUBLIC quot;-//W3C//DTD XHTML 1.0 Transitional//ENquot;
quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtdquot;
html xmlns=http://www.w3.org/1999/xhtml;
xmlns:wicket=http://wicket.apache.org;
head
*title wicket:id=pageTitleLogin Page/title*
meta http-equiv=Content-Type content=text/html; charset=UTF-8
/
meta name=viewport content=width=device-width /
/head
body
*wicket:extend
div style=margin:auto;text-align:center;width:40%;
form id=loginForm method=post
fieldset id=login
legend Login/legend
Username: input type=text id=username /br /
Password: input type=password id=password /
div
input type=submit name=login value=login
/
/div
/fieldset
/form
/div
/wicket:extend*
/body
/html

Child page code:
/*
 * To change this license header, choose License Headers in Project
Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package my_wicket;

import org.apache.wicket.markup.html.basic.Label;

/**
 *
 * @author mike
 */
public class ExtendsTemplatePage extends Template {

public ExtendsTemplatePage() {
//Label pageTitle = new Label(pageTitle, Login Page);
//this.add(pageTitle);
}

@Override
protected void onInitialize() {
super.onInitialize();
   * Label pageTitle = new Label(pageTitle, Login Page);
this.add(pageTitle);*
}
}



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-set-the-page-title-tp4662372p4662380.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: How to set the page title?

2013-11-13 Thread mike.hua
*make getTitle() abstract and override it on extensions*??
Sorry, In 6.x API, I can't find *getTitle()* in WebPage's functions.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-set-the-page-title-tp4662372p4662381.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: How to set the page title?

2013-11-13 Thread Ernesto Reinaldo Barreiro
See my previous e-mail. Add

   *title wicket:id=pageTitleLogin Page/title*

Too Template (assuming it is a page). Also

 Label pageTitle = new Label(pageTitle, getTitle());
 this.add(pageTitle);

To template

where get Title is abstract or can ve overriden by super





On Wed, Nov 13, 2013 at 12:13 PM, mike.hua hz...@sohu.com wrote:

 Here is the related codes:
 Child page html:
 ?xml version=1.0 encoding=utf-8 ?
 !DOCTYPE html PUBLIC quot;-//W3C//DTD XHTML 1.0 Transitional//ENquot;
 quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtdquot;
 html xmlns=http://www.w3.org/1999/xhtml;
 xmlns:wicket=http://wicket.apache.org;
 head
 *title wicket:id=pageTitleLogin Page/title*
 meta http-equiv=Content-Type content=text/html; charset=UTF-8
 /
 meta name=viewport content=width=device-width /
 /head
 body
 *wicket:extend
 div style=margin:auto;text-align:center;width:40%;
 form id=loginForm method=post
 fieldset id=login
 legend Login/legend
 Username: input type=text id=username /br /
 Password: input type=password id=password /
 div
 input type=submit name=login value=login
 /
 /div
 /fieldset
 /form
 /div
 /wicket:extend*
 /body
 /html

 Child page code:
 /*
  * To change this license header, choose License Headers in Project
 Properties.
  * To change this template file, choose Tools | Templates
  * and open the template in the editor.
  */
 package my_wicket;

 import org.apache.wicket.markup.html.basic.Label;

 /**
  *
  * @author mike
  */
 public class ExtendsTemplatePage extends Template {

 public ExtendsTemplatePage() {
 //Label pageTitle = new Label(pageTitle, Login Page);
 //this.add(pageTitle);
 }

 @Override
 protected void onInitialize() {
 super.onInitialize();
* Label pageTitle = new Label(pageTitle, Login Page);
 this.add(pageTitle);*
 }
 }



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/How-to-set-the-page-title-tp4662372p4662380.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




-- 
Regards - Ernesto Reinaldo Barreiro


Re: How to set the page title?

2013-11-13 Thread mike.hua
OK, the problem is resolved with your opinion.
Thank you for your help!



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-set-the-page-title-tp4662372p4662383.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: How to set the page title?

2013-11-13 Thread Ernesto Reinaldo Barreiro
getTitle is your own method on Template

proctected abstract IModelString getTitle()

then on super classes you provide an implementation.


On Wed, Nov 13, 2013 at 12:23 PM, mike.hua hz...@sohu.com wrote:

 *make getTitle() abstract and override it on extensions*??
 Sorry, In 6.x API, I can't find *getTitle()* in WebPage's functions.



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/How-to-set-the-page-title-tp4662372p4662381.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




-- 
Regards - Ernesto Reinaldo Barreiro


weld conversation propagation page

2013-11-13 Thread brazz
Hi,

after spending a hard time debugging i found this problem:

i have to pages:
FirstPage.class
SecondPage.class

on FirstPage.class i create a new conversation with conversation.begin();
and on FirstPage.class i have a link:

*setResponsePage(SecondPage.class);*

this link results in a new transient Conversation on SecondPage.class

if i create a new instance in setResponsePage():
*setResponsePage(new SecondPage());*

the conversation is propagated correctly ot SecondPage.class.

As i am new to cdi and weld i cannot really estimate if this is a bug or
desired behavior:

Thanks for any explanations.




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/weld-conversation-propagation-page-tp4662389.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: wicket library example, but with tabs

2013-11-13 Thread eostermueller
That fixed it, thx.
Now, all the tab code is loading the book detail in the TabPanel1 which is
great, but tabs are not part of the html.  I updated the github code but
need to noodle on this more tomorrow.

--Erik



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/wicket-library-example-but-with-tabs-tp4662343p4662390.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



Rendering a component into a String

2013-11-13 Thread Martin Dietze
In a legacy project I've inherited I've got a piece of code that
no longer works since the project was upgraded from Wicket 1.4 to
Wicket 6. 

It's about rendering a component (a Wicket panel) into a string
in order to return it wrapped into a webservice reply.

The webservice is based on Wicket, too. The webservice is based
on a Javascript handshake - the client calls the service using a
token connecting the user to his current session he has on the
application, the service replies are rendered into an iframe and
deliver their data through postMessage. 

Thus, when rendering a reply, I am basically rendering a Wicket
page within the context of my session. 

Now one of my API's calls requires me to render a Wicket panel
into a String, which is then wrapped into JSON as part of the
respective call's reply. 

The legacy code used to do this roughly like this (changes for
using the Wicket 6 API were applied, but this nevertheless never
worked):

- create a mock RequestCycle by creating a MockHttpSession, a
  MockHttpServletRequest and a MockHttpServletResponse, glue
  this all together to obtain a ServletWebRequest and a
  BufferedWebResponse and finaly use use Application.createRequestCycle()
  to create the RequestCycle object

- the component wrapped into a ComponentRenderingRequestHandler 

- then this code is executed:

|try {
|requestCycle.scheduleRequestHandlerAfterCurrent(requestHandler);
|try {
|if ( !requestCycle.processRequestAndDetach() ) {
|requestCycle.scheduleRequestHandlerAfterCurrent(new 
ErrorCodeRequestHandler((HttpServletResponse.SC_NOT_FOUND));
| }
|} finally {
|requestCycle.getResponse().close();
|}
|return requestCycle.getResponse().toString();
|} finally {
|requestCycle.detach();
|}

I must admit I could not have written this myself :)

Now when running this code, I run into two different 
exceptions:

org.apache.wicket.WicketRuntimeException: Exception in rendering component: 
[Profile [Component id = profile]]
at 
org.apache.wicket.Component.internalRenderComponent(Component.java:2576) 
[wicket-core-6.9.1.jar:6.9.1]
at 
org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1493) 
~[wicket-core-6.9.1.jar:6.9.1]
at org.apache.wicket.Component.internalRender(Component.java:2379) 
[wicket-core-6.9.1.jar:6.9.1]
at org.apache.wicket.Component.render(Component.java:2307) 
[wicket-core-6.9.1.jar:6.9.1]
[...]
Caused by: java.lang.NullPointerException: null
at 
org.apache.wicket.markup.html.internal.Enclosure.isVisible(Enclosure.java:143) 
~[wicket-core-6.9.1.jar:6.9.1]
at org.apache.wicket.Component.determineVisibility(Component.java:4363) 
[wicket-core-6.9.1.jar:6.9.1]
at org.apache.wicket.Component.internalBeforeRender(Component.java:916) 
[wicket-core-6.9.1.jar:6.9.1]
at org.apache.wicket.Component.beforeRender(Component.java:991) 
[wicket-core-6.9.1.jar:6.9.1]
at 
org.apache.wicket.Component.internalPrepareForRender(Component.java:2214) 
[wicket-core-6.9.1.jar:6.9.1]
at org.apache.wicket.Component.render(Component.java:2303) 
[wicket-core-6.9.1.jar:6.9.1]
at 
org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1390) 
~[wicket-core-6.9.1.jar:6.9.1]
at 
org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1554) 
~[wicket-core-6.9.1.jar:6.9.1]
at 
org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1529)
 ~[wicket-core-6.9.1.jar:6.9.1]
at 
org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1484) 
~[wicket-core-6.9.1.jar:6.9.1]
at 
org.apache.wicket.markup.html.panel.DefaultMarkupSourcingStrategy.onComponentTagBody(DefaultMarkupSourcingStrategy.java:71)
 ~[wicket-core-6.9.1.jar:6.9.1]
at 
org.apache.wicket.Component.internalRenderComponent(Component.java:2549) 
[wicket-core-6.9.1.jar:6.9.1]

The enclosure's child component is null, as we see here:
|@Override
|public boolean isVisible()
|{
|return childComponent.determineVisibility()  
super.isVisible();
|}

Below that exception I find the markup of a stack trace page in my logs. 
Below that markup I get another stack trace:

java.lang.NullPointerException: null
at 
org.apache.wicket.Component.internalPrepareForRender(Component.java:2224) 
~[wicket-core-6.9.1.jar:6.9.1]
at org.apache.wicket.Page.internalPrepareForRender(Page.java:241) 
~[wicket-core-6.9.1.jar:6.9.1]
at org.apache.wicket.Component.render(Component.java:2303) 
~[wicket-core-6.9.1.jar:6.9.1]
at org.apache.wicket.Page.renderPage(Page.java:1010) 
~[wicket-core-6.9.1.jar:6.9.1]
at 
org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:121)
 ~[wicket-core-6.9.1.jar:6.9.1]
at 

Re: Rendering a component into a String

2013-11-13 Thread Martin Grigorov
Hi,

See the source of
http://www.wicket-library.com/wicket-examples-6.0.x/mailtemplate/?2 example


On Wed, Nov 13, 2013 at 3:04 PM, Martin Dietze d...@fh-wedel.de wrote:

 In a legacy project I've inherited I've got a piece of code that
 no longer works since the project was upgraded from Wicket 1.4 to
 Wicket 6.

 It's about rendering a component (a Wicket panel) into a string
 in order to return it wrapped into a webservice reply.

 The webservice is based on Wicket, too. The webservice is based
 on a Javascript handshake - the client calls the service using a
 token connecting the user to his current session he has on the
 application, the service replies are rendered into an iframe and
 deliver their data through postMessage.

 Thus, when rendering a reply, I am basically rendering a Wicket
 page within the context of my session.

 Now one of my API's calls requires me to render a Wicket panel
 into a String, which is then wrapped into JSON as part of the
 respective call's reply.

 The legacy code used to do this roughly like this (changes for
 using the Wicket 6 API were applied, but this nevertheless never
 worked):

 - create a mock RequestCycle by creating a MockHttpSession, a
   MockHttpServletRequest and a MockHttpServletResponse, glue
   this all together to obtain a ServletWebRequest and a
   BufferedWebResponse and finaly use use Application.createRequestCycle()
   to create the RequestCycle object

 - the component wrapped into a ComponentRenderingRequestHandler

 - then this code is executed:

 |try {
 |requestCycle.scheduleRequestHandlerAfterCurrent(requestHandler);
 |try {
 |if ( !requestCycle.processRequestAndDetach() ) {
 |requestCycle.scheduleRequestHandlerAfterCurrent(new
 ErrorCodeRequestHandler((HttpServletResponse.SC_NOT_FOUND));
 | }
 |} finally {
 |requestCycle.getResponse().close();
 |}
 |return requestCycle.getResponse().toString();
 |} finally {
 |requestCycle.detach();
 |}

 I must admit I could not have written this myself :)

 Now when running this code, I run into two different
 exceptions:

 org.apache.wicket.WicketRuntimeException: Exception in rendering
 component: [Profile [Component id = profile]]
 at
 org.apache.wicket.Component.internalRenderComponent(Component.java:2576)
 [wicket-core-6.9.1.jar:6.9.1]
 at
 org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1493)
 ~[wicket-core-6.9.1.jar:6.9.1]
 at org.apache.wicket.Component.internalRender(Component.java:2379)
 [wicket-core-6.9.1.jar:6.9.1]
 at org.apache.wicket.Component.render(Component.java:2307)
 [wicket-core-6.9.1.jar:6.9.1]
 [...]
 Caused by: java.lang.NullPointerException: null
 at
 org.apache.wicket.markup.html.internal.Enclosure.isVisible(Enclosure.java:143)
 ~[wicket-core-6.9.1.jar:6.9.1]
 at
 org.apache.wicket.Component.determineVisibility(Component.java:4363)
 [wicket-core-6.9.1.jar:6.9.1]
 at
 org.apache.wicket.Component.internalBeforeRender(Component.java:916)
 [wicket-core-6.9.1.jar:6.9.1]
 at org.apache.wicket.Component.beforeRender(Component.java:991)
 [wicket-core-6.9.1.jar:6.9.1]
 at
 org.apache.wicket.Component.internalPrepareForRender(Component.java:2214)
 [wicket-core-6.9.1.jar:6.9.1]
 at org.apache.wicket.Component.render(Component.java:2303)
 [wicket-core-6.9.1.jar:6.9.1]
 at
 org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1390)
 ~[wicket-core-6.9.1.jar:6.9.1]
 at
 org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1554)
 ~[wicket-core-6.9.1.jar:6.9.1]
 at
 org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1529)
 ~[wicket-core-6.9.1.jar:6.9.1]
 at
 org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1484)
 ~[wicket-core-6.9.1.jar:6.9.1]
 at
 org.apache.wicket.markup.html.panel.DefaultMarkupSourcingStrategy.onComponentTagBody(DefaultMarkupSourcingStrategy.java:71)
 ~[wicket-core-6.9.1.jar:6.9.1]
 at
 org.apache.wicket.Component.internalRenderComponent(Component.java:2549)
 [wicket-core-6.9.1.jar:6.9.1]

 The enclosure's child component is null, as we see here:
 |@Override
 |public boolean isVisible()
 |{
 |return childComponent.determineVisibility() 
 super.isVisible();
 |}

 Below that exception I find the markup of a stack trace page in my logs.
 Below that markup I get another stack trace:

 java.lang.NullPointerException: null
 at
 org.apache.wicket.Component.internalPrepareForRender(Component.java:2224)
 ~[wicket-core-6.9.1.jar:6.9.1]
 at org.apache.wicket.Page.internalPrepareForRender(Page.java:241)
 ~[wicket-core-6.9.1.jar:6.9.1]
 at org.apache.wicket.Component.render(Component.java:2303)
 ~[wicket-core-6.9.1.jar:6.9.1]
 at org.apache.wicket.Page.renderPage(Page.java:1010)
 

Re: Rendering a component into a String

2013-11-13 Thread Martin Dietze
On Wed, November 13, 2013, Martin Grigorov wrote:

 See the source of
 http://www.wicket-library.com/wicket-examples-6.0.x/mailtemplate/?2 example

In short: instanciate my component, put it into a
ComponentRenderer, be happy. That was astonishingly simple :)

Cheers,

M'bert

-- 
--- / http://herbert.the-little-red-haired-girl.org / -
=+= 
Steht ein Bratscher vor 'ner Kneipe.

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



Re: Get return value of ajax event in Wicket 6.9.1

2013-11-13 Thread Daniela L
Hi,
I am sorry I don't get it.
How and when to set the JS variable?
Like this:
mySubmitButton.add(new AjaxEventBehavior(onclick) {
@Override
protected void onEvent(AjaxRequestTarget target) {
AjaxRequestAttributes ajaxRequestAttributes = new
AjaxRequestAttributes();
CharSequence dynamicExtraParameters = var enableEvent =
false;;


ajaxRequestAttributes.getDynamicExtraParameters().add(dynamicExtraParameters)

pageExitWarningBehavior.updateAjaxAttributes(ajaxRequestAttributes);
}
});

And which onBeforeRender, the one of the TextField?
Best Regards
Daniela


2013/11/13 Martin Grigorov mgrigo...@apache.org

 Hi,

 #onSubmit() would be called after the user agrees to leave the page.

 You can set some JS variable/flag when the submit button is used and
 depending on this flag do not ask for confirmation in onbeforerender.


 On Wed, Nov 13, 2013 at 10:02 AM, Daniela L danigal...@gmail.com wrote:

  Hi,
  I have another problem regarding this question.
  Now every time the page is left the message  Do you want to leave the
  page is popping up,
  but when the user correctly fills the form on the page and hits the
 submit
  button
  he should be redirected to another page showing the result of his input.
  I have tryed this to remove the behavior for a correct submit but the
  message is still popping up:
 
  mySubmitButton = new Button(mySubmitButton ) {
 
  @Override
  public void onSubmit() {
  try {
  myTextField.remove(pageExitWarningBehavior);
  //tryed both
  //pageExitWarningBehavior.detach(myTextField);
 }
  };
 
 
  2013/11/12 Daniela L danigal...@gmail.com
 
   Hi,
   thank you so much for your help this works fantastic.
   I am so happy I was trying around with this for days :-)
  
  
   2013/11/11 Martin Grigorov mgrigo...@apache.org
  
   respond() is the callback method that Wicket will notify.
   But you need to trigger an Ajax call first. This is done with the
 Wicket
   Ajax API: Wicket.Ajax.get(...).
  
   Just try with the line I've added in your JS code
  
  
   On Mon, Nov 11, 2013 at 4:04 PM, Daniela L danigal...@gmail.com
  wrote:
  
I thought adding respond was the ajax call to the server, am I
 wrong?
I didn't work much with ajax, i am sorry
   
   
2013/11/11 Martin Grigorov mgrigo...@apache.org
   
 Did you do what I suggested you ?


 On Mon, Nov 11, 2013 at 3:49 PM, Daniela L danigal...@gmail.com
   wrote:

  Hi,
 
  I have tryed to change to AbstractDefaultAjaxBehavior like I
   described
  below, but respond is never called. What am I doing wrong?
 
 
  Hi,
 
  as far as I have understood this can only be achieved, if I
  subclass
  AbstractDefaultAjaxBehavior like this?
 
  public class PageExitWarningBehavior extends
AbstractDefaultAjaxBehavior
  {
  @Override
  protected void respond(AjaxRequestTarget target) {
 
  AppointmentSession.get().releaseSavedBlockedFreeCalendarEvent();
}
 
 
  Hi,
 
  You need to make an Ajax call to the server.
 
 
  On Mon, Nov 11, 2013 at 2:10 PM, Daniela L 
 danigal...@gmail.com
  danigal...@gmail.comdanigal...@gmail.com 
  danigal...@gmail.com
  wrote:
 
 
  Hi,
  this is my first question, so i hope I get everything right.
 
  I am trying to catch the event of the user closing the browser
   window
in
  wicket.
 
  I followed this example:
 
 

   
  
 
 http://stackoverflow.com/questions/16527463/call-java-component-from-javascript-and-retreive-value
 
  and I managed to get the example working so the message is
   displayed,
 but I
  have no idea how to get the event triggered by the javascript
   function
in
  wicket. I need this because when the user closes the browser
  window
   I
 want
  to update some data in my database.
  Here is what I have tryed:
 
 
   RequiredTextFieldString myTextField = new
  RequiredTextFieldString(myTextField);
   myTextField.setOutputMarkupPlaceholderTag(true);
   myTextField.add(new PageExitWarningBehavior(){
  @Override
  public void onEvent(Component component, IEvent?
   event)
  {
  //this isn't ever called
 
 MySession.get().releaseBlockedDataFromDatabase();
  }
  });
 
  public class PageExitWarningBehavior extends Behavior  {
  @Override
  public void renderHead(Component component,
  IHeaderResponse
  response) {
  super.renderHead(component, response);
  response.render(new
  OnDomReadyHeaderItem(window.onbeforeunload = function (e) {
 
 
  

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 FormAgent{
public FormulaireAgent(final String id, Agent 
agent) {  
super(id, new 
CompoundPropertyModelAgent(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
ModelString(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



Iframe problem with jQuery 1.10.1 in IE

2013-11-13 Thread Heikki Uotinen
Hi,

if iframe content (Wicket page) is loaded from external domain loading of 
jQuery 1.10.1 (and Wicket) fails due to a bug

 http://bugs.jquery.com/ticket/13980

This has been fixed in jQuery 1.10.2 that we are now using by setting 
JQueryReference and it seems to work fine,

-Heikki




Re: weld conversation propagation page

2013-11-13 Thread Igor Vaynberg
this is the desired behavior. see conversation propagation settings.
by default conversations are only propagated to non-bookmarkable
pages.

-igor

On Wed, Nov 13, 2013 at 4:36 AM, brazz alexander.li...@man.eu wrote:
 Hi,

 after spending a hard time debugging i found this problem:

 i have to pages:
 FirstPage.class
 SecondPage.class

 on FirstPage.class i create a new conversation with conversation.begin();
 and on FirstPage.class i have a link:

 *setResponsePage(SecondPage.class);*

 this link results in a new transient Conversation on SecondPage.class

 if i create a new instance in setResponsePage():
 *setResponsePage(new SecondPage());*

 the conversation is propagated correctly ot SecondPage.class.

 As i am new to cdi and weld i cannot really estimate if this is a bug or
 desired behavior:

 Thanks for any explanations.




 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/weld-conversation-propagation-page-tp4662389.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: Get return value of ajax event in Wicket 6.9.1

2013-11-13 Thread Martin Grigorov
Hi,

mySubmitButton.add(AttributeAppender.append(onclick, window.dontAsk =
true; return true;))

response.render(new
OnDomReadyHeaderItem(window.onbeforeunload = function (e) {
  + if (!window.dontAsk) { +
  + var message = 'Your confirmation message goes
here.',
  + e = e || window.event; + if (e) {
  + e.returnValue = message; + } + return message;
   + }
+ };));


On Wed, Nov 13, 2013 at 4:12 PM, Daniela L danigal...@gmail.com wrote:

 Hi,
 I am sorry I don't get it.
 How and when to set the JS variable?
 Like this:
 mySubmitButton.add(new AjaxEventBehavior(onclick) {
 @Override
 protected void onEvent(AjaxRequestTarget target) {
 AjaxRequestAttributes ajaxRequestAttributes = new
 AjaxRequestAttributes();
 CharSequence dynamicExtraParameters = var enableEvent =
 false;;



 ajaxRequestAttributes.getDynamicExtraParameters().add(dynamicExtraParameters)

 pageExitWarningBehavior.updateAjaxAttributes(ajaxRequestAttributes);
 }
 });

 And which onBeforeRender, the one of the TextField?
 Best Regards
 Daniela


 2013/11/13 Martin Grigorov mgrigo...@apache.org

  Hi,
 
  #onSubmit() would be called after the user agrees to leave the page.
 
  You can set some JS variable/flag when the submit button is used and
  depending on this flag do not ask for confirmation in onbeforerender.
 
 
  On Wed, Nov 13, 2013 at 10:02 AM, Daniela L danigal...@gmail.com
 wrote:
 
   Hi,
   I have another problem regarding this question.
   Now every time the page is left the message  Do you want to leave the
   page is popping up,
   but when the user correctly fills the form on the page and hits the
  submit
   button
   he should be redirected to another page showing the result of his
 input.
   I have tryed this to remove the behavior for a correct submit but the
   message is still popping up:
  
   mySubmitButton = new Button(mySubmitButton ) {
  
   @Override
   public void onSubmit() {
   try {
   myTextField.remove(pageExitWarningBehavior);
   //tryed both
   //pageExitWarningBehavior.detach(myTextField);
  }
   };
  
  
   2013/11/12 Daniela L danigal...@gmail.com
  
Hi,
thank you so much for your help this works fantastic.
I am so happy I was trying around with this for days :-)
   
   
2013/11/11 Martin Grigorov mgrigo...@apache.org
   
respond() is the callback method that Wicket will notify.
But you need to trigger an Ajax call first. This is done with the
  Wicket
Ajax API: Wicket.Ajax.get(...).
   
Just try with the line I've added in your JS code
   
   
On Mon, Nov 11, 2013 at 4:04 PM, Daniela L danigal...@gmail.com
   wrote:
   
 I thought adding respond was the ajax call to the server, am I
  wrong?
 I didn't work much with ajax, i am sorry


 2013/11/11 Martin Grigorov mgrigo...@apache.org

  Did you do what I suggested you ?
 
 
  On Mon, Nov 11, 2013 at 3:49 PM, Daniela L 
 danigal...@gmail.com
wrote:
 
   Hi,
  
   I have tryed to change to AbstractDefaultAjaxBehavior like I
described
   below, but respond is never called. What am I doing wrong?
  
  
   Hi,
  
   as far as I have understood this can only be achieved, if I
   subclass
   AbstractDefaultAjaxBehavior like this?
  
   public class PageExitWarningBehavior extends
 AbstractDefaultAjaxBehavior
   {
   @Override
   protected void respond(AjaxRequestTarget target) {
  
  
 AppointmentSession.get().releaseSavedBlockedFreeCalendarEvent();
 }
  
  
   Hi,
  
   You need to make an Ajax call to the server.
  
  
   On Mon, Nov 11, 2013 at 2:10 PM, Daniela L 
  danigal...@gmail.com
   danigal...@gmail.comdanigal...@gmail.com 
   danigal...@gmail.com
   wrote:
  
  
   Hi,
   this is my first question, so i hope I get everything right.
  
   I am trying to catch the event of the user closing the browser
window
 in
   wicket.
  
   I followed this example:
  
  
 

   
  
 
 http://stackoverflow.com/questions/16527463/call-java-component-from-javascript-and-retreive-value
  
   and I managed to get the example working so the message is
displayed,
  but I
   have no idea how to get the event triggered by the javascript
function
 in
   wicket. I need this because when the user closes the browser
   window
I
  want
   to update some data in my database.
   Here is what I have tryed:
  
  
RequiredTextFieldString myTextField = new
   RequiredTextFieldString(myTextField);
myTextField.setOutputMarkupPlaceholderTag(true);

Re: Iframe problem with jQuery 1.10.1 in IE

2013-11-13 Thread Martin Grigorov
Hi,

Wicket 6.13.0 will come with jQuery 1.10.2

Thanks for informing us about this problem!


On Wed, Nov 13, 2013 at 8:36 PM, Heikki Uotinen 
heikki.uoti...@syncrontech.com wrote:

 Hi,

 if iframe content (Wicket page) is loaded from external domain loading of
 jQuery 1.10.1 (and Wicket) fails due to a bug

  http://bugs.jquery.com/ticket/13980

 This has been fixed in jQuery 1.10.2 that we are now using by setting
 JQueryReference and it seems to work fine,

 -Heikki