org.apache.wicket.markup.head.OnDomReadyHeaderItem Java Examples
The following examples show how to use
org.apache.wicket.markup.head.OnDomReadyHeaderItem.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AjaxLazyLoadImage.java From sakai with Educational Community License v2.0 | 6 votes |
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); StringBuilder script = new StringBuilder("var fullscreenWidth = 0;") .append(" var fullscreenHeight = 0;") .append(" var obj = document.body;") .append(" if (document.all) {") // IE .append(" fullscreenHeight = obj.scrollHeight;") .append(" fullscreenWidth = obj.scrollWidth;") .append(" } else {") // Other browsers .append(" fullscreenHeight = obj.clientHeight;") .append(" fullscreenWidth = obj.clientWidth;") .append(" }") .append(" jQuery('.maxWidth').val(fullscreenWidth);") .append(" jQuery('.maxHeight').val(fullscreenHeight);"); OnDomReadyHeaderItem onDomReady = OnDomReadyHeaderItem.forScript(script); response.render(onDomReady); }
Example #2
Source File: BuildSpecEditPanel.java From onedev with MIT License | 6 votes |
private Component newJobContent(Job job) { BeanEditor content = new JobEditor(jobContents.newChildId(), job); content.add(new Behavior() { @Override public void renderHead(Component component, IHeaderResponse response) { super.renderHead(component, response); int index = WicketUtils.getChildIndex(jobContents, content); String script = String.format("onedev.server.buildSpec.trackJobNameChange(%d);", index); response.render(OnDomReadyHeaderItem.forScript(script)); } }); jobContents.add(content.setOutputMarkupId(true)); return content; }
Example #3
Source File: InfiniteScrollListView.java From pm-wicket-utils with GNU Lesser General Public License v3.0 | 6 votes |
private Behavior getScrollBehaviour(){ return new AttributeModifier("scroll", 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()+"')"; } }; }
Example #4
Source File: FileSelectorPanel.java From sakai with Educational Community License v2.0 | 6 votes |
@Override public void renderHead(HtmlHeaderContainer container) { container.getHeaderResponse().render(JavaScriptHeaderItem.forUrl(BasePage.JQUERYSCRIPT)); super.renderHead(container); // needs to be rendered after jQuery but before the page specifc scripts 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())); }
Example #5
Source File: MainPage.java From openmeetings with Apache License 2.0 | 6 votes |
private AbstractDefaultAjaxBehavior newDelayedLoad() { return new AbstractDefaultAjaxBehavior() { private static final long serialVersionUID = 1L; @Override protected void respond(AjaxRequestTarget target) { log.debug("MainPage::delayedLoad"); main = new MainPanel(MAIN_PANEL_ID); target.add(mainContainer.replace(main).add(newAreaBehavior())); } @Override public void renderHead(Component component, IHeaderResponse response) { if (!inited) { log.debug("renderHead:: newDelayedLoad"); inited = true; super.renderHead(component, response); response.render(OnDomReadyHeaderItem.forScript(getCallbackScript())); } } }; }
Example #6
Source File: MarkdownViewer.java From onedev with MIT License | 6 votes |
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.render(JavaScriptHeaderItem.forReference(new LozadResourceReference())); response.render(JavaScriptHeaderItem.forReference(new MarkdownResourceReference())); CharSequence taskCallback = taskBehavior.getCallbackFunction( explicit(SourcePositionTrackExtension.DATA_START_ATTRIBUTE), explicit(TASK_CHECKED)); CharSequence referenceCallback = referenceBehavior.getCallbackFunction( explicit(REFERENCE_TYPE), explicit(REFERENCE_ID)); String script = String.format("onedev.server.markdown.onViewerDomReady('%s', %s, '%s', %s);", getMarkupId(), contentVersionSupport!=null?taskCallback:"undefined", SourcePositionTrackExtension.DATA_START_ATTRIBUTE, referenceCallback); response.render(OnDomReadyHeaderItem.forScript(script)); }
Example #7
Source File: DrawerManager.java From pm-wicket-utils with GNU Lesser General Public License v3.0 | 6 votes |
@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');")); } } }
Example #8
Source File: BootstrapFeedbackPopover.java From pm-wicket-utils with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); List<FeedbackMessage> msgs = model.getObject(); if(msgs.size()>0){ for(Component component: messages.keySet()){ StringBuffer sb = new StringBuffer(); for(FeedbackMessage msg : messages.get(component)){ sb.append(msg.getMessage()+"\n"); msg.markRendered(); } String script = "$(\"#"+component.getMarkupId()+"\")" + ".popover({ 'trigger': 'focus', " + "'placement': 'top', " + "'content': \""+StringEscapeUtils.escapeEcmaScript(sb.toString())+"\", " + "'template': '<div class=\"popover feedback-popover\"><div class=\"arrow\"></div><div class=\"popover-inner\"><h3 class=\"popover-title\"></h3><div class=\"popover-content\"><p></p></div></div></div>'" + "});"; script += "$(\"#"+component.getMarkupId()+"\").keypress(function(){ $(\"#"+this.getMarkupId()+"\").removeClass('has-error'); $(this).popover('destroy'); });"; response.render(OnDomReadyHeaderItem.forScript(script)); } } }
Example #9
Source File: HtmlAnnotationEditor.java From inception with Apache License 2.0 | 6 votes |
private static void initAnnotatorJs(IHeaderResponse aResponse, WebComponent aContainer, StoreAdapter aAdapter) { String callbackUrl = aAdapter.getCallbackUrl().toString(); StringBuilder script = new StringBuilder(); script.append( "var ann = $('#" + aContainer.getMarkupId() + "').annotator({readOnly: true});"); script.append("ann.annotator('addPlugin', 'Store', {"); script.append(" prefix: null,"); script.append(" emulateJSON: true,"); script.append(" emulateHTTP: true,"); script.append(" urls: {"); script.append(" read: '" + callbackUrl + "',"); script.append(" create: '" + callbackUrl + "',"); script.append(" update: '" + callbackUrl + "',"); script.append(" destroy: '" + callbackUrl + "',"); script.append(" search: '" + callbackUrl + "'"); script.append(" }"); script.append("});"); // script.append("Wicket.$('" + vis.getMarkupId() + "').annotator = ann;"); aResponse.render(OnDomReadyHeaderItem.forScript(script.toString())); }
Example #10
Source File: SlidebarBehavior.java From nextreports-server with Apache License 2.0 | 6 votes |
@Override public void renderHead(Component component, IHeaderResponse response) { super.renderHead(component, response); response.render(CssHeaderItem.forReference(new PackageResourceReference(SlidebarBehavior.class, "slidebars.css"))); response.render(CssHeaderItem.forUrl("css/slidebar.css")); response.render(JavaScriptHeaderItem.forReference(new PackageResourceReference(SlidebarBehavior.class, "slidebars.js"))); Map<String, String> vars = new HashMap<String, String>(); // vars.put("siteClose", "true"); PackageTextTemplate template = new PackageTextTemplate(SlidebarBehavior.class, "slidebar-behavior.template.js"); // template.interpolate(vars); response.render(OnDomReadyHeaderItem.forScript(template.getString())); }
Example #11
Source File: AbstractHtmlJsPaneWidget.java From Orienteer with Apache License 2.0 | 6 votes |
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); ODocument doc = getWidgetDocument(); Collection<String> resources = doc.field("resources"); if(resources!=null) { for(String resource : resources) { String lowercase = resource.toLowerCase(); if(lowercase.endsWith(".css")) { response.render(CssHeaderItem.forUrl(resource)); } else if(lowercase.endsWith(".js")) { response.render(JavaScriptHeaderItem.forUrl(resource)); } } } String script = doc.field("script"); if(!Strings.isEmpty(script)) { response.render(OnDomReadyHeaderItem.forScript(interpolateScript(script))); } }
Example #12
Source File: AjaxLazyLoadImage.java From sakai with Educational Community License v2.0 | 6 votes |
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); StringBuilder script = new StringBuilder("var fullscreenWidth = 0;") .append(" var fullscreenHeight = 0;") .append(" var obj = document.body;") .append(" if (document.all) {") // IE .append(" fullscreenHeight = obj.scrollHeight;") .append(" fullscreenWidth = obj.scrollWidth;") .append(" } else {") // Other browsers .append(" fullscreenHeight = obj.clientHeight;") .append(" fullscreenWidth = obj.clientWidth;") .append(" }") .append(" jQuery('.maxWidth').val(fullscreenWidth);") .append(" jQuery('.maxHeight').val(fullscreenHeight);"); OnDomReadyHeaderItem onDomReady = OnDomReadyHeaderItem.forScript(script); response.render(onDomReady); }
Example #13
Source File: ReportsEditPage.java From sakai with Educational Community License v2.0 | 6 votes |
@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();"); response.render(OnDomReadyHeaderItem.forScript(onDomReady.toString())); }
Example #14
Source File: ReportsEditPage.java From sakai with Educational Community License v2.0 | 6 votes |
@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();"); response.render(OnDomReadyHeaderItem.forScript(onDomReady.toString())); }
Example #15
Source File: ToggleBox.java From webanno with Apache License 2.0 | 5 votes |
@Override public void renderHead(IHeaderResponse aResponse) { super.renderHead(aResponse); aResponse.render(CssHeaderItem.forCSS( ".checkboxx-toggle-button .cbx-md { width: 10em; }", "ToggleBox")); aResponse.render(OnDomReadyHeaderItem.forScript(coloringScript())); }
Example #16
Source File: UploadableImagePanel.java From openmeetings with Apache License 2.0 | 5 votes |
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); if (delayed) { response.render(OnDomReadyHeaderItem.forScript("$('#" + form.getOutputMarkupId() + " .remove').click(function() {$(this).parent().find('.fileinput').fileinput('clear');})")); } }
Example #17
Source File: OmWebSocketPanel.java From openmeetings with Apache License 2.0 | 5 votes |
@Override protected void onInitialize() { super.onInitialize(); add(newWsBehavior(), new AbstractDefaultAjaxBehavior() { private static final long serialVersionUID = 1L; @Override public void renderHead(Component component, IHeaderResponse response) { if (!pingable) { log.debug("pingTimer is attached"); pingable = true; super.renderHead(component, response); response.render(OnDomReadyHeaderItem.forScript(getJs())); } } private CharSequence getJs() { return "OmUtil.ping(function(){" + getCallbackScript() + "});"; } @Override protected void respond(AjaxRequestTarget target) { log.debug("Sending WebSocket PING"); target.appendJavaScript(getJs()); WebSocketHelper.sendClient(getWsClient(), new byte[]{getUserId() == null ? 0 : getUserId().byteValue()}); } }); }
Example #18
Source File: FullCalendar.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
@Override public void renderHead(final IHeaderResponse response) { super.renderHead(response); String configuration = "$(\"#" + getMarkupId() + "\").fullCalendarExt("; configuration += Json.toJson(config); configuration += ");"; response.render(OnDomReadyHeaderItem.forScript(configuration)); }
Example #19
Source File: ChatPanel.java From openmeetings with Apache License 2.0 | 5 votes |
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); if (!chat.isShowDashboardChat()) { response.render(OnDomReadyHeaderItem.forScript("$('#chatPanel').hide();")); } }
Example #20
Source File: JQueryDashboardAjaxBehavior.java From Orienteer with Apache License 2.0 | 5 votes |
@Override public void renderHead(Component component, IHeaderResponse response) { super.renderHead(component, response); DashboardPanel<?> dashboard = (DashboardPanel<?>)component; response.render(CssHeaderItem.forReference(JQueryDashboardSupport.WIDGET_CSS)); response.render(JavaScriptHeaderItem.forReference(JQueryDashboardSupport.JQUERY_UI_JS)); Map<String, Object> variables = new HashMap<String, Object>(); variables.put("componentId", dashboard.getMarkupId()); variables.put("callBackScript", getCallbackScript()); variables.put("disabled", !DisplayMode.EDIT.equals(dashboard.getModeObject())); TextTemplate template = new PackageTextTemplate(JQueryDashboardAjaxBehavior.class, "widget.tmpl.js"); String script = template.asString(variables); response.render(OnDomReadyHeaderItem.forScript(script)); }
Example #21
Source File: ModeUrlResourceReference.java From onedev with MIT License | 5 votes |
@Override public List<HeaderItem> getDependencies() { List<HeaderItem> dependencies = super.getDependencies(); WebjarsJavaScriptResourceReference metaReference = new WebjarsJavaScriptResourceReference("codemirror/current/mode/meta.js"); String modeBase = StringUtils.substringBeforeLast(RequestCycle.get().urlFor(metaReference, new PageParameters()).toString(), "/"); dependencies.add(OnDomReadyHeaderItem.forScript("CodeMirror.modeURL = '" + modeBase + "/%N/%N.js';")); return dependencies; }
Example #22
Source File: BoardCardPanel.java From onedev with MIT License | 5 votes |
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); CharSequence callback = ajaxBehavior.getCallbackFunction(CallbackParameter.explicit("issue")); String script = String.format("onedev.server.issueBoards.onCardDomReady('%s', %s);", getMarkupId(), SecurityUtils.getUser()!=null?callback:"undefined"); response.render(OnDomReadyHeaderItem.forScript(script)); }
Example #23
Source File: UrlParametersReceivingBehavior.java From webanno with Apache License 2.0 | 5 votes |
@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)); }
Example #24
Source File: BasePage.java From openmeetings with Apache License 2.0 | 5 votes |
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("css/theme.css")); 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)); } response.render(CssHeaderItem.forReference(FontAwesome5CssReference.instance())); response.render(new FilteredHeaderItem(CssHeaderItem.forUrl("css/custom.css"), CUSTOM_CSS_FILTER)); }
Example #25
Source File: AbstractUnsecureBasePage.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
private void initializeContextMenu(final IHeaderResponse response) { // context menu final Map<String, String> i18nKeyMap = new HashMap<String, String>(); i18nKeyMap.put("newTab", getString("contextMenu.newTab")); i18nKeyMap.put("cancel", getString("contextMenu.cancel")); response.render(OnDomReadyHeaderItem.forScript(getJstemplate().asString(i18nKeyMap))); }
Example #26
Source File: BuildSpecEditPanel.java From onedev with MIT License | 5 votes |
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.render(JavaScriptHeaderItem.forReference(new BuildSpecResourceReference())); String selection = BuildSpecRendererProvider.getSelection(context.getPosition()); String script = String.format("onedev.server.buildSpec.onDomReady(%s, undefined, %s);", selection!=null? "'" + JavaScriptEscape.escapeJavaScript(selection) + "'": "undefined", deleteBehavior.getCallbackFunction(CallbackParameter.explicit("index"))); response.render(OnDomReadyHeaderItem.forScript(script)); }
Example #27
Source File: BuildSpecBlobViewPanel.java From onedev with MIT License | 5 votes |
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.render(JavaScriptHeaderItem.forReference(new BuildSpecResourceReference())); String selection = BuildSpecRendererProvider.getSelection(context.getPosition()); String script = String.format("onedev.server.buildSpec.onDomReady(%s, %s);", selection!=null? "'" + JavaScriptEscape.escapeJavaScript(selection) + "'": "undefined", selectBehavior.getCallbackFunction(CallbackParameter.explicit("selection"))); response.render(OnDomReadyHeaderItem.forScript(script)); }
Example #28
Source File: FolderViewPanel.java From onedev with MIT License | 5 votes |
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.render(JavaScriptHeaderItem.forReference(new FolderViewResourceReference())); PageParameters params = LastCommitsResource.paramsOf(context.getProject(), context.getBlobIdent().revision, context.getBlobIdent().path); String lastCommitsUrl = urlFor(new LastCommitsResourceReference(), params).toString(); CharSequence callback = userCardBehavior.getCallbackFunction( CallbackParameter.explicit("name"), CallbackParameter.explicit("emailAddress")); String script = String.format("onedev.server.folderView.onDomReady('%s', '%s', %s)", getMarkupId(), lastCommitsUrl, callback); response.render(OnDomReadyHeaderItem.forScript(script)); }
Example #29
Source File: PlainEditPanel.java From onedev with MIT License | 5 votes |
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.render(JavaScriptHeaderItem.forReference(new PlainEditResourceReference())); String script = String.format("onedev.server.plainEdit.onDomReady('%s', '%s');", getMarkupId(), fileName); response.render(OnDomReadyHeaderItem.forScript(script)); }
Example #30
Source File: BlobEditPanel.java From onedev with MIT License | 5 votes |
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.render(JavaScriptHeaderItem.forReference(new BlobEditResourceReference())); String script = String.format("onedev.server.blobEdit.onDomReady('%s');", getMarkupId()); response.render(OnDomReadyHeaderItem.forScript(script)); }