You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by hn...@apache.org on 2023/04/12 13:58:22 UTC
[myfaces-tobago] branch tobago-5.x updated: feature: custom body for tc:link/tc:button
This is an automated email from the ASF dual-hosted git repository.
hnoeth pushed a commit to branch tobago-5.x
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git
The following commit(s) were added to refs/heads/tobago-5.x by this push:
new b40975a88a feature: custom body for tc:link/tc:button
b40975a88a is described below
commit b40975a88aba3d02f30d4126eddafc0b82282b6d
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Wed Apr 12 15:42:24 2023 +0200
feature: custom body for tc:link/tc:button
Add a label facet to tc:link and tc:button. If the label facet is used, the label attribute has no meaning and the content of the label facet is rendered inside the link/button.
Issue: TOBAGO-2203
---
.../tobago/internal/renderkit/renderer/CommandRendererBase.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/CommandRendererBase.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/CommandRendererBase.java
index 136cb0a99e..bb65b45951 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/CommandRendererBase.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/CommandRendererBase.java
@@ -141,7 +141,14 @@ public abstract class CommandRendererBase<T extends AbstractUICommand> extends D
final String image = component.getImage();
HtmlRendererUtils.encodeIconOrImage(writer, image);
- if (label.getLabel() != null) {
+ final UIComponent labelFacet = ComponentUtils.getFacet(component, Facets.label);
+ if (labelFacet != null) {
+ insideBegin(facesContext, Facets.label);
+ for (final UIComponent child : RenderUtils.getFacetChildren(labelFacet)) {
+ child.encodeAll(facesContext);
+ }
+ insideEnd(facesContext, Facets.label);
+ } else if (label.getLabel() != null) {
writer.startElement(HtmlElements.SPAN);
HtmlRendererUtils.writeLabelWithAccessKey(writer, label);
writer.endElement(HtmlElements.SPAN);