Author: alevkovsky
Date: 2008-09-19 08:13:17 -0400 (Fri, 19 Sep 2008)
New Revision: 10502
Added:
trunk/sandbox/samples/editor-sample/src/main/webapp/pages/
trunk/sandbox/samples/editor-sample/src/main/webapp/pages/editor.jsp
Removed:
trunk/sandbox/samples/editor-sample/src/main/webapp/editor.xhtml
Modified:
trunk/sandbox/samples/editor-sample/src/main/webapp/WEB-INF/web.xml
trunk/sandbox/samples/editor-sample/src/main/webapp/index.jsp
trunk/sandbox/ui/editor/src/main/config/component/editor.xml
trunk/sandbox/ui/editor/src/main/java/org/richfaces/component/UIEditor.java
trunk/sandbox/ui/editor/src/main/java/org/richfaces/renderkit/EditorRendererBase.java
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/css/editor.xcss
trunk/sandbox/ui/editor/src/main/templates/editor.jspx
Log:
Add type attribute to Editor
Modified: trunk/sandbox/samples/editor-sample/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/sandbox/samples/editor-sample/src/main/webapp/WEB-INF/web.xml 2008-09-19
09:58:47 UTC (rev 10501)
+++ trunk/sandbox/samples/editor-sample/src/main/webapp/WEB-INF/web.xml 2008-09-19
12:13:17 UTC (rev 10502)
@@ -1,44 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
- <description>Richfaces Panel Sample</description>
- <display-name>panel-sample</display-name>
+ <description>Richfaces Editor Sample</description>
+ <display-name>editor-sample</display-name>
<context-param>
-<param-name>com.exadel.vcp.SKIN</param-name>
-<param-value>#{skinBean.skin}</param-value>
-</context-param>
- <context-param>
- <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
- <param-value>.xhtml</param-value>
- </context-param>
- <context-param>
- <param-name>facelets.REFRESH_PERIOD</param-name>
- <param-value>2</param-value>
- </context-param>
- <context-param>
- <param-name>facelets.DEVELOPMENT</param-name>
- <param-value>true</param-value>
- </context-param>
- <context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
- <param-value>client</param-value>
+ <param-value>server</param-value>
</context-param>
<context-param>
- <param-name>com.sun.faces.validateXml</param-name>
- <param-value>true</param-value>
- </context-param>
- <context-param>
- <param-name>com.sun.faces.verifyObjects</param-name>
- <param-value>true</param-value>
- </context-param>
- <context-param>
<param-name>org.ajax4jsf.SKIN</param-name>
<param-value>#{skinBean.skin}</param-value>
</context-param>
- <context-param>
- <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
- <param-value>com.sun.facelets.FaceletViewHandler</param-value>
- </context-param>
<filter>
<display-name>Ajax4jsf Filter</display-name>
<filter-name>ajax4jsf</filter-name>
Deleted: trunk/sandbox/samples/editor-sample/src/main/webapp/editor.xhtml
===================================================================
(Binary files differ)
Modified: trunk/sandbox/samples/editor-sample/src/main/webapp/index.jsp
===================================================================
--- trunk/sandbox/samples/editor-sample/src/main/webapp/index.jsp 2008-09-19 09:58:47 UTC
(rev 10501)
+++ trunk/sandbox/samples/editor-sample/src/main/webapp/index.jsp 2008-09-19 12:13:17 UTC
(rev 10502)
@@ -2,6 +2,6 @@
<html>
<head></head>
<body>
- <jsp:forward page="editor.jsf" />
+ <jsp:forward page="/pages/editor.jsf" />
</body>
</html>
\ No newline at end of file
Added: trunk/sandbox/samples/editor-sample/src/main/webapp/pages/editor.jsp
===================================================================
--- trunk/sandbox/samples/editor-sample/src/main/webapp/pages/editor.jsp
(rev 0)
+++ trunk/sandbox/samples/editor-sample/src/main/webapp/pages/editor.jsp 2008-09-19
12:13:17 UTC (rev 10502)
@@ -0,0 +1,20 @@
+<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib
uri="http://labs.jboss.com/jbossrichfaces/ui/ui/editor"
prefix="ed" %>
+<%@ taglib
uri="http://richfaces.org/a4j" prefix="a4j" %>
+<html>
+ <head>
+ <title></title>
+ </head>
+ <body>
+ <f:view >
+
+ <h:form>
+ <ed:editor id="editor_id" >
+ <f:param name="mode" value="textareas"/>
+ </ed:editor>
+ <h:commandButton value="Submit"/>
+ </h:form>
+ </f:view>
+ </body>
+</html>
Property changes on: trunk/sandbox/samples/editor-sample/src/main/webapp/pages/editor.jsp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/sandbox/ui/editor/src/main/config/component/editor.xml
===================================================================
--- trunk/sandbox/ui/editor/src/main/config/component/editor.xml 2008-09-19 09:58:47 UTC
(rev 10501)
+++ trunk/sandbox/ui/editor/src/main/config/component/editor.xml 2008-09-19 12:13:17 UTC
(rev 10502)
@@ -21,25 +21,18 @@
org.ajax4jsf.webapp.taglib.HtmlComponentTagBase
</superclass>
<test>
- </test>
-
+ </test>
</tag>
&ui_component_attributes;
&html_events;
&html_style_attributes;
- <property>
- <name>headerClass</name>
+ <property hidden="true">
+ <name>type</name>
<classname>java.lang.String</classname>
<description>
- A class that defines a style for a panel header
+ Sets editor type
</description>
+ <defaultvalue>"TinyMCE"</defaultvalue>
</property>
- <property>
- <name>bodyClass</name>
- <classname>java.lang.String</classname>
- <description>
- A class that defines a style for a panel content
- </description>
- </property>
</component>
</components>
Modified: trunk/sandbox/ui/editor/src/main/java/org/richfaces/component/UIEditor.java
===================================================================
--- trunk/sandbox/ui/editor/src/main/java/org/richfaces/component/UIEditor.java 2008-09-19
09:58:47 UTC (rev 10501)
+++ trunk/sandbox/ui/editor/src/main/java/org/richfaces/component/UIEditor.java 2008-09-19
12:13:17 UTC (rev 10502)
@@ -18,7 +18,11 @@
public static final String COMPONENT_TYPE = "org.richfaces.Editor";
public static final String COMPONENT_FAMILY = "org.richfaces.Editor";
+
+ public abstract void setType(String type);
+ public abstract String getType();
+
public boolean getRendersChildren() {
return true;
}
Modified:
trunk/sandbox/ui/editor/src/main/java/org/richfaces/renderkit/EditorRendererBase.java
===================================================================
---
trunk/sandbox/ui/editor/src/main/java/org/richfaces/renderkit/EditorRendererBase.java 2008-09-19
09:58:47 UTC (rev 10501)
+++
trunk/sandbox/ui/editor/src/main/java/org/richfaces/renderkit/EditorRendererBase.java 2008-09-19
12:13:17 UTC (rev 10502)
@@ -21,7 +21,6 @@
package org.richfaces.renderkit;
import java.io.IOException;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -31,35 +30,37 @@
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import org.richfaces.component.UIEditor;
import org.ajax4jsf.javascript.ScriptUtils;
import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
+import org.richfaces.component.UIEditor;
/**
* @author Pavel Yaschenko - mailto:pyaschenko@exadel.com created 09.17.2008
*
*/
public class EditorRendererBase extends HeaderResourcesRendererBase {
- @Override
- protected Class<? extends UIComponent> getComponentClass() {
- // TODO Auto-generated method stub
- return UIEditor.class;
- }
-
- public void writeEditorScript(FacesContext context,
- UIComponent component) throws IOException {
+ @Override
+ protected Class<? extends UIComponent> getComponentClass() {
+ return UIEditor.class;
+ }
- ResponseWriter writer = context.getResponseWriter();
- List <UIComponent> children = component.getChildren();
- Map<String, Object> params = new HashMap<String, Object>();
- for (UIComponent child: children) {
- UIParameter c = (UIParameter) child;
- if (c instanceof UIParameter) {
- params.put(c.getName(), c.getValue());
- }
- }
- writer.writeText("tinyMCE.init(",null);
- writer.writeText(ScriptUtils.toScript(params),null);
- writer.writeText(");",null);
+ public void writeEditorScript(FacesContext context, UIEditor component) throws
IOException {
+
+ ResponseWriter writer = context.getResponseWriter();
+ List<UIComponent> children = component.getChildren();
+ Map<String, Object> params = new HashMap<String, Object>();
+ for (UIComponent child : children) {
+ UIParameter c = (UIParameter) child;
+ if (c instanceof UIParameter) {
+ params.put(c.getName(), c.getValue());
+ }
}
+ if (component.getType() != null &&
component.getType().equalsIgnoreCase("TinyMCE")) {
+ writer.writeText("tinyMCE.init(", null);
+ writer.writeText(ScriptUtils.toScript(params), null);
+ writer.writeText(");", null);
+ } else {
+ // TODO add supporting for other types
+ }
+ }
}
Modified:
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/css/editor.xcss
===================================================================
---
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/css/editor.xcss 2008-09-19
09:58:47 UTC (rev 10501)
+++
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/css/editor.xcss 2008-09-19
12:13:17 UTC (rev 10502)
@@ -6,8 +6,7 @@
<f:verbatim>
- .rich-editor{
- width: 100%;
+ .rich-editor{
}
</f:verbatim>
Modified: trunk/sandbox/ui/editor/src/main/templates/editor.jspx
===================================================================
--- trunk/sandbox/ui/editor/src/main/templates/editor.jspx 2008-09-19 09:58:47 UTC (rev
10501)
+++ trunk/sandbox/ui/editor/src/main/templates/editor.jspx 2008-09-19 12:13:17 UTC (rev
10502)
@@ -11,21 +11,20 @@
component="org.richfaces.component.UIEditor">
<f:clientid var="clientId"/>
- <h:styles>css/editor.xcss</h:styles>
- <div id="#{clientId}"
x:passThruWithExclusions="id,value,styleClass,class" class="rich-editor
#{component.attributes['styleClass']}">
+ <h:styles>css/editor.xcss</h:styles>
+ <div id="#{clientId}"
x:passThruWithExclusions="id,value,styleClass,class" class="rich-editor
#{component.attributes['styleClass']}">
- <script type="text/javascript">
- <f:call name="writeEditorScript"></f:call>
- </script>
-
-
- <textarea id="elm1" name="elm1" rows="15"
cols="80" style="width: 100%">
- <p>Some paragraph</p>
- <p>Some other paragraph</p>
- <p>Some <b>element</b>, this is to be editor
1. <br /> This editor instance has a 100% width to it.
- <p>Some paragraph. <a
href="http://www.sourceforge.net">Some
link</a></p>
- <img src="logo.jpg">
- </textarea>
+ <script type="text/javascript">
+ <f:call name="writeEditorScript"></f:call>
+ </script>
+
+
+ <textarea id="elm1" name="elm1" rows="15"
cols="80" style="width: 100%">
+ <p>Some paragraph</p>
+ <p>Some other paragraph</p>
+ <p>Some <b>element</b>, this is to be editor
1. <br /> This editor instance has a 100% width to it.
+ <p>Some paragraph. <a
href="http://www.sourceforge.net">Some
link</a></p>
+ </textarea>
</div>
</f:root>