保存 Primefaces 布局状态

发布于 2024-11-29 09:12:54 字数 246 浏览 0 评论 0原文

据我所知,Primefaces 布局和仪表板具有可以保存的状态。

有人可以帮助我提供有关如何将 Primefaces 布局(整页)保存到某个持久数据库或文件中的代码片段(或一些教程/操作方法)网站吗?

在这种情况下,我希望用户能够保存自己关于布局单元大小的首选项,该布局单元在登录时最小化并关闭等。

谢谢

ps:我正在使用在 Tomcat 上运行的 Primefaces 2.2 - 基本上与可下载展示相同的配置。

I understand that Primefaces Layout and Dashboard have state which can be saved.

Could someone help me with snippet code (or some tutorial / how to ) site on how to save Primefaces layout (fullpage) into some persistent database or file.

In this case, I want to enable user to save their own preferences regarding size of the layoutUnit, which layoutUnit is minimized and closed and such whenever they login.

Thank you

ps: I am using Primefaces 2.2 running on Tomcat - essentially the same configuration as downloadable showcase.

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

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

发布评论

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

评论(1

許願樹丅啲祈禱 2024-12-06 09:12:54

您只需响应事件并保存状态。用户手册提供了详细信息。

<p:layout closeListener="#{layoutBean.handleClose}" toggleListener="#{layoutBean.handleToggle}" resizeListener="#layoutBean.handleResize}"/>


public void handleClose(CloseEvent event) {
    LayoutUnit closedUnit = event.getComponent(); //now get all the info related to closedUnit
}

public void handleResize(ResizeEvent event) {
    LayoutUnit resizedUnit = event.getComponent(); //now get all the info related to resizedUnit
}

public void handleToggle(ToggleEvent event) {
    LayoutUnit toggledUnit = event.getComponent();  //now get all the info related to toggledUnit 
    Visibility status = event.getVisibility();
}

现在可以将状态保存在数据库中并重现保存的状态,可以根据之前保存的状态设置布局单元的属性。

You just respond to the events and save the state. User manual gives the details.

<p:layout closeListener="#{layoutBean.handleClose}" toggleListener="#{layoutBean.handleToggle}" resizeListener="#layoutBean.handleResize}"/>


public void handleClose(CloseEvent event) {
    LayoutUnit closedUnit = event.getComponent(); //now get all the info related to closedUnit
}

public void handleResize(ResizeEvent event) {
    LayoutUnit resizedUnit = event.getComponent(); //now get all the info related to resizedUnit
}

public void handleToggle(ToggleEvent event) {
    LayoutUnit toggledUnit = event.getComponent();  //now get all the info related to toggledUnit 
    Visibility status = event.getVisibility();
}

Now the state can be saved in database and to reproduce the saved state, attributes of the layout units can be set as per the state saved earlier.

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