1

xforms は初めてです - Orbeon Form Builder 3.8 PE を使用しています。「Alert Dialog」や「Datatable」などの高度な xbl コントロールについて読みました。これらは私のアプリケーションでは非常に便利ですが、実装方法に関する知識のギャップを埋めることはできません。

ツールボックスにプロパティを追加するには、どこかにプロパティを追加する必要があるようです。または、コードを xform に直接追加する必要があります。Orbeon の例は、後者であると思わせるスニペットを示しています/しかし、例は文脈から外れています-これらのものを挟むためにどのタグが使用されているか、または後でアクションなどでそれらを参照する方法がわかりません.

前もって感謝します。[編集: コメントごとに以下のコード] Bill

<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml"
        xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
        xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
        xmlns:exforms="http://www.exforms.org/exf/1-0"
        xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
        xmlns:saxon="http://saxon.sf.net/"
        xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:oxf="http://www.orbeon.com/oxf/processors"
        xmlns:sql="http://orbeon.org/oxf/xml/sql"
        xmlns:xi="http://www.w3.org/2001/XInclude"
        xmlns:ev="http://www.w3.org/2001/xml-events"
        xmlns:xforms="http://www.w3.org/2002/xforms"
        xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary"
        xmlns:p="http://www.orbeon.com/oxf/pipeline"
        xmlns:xs="http://www.w3.org/2001/XMLSchema"
        xmlns:odt="http://orbeon.org/oxf/xml/datatypes"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xhtml:head>
    <xhtml:title>Operations</xhtml:title>
    <xforms:model id="fr-form-model">


        <xforms:instance id="fr-form-instance">
            <form>
                <section-1>
                    <control-1/>
                    <control-2/>
                </section-1>
                <section-2/>
                    <control-3/>
            </form>
        </xforms:instance>


        <xforms:bind id="fr-form-binds" nodeset="instance('fr-form-instance')">
            <xforms:bind id="section-1-bind" nodeset="section-1">
                <xforms:bind id="control-1-bind" name="control-1" nodeset="control-1"/>
                <xforms:bind id="control-2-bind" name="control-2" nodeset="control-2"/>
            </xforms:bind>
            <xforms:bind id="section-2-bind" nodeset="section-2">
                <xforms:bind id="control-3-bind" name="control-3" nodeset="control-3"/>
            </xforms:bind>
        </xforms:bind>


        <xforms:instance id="fr-form-metadata" xxforms:readonly="true">
            <metadata>
                <application-name>KENAN_TOOLKIT</application-name>
                <form-name>operations-process</form-name>
                <title xml:lang="en">Operations</title>
                <description xml:lang="en"/>
                <author/>
                <logo mediatype="image/jpeg" filename="optimum-lightpath-logo-810x141.JPG"
                      size="14799">/fr/service/oracle/crud/orbeon/builder/data/3978eab19d9c6ccd8c65a787aa1864c4/541ca86ada859805464573ca539d6327.JPG</logo>
            </metadata>
        </xforms:instance>


        <xforms:instance id="fr-form-attachments">
            <attachments>
                <css mediatype="text/css" filename="" size=""/>
                <pdf mediatype="application/pdf" filename="" size=""/>
            </attachments>
        </xforms:instance>



        <xforms:instance id="fr-form-resources" xxforms:readonly="false">
            <resources>
                <resource xml:lang="en">
                    <section-1>
                        <label>EBF</label>
                        <help/>
                    </section-1>
                    <control-1>
                        <label/>
                        <hint/>
                        <help/>
                        <alert/>
                    </control-1>
                    <control-2>
                        <label/>
                        <hint/>
                        <help/>
                        <alert/>
                    </control-2>
                    <section-2>
                        <label>Archive</label>
                        <help/>
                    </section-2>
                    <control-3>
                        <label/>
                        <hint/>
                        <help/>
                        <alert/>
                    </control-3>
                </resource>
            </resources>
        </xforms:instance>


        <xforms:instance id="fr-service-request-instance" xxforms:exclude-result-prefixes="#all">
            <request/>
        </xforms:instance>

        <xforms:instance id="fr-service-response-instance" xxforms:exclude-result-prefixes="#all">
            <response/>
        </xforms:instance>
        <xforms:instance id="testsvc-instance" class="fr-database-service"
                         xxforms:exclude-result-prefixes="#all">
            <body>&lt;sql:config xmlns:sql="http://orbeon.org/oxf/xml/sql"&gt;
            &lt;sql:datasource&gt;orbeonedmDS&lt;/sql:datasource&gt;
&lt;sql:query&gt;SELECT n.node_id as id, n.node_name_tid as name, n.sw_ver as ver, m.model_name as model FROM techmgr.node n, techmgr.model m WHERE n.model_id = m.model_id  and rownum between 0 and 100&lt;/sql:query&gt;

        &lt;/sql:config&gt;</body>
        </xforms:instance>
        <xforms:submission id="testsvc-submission" class="fr-database-service"
                           ref="instance('fr-service-request-instance')"
                           resource="/fr/service/custom/orbeon/database"
                           method="post"
                           serialization="application/xml"
                           replace="instance"
                           instance="fr-service-response-instance"/>
        <xforms:action id="pop-test-binding">

            <xforms:action ev:event="xforms-ready" ev:observer="fr-form-model">

                <xforms:send submission="testsvc-submission"/>
            </xforms:action>

            <xforms:action ev:event="xforms-submit" ev:observer="testsvc-submission">

                <xxforms:variable name="request-instance-name" select="'testsvc-instance'" as="xs:string"/>

                <xforms:insert nodeset="instance('fr-service-request-instance')"
                               origin="saxon:parse(instance($request-instance-name))"/>


                <xforms:action context="instance('fr-service-request-instance')">

                </xforms:action>
            </xforms:action>

            <xforms:action ev:event="xforms-submit-done" ev:observer="testsvc-submission"
                           context="instance('fr-service-response-instance')">

            </xforms:action>
        </xforms:action>

    </xforms:model>
</xhtml:head>
<xhtml:body>
    <fr:view>
        <xforms:label ref="instance('fr-form-metadata')/title"/>
        <fr:body>
            <fr:section id="section-1-section" bind="section-1-bind">
                <xforms:label ref="$form-resources/section-1/label"/>
                <xforms:help ref="$form-resources/section-1/help"/>
                <fr:grid columns="2">
                    <xhtml:tr>
                        <xhtml:td>
                            <xforms:input id="control-1-control" bind="control-1-bind">
                                <xforms:label ref="$form-resources/control-1/label"/>
                                <xforms:hint ref="$form-resources/control-1/hint"/>
                                <xforms:help ref="$form-resources/control-1/help"/>
                                <xforms:alert ref="$fr-resources/detail/labels/alert"/>
                            </xforms:input>
                        </xhtml:td>
                        <xhtml:td/>
                    </xhtml:tr>
                    <xhtml:tr>
                        <xhtml:td>
                            <xforms:input id="control-2-control" bind="control-2-bind">
                                <xforms:label ref="$form-resources/control-2/label"/>
                                <xforms:hint ref="$form-resources/control-2/hint"/>
                                <xforms:help ref="$form-resources/control-2/help"/>
                                <xforms:alert ref="$fr-resources/detail/labels/alert"/>
                            </xforms:input>
                        </xhtml:td>
                        <xhtml:td/>
                    </xhtml:tr>

                </fr:grid>
            </fr:section>
            <fr:section id="section-2-section" bind="section-2-bind">
                <xforms:label ref="$form-resources/section-2/label"/>
                <xforms:help ref="$form-resources/section-2/help"/>
                <fr:grid columns="1">
                    <xhtml:tr>
                        <xhtml:td>
                            <fr:datatable scrollable="both" width="800px" height="500px">
                                <thead>
                                    <tr>
                                        <th fr:sortable="true" fr:resizeable="true">ID</th>
                                        <th fr:sortable="true" fr:resizeable="true">Name</th>
                                        <th fr:sortable="true" fr:resizeable="true">Version</th>
                                        <th fr:sortable="true" fr:resizeable="true">Model</th>
                                    </tr>
                                </thead>
                                <tbody>
                                 <xforms:repeat nodeset="/testsvc:response/testsvc:row"> 
                                  <tr>
                                   <td>
                                    <xf:output value=""/>
                                   </td>
                                   <td>
                                   </td>
                                   <td>
                                   </td>
                                   <td>
                                   </td>
                                  </tr>
                                 </xforms:repeat>
                                </tbody>
                           </fr:datatable>
                        </xhtml:td>
                    </xhtml:tr>
                </fr:grid>
            </fr:section>
        </fr:body>
    </fr:view>
</xhtml:body>

4

1 に答える 1

2

wiki にある XBL に関するドキュメントは、手で XForms を作成し、XBL コンポーネントを Form Builder に追加するのではなく、 XBL コンポーネントを使用するか、独自の XBL コンポーネントを作成したい人を対象としています。

そうは言っても、確かに XBL コンポーネントを Form Builder に追加できますが、そのためにはコンポーネントのソースを変更する必要があり、一部のコンポーネントでは Form Builder 自体を変更することさえあります。これは「高度な Orbeon Forms 開発者」向けのタスクですが、あなたがそうではない、またはすぐにそうなるつもりはないと誰が言いましたか? いくつかの指針を示すために:

  1. ツールボックスに追加された XBL コンポーネントは、oxf.fb.toolbox.group.*プロパティから参照されます。デフォルトは で定義されてproperties-form-builder.xmlおり、独自の でこれをオーバーライドできますproperties-local.xml
  2. Form Builder で使用できるようにするには、コントロールが Form Builder にいくつかのメタデータを提供する必要があります。たとえば、これが単純なテキスト フィールドに対してどのように行われるかを参照してください。おそらく、XBL コンポーネントの最も単純な例は<fr:button>.
  3. コンポーネントが重要な構成を必要とする場合、フォームの 1 つのセルに収まらない場合 (例: datatable )、または 1 つのセルに収まるように設計されていない場合 (例: alert dialog )、おそらく重要なものを Form に変更します。ビルダーは確かに必要になります。

Form Builder での Orbeon データテーブルのサポートに関するアイデア

  1. 現在 Form Builder にあるすべてのコンポーネントは、1 つの値を含む 1 つのノードにバインドされています。xs:dateTime日付用と時刻用の 2 つのフィールドとして表示できる日付/時刻コントロールでさえ、フォームのを含むノードにバインドされます2010-11-12T10:16:36.209-08:00。データテーブルのようなより豊富なデータを保持できるコンポーネントについては、この 1 つのコンポーネント / 1 つの値のマッピングを超える必要があります。
  2. #1 でバインディングについて述べたことは、サービスの呼び出しにまで及びます。Form Builder では、サービスが返すことができる XML に制限はありませんが、Form Builder は、サービスによって返される XML から (サブツリーではなく) 単一の値を抽出することによって、コントロールの値を設定することができます。これも、データテーブルなどのより豊富なコンポーネントを処理するために拡張する必要があります。
  3. 最初のステップは、読み取り専用のデータテーブルをサポートすることです。読み取り/書き込みデータテーブルをサポートするには、特定のセルに他のコントロールを含めることができ、既存のグリッドに似たものにする必要があります。
于 2010-11-11T19:23:59.603 に答える