本文整理汇总了Java中org.apache.wicket.markup.head.OnDomReadyHeaderItem.forScript方法的典型用法代码示例。如果您正苦于以下问题:Java OnDomReadyHeaderItem.forScript方法的具体用法?Java OnDomReadyHeaderItem.forScript怎么用?Java OnDomReadyHeaderItem.forScript使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.wicket.markup.head.OnDomReadyHeaderItem
的用法示例。
在下文中一共展示了OnDomReadyHeaderItem.forScript方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renderHead
import org.apache.wicket.markup.head.OnDomReadyHeaderItem; //导入方法依赖的package包/类
@Override
public void renderHead(final IHeaderResponse response) {
HeaderItem headerItem = null;
if (renderedShowing && showing) {
/*
* workaround for modal tags being copied by bootstrap-modal right into body and wicket updating the wrong
* tags in their previous position
*/
headerItem = OnDomReadyHeaderItem.forScript(createRefreshScript());
} else if (!renderedShowing && showing) {
headerItem = OnDomReadyHeaderItem.forScript(createShowScript());
renderedShowing = true;
} else if (renderedShowing && !showing) {
final StringBuilder script = new StringBuilder();
//scroll gets enabled again by registered hidden.bs.modal event from bootstrapModalConfig.js
script.append("$(window).disablescroll();");
script.append(createRefreshScript());
script.append(createHideScript());
headerItem = OnDomReadyHeaderItem.forScript(script);
renderedShowing = false;
}
renderDirectlyOrDelegateToRoot(response, headerItem);
alreadyRendered = true;
}
示例2: renderHead
import org.apache.wicket.markup.head.OnDomReadyHeaderItem; //导入方法依赖的package包/类
@Override
public void renderHead(Component component, IHeaderResponse response) {
super.renderHead(component, response);
OnDomReadyHeaderItem focusComponentHeaderItem = OnDomReadyHeaderItem.forScript("document.getElementById('"
+ component.getMarkupId() + "').focus();");
response.render(focusComponentHeaderItem);
}
示例3: getClearIntervalHeaderItem
import org.apache.wicket.markup.head.OnDomReadyHeaderItem; //导入方法依赖的package包/类
private HeaderItem getClearIntervalHeaderItem() {
String varName = getIntervalJavaScriptVarName();
String javaScript = MessageFormat.format("if(!(typeof {0} === \"undefined\"))'{'\n" + "clearInterval({0});\n"
+ "'}'", varName);
return OnDomReadyHeaderItem.forScript(javaScript);
}
示例4: newHeaderItem
import org.apache.wicket.markup.head.OnDomReadyHeaderItem; //导入方法依赖的package包/类
/**
* creates a new header item for the initializer script
*
* @param script the script to render
* @param id the js id that can be used when rendering this script
* @return new header item
*/
protected HeaderItem newHeaderItem(final CharSequence script, final String id) {
return OnDomReadyHeaderItem.forScript(script);
}