[seam-commits] Seam SVN: r9247 - in trunk: examples/ui/view and 3 other directories.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Thu Oct 9 16:13:25 EDT 2008
Author: danielc.roth
Date: 2008-10-09 16:13:24 -0400 (Thu, 09 Oct 2008)
New Revision: 9247
Added:
trunk/examples/ui/src/org/jboss/seam/example/ui/SpanTitle.java
trunk/ui/src/main/java/org/jboss/seam/ui/component/UISpan.java
Modified:
trunk/examples/ui/view/template.xhtml
trunk/ui/src/main/config/component/span.xml
trunk/ui/src/main/java/org/jboss/seam/ui/renderkit/SpanRendererBase.java
Log:
JBSEAM-3140
Added: trunk/examples/ui/src/org/jboss/seam/example/ui/SpanTitle.java
===================================================================
--- trunk/examples/ui/src/org/jboss/seam/example/ui/SpanTitle.java (rev 0)
+++ trunk/examples/ui/src/org/jboss/seam/example/ui/SpanTitle.java 2008-10-09 20:13:24 UTC (rev 9247)
@@ -0,0 +1,16 @@
+package org.jboss.seam.example.ui;
+
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Unwrap;
+
+ at Name("spanTitle")
+public class SpanTitle
+{
+
+ @Unwrap
+ public String unwrap()
+ {
+ return "A Span title";
+ }
+
+}
Modified: trunk/examples/ui/view/template.xhtml
===================================================================
--- trunk/examples/ui/view/template.xhtml 2008-10-09 14:04:56 UTC (rev 9246)
+++ trunk/examples/ui/view/template.xhtml 2008-10-09 20:13:24 UTC (rev 9247)
@@ -101,6 +101,11 @@
<li><s:link view="/equalityValidator.xhtml">
<code>s:validateEquality</code>
</s:link></li>
+
+ <li><s:span title="#{spanTitle}" style="font-weight:bold">
+ <code>s:span</code>
+ </s:span>
+ </li>
</ul>
</s:div>
Modified: trunk/ui/src/main/config/component/span.xml
===================================================================
--- trunk/ui/src/main/config/component/span.xml 2008-10-09 14:04:56 UTC (rev 9246)
+++ trunk/ui/src/main/config/component/span.xml 2008-10-09 20:13:24 UTC (rev 9247)
@@ -5,7 +5,7 @@
<name>org.jboss.seam.ui.Span</name>
<family>org.jboss.seam.ui.Span</family>
<classname>org.jboss.seam.ui.component.html.HtmlSpan</classname>
- <superclass>org.jboss.seam.ui.component.UIStyle</superclass>
+ <superclass>org.jboss.seam.ui.component.UISpan</superclass>
<description>
<![CDATA[Render a HTML <span>]]>
</description>
@@ -22,5 +22,10 @@
</tag>
&ui_component_attributes;
&html_style_attributes;
+ <property>
+ <name>title</name>
+ <classname>java.lang.String</classname>
+ <description>Span title attribute</description>
+ </property>
</component>
</components>
Added: trunk/ui/src/main/java/org/jboss/seam/ui/component/UISpan.java
===================================================================
--- trunk/ui/src/main/java/org/jboss/seam/ui/component/UISpan.java (rev 0)
+++ trunk/ui/src/main/java/org/jboss/seam/ui/component/UISpan.java 2008-10-09 20:13:24 UTC (rev 9247)
@@ -0,0 +1,10 @@
+package org.jboss.seam.ui.component;
+
+public abstract class UISpan extends UIStyle
+{
+
+ public abstract String getTitle();
+
+ public abstract void setTitle(String title);
+
+}
Modified: trunk/ui/src/main/java/org/jboss/seam/ui/renderkit/SpanRendererBase.java
===================================================================
--- trunk/ui/src/main/java/org/jboss/seam/ui/renderkit/SpanRendererBase.java 2008-10-09 14:04:56 UTC (rev 9246)
+++ trunk/ui/src/main/java/org/jboss/seam/ui/renderkit/SpanRendererBase.java 2008-10-09 20:13:24 UTC (rev 9247)
@@ -2,8 +2,11 @@
import java.io.IOException;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
+import org.jboss.seam.ui.component.UISpan;
import org.jboss.seam.ui.component.UIStyle;
public class SpanRendererBase extends StyleRendererBase
@@ -12,7 +15,7 @@
@Override
protected Class getComponentClass()
{
- return UIStyle.class;
+ return UISpan.class;
}
@Override
@@ -22,6 +25,31 @@
}
@Override
+ protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException
+ {
+ UISpan span = (UISpan) component;
+
+ startElement(writer, span);
+
+ writer.writeAttribute("id", component.getClientId(context), "id");
+
+ if (span.getStyleClass() != null)
+ {
+ writer.writeAttribute("class", span.getStyleClass(), "styleClass");
+ }
+
+ if (span.getStyle() != null)
+ {
+ writer.writeAttribute("style", span.getStyle(), "style");
+ }
+
+ if (span.getTitle() != null)
+ {
+ writer.writeAttribute("title", span.getTitle(), "title");
+ }
+ }
+
+ @Override
public void startElement(ResponseWriter writer, UIStyle style) throws IOException
{
writer.startElement("span", style);
More information about the seam-commits
mailing list