Re: Wicket Cookie Deletion
> > You don't use *expires *here. Yes it is irrelevant. Please ignore it. This should work. > Check what are the response headers in Chrome's Dev Tools > Network. The > new max-age value must be set to 0. I went to chrome dev tool -> network. But i cannot see whats max-age and where to look for it. On Mon, Oct 7, 2019 at 9:15 AM Martin Grigorov wrote: > Hi, > > On Mon, Oct 7, 2019 at 3:14 AM Sibgha Nazir wrote: > > > Hi, > > > > I set a cookie from JavaScript in the chrome browser like > > > > > var d = new Date(); > > > d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); > > > var expires = "expires=" + d.toUTCString(); > > > document.cookie = "test=true;1;path=/"; > > > > You don't use *expires *here. > > > > > > > > So the cookie value in the chrome is "true" (cookie "test"="true") > > > > then I am trying to clear the cookie in the wicket like > > > > WebRequest webRequest = (WebRequest) RequestCycle.get().getRequest(); > > > > WebResponse webResponse = (WebResponse) RequestCycle.get().getResponse(); > > > > Cookie cookietest = webRequest.getCookie("test"); > > > webResponse.clearCookie(cookietest); > > > > This should work. > Check what are the response headers in Chrome's Dev Tools > Network. The > new max-age value must be set to 0. > > > > > > > > The cookie is not deleted. I run the wicket web app on tomcat server. > Does > > anyone know what could be wrong? > > > > > > Just to be clear the cookie we set with JavaScript and the cookie we > > retrieve in wicket is pointing to the same space? I am confused why it > > wouldn't work. Does it have to anything with the Tomcat server? > > > > Best Regards, > > Sibgha Nazir > > >
Wicket Cookie Deletion
Hi, I set a cookie from JavaScript in the chrome browser like > var d = new Date(); > d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); > var expires = "expires=" + d.toUTCString(); > document.cookie = "test=true;1;path=/"; So the cookie value in the chrome is "true" (cookie "test"="true") then I am trying to clear the cookie in the wicket like WebRequest webRequest = (WebRequest) RequestCycle.get().getRequest(); WebResponse webResponse = (WebResponse) RequestCycle.get().getResponse(); Cookie cookietest = webRequest.getCookie("test"); > webResponse.clearCookie(cookietest); The cookie is not deleted. I run the wicket web app on tomcat server. Does anyone know what could be wrong? Just to be clear the cookie we set with JavaScript and the cookie we retrieve in wicket is pointing to the same space? I am confused why it wouldn't work. Does it have to anything with the Tomcat server? Best Regards, Sibgha Nazir
Re: Wicket first time visit check
Hi, Thanks But it calls the constructor every time the page is rendered. What I want is, once the user has seen that page before, I don't want to execute that logic again. I want to trigger a javascript function for the first time users. If I have seen the webpage once, the next time I open it, then that javascript must not trigger. Also, can I trigger the javascript in onInitialize() method and how? Best Regards, Sibgha On Sat, Sep 21, 2019 at 7:08 AM Martin Grigorov wrote: > Hi, > > You can execute your logic in the page's constructor or onInitialize() > method. > > On Fri, Sep 20, 2019, 21:25 Sibgha Nazir wrote: > > > Hi, > > > > I have a wicket application and I want to do something when the user > opens > > the webpage for the first time. > > > > Could anyone give me a clue on how to check if this is the first visit > on a > > certain webpage? > > > > Best Regards, > > Sibgha > > >
Wicket first time visit check
Hi, I have a wicket application and I want to do something when the user opens the webpage for the first time. Could anyone give me a clue on how to check if this is the first visit on a certain webpage? Best Regards, Sibgha
Re: Import Javascript through webjars as maven dependency.
Any idea, how to fix it? On Mon, Sep 9, 2019 at 10:01 AM Martin Grigorov wrote: > Hi, > > I think the problem is in the packaging of this webjar. > The folder name in the .jar file > is: /META-INF/resources/webjars/jquery.scroll*T*o/ . Note the capiral T in > scrollTo. It does not match with the Maven artifact id - it uses lower case > 't'. > Because of this WebjarsJavaScriptResourceReference cannot find it. > > On Sun, Sep 8, 2019 at 3:27 PM Sibgha Nazir wrote: > > > Hi, > > > > I am not able to import the following through webjar as maven dependency > in > > my project. > > > > https://github.com/flesler/jquery.scrollTo > > > > I deployed it to the webjar using *bower install jquery.scrollTo* and it > is > > also visible on the webjars.org > > > > > > org.webjars.bowergithub.flesler > > jquery.scrollto > > 2.1.1 > > > > > > Add it to the project like > > > > aResponse.render(JavaScriptHeaderItem.forReference(new > > > > > WebjarsJavaScriptResourceReference("jquery.scrollto/current/jquery.scrollto.js"))); > > > > > > > > The wicket shows the error > > > > > > GET > > > > > http://localhost:8080/wicket/resource/de.agilecoders.wicket.webjars.request.resource.WebjarsJavaScriptResourceReference/webjars/jquery.scrollto/null/jquery.scrollto.js > > net::ERR_ABORTED 404 > > > > What could be the problem? > > > > Best Regards, > > SIbgha > > >
Re: Import Javascript through webjars as maven dependency.
Doesn't work with this solution as well. On Mon, Sep 9, 2019 at 6:59 AM Sven Meier wrote: > Hi, > > I don't know why, but WebJars doesn't seem to be able to determine the > 'current' version of your dependency. > > Try with "jquery.scrollto/2.1.1/jquery.scrollto.js" instead. > > Hope this helps > Sven > > Am 8. September 2019 14:27:34 MESZ schrieb Sibgha Nazir < > sibgha...@gmail.com>: > >Hi, > > > >I am not able to import the following through webjar as maven > >dependency in > >my project. > > > >https://github.com/flesler/jquery.scrollTo > > > >I deployed it to the webjar using *bower install jquery.scrollTo* and > >it is > >also visible on the webjars.org > > > > > >org.webjars.bowergithub.flesler > >jquery.scrollto > >2.1.1 > > > > > >Add it to the project like > > > >aResponse.render(JavaScriptHeaderItem.forReference(new > > >WebjarsJavaScriptResourceReference("jquery.scrollto/current/jquery.scrollto.js"))); > > > > > > > >The wicket shows the error > > > > > >GET > > > http://localhost:8080/wicket/resource/de.agilecoders.wicket.webjars.request.resource.WebjarsJavaScriptResourceReference/webjars/jquery.scrollto/null/jquery.scrollto.js > >net::ERR_ABORTED 404 > > > >What could be the problem? > > > >Best Regards, > >SIbgha >
Import Javascript through webjars as maven dependency.
Hi, I am not able to import the following through webjar as maven dependency in my project. https://github.com/flesler/jquery.scrollTo I deployed it to the webjar using *bower install jquery.scrollTo* and it is also visible on the webjars.org org.webjars.bowergithub.flesler jquery.scrollto 2.1.1 Add it to the project like aResponse.render(JavaScriptHeaderItem.forReference(new WebjarsJavaScriptResourceReference("jquery.scrollto/current/jquery.scrollto.js"))); The wicket shows the error GET http://localhost:8080/wicket/resource/de.agilecoders.wicket.webjars.request.resource.WebjarsJavaScriptResourceReference/webjars/jquery.scrollto/null/jquery.scrollto.js net::ERR_ABORTED 404 What could be the problem? Best Regards, SIbgha
Enjoy Hints on wicket application
Hi, I want to integrate https://xbsoftware.com/products/enjoyhint/ in my wicket application. Just need a little idea if its possible. I havent tries yet. But it seems like a angular js application. I always had some trouble integrating complex javascript with wicket and I apologize for lack of knowledge in how angular js works. But if anyone thins its doable I will put my effort into it. Thanks. Regards, Sibgha
Re: Notify Action to the Parent Class
Hey, I tried what you mentioned. The condition is never satisfied. *if (event.getPayload() instanceof YourEvent) * On Sun, May 26, 2019 at 6:10 PM Francois Meillet wrote: > Hi Sibgha, > > // here is a simple code > > // > // in your Dpanel > // > protected void onUpdate(AjaxRequestTarget target) { > send(getPage(), Broadcast.EXACT, new > YourEvent(yourDataFromYourDropDownChoice)); > } > > > // > // in your HomePage, you override the onEvent method > // > @Override > public void onEvent(IEvent event) { > super.onEvent(event); > > if (event.getPayload() instanceof YourEvent) { > > YourEvent yourEvent = (YourEvent) = event.getPayload(); > // the data you sent throw your vent > YourData xyz = yourEvent.getData(); > // if you don't neeed anymore your event > event.stop(); > } > } > > > // look at the docs > > https://ci.apache.org/projects/wicket/guide/8.x/single.html#_wicket_events_infrastructure > > > François > follow Apache Wicket on twitter : https://twitter.com/apache_wicket < > https://twitter.com/apache_wicket> ! > > > > Le 26 mai 2019 à 15:33, Sibgha Nazir a écrit : > > > > Hi, > > > > In my application, Home Page creates DPanel and Dpanel has the drop down > > menu. In the class DPanel at 'onchange' event, I want to do some action > > in the class HomePage.java. How can that be possible? > > > > > > *HomePage.java*public HomePage(final PageParameters parameters) > >{ > >super(parameters); > > > >final Panel dropDownPanel = new Dpanel("toReplace"); > > > >dropDownPanel.setOutputMarkupId(true); > >add(dropDownPanel); > >} > > > > > > *DPanel.java*public Dpanel(String aId) > >{ > >super(aId); > >form = new Form("form"); > >form.setOutputMarkupId(true); > > > >// SelectMenu // > >final DropDownChoice dropdown = new > > DropDownChoice("select", new Model(), new > > ListModel(GENRES)); > >dropdown.setRequired(true); > >dropdown.setOutputMarkupId(true); > >dropdown.add(new AjaxFormComponentUpdatingBehavior("change") { > >/** > > * > > */ > >private static final long serialVersionUID = > > -6744838136235652577L; > > > >protected void onUpdate(AjaxRequestTarget target) { > >System.out.println("Changed"); > > > >} > >}); > > . > > . > > . > > . > > > > Quick Start here... > > https://github.com/Sibgha360/dropdownexample.git, > >
Notify Action to the Parent Class
Hi, In my application, Home Page creates DPanel and Dpanel has the drop down menu. In the class DPanel at 'onchange' event, I want to do some action in the class HomePage.java. How can that be possible? *HomePage.java*public HomePage(final PageParameters parameters) { super(parameters); final Panel dropDownPanel = new Dpanel("toReplace"); dropDownPanel.setOutputMarkupId(true); add(dropDownPanel); } *DPanel.java*public Dpanel(String aId) { super(aId); form = new Form("form"); form.setOutputMarkupId(true); // SelectMenu // final DropDownChoice dropdown = new DropDownChoice("select", new Model(), new ListModel(GENRES)); dropdown.setRequired(true); dropdown.setOutputMarkupId(true); dropdown.add(new AjaxFormComponentUpdatingBehavior("change") { /** * */ private static final long serialVersionUID = -6744838136235652577L; protected void onUpdate(AjaxRequestTarget target) { System.out.println("Changed"); } }); . . . . Quick Start here... https://github.com/Sibgha360/dropdownexample.git,
Wicket DropDown Change event
Hi, I am not able to trigger the on change event of the drop down in the wicket. In the class DPanel,java, I am simply trying to print on the console when the change event has occured. dropdown.add(*new* AjaxFormComponentUpdatingBehavior("onchange") { /** * */ *private* *static* *final* *long* *serialVersionUID* = -6744838136235652577L; *protected* *void* onUpdate(AjaxRequestTarget target) { System.*out*.println("Changed"); } }); Need Help. Following is my quick start application. https://github.com/Sibgha360/dropdownexample.git Thanks
Re: Loadable Detachable Model on button click and not before
Hi, Following up on my question. I cant find the solution on the internet. Best Regards, Sibgha On Mon, Apr 29, 2019 at 1:53 PM Sibgha Nazir wrote: > Hi, > > I have the following code: > > > *LearningCurveChartPanel* > > *public* LearningCurveChartPanel(String aId, IModel > aModel) > > { > > *super*(aId); > > model = aModel; > > > //initially the chart is empty. passing empty model > > chartPanel = *new* ChartPanel(*MID_CHART_CONTAINER*, > > LoadableDetachableModel.*of*(*this*::renderChart)); > > > > chartPanel.setOutputMarkupId(*true*); > > add(chartPanel); > > } > > @OnEvent > > *public* *void* onRenderAnnotations(RenderAnnotationsEvent aEvent) > > { > > LOG.trace("rendered annotation event"); > > > aEvent.getRequestHandler().add(*this*); > > } > > *ChartPanel* > > > *public* ChartPanel(String aId, LoadableDetachableModel > loadableDetachableModel) > > { > > *super*(aId); > > > > chartModel = (loadableDetachableModel); > > > chart = *new* WebMarkupContainer(*MID_CHART_CONTAINER*); > > chart.setMarkupId("canvas"); > > chart.setOutputMarkupId(*true*); > > add(chart); > > > chartAjaxBejavior = *new* ChartAjaxBejavior(); > > add(chartAjaxBejavior); > > } > > > Here I am adding ChartPanel in the constructor of LearningCurveChartPanel > and as the LearningCurveChartPanel loads the chart panel is loaded with the > data that is returned by renderChart. I want to do such that the > ChartPanel only renders when I click a button. How do I change the below > line to > > chartPanel = *new* ChartPanel(*MID_CHART_CONTAINER*, > > LoadableDetachableModel.*of*(*this*::renderChart)); > > And how do I define such thing in the onClick event? >
Loadable Detachable Model on button click and not before
Hi, I have the following code: *LearningCurveChartPanel* *public* LearningCurveChartPanel(String aId, IModel aModel) { *super*(aId); model = aModel; //initially the chart is empty. passing empty model chartPanel = *new* ChartPanel(*MID_CHART_CONTAINER*, LoadableDetachableModel.*of*(*this*::renderChart)); chartPanel.setOutputMarkupId(*true*); add(chartPanel); } @OnEvent *public* *void* onRenderAnnotations(RenderAnnotationsEvent aEvent) { LOG.trace("rendered annotation event"); aEvent.getRequestHandler().add(*this*); } *ChartPanel* *public* ChartPanel(String aId, LoadableDetachableModel loadableDetachableModel) { *super*(aId); chartModel = (loadableDetachableModel); chart = *new* WebMarkupContainer(*MID_CHART_CONTAINER*); chart.setMarkupId("canvas"); chart.setOutputMarkupId(*true*); add(chart); chartAjaxBejavior = *new* ChartAjaxBejavior(); add(chartAjaxBejavior); } Here I am adding ChartPanel in the constructor of LearningCurveChartPanel and as the LearningCurveChartPanel loads the chart panel is loaded with the data that is returned by renderChart. I want to do such that the ChartPanel only renders when I click a button. How do I change the below line to chartPanel = *new* ChartPanel(*MID_CHART_CONTAINER*, LoadableDetachableModel.*of*(*this*::renderChart)); And how do I define such thing in the onClick event?
Re: Loadable Detachable Model not updating on re-render
I will do that. Thanks. On Mon, Apr 29, 2019 at 9:54 AM Maxim Solodovnik wrote: > http://wicket.apache.org/start/quickstart.html > > And upload your project to github or some other service like this :) > > On Mon, 29 Apr 2019 at 14:49, Sibgha Nazir wrote: > > > How to create quick start? > > > > On Mon, Apr 29, 2019 at 9:39 AM Sven Meier wrote: > > > > > > > > > > > Hi, > > > > > > > > > > > > that should do it, no need to call detach() for yourself. > > > > > > > > > > > > Hard to tell what's going wrong.Can you create a quickstart? > > > > > > > > > > > > Regards > > > > > > Sven > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On 29.04.2019 at 09:16,wrote: > > > > > > > > > > > > Hi, I tried doing the following *public* ChartPanel(String aId, > > > LoadableDetachableModel loadableDetachableModel) { > > > *super*(aId*,**loadableDetachableModel*); chartModel = > > > (loadableDetachableModel); chart = *new* > > > WebMarkupContainer(*MID_CHART_CONTAINER*); chart.setMarkupId("canvas"); > > > chart.setOutputMarkupId(*true*); add(chart); chartAjaxBejavior = *new* > > > ChartAjaxBejavior(); add(chartAjaxBejavior); } It still doesn't update > > the > > > ChartPanel with the new model when onRenderAnnotations triggers. Do I > > have > > > to explicitly call detach()? On Mon, Apr 29, 2019 at 7:49 AM Sven Meier > > > wrote: > > > Hi, > > > > your chartPanel should pass the > > > chartModel to the super constructor. The > panel takes care that the > > > model is detached after the request. > > > > If you just hold > > > chartModel as a member variable, no one will call > detach() on it > > > > > > > Have fun > > Sven > > > > > > > > > > > > > > > > > On 28.04.2019 at 21:29, wrote: > > > > > > > > > Hi, This question is related to LoadableDetachable Model. I > have a > > > > wicket panel, LearningCurveChartPanel. *public* > > > > LearningCurveChartPanel(String aId, IModel aModel) { *super*(aId); > model > > = > > > > aModel; //initially the chart is empty. passing empty model > chartPanel > > > = > *new* ChartPanel(*MID_CHART_CONTAINER*, > > > > LoadableDetachableModel.*of*(*this*::renderChart)); > > > > chartPanel.setOutputMarkupId(*true*); add(chartPanel); } @OnEvent > > *public* > > > > *void* onRenderAnnotations(RenderAnnotationsEvent aEvent) { > > > > LOG.trace("rendered annotation event"); > > > > aEvent.getRequestHandler().add(*this*); } which is rendering a > > ChartPanel. > > > > The ChartPanel is like this *public* ChartPanel(String aId, > > > > LoadableDetachableModel loadableDetachableModel) { *super*(aId); > > > chartModel > = (loadableDetachableModel); chart = *new* > > > > WebMarkupContainer(*MID_CHART_CONTAINER*); chart.setMarkupId("canvas"); > > > > > > chart.setOutputMarkupId(*true*); add(chart); chartAjaxBejavior = > *new* > > > > Char > > > tAjaxBejavior(); add(chartAjaxBejavior); } The chartModel has > the > > > right data and it renders correctly with the data that is fed to it > > > > from LearningCurveChartPanel. But when the onRenderAnnotation event of > > the > > > > LearningCurveChartPanel triggers what I am trying to do is to update > > > the > (re-render) the Chart Panel inside it. It does re-render the > > chart > > > panel > but the model stays the same. I want to implement it such > that > > > the model of > the ChartPanel updates and when it re-renders it as > the > > > latest data when > the onRenderAnnotation event was triggered. Please > > > guide me in the right > direction. Best, Sibgha > > > > > > > > > > > > > > > -- > WBR > Maxim aka solomax >
Re: Loadable Detachable Model not updating on re-render
There is one more thing regarding the same code. Here I am adding ChartPanel in the constructor of LearningCurveChartPanel and as the LearningCurveChartPanel loads the chart panel is loaded with the data that is returned by renderChart. I want to do such that the ChartPanel only renders when I click a button. How do I change the below line to chartPanel = *new* ChartPanel(*MID_CHART_CONTAINER*, LoadableDetachableModel.*of*(*this*::renderChart)); And how do I define such thing in the onClick event? Best, Sibgha On Sun, Apr 28, 2019 at 9:29 PM Sibgha Nazir wrote: > Hi, > > This question is related to LoadableDetachable Model. > > I have a wicket panel, LearningCurveChartPanel. > >*public* LearningCurveChartPanel(String aId, IModel > aModel) > > { > > *super*(aId); > > model = aModel; > > > //initially the chart is empty. passing empty model > > chartPanel = *new* ChartPanel(*MID_CHART_CONTAINER*, > > LoadableDetachableModel.*of*(*this*::renderChart)); > > > > chartPanel.setOutputMarkupId(*true*); > > add(chartPanel); > > } > > @OnEvent > > *public* *void* onRenderAnnotations(RenderAnnotationsEvent aEvent) > > { > > LOG.trace("rendered annotation event"); > > > aEvent.getRequestHandler().add(*this*); > > } > > > which is rendering a ChartPanel. The ChartPanel is like this > > *public* ChartPanel(String aId, LoadableDetachableModel > loadableDetachableModel) > > { > > *super*(aId); > > > > chartModel = (loadableDetachableModel); > > > chart = *new* WebMarkupContainer(*MID_CHART_CONTAINER*); > > chart.setMarkupId("canvas"); > > chart.setOutputMarkupId(*true*); > > add(chart); > > > chartAjaxBejavior = *new* ChartAjaxBejavior(); > > add(chartAjaxBejavior); > > } > > > The chartModel has the right data and it renders correctly with the data > that is fed to it from LearningCurveChartPanel. > > But when the onRenderAnnotation event of the LearningCurveChartPanel > triggers what I am trying to do is to update the (re-render) the Chart > Panel inside it. It does re-render the chart panel but the model stays the > same. I want to implement it such that the model of the ChartPanel updates > and when it re-renders it as the latest data when the onRenderAnnotation > event was triggered. > > Please guide me in the right direction. > > Best, > Sibgha > > > >
Re: Loadable Detachable Model not updating on re-render
How to create quick start? On Mon, Apr 29, 2019 at 9:39 AM Sven Meier wrote: > > > Hi, > > > > that should do it, no need to call detach() for yourself. > > > > Hard to tell what's going wrong.Can you create a quickstart? > > > > Regards > > Sven > > > > > > > > > > > > > > On 29.04.2019 at 09:16,wrote: > > > > > > Hi, I tried doing the following *public* ChartPanel(String aId, > LoadableDetachableModel loadableDetachableModel) { > *super*(aId*,**loadableDetachableModel*); chartModel = > (loadableDetachableModel); chart = *new* > WebMarkupContainer(*MID_CHART_CONTAINER*); chart.setMarkupId("canvas"); > chart.setOutputMarkupId(*true*); add(chart); chartAjaxBejavior = *new* > ChartAjaxBejavior(); add(chartAjaxBejavior); } It still doesn't update the > ChartPanel with the new model when onRenderAnnotations triggers. Do I have > to explicitly call detach()? On Mon, Apr 29, 2019 at 7:49 AM Sven Meier > wrote: > > > Hi, > > > > your chartPanel should pass the > chartModel to the super constructor. The > panel takes care that the > model is detached after the request. > > > > If you just hold > chartModel as a member variable, no one will call > detach() on it > > > > > Have fun > > Sven > > > > > > > > > > > > > > On 28.04.2019 at 21:29, wrote: > > > > > > > Hi, This question is related to LoadableDetachable Model. I have a > > wicket panel, LearningCurveChartPanel. *public* > > LearningCurveChartPanel(String aId, IModel aModel) { *super*(aId); model = > > aModel; //initially the chart is empty. passing empty model chartPanel > = > *new* ChartPanel(*MID_CHART_CONTAINER*, > > LoadableDetachableModel.*of*(*this*::renderChart)); > > chartPanel.setOutputMarkupId(*true*); add(chartPanel); } @OnEvent *public* > > *void* onRenderAnnotations(RenderAnnotationsEvent aEvent) { > > LOG.trace("rendered annotation event"); > > aEvent.getRequestHandler().add(*this*); } which is rendering a ChartPanel. > > The ChartPanel is like this *public* ChartPanel(String aId, > > LoadableDetachableModel loadableDetachableModel) { *super*(aId); > chartModel > = (loadableDetachableModel); chart = *new* > > WebMarkupContainer(*MID_CHART_CONTAINER*); chart.setMarkupId("canvas"); > > chart.setOutputMarkupId(*true*); add(chart); chartAjaxBejavior = *new* > > Char > tAjaxBejavior(); add(chartAjaxBejavior); } The chartModel has > the > right data and it renders correctly with the data that is fed to it > > from LearningCurveChartPanel. But when the onRenderAnnotation event of the > > LearningCurveChartPanel triggers what I am trying to do is to update > the > (re-render) the Chart Panel inside it. It does re-render the chart > panel > but the model stays the same. I want to implement it such that > the model of > the ChartPanel updates and when it re-renders it as the > latest data when > the onRenderAnnotation event was triggered. Please > guide me in the right > direction. Best, Sibgha > > > > > >
Re: Loadable Detachable Model not updating on re-render
Hi, I tried doing the following *public* ChartPanel(String aId, LoadableDetachableModel loadableDetachableModel) { *super*(aId*,**loadableDetachableModel*); chartModel = (loadableDetachableModel); chart = *new* WebMarkupContainer(*MID_CHART_CONTAINER*); chart.setMarkupId("canvas"); chart.setOutputMarkupId(*true*); add(chart); chartAjaxBejavior = *new* ChartAjaxBejavior(); add(chartAjaxBejavior); } It still doesn't update the ChartPanel with the new model when onRenderAnnotations triggers. Do I have to explicitly call detach()? On Mon, Apr 29, 2019 at 7:49 AM Sven Meier wrote: > > > Hi, > > > > your chartPanel should pass the chartModel to the super constructor. The > panel takes care that the model is detached after the request. > > > > If you just hold chartModel as a member variable, no one will call > detach() on it > > > > Have fun > > Sven > > > > > > > > > > > > > On 28.04.2019 at 21:29,wrote: > > > > > > Hi, This question is related to LoadableDetachable Model. I have a > wicket panel, LearningCurveChartPanel. *public* > LearningCurveChartPanel(String aId, IModel aModel) { *super*(aId); model = > aModel; //initially the chart is empty. passing empty model chartPanel = > *new* ChartPanel(*MID_CHART_CONTAINER*, > LoadableDetachableModel.*of*(*this*::renderChart)); > chartPanel.setOutputMarkupId(*true*); add(chartPanel); } @OnEvent *public* > *void* onRenderAnnotations(RenderAnnotationsEvent aEvent) { > LOG.trace("rendered annotation event"); > aEvent.getRequestHandler().add(*this*); } which is rendering a ChartPanel. > The ChartPanel is like this *public* ChartPanel(String aId, > LoadableDetachableModel loadableDetachableModel) { *super*(aId); chartModel > = (loadableDetachableModel); chart = *new* > WebMarkupContainer(*MID_CHART_CONTAINER*); chart.setMarkupId("canvas"); > chart.setOutputMarkupId(*true*); add(chart); chartAjaxBejavior = *new* > ChartAjaxBejavior(); add(chartAjaxBejavior); } The chartModel has > the right data and it renders correctly with the data that is fed to it > from LearningCurveChartPanel. But when the onRenderAnnotation event of the > LearningCurveChartPanel triggers what I am trying to do is to update the > (re-render) the Chart Panel inside it. It does re-render the chart panel > but the model stays the same. I want to implement it such that the model of > the ChartPanel updates and when it re-renders it as the latest data when > the onRenderAnnotation event was triggered. Please guide me in the right > direction. Best, Sibgha > > >
Loadable Detachable Model not updating on re-render
Hi, This question is related to LoadableDetachable Model. I have a wicket panel, LearningCurveChartPanel. *public* LearningCurveChartPanel(String aId, IModel aModel) { *super*(aId); model = aModel; //initially the chart is empty. passing empty model chartPanel = *new* ChartPanel(*MID_CHART_CONTAINER*, LoadableDetachableModel.*of*(*this*::renderChart)); chartPanel.setOutputMarkupId(*true*); add(chartPanel); } @OnEvent *public* *void* onRenderAnnotations(RenderAnnotationsEvent aEvent) { LOG.trace("rendered annotation event"); aEvent.getRequestHandler().add(*this*); } which is rendering a ChartPanel. The ChartPanel is like this *public* ChartPanel(String aId, LoadableDetachableModel loadableDetachableModel) { *super*(aId); chartModel = (loadableDetachableModel); chart = *new* WebMarkupContainer(*MID_CHART_CONTAINER*); chart.setMarkupId("canvas"); chart.setOutputMarkupId(*true*); add(chart); chartAjaxBejavior = *new* ChartAjaxBejavior(); add(chartAjaxBejavior); } The chartModel has the right data and it renders correctly with the data that is fed to it from LearningCurveChartPanel. But when the onRenderAnnotation event of the LearningCurveChartPanel triggers what I am trying to do is to update the (re-render) the Chart Panel inside it. It does re-render the chart panel but the model stays the same. I want to implement it such that the model of the ChartPanel updates and when it re-renders it as the latest data when the onRenderAnnotation event was triggered. Please guide me in the right direction. Best, Sibgha
Re: Partial
I make the call like this @Override *public* *void* renderHead(IHeaderResponse response) { *super*.renderHead(response); Optional target = RequestCycle.*get* ().find(AjaxRequestTarget.*class*); *if* (!target.equals(Optional.*empty*())) renderChart(target.get()); } On Wed, Apr 24, 2019 at 7:00 PM Martin Grigorov wrote: > Hi, > > On Wed, Apr 24, 2019 at 5:08 PM Sibgha Nazir wrote: > > > Hello wicket developer, > > > > I am facing the following exception on re-rendering a wicket panel using > > the code > > > > > > > > iPartialPageRequestHandler.add(chartPanel); > > > > In which method of your code do you make that call ? > How do you get a reference to iPartialPageRequestHandler? Is it passed as a > parameter to the method by Wicket or do you look it up by using > RequestCycle.find(Class) ? > > > > > > java.lang.IllegalStateException: A partial update of the page is being > > rendered, component [ChartPanel [Component id = chart-container]] can no > > longer be added > > > > It renders it perfectly the first time. But I want to call this again and > > again when user clicks refresh button. What does this mean? > > > > Best Regards, > > Sibgha Nazir > > >
Re: Partial
In renderChart there is a line updating the chart panel like this PartialPageRequestHandler.add(chartPanel); On Wed, Apr 24, 2019 at 8:06 PM Sibgha Nazir wrote: > I make the call like this > > @Override > > *public* *void* renderHead(IHeaderResponse response) > > { > > *super*.renderHead(response); > > > > Optional target = RequestCycle.*get* > ().find(AjaxRequestTarget.*class*); > > > *if* (!target.equals(Optional.*empty*())) > > renderChart(target.get()); > > } > > On Wed, Apr 24, 2019 at 7:00 PM Martin Grigorov > wrote: > >> Hi, >> >> On Wed, Apr 24, 2019 at 5:08 PM Sibgha Nazir wrote: >> >> > Hello wicket developer, >> > >> > I am facing the following exception on re-rendering a wicket panel using >> > the code >> > >> > >> > >> > iPartialPageRequestHandler.add(chartPanel); >> > >> >> In which method of your code do you make that call ? >> How do you get a reference to iPartialPageRequestHandler? Is it passed as >> a >> parameter to the method by Wicket or do you look it up by using >> RequestCycle.find(Class) ? >> >> >> > >> > java.lang.IllegalStateException: A partial update of the page is being >> > rendered, component [ChartPanel [Component id = chart-container]] can no >> > longer be added >> > >> > It renders it perfectly the first time. But I want to call this again >> and >> > again when user clicks refresh button. What does this mean? >> > >> > Best Regards, >> > Sibgha Nazir >> > >> >
Partial
Hello wicket developer, I am facing the following exception on re-rendering a wicket panel using the code iPartialPageRequestHandler.add(chartPanel); java.lang.IllegalStateException: A partial update of the page is being rendered, component [ChartPanel [Component id = chart-container]] can no longer be added It renders it perfectly the first time. But I want to call this again and again when user clicks refresh button. What does this mean? Best Regards, Sibgha Nazir
Re: Wicket collapsable panel
Is it possible to get a transition effect with this method? I.e. opening and closing of tjr panel. On Tue, Apr 16, 2019, 09:04 Ernesto Reinaldo Barreiro Hi, > > There are several ways to do this. E.g > > 1- Use javascript at client side and just hide nent of panel (bound to the > link that toggles the panel) > 2- Use wicket AJAX and content.steVisible(false|true) where content is the > panel containing you "box" content. This logic attached to the AJAX link > closing/opening box. > > > > On Mon, Apr 15, 2019 at 10:28 PM Sibgha Nazir wrote: > > > Hi, > > > > I am looking for a way to create a panel that opens and closes from one > > side of the container. I havent been lucky enough to find a related thing > > on internet. > > > > Can anybody hint me? > > > > Thanks. > > > > > -- > Regards - Ernesto Reinaldo Barreiro >
Wicket collapsable panel
Hi, I am looking for a way to create a panel that opens and closes from one side of the container. I havent been lucky enough to find a related thing on internet. Can anybody hint me? Thanks.