Author: nbelaevski
Date: 2009-09-16 18:07:54 -0400 (Wed, 16 Sep 2009)
New Revision: 15599
Modified:
branches/community/3.3.X/ui/editor/src/main/config/component/editor.xml
branches/community/3.3.X/ui/editor/src/main/templates/editor.jspx
branches/community/3.3.X/ui/editor/src/test/java/org/richfaces/component/EditorComponentTest.java
Log:
https://jira.jboss.org/jira/browse/RF-7040
Modified: branches/community/3.3.X/ui/editor/src/main/config/component/editor.xml
===================================================================
--- branches/community/3.3.X/ui/editor/src/main/config/component/editor.xml 2009-09-16
17:04:15 UTC (rev 15598)
+++ branches/community/3.3.X/ui/editor/src/main/config/component/editor.xml 2009-09-16
22:07:54 UTC (rev 15599)
@@ -197,5 +197,10 @@
<classname>java.lang.String</classname>
<description>A localized user presentable name for this
component.</description>
</property>
+ <property>
+ <name>inputElementType</name>
+ <classname>java.lang.String</classname>
+ <defaultvalue>"textarea"</defaultvalue>
+ </property>
</component>
</components>
Modified: branches/community/3.3.X/ui/editor/src/main/templates/editor.jspx
===================================================================
--- branches/community/3.3.X/ui/editor/src/main/templates/editor.jspx 2009-09-16 17:04:15
UTC (rev 15598)
+++ branches/community/3.3.X/ui/editor/src/main/templates/editor.jspx 2009-09-16 22:07:54
UTC (rev 15599)
@@ -21,11 +21,30 @@
if(shouldRenderTinyMCE(component)) {
]]>
</jsp:scriptlet>
+
+ <jsp:scriptlet>
+ <![CDATA[
+ if
("input".equals(component.getAttributes().get("inputElementType"))) {
+ ]]>
+ </jsp:scriptlet>
+ <input type="text" id="#{clientId}TextArea"
name="#{clientId}TextArea"
+ style="visibility: hidden"
+ value="#{this:getFormattedComponentStringValue(context, component)}" />
+ <jsp:scriptlet>
+ <![CDATA[
+ } else {
+ ]]>
+ </jsp:scriptlet>
+ <textarea id="#{clientId}TextArea" name="#{clientId}TextArea"
+ style="visibility: hidden">
+ #{this:getFormattedComponentStringValue(context, component)}
+ </textarea>
+ <jsp:scriptlet>
+ <![CDATA[
+ }
+ ]]>
+ </jsp:scriptlet>
- <textarea id="#{clientId}TextArea" name="#{clientId}TextArea"
- style="visibility: hidden">
- #{this:getFormattedComponentStringValue(context, component)}
- </textarea>
<script type="text/javascript">
<f:call name="writeEditorCustomPluginsParameters" />
Modified:
branches/community/3.3.X/ui/editor/src/test/java/org/richfaces/component/EditorComponentTest.java
===================================================================
---
branches/community/3.3.X/ui/editor/src/test/java/org/richfaces/component/EditorComponentTest.java 2009-09-16
17:04:15 UTC (rev 15598)
+++
branches/community/3.3.X/ui/editor/src/test/java/org/richfaces/component/EditorComponentTest.java 2009-09-16
22:07:54 UTC (rev 15599)
@@ -155,6 +155,27 @@
assertEquals("Some value", value);
}
+ public void testEditorRenderingInput() throws Exception {
+ editor.getAttributes().put("inputElementType", "input");
+
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ HtmlElement htmlDiv = page.getHtmlElementById(editor
+ .getClientId(facesContext));
+ assertNotNull(htmlDiv);
+ assertEquals(htmlDiv.getTagName(), "div");
+ HtmlElement input = page.getHtmlElementById(editor
+ .getClientId(facesContext)
+ + UIEditor.EDITOR_TEXT_AREA_ID_SUFFIX);
+ assertNotNull(input);
+ assertEquals(input.getTagName(), "input");
+ String style = input.getAttribute("style");
+ assertNotNull(style);
+ assertTrue(style.contains("visibility: hidden"));
+ String value = input.getAttribute("value");
+ assertEquals("Some value", value);
+ }
+
/* (non-Javadoc)
* @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
*/