PrimeFaces 2.2.1 在本地看起来与展示中不同

发布于 2024-12-11 06:05:29 字数 2603 浏览 2 评论 0原文

我在此处此处。这些都没有回答我的问题。我还搜索了 PrimeFaces 论坛

在 NetBeans 中设置普通 JSF 2.0 项目,我添加了 简单对话框的 Showcase 代码

代码 (index.xhtml) 减去 xml 声明和 DOCTYPE(XHTML 1.0 Transitional):

<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:p="http://primefaces.prime.com.tr/ui">
<h:head>
    <title>PrimeFaces</title>
</h:head>
<h:body>
    <h:panelGrid columns="1" cellpadding="5">
        <p:commandButton value="Basic" onclick="dlg1.show();" type="button"/>

        <p:commandButton value="Modal" onclick="dlg2.show();" type="button"/>

        <p:commandButton value="Effects" onclick="dlg3.show();" type="button"/>
    </h:panelGrid>

    <p:dialog header="Basic Dialog" widgetVar="dlg1">
        <h:outputText value="Resistance to PrimeFaces is futile!" />
    </p:dialog> 

    <p:dialog header="Modal Dialog" widgetVar="dlg2" modal="true" height="200">
        <h:outputText value="This is a Modal Dialog." />
    </p:dialog> 

    <p:dialog header="Effect Dialog" widgetVar="dlg3" showEffect="bounce" hideEffect="explode" height="200">
        <h:outputText value="This dialog has cool effects." />
    </p:dialog>
</h:body>

我已将 aristo 主题添加到我的 Libraries(添加到类路径的 NetBeans 方式),并将以下内容添加到 web.xml

web.xml(部分):

<context-param>
    <param-name>primefaces.THEME</param-name>
    <param-value>aristo</param-value>
</context-param>

没有进行其他更改,尽管我快速安装/卸载了另一个主题(dark-hive)只是为了确保该主题已正确注册。结果如下:

本地(Chrome 15.0.874.92):

本地创建网站的屏幕截图

展示:(来自 PrimeFaces展示)

在此处输入图像描述

堆栈:
PrimeFaces 2.2.1
JSF 2.0
玻璃鱼3.1.1
Java 1.6.0_18
Windows 7 x64
(由 NetBeans 7.0.1 生成)

编辑:这也在 FireFox 7.0.1 和 IE 9 上进行了测试

I've seen similar questions asked here and here. Neither of these answered my question. I've also searched the PrimeFaces forum.

Setting up a vanilla JSF 2.0 project in NetBeans, I've added the Showcase code for Simple Dialog.

Code (index.xhtml) minus the xml declaration and DOCTYPE (XHTML 1.0 Transitional):

<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:p="http://primefaces.prime.com.tr/ui">
<h:head>
    <title>PrimeFaces</title>
</h:head>
<h:body>
    <h:panelGrid columns="1" cellpadding="5">
        <p:commandButton value="Basic" onclick="dlg1.show();" type="button"/>

        <p:commandButton value="Modal" onclick="dlg2.show();" type="button"/>

        <p:commandButton value="Effects" onclick="dlg3.show();" type="button"/>
    </h:panelGrid>

    <p:dialog header="Basic Dialog" widgetVar="dlg1">
        <h:outputText value="Resistance to PrimeFaces is futile!" />
    </p:dialog> 

    <p:dialog header="Modal Dialog" widgetVar="dlg2" modal="true" height="200">
        <h:outputText value="This is a Modal Dialog." />
    </p:dialog> 

    <p:dialog header="Effect Dialog" widgetVar="dlg3" showEffect="bounce" hideEffect="explode" height="200">
        <h:outputText value="This dialog has cool effects." />
    </p:dialog>
</h:body>

I've added the aristo theme to my Libraries (NetBeans way of adding to the classpath) and added the following to web.xml

web.xml (partial):

<context-param>
    <param-name>primefaces.THEME</param-name>
    <param-value>aristo</param-value>
</context-param>

No other changes were made, although I quickly installed/uninstalled another theme (dark-hive) just to make certain that the theme was being registered properly. The results are as follows:

Local (Chrome 15.0.874.92):

Screenshot of locally created site

Showcase: (from PrimeFaces Showcase)

enter image description here

Stack:
PrimeFaces 2.2.1
JSF 2.0
Glassfish 3.1.1
Java 1.6.0_18
Windows 7 x64
(Generated by NetBeans 7.0.1)

Edit: This was also tested on FireFox 7.0.1 and IE 9

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

み青杉依旧 2024-12-18 06:05:29

问题不是默认字体大小吗?我可以从 showcase css 中看到它的自定义字体大小覆盖了主题的默认值:

body {
    margin: 0px;
    padding: 0;
    font-size: 12px;
    color: #616161;
}

我检查了我的一些项目,所有项目都有一些字体大小/字体系列自定义。希望有帮助

Isn't the problem the default font sizes? I can see from the showcase css that it has custom font sizes overriding the theme's default:

body {
    margin: 0px;
    padding: 0;
    font-size: 12px;
    color: #616161;
}

I checked some of my projects and all of them also have some font-size/font-family customization. Hope it helps

﹂绝世的画 2024-12-18 06:05:29

我读了你的 3 篇文章。你这里有什么问题吗?你能更具体地描述你的问题吗?我的意思是,他们有什么不同?

如果与字体大小有关,请查看 PrimeFaces 文档第 8.4 章:主题提示:(用户指南 3.4 及更高版本中的第 7.4 章)

主题的默认字体大小可能比预期大,需要更改 PrimeFaces 的字体大小
全局组件,使用 .ui-widget 样式类。较小字体的示例;

.ui-widget, .ui-widget .ui-widget {
     font-size: 90% !important;
}

希望它可以帮助你:)

I read your 3 posts. What's you problem here? Can you describe you problem more specifically? I mean, how different are they?

If it about font size, check PrimeFaces' Document. At Chapter 8.4: Themeing Tips: (Chapter 7.4 in User Guide 3.4 and later)

Default font size of themes might be bigger than expected, to change the font-size of PrimeFaces
components globally, use the .ui-widget style class. An example of smaller fonts;

.ui-widget, .ui-widget .ui-widget {
     font-size: 90% !important;
}

Hope that it can help u :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文