org.apache.wicket.markup.head.CssReferenceHeaderItem Java Examples
The following examples show how to use
org.apache.wicket.markup.head.CssReferenceHeaderItem.
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: BasePage.java From sakai with Educational Community License v2.0 | 6 votes |
/** * 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 #2
Source File: SakaiPage.java From sakai with Educational Community License v2.0 | 6 votes |
@Override public void renderHead(IHeaderResponse response) { // get Sakai skin String skinRepo = serverConfigurationService.getString("skin.repo"); String skin = siteService.findTool(sessionManager.getCurrentToolSession().getPlacementId()).getSkin(); if (skin == null) { skin = serverConfigurationService.getString("skin.default"); } String toolCSS = skinRepo + "/" + skin + "/tool.css"; String toolBaseCSS = skinRepo + "/tool_base.css"; // Sakai additions response.render(JavaScriptUrlReferenceHeaderItem.forUrl("/library/js/headscripts.js")); response.render(CssUrlReferenceHeaderItem.forUrl(toolBaseCSS)); response.render(CssUrlReferenceHeaderItem.forUrl(toolCSS)); response.render(JavaScriptHeaderItem.forScript("\nif (typeof setMainFrameHeight !== 'undefined'){\n" + "setMainFrameHeight( window.name );\n" + "}", "iframe-resize")); // Tool additions (at end so we can override if required) response.render(new MetaDataHeaderItem(MetaDataHeaderItem.META_TAG).addTagAttribute("http-equiv", "Content-Type").addTagAttribute("content", "text/html; charset=UTF-8")); response.render(CssReferenceHeaderItem.forReference(new CssResourceReference(getClass(), "style.css"))); }
Example #3
Source File: AbstractMobilePage.java From projectforge-webapp with GNU General Public License v3.0 | 6 votes |
@Override public void renderHead(final IHeaderResponse response) { super.renderHead(response); response.render(JavaScriptReferenceHeaderItem.forReference(Application.get().getJavaScriptLibrarySettings().getJQueryReference())); response.render(StringHeaderItem.forString(WicketUtils.getCssForFavicon(getUrl("/favicon.ico")))); if (WebConfiguration.isDevelopmentMode() == true) { response.render(CssReferenceHeaderItem.forUrl("mobile/jquery.mobile-" + JQUERY_MOBILE_VERSION + "/jquery.mobile-" + JQUERY_MOBILE_VERSION + ".css")); } else { response.render(CssReferenceHeaderItem.forUrl("mobile/jquery.mobile-" + JQUERY_MOBILE_VERSION + "/jquery.mobile-" + JQUERY_MOBILE_VERSION + ".min.css")); } response.render(CssReferenceHeaderItem.forUrl("mobile/projectforge.css")); response.render(JavaScriptReferenceHeaderItem.forUrl("mobile/jquery.mobile-" + JQUERY_MOBILE_VERSION + "/myconfig.js")); if (WebConfiguration.isDevelopmentMode() == true) { // response.renderJavaScriptReference("mobile/jquery.mobile/myconfig.js"); response.render(JavaScriptReferenceHeaderItem.forUrl("mobile/jquery.mobile-" + JQUERY_MOBILE_VERSION + "/jquery.mobile-" + JQUERY_MOBILE_VERSION + ".js")); } else { // response.renderJavaScriptReference("mobile/jquery.mobile/myconfig.js"); response.render(JavaScriptReferenceHeaderItem.forUrl("mobile/jquery.mobile-" + JQUERY_MOBILE_VERSION + "/jquery.mobile-" + JQUERY_MOBILE_VERSION + ".min.js")); } }
Example #4
Source File: BasePage.java From sakai with Educational Community License v2.0 | 6 votes |
/** * 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 #5
Source File: SakaiPage.java From sakai with Educational Community License v2.0 | 6 votes |
@Override public void renderHead(IHeaderResponse response) { // get Sakai skin String skinRepo = serverConfigurationService.getString("skin.repo"); String skin = siteService.findTool(sessionManager.getCurrentToolSession().getPlacementId()).getSkin(); if (skin == null) { skin = serverConfigurationService.getString("skin.default"); } String toolCSS = skinRepo + "/" + skin + "/tool.css"; String toolBaseCSS = skinRepo + "/tool_base.css"; // Sakai additions response.render(JavaScriptUrlReferenceHeaderItem.forUrl("/library/js/headscripts.js")); response.render(CssUrlReferenceHeaderItem.forUrl(toolBaseCSS)); response.render(CssUrlReferenceHeaderItem.forUrl(toolCSS)); response.render(JavaScriptHeaderItem.forScript("\nif (typeof setMainFrameHeight !== 'undefined'){\n" + "setMainFrameHeight( window.name );\n" + "}", "iframe-resize")); // Tool additions (at end so we can override if required) response.render(new MetaDataHeaderItem(MetaDataHeaderItem.META_TAG).addTagAttribute("http-equiv", "Content-Type").addTagAttribute("content", "text/html; charset=UTF-8")); response.render(CssReferenceHeaderItem.forReference(new CssResourceReference(getClass(), "style.css"))); }
Example #6
Source File: AbstractFullCalendar.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
@Override public void renderHead(IHeaderResponse response) { response.render(JavaScriptHeaderItem.forReference(WicketAjaxJQueryResourceReference.get())); response.render(CssReferenceHeaderItem.forReference(CSS)); if (getApplication().usesDeploymentConfig()) { response.render(JavaScriptReferenceHeaderItem.forReference(JS_MIN)); } else { response.render(JavaScriptReferenceHeaderItem.forReference(JS)); } response.render(JavaScriptReferenceHeaderItem.forReference(JS_EXT)); }
Example #7
Source File: ResourceBundleReferences.java From onedev with MIT License | 5 votes |
private void createBundles(Class<?> scope, Set<ResourceReference> resourceReferences) { /* * Some bundled css file may contain resources relative to parent paths of the css url, * for instance, a css may define below style: * * background: url(../images/clock.png)), * * if we use a resource name for instance "bundle" here, the generated resource * path will be something like "http://<server>:<port>/wicket/resource/org.apache.wicket.Application/bundle-ver-1472816165384.css", * and browser will resolve image url above as "http://<server>:<port>/wicket/resource/images/clock.png", which will cause Wicket * resource loading not working at all. However if we use a long path here for resource name, for instance * "a/l/o/n/g/p/a/t/h/bundle", the resolved image url will be "http://<server>:<port>/wicket/resource/org.apache.wicket.Application/a/l/o/n/g/p/a/t/clock.png", * which will be resolved to the correct image with help of our BundleAwareResourceReferenceFactory */ String name = "a/l/o/n/g/p/a/t/h/bundle"; List<ResourceReference> resourceReferenceList = new ArrayList<>(resourceReferences); resourceReferenceList.sort((o1, o2)->sorted.indexOf(o1)-sorted.indexOf(o2)); List<JavaScriptReferenceHeaderItem> javaScriptResourceReferences = new ArrayList<>(); List<CssReferenceHeaderItem> cssResourceReferences = new ArrayList<>(); for (ResourceReference resourceReference: resourceReferenceList) { if (resourceReference instanceof JavaScriptResourceReference) { javaScriptResourceReferences.add(JavaScriptReferenceHeaderItem.forReference(resourceReference)); } else if (resourceReference instanceof CssResourceReference) { cssResourceReferences.add(CssReferenceHeaderItem.forReference(resourceReference)); } } if (!javaScriptResourceReferences.isEmpty()) { javaScriptBundleReferences.add(new JavaScriptConcatResourceBundleReference( scope, name + ".js", javaScriptResourceReferences)); } if (!cssResourceReferences.isEmpty()) { cssBundleReferences.add(new CssConcatResourceBundleReference( scope, name + ".css", cssResourceReferences)); } }
Example #8
Source File: WicketRenderHeadUtils.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
/** * Bootstrap, jqueryui and uquery.contextmenu.js. */ public static void renderMainCSSIncludes(final IHeaderResponse response) { for (final String url : CSS_FILES) { response.render(CssReferenceHeaderItem.forUrl(url)); } LessWicketApplicationInstantiator.renderCompiledCssResource(response); }
Example #9
Source File: ResourceBundleReferencesTest.java From onedev with MIT License | 5 votes |
@Test public void testc() { ResourceBundleReferences references = new ResourceBundleReferences(Js1ResourceReferenceC.class); Assert.assertEquals(2, references.getJavaScriptBundles().size()); Assert.assertEquals( Lists.newArrayList( JavaScriptReferenceHeaderItem.forReference(new Js3ResourceReferenceC()), JavaScriptReferenceHeaderItem.forReference(new Js4ResourceReferenceC())), references.getJavaScriptBundles().get(0).getProvidedResources()); Assert.assertEquals( Lists.newArrayList( JavaScriptReferenceHeaderItem.forReference(new Js1ResourceReferenceC()), JavaScriptReferenceHeaderItem.forReference(new Js2ResourceReferenceC())), references.getJavaScriptBundles().get(1).getProvidedResources()); Assert.assertEquals(2, references.getCssBundles().size()); Assert.assertEquals( Lists.newArrayList( CssReferenceHeaderItem.forReference(new CssResourceReference(Js3ResourceReferenceC.class, "3.css")), CssReferenceHeaderItem.forReference(new CssResourceReference(Js4ResourceReferenceC.class, "4.css"))), references.getCssBundles().get(0).getProvidedResources()); Assert.assertEquals( Lists.newArrayList( CssReferenceHeaderItem.forReference(new CssResourceReference(Js1ResourceReferenceC.class, "1.css")), CssReferenceHeaderItem.forReference(new CssResourceReference(Js2ResourceReferenceC.class, "2.css"))), references.getCssBundles().get(1).getProvidedResources()); }
Example #10
Source File: BootstrapDatePickerBehaviour.java From pm-wicket-utils with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void renderHead(Component component, IHeaderResponse response) { super.renderHead(component, response); Collection<SpecialDate> specialDates = getSpecialDates(); if(component.isEnabledInHierarchy()){ response.render(CssReferenceHeaderItem.forReference(DATE_PICKER_CSS)); response.render(JavaScriptHeaderItem.forReference(DATE_PICKER_JAVASCRIPT)); response.render(JavaScriptHeaderItem.forReference(DATE_PICKER_EXTENSION_JAVASCRIPT)); if(!component.getLocale().getLanguage().equals("en")){ response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(BootstrapDatePickerBehaviour.class, "locales/bootstrap-datepicker."+component.getLocale().getLanguage()+".min.js"))); } if(null != specialDates && !specialDates.isEmpty()) { StringBuilder sb = new StringBuilder(); sb.append("["); DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); SpecialDate[] sdArray = specialDates.toArray(new SpecialDate[20]); for(int i = 0; i < specialDates.size(); ++i) { SpecialDate sd = sdArray[i]; sb.append("{dt:new Date('"+df.format(sd.getDt())+"'), css:'"+sd.getCssClass()+"', tooltip:'"+ sd.getTooltip() +"'}"); if(i < specialDates.size() - 1) { sb.append(","); } } sb.append("]"); response.render(OnDomReadyHeaderItem.forScript("$(\"#"+component.getMarkupId()+"\").datepicker(null, "+sb.toString()+")")); } else { response.render(OnDomReadyHeaderItem.forScript("$(\"#"+component.getMarkupId()+"\").datepicker()")); } } }
Example #11
Source File: BootstrapDateTimePickerBehaviour.java From pm-wicket-utils with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void renderHead(Component component, IHeaderResponse response) { super.renderHead(component, response); if(component.isEnabledInHierarchy()) { response.render(CssReferenceHeaderItem.forReference(DATETIME_PICKER_CSS)); response.render(JavaScriptHeaderItem.forReference(MOMENT_JAVASCRIPT)); response.render(JavaScriptHeaderItem.forReference(DATETIME_PICKER_JAVASCRIPT)); if(!component.getLocale().getLanguage().equals("en")) { response.render(JavaScriptHeaderItem.forReference( new JavaScriptResourceReference(BootstrapDateTimePickerBehaviour.class , "locales/" + component.getLocale().getLanguage() + ".js"))); } /** Not supporting special dates at the moment **/ response.render(OnDomReadyHeaderItem.forScript("$(\"#" + component.getMarkupId() + "\").datetimepicker({ " + " format: 'DD/MM/YYYY HH:mm:ss'," + " icons: { " + " time: 'fa fa-clock-o'," + " date: 'fa fa-calendar'," + " up: 'fa fa-arrow-up'," + " down: 'fa fa-arrow-down'," + " previous: 'fa fa-arrow-left'," + " next: 'fa fa-arrow-right'" + "}" + "});" )); } }
Example #12
Source File: ImageCropperPage.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
@Override public void renderHead(final IHeaderResponse response) { super.renderHead(response); response.render(CssReferenceHeaderItem.forUrl("imagecropper/history/history.css")); response.render(JavaScriptReferenceHeaderItem.forUrl("imagecropper/history/history.js")); response.render(JavaScriptReferenceHeaderItem.forUrl("imagecropper/AC_OETags.js")); }
Example #13
Source File: LessWicketApplicationInstantiator.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
/** * Renders the compiled css reference to the given response * @param response */ public static void renderCompiledCssResource(final IHeaderResponse response) { if (instance != null && instance.reference != null) { response.render(CssReferenceHeaderItem.forReference(instance.reference)); } else { log.error("Unable to find compiled main projectforge.css less file"); } }
Example #14
Source File: FontAwesomeBehavior.java From nextreports-server with Apache License 2.0 | 4 votes |
@Override public void renderHead(Component component, IHeaderResponse response) { super.renderHead(component, response); response.render(CssReferenceHeaderItem.forUrl("css/font-awesome.css")); }
Example #15
Source File: KnowledgeBasePage.java From inception with Apache License 2.0 | 4 votes |
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.render(CssReferenceHeaderItem.forReference(KnowledgeBasePageLRR.get())); }
Example #16
Source File: OArchitectEditorWidget.java From Orienteer with Apache License 2.0 | 4 votes |
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.render(CssReferenceHeaderItem.forReference(OARCHITECT_CSS)); response.render(CssReferenceHeaderItem.forReference(MXGRAPH_CSS)); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/OArchitectApplication.js"))); response.render(JavaScriptHeaderItem.forScript( String.format("initMxGraph('%s');", "en"), null)); response.render(JavaScriptHeaderItem.forReference(MXGRAPH_JS)); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/component/OArchitectEditor.js"))); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/component/OArchitectBar.js"))); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/util/OArchitectOType.js"))); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/component/OArchitectMessage.js"))); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/component/OArchitectPopupMenu.js"))); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/component/OArchitectModalWindow.js"))); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/component/OArchitectValueContainer.js"))); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/component/OClassEditModalWindow.js"))); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/component/OPropertyEditModalWindow.js"))); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/component/behavior/OArchitectAction.js"))); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/component/config/GraphConfig.js"))); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/component/config/GraphConnectionConfig.js"))); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/component/config/GraphStyleConfig.js"))); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/util/OArchitectCommand.js"))); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/util/OArchitectUtil.js"))); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/util/OArchitectOClass.js"))); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/util/OArchitectOProperty.js"))); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, "js/util/OArchitectConstants.js"))); String locale = getOArchitectEditorLocale(); response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OArchitectEditorWidget.class, String.format("js/util/locale/architect_%s.js", locale)))); PackageResourceReference configXml = new PackageResourceReference(OArchitectEditorWidget.class, "js/OArchitectApplication.js"); String configUrl = urlFor(configXml, null).toString(); String baseUrl = configUrl.substring(0, configUrl.indexOf("js/OArchitectApplication")); TextTemplate configTemplate = new PackageTextTemplate(OArchitectEditorWidget.class, "config.tmpl.xml"); Map<String, Object> params = CommonUtils.toMap("basePath", baseUrl); String config = configTemplate.asString(params); boolean canUpdate = canUserUpdateEditor(); response.render(OnLoadHeaderItem.forScript(String.format("initOrienteerArchitect('%s', %s, %s, '%s', '%s', '%s', '%s', '%s', '%s', %s);", baseUrl, CommonUtils.escapeAndWrapAsJavaScriptString(config), locale, this.getMarkupId(), container.getMarkupId(), editor.getMarkupId(), sidebar.getMarkupId(), toolbar.getMarkupId(), outline.getMarkupId(), Boolean.toString(canUpdate)))); }
Example #17
Source File: DatePicker.java From pm-wicket-utils with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void renderHead(Component component, IHeaderResponse response) { response.render(CssReferenceHeaderItem.forReference(DATE_PICKER_DATE_CSS, "screen")); response.render(JavaScriptHeaderItem.forReference(DATE_PICKER_JS)); response.render(JavaScriptHeaderItem.forReference(DATE_PICKER_ATTACH_JS)); response.render(JavaScriptHeaderItem.forReference(DATE_PICKER_DATE_JS)); if(component.isEnabledInHierarchy()){ StringBuilder sb = new StringBuilder(); sb.append("Date.defineParser(\"").append(getDatePattern()).append("\");"); response.render(JavaScriptHeaderItem.forScript(sb.toString(), "pickerDatePattern")); sb = new StringBuilder(); sb.append("new Picker.Date($(\"").append(component.getMarkupId()).append("\"), {"); sb.append("format : \"").append(getDatePattern()).append("\","); sb.append("inject : $(\"").append(container.getMarkupId()).append("\"),"); sb.append("months_abr : ["); sb.append("\"Jan\","); sb.append("\"Fev\","); sb.append("\"Mar\","); sb.append("\"Abr\","); sb.append("\"Mai\","); sb.append("\"Jun\","); sb.append("\"Jul\","); sb.append("\"Ago\","); sb.append("\"Set\","); sb.append("\"Out\","); sb.append("\"Nov\","); sb.append("\"Dez\","); sb.append("],"); sb.append("days_abr : ["); sb.append("\"Seg\","); sb.append("\"Ter\","); sb.append("\"Qua\","); sb.append("\"Qui\","); sb.append("\"Sex\","); sb.append("\"Sab\","); sb.append("\"Dom\","); sb.append("],"); sb.append("})"); response.render(OnLoadHeaderItem.forScript(sb.toString())); } }
Example #18
Source File: ResourceBundleReferences.java From onedev with MIT License | 4 votes |
public List<ConcatResourceBundleReference<CssReferenceHeaderItem>> getCssBundles() { return cssBundleReferences; }
Example #19
Source File: CssConcatResourceBundleReference.java From onedev with MIT License | 4 votes |
public CssConcatResourceBundleReference(Class<?> scope, String name, List<CssReferenceHeaderItem> resources) { super(scope, name, resources); }
Example #20
Source File: BundleAwareResourceReferenceFactory.java From onedev with MIT License | 4 votes |
public BundleAwareResourceReferenceFactory(List<ConcatResourceBundleReference<JavaScriptReferenceHeaderItem>> javaScriptBundles, List<ConcatResourceBundleReference<CssReferenceHeaderItem>> cssBundles) { bundles.addAll(javaScriptBundles); bundles.addAll(cssBundles); }