Skip to content

Commit

Permalink
Enhanced KendoUIBehavior#destroy() & KendoDestroyListener; wicketstuf…
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastien Briquet committed May 27, 2015
1 parent a20a0cf commit 9011d6b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
Expand Up @@ -21,7 +21,6 @@
import org.apache.wicket.protocol.http.WebApplication;

/**
* TODO javadoc
* Provides the {@link IInitializer} for Kendo UI
*
* @author Sebastien Briquet - sebfz1
Expand Down
Expand Up @@ -21,19 +21,18 @@

import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.AjaxRequestTarget.IJavaScriptResponse;
import org.apache.wicket.ajax.AjaxRequestTarget.IListener;
import org.apache.wicket.ajax.AjaxRequestTarget.AbstractListener;
import org.apache.wicket.util.visit.IVisit;
import org.apache.wicket.util.visit.IVisitor;
import org.apache.wicket.util.visit.Visits;

/**
* INTERNAL USE<br/>
* Provides an {@link IListener} for {@link KendoUIBehavior}{@code s} that destroys widgets about to be repainted.
* Provides an {@code IListener} for {@link KendoUIBehavior}{@code s} that destroys widgets about to be repainted.
*
* @author Sebastien Briquet - sebfz1
*/
public class KendoDestroyListener extends AjaxRequestTarget.AbstractListener
public class KendoDestroyListener extends AbstractListener
{
/**
* Specifies that a widgets can be automatically destroyed
Expand Down Expand Up @@ -61,7 +60,6 @@ public void onBeforeRespond(Map<String, Component> map, AjaxRequestTarget target
}
}


// Factories //

/**
Expand All @@ -72,6 +70,7 @@ public void onBeforeRespond(Map<String, Component> map, AjaxRequestTarget target
protected IVisitor<Component, Object> newBeforeRespondVisitor(final AjaxRequestTarget target)
{
return new IVisitor<Component, Object>() {

@Override
public void component(Component component, IVisit<Object> visit)
{
Expand Down
Expand Up @@ -160,7 +160,7 @@ public void destroy(AjaxRequestTarget target)
{
// TODO: remove log
target.prependJavaScript(String.format("console.info('destroying %s (%s)...')", this.method, this.selector));
target.prependJavaScript(this.widget() + ".destroy();");
target.prependJavaScript(String.format("var $w=%s; if($w) { $w.destroy(); }", this.widget()));

this.onDestroy(target);
}
Expand Down

0 comments on commit 9011d6b

Please sign in to comment.