本文整理汇总了Java中org.apache.wicket.markup.head.JavaScriptHeaderItem类的典型用法代码示例。如果您正苦于以下问题:Java JavaScriptHeaderItem类的具体用法?Java JavaScriptHeaderItem怎么用?Java JavaScriptHeaderItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JavaScriptHeaderItem类属于org.apache.wicket.markup.head包,在下文中一共展示了JavaScriptHeaderItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renderHead
import org.apache.wicket.markup.head.JavaScriptHeaderItem; //导入依赖的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: getDependencies
import org.apache.wicket.markup.head.JavaScriptHeaderItem; //导入依赖的package包/类
@Override
public List<HeaderItem> getDependencies() {
List<HeaderItem> dependencies = super.getDependencies();
dependencies.add(JavaScriptHeaderItem.forReference(new JQueryUIResourceReference()));
dependencies.add(JavaScriptHeaderItem.forReference(new SelectionPopoverResourceReference()));
dependencies.add(JavaScriptHeaderItem.forReference(new HoverResourceReference()));
dependencies.add(JavaScriptHeaderItem.forReference(new ScrollIntoViewResourceReference()));
dependencies.add(JavaScriptHeaderItem.forReference(new DoneEventsResourceReference()));
dependencies.add(JavaScriptHeaderItem.forReference(new HotkeysResourceReference()));
dependencies.add(JavaScriptHeaderItem.forReference(new CookiesResourceReference()));
dependencies.add(JavaScriptHeaderItem.forReference(new CodeMirrorResourceReference()));
dependencies.add(JavaScriptHeaderItem.forReference(new ClipboardResourceReference()));
dependencies.add(CssHeaderItem.forReference(
new BaseDependentCssResourceReference(SourceViewResourceReference.class, "source-view.css")));
return dependencies;
}
示例3: renderHead
import org.apache.wicket.markup.head.JavaScriptHeaderItem; //导入依赖的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.JavaScriptHeaderItem; //导入依赖的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)));
}
示例5: renderHead
import org.apache.wicket.markup.head.JavaScriptHeaderItem; //导入依赖的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()));
}
示例6: renderHead
import org.apache.wicket.markup.head.JavaScriptHeaderItem; //导入依赖的package包/类
@Override
public void renderHead(final IHeaderResponse response) {
super.renderHead(response);
final String version = ServerConfigurationService.getString("portal.cdn.version", "");
// tablesorted used by student grade summary
response.render(CssHeaderItem
.forUrl(String.format("/library/js/jquery/tablesorter/2.27.7/css/theme.bootstrap.min.css?version=%s", version)));
response.render(JavaScriptHeaderItem
.forUrl(String.format("/library/js/jquery/tablesorter/2.27.7/js/jquery.tablesorter.min.js?version=%s", version)));
response.render(JavaScriptHeaderItem
.forUrl(String.format("/library/js/jquery/tablesorter/2.27.7/js/jquery.tablesorter.widgets.min.js?version=%s", version)));
// GradebookNG Grade specific styles and behaviour
response.render(
CssHeaderItem.forUrl(String.format("/gradebookng-tool/styles/gradebook-grades.css?version=%s", version)));
response.render(
CssHeaderItem.forUrl(
String.format("/gradebookng-tool/styles/gradebook-print.css?version=%s", version),
"print"));
response.render(
JavaScriptHeaderItem.forUrl(
String.format("/gradebookng-tool/scripts/gradebook-grade-summary.js?version=%s", version)));
}
示例7: renderHead
import org.apache.wicket.markup.head.JavaScriptHeaderItem; //导入依赖的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)));
}
示例8: renderHead
import org.apache.wicket.markup.head.JavaScriptHeaderItem; //导入依赖的package包/类
@Override
public void renderHead(final IHeaderResponse response) {
super.renderHead(response);
final String version = ServerConfigurationService.getString("portal.cdn.version", "");
// Drag and Drop (requires jQueryUI)
response.render(
JavaScriptHeaderItem.forUrl(String.format("/library/webjars/jquery-ui/1.12.1/jquery-ui.min.js?version=%s", version)));
// chart requires ChartJS
response.render(
JavaScriptHeaderItem.forUrl(String.format("/gradebookng-tool/webjars/chartjs/2.7.0/Chart.min.js?version=%s", version)));
response.render(CssHeaderItem.forUrl(String.format("/gradebookng-tool/styles/gradebook-settings.css?version=%s", version)));
response.render(JavaScriptHeaderItem.forUrl(String.format("/gradebookng-tool/scripts/gradebook-settings.js?version=%s", version)));
}
示例9: renderHead
import org.apache.wicket.markup.head.JavaScriptHeaderItem; //导入依赖的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()));
}
}
示例10: renderHead
import org.apache.wicket.markup.head.JavaScriptHeaderItem; //导入依赖的package包/类
@Override
public void renderHead(Component component, IHeaderResponse response) {
super.renderHead(component, response);
DashboardSettings settings = DashboardSettings.get();
if (settings.isIncludeJQuery()) {
response.render(JavaScriptHeaderItem.forReference(settings.getJQueryReference()));
}
if (settings.isIncludeJQueryUI()) {
response.render(JavaScriptHeaderItem.forReference(settings.getJQueryUIReference()));
}
if (settings.isIncludeJQueryJson()) {
response.render(JavaScriptHeaderItem.forReference(settings.getJQueryJsonReference()));
}
if (settings.isIncludeJavaScript()) {
response.render(JavaScriptHeaderItem.forReference(settings.getJavaScriptReference()));
}
if (settings.isIncludeCss()) {
response.render(CssHeaderItem.forReference(settings.getCssReference()));
}
}
示例11: renderHead
import org.apache.wicket.markup.head.JavaScriptHeaderItem; //导入依赖的package包/类
@Override
public void renderHead(final IHeaderResponse response) {
super.renderHead(response);
// get the Sakai skin header fragment from the request attribute
final HttpServletRequest request = (HttpServletRequest) getRequest().getContainerRequest();
response.render(StringHeaderItem.forString((String) request.getAttribute("sakai.html.head")));
response.render(OnLoadHeaderItem.forScript("setMainFrameHeight( window.name )"));
// Tool additions (at end so we can override if required)
response.render(StringHeaderItem.forString("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"));
// render jQuery and the Wicket event library
// Both must be priority so they are emitted into the head
final String cdnQuery = PortalUtils.getCDNQuery();
response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forUrl(String.format(PortalUtils.getLatestJQueryPath()+ "?version=%s", cdnQuery))));
response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forUrl(String.format("/my-calendar/scripts/wicket/wicket-event-jquery.min.js?version=%s", cdnQuery))));
// NOTE: All libraries apart from jQuery and Wicket Event must be rendered inline with the application. See WidgetPage.html.
}
示例12: renderHead
import org.apache.wicket.markup.head.JavaScriptHeaderItem; //导入依赖的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));
}
示例13: renderHead
import org.apache.wicket.markup.head.JavaScriptHeaderItem; //导入依赖的package包/类
@Override
public void renderHead(final IHeaderResponse response) {
super.renderHead(response);
// get the Sakai skin header fragment from the request attribute
final HttpServletRequest request = (HttpServletRequest) getRequest().getContainerRequest();
response.render(StringHeaderItem.forString((String) request.getAttribute("sakai.html.head")));
response.render(OnLoadHeaderItem.forScript("setMainFrameHeight( window.name )"));
// Tool additions (at end so we can override if required)
response.render(StringHeaderItem.forString("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"));
// render jQuery and the Wicket event library
// Both must be priority so they are emitted into the head
final String cdnQuery = PortalUtils.getCDNQuery();
response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forUrl(String.format(PortalUtils.getLatestJQueryPath()+ "?version=%s", cdnQuery))));
response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forUrl(String.format("/my-calendar/scripts/wicket/wicket-event-jquery.min.js?version=%s", cdnQuery))));
// NOTE: All libraries apart from jQuery and Wicket Event must be rendered inline with the application. See WidgetPage.html.
}
示例14: renderHead
import org.apache.wicket.markup.head.JavaScriptHeaderItem; //导入依赖的package包/类
@Override
public void renderHead(IHeaderResponse response) {
super.renderHead(response);
String script = "Wicket.Event.subscribe(\"/websocket/message\", function(jqEvent, message) {\n"
+ " message = JSON.parse(message);\n"
+ " if (message.type == 'step') updateStep(message); else { Karate.Ajax.DebugWindow.logInfo(message.text); }\n"
+ "});\n"
+ "function updateStep(message){ var btn = jQuery('#' + message.buttonId); btn.addClass('btn-success'); }";
response.render(JavaScriptHeaderItem.forScript(script, "karate-ws-js"));
response.render(JavaScriptHeaderItem.forReference(KarateJsResourceReference.INSTANCE));
}
示例15: renderHead
import org.apache.wicket.markup.head.JavaScriptHeaderItem; //导入依赖的package包/类
@Override
public void renderHead(Component component, IHeaderResponse response) {
super.renderHead(component, response);
response.render(JavaScriptHeaderItem.forReference(new DropdownHoverResourceReference()));
String script = String.format("gitplex.server.dropdownhover.init('%s', %s, %s);",
getComponent().getMarkupId(true), hoverDelay, getCallbackFunction());
response.render(OnDomReadyHeaderItem.forScript(script));
}