本文整理汇总了Java中org.apache.wicket.markup.head.OnDomReadyHeaderItem类的典型用法代码示例。如果您正苦于以下问题:Java OnDomReadyHeaderItem类的具体用法?Java OnDomReadyHeaderItem怎么用?Java OnDomReadyHeaderItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OnDomReadyHeaderItem类属于org.apache.wicket.markup.head包,在下文中一共展示了OnDomReadyHeaderItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renderHead
import org.apache.wicket.markup.head.OnDomReadyHeaderItem; //导入依赖的package包/类
@Override
public void renderHead(IHeaderResponse response) {
super.renderHead(response);
response.render(JavaScriptHeaderItem.forReference(new MarkdownResourceReference()));
String encodedAttachmentSupport;
if (getAttachmentSupport() != null) {
encodedAttachmentSupport = Base64.encodeBase64String(SerializationUtils.serialize(getAttachmentSupport()));
encodedAttachmentSupport = StringUtils.deleteWhitespace(encodedAttachmentSupport);
encodedAttachmentSupport = StringEscapeUtils.escapeEcmaScript(encodedAttachmentSupport);
encodedAttachmentSupport = "'" + encodedAttachmentSupport + "'";
} else {
encodedAttachmentSupport = "undefined";
}
String callback = ajaxBehavior.getCallbackFunction(explicit("action"), explicit("param1"), explicit("param2"),
explicit("param3")).toString();
String autosaveKey = getAutosaveKey();
if (autosaveKey != null)
autosaveKey = "'" + JavaScriptEscape.escapeJavaScript(autosaveKey) + "'";
else
autosaveKey = "undefined";
String script = String.format("gitplex.server.markdown.onDomReady('%s', %s, %d, %s, %d, %b, %b, %s);",
container.getMarkupId(),
callback,
ATWHO_LIMIT,
encodedAttachmentSupport,
getAttachmentSupport()!=null?getAttachmentSupport().getAttachmentMaxSize():0,
getUserMentionSupport() != null,
getPullRequestReferenceSupport() != null,
autosaveKey);
response.render(OnDomReadyHeaderItem.forScript(script));
script = String.format("gitplex.server.markdown.onWindowLoad('%s');", container.getMarkupId());
response.render(OnLoadHeaderItem.forScript(script));
}
示例2: renderInitializationScript
import org.apache.wicket.markup.head.OnDomReadyHeaderItem; //导入依赖的package包/类
@Override
protected void renderInitializationScript(IHeaderResponse response) {
T value;
if (getWebRequest().getRequestParameters().getParameterNames().contains(getInputName())) {
convertInput();
value = getConvertedInput();
} else {
value = getModelObject();
}
if (value != null) {
JsonBuilder selection = new JsonBuilder();
try {
selection.object();
getProvider().toJson(value, selection);
selection.endObject();
} catch (JSONException e) {
throw new RuntimeException("Error converting model object to Json", e);
}
response.render(OnDomReadyHeaderItem.forScript(
JQuery.execute("$('#%s').select2('data', %s);", getJquerySafeMarkupId(), selection.toJson())));
}
}
示例3: renderHead
import org.apache.wicket.markup.head.OnDomReadyHeaderItem; //导入依赖的package包/类
@Override
public void renderHead(IHeaderResponse response) {
super.renderHead(response);
response.render(JavaScriptHeaderItem.forReference(new SourceEditResourceReference()));
String autosaveKey = JavaScriptEscape.escapeJavaScript(context.getAutosaveKey());
String jsonOfMark = context.getMark()!=null?getJson(context.getMark()):"undefined";
String script = String.format("gitplex.server.sourceEdit.onDomReady('%s', '%s', %s, '%s', %s, '%s', %b, '%s');",
sourceFormComponent.getMarkupId(),
JavaScriptEscape.escapeJavaScript(context.getNewPath()),
jsonOfMark,
sourceFormat.getIndentType(),
sourceFormat.getTabSize(),
sourceFormat.getLineWrapMode(),
context.getMode() == Mode.EDIT,
autosaveKey);
response.render(OnDomReadyHeaderItem.forScript(script));
script = String.format("gitplex.server.sourceEdit.onWindowLoad('%s', %s, '%s');",
sourceFormComponent.getMarkupId(), jsonOfMark, autosaveKey);
response.render(OnLoadHeaderItem.forScript(script));
}
示例4: renderHead
import org.apache.wicket.markup.head.OnDomReadyHeaderItem; //导入依赖的package包/类
@Override
public void renderHead(Component component, IHeaderResponse response) {
super.renderHead(component, response);
StringBuilder sb = new StringBuilder();
sb.append("$('#");
sb.append(component.getMarkupId());
sb.append("').tooltip({html:true");
if(!isInsideModal()){
sb.append(", 'container':'body'");
} else {
sb.append(", 'container':'#");
sb.append(getModalContainer(component));
sb.append("'");
}
sb.append("});");
response.render(OnDomReadyHeaderItem.forScript(sb.toString()));
}
示例5: renderHead
import org.apache.wicket.markup.head.OnDomReadyHeaderItem; //导入依赖的package包/类
@Override
public void renderHead(IHeaderResponse response) {
super.renderHead(response);
response.render(CssHeaderItem.forReference(STYLE_CSS));
response.render(CssHeaderItem.forReference(DIAGRAM_CSS));
response.render(CssHeaderItem.forReference(BPMN_CSS));
response.render(JavaScriptHeaderItem.forReference(BPMN_MODELER_JS));
Map<String, Object> params = new HashMap<String, Object>();
params.put("componentId", getMarkupId());
params.put("xmlComponentId", xml.getMarkupId());
params.put("lang", getLocale().getLanguage());
TextTemplate template = new PackageTextTemplate(BpmnModeler.class, "bpmnmodeler.tmpl.js");
response.render(OnDomReadyHeaderItem.forScript(template.asString(params)));
}
示例6: renderHead
import org.apache.wicket.markup.head.OnDomReadyHeaderItem; //导入依赖的package包/类
@Override
public void renderHead(IHeaderResponse response) {
super.renderHead(response);
response.render(JavaScriptHeaderItem.forReference(BootstrapModalJavaScriptResourceReference.get()));
Event confirmEvent = new Event(BootstrapConfirmEvent.CONFIRM) {
private static final long serialVersionUID = 6466300052232971891L;
@Override
public JsScope callback() {
return JsScopeEvent.quickScope(
new JsStatement()
.append("window.location = " + JsUtils.quotes(getURL(), true)).append(";")
.append("event.preventDefault();")
);
}
};
response.render(OnDomReadyHeaderItem.forScript(new JsStatement().$(this).chain(confirmEvent).render(true)));
}
示例7: internalRenderHead
import org.apache.wicket.markup.head.OnDomReadyHeaderItem; //导入依赖的package包/类
protected void internalRenderHead(IHeaderResponse response) {
response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forReference(Application.get().getJavaScriptLibrarySettings().getJQueryReference())));
super.renderHead(response);
final String suffix = DEVELOPMENT == getApplication().getConfigurationType() ? "" : ".min";
response.render(CssHeaderItem.forUrl(String.format("css/theme_om/jquery-ui%s.css", suffix)));
response.render(CssHeaderItem.forUrl(String.format("css/theme%s.css", suffix)));
if (isRtl()) {
response.render(CssHeaderItem.forUrl(String.format("css/theme-rtl%s.css", suffix)));
}
if (!Strings.isEmpty(getGaCode())) {
response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(BasePage.class, "om-ga.js"))));
StringBuilder script = new StringBuilder("initGA('");
script.append(getGaCode()).append("');").append(isMainPage() ? "initHash()" : "init()").append(';');
response.render(OnDomReadyHeaderItem.forScript(script));
}
}
示例8: renderHead
import org.apache.wicket.markup.head.OnDomReadyHeaderItem; //导入依赖的package包/类
@Override
public void renderHead(IHeaderResponse response) {
super.renderHead(response);
response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(Chat.class, "chat.js"))));
response.render(new PriorityHeaderItem(getNamedFunction("chatActivity", chatActivity, explicit(PARAM_TYPE), explicit(PARAM_ROOM_ID), explicit(PARAM_MSG_ID))));
if (showDashboardChat) {
ChatDao dao = getBean(ChatDao.class);
StringBuilder sb = new StringBuilder(getReinit());
List<ChatMessage> list = new ArrayList<>(dao.getGlobal(0, 30));
for(Long roomId : getUserRooms(getUserId())) {
Room r = getBean(RoomDao.class).get(roomId);
sb.append(addRoom(r));
}
list.addAll(dao.getUserRecent(getUserId(), Date.from(Instant.now().minus(Duration.ofHours(1L))), 0, 30));
if (!list.isEmpty()) {
sb.append("Chat.addMessage(").append(getMessage(list).toString()).append(");");
}
response.render(OnDomReadyHeaderItem.forScript(sb.toString()));
}
}
示例9: 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;
}
示例10: bratInitRenderLater
import org.apache.wicket.markup.head.OnDomReadyHeaderItem; //导入依赖的package包/类
/**
* Reload {@link BratAnnotationEditor} when the Correction/Curation page is opened
*
* @param aResponse
* the response.
*/
private void bratInitRenderLater(IHeaderResponse aResponse)
{
// Must be OnDomReader so that this is rendered before all other Javascript that is
// appended to the same AJAX request which turns the annotator visible after a document
// has been chosen.
// aResponse.render(OnDomReadyHeaderItem.forScript(bratInitCommand()));
// aResponse.render(OnLoadHeaderItem.forScript(bratLoadCollectionLaterCommand()));
// aResponse.render(OnLoadHeaderItem.forScript(bratRenderLaterCommand()));
String script = "setTimeout(function() { " +
bratInitCommand() +
bratLoadCollectionCommand() +
bratRenderLaterCommand() +
"}, 0);";
aResponse.render(OnDomReadyHeaderItem.forScript(script));
}
示例11: renderHead
import org.apache.wicket.markup.head.OnDomReadyHeaderItem; //导入依赖的package包/类
@Override
public void renderHead(IHeaderResponse response) {
super.renderHead(response);
response.render(JavaScriptHeaderItem.forUrl(JQUERYSCRIPT));
response.render(JavaScriptHeaderItem.forUrl(JQUERYUISCRIPT));
response.render(JavaScriptHeaderItem.forUrl(DATEPICKERSCRIPT));
response.render(JavaScriptHeaderItem.forUrl(StatsManager.SITESTATS_WEBAPP + "/script/reports.js"));
StringBuilder onDomReady = new StringBuilder();
onDomReady.append("checkWhatSelection();");
onDomReady.append("checkWhenSelection();");
onDomReady.append("checkWhoSelection();");
onDomReady.append("checkHowSelection();");
onDomReady.append("checkReportDetails();");
onDomReady.append("checkHowChartSelection();");
onDomReady.append(String.format("loadJQueryDatePicker('%s','%s');", "whenFrom", DateFormatterUtil.format(getReportParams().getWhenFrom(), DATEPICKER_FORMAT, getSession().getLocale())));
onDomReady.append(String.format("loadJQueryDatePicker('%s','%s');", "whenTo", DateFormatterUtil.format(getReportParams().getWhenTo(), DATEPICKER_FORMAT, getSession().getLocale())));
response.render(OnDomReadyHeaderItem.forScript(onDomReady.toString()));
}
示例12: renderHead
import org.apache.wicket.markup.head.OnDomReadyHeaderItem; //导入依赖的package包/类
@Override
public void renderHead(HtmlHeaderContainer container) {
container.getHeaderResponse().render(JavaScriptHeaderItem.forUrl(BasePage.JQUERYSCRIPT));
container.getHeaderResponse().render(JavaScriptHeaderItem.forUrl(StatsManager.SITESTATS_WEBAPP+"/html/components/jqueryFileTree/jqueryFileTree.js"));
container.getHeaderResponse().render(CssHeaderItem.forUrl(StatsManager.SITESTATS_WEBAPP+"/html/components/jqueryFileTree/jqueryFileTree.css"));
StringBuilder onDomReady = new StringBuilder();
onDomReady.append("jQuery('#sitestats-containerInner').fileTree(");
onDomReady.append(" {root: '");
onDomReady.append(BASE_DIR);
onDomReady.append("', script: '");
onDomReady.append(ajaxResourcesLoader.getCallbackUrl());
onDomReady.append("', duration: 100},");
onDomReady.append(" function(file) {return false;}");
onDomReady.append(");");
container.getHeaderResponse().render(OnDomReadyHeaderItem.forScript(onDomReady.toString()));
super.renderHead(container);
}
示例13: renderHead
import org.apache.wicket.markup.head.OnDomReadyHeaderItem; //导入依赖的package包/类
@Override
public void renderHead(Component component, IHeaderResponse response) {
super.renderHead(component, response);
// add java script stuff
response.render(JavaScriptHeaderItem.forUrl(JSTemplates.MAIN_JS,
JSTemplates.MAIN_JS_REF_ID));
// add javascript files for using jquery table sorter and select all
response.render(JavaScriptHeaderItem.forUrl(
JSTemplates.JQUERY_TABLESORT_JS,
JSTemplates.JQUERY_TABLESORT_JS_REF_ID));
// add javascript files for using jquery ui (sortable, draggable etc.)
response.render(JavaScriptHeaderItem.forUrl(JSTemplates.JQUERY_UI_JS,
JSTemplates.JQUERY_UI_JS_REF_ID));
// initially hide all ".collapse" thingies
response.render(OnDomReadyHeaderItem
.forScript(JSTemplates.INIT_COLLAPSE));
}
示例14: renderHead
import org.apache.wicket.markup.head.OnDomReadyHeaderItem; //导入依赖的package包/类
@Override
public void renderHead(IHeaderResponse response) {
super.renderHead(response);
response.render(JavaScriptHeaderItem.forReference(DRAWER_JAVASCRIPT));
response.render(JavaScriptHeaderItem.forReference(MANAGER_JAVASCRIPT));
response.render(CssHeaderItem.forReference(DRAWER_CSS));
Iterator<ListItem> iter = drawers.descendingIterator();
WebMarkupContainer drawer;
while (iter.hasNext()) {
drawer=iter.next().item;
response.render(OnDomReadyHeaderItem.forScript("$('#"+drawer.getMarkupId()+"').modaldrawer('show');"));
if (drawers.getFirst().item.equals(drawer)) {
response.render(OnDomReadyHeaderItem.forScript("$('#"+drawer.getMarkupId()+"').addClass('shown-modal');"));
response.render(OnDomReadyHeaderItem.forScript("$('#"+drawer.getMarkupId()+"').removeClass('hidden-modal');"));
} else {
response.render(OnDomReadyHeaderItem.forScript("$('#"+drawer.getMarkupId()+"').removeClass('shown-modal');"));
response.render(OnDomReadyHeaderItem.forScript("$('#"+drawer.getMarkupId()+"').addClass('hidden-modal');"));
}
}
}
示例15: getScrollBehaviour
import org.apache.wicket.markup.head.OnDomReadyHeaderItem; //导入依赖的package包/类
private Behavior getScrollBehaviour(){
return new AttributeModifier("onscroll", Model.of(this.getMarkupId())){
private static final long serialVersionUID = 3523727356782417598L;
@Override
public void renderHead(Component component, IHeaderResponse response) {
super.renderHead(component, response);
response.render(OnDomReadyHeaderItem.forScript("InfiniteScroll.getFromContainer('"+getMarkupId()+"').setUrls('"+upBehavior.getCallbackUrl()+"', '"+downBehavior.getCallbackUrl()+"')"));
}
@Override
protected String newValue(String currentValue, String replacementValue) {
return "InfiniteScroll.handleScroll('"+InfiniteScrollListView.this.getMarkupId()+"')";
}
};
}