ルート要素

ルート要素

rootPane

rootPane は Nexaweb アプリケーションの示すトップレベルコンテナです。

<rootpane> </rootpane>

デフォルトの値から rootPane 属性の値を変更したい場合、アプリケーションのクライアント XAL ファイルで rootpane を指定します。例えば、rootPane の枠と色を設定する場合です。

アプリケーションのクライアント XAL ファイルで rootPane を指定し、複数のドキュメントインターフェイス(MDI)スタイルのアプリケーションを作成します。

次は左にツリーとコンテナの中央に window のある MDI スタイルのアプリケーション用のXAL シンタックスです。

<rootPane> <borderPane> <tree borderPosition="west"/> <desktopPane borderPosition="center"> <window>...</window> </desktopPane> </borderPane> </rootPane> 

この例には以下が含まれています。

  • トップレベルコンテナの rootPane

  • borderPane、コンテナのレイアウトとrootPane のあるコンポーネントを管理するレイアウトコンテナ

  • tree, borderPane レイアウトの西座標に位置するデータの階層的図を提供

  • desktop, window と diaog を含み、borderPane レイアウトの中央座標に配置されているpanel

  • window, desktopPane に含まれているwindow コンポーネント

この例では、rootPane に追加されたwindow コンポーネントはアプリケーションのどこにでも移動することができます。しかし、desktoPane に追加された window はアプリケーションの中央のみにおく事ができ、treeが描写されるコンテナの西側部分には置く事ができません。

視覚的に、追加属性が指定されている場合以下のように示されます。

defs

defstag に項目を指定し、コンポーネントはシンタックス: #ID (pound symbol + コンポーネント ID)を使用することによりそれを参照することができます。defstag 下の項目は、コンポーネントが参照する前またはエラーが発生する前に、宣言する必要があります。
以下は defstag に配置できるコンポーネントです:

  • popupMenu

  • textField

  • comboBox

  • linearGradient

  • popup

defs セクションを使用し、これらのコンポーネントのバージョンを定義し、使用したいときに毎回コンポーネントを定義しなくてもUIで複数回使用することができます。

次は popup と popupMenu コンポーネントの定義を含むNexaweb Java アプリケーション UI ファイルでの def セクションのシンタックスを示しています。

 

<xal xmlns="http://openxal.org/ui/java"> <defs> <popup id="myPopup"> <borderPane> <label text="south" borderPosition="south"/> <label text="east" borderPosition="east"/> <label text="north" borderPosition="north"/> <label text="west" borderPosition="west"/> <label text="center" borderPosition="center"/> </borderPane> </popup> <popupMenu id="myPopupMenu"> <menuItem text="A menu item"/> <menuItem text="Another menu item"/> </popupMenu> </defs> <rootPane> <borderPane> <desktopPane borderPosition="center"> <horizontalFlowPane> <borderPane width="300px" height="500px"> <button text="A button with a popup" popup="#myPopup" borderPosition="north"/> <button text="MyPopup Used Here" popup="#myPopupMenu" borderPosition="south"/> <button height="25px" text="MyPopup Used Here" width="200px" popup="#myPopupMenu" borderPosition="west"/> </borderPane> </horizontalFlowPane> </desktopPane> </borderPane> </rootPane> </xal>

 

次は、UI で真ん中のボタンと下のボタンから表示するpopupMenu や MyPopup の図を示しています。

次の例は linearGradient を含む Nexaweb Java アプリケーションの defs セクションのシンタックスを示しています。

<xal xmlns="http://openxal.org/ui/java"> <defs> <linearGradient id="button_gradient_xal" x1="0%" y1="0%" y2="100%"> <stop offset="30%" stop-color="blue"/> <stop offset="100%" stop-color="#D5DEE3"/> </linearGradient> </defs> <rootPane> <borderPane> <desktopPane borderPosition="center"> <horizontalFlowPane> <borderPane> <button text="OK" borderPosition="north"/> <button text="Apply" borderPosition="center"/> <button text="linearGradient" borderPosition="south" backgroundColor="gradient(button_gradient_xal)"/> </borderPane> </horizontalFlowPane> </desktopPane> </borderPane> </rootPane> </xal>

 

次の図はUIでdefsセクションで定義されたlinearGradientを使用したボタンを表示しています。