org.apache.wicket.markup.head.IHeaderResponse Java Examples
The following examples show how to use
org.apache.wicket.markup.head.IHeaderResponse.
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: 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 #2
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 #3
Source File: DropzoneField.java From onedev with MIT License | 6 votes |
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.render(JavaScriptHeaderItem.forReference(new DropzoneFieldResourceReference())); String script = String.format( "onedev.server.dropzone.onDomReady('%s', '%s', %s, %s, %s, %d);", getMarkupId(), uploadBehavior.getCallbackUrl(), deleteBehavior.getCallbackFunction(CallbackParameter.explicit("name")), acceptedFiles!=null?"'" + acceptedFiles + "'":"null", maxFiles!=0?maxFiles:"null", maxFilesize); response.render(OnDomReadyHeaderItem.forScript(script)); }
Example #4
Source File: SourceLinesPage.java From onedev with MIT License | 6 votes |
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); Map<Day, Map<String, Integer>> lineIncrements = OneDev.getInstance(CommitInfoManager.class).getLineIncrements(getProject()); Map<Integer, Map<String, Integer>> data = new HashMap<>(); for (Map.Entry<Day, Map<String, Integer>> entry: lineIncrements.entrySet()) data.put(entry.getKey().getValue(), entry.getValue()); try { ObjectMapper mapper = OneDev.getInstance(ObjectMapper.class); String jsonOfData = mapper.writeValueAsString(data); String jsonOfDefaultBranch = mapper.writeValueAsString(getProject().getDefaultBranch()); String script = String.format("onedev.server.stats.sourceLines.onDomReady(%s, %s);", jsonOfData, jsonOfDefaultBranch); response.render(OnDomReadyHeaderItem.forScript(script)); } catch (JsonProcessingException e) { throw new RuntimeException(e); } }
Example #5
Source File: CodePropertyEditor.java From onedev with MIT License | 6 votes |
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.render(JavaScriptHeaderItem.forReference(new CodeSupportResourceReference())); CallbackParameter matchWith = CallbackParameter.explicit("matchWith"); CallbackParameter line = CallbackParameter.explicit("line"); CallbackParameter start = CallbackParameter.explicit("start"); CallbackParameter end = CallbackParameter.explicit("end"); String script = String.format( "onedev.server.codeSupport.onEditorDomReady('%s', '%s', %s);", input.getMarkupId(), getCode().language(), behavior.getCallbackFunction(matchWith, line, start, end)); response.render(OnLoadHeaderItem.forScript(script)); }
Example #6
Source File: InfiniteScrollBehavior.java From onedev with MIT License | 6 votes |
@Override public void renderHead(Component component, IHeaderResponse response) { super.renderHead(component, response); response.render(JavaScriptReferenceHeaderItem.forReference(new InfiniteScrollResourceReference())); String itemSelector; if (getItemSelector() != null) itemSelector = "'"+JavaScriptEscape.escapeJavaScript(getItemSelector())+"'"; else itemSelector = "undefined"; // Run onload script as the container size might be adjusted in window resize event (which // happens before onload). An example is the issue board columns String script = String.format("onedev.server.infiniteScroll.onLoad('%s', %s, %s, %s);", component.getMarkupId(true), getCallbackFunction(explicit("offset"), explicit("count")), pageSize, itemSelector); response.render(OnLoadHeaderItem.forScript(script)); }
Example #7
Source File: Select2Choice.java From onedev with MIT License | 6 votes |
@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(OnLoadHeaderItem.forScript( JQuery.execute("$('#%s').select2('data', %s);", getJquerySafeMarkupId(), selection.toJson()))); } else { clearInput(); } }
Example #8
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 #9
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 #10
Source File: PropertyFeatureEditor.java From inception with Apache License 2.0 | 5 votes |
@Override public void renderHead(IHeaderResponse aResponse) { super.renderHead(aResponse); aResponse.render(forReference(KendoChoiceDescriptionScriptReference.get())); }
Example #11
Source File: ConceptFeatureEditor.java From inception with Apache License 2.0 | 5 votes |
@Override public void renderHead(IHeaderResponse aResponse) { super.renderHead(aResponse); aResponse.render(forReference(KendoChoiceDescriptionScriptReference.get())); }
Example #12
Source File: TutorialFooterPanel.java From inception with Apache License 2.0 | 5 votes |
@Override public void renderHead(IHeaderResponse aResponse) { aResponse.render(JavaScriptHeaderItem.forReference(WebAnnoJavascriptReference.get())); //TODO move it back to web jars after latest release aResponse.render(JavaScriptHeaderItem.forReference(EnjoyHintJsReference.get())); // aResponse.render(JavaScriptHeaderItem // .forReference(new WebjarsJavaScriptResourceReference("enjoyhint/current/enjoyhint.js"))); // Loading resources for the tour guide feature for the new users aResponse.render(JavaScriptHeaderItem.forReference( new WebjarsJavaScriptResourceReference("enjoyhint/current/jquery.enjoyhint.js"))); aResponse.render(CssHeaderItem.forReference( new WebjarsCssResourceReference("enjoyhint/current/jquery.enjoyhint.css"))); aResponse.render(JavaScriptHeaderItem.forReference(new WebjarsJavaScriptResourceReference( "jquery.scrollTo/current/jquery.scrollTo.js"))); aResponse.render(JavaScriptHeaderItem.forReference( new WebjarsJavaScriptResourceReference("kinetic/current/kinetic.min.js"))); aResponse.render(JavaScriptHeaderItem.forReference(TutorialJavascriptReference.get())); // add top-margin to next button to fix label and buttons overlapping aResponse.render(CssHeaderItem.forCSS( ".enjoyhint_next_btn{\n" + " margin-top: 8px;\n" + "}", "enjoyhint")); // check if the tutorial will need to be run aResponse.render(OnLoadHeaderItem .forScript("setContextPath('" + context.getContextPath() + "');\n" + "runRoutines();")); }
Example #13
Source File: TestPage.java From onedev with MIT License | 5 votes |
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.render(JavaScriptHeaderItem.forReference(new TestResourceReference())); response.render(JavaScriptHeaderItem.forReference(new ScrollIntoViewResourceReference())); response.render(OnDomReadyHeaderItem.forScript("onedev.server.test.onDomReady();")); }
Example #14
Source File: CodePropertyViewer.java From onedev with MIT License | 5 votes |
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.render(JavaScriptHeaderItem.forReference(new CodeSupportResourceReference())); String script = String.format("onedev.server.codeSupport.onViewerDomReady('%s', '%s');", input.getMarkupId(), language); response.render(OnLoadHeaderItem.forScript(script)); }
Example #15
Source File: FieldListEditPanel.java From onedev with MIT License | 5 votes |
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.render(CssHeaderItem.forReference(new FieldListCssResourceReference())); validate(); if (!getModelObject().equals(getConvertedInput())) { String script = String.format("onedev.server.form.markDirty($('#%s').closest('form'));", getMarkupId()); response.render(OnDomReadyHeaderItem.forScript(script)); } }
Example #16
Source File: ProjectBlobPage.java From onedev with MIT License | 5 votes |
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.render(JavaScriptHeaderItem.forReference(new ProjectBlobResourceReference())); String callback = ajaxBehavior.getCallbackFunction(explicit("action")).toString(); String script = String.format("onedev.server.projectBlob.onDomReady(%s);", callback); response.render(OnDomReadyHeaderItem.forScript(script)); }
Example #17
Source File: ImageDiffPanel.java From onedev with MIT License | 5 votes |
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.render(JavaScriptHeaderItem.forReference(new ImageDiffResourceReference())); String script = String.format("onedev.server.imageDiff.onDomReady('%s');", getMarkupId()); response.render(OnDomReadyHeaderItem.forScript(script)); }
Example #18
Source File: InputAssistBehavior.java From onedev with MIT License | 5 votes |
@Override public void renderHead(Component component, IHeaderResponse response) { super.renderHead(component, response); response.render(JavaScriptHeaderItem.forReference(new InputAssistResourceReference())); String script = String.format("onedev.server.inputassist.onDomReady('%s', %s);", getComponent().getMarkupId(true), getCallbackFunction(explicit("type"), explicit("input"), explicit("caret"))); response.render(OnDomReadyHeaderItem.forScript(script)); }
Example #19
Source File: OnTypingDoneBehavior.java From onedev with MIT License | 5 votes |
@Override public void renderHead(Component component, IHeaderResponse response) { super.renderHead(component, response); response.render(JavaScriptHeaderItem.forReference(new DoneEventsResourceReference())); String script = String.format("" + "var $input = $('#%s');" + "$input.doneEvents('input', function() {" + " $(this).trigger('donetyping');" + "}, %s);", component.getMarkupId(true), timeout); response.render(OnDomReadyHeaderItem.forScript(script)); }
Example #20
Source File: BlobViewPanel.java From onedev with MIT License | 5 votes |
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.render(JavaScriptHeaderItem.forReference(new BlobViewResourceReference())); response.render(OnDomReadyHeaderItem.forScript(String.format("onedev.server.blobView.onDomReady('%s');", getMarkupId()))); }
Example #21
Source File: MarkdownEditor.java From onedev with MIT License | 5 votes |
@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("onedev.server.markdown.onDomReady('%s', %s, %d, %s, %d, %b, %b, '%s', %s);", container.getMarkupId(), callback, ATWHO_LIMIT, encodedAttachmentSupport, getAttachmentSupport()!=null?getAttachmentSupport().getAttachmentMaxSize():0, getUserMentionSupport() != null, getReferenceSupport() != null, JavaScriptEscape.escapeJavaScript(ProjectNameValidator.PATTERN.pattern()), autosaveKey); response.render(OnDomReadyHeaderItem.forScript(script)); script = String.format("onedev.server.markdown.onWindowLoad('%s');", container.getMarkupId()); response.render(OnLoadHeaderItem.forScript(script)); }
Example #22
Source File: SourceFormComponent.java From onedev with MIT License | 5 votes |
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); String autosaveKey = JavaScriptEscape.escapeJavaScript(getContext().getAutosaveKey()); PlanarRange mark = SourceRendererProvider.getRange(getContext().getPosition()); String jsonOfMark; if (mark != null) { try { jsonOfMark = OneDev.getInstance(ObjectMapper.class).writeValueAsString(mark); } catch (JsonProcessingException e) { throw new RuntimeException(e); } } else { jsonOfMark = "undefined"; } String script = String.format("onedev.server.sourceEdit.onDomReady(" + "'%s', '%s', %s, '%s', %s, '%s', %b, '%s');", getMarkupId(), JavaScriptEscape.escapeJavaScript(getContext().getNewPath()), jsonOfMark, getSourceFormat().getIndentType(), getSourceFormat().getTabSize(), getSourceFormat().getLineWrapMode(), getContext().getMode() == Mode.EDIT || getContext().getInitialNewPath() != null, autosaveKey); response.render(OnDomReadyHeaderItem.forScript(script)); }
Example #23
Source File: ColorPicker.java From onedev with MIT License | 5 votes |
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.render(JavaScriptHeaderItem.forReference(new ColorPickerResourceReference())); String script = String.format("onedev.server.colorPicker.onDomReady('%s', %b);", getMarkupId(true), allowEmpty); response.render(OnDomReadyHeaderItem.forScript(script)); }
Example #24
Source File: UserSingleChoice.java From onedev with MIT License | 4 votes |
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.render(JavaScriptHeaderItem.forReference(new UserChoiceResourceReference())); }
Example #25
Source File: ProjectSelector.java From onedev with MIT License | 4 votes |
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.render(JavaScriptHeaderItem.forReference(new ProjectSelectorResourceReference())); }
Example #26
Source File: ProjectListPanel.java From onedev with MIT License | 4 votes |
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.render(CssHeaderItem.forReference(new ProjectListResourceReference())); }
Example #27
Source File: ReferencedFromIssuePanel.java From onedev with MIT License | 4 votes |
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.render(CssHeaderItem.forReference(new TitleAndStatusCssResourceReference())); }
Example #28
Source File: NoNameEditPanel.java From onedev with MIT License | 4 votes |
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.render(CssHeaderItem.forReference(new NoNameCssResourceReference())); }
Example #29
Source File: CodeCommentListPanel.java From onedev with MIT License | 4 votes |
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.render(CssHeaderItem.forReference(new CodeCommentCssResourceReference())); }
Example #30
Source File: NewGroupPage.java From onedev with MIT License | 4 votes |
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.render(CssHeaderItem.forReference(new GroupCssResourceReference())); }