Containers and Panes

This section provides brief descriptions of the containers and layout panes available for developing a Nexaweb Java application UI.

For more detailed information on container and layout pane widgets, see the XAL Schema documentation.

Basic Containers

This section describes the basic containers available for developing a Nexaweb Java application UI. In addition to these containers, see also Floating Containers and Root Elements.

desktopPane

desktopPane is a panel that also hosts windows and dialogs.

Nexaweb Studio makes this widget available in the Palette view from which you can drag and drop it onto a UI file in the Visual Editor.

Example XAL for using this widget in a freePane:

<desktopPane height="300px" width="300px" x="0px" y="0px"/>

scrollPane

A component used to fit large areas of content that automatically shows scrollbars when a component inside of it is larger than the scrollPane itself. Can have only one child component that always takes up at least the entire space of the scroll pane. (The child component is at least as large as the viewable area of the scrollPane.)

Nexaweb Studio makes this widget available in the Palette view from which you can drag and drop it onto a UI file in the Visual Editor.

Example XAL for using this widget in a freePane:

<scrollPane height="300px" width="300px" x="10px" y="10px">
    <freePane/>
 </scrollPane>

The following table lists and provides brief descriptions of scrollPane component specific attributes: 

AttributeDescription
horizontalScrollBarPolicySpecifies policy for when the component displays a horizontal scrollbar. always - horizontal scrollBar always visible. never - horizontal scrollBar never visible. automatic - horizontal scrollbar displays if needed. Default=automatic.
horizontalScrollPositionSpecifies the horizontal position of the scrolled component. For example, setting the value to 100 scrolls the component 100 pixels to the right. DOM Accuracy: The value of this attribute in the DOM always reflects the current value in the UI.
verticalScrollBarPolicySpecifies policy for when the component displays a vertical scrollbar. always - vertical scrollBar always visible. never - vertical scrollBar never visible. automatic - vertical scrollbar displays if needed. Default=automatic.
verticalScrollPositionSpecifies the vertical position of the scrolled component. For example, setting the value to 100 scrolls the component 100 pixels down.
DOM Accuracy: The value of this attribute in the DOM always reflects the current value in the UI.

horizontalSplitPane

A panel divided into two sections, horizontally, with a draggable bar between them by which a user can resize each section within the total space of the panel.

Nexaweb Studio makes this widget available in the Palette view from which you can drag and drop it onto a UI file in the Visual Editor.

Example XAL for using this widget in a freePane:

<horizontalSplitPane height="300px" width="300px" x="40px" y="0px"> 
 <left> 
 <freePane/> 
 </left>
 <right> 
 <freePane/> 
 </right>
</horizontalSplitPane>

The following table lists and provides brief descriptions of horizontalSplitPane component specific attributes:

AttributeDescription
splitPosition Specifies the location of the dividing bar from 0 (left) to 100 (right).


verticalSplitPane

A panel divided into two sections, vertically, with a draggable bar between them by which a user can resize each section within the total space of the panel.

Nexaweb Studio makes this widget available in the Palette view from which you can drag and drop it onto a UI file in the Visual Editor.

Example XAL for using this widget in a freePane:

<verticalSplitPane height="300px" width="300px" x="40px" y="0px"> 
 <top> 
 <freePane/>
 </top>
 <bottom>
  <freePane/>
 </bottom>
</verticalSplitPane>

The following table lists and provides brief descriptions of verticalSplitPane component specific attributes:

AttributeDescription
splitPosition Specifies the location of the dividing bar from 0 (top) to 100 (bottom).


tabPane

A panel with a clickable tab at the top. Keyboard navigation: Tabbing into a tab box focuses on a tab. Once focused on a tab, left or right arrow keys navigate between tabs, or pressing the tab key focuses on the first component inside the tab.

Nexaweb Studio makes this widget available in the Palette view from which you can drag and drop it onto a UI file in the Visual Editor.

Example XAL for using this widget in a freePane:

<tabPane height="300px" width="300px" x="10px" y="0px">
 <tab text="Tab">
  <freePane/>
 </tab>
</tabPane>

 The following table lists and provides brief descriptions of tabPane component specific attributes:

AttributeDescription
tabAlignmentSpecifies the position of tabs relative to the parent tabPane. In a default tabPane, with tabs that run across the top, setting this to end positions the tabs flush with the far right of the tabPane. Setting this to start positions the tabs flush with the far left of the tabPane.  Default=start
tabGrowth  Specifies in pixels how much a tab enlarges when selected. Default=2 pixels.
tabOverlapSpecifies the spacing between tabs. For example, set to 5, tabs overlap their neighbors slightly, while set to -5 creates space between tabs.
tabPlacementSpecifies along which edge of the tabPane to place the tabs. Values: left, right, top, bottom. Default=top.

The following figure shows a tabPane with two tabs:

The following figure shows a tabPane with tabPlacement set to left and tabOverlap set to -5:

Layout Panes

This section describes the layout panes available for developing a Nexaweb Java application UI. Use layout panes to quickly organize components in application user interfaces. 

freePane

 

freePane is the default layout pane Nexaweb Studio uses for all containers if you do not specify any other layout pane. It arranges components according to the absolute sizes and positions that you specify for each component. When sizing and positioning components, you need to consider that screen size may vary from one computer to another. Use freePane when other panes cannot meet your requirements or when you want to add components to the container with x/y coordinates from a mouse event. The following example xml represents the window shown above:
<xal xmlns="http://openxal.org/ui/java">
 <window title="New Window" width="300px" height="300px">
    <freePane>
      <comboBox height="25px" text="Account Type" width="100px" x="45px" y="24px">
        <listBox>
          <listItem text="New Account"/>
          <listItem text="Existing Account"/>
          <listItem text="Search"/>
        </listBox>
      </comboBox>
      <button height="25px" text="Go" width="100px" x="45px" y="60px"/>
      <radioButton height="25px" text="Button On/Off" width="100px" x="170px" y="220px" selected="true"/>
    </freePane>
 </window>
</xal>

borderPane

 

A borderPane places components in up to five areas: north, south, west, east, and center. Components placed in north and south stretch horizontally. Components placed in the west and the east stretch vertically. Components placed in the center stretch in both directions, so that the remaining space fills with the center component.  You place child components in these areas by specifying borderPosition
when adding the component to the borderPane.  The following example xml represents the window shown above:

<xal xmlns="http://openxal.org/ui/java"> 
 <window title="New Window" width="300px" height="300px">
  <borderPane>
   <button height="25px" text="North" width="100px" borderPosition="north"/>
   <button height="25px" text="South" width="100px" borderPosition="south"/>
   <button height="25px" text="East" width="100px" borderPosition="east"/>
   <button height="25px" text="West" width="100px" borderPosition="west"/>
   <button height="25px" text="Center" width="100px" borderPosition="center"/>
  </borderPane>
 </window>
</xal>

As this example shows, child components expand themselves to fill the area in which they reside. If you resize the window, the components resize themselves as well to fill the area.  borderPane ignores the size of a component placed in the center area so that the component can fill any available space.  Components placed in north and south maintain their height and components placed in west and east maintain their width.

You don't have to put components in all five areas.  Often placing components in two or there areas is sufficient to get the layout result you want.

The following table lists and provides brief descriptions of borderPane specific attributes: 

AttributeDescription
borderPositionSpecify this attribute for components you add to a borderPane layout. Specifies the location of a component within the borderPane. You cannot change this attribute for a component after adding that component to the borderPane. Values=north, south, east, west, center.
horizontalGapSpecifies the horizontal gap between components in pane.
verticalGapSpecifies the vertical gap between components in pane.


cardPane

cardPane (available in Java applications only) allows you to put different components to a common container, while showing only one of them at a time. You specify which one to show using the show attribute.  The displayed component occupies the entire space of its parent container. The best example
of a cardPane is a slideshow. As shown in the windows above, clicking prev or next button sets the show attribute of cardLayout and makes the corresponding component in the deck show up. The following example xml represents the windows shown above:

cardPane - UI Example

<xal xmlns="http://openxal.org/ui/java">
    <mco:declarations xmlns:mco="http://openxal.org/core/mco">
    <mco:mco id="cardPaneMco" src="CardPaneMco"/>
    </mco:declarations>
    <window title="New Window" width="300" height="300">
        <borderPane>
            <cardPane id="cardPane" borderPosition="center" show="1">
                <button id="button1" text="Button 1" name="1"/>
                <button id="button2" text="Button 2" name="2"/>
                <button id="button3" text="Button 3" name="3"/>
                <borderPane id="panel" name="4">
                    <button borderPosition="center" id="button4" text="Button 4"/>
                </borderPane>
            </cardPane>
            <horizontalFlowPane borderPosition="south" align="center">
                <button id="prev" text="prev" onCommand="mco://cardPaneMco.prev( cardPane )"/>
                <button id="next" text="next" onCommand="mco://cardPaneMco.next( cardPane )"/>
            </horizontalFlowPane>
        </borderPane>
    </window>
</xal>

cardPane - MCO Example

 import com.nexaweb.client.mco.AbstractMco;
 import com.nexaweb.xml.Element;
 public class CardPaneMco extends AbstractMco{
     //   first card by default is the first card
     int currPage = 0;
     public void next( Element cardPane) { 
         //   increment the current card index
         //   if last card is reached, set to first card
         currPage++;
         if( currPage == cardPane.getChildCount() )
         {
             currPage = 0; 
         }
         //   get the name of the new card to show, and set it on the card pane
         String cardName = ( (Element) cardPane.getChildAt(currPage) ).getAttribute("name");
         cardPane.setAttribute("show", cardName ); 
     }
     public void prev( Element cardPane )
     { 
         //   decrement the current card index
         //   if first card is reached, set to last card
         currPage--;
         if( currPage < 0 )
         {
             currPage = cardPane.getChildCount()-1;
         }
         //   get the name of the new card to show, and set it on the card pane 
         String cardName = ( (Element) cardPane.getChildAt(currPage) ).getAttribute("name");
         cardPane.setAttribute("show", cardName );
     }
 }



The following table lists and provides brief descriptions of cardPane specific attributes:

AttributeDescription
cardNameSpecifies a string indicating the type of component which, when supplied in the cardPane's show attribute causes this component to become the active component in the card pane. The active component takes up the entire area of the cardPane, and can receive input events. You cannot change this attribute for a component after adding that component to the cardPane.

gridPane


 
gridPane arranges components row by row in a uniform grid, based on the order in which you add components to the parent container. gridPane sizes each component the same and the overall grid will exactly fit the parent container. You specify the number of columns in the grid through the columns attribute.  In addition to the gridPane attributes, you can use child component attributes to help sizing
and placing child components in the grid. The following example xml represents the window shown above:

<xal xmlns="http://openxal.org/ui/java">
  <window title="New Window" width="300px" height="300px">
   <gridPane evenlySpace="true" columns="3">
    <button height="25px" text="Button" width="100px"/>
    <link height="20px" text="link"/>
    <comboBox height="25px" text="ComboBox" width="100px">
     <listBox>
      <listItem text="listItem #1"/>
      <listItem text="listItem #2"/>
      <listItem text="listItem #3"/>
     </listBox>
    </comboBox>
    <radioButton height="25px" text="radioButton" width="100px"/>
    <textField height="25px" text="TextField" width="200px"/>
    <button height="25px" text="Button" width="100px"/>
    <listBox height="100px" width="100px">
     <listItem text="listItem #1"/>
     <listItem text="listItem #2"/>
     <listItem text="listItem #3"/>
    </listBox> 
    <button height="25px" text="Button" width="100px"/>
   </gridPane>
  </window>
 </xal>

gridPane is patterned after the SWT grid layout. - http://www.eclipse.org/articles/Understanding%20Layouts/Understanding%20Layouts.htm

The following table lists and provides brief descriptions of gridPane specific attributes:

AttributeDescription
gridColumnSpanSpecifies the number of columns the component spans in the grid.
gridHorizontalAlignmentSpecifies the horizontal alignment of the component within a grid layout cell.
gridHorizontalGrabSpaceSpecifies whether the grid cell this component occupies stretches horizontally to fit the available space. true=yes; false=no.
gridRowSpanSpecifies the number of rows the component spans in the grid.
gridVerticalAlignmentSpecifies the vertical alignment of the component within a grid layout cell.
gridVerticalGrabSpaceSpecifies whether the grid cell this component occupies stretches vertically to fit the available space. true=yes; false=no.

Note: You cannot change these attributes for a component after adding that component to the gridPane.


horizontalBoxPane

The horizontalBoxPane places components in a single row along the horizontal orientation of the container.  It does not wrap components to the next row, as the horizontalFlowPane does, when the size of the total width of the components exceeds the width of the container. By default, horizontalBoxPane honors a component's size and the component does not resize if the container's size changes. The following example xml represents the window shown above.

 <xal xmlns="http://openxal.org/ui/java">
  <window title="New Window" width="300px" height="300px" x="5" y="5">
   <horizonatlBoxPane>
    <button height="25px" text="Button" width="100px"/>
    <button height="25px" text="Button" width="100px"/> 
    <textField height="25px" text="TextField" width="200px"/>
    <label height="20px" text="Label" width="100px"/>
    <comboBox height="25px" text="ComboBox" width="100px">
     <listBox>
      <listItem text="listItem #1"/>
      <listItem text="listItem #2"/>
      <listItem text="listItem #3"/>
     </listBox>
    </comboBox>
   </horizontalBoxPane>
  </window>
 </xal>

The following table lists and provides brief descriptions of horizontalBoxPane specific attributes:

AttributeDescription
alignmentSpecifies where to align components along vertical axis in layout. Values: start, center, end, stretch. start= top or left of component; center=center left; end=bottom left; stretch=align the component to cover the entire area.
boxFlexSpecify this attribute for components you add to a horizontalBoxPane layout. Specifies whether the component grows or shrinks to fit the available space in the parent container. If more than one component in the layout has a flex value, each component grows or shrinks in proportion to its flex value. Components with no flex value remain at their specified size.
packSpecifies where to align components along horizontal axis in layout. If the pane has extra space, the pack attribute specifies where to anchor the child components. Values=start, center, end. start= top or left of component; center=center top; end=top left; stretch=align the component to cover the entire area.


verticalBoxPane

The verticalBoxPane places components in a single column in a vertical orientation.  It does not wrap a component to the next row or column if the component's size is over the container's size, where as verticalFlowPane does wrap the component to available space. By default, verticalBoxPane honors a component's size and the component does not resize if the container's size changes. The following example xml represents the window shown
above:

 <xal xmlns="http://openxal.org/ui/java"> 
  <window title="New Window" width="300px" height="300px" x="5" y="5">
   <verticalBoxPane>
    <button height="25px" text="Button" width="100px"/>
    <button height="25px" text="Button" width="100px"/> 
    <textField height="25px" text="TextField" width="200px"/>
    <label height="20px" text="Label" width="100px"/>
    <comboBox height="25px" text="ComboBox" width="100px">
     <listBox>
      <listItem text="listItem #1"/>
      <listItem text="listItem #2"/>
      <listItem text="listItem #3"/>
     </listBox>
    </comboBox>
   </verticalBoxPane>
  </window>
 </xal>

The following table lists and provides brief descriptions of verticalBoxPane specific attributes:

AttributeDescription
alignmentSpecifies where to align components along horizontal axis in layout. Values: start, center, end, stretch. start= top or left of component; end= the right or bottom; stretch=align the component to cover the entire area.
boxFlexSpecify this attribute for components you add to a verticalBoxPane layout. Specifies whether the component grows or shrinks to fit the available space in the parent container. If more than one component in the layout has a flex value, each component grows or shrinks in proportion to its flex value. Components with no flex value remain at their specified size.
packSpecifies where to align components along vertical axis in layout. If the pane has extra space, the pack attribute specifies where to anchor the child components. Values=start, center, end.


horizontalFlowPane

horizontalFlowPane lays out components in rows that span the horizontal width of the container. horizontalFlowPane separates components within a row by a horizontal gap that you can specify.  horizontalFlowPane places each component in the same row until the total of the width of components in the row and the horizontal gap between them exceeds the width of the container, then begins a new row and places components across that. You can specify the amount of space between rows by indicating a value for the vertical gap. The following example xml represents the window shown above:

 <xal xmlns="http://openxal.org/ui/java"> 
  <window title="New Window" width="300px" height="300px">
   <horizontalFlowPane gapHorizontal="25" gapVertical="25">
    <button height="25px" text="Button" width="100px" x="100px" y="10px"/>
    <button height="25px" text="Button" width="100px" x="164px" y="53px"/>
    <radioButton height="25px" text="radioButton" width="100px"/>
    <comboBox height="25px" text="ComboBox" width="100px">
     <listBox>
      <listItem text="listItem #1"/>
      <listItem text="listItem #2"/>
      <listItem text="listItem #3"/>
     </listBox>
    </comboBox>
    <textField height="25px" text="TextField" width="200px"/>
   </horizontalFlowPane>
  </window>
 </xal>

The following table lists and provides brief descriptions of horizontalFlowPane specific attributes:

AttributeDescription
alignmentSpecifies horizontal alignment of components in pane.
horizontalGapSpecifies horizontal (left to right) gap between components as components fill the vertical axis and spread horizontally across the pane.
verticalGap  Specifies vertical (top to bottom) gap between components.


verticalFlowPane

verticalFlowPane lays out components in a single column, aligned from the left, and centering the components to the largest component in the column.  It starts a new column when components fill the vertical space of the container. The following example xml represents the window shown above:

 <xal xmlns="http://openxal.org/ui/java"> 
  <window title="New Window" width="300px" height="300px">
   <verticalFlowPane>
    <button height="25px" text="Button" width="100px"/>
    <button height="25px" text="Button" width="100px"/>
    <radioButton height="25px" text="radioButton" width="100px"/>
    <comboBox height="25px" text="ComboBox" width="100px">
     <listBox>
      <listItem text="listItem #1"/>
      <listItem text="listItem #2"/>
      <listItem text="listItem #3"/>
     </listBox>
    </comboBox>
    <textField height="25px" text="TextField" width="200px"/>
   </verticalFlowPane>
  </window>
 </xal>

The following table lists and provides brief descriptions of verticalFlowPane specific attributes:

AttributeDescription
alignmentSpecifies vertical alignment of components in pane.
horizontalGapSpecifies horizontal (left to right) gap between components as components fill the vertical axis and spread horizontally across the pane.
verticalGap  Specifies vertical (top to bottom) gap between components.