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:25 UTC
[myfaces-tobago] branch main 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 main
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git
The following commit(s) were added to refs/heads/main by this push:
new 7c40d402fe feature: custom body for tc:link/tc:button
7c40d402fe is described below
commit 7c40d402fe2b035690a2e15dc85d4874a0ce9921
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 6d20b5f073..92bbac9027 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
@@ -142,7 +142,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);