Author: pyaschenko
Date: 2008-11-18 06:38:40 -0500 (Tue, 18 Nov 2008)
New Revision: 11202
Added:
trunk/sandbox/samples/editor-sample/src/main/java/org/richfaces/MiracleBean.java
trunk/sandbox/samples/editor-sample/src/main/webapp/pages/miracle-editor.jsp
Modified:
trunk/sandbox/samples/editor-sample/src/main/webapp/WEB-INF/faces-config.xml
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/editor.js
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/tiny_mce/themes/advanced/skins/richfaces/ui.xcss
Log:
miracleBean added & some css fixes
Added: trunk/sandbox/samples/editor-sample/src/main/java/org/richfaces/MiracleBean.java
===================================================================
--- trunk/sandbox/samples/editor-sample/src/main/java/org/richfaces/MiracleBean.java
(rev 0)
+++
trunk/sandbox/samples/editor-sample/src/main/java/org/richfaces/MiracleBean.java 2008-11-18
11:38:40 UTC (rev 11202)
@@ -0,0 +1,119 @@
+package org.richfaces;
+
+import java.beans.BeanInfo;
+import java.beans.IntrospectionException;
+import java.beans.PropertyDescriptor;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIInput;
+import javax.faces.component.html.HtmlCommandButton;
+import javax.faces.component.html.HtmlInputText;
+import javax.faces.component.html.HtmlOutputLabel;
+import javax.faces.component.html.HtmlPanelGrid;
+import javax.faces.component.html.HtmlSelectBooleanCheckbox;
+import javax.faces.context.FacesContext;
+
+
+public class MiracleBean {
+
+ private UIComponent component;
+
+ private UIComponent containerComponent;
+
+ private Map<String, Object> values = new HashMap<String, Object>();
+
+ public UIComponent getComponent() {
+ return component;
+ }
+
+ public void setComponent(UIComponent component) {
+ this.component = component;
+ }
+
+ public UIComponent getContainerComponent() {
+ if (containerComponent == null) {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ containerComponent = new HtmlPanelGrid();
+
+ List<UIComponent> children = containerComponent.getChildren();
+ children.clear();
+
+ try {
+ BeanInfo beanInfo = java.beans.Introspector.getBeanInfo(component.getClass());
+
+ for (PropertyDescriptor pd : beanInfo.getPropertyDescriptors()) {
+ String name = pd.getName();
+
+ if ("submittedValue".equals(name) || "id".equals(name) ||
"transient".equals(name) || "rendered".equals(name) ||
"rendererType".equals(name) || "localValueSet".equals(name)) {
+ continue;
+ }
+
+ UIInput input = null;
+
+ Class<?> type = pd.getPropertyType();
+ if (pd.getWriteMethod() != null) {
+ if (Boolean.class.isAssignableFrom(type) || Boolean.TYPE.equals(type)) {
+ input = new HtmlSelectBooleanCheckbox();
+ } else if (type.getName().startsWith("java.lang.") || type.isPrimitive())
{
+ input = new HtmlInputText();
+ }
+
+ if (input != null) {
+ input.setConverter(facesContext.getApplication().createConverter(type));
+
+ HtmlOutputLabel label = new HtmlOutputLabel();
+ label.setValue(name);
+ label.setFor(name);
+ label.setId(name + "_lbl");
+
+ children.add(label);
+
+ input.setId(name);
+ input.setValueExpression("value",
+ facesContext.getApplication().getExpressionFactory().createValueExpression(
+ facesContext.getELContext(),
"#{miracleBean.values['"+name+"']}", type));
+
+ children.add(input);
+ }
+ }
+ }
+ } catch (IntrospectionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ HtmlCommandButton button = new HtmlCommandButton();
+ button.setValue("Submit");
+ button.setActionExpression(facesContext.getApplication().getExpressionFactory().createMethodExpression(facesContext.getELContext(),
"#{miracleBean.applyValues}", Void.TYPE, new Class[0]));
+
+ children.add(button);
+ }
+
+ return containerComponent;
+ }
+
+ public void setContainerComponent(UIComponent containerComponent) {
+ this.containerComponent = containerComponent;
+ }
+
+ public Map<String, Object> getValues() {
+ return values;
+ }
+
+ public void setValues(Map<String, Object> values) {
+ this.values = values;
+ }
+
+ public void applyValues() {
+ Map<String, Object> attributes = component.getAttributes();
+
+ for (Map.Entry<String, Object> entry : values.entrySet()) {
+ attributes.put(entry.getKey(), entry.getValue());
+ }
+ }
+}
Modified: trunk/sandbox/samples/editor-sample/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
---
trunk/sandbox/samples/editor-sample/src/main/webapp/WEB-INF/faces-config.xml 2008-11-18
10:23:45 UTC (rev 11201)
+++
trunk/sandbox/samples/editor-sample/src/main/webapp/WEB-INF/faces-config.xml 2008-11-18
11:38:40 UTC (rev 11202)
@@ -11,6 +11,11 @@
<managed-bean-name>editorBean</managed-bean-name>
<managed-bean-class>org.richfaces.EditorBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>miracleBean</managed-bean-name>
+ <managed-bean-class>org.richfaces.MiracleBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
</managed-bean>
</faces-config>
Added: trunk/sandbox/samples/editor-sample/src/main/webapp/pages/miracle-editor.jsp
===================================================================
--- trunk/sandbox/samples/editor-sample/src/main/webapp/pages/miracle-editor.jsp
(rev 0)
+++
trunk/sandbox/samples/editor-sample/src/main/webapp/pages/miracle-editor.jsp 2008-11-18
11:38:40 UTC (rev 11202)
@@ -0,0 +1,37 @@
+<%@ 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>
+ <style>
+ .myStyle{
+ border:1px solid;
+
+ }
+ </style>
+ </head>
+ <body>
+ <f:view >
+ <h:form>
+ <h:panelGrid columns="1">
+ <h:selectOneRadio binding="#{skinBean.component}" />
+ <h:commandLink action="#{skinBean.change}" value="set
skin" />
+ <h:outputText value="Current Skin: #{skinBean.skin}"/>
+ </h:panelGrid>
+ </h:form>
+
+ <h:form id="formId">
+
+ <ed:editor binding="#{miracleBean.component}"
+
plugins="safari,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,myemotions">
+ </ed:editor>
+
+ <h:panelGrid columns="2"
binding="#{miracleBean.containerComponent}" />
+
+
+ </h:form>
+ </f:view>
+ </body>
+</html>
Modified:
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/editor.js
===================================================================
---
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/editor.js 2008-11-18
10:23:45 UTC (rev 11201)
+++
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/editor.js 2008-11-18
11:38:40 UTC (rev 11202)
@@ -60,10 +60,10 @@
if(this.params.useSeamText){
this.tinyparams.plugins = Richfaces.Editor.SeamTextConfiguration.plugins;
- this.tinyparams.theme_advanced_buttons1 =
Richfaces.Editor.SeamTextConfiguration.theme_advanced_buttons1;
- this.tinyparams.theme_advanced_buttons2 =
Richfaces.Editor.SeamTextConfiguration.theme_advanced_buttons2;
- this.tinyparams.theme_advanced_buttons3 =
Richfaces.Editor.SeamTextConfiguration.theme_advanced_buttons3;
- this.tinyparams.theme_advanced_buttons4 =
Richfaces.Editor.SeamTextConfiguration.theme_advanced_buttons4;
+ //this.tinyparams.theme_advanced_buttons1 =
Richfaces.Editor.SeamTextConfiguration.theme_advanced_buttons1;
+ //this.tinyparams.theme_advanced_buttons2 =
Richfaces.Editor.SeamTextConfiguration.theme_advanced_buttons2;
+ //this.tinyparams.theme_advanced_buttons3 =
Richfaces.Editor.SeamTextConfiguration.theme_advanced_buttons3;
+ //this.tinyparams.theme_advanced_buttons4 =
Richfaces.Editor.SeamTextConfiguration.theme_advanced_buttons4;
}
}
@@ -74,9 +74,9 @@
plugins :
"safari,spellchecker,style,table,save,advhr,advimage,advlink,iespell,inlinepopups,insertdatetime,preview,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
// Theme options
- theme_advanced_buttons1 :
"save,newdocument,|,bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,|,cut,copy,paste,pastetext,pasteword",
- theme_advanced_buttons2 :
"search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
- theme_advanced_buttons3 :
"tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,iespell,advhr,|,print,|,ltr,rtl,|,fullscreen",
- theme_advanced_buttons4 :
"styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote"
+ //theme_advanced_buttons1 :
"save,newdocument,|,bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,|,cut,copy,paste,pastetext,pasteword",
+ //theme_advanced_buttons2 :
"search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
+ //theme_advanced_buttons3 :
"tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,iespell,advhr,|,print,|,ltr,rtl,|,fullscreen",
+ //theme_advanced_buttons4 :
"styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote"
}
\ No newline at end of file
Modified:
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/tiny_mce/themes/advanced/skins/richfaces/ui.xcss
===================================================================
---
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/tiny_mce/themes/advanced/skins/richfaces/ui.xcss 2008-11-18
10:23:45 UTC (rev 11201)
+++
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/tiny_mce/themes/advanced/skins/richfaces/ui.xcss 2008-11-18
11:38:40 UTC (rev 11202)
@@ -247,10 +247,10 @@
</u:selector>
<u:selector name=".richfacesSkin .mceListBox .mceText">
- <u:style name="background" skin="additionalBackgroundColor"/>
+ <u:style name="background" skin="tableBackgroundColor"/>
<u:style name="border-width" value="1px"/>
<u:style name="border-style" value="solid"/>
- <u:style name="border-color"
skin="additionalBackgroundColor"/>
+ <u:style name="border-color" skin="panelBorderColor"/>
<u:style name="border-right" value="0"/>
<u:style name="font-family" skin="generalFamilyFont"/>
</u:selector>