如何阻止 Richfaces 添加边框到面板和日历?
我希望使用自定义的 richfaces 皮肤来处理我的大部分演示工作。 不幸的是,richfaces 在日历组件中的每个单元格和每个面板周围呈现边框。 我想将它们关闭,以便那天的数字位于一个没有边界的开放网格中。 没有明显的方法可以使用日历控件的外观或属性来做到这一点。
我可以使用自定义 CSS,但我更愿意使用框架从 richfaces 创建的样式表中完全删除与边框相关的属性,而不是对抗框架并使用丑陋的 CSS 覆盖所有内容。
那么如何阻止富人向面板和日历添加边框呢?
这家伙有一个类似的问题
I'm hoping to use a custom richfaces skin to handle the bulk of my presentation work. Unfortunately richfaces renders borders around every cell in a calendar component and around each panel. I would like to turn them off so that day numbers site in an open grid with no borders. There is no obvious way to do that using skins or attributes of the calendar control.
I could use custom CSS but I'd prefer to work with the framework to completely remove the border related properties from the stylesheets created by richfaces rather than work against the framework and override everything using ugly CSS.
So how do I stop richfaces adding borders to panels and calendars?
This guy has a similar problem
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
从版本 3.3.0.GA 开始,无法要求 richfaces 停止渲染边框和背景的 CSS。 有必要覆盖内置样式表中的每个属性(org.richfaces.renderkit.html.css 中包含的属性,它是 richfaces-ui-3.3.0.GA.jar 的一部分)。
插件和外观 为您提供了必要的能力来做到这一点,就像使用常用技术添加自定义 CSS 一样,尽管插件和皮肤可以说更好,因为您可以引用抽象颜色定义来补偿缺失的背景,如下所示:
以下 CSS 属性对于快速中和边框和背景相关的属性很有用。
要开始使用插件和皮肤,您可以使用以下 Maven2 命令序列:
最好从命令行完成,因为不幸的是 Eclipse 插件无法在 jboss 存储库中找到原型(其他 IDE 可能会更好地处理这个问题)。 您需要更改 artifactId、groupId、package、version 和 name 属性以适合您的项目。 选择反映保存多个皮肤定义的工件范围的工件和包名称。
尽管需要做很多工作,但可以添加对通用格式 xxxBackgroundEnabled 和 xxxBorderEnabled 的外观属性的支持,以根据具体情况关闭这些边框和背景 CSS 的渲染。
您需要与 richfaces 团队合作来修补 org.richfaces.renderkit.html.css 中的 xcss 文件。 您还需要 XCSS JSF 标记库之一中的某种条件输出功能(由 XCSS 文件中的 http://jsf.exadel.com/template/util 或 http:/jsf.exadel.com/template 标识)我预计会使用它来将 CSS 属性组包装在 XCSS 文件中。
如果您对 richfaces 进行了这样的修改,那么您将能够从任何皮肤的属性文件中禁用有争议的 CSS 渲染。
As of version 3.3.0.GA it is not possible to ask richfaces to stop rendering CSS for borders and backgrounds. Its necessary to override each of the properties from the built in stylesheets (the ones contained in org.richfaces.renderkit.html.css which is part of richfaces-ui-3.3.0.GA.jar).
Plug and skin gives you the necessary power to do that, as would custom CSS added using the usual techniques, though plug and skin is arguably better as you can reference abstract colour definitions to compensate for missing backgrounds, like this:
The following CSS properties are useful for quickly neutralising the border and background related properties.
To get started with plug and skin you can use the following Maven2 command sequence:
This is best done from the command line as unfortunately the Eclipse plugins cannot locate the archetypes in the jboss repository (other IDEs may handle that better). You'll need to change artifactId, groupId, package, version and name properties to suit your project. Choose an artefact and package name that reflects the scope of the artefact for holding mulitple skin definitions.
It would be possible - though a lot of work - to add support for skin properties in the general format xxxBackgroundEnabled and xxxBorderEnabled to switch off rendering of those border and background CSS on a case by case basis.
You would need to work with the richfaces team to patch the xcss files in org.richfaces.renderkit.html.css. You'd also need some kind of conditional output functionality in one of the XCSS JSF tag libraries (identified by http:/jsf.exadel.com/template/util or http:/jsf.exadel.com/template in the XCSS files) which I'd anticipate using to wrap groups of CSS properties in the XCSS files.
If you made such a modification to richfaces then you would be able to disable rendering of the controversial CSS from the properties file of any skin.
有一种名为
plain
的皮肤,几乎没有附加任何样式。以下是文档摘录:
激活它
您可以通过添加到
web.xml
来阻止 RichFaces 加载任何样式
。 您还可以通过
web.xml
中的设置。 但请注意,因为它在 JBoss Portlet Bridge 1.0.0 中不起作用。
There is a skin called
plain
that's got nearly no styles at all attached to it.Here's an excerpt from the documentation:
You can activate it by adding
to the
web.xml
.You can also hinder RichFaces to load any styles at all with
set in the
web.xml
.But beware, since it won't work in JBoss Portlet Bridge 1.0.0.
RichFaces 有一个内置的皮肤系统,称为 Skinnablity。 Skinnability 是标准 CSS 的高级扩展。 您可以创建自己的皮肤文件以在应用程序中使用(jboss 文档)。
在 richfaces-impl jar 中,文件夹 /META-INF/skins 包含所有皮肤文件 (.skin.properties)。 复制一份并重命名,修改你想要的内容。 你将不得不重建罐子。
或者
您可以使用 richfaces 的即插即用功能,我以前从未尝试过,但看起来它也适用于您想要做的事情。
RichFaces has a skin system built in called Skinnablity. Skinnability is a high-level extension of standard CSS. You can create your own skin file to use in your application(jboss documentation).
In the richfaces-impl jar, the folder /META-INF/skins contains all the skin files (.skin.properties). Copy one and rename name it, modify what you want. You will have to rebuild the jar.
OR
You can use the plug-n-skin feature of richfaces, which i've never tried before but looks like it would also work for what you are trying to do.