This checkin implements the "layout" attribute for "panelGroup"
[layout="block" renders a "div" instead of a "span"]
SECTION: Changes
** api **
M doc/panel-group-attrs.xml
-- add "layout" attribute
M doc/standard-html-renderkit-base.xml
-- updated description for panelGroup rendering
** ri **
M src/com/sun/faces/renderkit/html_basic/GroupRenderer.java
-- looks for same conditions as when rendering a span (id, style, or
styleClass present),
but, if "layout" attr is present and value is "block" ---> render
with "div".
M web/test/RenderResponse_correct
-- updated golden file
M web/test/TestRenderResponsePhase.jsp
-- included panelGroup with "layout" attribute
Index: panel-group-attrs.xml
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-api/doc/panel-group-attrs.xml,v
retrieving revision 1.4
diff -u -r1.4 panel-group-attrs.xml
--- panel-group-attrs.xml 8 Nov 2004 19:23:00 -0000 1.4
+++ panel-group-attrs.xml 12 Jan 2005 18:43:18 -0000
@@ -49,4 +49,16 @@
<pass-through>false</pass-through>
</attribute-extension>
</attribute>
-</root>
\ No newline at end of file
+
+ <attribute>
+ <description>
+ The type of layout markup to use when rendering this group.
+ Valid value is "block" that will produce an HTML "div" element.
+ If not specified, an HTML "span" element will be produced.
+ </description>
+ <display-name>Layout</display-name>
+ <icon></icon>
+ <attribute-name>layout</attribute-name>
+ <attribute-class>java.lang.String</attribute-class>
+ </attribute>
+</root>
Index: standard-html-renderkit-base.xml
===================================================================
RCS file:
/cvs/javaserverfaces-sources/jsf-api/doc/standard-html-renderkit-base.
xml,v
retrieving revision 1.2
diff -u -r1.2 standard-html-renderkit-base.xml
--- standard-html-renderkit-base.xml 10 Nov 2004 22:39:07 -0000 1.2
+++ standard-html-renderkit-base.xml 12 Jan 2005 18:43:19 -0000
@@ -1710,10 +1710,14 @@
<description>Intended for use in situations when only one
UIComponent child can be nested, such as in the case of facets.
- If the "style" or "styleClass" attributes are present, render a
- "span" element, outputting the value of the "style" attribute as
- the value of the "style" attribute, and the value of the
- "styleClass" attribute as the value of the "class"
+ If the "style" or "styleClass" attributes are present, and the
"layout"
+ attribute is present with a value of "block", render a "div" element,
+ outputting the value of the "style" attribute as the value of the
+ "style" attribute and the value of the "styleClass" attribute as the
+ value of the "class" attribute. Otherwise, if the "layout" attribute
+ is not present, render a "span" element, outputting the value of the
+ "style" attribute as the value of the "style" attribute, and the
value
+ of the "styleClass" attribute as the value of the "class"
attribute. </description>
<component-family>javax.faces.Panel</component-family>
<renderer-type>javax.faces.Group</renderer-type>
Index: GroupRenderer.java
===================================================================
RCS file:
/cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/renderkit/html_b
asic/GroupRenderer.java,v
retrieving revision 1.22
diff -u -r1.22 GroupRenderer.java
--- GroupRenderer.java 31 Mar 2004 18:48:35 -0000 1.22
+++ GroupRenderer.java 12 Jan 2005 18:45:31 -0000
@@ -91,11 +91,16 @@
// Render a span around this group if necessary
String
style = (String) component.getAttributes().get("style"),
- styleClass = (String)
component.getAttributes().get("styleClass");
+ styleClass = (String)
component.getAttributes().get("styleClass"),
+ layout = (String) component.getAttributes().get("layout");
ResponseWriter writer = context.getResponseWriter();
- if (spanned(component)) {
- writer.startElement("span", component);
+ if (divOrSpan(component)) {
+ if ((layout != null) && (layout.equals("block"))) {
+ writer.startElement("div", component);
+ } else {
+ writer.startElement("span", component);
+ }
writeIdAttributeIfNecessary(context, writer, component);
if (styleClass != null) {
writer.writeAttribute("class", styleClass, "styleClass");
@@ -155,8 +160,13 @@
// Close our span element if necessary
ResponseWriter writer = context.getResponseWriter();
- if (spanned(component)) {
- writer.endElement("span");
+ String layout = (String)component.getAttributes().get("layout");
+ if (divOrSpan(component)) {
+ if ((layout != null) && (layout.equals("block"))) {
+ writer.endElement("div");
+ } else {
+ writer.endElement("span");
+ }
}
if (log.isTraceEnabled()) {
log.trace("End encoding component " +
@@ -167,11 +177,11 @@
/**
- * <p>Return true if we need to render a span element around this
group.
+ * <p>Return true if we need to render a div or span element around
this gr
oup.
*
* @param component <code>UIComponent</code> for this group
*/
- private boolean spanned(UIComponent component) {
+ private boolean divOrSpan(UIComponent component) {
if (shouldWriteIdAttribute(component) ||
(component.getAttributes().get("style") != null) ||
(component.getAttributes().get("styleClass") != null)) {
Index: TestRenderResponsePhase.jsp
===================================================================
RCS file:
/cvs/javaserverfaces-sources/jsf-ri/web/test/TestRenderResponsePhase.j
sp,v
retrieving revision 1.84
diff -u -r1.84 TestRenderResponsePhase.jsp
--- TestRenderResponsePhase.jsp 12 Nov 2004 18:00:28 -0000 1.84
+++ TestRenderResponsePhase.jsp 12 Jan 2005 18:47:14 -0000
@@ -658,6 +658,14 @@
</td>
</tr>
+<tr>
+<td>
+<h:panelGroup layout="block" style="color:red" styleClass="walleye">
+ <f:verbatim>style this text like a red walleye</f:verbatim>
+</h:panelGroup>
+</td>
+</tr>
+
<h:inputHidden value="48%" >
<f:convertNumber type="number" pattern="#%"/>
</h:inputHidden>
Index: RenderResponse_correct
===================================================================
RCS file:
/cvs/javaserverfaces-sources/jsf-ri/web/test/RenderResponse_correct,v
retrieving revision 1.113
diff -u -r1.113 RenderResponse_correct
--- RenderResponse_correct 14 Dec 2004 21:08:56 -0000 1.113
+++ RenderResponse_correct 12 Jan 2005 18:49:35 -0000
@@ -15,7 +15,7 @@
-<form id="basicForm" method="post"
action="/test/faces/TestRenderResponsePhase.
jsp;jsessionid=E8C22D1F61AAFB3BEB4875553F897B85" class="formClass"
accept-charse
t="some-charset" accept="html,wml"
enctype="application/x-www-form-urlencoded" t
arget="_self" title="basicForm">
+<form id="basicForm" method="post"
action="/test/faces/TestRenderResponsePhase.
jsp;jsessionid=676E0FBF879741B55500B45B856C6622" class="formClass"
accept-charse
t="some-charset" accept="html,wml"
enctype="application/x-www-form-urlencoded" t
arget="_self" title="basicForm">
<TABLE BORDER="1">
@@ -130,12 +130,12 @@
- <a id="basicForm:imageLink" href="#" style="someStyle"
onclick="c
learFormHiddenParams_basicForm('basicForm');document.forms['basicForm']['basicFo
rm:_idcl'].value='basicForm:imageLink';
document.forms['basicForm'].submit(); re
turn false;"><img
src="duke.gif;jsessionid=E8C22D1F61AAFB3BEB4875553F897B85" /><
/a>
+ <a id="basicForm:imageLink" href="#" style="someStyle"
onclick="c
learFormHiddenParams_basicForm('basicForm');document.forms['basicForm']['basicFo
rm:_idcl'].value='basicForm:imageLink';
document.forms['basicForm'].submit(); re
turn false;"><img
src="duke.gif;jsessionid=676E0FBF879741B55500B45B856C6622" /><
/a>
</TD>
<TD>
- <img id="basicForm:graphicImage"
src="/test/duke.gif;jsessionid=E8C
22D1F61AAFB3BEB4875553F897B85" style="someStyle" usemap="#map1"
ismap="ismap" />
+ <img id="basicForm:graphicImage"
src="/test/duke.gif;jsessionid=676
E0FBF879741B55500B45B856C6622" style="someStyle" usemap="#map1"
ismap="ismap" />
</TD>
</TR>
@@ -169,7 +169,7 @@
Index: RenderResponse_correct
===================================================================
RCS file:
/cvs/javaserverfaces-sources/jsf-ri/web/test/RenderResponse_correct,v
retrieving revision 1.113
diff -u -r1.113 RenderResponse_correct
--- RenderResponse_correct 14 Dec 2004 21:08:56 -0000 1.113
+++ RenderResponse_correct 12 Jan 2005 18:49:35 -0000
@@ -15,7 +15,7 @@
-<form id="basicForm" method="post"
action="/test/faces/TestRenderResponsePhase.
jsp;jsessionid=E8C22D1F61AAFB3BEB4875553F897B85" class="formClass"
accept-charse
t="some-charset" accept="html,wml"
enctype="application/x-www-form-urlencoded" t
arget="_self" title="basicForm">
+<form id="basicForm" method="post"
action="/test/faces/TestRenderResponsePhase.
jsp;jsessionid=676E0FBF879741B55500B45B856C6622" class="formClass"
accept-charse
t="some-charset" accept="html,wml"
enctype="application/x-www-form-urlencoded" t
arget="_self" title="basicForm">
<TABLE BORDER="1">
@@ -130,12 +130,12 @@
- <a id="basicForm:imageLink" href="#" style="someStyle"
onclick="c
learFormHiddenParams_basicForm('basicForm');document.forms['basicForm']['basicFo
rm:_idcl'].value='basicForm:imageLink';
document.forms['basicForm'].submit(); re
turn false;"><img
src="duke.gif;jsessionid=E8C22D1F61AAFB3BEB4875553F897B85" /><
/a>
+ <a id="basicForm:imageLink" href="#" style="someStyle"
onclick="c
learFormHiddenParams_basicForm('basicForm');document.forms['basicForm']['basicFo
rm:_idcl'].value='basicForm:imageLink';
document.forms['basicForm'].submit(); re
turn false;"><img
src="duke.gif;jsessionid=676E0FBF879741B55500B45B856C6622" /><
/a>
</TD>
<TD>
- <img id="basicForm:graphicImage"
src="/test/duke.gif;jsessionid=E8C
22D1F61AAFB3BEB4875553F897B85" style="someStyle" usemap="#map1"
ismap="ismap" />
+ <img id="basicForm:graphicImage"
src="/test/duke.gif;jsessionid=676
E0FBF879741B55500B45B856C6622" style="someStyle" usemap="#map1"
ismap="ismap" />
</TD>
</TR>
@@ -169,7 +169,7 @@
- <a id="basicForm:hrefParamLink" href="#"
onclick="clearFormHiddenPa
rams_basicForm('basicForm');document.forms['basicForm']['basicForm:_idcl'].value
='basicForm:hrefParamLink';document.forms['basicForm']['name'].value='horwat';do
cument.forms['basicForm']['value'].value='password';
document.forms['basicForm']
.target='_top'; document.forms['basicForm'].submit(); return
false;"><img src="d
uke.gif;jsessionid=E8C22D1F61AAFB3BEB4875553F897B85" /></a>
+ <a id="basicForm:hrefParamLink" href="#"
onclick="clearFormHiddenPa
rams_basicForm('basicForm');document.forms['basicForm']['basicForm:_idcl'].value
='basicForm:hrefParamLink';document.forms['basicForm']['name'].value='horwat';do
cument.forms['basicForm']['value'].value='password';
document.forms['basicForm']
.target='_top'; document.forms['basicForm'].submit(); return
false;"><img src="d
uke.gif;jsessionid=676E0FBF879741B55500B45B856C6622" /></a>
</TD>
</TR>
@@ -177,7 +177,7 @@
<TD>
- <a id="basicForm:outputLink"
href="test.html;jsessionid=E8C22D1F61
AAFB3BEB4875553F897B85" class="hyperlinkClass">output link text</a>
+ <a id="basicForm:outputLink"
href="test.html;jsessionid=676E0FBF87
9741B55500B45B856C6622" class="hyperlinkClass">output link text</a>
</TD>
@@ -189,12 +189,12 @@
- <a id="basicForm:output_imageLink"
href="test.html;jsessionid=E8C
22D1F61AAFB3BEB4875553F897B85" style="position: absolute; left: 96px;
top: 168px
"><img src="duke.gif;jsessionid=E8C22D1F61AAFB3BEB4875553F897B85" /></a>
+ <a id="basicForm:output_imageLink"
href="test.html;jsessionid=676
E0FBF879741B55500B45B856C6622" style="position: absolute; left: 96px;
top: 168px
"><img src="duke.gif;jsessionid=676E0FBF879741B55500B45B856C6622" /></a>
</TD>
<TD>
- <img id="basicForm:output_graphicImage"
src="/test/duke.gif;jsessio
nid=E8C22D1F61AAFB3BEB4875553F897B85" usemap="#map1" ismap="ismap" />
+ <img id="basicForm:output_graphicImage"
src="/test/duke.gif;jsessio
nid=676E0FBF879741B55500B45B856C6622" usemap="#map1" ismap="ismap" />
</TD>
</TR>
@@ -202,7 +202,7 @@
<TR>
<TD>
- <a id="basicForm:output_commandLink"
href="test.html;jsessionid=E8C
22D1F61AAFB3BEB4875553F897B85" style="position: absolute; left: 96px;
top: 168px
" class="hyperlinkClass">link text</a>
+ <a id="basicForm:output_commandLink"
href="test.html;jsessionid=676
E0FBF879741B55500B45B856C6622" style="position: absolute; left: 96px;
top: 168px
" class="hyperlinkClass">link text</a>
</TD>
</TR>
@@ -212,13 +212,13 @@
- <a id="basicForm:output_commandParamLink"
href="test.html;jsessioni
d=E8C22D1F61AAFB3BEB4875553F897B85?name=horwat&value=password"
class="hyperlinkC
lass">link text</a>
+ <a id="basicForm:output_commandParamLink"
href="test.html;jsessioni
d=676E0FBF879741B55500B45B856C6622?name=horwat&value=password"
class="hyperlinkC
lass">link text</a>
</TD>
</TR>
<TR>
<TD>
- <a id="basicForm:output_hrefLink"
href="test.html;jsessionid=E8C22D
1F61AAFB3BEB4875553F897B85"><img src="duke.gif"></a>
+ <a id="basicForm:output_hrefLink"
href="test.html;jsessionid=676E0F
BF879741B55500B45B856C6622"><img src="duke.gif"></a>
</TD>
</TR>
@@ -228,7 +228,7 @@
- <a id="basicForm:output_hrefParamLink"
href="test.html;jsessionid=E
8C22D1F61AAFB3BEB4875553F897B85?name=horwat&value=password"><img
src="duke.gif;j
sessionid=E8C22D1F61AAFB3BEB4875553F897B85" /></a>
+ <a id="basicForm:output_hrefParamLink"
href="test.html;jsessionid=6
76E0FBF879741B55500B45B856C6622?name=horwat&value=password"><img
src="duke.gif;j
sessionid=676E0FBF879741B55500B45B856C6622" /></a>
</TD>
</TR>
@@ -715,9 +715,17 @@
</td>
</tr>
+<tr>
+<td>
+
+
+<div class="walleye" style="color:red">style this text like a red
walleye</div>
+</td>
+</tr>
+
-<input type="hidden" name="basicForm:_id80" value="48%" />
+<input type="hidden" name="basicForm:_id82" value="48%" />
<tr><td>
@@ -851,9 +859,9 @@
<!--
function clearFormHiddenParams_basicForm(curFormName) {
var curForm = document.forms[curFormName];
+ curForm.elements['basicForm:_id82'].value = null;
curForm.elements['value'].value = null;
curForm.elements['basicForm:_idcl'].value = null;
- curForm.elements['basicForm:_id80'].value = null;
curForm.elements['name'].value = null;
curForm.target='_self';
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_javaserverfaces.dev.java.net
For additional commands, e-mail: dev-help_at_javaserverfaces.dev.java.net