我有以下呈现的 HTML:
<div id="ordersBrowseForm:ordersBrowseWestPane" class="ui-layout-west ui-widget-content ui-corner-all ui-layout-pane ui-layout-pane-west" data-combinedposition="west" style="position: absolute; margin: 0px; left: 0px; right: auto; top: 116px; bottom: 0px; height: 312px; z-index: 0; width: 198px; display: none; visibility: visible; "><div class="ui-widget-header ui-corner-top pe-layout-pane-header">
由于我为这个 PrimeFaces 扩展 layoutPane (pe:layoutPane) 分配了一个 ID,我想通过 OmniFaces Components.findComponent 和 JSF UIComponent 检查来自 bean 的显示 CSS。
基于 BalusC 对以下内容的回答:
我的 bean 中有以下内容:
UIComponent westPane = (UIComponent) Components.findComponent("ordersBrowseForm:ordersBrowseWestPane");
if (westPane != null) {
Map attrs = westPane.getAttributes();
String paneStyle = (String) attrs.get("style");
if (debug) {
String log;
log = "LayoutController.handleResize(): ordersBrowseForm:ordersBrowseWestPane style = " +
(paneStyle != null ? paneStyle : "null");
System.out.println(log);
}
}
服务器日志始终包含以下内容:
INFO: LayoutController.handleResize(): ordersBrowseForm:ordersBrowseWestPane style = null
请指教。谢谢。