use of org.apache.wicket.markup.head.OnDomReadyHeaderItem in project ocvn by devgateway.
the class JavascriptCallbackAjaxBehavior method renderHead.
@Override
public void renderHead(final Component component, final IHeaderResponse response) {
Map<String, Object> map = new HashMap<>();
map.put("callbackUrl", getCallbackUrl().toString());
map.put("args", getCallbackArguments());
map.put("componentMarkupId", component.getMarkupId());
try {
if (scriptTemplate != null) {
OnDomReadyHeaderItem onDomReadyHeaderItem = OnDomReadyHeaderItem.forScript(scriptTemplate.asString(map));
scriptTemplate.close();
response.render(onDomReadyHeaderItem);
}
} catch (Exception e) {
e.printStackTrace();
}
}
use of org.apache.wicket.markup.head.OnDomReadyHeaderItem in project webanno by webanno.
the class UrlParametersReceivingBehavior method renderHead.
@Override
public void renderHead(Component component, IHeaderResponse response) {
super.renderHead(component, response);
StringBuilder sb = new StringBuilder().append("try{").append("window.UrlUtil = newUrlUtil(").append(optionsJsonString()).append(");").append("UrlUtil.setWicketAjaxCall(function(){" + getCallbackFunctionBody() + "});").append("$(window).bind('hashchange',window.UrlUtil.back);").append("window.UrlUtil.sendUrlParameters();").append("}catch(e){}");
response.render(new OnDomReadyHeaderItem(sb.toString()));
response.render(getJS(UrlFragment.class));
}
use of org.apache.wicket.markup.head.OnDomReadyHeaderItem in project wicket by apache.
the class AbstractAutoCompleteBehavior method renderAutocompleteHead.
/**
* Render autocomplete init javascript and other head contributions
*
* @param response
*/
private void renderAutocompleteHead(final IHeaderResponse response) {
response.render(JavaScriptHeaderItem.forReference(AUTOCOMPLETE_JS));
String initJS = String.format("new Wicket.AutoComplete(%s, %s);", renderAjaxAttributes(getComponent()), constructSettingsJS());
final OnDomReadyHeaderItem onDomReady = OnDomReadyHeaderItem.forScript(initJS);
response.render(new WrappedHeaderItem(onDomReady));
}
use of org.apache.wicket.markup.head.OnDomReadyHeaderItem in project oc-explorer by devgateway.
the class JavascriptCallbackAjaxBehavior method renderHead.
@Override
public void renderHead(final Component component, final IHeaderResponse response) {
Map<String, Object> map = new HashMap<>();
map.put("callbackUrl", getCallbackUrl().toString());
map.put("args", getCallbackArguments());
map.put("componentMarkupId", component.getMarkupId());
try {
if (scriptTemplate != null) {
OnDomReadyHeaderItem onDomReadyHeaderItem = OnDomReadyHeaderItem.forScript(scriptTemplate.asString(map));
scriptTemplate.close();
response.render(onDomReadyHeaderItem);
}
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations