0

次のレンダリングされた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">

このPrimeFacesExtensionlayoutPane(pe:layoutPane)にIDを割り当てたので、OmniFacesComponents.findComponentおよびJSFUIComponentを介してBeanからの表示CSSを確認したいと思います。

以下に関するBalusCの回答に基づく:

拡張PrimeFacesコンポーネントに渡された属性へのアクセス

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

お知らせ下さい。ありがとう。

4

1 に答える 1

1

それは可能ではありません。はUIComponent#getAttributes()、ビュー側のコンポーネントで明示的に宣言されている属性のみを返します。

<p:someComponent style="position: absolute;">

または、レンダリング前またはレンダリング中にプログラムで:

component.getAttributes().put("style", "position: absolute;");

生成された HTML 要素の属性は返しません。何をしようとしているのかは完全には明らかではありませんが、代わりに JavaScript を使用してクライアント側でタスクを実行することを検討してください。

于 2012-11-06T00:38:05.553 に答える