| |||||||
FRAMES NO FRAMES |
Use the webuijsf:label
tag to display a label for a
component. To specify which component the label belongs to you may
either:
webuijsf:label
;
or for
attribute of webuijsf:label
to the id of the labelled component.If the tags are adjacent on the page, the first option should be preferred as it is simpler to configure the tag this way.
Note that many components in this library have label
labelLevel
attributes (and sometimeslabelOnTop
) which can be used
instead of webuijsf:label
. The main reason to use webuijsf:label
is if you need to specify the appearance of the label beyond what these
attributes permit.
The webuijsf:label
tag results in a HTML label
or span
element. A span element is rendered if no
labelled component could be found.
If the tag has a body, the body must consists of tags corresponding
to JSF components only. The corresponding JSF components become
children of the Label
component. All the child components
are rendered after the label
element.
If the tag has a body but no for
attribute, alabel
is printed, and its for
attribute is set to the element
ID of the first child component which is an EditableValueHolder.
document.getElementById(id).setProps({level:
2})
.getProps() |
Use this function to get widget properties. Please see setProps()
function for a list of supported properties. |
refresh(execute) |
Use this function to
asynchronously refresh the component.
|
setProps(props) |
Use this function to change any of the following supported
properties:
|
When the component is manipulated client side, some functions may
publish event topics for custom AJAX implementations to listen for.
Using the Dojo event system, listen for the refresh event topic using:
<webuijsf:script>
var processEvents =
{
update: function(props) {
//
Do something...
}
}
// Subscribe to refresh event.
dojo.subscribe(webui.suntheme.widget.label.event.<eventname>.endTopic,
processEvents, "update");
</webuijsf:script>
The following events are supported.
webui.suntheme.widget.label.event.refresh.beginTopic | Event topic published before asynchronously refreshing the
component. Supported properties include:
|
webui.suntheme.widget.label.event.refresh.endTopic | Event topic published after asynchronously refreshing the
component. Supported properties include: See setProps() function.
|
webuijsf:label
with for
attribute<webuijsf:label id="label1" text="Label 1:" for="field1" labelLevel="2"/>
<webuijsf:field id="field1" text="#{Bean.value}" type="text" trim="true"/>
webuijsf:label
with labelled component in
tag body<webuijsf:label id="label2" text="Label 2:" labelLevel="2"/>
<webuijsf:field id="field2" text="#{Bean.value}" type="text"
trim="true"/></webuijsf:label>
webuijsf:label
<webuijsf:field id="field3" text="#{Bean.value}" type="text"
trim="true" label="Label 3:" labelLevel="2"/>
<webuijsf:radioButton id="rb1" name="rb1" label="Toggle Label Visible" onClick="toggleVisible()"/><webuijsf:label id="label1" text="My Label" />
<webuijsf:script>
function toggleVisible() {
var domNode = document.getElementById("form1:label1
"); // Get label
return domNode.setProps({visible: !domNode.getProps().visible}); // Toggle visible state
}
</webuijsf:script>
<webuijsf:radioButton id="rb1" name="rb1" label="Refresh Label" onClick="refreshLabel()"/><webuijsf:label id="label1" text="
#{MyBean.text}" />
<webuijsf:script>
function refreshLabel() {
var domNode =
document.getElementById("form1:label1"); // Get label
return domNode.refresh(); //
Asynchronously refresh label
}
</webuijsf:script>
Note that the refresh function can optionally take a list of
elements
to execute. Thus, a comma-separated list of ids can be provided to
update components server-side: refresh("form1:id1,form2:id2,..."). When
no parameter is given, the refresh function acts as a reset.
That is, the component will be redrawn using values set
server-side, but not updated.<webuijsf:label id="label1
" text="#{MyBean.text}"/>
<webuijsf:textField id="field1" text="#{MyBean.text}" label="Change Label"
onKeyPress="setTimeout('refreshLabel();', 0);"/> // Field used to asynchronously update label.
<webuijsf:script>
function
refreshLabel
() {
var domNode =
document.getElementById("form1:label1"); // Get label
return
domNode.refresh("form1:field1"); // Asynchronously refresh while
submitting field value
}
</webuijsf:script>
Note that the refresh function can optionally take a list of
elements
to execute. Thus, a comma-separated list of ids can be provided to
update components server-side: refresh("form1:id1,form2:id2,...")Tag Information | |
Tag Class | com.sun.webui.jsf.component.LabelTag |
TagExtraInfo Class | None |
Body Content | JSP |
Display Name | None |
Attributes | ||||
Name | Required | Request-time | Type | Description |
binding | false | false | java.lang.String | A ValueExpression that resolves to the UIComponent that corresponds to this tag. This attribute allows the Java bean that contains the UIComponent to manipulate the UIComponent, its properties, and its children. |
toolTip | false | false | java.lang.String | Sets the value of the title attribute for the HTML element. The specified text will display as a tooltip if the mouse cursor hovers over the HTML element. |
onMouseDown | false | false | java.lang.String | Scripting code executed when the user presses a mouse button while the mouse pointer is on the component. |
hideIndicators | false | false | java.lang.String | Use the hideIndicators attribute to prevent display of the required and invalid icons with the label. When the required attribute on the component to be labeled is set to true, the required icon is displayed next to the label. If the user submits the page with an invalid value for the component, the invalid icon is displayed. This attribute is useful when the component has more than one label, and only one label should show the icons. |
onMouseOut | false | false | java.lang.String | Scripting code executed when a mouse out movement occurs over this component. |
requiredIndicator | false | false | java.lang.String | Flag indicating that the labeled component should be marked as required. It is only relevant if the labeled component is not a child of the label tag. Set this flag to ensure that the required icon shows up the first time the page is rendered. |
onMouseOver | false | false | java.lang.String | Scripting code executed when the user moves the mouse pointer into the boundary of this component. |
htmlTemplate | false | false | java.lang.String | Alternative HTML template to be used by this component. |
onMouseMove | false | false | java.lang.String | Scripting code executed when the user moves the mouse pointer while over the component. |
onMouseUp | false | false | java.lang.String | Scripting code executed when the user releases a mouse button while the mouse pointer is on the component. |
styleClass | false | false | java.lang.String | CSS style class(es) to be applied to the outermost HTML element when this component is rendered. |
text | false | false | java.lang.String | The label text to be displayed for this label. This attribute
can be set to a literal string, to a value binding expression
that corresponds to a property of a managed bean, or to a value
binding expression that corresponds to a message from a resource
bundle declared using |
visible | false | false | java.lang.String | Use the visible attribute to indicate whether the component should be viewable by the user in the rendered HTML page. If set to false, the HTML code for the component is present in the page, but the component is hidden with style attributes. By default, visible is set to true, so HTML for the component HTML is included and visible to the user. If the component is not visible, it can still be processed on subsequent form submissions because the HTML is present. |
style | false | false | java.lang.String | CSS style(s) to be applied to the outermost HTML element when this component is rendered. |
labelLevel | false | false | java.lang.String | Style level for this label, where lower values typically specify progressively larger font sizes, and/or bolder font weights. Valid values are 1, 2, and 3. The default label level is 2. Any label level outside this range will result in no label level being added. |
onClick | false | false | java.lang.String | Scripting code executed when a mouse click occurs over this component. |
for | false | false | java.lang.String | Use this attribute to specify the labeled component. The value of the attribute is the absolute client id of the component or the id of the component to be labeled. A relative component id may be used only if the labeled component is a sibling of the label. |
converter | false | false | java.lang.String | The converter attribute is used to specify a method to translate native
property values to String and back for this component. The converter
attribute value must be one of the following:
|
rendered | false | false | java.lang.String | Use the rendered attribute to indicate whether the HTML code for the component should be included in the rendered HTML page. If set to false, the rendered HTML page does not include the HTML for the component. If the component is not rendered, it is also not processed on any subsequent form submission. |
id | false | true | java.lang.String | No Description |
Variables | No Variables Defined. |
| |||||||
FRAMES NO FRAMES |