You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2020/04/23 09:53:31 UTC
[myfaces-tobago] 03/08: Tobago-1999: enable inline rendering of
selectOneChoice
This is an automated email from the ASF dual-hosted git repository.
weber pushed a commit to branch TOBAGO-1999_Select2
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git
commit 5efb1cb8f3e2bd128cf2384cfacbf14aa8ad0ecb
Author: Volker Weber <v....@inexso.de>
AuthorDate: Fri Feb 14 10:34:11 2020 +0100
Tobago-1999: enable inline rendering of selectOneChoice
---
.../src/main/webapp/content/01-basic/00/input.xhtml | 3 +++
.../main/webapp/content/25-select/00-select2/select2.xhtml | 14 +++++++++++++-
.../src/main/webapp/content/25-select/select.xhtml | 13 ++++++++++++-
.../standard/standard/tag/SelectOneChoiceRenderer.java | 4 ++--
4 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/01-basic/00/input.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/01-basic/00/input.xhtml
index e267e6c..e7c898d 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/01-basic/00/input.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/01-basic/00/input.xhtml
@@ -70,6 +70,9 @@
value="Some Text"/>
<tc:panel>
+ <f:facet name="layout">
+ <tc:flowLayout/>
+ </f:facet>
<tc:out value="An input field is "/>
<tc:in value="here" inline="true"/>
<tc:out value=" inside of a floating text."/>
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/25-select/00-select2/select2.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/25-select/00-select2/select2.xhtml
index d5febd3..b113a85 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/25-select/00-select2/select2.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/25-select/00-select2/select2.xhtml
@@ -25,7 +25,7 @@
<ui:param name="title" value="Select2 Controls"/>
<tc:panel>
<f:facet name="layout">
- <tc:gridLayout rows="auto;auto;auto;*;auto"/>
+ <tc:gridLayout rows="auto;auto;25px;auto;*;auto"/>
</f:facet>
<tc:panel>
@@ -97,6 +97,18 @@
</tc:panel>
</tc:panel>
+ <tc:panel>
+ <f:facet name="layout">
+ <tc:flowLayout/>
+ </f:facet>
+ <tc:out value="You can use a tc:selectOneChoice like this "/>
+ <tc:selectOneChoice value="#{reference.manufacturer}"
+ select2="true">
+ <f:selectItems value="#{reference.manufacturerSelectItems}"/>
+ </tc:selectOneChoice>
+ <tc:out value=" inside of a floating text."/>
+ </tc:panel>
+
<tc:panel>
<f:facet name="layout">
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/25-select/select.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/25-select/select.xhtml
index b315d6b..4d6be38 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/25-select/select.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/25-select/select.xhtml
@@ -26,7 +26,7 @@
<tc:panel>
<f:facet name="layout">
<tc:gridLayout
- rows="auto;auto;auto;auto;auto;auto;45px;45px;auto;auto;auto;200px;200px;auto;auto;auto;auto;auto;*;auto"/>
+ rows="auto;auto;auto;auto;auto;auto;45px;45px;auto;auto;auto;25px;200px;200px;auto;auto;auto;auto;auto;*;auto"/>
</f:facet>
<!-- code-sniplet-start id="selectBooleanCheckbox" -->
@@ -91,6 +91,17 @@
<f:selectItems value="#{reference.manufacturerSelectItems}"/>
</tx:selectOneChoice>
+ <tc:panel>
+ <f:facet name="layout">
+ <tc:flowLayout/>
+ </f:facet>
+ <tc:out value="You can use a tc:selectOneChoice like this "/>
+ <tc:selectOneChoice value="#{reference.manufacturer}">
+ <f:selectItems value="#{reference.manufacturerSelectItems}"/>
+ </tc:selectOneChoice>
+ <tc:out value=" inside of a floating text."/>
+ </tc:panel>
+
<!-- code-sniplet-start id="selectOneListbox" -->
<tx:selectOneListbox label="Contact via: ">
<f:selectItem itemValue="Phone" itemLabel="Phone"/>
diff --git a/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneChoiceRenderer.java b/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneChoiceRenderer.java
index c1963b3..8035747 100644
--- a/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneChoiceRenderer.java
+++ b/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneChoiceRenderer.java
@@ -89,7 +89,7 @@ public class SelectOneChoiceRenderer extends SelectOneRendererBase {
LOG.trace("Select2 json = \"{}\"", json);
ComponentUtils.putDataAttribute(select, "tobago-select2", json);
- writer.startElement(HtmlElements.DIV, select);
+ writer.startElement(HtmlElements.SPAN, select);
writer.writeStyleAttribute(style);
style.setTop(Measure.ZERO);
style.setLeft(Measure.ZERO);
@@ -130,7 +130,7 @@ public class SelectOneChoiceRenderer extends SelectOneRendererBase {
writer.endElement(HtmlElements.SELECT);
if (renderAsSelect2) {
- writer.endElement(HtmlElements.DIV);
+ writer.endElement(HtmlElements.SPAN);
}
super.encodeEnd(facesContext, select);