Re: How I get the internal html content of a dynamically updated div tag using Apache Wicket
Hi, I guess you want to get the new entered text via Ajax submit. You can extend AjaxSubmitButton and implement #updateAjaxAttributes() { attributes.getDynamicExtraParameters().add(return [ {name: 'richText', value: $('#editorArea').html() } ]); } Then use getRequest().getRequestParameters().getParameterValue(richText).toString() to get the produced HTML. On Sat, Jun 1, 2013 at 8:04 AM, Andun Sameera andun...@gmail.com wrote: Hi, In my html file I have a div tag like this, div wicket:id=editorAreaType Here/div I am using a JavaScript library called bootstrap-wysiwyg to make this div tag a text are which we can type rich text. When the person types text, div tag's html content updates to represent the text content in html. I want to retrieve it in to the Java code of the html file in wicket. I tried to do it by creating reference variable to div tag like following, WebMarkupContainer editorArea=new WebMarkupContainer(editorArea); String text=editorArea.getMarkup().toString(true) But this don't give me the updated HTML content. I give only the initial html content. what is the problem here? Thanks! -- Regards Andun S.L. Gunawardana Undergraduate Department of Computer Science And Engineering University of Moratuwa Sri Lanka Blog - http://www.insightforfuture.blogspot.com/ LinkedIn - http://www.linkedin.com/pub/andun-s-l-gunawardana/34/646/703 Twitter -http://twitter.com/AndunSLG - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How I get the internal html content of a dynamically updated div tag using Apache Wicket
Hello Martin, Is it possible to create FormComponentPanel as in following example https://cwiki.apache.org/WICKET/creating-custom-formcomponentpanels-to-build-valid-objects-using-wickets-form-validation-logic.html but taking the value from the div.innerHtml and not the textfield? On Sat, Jun 1, 2013 at 2:19 PM, Martin Grigorov mgrigo...@apache.orgwrote: Hi, I guess you want to get the new entered text via Ajax submit. You can extend AjaxSubmitButton and implement #updateAjaxAttributes() { attributes.getDynamicExtraParameters().add(return [ {name: 'richText', value: $('#editorArea').html() } ]); } Then use getRequest().getRequestParameters().getParameterValue(richText).toString() to get the produced HTML. On Sat, Jun 1, 2013 at 8:04 AM, Andun Sameera andun...@gmail.com wrote: Hi, In my html file I have a div tag like this, div wicket:id=editorAreaType Here/div I am using a JavaScript library called bootstrap-wysiwyg to make this div tag a text are which we can type rich text. When the person types text, div tag's html content updates to represent the text content in html. I want to retrieve it in to the Java code of the html file in wicket. I tried to do it by creating reference variable to div tag like following, WebMarkupContainer editorArea=new WebMarkupContainer(editorArea); String text=editorArea.getMarkup().toString(true) But this don't give me the updated HTML content. I give only the initial html content. what is the problem here? Thanks! -- Regards Andun S.L. Gunawardana Undergraduate Department of Computer Science And Engineering University of Moratuwa Sri Lanka Blog - http://www.insightforfuture.blogspot.com/ LinkedIn - http://www.linkedin.com/pub/andun-s-l-gunawardana/34/646/703 Twitter -http://twitter.com/AndunSLG - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- WBR Maxim aka solomax
Re: How I get the internal html content of a dynamically updated div tag using Apache Wicket
Hi Maxim, It depends what is the markup you have to work with. Usually WYSIWYG widgets work with just a div or textarea and create other HTML elements dynamically with JavaScript to do their job, e.g. an iframe. Additionally they almost always give you API to get the produced rich content (html, markdown, ...). For example: var richEditor = $.myWysiwyg(#myTextArea); var richContent = richEditor.getContent(); doSomethingWithRichContent(richContent); So it is not always possible to create 1:1 mapping between the client and the server usage of form components. On Sat, Jun 1, 2013 at 11:11 AM, Maxim Solodovnik solomax...@gmail.comwrote: Hello Martin, Is it possible to create FormComponentPanel as in following example https://cwiki.apache.org/WICKET/creating-custom-formcomponentpanels-to-build-valid-objects-using-wickets-form-validation-logic.html but taking the value from the div.innerHtml and not the textfield? On Sat, Jun 1, 2013 at 2:19 PM, Martin Grigorov mgrigo...@apache.org wrote: Hi, I guess you want to get the new entered text via Ajax submit. You can extend AjaxSubmitButton and implement #updateAjaxAttributes() { attributes.getDynamicExtraParameters().add(return [ {name: 'richText', value: $('#editorArea').html() } ]); } Then use getRequest().getRequestParameters().getParameterValue(richText).toString() to get the produced HTML. On Sat, Jun 1, 2013 at 8:04 AM, Andun Sameera andun...@gmail.com wrote: Hi, In my html file I have a div tag like this, div wicket:id=editorAreaType Here/div I am using a JavaScript library called bootstrap-wysiwyg to make this div tag a text are which we can type rich text. When the person types text, div tag's html content updates to represent the text content in html. I want to retrieve it in to the Java code of the html file in wicket. I tried to do it by creating reference variable to div tag like following, WebMarkupContainer editorArea=new WebMarkupContainer(editorArea); String text=editorArea.getMarkup().toString(true) But this don't give me the updated HTML content. I give only the initial html content. what is the problem here? Thanks! -- Regards Andun S.L. Gunawardana Undergraduate Department of Computer Science And Engineering University of Moratuwa Sri Lanka Blog - http://www.insightforfuture.blogspot.com/ LinkedIn - http://www.linkedin.com/pub/andun-s-l-gunawardana/34/646/703 Twitter -http://twitter.com/AndunSLG - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- WBR Maxim aka solomax
WicketTester CDI and WicketApplication
Hi All I am having difficulty finding information on how I can create a CDI context for use in my tests. Is there some kind of way of creating a mock cdi environment for testing. Currently my tests fail trying to retrieve the CDI Bean Manager as this is normally controlled by the Web Application Container. Do I need to create a mock Web Application class which simulates a dummy Bean Manager? Is there any guides specific to Wicket? Thanks David - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: WicketTester CDI and WicketApplication
Hi, I usually use Arquillian to deploy a CDI context in my tests which require injection to work (often it happens for pages tests). When testing individual components it is easy to manually inject references (either via package visibility or via PowerMock's Whitebox for instance). Regards, __ Cedric Gatay (@Cedric_Gatay http://twitter.com/Cedric_Gatay) http://code-troopers.com | http://www.bloggure.info | http://cedric.gatay.fr On Sat, Jun 1, 2013 at 5:13 PM, David Beer david.m.b...@gmail.com wrote: Hi All I am having difficulty finding information on how I can create a CDI context for use in my tests. Is there some kind of way of creating a mock cdi environment for testing. Currently my tests fail trying to retrieve the CDI Bean Manager as this is normally controlled by the Web Application Container. Do I need to create a mock Web Application class which simulates a dummy Bean Manager? Is there any guides specific to Wicket? Thanks David --**--**- To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.orgusers-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: WicketTester CDI and WicketApplication
Hi Cedric Thanks for the reply I will take a look at Arquillian and see how I can use it. Any guides are helpful especially when used with wicket. Thanks David On 01/06/13 16:20, Cedric Gatay wrote: Hi, I usually use Arquillian to deploy a CDI context in my tests which require injection to work (often it happens for pages tests). When testing individual components it is easy to manually inject references (either via package visibility or via PowerMock's Whitebox for instance). Regards, __ Cedric Gatay (@Cedric_Gatay http://twitter.com/Cedric_Gatay) http://code-troopers.com | http://www.bloggure.info | http://cedric.gatay.fr On Sat, Jun 1, 2013 at 5:13 PM, David Beer david.m.b...@gmail.com wrote: Hi All I am having difficulty finding information on how I can create a CDI context for use in my tests. Is there some kind of way of creating a mock cdi environment for testing. Currently my tests fail trying to retrieve the CDI Bean Manager as this is normally controlled by the Web Application Container. Do I need to create a mock Web Application class which simulates a dummy Bean Manager? Is there any guides specific to Wicket? Thanks David --**--**- To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.orgusers-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
A child with id 'XXXX' already exist AND class constructor called twice issue
Hi everyone. I am a little new on Wicket, and I have googling this problem a lot of time. I have 3 or 4h try to solve this exception: java.lang.IllegalArgumentException: A child with id 'eventos' already exists But as you can see on code below, I am adding just a ListView component. I ran this code step by step and I am noting that class constructor is called twice. I don't know why, I am guess that the problem have to be with that behaviour. I am using wicket 6.7.0 on tomcat 7. Running on Windows 8. Could you help me to solve this problem? *This is the HTML code:* html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en xmlns:wicket=http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd; wicket:head link rel=stylesheet type=text/css href=tables.css/ link rel=stylesheet type=text/css href=correos.css/ link rel=stylesheet type=text/css href=ofertasPage.css/ /wicket:head body wicket:extend div id=main div id=leftside div class=grupo Eventos wicket:link Nueva evento EventoPage.html /wicket:link Nombre Tipo Correo Inicio de recepcioacute;n Cierre de recepcioacute;n Cierre de recepcioacute;n Pedro Marcano Pedro Marcano 0412/342-30-58 0412/342-30-58 0412/342-30-58 images/preview-5.png images/edit-9.png wicket:link Nuevo evento EventoPage.html /wicket:link /div /div /div /wicket:extend /body /html *And this is the class constructor* public EventosPage() { LoadableDetachableModelListlt;Evento ldm = new LoadableDetachableModelListlt;Evento() { @Override protected ListEvento load() { return Evento.getAll(); } }; add(new ListViewEvento(eventos, ldm) { @Override protected void populateItem(ListItemEvento item) { Evento ev = item.getModelObject(); CompoundPropertyModelEvento cpm = new CompoundPropertyModel(ev); item.add(new Label(nombre, cpm)); item.add(new Label(tipo.nombre, cpm)); item.add(new Label(correo, cpm)); item.add(new Label(inicioRecepcion, cpm)); item.add(new Label(finRecepcion, cpm)); item.add(new BookmarkablePageLink(ver, EventoPage.class)); item.add(new BookmarkablePageLink(editar, EventoPage.class)); } }); Thanks in advance, Roger -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/A-child-with-id--already-exist-AND-class-constructor-called-twice-issue-tp4659200.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 I get the internal html content of a dynamically updated div tag using Apache Wicket
Hello Martin, Thanks for the reply Is it possible to wrap component into its own form and add some behavior which will trigger adding DynamicExtraParameters on upper form submit? I have added new AjaxFormSubmitBehavior(this, submit) to my component form but it is not triggered on upper form submit :( On Sat, Jun 1, 2013 at 3:25 PM, Martin Grigorov mgrigo...@apache.orgwrote: Hi Maxim, It depends what is the markup you have to work with. Usually WYSIWYG widgets work with just a div or textarea and create other HTML elements dynamically with JavaScript to do their job, e.g. an iframe. Additionally they almost always give you API to get the produced rich content (html, markdown, ...). For example: var richEditor = $.myWysiwyg(#myTextArea); var richContent = richEditor.getContent(); doSomethingWithRichContent(richContent); So it is not always possible to create 1:1 mapping between the client and the server usage of form components. On Sat, Jun 1, 2013 at 11:11 AM, Maxim Solodovnik solomax...@gmail.com wrote: Hello Martin, Is it possible to create FormComponentPanel as in following example https://cwiki.apache.org/WICKET/creating-custom-formcomponentpanels-to-build-valid-objects-using-wickets-form-validation-logic.html but taking the value from the div.innerHtml and not the textfield? On Sat, Jun 1, 2013 at 2:19 PM, Martin Grigorov mgrigo...@apache.org wrote: Hi, I guess you want to get the new entered text via Ajax submit. You can extend AjaxSubmitButton and implement #updateAjaxAttributes() { attributes.getDynamicExtraParameters().add(return [ {name: 'richText', value: $('#editorArea').html() } ]); } Then use getRequest().getRequestParameters().getParameterValue(richText).toString() to get the produced HTML. On Sat, Jun 1, 2013 at 8:04 AM, Andun Sameera andun...@gmail.com wrote: Hi, In my html file I have a div tag like this, div wicket:id=editorAreaType Here/div I am using a JavaScript library called bootstrap-wysiwyg to make this div tag a text are which we can type rich text. When the person types text, div tag's html content updates to represent the text content in html. I want to retrieve it in to the Java code of the html file in wicket. I tried to do it by creating reference variable to div tag like following, WebMarkupContainer editorArea=new WebMarkupContainer(editorArea); String text=editorArea.getMarkup().toString(true) But this don't give me the updated HTML content. I give only the initial html content. what is the problem here? Thanks! -- Regards Andun S.L. Gunawardana Undergraduate Department of Computer Science And Engineering University of Moratuwa Sri Lanka Blog - http://www.insightforfuture.blogspot.com/ LinkedIn - http://www.linkedin.com/pub/andun-s-l-gunawardana/34/646/703 Twitter -http://twitter.com/AndunSLG - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- WBR Maxim aka solomax -- WBR Maxim aka solomax