org.apache.wicket.markup.head.OnLoadHeaderItem Java Examples

The following examples show how to use org.apache.wicket.markup.head.OnLoadHeaderItem. 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: WidgetPage.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
@Override
public void renderHead(final IHeaderResponse response) {

    super.renderHead(response);

    final String version = this.serverConfigurationService.getString("portal.cdn.version", "");

    // 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
    response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forUrl(String.format("/library/webjars/jquery/1.12.4/jquery.min.js?version=%s", version))));
    response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forUrl(String.format("/site-description/scripts/wicket/wicket-event-jquery.min.js?version=%s", version))));

    // NOTE: All libraries apart from jQuery and Wicket Event must be rendered inline with the application. See WidgetPage.html.
}
 
Example #2
Source File: Select2Choice.java    From onedev with MIT License 6 votes vote down vote up
@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 #3
Source File: AbstractSelect2Choice.java    From onedev with MIT License 6 votes vote down vote up
@Override
public void renderHead(IHeaderResponse response) {
	super.renderHead(response);

	// initialize select2
	response.render(JavaScriptHeaderItem.forReference(new Select2ResourceReference()));

	// Use OnLoad instead of OnDomReady here as otherwise the placeholder 
	// of multi-choice can not be displayed in a modal dialog
	response.render(OnLoadHeaderItem.forScript(JQuery.execute("$('#%s').select2(%s);", 
			getJquerySafeMarkupId(), settings.toJson())));

	// select current value

	renderInitializationScript(response);
}
 
Example #4
Source File: WidgetPage.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
@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.
}
 
Example #5
Source File: CodePropertyEditor.java    From onedev with MIT License 6 votes vote down vote up
@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 vote down vote up
@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: WidgetPage.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
@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.
}
 
Example #8
Source File: BasePage.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
/**
 * This block adds the required wrapper markup to style it like a Sakai tool. 
 * Add to this any additional CSS or JS references that you need.
 * 
 */
public void renderHead(IHeaderResponse response) {
	
	
	//get Sakai skin
	String skinRepo = sakaiProxy.getSkinRepoProperty();
	String toolCSS = sakaiProxy.getToolSkinCSS(skinRepo);
	String toolBaseCSS = skinRepo + "/tool_base.css";
	
	//Sakai additions				
	response.render(JavaScriptReferenceHeaderItem.forUrl("/library/js/headscripts.js"));
	response.render(CssReferenceHeaderItem.forUrl(toolBaseCSS));
	response.render(CssReferenceHeaderItem.forUrl(toolCSS));
	response.render (OnLoadHeaderItem.forScript("setMainFrameHeight( window.name )"));
	response.render(StringHeaderItem.forString("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"));					
	
}
 
Example #9
Source File: BasePage.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
@Override
public void renderHead(final IHeaderResponse response) {

	// get the Sakai skin header fragment from the request attribute
	final HttpServletRequest request = (HttpServletRequest) getRequest().getContainerRequest();

	final String sakaiHtmlHead = (String) request.getAttribute("sakai.html.head");
	if (StringUtils.isNotBlank(sakaiHtmlHead)) {
		response.render(StringHeaderItem.forString((String) request.getAttribute("sakai.html.head")));
	}
	response.render(OnLoadHeaderItem.forScript("setMainFrameHeight( window.name )"));

	String version = PortalUtils.getCDNQuery();

	// 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\" />"));
	response.render(CssHeaderItem.forUrl(String.format("/profile2-tool/css/profile2.css%s", version)));
	response.render(JavaScriptHeaderItem.forUrl(String.format("/profile2-tool/javascript/profile2.js%s", version)));

}
 
Example #10
Source File: WidgetPage.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
@Override
public void renderHead(final IHeaderResponse response) {
    super.renderHead(response);

    final String version = this.serverConfigurationService.getString("portal.cdn.version", "");

    // 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
    response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forUrl(String.format("/library/webjars/jquery/1.12.4/jquery.min.js?version=%s", version))));
    response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forUrl(String.format("/mycalendar/scripts/wicket/wicket-event-jquery.min.js?version=%s", version))));

    // additional styles (datepicker, this widget etc)
    response.render(CssHeaderItem.forUrl(String.format("/library/webjars/jquery-ui/1.12.1/jquery-ui.min.css?version=%s", version)));

    // NOTE: All libraries apart from jQuery and Wicket Event must be rendered inline with the application. See WidgetPage.html.

}
 
Example #11
Source File: BaseChart.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
@Override
public void renderHead(final IHeaderResponse response) {

	final String version = PortalUtils.getCDNQuery();

	// chart requires ChartJS
	response.render(
			JavaScriptHeaderItem.forUrl(String.format("/gradebookng-tool/webjars/chartjs/2.7.0/Chart.min.js%s", version)));

	// our chart functions
	response.render(
			JavaScriptHeaderItem.forUrl(String.format("/gradebookng-tool/scripts/gradebook-chart.js%s", version)));

	// render immediately (for all subclasses)
	final GbChartData data = getData();
	response.render(OnLoadHeaderItem.forScript("renderChart('" + toJson(data) + "');"));
}
 
Example #12
Source File: BaseChart.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
@Override
public void renderHead(final IHeaderResponse response) {

	final String version = PortalUtils.getCDNQuery();

	// chart requires ChartJS
	response.render(
			JavaScriptHeaderItem.forUrl(String.format("/gradebookng-tool/webjars/chartjs/2.7.0/Chart.min.js%s", version)));

	// our chart functions
	response.render(
			JavaScriptHeaderItem.forUrl(String.format("/gradebookng-tool/scripts/gradebook-chart.js%s", version)));

	// render immediately (for all subclasses)
	final GbChartData data = getData();
	response.render(OnLoadHeaderItem.forScript("renderChart('" + toJson(data) + "');"));
}
 
Example #13
Source File: WidgetPage.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
@Override
public void renderHead(final IHeaderResponse response) {
    super.renderHead(response);

    final String version = this.serverConfigurationService.getString("portal.cdn.version", "");

    // 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
    response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forUrl(String.format("/library/webjars/jquery/1.12.4/jquery.min.js?version=%s", version))));
    response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forUrl(String.format("/mycalendar/scripts/wicket/wicket-event-jquery.min.js?version=%s", version))));

    // additional styles (datepicker, this widget etc)
    response.render(CssHeaderItem.forUrl(String.format("/library/webjars/jquery-ui/1.12.1/jquery-ui.min.css?version=%s", version)));

    // NOTE: All libraries apart from jQuery and Wicket Event must be rendered inline with the application. See WidgetPage.html.

}
 
Example #14
Source File: ImplementationModalPanel.java    From syncope with Apache License 2.0 6 votes vote down vote up
@Override
public void renderHead(final IHeaderResponse response) {
    super.renderHead(response);
    if (viewMode != ViewMode.JAVA_CLASS) {
        response.render(OnLoadHeaderItem.forScript(
                "editor = CodeMirror.fromTextArea("
                + "document.getElementById('groovyClassForm').children['groovyClass'], {"
                + "  readOnly: false, "
                + "  lineNumbers: true, "
                + "  lineWrapping: true, "
                + "  matchBrackets: true,"
                + "  autoCloseBrackets: true,"
                + (viewMode == ViewMode.GROOVY_BODY ? "  mode: 'text/x-groovy'," : "")
                + "  autoRefresh: true"
                + "});"
                + "editor.on('change', updateTextArea);"));
    }
}
 
Example #15
Source File: WidgetPage.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
@Override
public void renderHead(final IHeaderResponse response) {

    super.renderHead(response);

    final String version = this.serverConfigurationService.getString("portal.cdn.version", "");

    // 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
    response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forUrl(String.format("/library/webjars/jquery/1.12.4/jquery.min.js?version=%s", version))));
    response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forUrl(String.format("/site-description/scripts/wicket/wicket-event-jquery.min.js?version=%s", version))));

    // NOTE: All libraries apart from jQuery and Wicket Event must be rendered inline with the application. See WidgetPage.html.
}
 
Example #16
Source File: BasePage.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
@Override
public void renderHead(final IHeaderResponse response) {

	// get the Sakai skin header fragment from the request attribute
	final HttpServletRequest request = (HttpServletRequest) getRequest().getContainerRequest();

	final String sakaiHtmlHead = (String) request.getAttribute("sakai.html.head");
	if (StringUtils.isNotBlank(sakaiHtmlHead)) {
		response.render(StringHeaderItem.forString((String) request.getAttribute("sakai.html.head")));
	}
	response.render(OnLoadHeaderItem.forScript("setMainFrameHeight( window.name )"));

	String version = PortalUtils.getCDNQuery();

	// 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\" />"));
	response.render(CssHeaderItem.forUrl(String.format("/profile2-tool/css/profile2.css%s", version)));
	response.render(JavaScriptHeaderItem.forUrl(String.format("/profile2-tool/javascript/profile2.js%s", version)));

}
 
Example #17
Source File: BinaryTextPreviewer.java    From syncope with Apache License 2.0 6 votes vote down vote up
@Override
public void renderHead(final IHeaderResponse response) {
    super.renderHead(response);
    String options;
    switch (mimeType) {
        case MediaType.APPLICATION_JSON:
            options = "matchBrackets: true, autoCloseBrackets: true,";
            break;
        case MediaType.APPLICATION_XML:
            options = "autoCloseTags: true, mode: 'text/html',";
            break;
        default:
            options = "mode: 'text/html',";
    }

    response.render(OnLoadHeaderItem.forScript(
            "var editor = CodeMirror.fromTextArea(document.getElementById('" + jsonEditorInfoId + "'), {"
            + "  readOnly: true, "
            + "  lineNumbers: true, "
            + "  lineWrapping: false, "
            + options
            + "  autoRefresh: true"
            + "});"
            + "editor.setSize('500', 100)"));
}
 
Example #18
Source File: WidgetPage.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
@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.
}
 
Example #19
Source File: WidgetPage.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
@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.
}
 
Example #20
Source File: BasePage.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
/**
 * This block adds the required wrapper markup to style it like a Sakai tool. 
 * Add to this any additional CSS or JS references that you need.
 * 
 */
public void renderHead(IHeaderResponse response) {
	
	
	//get Sakai skin
	String skinRepo = sakaiProxy.getSkinRepoProperty();
	String toolCSS = sakaiProxy.getToolSkinCSS(skinRepo);
	String toolBaseCSS = skinRepo + "/tool_base.css";
	
	//Sakai additions				
	response.render(JavaScriptReferenceHeaderItem.forUrl("/library/js/headscripts.js"));
	response.render(CssReferenceHeaderItem.forUrl(toolBaseCSS));
	response.render(CssReferenceHeaderItem.forUrl(toolCSS));
	response.render (OnLoadHeaderItem.forScript("setMainFrameHeight( window.name )"));
	response.render(StringHeaderItem.forString("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"));					
	
}
 
Example #21
Source File: DisplayHTML5Panel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
@Override
  public void renderHead(IHeaderResponse response) {
response.render(OnLoadHeaderItem.forScript(getResizeEndDefinition()));
response.render(OnLoadHeaderItem.forScript(getResizeJavaScript()));
	
// must call display onLoad instead of onDomReady to appear it in iframe
// $(document).ready in the iframe seems to be fired too soon and the iframe content isn't even loaded yet
response.render(OnLoadHeaderItem.forScript(getDisplayCall()));

//include js file
      response.render(JavaScriptHeaderItem.forReference(NEXT_JS));
      
      //<script> tag
      //response.renderJavaScript(getJavaScript(), null); 
  }
 
Example #22
Source File: ChartRendererPanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
@Override
public void renderHead(Component component, IHeaderResponse response) {			
	super.renderHead(component, response);					
	
	//include js file
       response.render(JavaScriptHeaderItem.forReference(NEXT_JS));
       
       response.render(OnLoadHeaderItem.forScript(getCallbackFunctionBody()));	
}
 
Example #23
Source File: ChartHTML5Panel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
@Override
  public void renderHead(IHeaderResponse response) {
response.render(OnLoadHeaderItem.forScript(getResizeEndDefinition()));
response.render(OnLoadHeaderItem.forScript(getResizeJavaScript()));
	
// must call chart onLoad instead of onDomReady to appear it in iframe
// $(document).ready in the iframe seems to be fired too soon and the iframe content isn't even loaded yet
response.render(OnLoadHeaderItem.forScript(getNextChartJavascriptCall()));

//include js file		
      response.render(JavaScriptHeaderItem.forReference(NEXTCHARTS_JS));
      
      //<script> tag
      //response.renderJavaScript(getJavaScript(), null); 
  }
 
Example #24
Source File: BaseLogin.java    From syncope with Apache License 2.0 5 votes vote down vote up
@Override
public void renderHead(final IHeaderResponse response) {
    super.renderHead(response);
    if (StringUtils.isNotBlank(notificationMessage)) {
        response.render(OnLoadHeaderItem.forScript(StyledNotificationBehavior.jQueryShow(notificationMessage,
                String.format("jQuery('#%s').data('kendoNotification')",
                        notificationPanel.getNotificationMarkupId()), notificationLevel)));
    }
}
 
Example #25
Source File: InfinitePagingDataTableHeadersToolbar.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
@Override
public void renderHead(IHeaderResponse response)
{
	super.renderHead(response);

	response.render(JavaScriptHeaderItem.forUrl(TOOLBAR_JS));
	long sortableCols = getTable().getColumns().stream().filter(IColumn::isSortable).count();
	String attachScript = String.format("RHTB.init('%s', %d);", getTable().getMarkupId(), sortableCols);
	response.render(OnLoadHeaderItem.forScript(attachScript));
}
 
Example #26
Source File: DisplayWidgetView.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
@Override
public void renderHead(Component component, IHeaderResponse response) {			
	super.renderHead(component, response);					
	
	//include js file
       response.render(JavaScriptHeaderItem.forReference(NEXT_JS));
       
       response.render(OnLoadHeaderItem.forScript(getCallbackFunctionBody()));	
}
 
Example #27
Source File: CodeEditorPanel.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
private void initCodeMirror(IHeaderResponse response) {
    Map<String, String> params = newParamsMap();
    Map<String, String> keysMap = newParamsMap();
    configureCustomEditorParams(params);
    configureCustomEditorKeysBinding(keysMap);
    configureEditorParams(params);
    configureEditorKeysBinding(keysMap);
    if (displayModel.getObject() == DisplayMode.EDIT) params.put(EXTRAKEYS, keysMap.toString());
    response.render(OnLoadHeaderItem.forScript(getInitJsCode(params)));
}
 
Example #28
Source File: FocusOnLoadBehavior.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
/**
 * @see org.apache.wicket.behavior.Behavior#renderHead(org.apache.wicket.Component, org.apache.wicket.markup.html.IHeaderResponse)
 */
@Override
public void renderHead(final Component component, final IHeaderResponse response)
{
  super.renderHead(component, response);
  response.render(OnLoadHeaderItem.forScript("document.getElementById('" + component.getMarkupId() + "').focus()"));
}
 
Example #29
Source File: SystemLogPage.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
@Override
public void renderHead(IHeaderResponse response) {
	super.renderHead(response);
	
       IJavaScriptLibrarySettings settings = NextServerApplication.get().getJavaScriptLibrarySettings();
       response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forReference(settings.getJQueryReference())));
	
	response.render(OnLoadHeaderItem.forScript("$(\"#log\").scrollTop($(\"#log\").prop(\"scrollHeight\"));"));
}
 
Example #30
Source File: DisplayImagePanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
@Override
public void renderHead(Component component, IHeaderResponse response) {			
	super.renderHead(component, response);
	
	//include js file
	response.render(JavaScriptHeaderItem.forReference(NEXT_JS));
	
	response.render(OnLoadHeaderItem.forScript(getResizeEndDefinition()));	
	response.render(OnLoadHeaderItem.forScript(getResizeJavaScript()));			
}