Icefaces的默认外观以及如何自定义它

时间:2009-08-04 23:53:54

标签: java icefaces

我对Icefaces的样式有疑问。我有一个可以使用Icefaces组件的最小应用程序,但是当我使用它们并查看页面时,组件没有样式化(例如按钮具有默认外观,并且选项卡没有任何外观,没有图像,没有任何内容)。我想知道为什么我应该这样做,所以我会让默认的Icefaces工作。

接下来我不知道如何通过更改一些自动应用于组件的默认css样式类来自定义外观,因此我使用的每个组件都会获得更改的样式。

感谢您的回答!

2 个答案:

答案 0 :(得分:5)

我建议你选择一个现有的样式表,它包含在ICEfaces包中(检查下载的ICEfaces-1.8.1-bin.zip的 resources 文件夹):< / p>

  • 雾凇
  • XP

您可以在ICEfaces showcase

中预览它们

通过<ice:outputStyle>标记将其包含在* .xhtml文件中:

(portlet)
<ice:outputStyle href="/xmlhttp/css/rime/rime-portlet.css"/>

(servlet)
<ice:outputStyle href="./css/demo_template.css"/>

从这里开始,随意操作选择的样式表或者 - 我喜欢 - 在ICEfaces之后包含你自己的样式表并覆盖所需的样式。

关于你的第二个问题: 基本上每个ICEfaces组件都有自己的样式类。只需浏览展示区并使用Firebug检查组件。我没有找到很多可以在不同组件之间重用的类。因此,您必须自己定制每个组件 - 或者通过styleClass属性将您自己的公共样式类应用于您使用的每个组件。

<ice:panelGrid styleClass="myCommonStyleClass">
<ice:inputField styleClass="myCommonStyleClass">

答案 1 :(得分:1)

There are three predefined ICEfaces style sheets included:

(1) xp.css
(2) royale.css
(3) rime.css

Developers may also create their own custom style sheet based on a predefined ICEfaces style sheet. If the style class names match those defined in the ICEfaces style sheets, the ICEfaces components will use the specified styles by default, without the need to specify the style class names explicitly on each component.

(1) Where to find CSS class names ?

IMPORTANT : The default CSS class names associated with each component are listed in the component's TLD (taglib) description.

(2) How To use a predefined style :


<link rel="stylesheet" type="text/css" href="./xmlhttp/css/xp/xp.css" />

     OR


<ice:outputStyle href="./xmlhttp/css/xp/xp.css" rel="stylesheet" type="text/css"  />

(3) Is there any Advantages of using ICEFaces OutputStyle ?

The ice:outputStyle component has the following advantages over the HTML link tag:

- Automatically includes browser-specific variants of the main style sheet in the page to adapt the theme styling to account for differences in each browsers' CSS support. See the TLD (taglib) documentation for the ice:outputStyle component for details.
- Provides the ability to dynamically change the theme style sheet at runtime via a value binding on the component's `href` attribute.

(4) What is meant by xmlhttp ?

The xmlhttp->css->xp path is automatically resolved by ICEfaces and all needed resources are loaded from the ICEfaces.jar

Hope this helps..!! :)