JBoss Rich Faces SVN: r15024 - branches/community/3.3.X/docs/userguide/en/src/main/resources/images.
by richfaces-svn-commits@lists.jboss.org
Author: atsebro
Date: 2009-07-28 07:45:45 -0400 (Tue, 28 Jul 2009)
New Revision: 15024
Added:
branches/community/3.3.X/docs/userguide/en/src/main/resources/images/calendar7.png
Log:
RF-7532: rich:calendar component description review
Added: branches/community/3.3.X/docs/userguide/en/src/main/resources/images/calendar7.png
===================================================================
(Binary files differ)
Property changes on: branches/community/3.3.X/docs/userguide/en/src/main/resources/images/calendar7.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
15 years, 5 months
JBoss Rich Faces SVN: r15023 - in branches/community/3.3.X/ui: dropdown-menu/src/main/java/org/richfaces/renderkit/html and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2009-07-28 06:01:01 -0400 (Tue, 28 Jul 2009)
New Revision: 15023
Modified:
branches/community/3.3.X/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererDelegate.java
branches/community/3.3.X/ui/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java
Log:
RF-7595
Modified: branches/community/3.3.X/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererDelegate.java
===================================================================
--- branches/community/3.3.X/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererDelegate.java 2009-07-28 09:57:25 UTC (rev 15022)
+++ branches/community/3.3.X/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererDelegate.java 2009-07-28 10:01:01 UTC (rev 15023)
@@ -22,17 +22,19 @@
package org.richfaces.renderkit.html;
import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import org.ajax4jsf.javascript.JSFunction;
+import org.ajax4jsf.renderkit.RendererUtils;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.ajax4jsf.renderkit.RendererUtils.ScriptHashVariableWrapper;
import org.ajax4jsf.resource.InternetResource;
import org.richfaces.component.UIContextMenu;
-import org.richfaces.component.UIMenuGroup;
-import org.richfaces.renderkit.ScriptOptions;
/**
* @author Maksim Kaszynski
@@ -40,71 +42,23 @@
*/
public class ContextMenuRendererDelegate extends AbstractMenuRenderer {
- /* (non-Javadoc)
- * @see org.richfaces.renderkit.html.AbstractMenuRenderer#getLayerScript(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
- */
- protected String getLayerScript(FacesContext context, UIComponent component) {
- StringBuffer buffer = new StringBuffer();
- JSFunction function = new JSFunction("new RichFaces.Menu.Layer");
- function.addParameter(component.getClientId(context)+"_menu");
- function.addParameter(component.getAttributes().get("showDelay"));
-
- if (component instanceof UIContextMenu) {
- function.addParameter(component.getAttributes().get("hideDelay"));
- } else {
- function.addParameter(new Integer(300));
- }
-
- function.appendScript(buffer);
-
- if (component instanceof UIMenuGroup) {
- buffer.append(".");
- function = new JSFunction("asSubMenu");
- function.addParameter(component.getParent().getClientId(context)+"_menu");
- function.addParameter(component.getClientId(context));
- String evt = (String) component.getAttributes().get("event");
- if(evt == null || evt.trim().length() == 0){
- evt = "onmouseover";
- }
- function.addParameter(evt);
- ScriptOptions subMenuOptions = new ScriptOptions(component);
- subMenuOptions.addEventHandler("onopen");
- subMenuOptions.addEventHandler("onclose");
- subMenuOptions.addOption("direction");
- subMenuOptions.addOption("dummy", "dummy");
- function.addParameter(subMenuOptions);
- function.appendScript(buffer);
-
- } else {
- buffer.append(".");
- function = new JSFunction("asContextMenu");
-/* function.addParameter(component.getParent().getClientId(context));
- String evt = (String) component.getAttributes().get("event");
- if(evt == null || evt.trim().length() == 0){
- evt = "oncontextmenu";
- }
- function.addParameter(evt);
- function.addParameter("onmouseout");
-*/ ScriptOptions menuOptions = new ScriptOptions(component);
-
- menuOptions.addOption("direction");
- menuOptions.addOption("jointPoint");
- menuOptions.addOption("verticalOffset");
-
-
- menuOptions.addOption("horizontalOffset");
- menuOptions.addEventHandler("oncollapse");
- menuOptions.addEventHandler("onexpand");
- menuOptions.addEventHandler("onitemselect");
- menuOptions.addEventHandler("ongroupactivate");
-
- menuOptions.addOption("dummy", "dummy");
- function.addParameter(menuOptions);
- function.appendScript(buffer);
-
+ protected void appendMenuScript(FacesContext context, UIComponent component, StringBuffer buffer) {
+ Map<String, Object> options = new HashMap<String, Object>();
+ RendererUtils utils = getUtils();
+ buffer.append(".");
+ JSFunction function = new JSFunction("asContextMenu");
+ utils.addToScriptHash(options, "direction", component.getAttributes().get("direction"), "auto");
+ utils.addToScriptHash(options, "jointPoint", component.getAttributes().get("jointPoint"), "auto");
+ utils.addToScriptHash(options, "verticalOffset", component.getAttributes().get("verticalOffset"), "0");
+ utils.addToScriptHash(options, "horizontalOffset", component.getAttributes().get("horizontalOffset"), "0");
+ utils.addToScriptHash(options, "oncollapse", component.getAttributes().get("oncollapse"), null, ScriptHashVariableWrapper.EVENT_HANDLER);
+ utils.addToScriptHash(options, "onexpand", component.getAttributes().get("onexpand"), null, ScriptHashVariableWrapper.EVENT_HANDLER);
+ utils.addToScriptHash(options, "onitemselect", component.getAttributes().get("onitemselect"), null, ScriptHashVariableWrapper.EVENT_HANDLER);
+ utils.addToScriptHash(options, "ongroupactivate", component.getAttributes().get("ongroupactivate"), null, ScriptHashVariableWrapper.EVENT_HANDLER);
+ if (!options.isEmpty()) {
+ function.addParameter(options);
}
-
- return buffer.toString();
+ function.appendScript(buffer);
}
/* (non-Javadoc)
Modified: branches/community/3.3.X/ui/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java
===================================================================
--- branches/community/3.3.X/ui/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java 2009-07-28 09:57:25 UTC (rev 15022)
+++ branches/community/3.3.X/ui/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java 2009-07-28 10:01:01 UTC (rev 15023)
@@ -34,7 +34,6 @@
import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.ajax4jsf.renderkit.RendererUtils.ScriptHashVariableWrapper;
import org.richfaces.component.UIDropDownMenu;
-import org.richfaces.component.UIMenuGroup;
public class DropDownMenuRendererBase extends AbstractMenuRenderer {
@@ -44,59 +43,26 @@
}
@Override
- protected String getLayerScript(FacesContext context, UIComponent component) {
- StringBuffer buffer = new StringBuffer();
+ protected void appendMenuScript(FacesContext context, UIComponent component, StringBuffer buffer) {
Map<String, Object> options = new HashMap<String, Object>();
RendererUtils utils = getUtils();
- JSFunction function = new JSFunction("new RichFaces.Menu.Layer");
- function.addParameter(component.getClientId(context)+"_menu");
- utils.addToScriptHash(options, "delay", component.getAttributes().get("showDelay"), "300");
- utils.addToScriptHash(options, "hideDelay", component.getAttributes().get("hideDelay"), "300");
- utils.addToScriptHash(options, "selectedClass", component.getAttributes().get("selectedLabelClass"));
-
- if (!options.isEmpty()) {
- function.addParameter(options);
- }
-
+ buffer.append(".");
+ JSFunction function = new JSFunction("asDropDown");
+ function.addParameter(component.getClientId(context));
+ utils.addToScriptHash(options, "onEvt", component.getAttributes().get("event"), "onmouseover");
+ utils.addToScriptHash(options, "direction", component.getAttributes().get("direction"), "auto");
+ utils.addToScriptHash(options, "jointPoint", component.getAttributes().get("jointPoint"), "auto");
+ utils.addToScriptHash(options, "verticalOffset", component.getAttributes().get("verticalOffset"), "0");
+ utils.addToScriptHash(options, "horizontalOffset", component.getAttributes().get("horizontalOffset"), "0");
+ utils.addToScriptHash(options, "oncollapse", component.getAttributes().get("oncollapse"), null, ScriptHashVariableWrapper.EVENT_HANDLER);
+ utils.addToScriptHash(options, "onexpand", component.getAttributes().get("onexpand"), null, ScriptHashVariableWrapper.EVENT_HANDLER);
+ utils.addToScriptHash(options, "onitemselect", component.getAttributes().get("onitemselect"), null, ScriptHashVariableWrapper.EVENT_HANDLER);
+ utils.addToScriptHash(options, "ongroupactivate", component.getAttributes().get("ongroupactivate"), null, ScriptHashVariableWrapper.EVENT_HANDLER);
+ utils.addToScriptHash(options, "disabled", component.getAttributes().get("disabled"));
+ if (!options.isEmpty()) {
+ function.addParameter(options);
+ }
function.appendScript(buffer);
-
- options = new HashMap<String, Object>();
-
- if (component instanceof UIMenuGroup) {
- buffer.append(".");
- function = new JSFunction("asSubMenu");
- function.addParameter(component.getParent().getClientId(context)+"_menu");
- function.addParameter(component.getClientId(context));
- utils.addToScriptHash(options, "evtName", component.getAttributes().get("event"), "onmouseover");
- utils.addToScriptHash(options, "direction", component.getAttributes().get("direction"), "auto");
- utils.addToScriptHash(options, "onopen", component.getAttributes().get("onopen"), null, ScriptHashVariableWrapper.EVENT_HANDLER);
- utils.addToScriptHash(options, "onclose", component.getAttributes().get("onclose"), null, ScriptHashVariableWrapper.EVENT_HANDLER);
- if (!options.isEmpty()) {
- function.addParameter(options);
- }
- function.appendScript(buffer);
- } else {
- buffer.append(".");
- function = new JSFunction("asDropDown");
- function.addParameter(component.getClientId(context));
- utils.addToScriptHash(options, "onEvt", component.getAttributes().get("event"), "onmouseover");
- utils.addToScriptHash(options, "direction", component.getAttributes().get("direction"), "auto");
- utils.addToScriptHash(options, "jointPoint", component.getAttributes().get("jointPoint"), "auto");
- utils.addToScriptHash(options, "verticalOffset", component.getAttributes().get("verticalOffset"), "0");
- utils.addToScriptHash(options, "horizontalOffset", component.getAttributes().get("horizontalOffset"), "0");
- utils.addToScriptHash(options, "oncollapse", component.getAttributes().get("oncollapse"), null, ScriptHashVariableWrapper.EVENT_HANDLER);
- utils.addToScriptHash(options, "onexpand", component.getAttributes().get("onexpand"), null, ScriptHashVariableWrapper.EVENT_HANDLER);
- utils.addToScriptHash(options, "onitemselect", component.getAttributes().get("onitemselect"), null, ScriptHashVariableWrapper.EVENT_HANDLER);
- utils.addToScriptHash(options, "ongroupactivate", component.getAttributes().get("ongroupactivate"), null, ScriptHashVariableWrapper.EVENT_HANDLER);
- utils.addToScriptHash(options, "disabled", component.getAttributes().get("disabled"));
- if (!options.isEmpty()) {
- function.addParameter(options);
- }
- function.appendScript(buffer);
-
- }
-
- return buffer.toString();
}
public void encodeChildren(FacesContext context, UIComponent component)
15 years, 5 months
JBoss Rich Faces SVN: r15022 - in branches/community/3.3.X/ui/menu-components/src/main: resources/org/richfaces/renderkit/html/scripts and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2009-07-28 05:57:25 -0400 (Tue, 28 Jul 2009)
New Revision: 15022
Modified:
branches/community/3.3.X/ui/menu-components/src/main/java/org/richfaces/renderkit/html/AbstractMenuRenderer.java
branches/community/3.3.X/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
branches/community/3.3.X/ui/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx
Log:
RF-7508
Modified: branches/community/3.3.X/ui/menu-components/src/main/java/org/richfaces/renderkit/html/AbstractMenuRenderer.java
===================================================================
--- branches/community/3.3.X/ui/menu-components/src/main/java/org/richfaces/renderkit/html/AbstractMenuRenderer.java 2009-07-28 09:16:35 UTC (rev 15021)
+++ branches/community/3.3.X/ui/menu-components/src/main/java/org/richfaces/renderkit/html/AbstractMenuRenderer.java 2009-07-28 09:57:25 UTC (rev 15022)
@@ -22,25 +22,27 @@
package org.richfaces.renderkit.html;
import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
-import java.util.Set;
+import java.util.Map;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.javascript.JSFunction;
import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
+import org.ajax4jsf.renderkit.RendererUtils;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.ajax4jsf.renderkit.RendererUtils.ScriptHashVariableWrapper;
import org.ajax4jsf.resource.InternetResource;
import org.richfaces.component.UIMenuGroup;
import org.richfaces.component.UIMenuItem;
import org.richfaces.component.UIMenuSeparator;
import org.richfaces.component.util.HtmlUtil;
-import org.richfaces.renderkit.ScriptOptions;
/**
* @author Maksim Kaszynski
@@ -69,21 +71,62 @@
buffer.append(getLayerScript(context, component));
- List children = component.getChildren();
- for (Iterator it = children.iterator(); it.hasNext();) {
- buffer.append(getItemScript(context, (UIComponent) it.next()));
+ List<UIComponent> children = component.getChildren();
+ List<Object> scriptObjects = new ArrayList<Object>(children.size());
+ for (Iterator<UIComponent> it = children.iterator(); it.hasNext();) {
+ Object scriptObject = getItemScriptObject(context, it.next());
+ if(scriptObject != null) {
+ scriptObjects.add(scriptObject);
+ }
}
-
- ResponseWriter out = context.getResponseWriter();
- String script = buffer.append(";").toString();
- out.write(script);
+ if (!scriptObjects.isEmpty()) {
+ buffer.append(".");
+ JSFunction function = new JSFunction("addItems");
+ function.addParameter(scriptObjects);
+ function.appendScript(buffer);
+ }
+ buffer.append(";");
+ context.getResponseWriter().write(buffer.toString());
}
- protected abstract String getLayerScript(FacesContext context,
- UIComponent layer);
+ protected abstract void appendMenuScript(FacesContext context, UIComponent component, StringBuffer buffer);
+
+ protected String getLayerScript(FacesContext context, UIComponent component) {
+ StringBuffer buffer = new StringBuffer();
+ Map<String, Object> options = new HashMap<String, Object>();
+ RendererUtils utils = getUtils();
+ JSFunction function = new JSFunction("new RichFaces.Menu.Layer");
+ function.addParameter(component.getClientId(context)+"_menu");
+ utils.addToScriptHash(options, "delay", component.getAttributes().get("showDelay"), "300");
+ utils.addToScriptHash(options, "hideDelay", component.getAttributes().get("hideDelay"), "300");
+ utils.addToScriptHash(options, "selectedClass", component.getAttributes().get("selectedLabelClass"));
+ if (!options.isEmpty()) {
+ function.addParameter(options);
+ }
+ function.appendScript(buffer);
+ if (component instanceof UIMenuGroup) {
+ options = new HashMap<String, Object>();
+ buffer.append(".");
+ function = new JSFunction("asSubMenu");
+ function.addParameter(component.getParent().getClientId(context)+"_menu");
+ function.addParameter(component.getClientId(context));
+ utils.addToScriptHash(options, "evtName", component.getAttributes().get("event"), "onmouseover");
+ utils.addToScriptHash(options, "direction", component.getAttributes().get("direction"), "auto");
+ utils.addToScriptHash(options, "onopen", component.getAttributes().get("onopen"), null, ScriptHashVariableWrapper.EVENT_HANDLER);
+ utils.addToScriptHash(options, "onclose", component.getAttributes().get("onclose"), null, ScriptHashVariableWrapper.EVENT_HANDLER);
+ if (!options.isEmpty()) {
+ function.addParameter(options);
+ }
+ function.appendScript(buffer);
+ } else {
+ appendMenuScript(context, component, buffer);
+ }
+ return buffer.toString();
+ }
- protected String getItemScript(FacesContext context, UIComponent kid) {
+ protected Object getItemScriptObject(FacesContext context, UIComponent kid) {
String itemId = null;
+ List<Object> scriptObject = null;
boolean closeOnClick = true;
Integer flagGroup = null;
boolean disabled = false;
@@ -105,43 +148,35 @@
}
}
if (itemId != null) {
- JSFunction function = new JSFunction(".addItem");
- function.addParameter(itemId);
- ScriptOptions options = new ScriptOptions(kid);
+ scriptObject = new ArrayList<Object>();
+ Map<String, Object> options = new HashMap<String, Object>(2);
+ RendererUtils utils = getUtils();
+ scriptObject.add(itemId);
- options.addEventHandler("onmouseout");
- options.addEventHandler("onmouseover");
-
- if (closeOnClick) {
- options.addOption("closeOnClick", Boolean.TRUE);
- }
- options.addOption("flagGroup", flagGroup);
-
- options.addOption("styleClass");
- options.addOption("style");
- options.addOption("itemClass");
- options.addOption("itemStyle");
- options.addOption("disabledItemClass");
- options.addOption("disabledItemStyle");
- options.addOption("selectItemClass");
- options.addOption("labelClass");
- options.addOption("selectedLabelClass");
- options.addOption("disabledLabelClass");
-
- options.addOption("selectClass");
- options.addOption("selectStyle");
- options.addOption("iconClass");
-
- if (disabled) {
- options.addOption("disabled", Boolean.TRUE);
- }
-
- options.addEventHandler("onselect");
-
- function.addParameter(options);
- return function.toScript();
+ utils.addToScriptHash(options, "onmouseout", kid.getAttributes().get("onmouseout"), null, ScriptHashVariableWrapper.EVENT_HANDLER);
+ utils.addToScriptHash(options, "onmouseover", kid.getAttributes().get("onmouseover"), null, ScriptHashVariableWrapper.EVENT_HANDLER);
+ utils.addToScriptHash(options, "onselect", kid.getAttributes().get("onselect"), null, ScriptHashVariableWrapper.EVENT_HANDLER);
+ utils.addToScriptHash(options, "closeOnClick", closeOnClick, "true");
+ utils.addToScriptHash(options, "flagGroup", flagGroup);
+ utils.addToScriptHash(options, "styleClass", kid.getAttributes().get("styleClass"));
+ utils.addToScriptHash(options, "style", kid.getAttributes().get("style"));
+ utils.addToScriptHash(options, "itemClass", kid.getAttributes().get("itemClass"));
+ utils.addToScriptHash(options, "itemStyle", kid.getAttributes().get("itemStyle"));
+ utils.addToScriptHash(options, "disabledItemClass", kid.getAttributes().get("disabledItemClass"));
+ utils.addToScriptHash(options, "disabledItemStyle", kid.getAttributes().get("disabledItemStyle"));
+ utils.addToScriptHash(options, "selectItemClass", kid.getAttributes().get("selectItemClass"));
+ utils.addToScriptHash(options, "labelClass", kid.getAttributes().get("labelClass"));
+ utils.addToScriptHash(options, "selectedLabelClass", kid.getAttributes().get("selectedLabelClass"));
+ utils.addToScriptHash(options, "disabledLabelClass", kid.getAttributes().get("disabledLabelClass"));
+ utils.addToScriptHash(options, "selectClass", kid.getAttributes().get("selectClass"));
+ utils.addToScriptHash(options, "selectStyle", kid.getAttributes().get("selectStyle"));
+ utils.addToScriptHash(options, "iconClass", kid.getAttributes().get("iconClass"));
+ utils.addToScriptHash(options, "disabled", disabled);
+ if (!options.isEmpty()) {
+ scriptObject.add(options);
+ }
}
- return "";
+ return scriptObject;
}
public boolean getRendersChildren() {
Modified: branches/community/3.3.X/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
===================================================================
--- branches/community/3.3.X/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2009-07-28 09:16:35 UTC (rev 15021)
+++ branches/community/3.3.X/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2009-07-28 09:57:25 UTC (rev 15022)
@@ -1011,12 +1011,17 @@
},
//addItem: function(itemId, hoverClass, plainClass, hoverStyle, plainStyle){
addItem: function(itemId, options) {
- var dis = this;
var item = new RichFaces.Menu.Item(itemId, this, options || {});
//item.menu = this;
this.items[itemId] = item;
return this;
},
+ addItems: function(scriptObjects) {
+ for ( var i = 0; i < scriptObjects.length; i++) {
+ this.addItem.apply(this, scriptObjects[i]);
+ }
+ return this;
+ },
hideMe: function(e){
RichFaces.Menu.Layers.clearPopUpTO();
RichFaces.Menu.Layers.levels[this.level] = null;
@@ -1299,7 +1304,10 @@
RichFaces.Menu.Item = Class.create({
initialize: function(id, menu, options) {
- this.options = options;
+ this.options = {
+ closeOnClick : true
+ };
+ Object.extend(this.options, options);
this.id = id;
this.menu = menu;
this.mouseOver = false;
@@ -1499,14 +1507,14 @@
element.style.cssText = menuGroupStyle;
}
-RichFaces.Menu.itemMouseOut = function(event, element, menuItemClass, menuItemStyle, iconClass) {
+RichFaces.Menu.itemMouseOut = function(event, element, classes) {
if (RichFaces.Menu.isWithin(event, element)) {
return;
}
- element.className = 'rich-menu-item rich-menu-item-enabled ' + (menuItemClass ? menuItemClass : '');
- element.style.cssText = menuItemStyle;
- $(element.id + ':icon').className='rich-menu-item-icon ' + (iconClass ? iconClass : '');
+ element.className = 'rich-menu-item rich-menu-item-enabled ' + (classes.styleClass || '');
+ element.style.cssText = classes.style || "";
+ $(element.id + ':icon').className='rich-menu-item-icon ' + (classes.iconClass || '');
Element.removeClassName($(element.id + ':anchor'), 'rich-menu-item-label-selected');
}
@@ -1520,14 +1528,14 @@
element.style.cssText = menuGroupStyle;
}
-RichFaces.Menu.itemMouseOver = function(event, element, menuItemHoverClass, menuItemStyle, iconClass) {
+RichFaces.Menu.itemMouseOver = function(event, element, classes) {
if (RichFaces.Menu.isWithin(event, element)) {
return;
}
- element.className = 'rich-menu-item rich-menu-item-hover ' + (menuItemHoverClass ? menuItemHoverClass : '');
- element.style.cssText = menuItemStyle;
+ element.className = 'rich-menu-item rich-menu-item-hover ' + (classes.styleClass || '');
+ element.style.cssText = classes.style || "";
- $(element.id + ':icon').className='rich-menu-item-icon rich-menu-item-icon-selected ' + (iconClass ? iconClass : '');
+ $(element.id + ':icon').className='rich-menu-item-icon rich-menu-item-icon-selected ' + (classes.iconClass || '');
Element.addClassName($(element.id + ':anchor'), 'rich-menu-item-label-selected');
}
Modified: branches/community/3.3.X/ui/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx
===================================================================
--- branches/community/3.3.X/ui/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx 2009-07-28 09:16:35 UTC (rev 15021)
+++ branches/community/3.3.X/ui/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx 2009-07-28 09:57:25 UTC (rev 15022)
@@ -57,11 +57,21 @@
*/
]]></jsp:scriptlet>
+ <c:scriptObject var="onmouseoutClasses">
+ <c:scriptOption name="styleClass" value="#{menuItemCustomClass}"/>
+ <c:scriptOption name="style" value="#{onmouseoutInlineStyles}"/>
+ <c:scriptOption attributes="iconClass"/>
+ </c:scriptObject>
+ <c:scriptObject var="onmouseoverClasses">
+ <c:scriptOption name="styleClass" value="#{menuItemHoverClass}"/>
+ <c:scriptOption name="style" value="#{onmouseoverInlineStyles}"/>
+ <c:scriptOption attributes="iconClass"/>
+ </c:scriptObject>
<div id="#{clientId}"
class="#{menuItemClass}"
- onmouseout="RichFaces.Menu.itemMouseOut(event, this, '#{menuItemCustomClass}', '#{onmouseoutInlineStyles}', '#{component.attributes['iconClass']}');"
- onmouseover="RichFaces.Menu.itemMouseOver(event, this, '#{menuItemHoverClass}', '#{onmouseoverInlineStyles}', '#{component.attributes['iconClass']}');"
+ onmouseout="RichFaces.Menu.itemMouseOut(event, this, #{onmouseoutClasses});"
+ onmouseover="RichFaces.Menu.itemMouseOver(event, this, #{onmouseoverClasses});"
onmouseup="Event.stop(event); #{component.attributes['onmouseup']}"
onmousedown="Event.stop(event); #{component.attributes['onmousedown']}"
15 years, 5 months
JBoss Rich Faces SVN: r15021 - branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon.
by richfaces-svn-commits@lists.jboss.org
Author: adubovsky
Date: 2009-07-28 05:16:35 -0400 (Tue, 28 Jul 2009)
New Revision: 15021
Modified:
branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/Listeners.java
Log:
sysout minor changes
Modified: branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/Listeners.java
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/Listeners.java 2009-07-28 09:15:39 UTC (rev 15020)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/Listeners.java 2009-07-28 09:16:35 UTC (rev 15021)
@@ -61,7 +61,7 @@
* the parameter of the value change listener
*/
public void valueChangeListener(ValueChangeEvent e) {
- System.out.println("++>> TUT");
+ System.out.println("++>> valueChangeListener was called");
statusValueChangeListener = true;
phaseValueChangeListener = PhaseTracker.currentPhase;
}
15 years, 5 months
JBoss Rich Faces SVN: r15020 - in branches/community/3.3.X/test-applications/test-jsp/src/main: webapp/WEB-INF/auto and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: adubovsky
Date: 2009-07-28 05:15:39 -0400 (Tue, 28 Jul 2009)
New Revision: 15020
Added:
branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/Listeners.java
Modified:
branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/AutoGeneral.java
branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/Convertion.java
branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/UtilListeners.java
branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/Validation.java
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/auto/auto-config.xml
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/comboBox/comboBox.jsp
branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/pickList/pickList.jsp
Log:
+ valueChangeListener test
Modified: branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/AutoGeneral.java
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/AutoGeneral.java 2009-07-28 00:32:59 UTC (rev 15019)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/AutoGeneral.java 2009-07-28 09:15:39 UTC (rev 15020)
@@ -47,7 +47,7 @@
*/
private static final String[] autoGeneralAttrs = { "immediate",
"validator", "validatorMessage", "required", "requiredMessage",
- "converter", "converterMessage" };
+ "converter", "converterMessage", "valueChangeListener" };
/** The result auto general grid. */
private HtmlPanelGrid resultAutoGeneralGrid = null;
@@ -139,6 +139,13 @@
.equalsIgnoreCase("converterMessage"))
// run test for "converterMessage" attribute
convertionBean.converterMessageCheck(attr);
+ } else if (attr.getName().equalsIgnoreCase("valueChangeListener")) {
+ Listeners listenersBean = (Listeners) BeanManager
+ .getManagedBeanFromSession("listeners");
+ ImmediateComponentBean compInt = (ImmediateComponentBean) BeanManager
+ .getManagedBeanFromSession(component);
+ // run test for "valueChangeListener" attribute
+ listenersBean.valueChangeListenerCheck(attr, compInt.isImmediate());
}
}
// redraw the results grid with the last test results
@@ -170,6 +177,10 @@
.getManagedBeanFromSession("convertion");
if (null != convertionBean)
convertionBean.reset();
+
+ Listeners listenersBean = (Listeners) BeanManager
+ .getManagedBeanFromSession("listeners");
+ listenersBean.reset();
UIViewRoot vr = FacesContext.getCurrentInstance().getViewRoot();
UIInput inp = (UIInput) vr
Modified: branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/Convertion.java
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/Convertion.java 2009-07-28 00:32:59 UTC (rev 15019)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/Convertion.java 2009-07-28 09:15:39 UTC (rev 15020)
@@ -26,6 +26,7 @@
import javax.faces.component.UIComponent;
import javax.faces.convert.Converter;
import javax.faces.convert.ConverterException;
+import javax.faces.event.PhaseId;
import util.data.Car;
import util.parser.Attribute;
@@ -54,13 +55,13 @@
* The phase converter get as object keeps the JSF phase on which
* getAsObject is triggered.
*/
- private String phaseConverterGetAsObject = "UNDEFINED";
+ private PhaseId phaseConverterGetAsObject = PhaseId.ANY_PHASE;
/**
* The phase converter get as string keeps the JSF phase on which
* getAsString is triggered.
*/
- private String phaseConverterGetAsString = "UNDEFINED";
+ private PhaseId phaseConverterGetAsString = PhaseId.ANY_PHASE;
/** The converter message test which is actual displayed on the page. */
private String converterMessageTest = "";
@@ -84,6 +85,8 @@
converterMessageTest = "";
statusConverterGetAsObject = false;
statusConverterGetAsString = false;
+ phaseConverterGetAsObject = PhaseId.ANY_PHASE;
+ phaseConverterGetAsString = PhaseId.ANY_PHASE;
}
/**
@@ -106,8 +109,7 @@
// getAsObject is called
statusConverterGetAsObject = true;
// keep phase
- phaseConverterGetAsObject = PhaseTracker.currentPhase
- .toString();
+ phaseConverterGetAsObject = PhaseTracker.currentPhase;
if (newValue.equals("converter"))
throw new ConverterException(new FacesMessage(
FacesMessage.SEVERITY_ERROR, "Converter error",
@@ -128,8 +130,7 @@
// getAsString is called
statusConverterGetAsString = true;
// keep phase
- phaseConverterGetAsString = PhaseTracker.currentPhase
- .toString();
+ phaseConverterGetAsString = PhaseTracker.currentPhase;
return (null == value) ? null : value.toString();
}
@@ -156,8 +157,7 @@
// getAsObject is called
statusConverterGetAsObject = true;
// keep phase
- phaseConverterGetAsObject = PhaseTracker.currentPhase
- .toString();
+ phaseConverterGetAsObject = PhaseTracker.currentPhase;
if (newValue.indexOf("converter") > -1)
throw new ConverterException(new FacesMessage(
FacesMessage.SEVERITY_ERROR, "Converter error",
@@ -179,9 +179,7 @@
// getAsString is called
statusConverterGetAsString = true;
// keep phase
- phaseConverterGetAsString = PhaseTracker.currentPhase
- .toString();
-
+ phaseConverterGetAsString = PhaseTracker.currentPhase;
if (value instanceof Car) {
Car car = (Car) value;
return (null == car) ? null : car.toString();
@@ -203,13 +201,14 @@
// converter should be called...
if ((statusConverterGetAsObject) && (statusConverterGetAsString)) {
// ... getAsObject on the 3th phase if component is not immediate...
- if (((phaseConverterGetAsObject.equals("PROCESS_VALIDATIONS(3)"))
+ if (((phaseConverterGetAsObject.equals(PhaseId.PROCESS_VALIDATIONS))
&& (!immediate)
// ... getAsObject or on the 2th phase if component is immediate...
- || (phaseConverterGetAsObject.equals("APPLY_REQUEST_VALUES(2)"))
+ || (phaseConverterGetAsObject.equals(PhaseId.APPLY_REQUEST_VALUES))
&& (immediate))
// ... and getAsString on the 6th phase
- && (phaseConverterGetAsString.equals("RENDER_RESPONSE(6)"))) {
+ && (phaseConverterGetAsString
+ .equals(PhaseId.RENDER_RESPONSE))) {
attr.setStatus(Status.PASSED);
} else {
attr.setStatus(Status.FAILED);
Added: branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/Listeners.java
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/Listeners.java (rev 0)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/Listeners.java 2009-07-28 09:15:39 UTC (rev 15020)
@@ -0,0 +1,95 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package automateCommon;
+
+import javax.faces.event.PhaseId;
+import javax.faces.event.ValueChangeEvent;
+
+import util.parser.Attribute;
+import util.parser.Status;
+import util.phaseTracker.PhaseTracker;
+
+/**
+ * The Listeners bean provides methods for "valueChangeListener" attribute
+ * testing.
+ */
+public class Listeners {
+
+ /**
+ * The statusValueChangeListener indicates whether valueChangeListener is
+ * called or not.
+ */
+ private boolean statusValueChangeListener = false;
+
+ /**
+ * The phaseValueChangeListener keeps the JSF phase on which
+ * valueChangeListener is triggered.
+ */
+ private PhaseId phaseValueChangeListener = PhaseId.ANY_PHASE;
+
+ /**
+ * Resets test variables.
+ */
+ public void reset() {
+ statusValueChangeListener = false;
+ phaseValueChangeListener = PhaseId.ANY_PHASE;
+ }
+
+ /**
+ * Value change listener.
+ *
+ * @param e
+ * the parameter of the value change listener
+ */
+ public void valueChangeListener(ValueChangeEvent e) {
+ System.out.println("++>> TUT");
+ statusValueChangeListener = true;
+ phaseValueChangeListener = PhaseTracker.currentPhase;
+ }
+
+ /**
+ * Value change listener check.
+ *
+ * @param attr
+ * the tested attribute
+ * @param immediate
+ * the immediate attribute value of the current component
+ */
+ public void valueChangeListenerCheck(Attribute attr, boolean immediate) {
+ // validator should be called...
+ if (statusValueChangeListener) {
+ // ... on the 3th phase if component is not immediate...
+ if ((phaseValueChangeListener.equals(PhaseId.PROCESS_VALIDATIONS))
+ && (!immediate)
+ // ... or on the 2th phase if component is immediate
+ || (phaseValueChangeListener
+ .equals(PhaseId.APPLY_REQUEST_VALUES))
+ && (immediate)) {
+ attr.setStatus(Status.PASSED);
+ } else {
+ attr.setStatus(Status.FAILED);
+ }
+ } else {
+ attr.setStatus(Status.FAILED);
+ }
+ }
+}
Modified: branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/UtilListeners.java
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/UtilListeners.java 2009-07-28 00:32:59 UTC (rev 15019)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/UtilListeners.java 2009-07-28 09:15:39 UTC (rev 15020)
@@ -33,8 +33,8 @@
/**
* The Class UtilListeners is used for changing "required" and "immediate"
- * attributes. Listeners are added to the corresponding buttons when results
- * grids are generated.
+ * attributes of the tested component. Listeners are added to the corresponding
+ * buttons when results grids are generated.
*/
public class UtilListeners {
Modified: branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/Validation.java
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/Validation.java 2009-07-28 00:32:59 UTC (rev 15019)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/java/automateCommon/Validation.java 2009-07-28 09:15:39 UTC (rev 15020)
@@ -26,6 +26,7 @@
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
+import javax.faces.event.PhaseId;
import javax.faces.validator.ValidatorException;
import util.parser.Attribute;
@@ -54,7 +55,7 @@
private boolean statusValidator = false;
/** The phase validator keeps the JSF phase on which validator is triggered. */
- private String phaseValidator = "UNDEFINED";
+ private PhaseId phaseValidator = PhaseId.ANY_PHASE;
/**
* Instantiates a new validation.
@@ -73,7 +74,7 @@
validatorMessageTest = "";
requiredMessageTest = "";
statusValidator = false;
- phaseValidator = "UNDEFINED";
+ phaseValidator = PhaseId.ANY_PHASE;
}
/**
@@ -95,7 +96,7 @@
// validator is called
statusValidator = true;
// keep phase
- phaseValidator = PhaseTracker.currentPhase.toString();
+ phaseValidator = PhaseTracker.currentPhase;
if (value != null) {
if (value instanceof List) {
List<Object> arr_value = (List<Object>) value;
@@ -133,10 +134,10 @@
// validator should be called...
if (statusValidator) {
// ... on the 3th phase if component is not immediate...
- if ((phaseValidator.equals("PROCESS_VALIDATIONS(3)"))
+ if ((phaseValidator.equals(PhaseId.PROCESS_VALIDATIONS))
&& (!immediate)
// ... or on the 2th phase if component is immediate
- || (phaseValidator.equals("APPLY_REQUEST_VALUES(2)"))
+ || (phaseValidator.equals(PhaseId.APPLY_REQUEST_VALUES))
&& (immediate)) {
attr.setStatus(Status.PASSED);
} else {
@@ -178,7 +179,7 @@
// component should be immediate...
if ((statusValidator) && (immediate)) {
// ...and validator should be called on the 2th phase
- if (phaseValidator.equals("APPLY_REQUEST_VALUES(2)")) {
+ if (phaseValidator.equals(PhaseId.APPLY_REQUEST_VALUES)) {
attr.setStatus(Status.PASSED);
} else {
attr.setStatus(Status.FAILED);
Modified: branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/auto/auto-config.xml
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/auto/auto-config.xml 2009-07-28 00:32:59 UTC (rev 15019)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/WEB-INF/auto/auto-config.xml 2009-07-28 09:15:39 UTC (rev 15020)
@@ -12,6 +12,13 @@
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
+ <managed-bean-name>listeners</managed-bean-name>
+ <managed-bean-class>
+ automateCommon.Listeners
+ </managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
<managed-bean-name>convertion</managed-bean-name>
<managed-bean-class>
automateCommon.Convertion
Modified: branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/comboBox/comboBox.jsp
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/comboBox/comboBox.jsp 2009-07-28 00:32:59 UTC (rev 15019)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/comboBox/comboBox.jsp 2009-07-28 09:15:39 UTC (rev 15020)
@@ -9,6 +9,7 @@
<rich:comboBox id="comboBoxID" value="#{comboBox.value}"
validator="#{validation.validate}"
validatorMessage="#{validation.validatorMessage}"
+ valueChangeListener="#{listeners.valueChangeListener}"
converter="#{convertion.convert}"
converterMessage="#{convertion.converterMessage}"
onblur="markEventAsWorkable('onblur');"
@@ -42,7 +43,8 @@
inputStyle="inputStyle:inputStyle" itemClass="itemClass-itemClass"
itemSelectedClass="itemSelectedClass-itemSelectedClass"
listClass="listClass-listClass" listStyle="listStyle:listStyle"
- required="#{comboBox.required}" requiredMessage="#{validation.requiredMessage}"
+ required="#{comboBox.required}"
+ requiredMessage="#{validation.requiredMessage}"
immediate="#{comboBox.immediate}">
<f:selectItem itemValue="validator" />
<f:selectItem itemValue="converter" />
Modified: branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/pickList/pickList.jsp
===================================================================
--- branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/pickList/pickList.jsp 2009-07-28 00:32:59 UTC (rev 15019)
+++ branches/community/3.3.X/test-applications/test-jsp/src/main/webapp/components/pickList/pickList.jsp 2009-07-28 09:15:39 UTC (rev 15020)
@@ -32,6 +32,7 @@
converterMessage="#{convertion.converterMessage}"
required="#{pickList.required}"
requiredMessage="#{validation.requiredMessage}"
+ valueChangeListener="#{listeners.valueChangeListener}"
immediate="#{pickList.immediate}">
<f:selectItems value="#{pickList.selectItems}" />
<f:selectItem itemLabel="validator" itemValue="validator" />
15 years, 5 months
Your order
by richfaces-svn-commits@lists.jboss.org
15 years, 5 months
JBoss Rich Faces SVN: r15019 - branches/community/3.3.X/ui/layout/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2009-07-27 20:32:59 -0400 (Mon, 27 Jul 2009)
New Revision: 15019
Modified:
branches/community/3.3.X/ui/layout/src/main/java/org/richfaces/renderkit/AbstractPageRenderer.java
Log:
https://jira.jboss.org/jira/browse/RF-7367
Modified: branches/community/3.3.X/ui/layout/src/main/java/org/richfaces/renderkit/AbstractPageRenderer.java
===================================================================
--- branches/community/3.3.X/ui/layout/src/main/java/org/richfaces/renderkit/AbstractPageRenderer.java 2009-07-28 00:21:54 UTC (rev 15018)
+++ branches/community/3.3.X/ui/layout/src/main/java/org/richfaces/renderkit/AbstractPageRenderer.java 2009-07-28 00:32:59 UTC (rev 15019)
@@ -79,8 +79,8 @@
ResponseWriter out = context.getResponseWriter();
Map<String, Object> attributes = component.getAttributes();
String format = (String) attributes.get("markupType");
- String contentType = null;
- String namespace = null;
+ String contentType = (String) attributes.get("contentType");
+ String namespace = (String) attributes.get("namespace");
// String characterEncoding = out.getCharacterEncoding();
String[] docType = null;
if (null != format) {
@@ -97,13 +97,15 @@
}
}
if (null != docType) {
- contentType = docType[1];
- namespace = docType[2];
+ if (null == contentType) {
+ contentType = docType[1];
+ }
+ // https://jira.jboss.org/jira/browse/RF-7367
+ if (null == namespace) {
+ namespace = docType[2];
+ }
out.write(docType[0]);
}
- if (null == contentType) {
- contentType = (String) attributes.get("contentType");
- }
if (null != contentType) {
// response.setContentType(contentType /*+ ";charset=" +
// characterEncoding*/);
15 years, 5 months
JBoss Rich Faces SVN: r15018 - in branches/community/3.3.X: samples/beanValidatorSample/src/main/java/org/richfaces and 8 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2009-07-27 20:21:54 -0400 (Mon, 27 Jul 2009)
New Revision: 15018
Added:
branches/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/LocaleBean.java
branches/community/3.3.X/ui/beanValidator/src/test/java/org/richfaces/validator/ObjectValidatorTest.java
branches/community/3.3.X/ui/beanValidator/src/test/resources/ValidatorMessages_ru.properties
Modified:
branches/community/3.3.X/samples/beanValidatorSample/pom.xml
branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/WEB-INF/faces-config.xml
branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/Bean.java
branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/layout/template.xhtml
branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/pages/beanValidation.xhtml
branches/community/3.3.X/ui/beanValidator/pom.xml
branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/validator/BeanValidator.java
branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/validator/HibernateValidator.java
branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/validator/NullValidator.java
branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/validator/ObjectValidator.java
branches/community/3.3.X/ui/beanValidator/src/test/java/org/richfaces/validator/BeanValidatorTest.java
branches/community/3.3.X/ui/beanValidator/src/test/java/org/richfaces/validator/HibernateValidatorTest.java
branches/community/3.3.X/ui/beanValidator/src/test/java/org/richfaces/validator/MockValidationProvider.java
Log:
https://jira.jboss.org/jira/browse/RF-4428
Handle localization for HibernateValidator, test localization issues.
Modified: branches/community/3.3.X/samples/beanValidatorSample/pom.xml
===================================================================
--- branches/community/3.3.X/samples/beanValidatorSample/pom.xml 2009-07-24 23:45:04 UTC (rev 15017)
+++ branches/community/3.3.X/samples/beanValidatorSample/pom.xml 2009-07-28 00:21:54 UTC (rev 15018)
@@ -126,12 +126,12 @@
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
- <version>1.0.CR2</version>
+ <version>1.0.CR3</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
- <version>4.0.0.Beta1</version>
+ <version>4.0.0.Beta2</version>
</dependency>
</dependencies>
</profile>
@@ -142,7 +142,7 @@
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
- <version>1.0.CR2</version>
+ <version>1.0.CR3</version>
</dependency>
</dependencies>
</profile>
Added: branches/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/LocaleBean.java
===================================================================
--- branches/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/LocaleBean.java (rev 0)
+++ branches/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/LocaleBean.java 2009-07-28 00:21:54 UTC (rev 15018)
@@ -0,0 +1,53 @@
+/**
+ *
+ */
+package org.richfaces;
+
+import java.util.Locale;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class LocaleBean {
+
+ private Locale current = Locale.ENGLISH;
+
+ private String language = "en";
+
+ /**
+ * @return the current
+ */
+ public Locale getCurrent() {
+ return current;
+ }
+
+ /**
+ * @param current the current to set
+ */
+ public void setCurrent(Locale current) {
+ this.current = current;
+ }
+
+ /**
+ * @return the language
+ */
+ public String getLanguage() {
+ return language;
+ }
+
+ /**
+ * @param language the language to set
+ */
+ public void setLanguage(String language) {
+ this.language = language;
+ }
+
+
+ public String select(){
+ setCurrent(new Locale(getLanguage()));
+ return null;
+ }
+
+
+}
Property changes on: branches/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/LocaleBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/WEB-INF/faces-config.xml 2009-07-24 23:45:04 UTC (rev 15017)
+++ branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/WEB-INF/faces-config.xml 2009-07-28 00:21:54 UTC (rev 15018)
@@ -1,7 +1,16 @@
-<?xml version="1.0"?>
-<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
- "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
-<faces-config>
+<?xml version="1.0" encoding="UTF-8"?>
+<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
+ version="1.2">
+ <application>
+ <locale-config>
+ <default-locale>en</default-locale>
+ <supported-locale>en</supported-locale>
+ <supported-locale>de</supported-locale>
+ <supported-locale>fr</supported-locale>
+ </locale-config>
+ </application>
<managed-bean>
<managed-bean-name>bean</managed-bean-name>
<managed-bean-class>org.richfaces.example.Bean</managed-bean-class>
@@ -28,6 +37,11 @@
<managed-bean-scope>application</managed-bean-scope>
</managed-bean>
<managed-bean>
+ <managed-bean-name>locale</managed-bean-name>
+ <managed-bean-class>org.richfaces.LocaleBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
<managed-bean-name>contentBean</managed-bean-name>
<managed-bean-class>org.richfaces.ContentBean</managed-bean-class>
<managed-bean-scope>none</managed-bean-scope>
Modified: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/Bean.java
===================================================================
--- branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/Bean.java 2009-07-24 23:45:04 UTC (rev 15017)
+++ branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/Bean.java 2009-07-28 00:21:54 UTC (rev 15018)
@@ -58,7 +58,7 @@
*/
@NotEmpty
// @Email
- @Pattern(regexp="^[a-zA-Z][\\w\\.-]*[a-zA-Z0-9](a)[a-zA-Z0-9][\\w\\.-]*[a-zA-Z0-9]\\.[a-zA-Z][a-zA-Z\\.]*[a-zA-Z]$")
+// @Pattern(regexp="^[a-zA-Z][\\w\\.-]*[a-zA-Z0-9](a)[a-zA-Z0-9][\\w\\.-]*[a-zA-Z0-9]\\.[a-zA-Z][a-zA-Z\\.]*[a-zA-Z]$")
public String getEmail() {
return email;
}
Modified: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/layout/template.xhtml
===================================================================
--- branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/layout/template.xhtml 2009-07-24 23:45:04 UTC (rev 15017)
+++ branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/layout/template.xhtml 2009-07-28 00:21:54 UTC (rev 15018)
@@ -1,10 +1,11 @@
-<a:page xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:s="http://jboss.com/products/seam/taglib"
- xmlns:a="http://richfaces.org/a4j"
- xmlns:rich="http://richfaces.org/rich"
- pageTitle="#{title}" format="xhtml">
+<f:view xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns:a="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich"
+ locale="#{locale.current}">
+<a:page pageTitle="#{title}" format="xhtml">
<a:loadStyle src="/css/grids.css" />
<a:loadStyle src="resource://css/panel.xcss" />
<a:loadStyle src="resource://css/table.xcss" />
@@ -16,6 +17,14 @@
<div class="yui-b">
<!-- YOUR NAVIGATION GOES HERE -->
<ui:include src="/include/pagesList.xhtml" />
+ <h:form>
+ <h:selectOneMenu value="#{locale.language}">
+ <f:selectItem itemLabel="English" itemValue="en"/>
+ <f:selectItem itemLabel="Deutsch" itemValue="de"/>
+ <f:selectItem itemLabel="Francais" itemValue="fr"/>
+</h:selectOneMenu>
+<h:commandButton action="#{locale.select}" value="ChangeLanguage"/>
+</h:form>
</div>
<div class="yui-main">
<div class="yui-b">
@@ -46,4 +55,5 @@
</div>
</div>
</div>
-</a:page>
\ No newline at end of file
+</a:page>
+</f:view>
\ No newline at end of file
Modified: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/pages/beanValidation.xhtml
===================================================================
--- branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/pages/beanValidation.xhtml 2009-07-24 23:45:04 UTC (rev 15017)
+++ branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/pages/beanValidation.xhtml 2009-07-28 00:21:54 UTC (rev 15018)
@@ -20,7 +20,7 @@
<h:panelGrid columns="3">
<h:outputLabel for="email" value="Email Address:" />
<h:inputText id="email" value="#{bean.email}" label="Email">
- <rich:beanValidator summary="Invalid Email address" profiles="javax.validation.groups.Default"/>
+ <rich:beanValidator summary="Invalid Email address" />
</h:inputText>
<rich:message for="email"/>
<h:outputLabel for="card" value="Credit card number:" />
Modified: branches/community/3.3.X/ui/beanValidator/pom.xml
===================================================================
--- branches/community/3.3.X/ui/beanValidator/pom.xml 2009-07-24 23:45:04 UTC (rev 15017)
+++ branches/community/3.3.X/ui/beanValidator/pom.xml 2009-07-28 00:21:54 UTC (rev 15018)
@@ -70,7 +70,7 @@
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
- <version>1.0.CR2</version>
+ <version>1.0.CR3</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Modified: branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/validator/BeanValidator.java
===================================================================
--- branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/validator/BeanValidator.java 2009-07-24 23:45:04 UTC (rev 15017)
+++ branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/validator/BeanValidator.java 2009-07-28 00:21:54 UTC (rev 15018)
@@ -42,10 +42,10 @@
* java.lang.String, java.lang.Object, java.util.Locale)
*/
@Override
- protected String[] validate(Object base, String property, Object value,
- Locale locale, Set<String> profiles) {
+ protected String[] validate(FacesContext facesContext, Object base, String property,
+ Object value, Set<String> profiles) {
Class beanType = base.getClass();
- Set<ConstraintViolation<Object>> constrains = getValidator(locale)
+ Set<ConstraintViolation<Object>> constrains = getValidator(facesContext)
.validateValue(beanType, property, value, getGroups(profiles));
return extractMessages(constrains);
}
@@ -62,7 +62,7 @@
Set<String> profiles) {
Class<?>[] groups = getGroups(profiles);
Set<ConstraintViolation<Object>> violations = getValidator(
- calculateLocale(context)).validate(value, groups);
+ context).validate(value, groups);
String[] messages = extractMessages(violations);
return messages;
}
@@ -106,10 +106,10 @@
return messages;
}
- protected Validator getValidator(Locale locale) {
+ protected Validator getValidator(FacesContext facesContext) {
ValidatorContext validatorContext = validatorFactory.usingContext();
MessageInterpolator jsfMessageInterpolator = new JsfMessageInterpolator(
- locale, validatorFactory.getMessageInterpolator());
+ calculateLocale(facesContext), validatorFactory.getMessageInterpolator());
validatorContext.messageInterpolator(jsfMessageInterpolator);
Validator beanValidator = validatorContext.getValidator();
return beanValidator;
@@ -138,7 +138,12 @@
public String interpolate(String messageTemplate, Context context,
Locale locale) {
- return delegate.interpolate(messageTemplate, context, locale);
+ if (null != locale) {
+ return delegate.interpolate(messageTemplate, context,
+ this.locale);
+ } else {
+ return delegate.interpolate(messageTemplate, context, locale);
+ }
}
}
Modified: branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/validator/HibernateValidator.java
===================================================================
--- branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/validator/HibernateValidator.java 2009-07-24 23:45:04 UTC (rev 15017)
+++ branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/validator/HibernateValidator.java 2009-07-28 00:21:54 UTC (rev 15018)
@@ -22,10 +22,13 @@
import java.beans.FeatureDescriptor;
import java.util.Collection;
+import java.util.Collections;
import java.util.EmptyStackException;
+import java.util.Enumeration;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
+import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.Set;
import java.util.Stack;
@@ -37,6 +40,8 @@
import org.hibernate.validator.ClassValidator;
import org.hibernate.validator.InvalidValue;
+import org.hibernate.validator.MessageInterpolator;
+import org.hibernate.validator.Validator;
/**
* Perform validation by Hibernate Validator annotations
@@ -46,6 +51,9 @@
*/
public class HibernateValidator extends ObjectValidator {
+ static final String DEFAULT_VALIDATOR_MESSAGES = "org.hibernate.validator.resources.DefaultValidatorMessages";
+ static final String VALIDATOR_MESSAGES = "ValidatorMessages";
+
private Map<ValidatorKey, ClassValidator<? extends Object>> classValidators = new ConcurrentHashMap<ValidatorKey, ClassValidator<? extends Object>>();
HibernateValidator() {
@@ -64,7 +72,7 @@
String validationMessages[] = null;
if (null != value) {
ClassValidator<Object> validator = (ClassValidator<Object>) getValidator(
- value.getClass(), calculateLocale(context));
+ context, value.getClass());
if (validator.hasValidationRules()) {
InvalidValue[] invalidValues = validator
.getInvalidValues(value);
@@ -83,16 +91,16 @@
/**
* Validate bean property in the base class aganist new value.
- *
* @param beanClass
* @param property
* @param value
+ *
* @return
*/
- protected InvalidValue[] validateClass(Class<? extends Object> beanClass,
- String property, Object value, Locale locale) {
+ protected InvalidValue[] validateClass(FacesContext facesContext,
+ Class<? extends Object> beanClass, String property, Object value) {
ClassValidator<? extends Object> classValidator =
- getValidator(beanClass, locale);
+ getValidator(facesContext, beanClass);
InvalidValue[] invalidValues = classValidator
.getPotentialInvalidValues(property, value);
@@ -101,18 +109,18 @@
/**
* Get ( or create ) {@link ClassValidator} for a given bean class.
+ * @param beanClass
*
- * @param beanClass
* @return
*/
@SuppressWarnings("unchecked")
protected ClassValidator<? extends Object> getValidator(
- Class<? extends Object> beanClass, Locale locale) {
+ FacesContext facesContext, Class<? extends Object> beanClass) {
// TODO - localization support.
- ValidatorKey key = new ValidatorKey(beanClass, locale);
+ ValidatorKey key = new ValidatorKey(beanClass, calculateLocale(facesContext));
ClassValidator result = classValidators.get(key);
if (null == result) {
- result = createValidator(beanClass, locale);
+ result = createValidator(facesContext, beanClass);
classValidators.put(key, result);
}
return result;
@@ -126,17 +134,32 @@
*/
@SuppressWarnings("unchecked")
protected ClassValidator<? extends Object> createValidator(
- Class<? extends Object> beanClass, Locale locale) {
- ResourceBundle bundle = getCurrentResourceBundle(locale);
+ FacesContext facesContext, Class<? extends Object> beanClass) {
+ ResourceBundle bundle = createHibernateMessages(facesContext);
return bundle == null ? new ClassValidator(beanClass)
: new ClassValidator(beanClass, bundle);
}
+ /**
+ * @param facesContext
+ * @return
+ */
+ protected ResourceBundle createHibernateMessages(FacesContext facesContext) {
+ ResourceBundle bundle = getResourceBundle(facesContext, VALIDATOR_MESSAGES);
+ ResourceBundle defaultMessagesBundle = getResourceBundle(facesContext, DEFAULT_VALIDATOR_MESSAGES);
+ if(null != bundle && defaultMessagesBundle != null){
+ bundle = new ResourceBundleChain(bundle, defaultMessagesBundle);
+ } else if(null != defaultMessagesBundle){
+ bundle = defaultMessagesBundle;
+ }
+ return bundle;
+ }
+
@Override
- protected String[] validate(Object base, String property, Object value,
- Locale locale, Set<String> profiles) {
- InvalidValue[] invalidValues = validateBean(base, property, value,
- locale);
+ protected String[] validate(FacesContext facesContext, Object base, String property,
+ Object value, Set<String> profiles) {
+ InvalidValue[] invalidValues = validateBean(facesContext, base, property,
+ value);
if (null == invalidValues) {
return null;
} else {
@@ -151,19 +174,68 @@
/**
* Validate bean property of the base object aganist new value
- *
* @param base
* @param property
* @param value
+ *
* @return
*/
- protected InvalidValue[] validateBean(Object base, String property, Object value,
- Locale locale) {
+ protected InvalidValue[] validateBean(FacesContext facesContext, Object base, String property,
+ Object value) {
Class<? extends Object> beanClass = base.getClass();
- InvalidValue[] invalidValues = validateClass(beanClass, property, value, locale);
+ InvalidValue[] invalidValues = validateClass(facesContext, beanClass, property, value);
return invalidValues;
}
+ private static class JsfMessageInterpolator implements MessageInterpolator {
+
+ private Locale locale;
+ private MessageInterpolator delegate;
+
+ public JsfMessageInterpolator(Locale locale,
+ MessageInterpolator delegate) {
+ this.locale = locale;
+ this.delegate = delegate;
+ }
+
+
+ public String interpolate(String message, Validator validator,
+ MessageInterpolator defaultInterpolator) {
+ return delegate.interpolate(message, validator, defaultInterpolator);
+ }
+
+ }
+ static class ResourceBundleChain extends ResourceBundle {
+
+ private final ResourceBundle delegate;
+
+ public ResourceBundleChain(ResourceBundle delegate, ResourceBundle parent) {
+ this.delegate = delegate;
+ setParent(parent);
+ }
+
+ @Override
+ public Enumeration<String> getKeys() {
+ // TODO Auto-generated method stub
+ return null!=delegate?delegate.getKeys():Collections.<String>enumeration(Collections.<String>emptyList());
+ }
+
+ @Override
+ protected Object handleGetObject(String key) {
+ try {
+ return null != delegate ? delegate.getObject(key) : null;
+
+ } catch (MissingResourceException e) {
+ return null;
+ }
+ }
+
+ @Override
+ public Locale getLocale() {
+ return null!=delegate?delegate.getLocale():null;
+ }
+ }
+
}
Modified: branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/validator/NullValidator.java
===================================================================
--- branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/validator/NullValidator.java 2009-07-24 23:45:04 UTC (rev 15017)
+++ branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/validator/NullValidator.java 2009-07-28 00:21:54 UTC (rev 15018)
@@ -3,7 +3,6 @@
*/
package org.richfaces.validator;
-import java.util.Locale;
import java.util.Set;
import javax.faces.context.FacesContext;
@@ -18,8 +17,8 @@
* @see org.richfaces.validator.ObjectValidator#validate(java.lang.Object, java.lang.String, java.lang.Object, java.util.Locale)
*/
@Override
- protected String[] validate(Object base, String property, Object value,
- Locale locale, Set<String> profiles) {
+ protected String[] validate(FacesContext facesContext, Object base, String property,
+ Object value, Set<String> profiles) {
// do nothing.
return null;
}
Modified: branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/validator/ObjectValidator.java
===================================================================
--- branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/validator/ObjectValidator.java 2009-07-24 23:45:04 UTC (rev 15017)
+++ branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/validator/ObjectValidator.java 2009-07-28 00:21:54 UTC (rev 15018)
@@ -6,6 +6,7 @@
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
+import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.Set;
import java.util.Stack;
@@ -15,6 +16,7 @@
import javax.el.ELResolver;
import javax.el.ValueExpression;
import javax.faces.FacesException;
+import javax.faces.application.Application;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
@@ -113,7 +115,7 @@
if (null != target) {
ELContext elContext = context.getELContext();
ValidationResolver validationResolver = createValidationResolver(
- elContext.getELResolver(), calculateLocale(context),profiles);
+ context, elContext.getELResolver(),profiles);
ELContextWrapper wrappedElContext = new ELContextWrapper(elContext,
validationResolver);
// TODO - handle ELExceptions ?
@@ -142,7 +144,7 @@
/**
* Validate bean property for a new value.
- *
+ * @param facesContext TODO
* @param base
* - bean
* @param property
@@ -150,39 +152,46 @@
* @param value
* new value.
* @param profiles TODO
+ *
* @return null for a valid value, array of the validation messages
* othervise.
*/
- protected abstract String[] validate(Object base, String property,
- Object value, Locale locale, Set<String> profiles);
+ protected abstract String[] validate(FacesContext facesContext, Object base,
+ String property, Object value, Set<String> profiles);
- protected ResourceBundle getCurrentResourceBundle(Locale locale) {
- if (null == FacesContext.getCurrentInstance()
- || null == FacesContext.getCurrentInstance().getApplication()) {
- throw new FacesException(FACES_CONTEXT_IS_NULL);
+ protected ResourceBundle getResourceBundle(FacesContext facesContext, String name) {
+ // TODO - cache resource bundles.
+ ResourceBundle bundle = null;
+ if (null != facesContext) {
+ Application application = facesContext.getApplication();
+ try {
+ bundle = application.getResourceBundle(facesContext,
+ name);
+
+ } catch (Exception e) {
+ // Let one more attempt to load resource
+ }
}
- String appBundle = FacesContext.getCurrentInstance().getApplication()
- .getMessageBundle();
- if (null == appBundle || null == locale) {
- return null;
- }
+ if (null == bundle) {
+ ClassLoader classLoader = Thread.currentThread()
+ .getContextClassLoader();
+ if (null == classLoader) {
+ classLoader = this.getClass().getClassLoader();
+ }
+ try {
+ bundle = ResourceBundle.getBundle(name, calculateLocale(facesContext),
+ classLoader);
- ResourceBundle bundle;
-
- ClassLoader classLoader = Thread.currentThread()
- .getContextClassLoader();
- if (classLoader != null) {
- bundle = ResourceBundle.getBundle(appBundle, locale, classLoader);
- } else {
- bundle = ResourceBundle.getBundle(appBundle, locale);
+ } catch (MissingResourceException e) {
+ // Do nothing, use default bundle.
+ }
}
-
return bundle;
}
- protected ValidationResolver createValidationResolver(ELResolver parent,
- Locale locale, Set<String> profiles) {
- return new ValidationResolver(parent, locale, profiles);
+ protected ValidationResolver createValidationResolver(FacesContext context,
+ ELResolver parent, Set<String> profiles) {
+ return new ValidationResolver(parent, context, profiles);
}
/**
@@ -308,20 +317,21 @@
private String[] validationMessages = null;
- private Locale locale = null;
-
private Stack<BasePropertyPair> valuesStack;
private Set<String> profiles;
+ private FacesContext facesContext;
+
/**
* @param parent
+ * @param context
*/
- public ValidationResolver(ELResolver parent, Locale locale,Set<String> profiles) {
+ public ValidationResolver(ELResolver parent, FacesContext context, Set<String> profiles) {
this.parent = parent;
- this.locale = locale;
this.valuesStack = new Stack<BasePropertyPair>();
this.profiles = profiles;
+ this.facesContext = context;
}
public boolean isValid() {
@@ -412,8 +422,8 @@
// apache el looses locale information during value
// resolution,
// so we use our own
- validationMessages = validate(base, property.toString(),
- value, locale, profiles);
+ validationMessages = validate(facesContext, base,
+ property.toString(), value, profiles);
valid = null == validationMessages
|| 0 == validationMessages.length;
Modified: branches/community/3.3.X/ui/beanValidator/src/test/java/org/richfaces/validator/BeanValidatorTest.java
===================================================================
--- branches/community/3.3.X/ui/beanValidator/src/test/java/org/richfaces/validator/BeanValidatorTest.java 2009-07-24 23:45:04 UTC (rev 15017)
+++ branches/community/3.3.X/ui/beanValidator/src/test/java/org/richfaces/validator/BeanValidatorTest.java 2009-07-28 00:21:54 UTC (rev 15018)
@@ -21,7 +21,6 @@
package org.richfaces.validator;
import java.util.List;
-import java.util.Locale;
import java.util.Map;
import java.util.ResourceBundle;
@@ -50,7 +49,7 @@
public void testValidate() throws Exception {
BeanValidator validator = new BeanValidator();
- String[] validate = validator.validate(new Bean(), "property", null, Locale.ENGLISH, null);
+ String[] validate = validator.validate(facesContext, new Bean(), "property", null, null);
assertNotNull(validate);
assertEquals(1, validate.length);
}
Modified: branches/community/3.3.X/ui/beanValidator/src/test/java/org/richfaces/validator/HibernateValidatorTest.java
===================================================================
--- branches/community/3.3.X/ui/beanValidator/src/test/java/org/richfaces/validator/HibernateValidatorTest.java 2009-07-24 23:45:04 UTC (rev 15017)
+++ branches/community/3.3.X/ui/beanValidator/src/test/java/org/richfaces/validator/HibernateValidatorTest.java 2009-07-28 00:21:54 UTC (rev 15018)
@@ -51,26 +51,26 @@
public void testGetValidator() throws Exception {
HibernateValidator beanValidator = new HibernateValidator();
- ClassValidator<? extends Object> validator = beanValidator.getValidator(ValidableBean.class,Locale.ENGLISH);
+ ClassValidator<? extends Object> validator = beanValidator.getValidator(facesContext,ValidableBean.class);
assertNotNull(validator);
assertTrue(validator.hasValidationRules());
- validator = beanValidator.getValidator(String.class,Locale.getDefault());
+ validator = beanValidator.getValidator(facesContext,String.class);
assertNotNull(validator);
assertFalse(validator.hasValidationRules());
}
public void testValidateClass() throws Exception {
HibernateValidator beanValidator = new HibernateValidator();
- InvalidValue[] invalidValues = beanValidator.validateClass(ValidableBean.class, "integerProperty", new Integer(3),Locale.getDefault());
+ InvalidValue[] invalidValues = beanValidator.validateClass(facesContext, ValidableBean.class, "integerProperty",new Integer(3));
assertNotNull(invalidValues);
assertEquals(0, invalidValues.length);
- invalidValues = beanValidator.validateClass(ValidableBean.class, "integerProperty", new Integer(-1),Locale.getDefault());
+ invalidValues = beanValidator.validateClass(facesContext, ValidableBean.class, "integerProperty",new Integer(-1));
assertNotNull(invalidValues);
assertEquals(1, invalidValues.length);
- invalidValues = beanValidator.validateClass(UnValidableBean.class, "integerProperty", new Integer(-1),Locale.getDefault());
+ invalidValues = beanValidator.validateClass(facesContext, UnValidableBean.class, "integerProperty",new Integer(-1));
assertNotNull(invalidValues);
assertEquals(0, invalidValues.length);
- invalidValues = beanValidator.validateClass(ValidableBean.class, "nonExistentProperty", new Integer(-1),Locale.getDefault());
+ invalidValues = beanValidator.validateClass(facesContext, ValidableBean.class, "nonExistentProperty",new Integer(-1));
assertNotNull(invalidValues);
assertEquals(0, invalidValues.length);
@@ -78,14 +78,14 @@
public void testValidateBean() throws Exception {
HibernateValidator beanValidator = new HibernateValidator();
- InvalidValue[] invalidValues = beanValidator.validateBean(new ValidableBean(), "integerProperty", new Integer(-1),Locale.getDefault());
+ InvalidValue[] invalidValues = beanValidator.validateBean(facesContext, new ValidableBean(), "integerProperty",new Integer(-1));
assertNotNull(invalidValues);
assertEquals(1, invalidValues.length);
}
public void testValidateArray() throws Exception {
HibernateValidator beanValidator = new HibernateValidator();
- InvalidValue[] invalidValues = beanValidator.validateBean(new ValidableBean(), "array", "",Locale.getDefault());
+ InvalidValue[] invalidValues = beanValidator.validateBean(facesContext, new ValidableBean(), "array","");
assertNotNull(invalidValues);
assertEquals(2, invalidValues.length);
System.out.println(invalidValues[0].getMessage());
@@ -94,14 +94,14 @@
public void testValidateList() throws Exception {
HibernateValidator beanValidator = new HibernateValidator();
- InvalidValue[] invalidValues = beanValidator.validateBean(new ValidableBean(), "list", "",Locale.getDefault());
+ InvalidValue[] invalidValues = beanValidator.validateBean(facesContext, new ValidableBean(), "list","");
assertNotNull(invalidValues);
assertEquals(1, invalidValues.length);
System.out.println(invalidValues[0].getMessage());
}
public void testValidateMap() throws Exception {
HibernateValidator beanValidator = new HibernateValidator();
- InvalidValue[] invalidValues = beanValidator.validateBean(new ValidableBean(), "map", "",Locale.getDefault());
+ InvalidValue[] invalidValues = beanValidator.validateBean(facesContext, new ValidableBean(), "map","");
assertNotNull(invalidValues);
assertEquals(1, invalidValues.length);
System.out.println(invalidValues[0].getMessage());
@@ -110,7 +110,7 @@
public void testValidationResolver() throws Exception {
ValidableBean bean = new ValidableBean();
HibernateValidator beanValidator = new HibernateValidator();
- ValidationResolver validationResolver = beanValidator.createValidationResolver(facesContext.getELContext().getELResolver(), Locale.US,null);
+ ValidationResolver validationResolver = beanValidator.createValidationResolver(facesContext, facesContext.getELContext().getELResolver(),null);
Object list = validationResolver.getValue(elContext, bean, "list");
assertNotNull(list);
assertTrue(list instanceof List);
@@ -121,7 +121,7 @@
public void testValidationResolverMap() throws Exception {
ValidableBean bean = new ValidableBean();
HibernateValidator beanValidator = new HibernateValidator();
- ValidationResolver validationResolver = beanValidator.createValidationResolver(facesContext.getELContext().getELResolver(), Locale.US,null);
+ ValidationResolver validationResolver = beanValidator.createValidationResolver(facesContext, facesContext.getELContext().getELResolver(),null);
Object list = validationResolver.getValue(elContext, bean, "map");
assertNotNull(list);
assertTrue(list instanceof Map);
@@ -129,4 +129,36 @@
assertFalse(validationResolver.isValid());
assertEquals(1, validationResolver.getValidationMessages().length);
}
+
+ public void testHibernateMessages() throws Exception {
+ HibernateValidator beanValidator = new HibernateValidator();
+ facesContext.getViewRoot().setLocale(Locale.FRANCE);
+ ResourceBundle hibernateMessages = beanValidator.createHibernateMessages(facesContext);
+ assertEquals(Locale.FRANCE.getLanguage(), hibernateMessages.getLocale().getLanguage());
+ String message = hibernateMessages.getString("validator.pattern");
+ assertEquals("doit suivre \"{regex}\"", message);
+
+ }
+
+ public void testLocalization() throws Exception {
+ HibernateValidator beanValidator = new HibernateValidator();
+ InvalidValue[] invalidValues = beanValidator.validateClass(facesContext, ValidableBean.class, "integerProperty",new Integer(-1));
+ assertNotNull(invalidValues);
+ assertEquals(1, invalidValues.length);
+ System.out.println(invalidValues[0]);
+ assertTrue(invalidValues[0].getMessage().contains("must be greater than or equal"));
+ facesContext.getViewRoot().setLocale(Locale.FRANCE);
+ invalidValues = beanValidator.validateClass(facesContext, ValidableBean.class, "integerProperty",new Integer(-1));
+ assertNotNull(invalidValues);
+ assertEquals(1, invalidValues.length);
+ System.out.println(invalidValues[0]);
+ assertTrue(invalidValues[0].getMessage().contains("rieur ou"));
+ facesContext.getViewRoot().setLocale(new Locale("ru","RU"));
+ invalidValues = beanValidator.validateClass(facesContext, ValidableBean.class, "integerProperty",new Integer(-1));
+ assertNotNull(invalidValues);
+ assertEquals(1, invalidValues.length);
+ System.out.println(invalidValues[0]);
+ assertTrue(invalidValues[0].getMessage().contains("i18n Test"));
+ }
+
}
Modified: branches/community/3.3.X/ui/beanValidator/src/test/java/org/richfaces/validator/MockValidationProvider.java
===================================================================
--- branches/community/3.3.X/ui/beanValidator/src/test/java/org/richfaces/validator/MockValidationProvider.java 2009-07-24 23:45:04 UTC (rev 15017)
+++ branches/community/3.3.X/ui/beanValidator/src/test/java/org/richfaces/validator/MockValidationProvider.java 2009-07-28 00:21:54 UTC (rev 15018)
@@ -7,16 +7,17 @@
import java.util.Collections;
import java.util.Set;
-import javax.validation.BeanDescriptor;
import javax.validation.Configuration;
-import javax.validation.ConstraintDescriptor;
import javax.validation.ConstraintValidatorFactory;
import javax.validation.ConstraintViolation;
import javax.validation.MessageInterpolator;
+import javax.validation.Path;
import javax.validation.TraversableResolver;
import javax.validation.Validator;
import javax.validation.ValidatorContext;
import javax.validation.ValidatorFactory;
+import javax.validation.metadata.BeanDescriptor;
+import javax.validation.metadata.ConstraintDescriptor;
import javax.validation.spi.BootstrapState;
import javax.validation.spi.ConfigurationState;
import javax.validation.spi.ValidationProvider;
@@ -30,10 +31,6 @@
public <T> ConstraintViolation<T> getDefaultConstraint(){
return new ConstraintViolation<T>(){
- public ConstraintDescriptor<?> getConstraintDescriptor() {
- // TODO Auto-generated method stub
- return null;
- }
public Object getInvalidValue() {
// TODO Auto-generated method stub
@@ -55,7 +52,7 @@
return null;
}
- public String getPropertyPath() {
+ public Path getPropertyPath() {
// TODO Auto-generated method stub
return null;
}
@@ -69,6 +66,11 @@
// TODO Auto-generated method stub
return null;
}
+
+ public ConstraintDescriptor<?> getConstraintDescriptor() {
+ // TODO Auto-generated method stub
+ return null;
+ }
};
}
@@ -125,6 +127,12 @@
ConstraintViolation<T> constrain = getDefaultConstraint();
return Collections.singleton(constrain);
}
+
+ public <T> T unwrap(Class<T> type) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
};
}
@@ -143,6 +151,11 @@
};
}
+
+ public <T> T unwrap(Class<T> type) {
+ // TODO Auto-generated method stub
+ return null;
+ }
};
}
@@ -220,4 +233,9 @@
return false;
}
+ public Configuration createSpecializedConfiguration(BootstrapState state) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
Added: branches/community/3.3.X/ui/beanValidator/src/test/java/org/richfaces/validator/ObjectValidatorTest.java
===================================================================
--- branches/community/3.3.X/ui/beanValidator/src/test/java/org/richfaces/validator/ObjectValidatorTest.java (rev 0)
+++ branches/community/3.3.X/ui/beanValidator/src/test/java/org/richfaces/validator/ObjectValidatorTest.java 2009-07-28 00:21:54 UTC (rev 15018)
@@ -0,0 +1,79 @@
+package org.richfaces.validator;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.Set;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+
+public class ObjectValidatorTest extends AbstractAjax4JsfTestCase {
+
+ public ObjectValidatorTest(String name) {
+ super(name);
+ }
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public void testCreateInstance() {
+ ObjectValidator objectValidator = ObjectValidator.createInstance();
+ assertEquals(BeanValidator.class, objectValidator.getClass());
+ }
+
+ public void testGetInstance() {
+ ObjectValidator objectValidator = ObjectValidator.getInstance(facesContext);
+ assertEquals(BeanValidator.class, objectValidator.getClass());
+ ObjectValidator objectValidator2 = ObjectValidator.getInstance(facesContext);
+ assertSame(objectValidator, objectValidator2);
+ }
+
+ public void testCalculateLocale() {
+ ObjectValidatorStub validator = new ObjectValidatorStub();
+ facesContext.getViewRoot().setLocale(Locale.FRANCE);
+ assertEquals(Locale.FRANCE, validator.calculateLocale(facesContext));
+ facesContext.getViewRoot().setLocale(Locale.US);
+ assertEquals(Locale.US, validator.calculateLocale(facesContext));
+ }
+
+ public void testGetResourceBundle() {
+ ObjectValidatorStub validator = new ObjectValidatorStub();
+ facesContext.getViewRoot().setLocale(Locale.US);
+ ResourceBundle bundle = validator.getResourceBundle(facesContext, HibernateValidator.DEFAULT_VALIDATOR_MESSAGES);
+ assertNotNull(bundle);
+ assertEquals(Locale.US.getLanguage(), bundle.getLocale().getLanguage());
+ }
+
+ public void testGetResourceBundleNonExists() {
+ ObjectValidatorStub validator = new ObjectValidatorStub();
+ facesContext.getViewRoot().setLocale(Locale.US);
+ ResourceBundle bundle = validator.getResourceBundle(facesContext, "fooBar");
+ assertNull(bundle);
+ }
+
+ private static class ObjectValidatorStub extends ObjectValidator {
+
+ @Override
+ protected String[] validate(FacesContext facesContext, Object base, String property,
+ Object value, Set<String> profiles) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String[] validateGraph(FacesContext context, Object value,
+ Set<String> profiles) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ }
+}
Property changes on: branches/community/3.3.X/ui/beanValidator/src/test/java/org/richfaces/validator/ObjectValidatorTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/community/3.3.X/ui/beanValidator/src/test/resources/ValidatorMessages_ru.properties
===================================================================
--- branches/community/3.3.X/ui/beanValidator/src/test/resources/ValidatorMessages_ru.properties (rev 0)
+++ branches/community/3.3.X/ui/beanValidator/src/test/resources/ValidatorMessages_ru.properties 2009-07-28 00:21:54 UTC (rev 15018)
@@ -0,0 +1 @@
+validator.min=i18n Test
Property changes on: branches/community/3.3.X/ui/beanValidator/src/test/resources/ValidatorMessages_ru.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 5 months
JBoss Rich Faces SVN: r15017 - in root/cdk/trunk: plugins/maven-cdk-plugin and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2009-07-24 19:45:04 -0400 (Fri, 24 Jul 2009)
New Revision: 15017
Removed:
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateTestMojo.java
Modified:
root/cdk/trunk/plugins/maven-cdk-plugin/pom.xml
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/MavenCompilationContext.java
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/MavenLogger.java
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/MavenXMLMerge.java
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/AbstractCreateMojo.java
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/AssemblyAttachedLibraryMojo.java
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/AssemblyLibraryMojo.java
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/CompileMojo.java
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/CreateSkinMojo.java
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/CreateThemeMojo.java
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/SkinInfo.java
root/cdk/trunk/plugins/maven-cdk-plugin/src/main/mdo/resource-config.mdo
root/cdk/trunk/pom.xml
Log:
fix project build
Modified: root/cdk/trunk/plugins/maven-cdk-plugin/pom.xml
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/pom.xml 2009-07-24 23:43:17 UTC (rev 15016)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/pom.xml 2009-07-24 23:45:04 UTC (rev 15017)
@@ -15,32 +15,32 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
- <version>2.0.4</version>
+ <version>2.0.10</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
- <version>2.0.4</version>
+ <version>2.0.10</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
- <version>2.0.4</version>
+ <version>2.0.10</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-archiver</artifactId>
- <version>2.2</version>
+ <version>2.4</version>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>file-management</artifactId>
- <version>1.1</version>
+ <version>1.2.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
- <version>1.5.1</version>
+ <version>1.5.15</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
@@ -50,7 +50,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>3.8.1</version>
+ <version>4.6</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -72,7 +72,7 @@
<plugin>
<groupId>org.codehaus.modello</groupId>
<artifactId>modello-maven-plugin</artifactId>
- <version>1.0-alpha-18</version>
+ <version>1.0.2</version>
<executions>
<execution>
<goals>
Modified: root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/MavenCompilationContext.java
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/MavenCompilationContext.java 2009-07-24 23:43:17 UTC (rev 15016)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/MavenCompilationContext.java 2009-07-24 23:45:04 UTC (rev 15017)
@@ -25,9 +25,8 @@
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.exception.ParseErrorException;
import org.apache.velocity.exception.ResourceNotFoundException;
-import org.richfaces.templatecompiler.builder.AbstractCompilationContext;
-import org.richfaces.templatecompiler.builder.CompilationException;
-import org.richfaces.templatecompiler.elements.ElementsFactory;
+import org.richfaces.cdk.AbstractCompilationContext;
+import org.richfaces.cdk.CdkException;
/**
* @author shura
@@ -42,7 +41,7 @@
* @param logger
* @throws CompilationException
*/
- public MavenCompilationContext(MavenLogger logger,ClassLoader loader,VelocityEngine engine) throws CompilationException {
+ public MavenCompilationContext(MavenLogger logger,ClassLoader loader,VelocityEngine engine) {
super(loader);
this.logger = logger;
this.engine = engine;
@@ -104,26 +103,19 @@
logger.warn(content, error);
}
- /* (non-Javadoc)
- * @see org.richfaces.templatecompiler.builder.CompilationContext#getElementsFactory()
- */
- public ElementsFactory getElementsFactory() {
- // TODO Auto-generated method stub
- return null;
- }
/* (non-Javadoc)
* @see org.richfaces.templatecompiler.builder.CompilationContext#getTemplate(java.lang.String)
*/
- public Template getTemplate(String name) throws CompilationException {
+ public Template getTemplate(String name) throws CdkException {
try {
return engine.getTemplate(name);
} catch (ResourceNotFoundException e) {
- throw new CompilationException(e.getLocalizedMessage());
+ throw new CdkException(e.getLocalizedMessage());
} catch (ParseErrorException e) {
- throw new CompilationException(e.getLocalizedMessage());
+ throw new CdkException(e.getLocalizedMessage());
} catch (Exception e) {
- throw new CompilationException(e.getLocalizedMessage());
+ throw new CdkException(e.getLocalizedMessage());
}
}
Modified: root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/MavenLogger.java
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/MavenLogger.java 2009-07-24 23:43:17 UTC (rev 15016)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/MavenLogger.java 2009-07-24 23:45:04 UTC (rev 15017)
@@ -22,7 +22,7 @@
package org.richfaces.builder.maven;
import org.apache.maven.plugin.logging.Log;
-import org.richfaces.builder.generator.Logger;
+import org.richfaces.cdk.Logger;
/**
* @author shura
Modified: root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/MavenXMLMerge.java
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/MavenXMLMerge.java 2009-07-24 23:43:17 UTC (rev 15016)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/maven/MavenXMLMerge.java 2009-07-24 23:45:04 UTC (rev 15017)
@@ -30,10 +30,9 @@
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.logging.Log;
import org.codehaus.plexus.util.DirectoryScanner;
-import org.richfaces.builder.config.ParsingException;
-import org.richfaces.builder.xml.XMLBody;
-import org.richfaces.builder.xml.XMLBodyMerge;
-import org.richfaces.builder.xml.XPathComparator;
+import org.richfaces.cdk.xmlutils.XMLBody;
+import org.richfaces.cdk.xmlutils.XMLBodyMerge;
+import org.richfaces.cdk.xmlutils.XPathComparator;
/**
* Class is used to locate and merge several xml files
@@ -100,7 +99,7 @@
} catch (FileNotFoundException e) {
throw new MojoExecutionException("Could't read file "
+ sourceFile.getPath(), e);
- } catch (ParsingException e) {
+ } catch (org.richfaces.cdk.xmlutils.ParsingException e) {
throw new MojoExecutionException(
"Error parsing config file "
+ sourceFile.getPath(), e);
Modified: root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/AbstractCreateMojo.java
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/AbstractCreateMojo.java 2009-07-24 23:43:17 UTC (rev 15016)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/AbstractCreateMojo.java 2009-07-24 23:45:04 UTC (rev 15017)
@@ -25,9 +25,9 @@
import java.util.HashSet;
import java.util.Set;
-import org.aja4jsf.builder.model.Resource;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.velocity.VelocityContext;
+import org.richfaces.cdk.model.Resource;
/**
* @author Nick Belaevski
Modified: root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/AssemblyAttachedLibraryMojo.java
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/AssemblyAttachedLibraryMojo.java 2009-07-24 23:43:17 UTC (rev 15016)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/AssemblyAttachedLibraryMojo.java 2009-07-24 23:45:04 UTC (rev 15017)
@@ -58,11 +58,11 @@
import org.codehaus.plexus.archiver.UnArchiver;
import org.codehaus.plexus.archiver.manager.ArchiverManager;
import org.codehaus.plexus.util.DirectoryScanner;
-import org.richfaces.builder.config.ParsingException;
-import org.richfaces.builder.xml.NamesListComparator;
-import org.richfaces.builder.xml.XMLBody;
-import org.richfaces.builder.xml.XMLBodyMerge;
-import org.richfaces.builder.xml.XPathComparator;
+import org.richfaces.cdk.xmlutils.NamesListComparator;
+import org.richfaces.cdk.xmlutils.ParsingException;
+import org.richfaces.cdk.xmlutils.XMLBody;
+import org.richfaces.cdk.xmlutils.XMLBodyMerge;
+import org.richfaces.cdk.xmlutils.XPathComparator;
import org.w3c.dom.Node;
/**
@@ -423,7 +423,7 @@
} catch (FileNotFoundException e) {
throw new MojoExecutionException(
"Could't read faces-config file", e);
- } catch (ParsingException e) {
+ } catch (org.richfaces.cdk.xmlutils.ParsingException e) {
throw new MojoExecutionException(
"Error parsing faces-config file", e);
}
Modified: root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/AssemblyLibraryMojo.java
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/AssemblyLibraryMojo.java 2009-07-24 23:43:17 UTC (rev 15016)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/AssemblyLibraryMojo.java 2009-07-24 23:45:04 UTC (rev 15017)
@@ -57,11 +57,11 @@
import org.codehaus.plexus.archiver.UnArchiver;
import org.codehaus.plexus.archiver.manager.ArchiverManager;
import org.codehaus.plexus.util.DirectoryScanner;
-import org.richfaces.builder.config.ParsingException;
-import org.richfaces.builder.xml.NamesListComparator;
-import org.richfaces.builder.xml.XMLBody;
-import org.richfaces.builder.xml.XMLBodyMerge;
-import org.richfaces.builder.xml.XPathComparator;
+import org.richfaces.cdk.xmlutils.NamesListComparator;
+import org.richfaces.cdk.xmlutils.ParsingException;
+import org.richfaces.cdk.xmlutils.XMLBody;
+import org.richfaces.cdk.xmlutils.XMLBodyMerge;
+import org.richfaces.cdk.xmlutils.XPathComparator;
import org.w3c.dom.Node;
/**
Modified: root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/CompileMojo.java
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/CompileMojo.java 2009-07-24 23:43:17 UTC (rev 15016)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/CompileMojo.java 2009-07-24 23:45:04 UTC (rev 15017)
@@ -21,6 +21,7 @@
package org.richfaces.builder.mojo;
+import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.io.File;
import java.lang.reflect.Array;
@@ -30,7 +31,6 @@
import java.util.List;
import java.util.Map;
-import org.apache.commons.beanutils.PropertyUtils;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.model.Parent;
import org.apache.maven.plugin.MojoExecutionException;
@@ -253,29 +253,29 @@
// All other objects threaded as Java Beans.
try {
StringBuffer ret = new StringBuffer("{");
- PropertyDescriptor[] propertyDescriptors = PropertyUtils
- .getPropertyDescriptors(obj);
+ PropertyDescriptor[] propertyDescriptors = Introspector
+ .getBeanInfo(obj.getClass()).getPropertyDescriptors();
boolean first = true;
for (int i = 0; i < propertyDescriptors.length; i++) {
PropertyDescriptor propertyDescriptor = propertyDescriptors[i];
String key = propertyDescriptor.getName();
- if ("class".equals(key)
- || propertyDescriptor.getReadMethod() == null) {
- continue;
+ if (!"class".equals(key)
+ && propertyDescriptor.getReadMethod() != null) {
+ if (!first) {
+ ret.append(",\n\t");
+ }
+ addEncodedString(ret, key);
+ ret.append(":");
+ try {
+ Object value = propertyDescriptor.getReadMethod()
+ .invoke(obj, new Object[] {});
+ propertyDescriptor.getReadMethod();
+ ret.append(String.valueOf(value));
+ } catch (InvocationTargetException e) {
+ ret.append("null");
+ }// ret.append(toLog(PropertyUtils.getProperty(obj, key)));
+ first = false;
}
- if (!first) {
- ret.append(",\n\t");
- }
- addEncodedString(ret, key);
- ret.append(":");
- try {
- ret.append(String.valueOf(PropertyUtils.getProperty(obj,
- key)));
-
- } catch (InvocationTargetException e) {
- ret.append("Not ACCESIBLE");
- }// ret.append(toLog(PropertyUtils.getProperty(obj, key)));
- first = false;
}
return ret.append("}\n").toString();
} catch (Exception e) {
Modified: root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/CreateSkinMojo.java
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/CreateSkinMojo.java 2009-07-24 23:43:17 UTC (rev 15016)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/CreateSkinMojo.java 2009-07-24 23:45:04 UTC (rev 15017)
@@ -33,10 +33,6 @@
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
-import org.aja4jsf.builder.model.Resource;
-import org.aja4jsf.builder.model.ResourceConfig;
-import org.aja4jsf.builder.model.io.xpp3.ResourceConfigXpp3Reader;
-import org.aja4jsf.builder.model.io.xpp3.ResourceConfigXpp3Writer;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
@@ -44,6 +40,10 @@
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.velocity.VelocityContext;
+import org.richfaces.cdk.model.Resource;
+import org.richfaces.cdk.model.ResourceConfig;
+import org.richfaces.cdk.model.io.xpp3.ResourceConfigXpp3Reader;
+import org.richfaces.cdk.model.io.xpp3.ResourceConfigXpp3Writer;
/**
* This mojo is intended to create new skin add-on within existing project.
Modified: root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/CreateThemeMojo.java
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/CreateThemeMojo.java 2009-07-24 23:43:17 UTC (rev 15016)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/CreateThemeMojo.java 2009-07-24 23:45:04 UTC (rev 15017)
@@ -24,10 +24,10 @@
import java.io.File;
import java.util.Locale;
-import org.aja4jsf.builder.model.Resource;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.velocity.VelocityContext;
+import org.richfaces.cdk.model.Resource;
/**
* This mojo is intended to create new theme within existing project.
Deleted: root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java 2009-07-24 23:43:17 UTC (rev 15016)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java 2009-07-24 23:45:04 UTC (rev 15017)
@@ -1,339 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.builder.mojo;
-
-import java.io.File;
-import java.io.FilenameFilter;
-
-import org.apache.maven.model.Resource;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.project.MavenProject;
-import org.apache.velocity.Template;
-import org.apache.velocity.exception.ParseErrorException;
-import org.apache.velocity.exception.ResourceNotFoundException;
-import org.richfaces.builder.config.BuilderConfig;
-import org.richfaces.builder.config.ParsingException;
-import org.richfaces.builder.generator.ComponentGenerator2;
-import org.richfaces.builder.generator.ComponentTagGenerator;
-import org.richfaces.builder.generator.ConverterGenerator;
-import org.richfaces.builder.generator.ConverterTagGenerator;
-import org.richfaces.builder.generator.FaceletsTaglibGenerator;
-import org.richfaces.builder.generator.FacesConfigGenerator;
-import org.richfaces.builder.generator.GeneratorException;
-import org.richfaces.builder.generator.JSFGeneratorConfiguration;
-import org.richfaces.builder.generator.ListenerGenerator;
-import org.richfaces.builder.generator.ListenerTagGenerator;
-import org.richfaces.builder.generator.RenderKitBean;
-import org.richfaces.builder.generator.RendererGenerator;
-import org.richfaces.builder.generator.ResourcesConfigGenerator;
-import org.richfaces.builder.generator.ResourcesConfigParser;
-import org.richfaces.builder.generator.ResourcesDependenciesGenerator;
-import org.richfaces.builder.generator.TagHandlerGenerator;
-import org.richfaces.builder.generator.TaglibGenerator;
-import org.richfaces.builder.generator.ValidatorGenerator;
-import org.richfaces.builder.generator.ValidatorTagGenerator;
-import org.richfaces.builder.maven.MavenLogger;
-import org.richfaces.builder.velocity.BuilderContext;
-
-/**
- * This plugin geterate JSF components and renderers source code, as well as
- * configuration files.
- *
- * @author shura
- * @goal generate
- * @requiresDependencyResolution compile
- * @phase generate-sources
- * @execute phase="compile"
- */
-public class GenerateMojo extends AbstractCDKMojo implements
- JSFGeneratorConfiguration {
-
- /**
- * Project executed by first compile lifecycle.
- *
- * @parameter expression="${executedProject}"
- * @readonly
- */
- protected MavenProject executedProject;
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.maven.plugin.Mojo#execute()
- */
- public void execute() throws MojoExecutionException, MojoFailureException {
- getLog().debug("GenerateMojo components");
-
- //FIXME: configure plexus component instead of programmatic property set.
-
- // velocity.getEngine().setProperty("velocimacro.library", getTemplatesPath() + "/VM_global_library.vm");
-
- if (null != executedProject) {
- Taglib taglib = checkLibraryConfig();
- ClassLoader contextCL = Thread.currentThread().getContextClassLoader();
- // compile goal executed
- try {
- // Parse config files.
- ClassLoader generatiorLoader = createProjectClassLoader(executedProject);
- Thread.currentThread().setContextClassLoader(generatiorLoader);
- BuilderConfig config = createConfig(generatiorLoader);
- MavenLogger mavenLogger = new MavenLogger(getLog());
- // TODO - parse sources by qdox for JavaDoc comments ?
- // GenerateMojo components.
- ComponentGenerator2 compGenerator = new ComponentGenerator2(this,
- mavenLogger);
- compGenerator.createFiles(config);
- // GenerateMojo validators
- ValidatorGenerator validatorGenerator = new ValidatorGenerator(this, mavenLogger);
- validatorGenerator.createFiles(config);
- // GenerateMojo converters
- ConverterGenerator converterGenerator = new ConverterGenerator(this, mavenLogger);
- converterGenerator.createFiles(config);
- // GenerateMojo renderers
- RendererGenerator rendererGenerator = new RendererGenerator(
- this, mavenLogger);
- rendererGenerator.setSrcDir(templatesDirectory);
- rendererGenerator.createFiles(config);
- // GenerateMojo component test
-/*
- ComponentTestGenerator componentTestGenerator = new ComponentTestGenerator(this, mavenLogger);
- componentTestGenerator.setDestDir(outputTestsDirectory);
- componentTestGenerator.createFiles(config);
-*/
- // GenerateMojo tags
- ComponentTagGenerator componentTagGenerator = new ComponentTagGenerator(this, mavenLogger);
- componentTagGenerator.createFiles(config);
-
-// GenerateMojo tags for validators
- ValidatorTagGenerator validatorTagGenerator = new ValidatorTagGenerator(this, mavenLogger);
- validatorTagGenerator.createFiles(config);
-
-// GenerateMojo tags for converters
- ConverterTagGenerator converterTagGenerator = new ConverterTagGenerator(this, mavenLogger);
- converterTagGenerator.createFiles(config);
-
-
- ListenerTagGenerator listenerTagGenerator = new ListenerTagGenerator(this, mavenLogger);
- listenerTagGenerator.createFiles(config);
-
-
- // GenerateMojo tag test
-/*
- TagTestGenerator tagTestGenerator = new TagTestGenerator(this, mavenLogger);
- tagTestGenerator.setDestDir(outputTestsDirectory);
- tagTestGenerator.createFiles(config);
-*/
- // GenerateMojo tag handlers
- TagHandlerGenerator tagHandlerGenerator = new TagHandlerGenerator(
- this, mavenLogger);
- tagHandlerGenerator.createFiles(config);
- //Generate listeners
- ListenerGenerator listenerGenerator = new ListenerGenerator(this, mavenLogger);
- listenerGenerator.createFiles(config);
-
- JSFGeneratorConfiguration resourcesConfiguration = new JSFGeneratorConfiguration() {
-
- public ClassLoader getClassLoader() {
- return createProjectClassLoader(executedProject);
- }
-
- public File getDestDir() {
- return outputResourcesDirectory;
- }
-
- public String getKey() {
- return key;
- }
-
- public Template getTemplate(String name) throws GeneratorException {
- return GenerateMojo.this.getTemplate(name);
- }
-
- public String getTemplatesPath() {
- return GenerateMojo.this.getTemplatesPath();
- }
-
- };
- // GenerateMojo faces-config
- FacesConfigGenerator configGenerator = new FacesConfigGenerator(
- resourcesConfiguration, mavenLogger);
- configGenerator.setInclude(facesConfigInclude);
- configGenerator.setFacesconfig(new File(
- outputResourcesDirectory, "META-INF/faces-config.xml"));
- RenderKitBean renderKitBean = configGenerator.createRenderKit();
- renderKitBean.setRenderkitid("HTML_BASIC");
- configGenerator.createFiles(config);
- // GenerateMojo JSP taglib
- if (null != taglib) {
- TaglibGenerator taglibGenerator = new TaglibGenerator(
- resourcesConfiguration, mavenLogger);
- taglibGenerator.setUri(taglib.getUri());
- taglibGenerator.setShortname(taglib.getShortName());
- taglibGenerator.setListenerclass(taglib.getListenerClass());
- taglibGenerator.setDisplayname(taglib.getDisplayName());
- taglibGenerator.setListenerclass(taglib.getListenerClass());
- taglibGenerator.setValidatorclass(taglib.getValidatorClass());
- taglibGenerator.setTlibversion(taglib.getTlibVersion());
- taglibGenerator.setJspversion(taglib.getJspVersion());
- taglibGenerator.setInclude(taglibInclude);
- taglibGenerator.setTaglib(new File(
- outputResourcesDirectory, "META-INF/"+taglib.getShortName()
- + ".tld"));
- taglibGenerator.createFiles(config);
- // GenerateMojo Facelets taglib
- FaceletsTaglibGenerator faceletsTaglibGenerator = new FaceletsTaglibGenerator(
- resourcesConfiguration, mavenLogger);
- faceletsTaglibGenerator.setUri(taglib.getUri());
- faceletsTaglibGenerator.setShortname(taglib.getShortName());
- faceletsTaglibGenerator.setInclude(taglibInclude);
- faceletsTaglibGenerator.setTaglib(new File(
- outputResourcesDirectory, "META-INF/"+taglib.getShortName()
- + ".taglib.xml"));
- faceletsTaglibGenerator.createFiles(config);
- }
-
- ResourcesConfigParser resourcesConfigParser = new ResourcesConfigParser(resourcesConfiguration, mavenLogger);
- resourcesConfigParser.setTemplates(templatesDirectory);
- resourcesConfigParser.parse(config);
-
- if (taglib != null) {
- ResourcesDependenciesGenerator resourcesDependenciesGenerator = new ResourcesDependenciesGenerator(resourcesConfiguration, mavenLogger);
- resourcesDependenciesGenerator.setUri(taglib.getUri());
- resourcesDependenciesGenerator.setDependencyFile(new File(outputResourcesDirectory,
- "META-INF/" + taglib.getShortName() + ".component-dependencies.xml"));
- resourcesDependenciesGenerator.setComponentDependencies(resourcesConfigParser.getComponentResourcesMap());
- resourcesDependenciesGenerator.createFiles(config);
- }
-
- // Generate resources configuration file resources-config.xml
- // for all images/scripts/css...
- ResourcesConfigGenerator resourcesConfigGenerator = new ResourcesConfigGenerator(resourcesConfiguration, mavenLogger);
- resourcesConfigGenerator.setResourcesConfigGeneratorBean(resourcesConfigParser.getResourcesConfigGeneratorBean());
- resourcesConfigGenerator.setInclude(resourcesInclude);
- resourcesConfigGenerator.setTemplates(templatesDirectory);
- resourcesConfigGenerator.setResourcesConfig(new File(
- outputResourcesDirectory, "META-INF/resources-config.xml"));
- resourcesConfigGenerator.createFiles(config);
-
- // Add generated sources and resources to project
- project.addCompileSourceRoot(outputJavaDirectory.getPath());
-// project.addCompileSourceRoot(outputTestsDirectory.getPath());
-
- Resource resource = new Resource();
- resource.setDirectory(outputResourcesDirectory.getPath());
-// resource.setTargetPath("META-INF");
- project.addResource(resource);
- } catch (Exception e) {
- getLog().error("Error on generate component", e);
- throw new MojoExecutionException(
- "Error in component generation", e);
- }
- Thread.currentThread().setContextClassLoader(contextCL);
- }
-
- }
-
- protected BuilderConfig createConfig(ClassLoader generatiorLoader)
- throws ParsingException {
- BuilderConfig builderConfig = new BuilderConfig(generatiorLoader,
- new MavenLogger(getLog()));
- // Get all *.xml config files
- FilenameFilter filter = new FilenameFilter() {
-
- public boolean accept(File dir, String name) {
-
- return name.toLowerCase().endsWith(".xml");
- }
-
- };
- boolean filesParsed = false;
- File [] directories = {
- componentConfigDirectory,
- validatorConfigDirectory,
- converterConfigDirectory
- };
-
- for (File directory : directories) {
- if (directory.exists()) {
- File[] files = directory.listFiles(filter);
- for (File file : files) {
- filesParsed = true;
- builderConfig.parseConfig(file);
- }
- }
- }
- if (!filesParsed) {
- getLog().warn("No component configuration files found -- probably a skin project");
- }
- /*
- if (!filesParsed) {
- throw new ParsingException("No config files found");
- }
- */
- builderConfig.checkComponentProperties();
- return builderConfig;
- }
-
- public File getDestDir() {
- // TODO Auto-generated method stub
- return outputJavaDirectory;
- }
-
- public String getKey() {
- // TODO Auto-generated method stub
- return key;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.richfaces.builder.generator.JSFGeneratorConfiguration#getClassLoader()
- */
- public ClassLoader getClassLoader() {
- return createProjectClassLoader(executedProject);
- }
-
- /* (non-Javadoc)
- * @see org.richfaces.builder.generator.JSFGeneratorConfiguration#getTemplate(java.lang.String)
- */
- public Template getTemplate(String name) throws GeneratorException {
- // TODO Auto-generated method stub
- try {
- return this.velocity.getEngine().getTemplate(name);
- } catch (ResourceNotFoundException e) {
- throw new GeneratorException(e.getLocalizedMessage());
- } catch (ParseErrorException e) {
- throw new GeneratorException(e.getLocalizedMessage());
- } catch (Exception e) {
- throw new GeneratorException(e.getLocalizedMessage());
- }
- }
-
- /* (non-Javadoc)
- * @see org.richfaces.builder.generator.JSFGeneratorConfiguration#getTemplatesPath()
- */
- public String getTemplatesPath() {
- return Library.JSF12.equals(library.getJsfVersion())?BuilderContext.TEMPLATES12_PATH:BuilderContext.TEMPLATES_PATH;
- }
-
-}
Deleted: root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateTestMojo.java
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateTestMojo.java 2009-07-24 23:43:17 UTC (rev 15016)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateTestMojo.java 2009-07-24 23:45:04 UTC (rev 15017)
@@ -1,171 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.builder.mojo;
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.richfaces.builder.config.BuilderConfig;
-import org.richfaces.builder.generator.ComponentTestGenerator;
-import org.richfaces.builder.generator.TagTestGenerator;
-import org.richfaces.builder.maven.MavenLogger;
-
-/**
- *
- * @author dbiatenia
- * @goal generate-tests
- * @requiresDependencyResolution test
- * @phase generate-test-sources
- * @execute phase="test-compile"
- */
-public class GenerateTestMojo extends GenerateMojo{
-
- public void execute() throws MojoExecutionException, MojoFailureException {
- getLog().debug("GenerateTestMojo tests");
- if (null != executedProject) {
- Taglib taglib = checkLibraryConfig();
- // compile goal executed
- try {
- // Parse config files.
- ClassLoader generatiorLoader = createProjectClassLoader(executedProject);
- BuilderConfig config = createConfig(generatiorLoader);
- MavenLogger mavenLogger = new MavenLogger(getLog());
- // TODO - parse sources by qdox for JavaDoc comments ?
- // GenerateMojo components.
-/*
- ComponentGenerator compGenerator = new ComponentGenerator(this,
- mavenLogger);
- compGenerator.createFiles(config);
-*/
- // GenerateMojo renderers
-/*
- RendererGenerator rendererGenerator = new RendererGenerator(
- this, mavenLogger);
- rendererGenerator.setSrcDir(templatesDirectory);
- rendererGenerator.createFiles(config);
-*/
- // GenerateMojo component test
- ComponentTestGenerator componentTestGenerator = new ComponentTestGenerator(this, mavenLogger);
- componentTestGenerator.setDestDir(outputTestsDirectory);
- componentTestGenerator.createFiles(config);
-
- // GenerateMojo tags
-/*
- TagGenerator tagGenerator = new TagGenerator(this, mavenLogger);
- tagGenerator.createFiles(config);
-*/
- // GenerateMojo tag test
- TagTestGenerator tagTestGenerator = new TagTestGenerator(this, mavenLogger);
- tagTestGenerator.setDestDir(outputTestsDirectory);
- tagTestGenerator.createFiles(config);
-
- // GenerateMojo tag handlers
-/*
- TagHandlerGenerator tagHandlerGenerator = new TagHandlerGenerator(
- this, mavenLogger);
- tagHandlerGenerator.createFiles(config);
- //Generate listeners
- ListenerGenerator listenerGenerator = new ListenerGenerator(this, mavenLogger);
- listenerGenerator.createFiles(config);
-*/
-/*
- JSFGeneratorConfiguration resourcesConfiguration = new JSFGeneratorConfiguration() {
-
- public ClassLoader getClassLoader() {
- return createProjectClassLoader(executedProject);
- }
-
- public File getDestDir() {
- return outputResourcesDirectory;
- }
-
- public String getKey() {
- return key;
- }
-
- public Template getTemplate(String name) throws GeneratorException {
- return GenerateTestMojo.this.getTemplate(name);
- }
-
- public String getTemplatesPath() {
- return GenerateTestMojo.this.getTemplatesPath();
- }
-
- };
- // GenerateMojo faces-config
- FacesConfigGenerator configGenerator = new FacesConfigGenerator(
- resourcesConfiguration, mavenLogger);
- configGenerator.setInclude(facesConfigInclude);
- configGenerator.setFacesconfig(new File(
- outputResourcesDirectory, "META-INF/faces-config.xml"));
- RenderKitBean renderKitBean = configGenerator.createRenderKit();
- renderKitBean.setRenderkitid("HTML_BASIC");
- configGenerator.createFiles(config);
- // GenerateMojo JSP taglib
- if (null != taglib) {
- TaglibGenerator taglibGenerator = new TaglibGenerator(
- resourcesConfiguration, mavenLogger);
- taglibGenerator.setUri(taglib.getUri());
- taglibGenerator.setShortname(taglib.getShortName());
- taglibGenerator.setListenerclass(taglib.getListenerClass());
- taglibGenerator.setDisplayname(taglib.getDisplayName());
- taglibGenerator.setListenerclass(taglib.getListenerClass());
- taglibGenerator.setValidatorclass(taglib.getValidatorClass());
- taglibGenerator.setTlibversion(taglib.getTlibVersion());
- taglibGenerator.setJspversion(taglib.getJspVersion());
- taglibGenerator.setInclude(taglibInclude);
- taglibGenerator.setTaglib(new File(
- outputResourcesDirectory, "META-INF/"+taglib.getShortName()
- + ".tld"));
- taglibGenerator.createFiles(config);
- // GenerateMojo Facelets taglib
- FaceletsTaglibGenerator faceletsTaglibGenerator = new FaceletsTaglibGenerator(
- resourcesConfiguration, mavenLogger);
- faceletsTaglibGenerator.setUri(taglib.getUri());
- faceletsTaglibGenerator.setShortname(taglib.getShortName());
- faceletsTaglibGenerator.setInclude(taglibInclude);
- faceletsTaglibGenerator.setTaglib(new File(
- outputResourcesDirectory, "META-INF/"+taglib.getShortName()
- + ".taglib.xml"));
- faceletsTaglibGenerator.createFiles(config);
- }
- // Generate resources configuration file resources-config.xml
- // for all images/scripts/css...
- // Add generated sources and resources to project
-*/
-// project.addCompileSourceRoot(outputJavaDirectory.getPath());
- project.addTestCompileSourceRoot(outputTestsDirectory.getPath());
-/*
- Resource resource = new Resource();
- resource.setDirectory(outputResourcesDirectory.getPath());
-// resource.setTargetPath("META-INF");
- project.addResource(resource);
-*/
- } catch (Exception e) {
- getLog().error("Error on generate component", e);
- throw new MojoExecutionException(
- "Error in component generation", e);
- }
- }
-
- }
-
-}
Modified: root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/SkinInfo.java
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/SkinInfo.java 2009-07-24 23:43:17 UTC (rev 15016)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/SkinInfo.java 2009-07-24 23:45:04 UTC (rev 15017)
@@ -24,7 +24,7 @@
import java.util.ArrayList;
import java.util.List;
-import org.aja4jsf.builder.model.Resource;
+import org.richfaces.cdk.model.Resource;
/**
* @author Maksim Kaszynski
Modified: root/cdk/trunk/plugins/maven-cdk-plugin/src/main/mdo/resource-config.mdo
===================================================================
--- root/cdk/trunk/plugins/maven-cdk-plugin/src/main/mdo/resource-config.mdo 2009-07-24 23:43:17 UTC (rev 15016)
+++ root/cdk/trunk/plugins/maven-cdk-plugin/src/main/mdo/resource-config.mdo 2009-07-24 23:45:04 UTC (rev 15017)
@@ -5,7 +5,7 @@
<defaults>
<default>
<key>package</key>
- <value>org.aja4jsf.builder.model</value>
+ <value>org.richfaces.cdk.model</value>
</default>
</defaults>
<classes>
Modified: root/cdk/trunk/pom.xml
===================================================================
--- root/cdk/trunk/pom.xml 2009-07-24 23:43:17 UTC (rev 15016)
+++ root/cdk/trunk/pom.xml 2009-07-24 23:45:04 UTC (rev 15017)
@@ -29,6 +29,63 @@
<url>file:target/site2</url>
</site-->
</distributionManagement>
+ <repositories>
+ <repository>
+ <releases />
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>maven-repository2.dev.java.net</id>
+ <name>Java.net Repository for Maven 2</name>
+ <url>http://download.java.net/maven/2</url>
+ </repository>
+
+ <repository>
+ <id>repository.jboss.org</id>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <url>http://repository.jboss.org/maven2</url>
+ </repository>
+ <repository>
+ <id>snapshots.jboss.org</id>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </snapshots>
+ <url>http://snapshots.jboss.org/maven2</url>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>repository.jboss.org</id>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <url>http://repository.jboss.org/maven2</url>
+ </pluginRepository>
+ <pluginRepository>
+ <id>snapshots.jboss.org</id>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </snapshots>
+ <url>http://snapshots.jboss.org/maven2</url>
+ </pluginRepository>
+ </pluginRepositories>
+
<modules>
<module>plugins</module>
<module>archetypes</module>
15 years, 5 months