@Override public void renderHead(IHeaderResponse iHeaderResponse) { super.renderHead(iHeaderResponse); component.getDefaultModel().getObject(); logger.info( "ID = " + component.getId() + " ObJect= " + component.getDefaultModel().getObject()); if (component.getId().equalsIgnoreCase("username")) { String value = (String) component.getDefaultModel().getObject(); if (null == value || value.isEmpty()) { iHeaderResponse.renderOnLoadJavascript( "document.getElementById('" + component.getMarkupId() + "').focus()"); } // } else { // if (component.getId().equalsIgnoreCase("password")) { // String value = (String) component.getDefaultModel().getObject(); // if (null == value || value.isEmpty()) { // iHeaderResponse.renderOnLoadJavascript("document.getElementById('" + // component.getMarkupId() + "').focus()"); // isColored = true; // } // } } else { iHeaderResponse.renderOnLoadJavascript( "document.getElementById('" + component.getMarkupId() + "').focus()"); } }
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.renderCSSReference(CSS_1); response.renderCSSReference(CSS_2); response.renderCSSReference(CSS_PRINT_1, "print"); response.renderCSSReference(CSS_PRINT_2, "print"); }
public void renderHead(final IHeaderResponse response) { // Nav Bar Tool Tips // NOTE: Based on unstable, 2.0 version. If replacing, take note of CSS style changes as well! // response.renderJavascriptReference(new // ResourceReference("js/jquery/jquery.qtip-2.0-rev411.min.js")); response.renderJavascriptReference(new ResourceReference("js/jquery/jquery.qtip-1.0.min.js")); response.renderJavascript( "$(window).ready(function() { navBarToolTips(); });", "Nav Bar Tool Tip Init"); }
@Override public void renderHead(IHeaderResponse response) { response.renderJavaScriptReference(WidgetJavaScriptResourceReference.get()); response.renderJavaScriptReference(MouseJavaScriptResourceReference.get()); response.renderJavaScriptReference(PositionJavaScriptResourceReference.get()); response.renderJavaScriptReference(DialogJavaScriptResourceReference.get()); response.renderJavaScriptReference(DraggableJavaScriptResourceReference.get()); response.renderJavaScriptReference(ResizableJavaScriptResourceReference.get()); }
@Override public void renderHead(Component component, IHeaderResponse response) { response.renderCSSReference( new CssResourceReference(getClass(), "css/multiboxes-selection.css")); response.renderJavaScriptReference(WidgetJavaScriptResourceReference.get()); response.renderJavaScriptReference(CoreEffectJavaScriptResourceReference.get()); response.renderJavaScriptReference( new PackageResourceReference(getClass(), "js/multiboxes.selection.js")); }
@Override public void renderHead(Component c, IHeaderResponse response) { String url = getURL(developmentMode, openLayersVersion); response.renderJavaScriptReference(url); response.renderJavaScriptReference(WicketEventReference.INSTANCE); response.renderJavaScriptReference(WicketAjaxReference.INSTANCE); response.renderJavaScriptReference(WICKET_OMAP_JS); }
@Override public void renderHead(IHeaderResponse response) { response.renderCSSReference( new PackageResourceReference(BaseUserWeavePage.class, "configBase.css")); response.renderJavaScriptReference(JQuery.getLatest()); response.renderJavaScriptReference( new JavaScriptResourceReference(BaseUserWeavePage.class, "hover.js")); }
public void initialize(IHeaderResponse response) { // Register all javascript for (int i = 0; i < this.javascriptResources.size(); i++) { response.renderJavascriptReference(this.javascriptResources.get(i)); } // Register all css resources for (int i = 0; i < this.cssResources.size(); i++) { response.renderCSSReference(this.cssResources.get(i)); } }
/** * Add the required css and js files to the page * * <p>Also add the javascript to create the tooltip */ @Override public void renderHead(Component c, final IHeaderResponse response) { response.renderJavaScriptReference( new PackageResourceReference(MootipBehaviour.class, "mootools.v1.11.js")); response.renderJavaScriptReference( new PackageResourceReference(MootipBehaviour.class, "mootips.v1.11.js")); if (contributeCSS) response.renderCSSReference(new PackageResourceReference(MootipBehaviour.class, "tip.css")); response.renderOnLoadJavaScript(generateJS(mooTipTemplate)); }
@Override public void renderHead(final IHeaderResponse response) { // response.renderJavaScriptReference(new JavaScriptResourceReference( // BasePage.class, "js/jquery.tools.min.js")); // response.renderJavaScriptReference(new JavaScriptResourceReference( // BasePage.class, "js/tooltips.js")); // response.renderCSSReference(new PackageResourceReference( // BasePage.class, "css/wicket.css")); response.renderJavaScriptReference( new JavaScriptResourceReference(BaseUsersPage.class, "js/widgets.js")); response.renderJavaScriptReference( new JavaScriptResourceReference(BaseUsersPage.class, "js/jquery.js")); }
protected void generate( IWrapperContainer component, IHeaderResponse response, boolean domreadySupport) { if (component instanceof IWrapperContainer) { IWrapperContainer g = (IWrapperContainer) component; if (!g.isInDashboard()) { if (domreadySupport) { response.renderOnDomReadyJavascript(toScript(g)); } else { response.renderOnLoadJavascript(toScript(g)); } } } }
/** * Render initialization JavaScript for this component. * * @param response */ private void renderInitJavaScript(IHeaderResponse response) { // get initialization JavaScript template from file TextTemplate initJSTemplate = new PackageTextTemplate(CoolButton.class, "init.js.template"); // fill variables map Map<String, Object> variables = new HashMap<String, Object>(); // id of HTML block to render component variables.put("elementId", this.getMarkupId()); // JavaScript namespace for this component variables.put("namespace", this.getJSNamespace()); // JavaScript variable name for this component variables.put("variableName", this.getJSVariableName()); // component properties variables.put("caption", this.properties.getCaption()); variables.put("width", this.properties.getWidth()); variables.put("height", this.properties.getHeight()); variables.put("textColor", this.properties.getTextColor()); variables.put("backColor", this.properties.getBackColor()); // render variables into template initJSTemplate.interpolate(variables); // render initialization JavaScript as OnDomReady event handler response.renderOnDomReadyJavaScript(initJSTemplate.asString()); }
/** * @see * org.apache.wicket.markup.html.IHeaderContributor#renderHead(org.apache.wicket.markup.html.IHeaderResponse) */ public void renderHead(IHeaderResponse response) { // NOTE JavascriptResourceReference takes care of stripping comments // when in deployment (production) mode response.renderJavascriptReference( new JavascriptResourceReference(DatePicker.class, "dhtmlgoodies_calendar.js")); response.renderCSSReference( new CompressedResourceReference(DatePicker.class, "dhtmlgoodies_calendar.css")); // Set the icons image path response.renderOnLoadJavascript( "setImagePath(\"" + RequestCycle.get().urlFor(new ResourceReference(DatePicker.class, "images/")) + "\")"); // Set the language code of the current session response.renderOnLoadJavascript( "setLanguageCode(\"" + component.getSession().getLocale().getLanguage() + "\")"); }
@Override public void renderHead(IHeaderResponse response) { // spinner component overwrites onblur, add it as listener response.renderOnDomReadyJavascript( "var spinner = wicketGet('" + WebDataSpinner.this.field.getMarkupId() + "');Wicket.Event.add(spinner,'blur',spinner.onblur);"); super.renderHead(response); }
@Override public void renderHead(final Component component, final IHeaderResponse response) { super.renderHead(component, response); response.renderCSSReference(TAG_IT_CSS); response.renderJavaScriptReference(TAG_IT_JS); component.setOutputMarkupId(true); String id = component.getMarkupId(); TextTemplate tagItConfig = getTagItConfig(); Map<String, CharSequence> variables = new HashMap<String, CharSequence>(); variables.put("componentId", id); variables.put("callbackUrl", getCallbackUrl()); String script = tagItConfig.asString(variables); response.renderOnDomReadyJavaScript(script); }
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.renderJavascriptReference( new JavascriptResourceReference(Chart.class, "jquery-1.10.2.min.js"), "jquery"); ClientProperties clientProperties = ((WebClientInfo) ((WebSession) Session.get()).getClientInfo()).getProperties(); boolean isIE = clientProperties.isBrowserInternetExplorer(); boolean isLowerThan9 = clientProperties.getBrowserVersionMajor() < 9; boolean domreadySupport = !(isIE && isLowerThan9); response.renderJavascriptReference("https://www.google.com/jsapi"); String jsg = " google.load('visualization', '1.2', {\n" + "packages : [ 'corechart', 'controls', 'table', 'orgchart']\n" + "});"; response.renderJavascript(jsg, "jsg"); response.renderJavascriptReference( new JavascriptResourceReference(Resolver.class, "bridge.js")); generate(container, response, domreadySupport); }
public void renderHead(IHeaderResponse response) { // Map variables = new HashMap(); // String widgetId = getComponentMarkupId(); // variables.put("widgetId", widgetId); // // String bBCodes = ""; // boolean firstTag = true; // for (Tags t : Tags.values()) { // if (firstTag) { // firstTag = false; // bBCodes += t.getEndBBTag(); // } else { // bBCodes += "," + t.getEndBBTag(); // // } // } // variables.put("bBCodes", bBCodes); response.renderJavascriptReference(JAVASCRIPT); // TextTemplateHeaderContributor.forJavaScript(BBCodeControls.class, // "bbCodeComponent.js", Model.valueOf(variables)).renderHead( // response); }
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.renderCSSReference( new PackageResourceReference(AbstractBasePage.class, "styles/base.css"), "all"); }
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.renderJavaScript("someJS()", "js"); }
/** * Render CSS and JavaScript references for this component. * * @param response */ private void renderReferences(IHeaderResponse response) { // render reference to Cool Button JavaScript file response.renderJavaScriptReference( new PackageResourceReference(CoolButton.class, "cool-button.js")); }
@Override public void renderHead(HtmlHeaderContainer container) { IHeaderResponse response = container.getHeaderResponse(); // shouldn't be using MarkupAttributes as it's an internal method, but // have to, no other way to // find out if the user put an id attribute on the tag, // getMarkupId(false) should tell us, but it doens't // at this stage in rendering it seems String tmpId = this.getMarkupAttributes().getString("id"); // if they haven't set the id on the component tag, we'll set one for // them if (Strings.isEmpty(tmpId)) { this.setOutputMarkupId(true); tmpId = this.getMarkupId(true); } final String id = tmpId; // add prototype response.renderJavaScriptReference(PrototypeResourceReference.INSTANCE); // add this components javascript response.renderJavaScriptReference( new PackageResourceReference(this.getClass(), "res/scripts/tag.js")); // add component css if (properties.isBrowserInternetExplorer()) { response.renderCSSReference( new PackageResourceReference(this.getClass(), "res/stylesheets/tag-ie.css")); } else if (properties.isBrowserSafari()) { response.renderCSSReference( new PackageResourceReference(this.getClass(), "res/stylesheets/tag-webkit.css")); } else { response.renderCSSReference( new PackageResourceReference(this.getClass(), "res/stylesheets/tag-moz.css")); } // render the javascript to setup the component IModel variablesModel = new AbstractReadOnlyModel() { @Override public Map getObject() { Map<String, CharSequence> variables = new HashMap<String, CharSequence>(2); variables.put("id", id); StringBuffer arr = new StringBuffer(); // join our collection into a comma delimeted string Collection<T> model = (Collection<T>) MultiTextInput.this.getInnermostModel().getObject(); if (model != null) { Iterator<?> iter = model.iterator(); while (iter.hasNext()) { arr.append('\''); // looks like a weird substitution, but regexp in java // ftl. arr.append( iter.next().toString().replaceAll("'", "\\\\'").replaceAll("\"", "\\\\\"")); arr.append('\''); if (iter.hasNext()) { arr.append(','); } } } variables.put("model", arr.toString()); variables.put("length", String.valueOf(MultiTextInput.this.inputLength)); return variables; } }; // merge the javascript from the properties file with the properties we // set above String js = new StringBuffer().append(getString("javascript.tagEntry", variablesModel)).toString(); response.renderOnDomReadyJavaScript(js.toString()); super.renderHead(container); }
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.renderCSSReference(CSS); }
@Override public void renderHead(Component component, IHeaderResponse headerResponse) { super.renderHead(component, headerResponse); headerResponse.renderOnLoadJavaScript( "document.getElementById('" + component.getMarkupId() + "').focus();"); }
@Override public void renderHead(IHeaderResponse response) { response.renderOnDomReadyJavascript("Wicket.Window.unloadConfirmation = false"); }