PATH |
The WOTabPanel component displays a tab panel. When the user selects a tab the corresponding panel appears.
This component can be embedded within a WOForm. When the WOTabPanel
contains form fields that are bound to an enterprise object's
attributes, the HTML element the user clicks to change tabs must
be a submit button. This ensures that the values the user types
into these fields get stored in the enterprise object. If the HTML
element the user clicks is a hyperlink, the enterprise object's
attributes are not updated when the user switches tabs and the form
field values are lost. The submitActionName
binding determines
the whether the HTML element that switches tabs is a hyperlink or
a submit button.
movieArray
and
contain Movie objects.currentMovie
could represent
the currently selected object in movieArray
.
This attribute gets updated each time the tab panel is redisplayed.
In addition, this attribute defines the initially selected object and
defaults to the first object in the list.currentMovie.title
.
If your tab objects are Strings (NSStrings in Objective-C), do not
set this attribute.submitActionName
is
not defined or is set to null
, the
tab selectors are hyperlinks. Otherwise the tab selectors are submit
buttons. If you want the tab selector to be a submit button, but
don't want to call an action, set this attribute to the empty
string (""
).The WOTabPanel component is used in conjunction with the WOKeyValueConditional which conditionally displays the tab panel contents depending on the tab the user selects. The following example shows the HTML, template, and Java files for the parent component containing a tab panel.
<WEBOBJECT NAME=TabPanel1> <WEBOBJECT NAME=KeyValueConditional1> This is the content<BR>for the first tab.<BR> </WEBOBJECT> <WEBOBJECT NAME=KeyValueConditional2> This is the content<BR>for the second tab.<BR> </WEBOBJECT> </WEBOBJECT>
TabPanel1: WOTabPanel { tabs = keyList; selectedTab = selection; } KeyValueConditional1: WOKeyValueConditional { key = "selection"; value = "first"; } KeyValueConditional2: WOKeyValueConditional { key = "selection"; value = "second"; }
protected NSArray keyList; protected String selection; public Main() { keyList = new NSArray(new Object[] {"first","second"}); }
The parent component's constructor initializes the key list.
The selection
string
holds the current selection which the WOKeyValueConditional components
query to decide if they should display their contents.