且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何停止Richfaces向面板和日历添加边框?

更新时间:2023-12-04 09:29:58

从3.3.0.GA版本开始, richfaces停止渲染边框和背景的CSS。它必须覆盖内置样式表(包含在org.richfaces.renderkit.html.css中的,属于richfaces-ui-3.3.0.GA.jar的一部分)的每个属性。

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).

插件和皮肤给你这样做的必要的力量,使用通常的技术添加自定义CSS,虽然插件和皮肤可以说更好,因为你可以参考抽象颜色定义,以补偿缺少背景,像这样:

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:

<u:style name="color" skin="abstractColorName" />

以下CSS属性可用于快速中和边框和背景相关属性。

The following CSS properties are useful for quickly neutralising the border and background related properties.

border: none;
background: transparent;

要开始使用插件和皮肤,您可以使用以下Maven2命令序列:

To get started with plug and skin you can use the following Maven2 command sequence:

mvn archetype:generate -DarchetypeGroupId=org.richfaces.cdk -DarchetypeArtifactId=maven-archetype-plug-n-skin -DarchetypeVersion=3.3.0.GA -DartifactId=fil-skins -Dpackage=com.feelitlive.richfaces -DgroupId=com.feelitlive.server -Dversion=0.0.1-SNAPSHOT -DarchetypeRepository=http://repository.jboss.com/maven2/
cd fil-skins
mvn cdk:add-skin -Dname=fil -Dpackage=com.feelitlive.richfaces.skins

这***从命令行完成,不幸的是Eclipse插件无法在jboss存储库中找到原型(其他IDE可能会更好地处理)。您需要更改artifactId,groupId,包,版本和名称属性以适合您的项目。选择反映用于保存多个皮肤定义的工件范围的工件和包名。

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.

虽然很多工作 - 添加对皮肤属性的支持,一般格式为xxxBackgroundEnabled和xxxBorderEnabled,以根据具体情况关闭这些边框和背景CSS的渲染。

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.

您需要与richfaces团队一起修补org.richfaces.renderkit.html.css中的xcss文件。您还需要在XCSS JSF标记库之一(在XCSS文件中由http:/jsf.exadel.com/template/util或http:/jsf.exadel.com/template标识)中的某种条件输出功能,我希望使用它在XCSS文件中包装CSS属性组。

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.

如果你对richfaces进行了这样的修改,那么你将能够禁用任何皮肤的属性文件中有争议的CSS。

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.