JBoss Rich Faces SVN: r13366 - in trunk/ui/menu-components/src/main: java/org/richfaces/renderkit/html and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-04-02 15:43:16 -0400 (Thu, 02 Apr 2009)
New Revision: 13366
Modified:
trunk/ui/menu-components/src/main/config/component/menucomponents.xml
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/AbstractMenuRenderer.java
trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
Log:
https://jira.jboss.org/jira/browse/RF-5226
Modified: trunk/ui/menu-components/src/main/config/component/menucomponents.xml
===================================================================
--- trunk/ui/menu-components/src/main/config/component/menucomponents.xml 2009-04-02 19:07:12 UTC (rev 13365)
+++ trunk/ui/menu-components/src/main/config/component/menucomponents.xml 2009-04-02 19:43:16 UTC (rev 13366)
@@ -127,13 +127,11 @@
<name>selectStyle</name>
<classname>java.lang.String</classname>
<description>CSS style rules to be applied to selected items</description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
</property>
<property>
<name>selectClass</name>
<classname>java.lang.String</classname>
<description>Class to be applied to selected items</description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
</property>
<property>
<name>iconStyle</name>
@@ -144,13 +142,11 @@
<name>iconClass</name>
<classname>java.lang.String</classname>
<description>Class to be applied to icon element</description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
</property>
<property>
<name>labelClass</name>
<classname>java.lang.String</classname>
<description>Class to be applied to label element</description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
</property>
<property>
<name>converter</name>
@@ -276,31 +272,26 @@
<name>selectClass</name>
<classname>java.lang.String</classname>
<description>Class to be applied to selected items</description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
</property>
<property>
<name>selectStyle</name>
<classname>java.lang.String</classname>
<description>CSS style rules to be applied to selected items</description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
</property>
<property>
<name>iconClass</name>
<classname>java.lang.String</classname>
<description>Class to be applied to icon element</description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
</property>
<property>
<name>iconStyle</name>
<classname>java.lang.String</classname>
<description>CSS style rules to be applied to icon element</description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
</property>
<property>
<name>labelClass</name>
<classname>java.lang.String</classname>
<description>Class to be applied to label element</description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
</property>
&ajax_component_attributes;
Modified: trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/AbstractMenuRenderer.java
===================================================================
--- trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/AbstractMenuRenderer.java 2009-04-02 19:07:12 UTC (rev 13365)
+++ trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/AbstractMenuRenderer.java 2009-04-02 19:43:16 UTC (rev 13366)
@@ -82,24 +82,24 @@
protected String getItemScript(FacesContext context, UIComponent kid) {
String itemId = null;
- int flcloseonclick = 1;
- int flagGroup = 0;
+ boolean closeOnClick = true;
+ Integer flagGroup = null;
boolean disabled = false;
if (kid instanceof UIMenuItem) {
UIMenuItem menuItem = (UIMenuItem) kid;
itemId = kid.getClientId(context);
disabled = menuItem.isDisabled();
if (disabled) {
- flcloseonclick = 0;
+ closeOnClick = false;
}
} else if (kid instanceof UIMenuGroup) {
UIMenuGroup menuGroup = (UIMenuGroup) kid;
itemId = kid.getClientId(context);
- flcloseonclick = 0;
+ closeOnClick = false;
if ((disabled = menuGroup.isDisabled())) {
- flagGroup = 2;
+ flagGroup = Integer.valueOf(2);
} else {
- flagGroup = 1;
+ flagGroup = Integer.valueOf(1);
}
}
if (itemId != null) {
@@ -109,9 +109,12 @@
options.addEventHandler("onmouseout");
options.addEventHandler("onmouseover");
- options.addOption("closeOnClick", new Integer(flcloseonclick));
- options.addOption("flagGroup", new Integer(flagGroup));
+ if (closeOnClick) {
+ options.addOption("closeOnClick", Boolean.TRUE);
+ }
+ options.addOption("flagGroup", flagGroup);
+
options.addOption("styleClass");
options.addOption("style");
options.addOption("itemClass");
@@ -126,8 +129,11 @@
options.addOption("selectClass");
options.addOption("selectStyle");
options.addOption("iconClass");
- options.addOption("disabled", Boolean.valueOf(disabled));
+ if (disabled) {
+ options.addOption("disabled", Boolean.TRUE);
+ }
+
options.addEventHandler("onselect");
function.addParameter(options);
Modified: trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
===================================================================
--- trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2009-04-02 19:07:12 UTC (rev 13365)
+++ trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2009-04-02 19:43:16 UTC (rev 13366)
@@ -1115,7 +1115,7 @@
};
var mouseover = function(e) {
- if (options.disabled == false && !RichFaces.Menu.isWithin(e, $(topLevel))) {
+ if (!options.disabled && !RichFaces.Menu.isWithin(e, $(topLevel))) {
this.highlightLabel();
}
};
@@ -1126,7 +1126,7 @@
};
var mouseout = function(e){
- if (options.disabled == false && !RichFaces.Menu.isWithin(e, $(topLevel))) {
+ if (!options.disabled && !RichFaces.Menu.isWithin(e, $(topLevel))) {
this.unHighlightLabel();
}
};
@@ -1424,7 +1424,7 @@
onclick: function(e){
- if (this.options.closeOnClick == 1) {
+ if (this.options.closeOnClick) {
var menuLayer = this.menu;
while (menuLayer.level > 0) {
menuLayer = RichFaces.Menu.Layers.layers[(RichFaces.Menu.Layers.father[menuLayer.id])];
@@ -1462,7 +1462,7 @@
},
isDisabled : function() {
- //console.log(this.id + (this.options.disabled));
+ //console.log(this.id + (!!this.options.disabled));
return this.options.disabled || false;
},
onmouseover : function(event) {
15 years, 8 months
JBoss Rich Faces SVN: r13365 - in trunk/ui: dropdown-menu/src/main/java/org/richfaces/renderkit/html and 6 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-04-02 15:07:12 -0400 (Thu, 02 Apr 2009)
New Revision: 13365
Modified:
trunk/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererDelegate.java
trunk/ui/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java
trunk/ui/menu-components/src/main/config/component/menucomponents.xml
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/AbstractMenuRenderer.java
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuGroupRendererBase.java
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererDelegate.java
trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/css/dropdownmenu.xcss
trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/css/menucomponents.xcss
trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuGroup.jspx
trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx
trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuSeparator.jspx
trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuGroupComponentTest.java
trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuItemComponentTest.java
trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuSeparatorComponentTest.java
Log:
https://jira.jboss.org/jira/browse/RF-5226
Modified: trunk/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererDelegate.java
===================================================================
--- trunk/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererDelegate.java 2009-04-02 18:00:13 UTC (rev 13364)
+++ trunk/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererDelegate.java 2009-04-02 19:07:12 UTC (rev 13365)
@@ -130,7 +130,7 @@
styleClass = "";
}
- writer.writeAttribute(HTML.class_ATTRIBUTE, "dr-menu-list-border rich-menu-list-border " + styleClass, null);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, "rich-menu-list-border " + styleClass, null);
writer.writeAttribute(HTML.style_ATTRIBUTE, "display: none; z-index: 2; " + style, null);
}
}
Modified: trunk/ui/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java
===================================================================
--- trunk/ui/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java 2009-04-02 18:00:13 UTC (rev 13364)
+++ trunk/ui/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java 2009-04-02 19:07:12 UTC (rev 13365)
@@ -116,7 +116,7 @@
}
protected void processLayerStyles(FacesContext context, UIComponent layer, ResponseWriter writer) throws IOException {
- writer.writeAttribute(HTML.class_ATTRIBUTE, "dr-menu-list-border rich-menu-list-border", null);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, "rich-menu-list-border", null);
writer.writeAttribute(HTML.style_ATTRIBUTE, "display: none; z-index: 2;", null);
}
Modified: trunk/ui/menu-components/src/main/config/component/menucomponents.xml
===================================================================
--- trunk/ui/menu-components/src/main/config/component/menucomponents.xml 2009-04-02 18:00:13 UTC (rev 13364)
+++ trunk/ui/menu-components/src/main/config/component/menucomponents.xml 2009-04-02 19:07:12 UTC (rev 13365)
@@ -97,35 +97,30 @@
<classname>java.lang.String</classname>
<description>HTML: a script expression; a pointer is moved
within</description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
</property>
<property>
<name>onmouseout</name>
<classname>java.lang.String</classname>
<description>HTML: a script expression; a pointer is moved
away</description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
</property>
<property>
<name>onmouseover</name>
<classname>java.lang.String</classname>
<description>HTML: a script expression; a pointer is moved
onto</description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
</property>
<property>
<name>onopen</name>
<classname>java.lang.String</classname>
<description>HTML: script expression; group was
opened</description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
</property>
<property>
<name>onclose</name>
<classname>java.lang.String</classname>
<description>HTML: script expression; group was
closed</description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
</property>
<property>
@@ -257,7 +252,6 @@
<classname>java.lang.String</classname>
<description>HTML: script expression; The onselect event occurs when
you select some menu item</description>
- <defaultvalue>""</defaultvalue>
</property>
<property hidden="true">
<name>ondblclick</name>
Modified: trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/AbstractMenuRenderer.java
===================================================================
--- trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/AbstractMenuRenderer.java 2009-04-02 18:00:13 UTC (rev 13364)
+++ trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/AbstractMenuRenderer.java 2009-04-02 19:07:12 UTC (rev 13365)
@@ -33,8 +33,6 @@
import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.javascript.JSFunction;
-import org.ajax4jsf.renderkit.ComponentVariables;
-import org.ajax4jsf.renderkit.ComponentsVariableResolver;
import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.ajax4jsf.resource.InternetResource;
@@ -165,13 +163,13 @@
writer.writeAttribute(HTML.id_ATTRIBUTE, clientId+"_menu", null);
processLayerStyles(context, layer, writer);
writer.startElement(HTML.DIV_ELEM, layer);
- writer.writeAttribute(HTML.class_ATTRIBUTE, "dr-menu-list-bg rich-menu-list-bg", null);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, "rich-menu-list-bg", null);
encodeItems(context, layer);
writer.startElement(HTML.DIV_ELEM, layer);
- writer.writeAttribute(HTML.class_ATTRIBUTE, "dr-menu-list-strut rich-menu-list-strut", null);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, "rich-menu-list-strut", null);
writer.startElement(HTML.DIV_ELEM, layer);
- writer.writeAttribute(HTML.class_ATTRIBUTE, "dr-menu-list-strut rich-menu-list-strut", null);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, "rich-menu-list-strut", null);
writer.writeAttribute(HTML.width_ATTRIBUTE, "1", null);
writer.writeAttribute(HTML.height_ATTRIBUTE, "1", null);
writer.writeAttribute(HTML.style_ATTRIBUTE, width!=null && width.length() > 0 ? "width: " + HtmlUtil.qualifySize(width) : "", null);
Modified: trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuGroupRendererBase.java
===================================================================
--- trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuGroupRendererBase.java 2009-04-02 18:00:13 UTC (rev 13364)
+++ trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuGroupRendererBase.java 2009-04-02 19:07:12 UTC (rev 13365)
@@ -23,7 +23,6 @@
import java.io.IOException;
-import javax.faces.FacesException;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -31,6 +30,7 @@
import org.ajax4jsf.renderkit.ComponentsVariableResolver;
import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
import org.richfaces.component.UIMenuGroup;
+import org.richfaces.component.UIMenuItem;
import org.richfaces.component.util.ViewUtil;
@@ -106,6 +106,11 @@
return delegate.getParentMenu(context, menuGroup);
}
+ protected String collectInlineStyles(FacesContext context, UIMenuItem menuItem, boolean isOnmouseover) {
+ return delegate.collectInlineStyles(context, menuItem, isOnmouseover);
+ }
+
+ @Deprecated
protected String processInlineStyles(FacesContext context,
UIMenuGroup menuGroup, boolean isOnmouseover) {
Modified: trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java
===================================================================
--- trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java 2009-04-02 18:00:13 UTC (rev 13364)
+++ trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java 2009-04-02 19:07:12 UTC (rev 13365)
@@ -36,8 +36,6 @@
import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.event.AjaxEvent;
-import org.ajax4jsf.javascript.JSFunction;
-import org.ajax4jsf.javascript.JSFunctionDefinition;
import org.ajax4jsf.javascript.ScriptUtils;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.ajax4jsf.renderkit.ComponentVariables;
@@ -212,9 +210,9 @@
} else {
variables.setVariable("onmouseoutInlineStyles",
- processInlineStyles(context, menuItem, false));
+ collectInlineStyles(context, menuItem, false));
variables.setVariable("onmouseoverInlineStyles",
- processInlineStyles(context, menuItem, true));
+ collectInlineStyles(context, menuItem, true));
//-----------------------------------
StringBuffer scriptValue = new StringBuffer();
@@ -325,6 +323,11 @@
return MenuComponent.MODE_SERVER;
}
+ protected String collectInlineStyles(FacesContext context, UIMenuItem menuItem, boolean isOnmouseover) {
+ return delegate.collectInlineStyles(context, menuItem, isOnmouseover);
+ }
+
+ @Deprecated
protected String processInlineStyles(FacesContext context, UIMenuItem menuItem, boolean isOnmouseover) {
return delegate.processInlineStyles(context, menuItem, isOnmouseover);
}
Modified: trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererDelegate.java
===================================================================
--- trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererDelegate.java 2009-04-02 18:00:13 UTC (rev 13364)
+++ trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererDelegate.java 2009-04-02 19:07:12 UTC (rev 13365)
@@ -26,150 +26,91 @@
import org.ajax4jsf.renderkit.ComponentVariables;
import org.ajax4jsf.renderkit.RendererBase;
+import static org.richfaces.component.util.HtmlUtil.concatClasses;
+import static org.richfaces.component.util.HtmlUtil.concatStyles;
+
+
public class MenuItemRendererDelegate extends RendererBase {
protected void initializeStyles(FacesContext context, UIComponent menuItem,
boolean disabled, ComponentVariables variables) {
UIComponent parentMenu = getParentMenu(context, menuItem);
- Object itemClass = "";
- Object itemStyle = "";
- Object disabledItemClass = "";
- Object disabledItemStyle = "";
- Object selectItemClass = "";
+ String itemClass = null;
+ String itemStyle = null;
+ String disabledItemClass = null;
+ String disabledItemStyle = null;
+ String selectItemClass = null;
if (parentMenu != null) {
- itemClass = parentMenu.getAttributes().get("itemClass");
- itemStyle = parentMenu.getAttributes().get("itemStyle");
- disabledItemClass = parentMenu.getAttributes().get("disabledItemClass");
- disabledItemStyle = parentMenu.getAttributes().get("disabledItemStyle");
- selectItemClass = parentMenu.getAttributes().get("selectItemClass");
+ itemClass = (String) parentMenu.getAttributes().get("itemClass");
+ itemStyle = (String) parentMenu.getAttributes().get("itemStyle");
+ disabledItemClass = (String) parentMenu.getAttributes().get("disabledItemClass");
+ disabledItemStyle = (String) parentMenu.getAttributes().get("disabledItemStyle");
+ selectItemClass = (String) parentMenu.getAttributes().get("selectItemClass");
}
- Object selectClass = menuItem.getAttributes().get("selectClass");
- Object styleClass = menuItem.getAttributes().get("styleClass");
- Object style = menuItem.getAttributes().get("style");
- Object labelClass = (String)menuItem.getAttributes().get("labelClass");
- Object disabledLabelClass = (String)menuItem.getAttributes().get("labelClass");
- Object selectedLabelClass = (String)menuItem.getAttributes().get("labelClass");
+ String selectClass = (String) menuItem.getAttributes().get("selectClass");
+ String styleClass = (String) menuItem.getAttributes().get("styleClass");
+ String style = (String) menuItem.getAttributes().get("style");
+ String labelClass = (String) menuItem.getAttributes().get("labelClass");
+ String disabledLabelClass = (String) menuItem.getAttributes().get("labelClass");
+ String selectedLabelClass = (String) menuItem.getAttributes().get("labelClass");
- if (null == labelClass) {
- labelClass = "";
- }
- if (null == disabledLabelClass) {
- disabledLabelClass = "";
- }
- if (null == selectedLabelClass) {
- selectedLabelClass = "";
- }
- if (null == itemClass) {
- itemClass = "";
- }
- if (null == itemStyle) {
- itemStyle = "";
- }
- if (null == disabledItemClass) {
- disabledItemClass = "";
- }
- if (null == disabledItemStyle) {
- disabledItemStyle = "";
- }
- if (null == selectItemClass) {
- selectItemClass = "";
- }
- if (null == styleClass) {
- styleClass = "";
- }
- if (null == selectClass) {
- selectClass = "";
- }
- if (null == style) {
- style = "";
- }
-
if (disabled) {
- variables.setVariable("menuItemClass",
- "dr-menu-item dr-menu-item-disabled rich-menu-item rich-menu-item-disabled " +
- styleClass + " " +
- itemClass + " " + disabledItemClass);
- variables.setVariable("menuItemStyle",
- itemStyle + "; " + disabledItemStyle + "; " + style);
- variables.setVariable("menuItemLabelClass", "rich-menu-item-label rich-menu-item-label-disabled " +
- labelClass + " " + disabledLabelClass);
- variables.setVariable("menuGroupClass", "dr-menu-item dr-menu-item-disabled rich-menu-group rich-menu-group-disabled " +
- itemClass + " " + disabledItemClass + " " + styleClass);
+ variables.setVariable("menuItemClass", concatClasses("rich-menu-item rich-menu-item-disabled", styleClass, itemClass, disabledItemClass));
+ variables.setVariable("menuItemStyle", concatStyles(itemStyle, disabledItemStyle, style));
+ variables.setVariable("menuItemLabelClass", concatClasses("rich-menu-item-label rich-menu-item-label-disabled", labelClass, disabledLabelClass));
+ variables.setVariable("menuGroupClass", concatClasses("rich-menu-group rich-menu-group-disabled", itemClass, disabledItemClass, styleClass));
variables.setVariable("menuItemMouseMove", "");
variables.setVariable("menuItemItemIconClass", "rich-menu-item-icon-disabled");
- variables.setVariable("menuItemItemLabelClass", "rich-menu-item-label-disabled " + labelClass);
+ variables.setVariable("menuItemItemLabelClass", concatClasses("rich-menu-item-label-disabled", labelClass));
variables.setVariable("menuItemItemFolderClass", "rich-menu-item-folder-disabled");
} else {
- variables.setVariable("menuItemClass",
- "dr-menu-item dr-menu-item-enabled rich-menu-item rich-menu-item-enabled " +
- styleClass + " " + itemClass);
- variables.setVariable("menuItemStyle", itemStyle + "; " + style);
- variables.setVariable("menuItemHoverClass",
- "this.className='dr-menu-item dr-menu-item-hover rich-menu-item rich-menu-item-hover " +
- styleClass + " " + selectClass +
- selectItemClass + "';");
- variables.setVariable("menuItemLabelClass", "rich-menu-item-label " + labelClass);
+ variables.setVariable("menuItemCustomClass", concatClasses(styleClass, itemClass));
+ variables.setVariable("menuItemClass", concatClasses("rich-menu-item rich-menu-item-enabled", styleClass, itemClass));
+ variables.setVariable("menuItemStyle", concatStyles(itemStyle, style));
+ variables.setVariable("menuItemHoverClass", concatClasses(styleClass, selectClass, selectItemClass));
+ variables.setVariable("menuItemLabelClass", concatClasses("rich-menu-item-label", labelClass));
variables.setVariable("selectLabelClass", selectedLabelClass);
- variables.setVariable("menuGroupClass", "dr-menu-item dr-menu-item-enabled rich-menu-group " +
- itemClass + " " + styleClass);
+ variables.setVariable("menuGroupClass", concatClasses("rich-menu-group rich-menu-group-enabled", itemClass, styleClass));
+ variables.setVariable("menuGroupCustomClass", concatClasses(itemClass, styleClass));
variables.setVariable("menuItemMouseMove", menuItem.getAttributes().get("onmousemove"));
- variables.setVariable("menuGroupItemIconClass", "rich-menu-item-icon-enabled rich-menu-group-icon ");
- variables.setVariable("menuGroupItemLabelClass", "rich-menu-item-label rich-menu-group-label " + labelClass);
- variables.setVariable("menuGroupItemFolderClass", "rich-menu-item-folder rich-menu-group-folder ");
- variables.setVariable("onmouseoutInlineStyles", processInlineStyles(context, menuItem, false));
- variables.setVariable("onmouseoverInlineStyles", processInlineStyles(context, menuItem, true));
+ variables.setVariable("menuGroupItemIconClass", "rich-menu-item-icon-enabled rich-menu-group-icon");
+ variables.setVariable("menuGroupItemLabelClass", concatClasses("rich-menu-item-label rich-menu-group-label", labelClass));
+ variables.setVariable("menuGroupItemFolderClass", "rich-menu-item-folder rich-menu-group-folder");
+ variables.setVariable("onmouseoutInlineStyles", collectInlineStyles(context, menuItem, false));
+ variables.setVariable("onmouseoverInlineStyles", collectInlineStyles(context, menuItem, true));
- variables.setVariable("menuGroupHoverClass", "this.className='dr-menu-item dr-menu-item-enabled rich-menu-group " +
- itemClass + " " + selectItemClass + " " + styleClass + "'");
+ variables.setVariable("menuGroupHoverClass", concatClasses(itemClass, selectItemClass, styleClass));
}
}
- protected String processInlineStyles(FacesContext context, UIComponent menuItem, boolean isOnmouseover) {
+ protected String collectInlineStyles(FacesContext context, UIComponent menuItem, boolean isOnmouseover) {
+ String style = (String) menuItem.getAttributes().get("style");
+ String selectStyle = (String) menuItem.getAttributes().get("selectStyle");
- StringBuffer buffer = new StringBuffer();
- Object style = menuItem.getAttributes().get("style");
- Object selectStyle = menuItem.getAttributes().get("selectStyle");
-
UIComponent parentMenu = getParentMenu(context, menuItem);
- Object selectItemStyle = null;
- Object itemStyle = null;
+ String selectItemStyle = null;
+ String itemStyle = null;
if (parentMenu != null) {
- selectItemStyle = parentMenu.getAttributes().get("selectItemStyle");
- itemStyle = parentMenu.getAttributes().get("itemStyle");
-
+ selectItemStyle = (String) parentMenu.getAttributes().get("selectItemStyle");
+ itemStyle = (String) parentMenu.getAttributes().get("itemStyle");
}
- if (null == selectStyle) {
- selectStyle = "";
- }
- if (null == selectItemStyle) {
- selectItemStyle = "";
- }
- if (null == itemStyle) {
- itemStyle = "";
- }
-
- selectStyle = itemStyle + "; " + selectItemStyle + "; " + selectStyle;
-
- buffer.append("$('" + menuItem.getClientId(context) + "').style.cssText='");
-
- if (null != style) {
- buffer.append(style.toString() + "; ");
- }
-
if (isOnmouseover) {
- buffer.append(selectStyle.toString() + ";';");
+ return concatStyles(style, itemStyle, selectItemStyle, selectStyle);
} else {
- buffer.append(itemStyle.toString() + ";';");
+ return concatStyles(style, itemStyle);
}
-
- return buffer.toString();
}
+ @Deprecated
+ protected String processInlineStyles(FacesContext context, UIComponent menuItem, boolean isOnmouseover) {
+ return ("$('" + menuItem.getClientId(context) + "').style.cssText='" + collectInlineStyles(context, menuItem, isOnmouseover) + "';");
+ }
+
protected UIComponent getParentMenu(FacesContext context, UIComponent menuItem) {
UIComponent parent = menuItem.getParent();
while (null != parent) {
Modified: trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/css/dropdownmenu.xcss
===================================================================
--- trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/css/dropdownmenu.xcss 2009-04-02 18:00:13 UTC (rev 13364)
+++ trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/css/dropdownmenu.xcss 2009-04-02 19:07:12 UTC (rev 13365)
@@ -6,12 +6,12 @@
<f:verbatim><![CDATA[
-.dr-menu-list-border {
+.rich-menu-list-border {
border : 1px solid;
float : left;
position : absolute;
}
-.dr-menu-list-bg {
+.rich-menu-list-bg {
border-top-style : solid;
border-left-style : solid;
border-right-style : solid;
@@ -39,7 +39,7 @@
cursor : pointer;
}
-.dr-menu-list-strut {
+.rich-menu-list-strut {
font-size : 0px;
border: 0px;
margin : 0px;
@@ -64,12 +64,12 @@
<u:style name="font-weight" skin="headerWeightFont" />
</u:selector>
-<u:selector name=".dr-menu-list-border">
+<u:selector name=".rich-menu-list-border">
<u:style name="border-color" skin="panelBorderColor" />
<u:style name="background-color" skin="additionalBackgroundColor" />
</u:selector>
-<u:selector name=".dr-menu-list-bg">
+<u:selector name=".rich-menu-list-bg">
<u:style name="background-image">
<f:resource f:key="org.richfaces.renderkit.html.images.background.MenuListBackground"/>
</u:style>
Modified: trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/css/menucomponents.xcss
===================================================================
--- trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/css/menucomponents.xcss 2009-04-02 18:00:13 UTC (rev 13364)
+++ trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/css/menucomponents.xcss 2009-04-02 19:07:12 UTC (rev 13365)
@@ -5,26 +5,26 @@
<f:verbatim><![CDATA[
-.dr-menu-separator {
+.rich-menu-separator {
font-size : 0px;
border-top: 1px solid;
margin : 2px 0px 2px 24px;
cursor: default;
}
-.dr-menu-item {
+.rich-menu-item, .rich-menu-group {
padding : 1px 35px 1px 1px;
white-space : nowrap;
position : relative;
}
-.dr-menu-item-enabled {
+.rich-menu-item-enabled, .rich-menu-group-enabled {
border : 0px solid transparent;
padding : 2px 36px 2px 2px;
}
-.dr-menu-item-hover {
+.rich-menu-item-hover, .rich-menu-group-hover {
border : 1px solid;
cursor : pointer;
}
-.dr-menu-item-disabled {
+.rich-menu-item-disabled, .rich-menu-group-disabled {
border : 0px solid transparent;
cursor : default;
}
@@ -34,7 +34,7 @@
.dr-menu-icon img {
vertical-align: middle;
}
-.dr-menu-item a {
+.rich-menu-item a, .rich-menu-group a {
text-decoration : none;
}
@@ -47,16 +47,16 @@
right : 1px;
}
-.dr-menu-item-disabled .dr-menu-node {
+.rich-menu-item-disabled .dr-menu-node, .rich-menu-group-disabled .dr-menu-node {
background-position : bottom;
}
-.dr-menu-list-border {
+.rich-menu-list-border {
border : 1px solid;
float : left;
position : absolute;
}
-.dr-menu-list-bg {
+.rich-menu-list-bg {
border-top-style : solid;
border-left-style : solid;
border-right-style : solid;
@@ -84,7 +84,7 @@
cursor : pointer;
}
-.dr-menu-list-strut {
+.rich-menu-list-strut {
font-size : 0px;
border: 0px;
margin : 0px;
@@ -104,21 +104,22 @@
</f:verbatim>
-<u:selector name=".dr-menu-separator">
+<u:selector name=".rich-menu-separator">
<u:style name="border-top-color" skin="panelBorderColor" />
</u:selector>
-<u:selector name=".dr-menu-item, .dr-menu-item a, .dr-menu-item a:hover, .dr-menu-item a:visited">
+<u:selector name=".rich-menu-item, .rich-menu-item a, .rich-menu-item a:hover, .rich-menu-item a:visited,
+ .rich-menu-group, .rich-menu-group a, .rich-menu-group a:hover, .rich-menu-group a:visited">
<u:style name="color" skin="generalTextColor" />
<u:style name="font-family" skin="generalFamilyFont" />
<u:style name="font-size" skin="generalSizeFont" />
</u:selector>
-<u:selector name=".dr-menu-item-disabled">
+<u:selector name=".rich-menu-item-disabled, .rich-menu-group-disabled">
<u:style name="color" skin="tabDisabledTextColor" />
</u:selector>
-<u:selector name=".dr-menu-item-hover">
+<u:selector name=".rich-menu-item-hover, .rich-menu-group-hover">
<u:style name="background-position" value="top left"/>
<u:style name="background-repeat" value="repeat-x"/>
<u:style name="border-color" skin="tipBorderColor" />
@@ -135,12 +136,12 @@
<u:style name="font-weight" skin="headerWeightFont" />
</u:selector>
-<u:selector name=".dr-menu-list-border">
+<u:selector name=".rich-menu-list-border">
<u:style name="border-color" skin="panelBorderColor" />
<u:style name="background-color" skin="additionalBackgroundColor" />
</u:selector>
-<u:selector name=".dr-menu-list-bg">
+<u:selector name=".rich-menu-list-bg">
<u:style name="background-image">
<f:resource f:key="org.richfaces.renderkit.html.images.background.MenuListBackground"/>
</u:style>
Modified: trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
===================================================================
--- trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2009-04-02 18:00:13 UTC (rev 13364)
+++ trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2009-04-02 19:07:12 UTC (rev 13365)
@@ -1297,8 +1297,10 @@
}
};
RichFaces.Menu.Items = {
- classNames: ['dr-menu-item-enabled', 'rich-menu-item-enabled'],
- hoverClassNames : ['dr-menu-item-hover', 'rich-menu-item-hover'],
+ itemClassNames: ['rich-menu-item-enabled'],
+ groupClassNames: ['rich-menu-group-enabled'],
+ itemHoverClassNames: ['rich-menu-item-hover'],
+ groupHoverClassNames: ['rich-menu-group-hover'],
iconClassNames : [],
hoverIconClassNames: ['dr-menu-icon-selected', 'rich-menu-item-icon-selected'],
labelClassNames: [],
@@ -1310,6 +1312,22 @@
$A(toAdd).each(function(className) {e.addClassName(className)});
},
+ getHoverClassNames: function (item) {
+ if (item.options.flagGroup == 1) {
+ return this.groupHoverClassNames;
+ } else {
+ return this.itemHoverClassNames;
+ }
+ },
+
+ getClassNames: function (item) {
+ if (item.options.flagGroup == 1) {
+ return this.groupClassNames;
+ } else {
+ return this.itemClassNames;
+ }
+ },
+
onmouseover: function(item) {
var element = item.getElement();
var icon = item.getIcon();
@@ -1323,7 +1341,7 @@
var hoverStyle = item.getHoverStyle();
element.style.cssText = inlineStyle.concat(hoverStyle);
- this.replaceClasses(element, this.classNames, this.hoverClassNames.concat(hoverClass));
+ this.replaceClasses(element, this.getClassNames(item), this.getHoverClassNames(item).concat(hoverClass));
this.replaceClasses(icon, this.iconClassNames, this.hoverIconClassNames.concat(iconHoverClass));
this.replaceClasses(labl, this.labelClassNames, this.hoverLabelClassNames.concat(labelHoverClass));
},
@@ -1339,7 +1357,7 @@
var inlineStyle = item.getInlineStyle();
element.style.cssText = inlineStyle;
- this.replaceClasses(element, this.hoverClassNames.concat(hoverClass), this.classNames);
+ this.replaceClasses(element, this.getHoverClassNames(item).concat(hoverClass), this.getClassNames(item));
this.replaceClasses(icon, this.hoverIconClassNames.concat(iconHoverClass), this.iconClassNames);
this.replaceClasses(labl, this.hoverLabelClassNames.concat(labelHoverClass), this.labelClassNames);
}
@@ -1493,10 +1511,9 @@
},
highLightGroup: function(light) {
if (light) {
- Element.removeClassName(this.id,"dr-menu-item-enabled");
- Element.addClassName(this.id,"dr-menu-item-hover");
+ Element.removeClassName(this.id,"rich-menu-group-enabled");
+
Element.addClassName(this.id,"rich-menu-group-hover");
- Element.addClassName(this.id,"rich-menu-item-hover");
if (this.options.selectClass) {
Element.addClassName(this.id, this.options.selectClass);
}
@@ -1507,10 +1524,10 @@
Element.addClassName(this.id+":anchor","rich-menu-group-label-selected");
} else {
if (!this.mouseOver) {
- Element.removeClassName(this.id,"dr-menu-item-hover");
Element.removeClassName(this.id,"rich-menu-group-hover");
- Element.removeClassName(this.id,"rich-menu-item-hover");
- Element.addClassName(this.id,"dr-menu-item-enabled");
+
+ Element.addClassName(this.id,"rich-menu-group-enabled");
+
if (this.options.selectClass) {
Element.removeClassName(this.id, this.options.selectClass);
}
@@ -1518,6 +1535,8 @@
Element.removeClassName(this.id+":anchor","rich-menu-item-label-selected");
Element.removeClassName(this.id+":icon","rich-menu-group-icon-selected");
Element.removeClassName(this.id+":anchor","rich-menu-group-label-selected");
+ } else {
+ debugger;
}
}
}
@@ -1537,7 +1556,7 @@
RichFaces.Menu.updateItem = function (event, element, attr) {
var menuItem = RichFaces.Menu.findMenuItem(element.id);
- var classes = 'dr-menu-item dr-menu-item-enabled rich-menu-item rich-menu-item-enabled';
+ var classes = 'rich-menu-item rich-menu-item-enabled';
if (menuItem) {
if (menuItem.options.styleClass) classes =+ ' '+menuItem.options.styleClass;
element.className = classes;
@@ -1558,3 +1577,45 @@
Richfaces.jsFormSubmit(element.id,form.id,target,params);
return false;
}
+
+RichFaces.Menu.groupMouseOut = function(event, element, menuGroupClass, menuGroupStyle) {
+ if (RichFaces.Menu.isWithin(event, element)) {
+ return;
+ }
+
+ element.className = 'rich-menu-group rich-menu-group-enabled ' + (menuGroupClass ? menuGroupClass : '');
+ element.style.cssText = menuGroupStyle;
+}
+
+RichFaces.Menu.itemMouseOut = function(event, element, menuItemClass, menuItemStyle, iconClass) {
+ 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='dr-menu-icon rich-menu-item-icon ' + (iconClass ? iconClass : '');
+ Element.removeClassName($(element.id + ':anchor'), 'rich-menu-item-label-selected');
+
+}
+
+RichFaces.Menu.groupMouseOver = function(event, element, menuGroupHoverClass, menuGroupStyle) {
+ if (RichFaces.Menu.isWithin(event, element)) {
+ return;
+ }
+
+ element.className = 'rich-menu-group rich-menu-group-enabled ' + (menuGroupHoverClass ? menuGroupHoverClass : '');
+ element.style.cssText = menuGroupStyle;
+}
+
+RichFaces.Menu.itemMouseOver = function(event, element, menuItemHoverClass, menuItemStyle, iconClass) {
+ if (RichFaces.Menu.isWithin(event, element)) {
+ return;
+ }
+
+ element.className = 'rich-menu-item rich-menu-item-hover ' + (menuItemHoverClass ? menuItemHoverClass : '');
+ element.style.cssText = menuItemStyle;
+
+ $(element.id + ':icon').className='dr-menu-icon dr-menu-icon-selected rich-menu-item-icon rich-menu-item-icon-selected ' + (iconClass ? iconClass : '');
+ Element.addClassName($(element.id + ':anchor'), 'rich-menu-item-label-selected');
+}
Modified: trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuGroup.jspx
===================================================================
--- trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuGroup.jspx 2009-04-02 18:00:13 UTC (rev 13364)
+++ trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuGroup.jspx 2009-04-02 19:07:12 UTC (rev 13365)
@@ -27,8 +27,8 @@
class="#{menuGroupClass}"
style="#{menuItemStyle}"
onmousemove="#{menuItemMouseMove}"
- onmouseout="if (RichFaces.Menu.isWithin(event, this)) return; this.className='#{menuGroupClass}'; #{onmouseoutInlineStyles}"
- onmouseover="if (RichFaces.Menu.isWithin(event, this)) return; #{menuGroupHoverClass}; #{onmouseoverInlineStyles}" >
+ onmouseout="RichFaces.Menu.groupMouseOut(event, this, '#{menuGroupCustomClass}', '#{onmouseoutInlineStyles}');"
+ onmouseover="RichFaces.Menu.groupMouseOver(event, this, '#{menuGroupHoverClass}', '#{onmouseoverInlineStyles}');">
<span id="#{clientId}:icon"
class="dr-menu-icon #{menuGroupItemIconClass} #{component.attributes['iconClass']}">
Modified: trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx
===================================================================
--- trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx 2009-04-02 18:00:13 UTC (rev 13364)
+++ trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx 2009-04-02 19:07:12 UTC (rev 13365)
@@ -41,7 +41,7 @@
<div id="#{clientId}"
class="#{menuItemClass}"
style="#{menuItemStyle}"
- onclick="Event.stop(event || window.event);">
+ onclick="Event.stop(event);">
<jsp:scriptlet><![CDATA[
} else {
@@ -58,16 +58,8 @@
<div id="#{clientId}"
class="#{menuItemClass}"
- onmouseout="if (RichFaces.Menu.isWithin(event, this)) return;
- this.className='#{menuItemClass}';
- #{onmouseoutInlineStyles}
- $('#{clientId}:icon').className='dr-menu-icon rich-menu-item-icon #{component.attributes['iconClass']}';
- Element.removeClassName($('#{clientId}:anchor'), 'rich-menu-item-label-selected');"
- onmouseover="if (RichFaces.Menu.isWithin(event, this)) return;
- #{menuItemHoverClass};
- #{onmouseoverInlineStyles}
- $('#{clientId}:icon').className='dr-menu-icon dr-menu-icon-selected rich-menu-item-icon rich-menu-item-icon-selected #{component.attributes['iconClass']}';
- Element.addClassName($('#{clientId}:anchor'), 'rich-menu-item-label-selected');"
+ onmouseout="RichFaces.Menu.itemMouseOut(event, this, '#{menuItemCustomClass}', '#{onmouseoutInlineStyles}', '#{component.attributes['iconClass']}');"
+ onmouseover="RichFaces.Menu.itemMouseOver(event, this, '#{menuItemHoverClass}', '#{onmouseoverInlineStyles}', '#{component.attributes['iconClass']}');"
onmouseup="Event.stop(event); #{component.attributes['onmouseup']}"
onmousedown="Event.stop(event); #{component.attributes['onmousedown']}"
Modified: trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuSeparator.jspx
===================================================================
--- trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuSeparator.jspx 2009-04-02 18:00:13 UTC (rev 13364)
+++ trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuSeparator.jspx 2009-04-02 19:07:12 UTC (rev 13365)
@@ -13,7 +13,7 @@
<f:clientid var="clientId"/>
- <div id="#{clientId}" class="dr-menu-separator rich-menu-separator">
+ <div id="#{clientId}" class="rich-menu-separator">
</div>
</f:root>
Modified: trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuGroupComponentTest.java
===================================================================
--- trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuGroupComponentTest.java 2009-04-02 18:00:13 UTC (rev 13364)
+++ trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuGroupComponentTest.java 2009-04-02 19:07:12 UTC (rev 13365)
@@ -30,19 +30,13 @@
import javax.faces.component.UIForm;
import javax.faces.component.html.HtmlForm;
import javax.faces.component.html.HtmlOutputText;
-import javax.servlet.http.HttpServletResponse;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.ajax4jsf.resource.InternetResource;
-import org.ajax4jsf.resource.InternetResourceBuilder;
-import org.ajax4jsf.resource.ResourceBuilderImpl;
import org.ajax4jsf.resource.image.ImageInfo;
import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-import org.ajax4jsf.tests.HtmlTestUtils;
import org.richfaces.component.html.HtmlMenuGroup;
import org.richfaces.renderkit.html.images.MenuNodeImage;
-import com.gargoylesoftware.htmlunit.Page;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
@@ -198,8 +192,6 @@
assertNotNull(div);
assertEquals(HTML.DIV_ELEM, div.getNodeName());
classAttr = div.getAttributeValue(HTML.class_ATTRIBUTE);
- assertTrue(classAttr.contains("dr-menu-item"));
- assertTrue(classAttr.contains("dr-menu-item-disabled"));
assertTrue(classAttr.contains("rich-menu-group-disabled"));
assertTrue(classAttr.contains("rich-menu-group"));
@@ -231,7 +223,7 @@
assertEquals(HTML.DIV_ELEM, div.getNodeName());
classAttr = div.getAttributeValue(HTML.class_ATTRIBUTE);
assertTrue(classAttr
- .contains("dr-menu-item dr-menu-item-enabled rich-menu-group"));
+ .contains("rich-menu-group rich-menu-group-enabled"));
div = page.getHtmlElementById(menuGroup.getClientId(facesContext) + ":folder");
assertNotNull(div);
Modified: trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuItemComponentTest.java
===================================================================
--- trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuItemComponentTest.java 2009-04-02 18:00:13 UTC (rev 13364)
+++ trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuItemComponentTest.java 2009-04-02 19:07:12 UTC (rev 13365)
@@ -31,21 +31,15 @@
import javax.faces.component.html.HtmlForm;
import javax.faces.component.html.HtmlOutputText;
import javax.faces.event.PhaseId;
-import javax.servlet.http.HttpServletResponse;
import org.ajax4jsf.event.EventsQueue;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.ajax4jsf.resource.InternetResource;
-import org.ajax4jsf.resource.InternetResourceBuilder;
-import org.ajax4jsf.resource.ResourceBuilderImpl;
import org.ajax4jsf.resource.image.ImageInfo;
import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-import org.ajax4jsf.tests.HtmlTestUtils;
import org.ajax4jsf.tests.MockViewRoot;
import org.richfaces.component.html.HtmlMenuItem;
import org.richfaces.renderkit.html.images.background.MenuListBackground;
-import com.gargoylesoftware.htmlunit.Page;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
@@ -199,8 +193,6 @@
assertNotNull(div);
assertEquals(HTML.DIV_ELEM, div.getNodeName());
classAttr = div.getAttributeValue(HTML.class_ATTRIBUTE);
- assertTrue(classAttr.contains("dr-menu-item"));
- assertTrue(classAttr.contains("dr-menu-item-disabled"));
assertTrue(classAttr.contains("rich-menu-item"));
assertTrue(classAttr.contains("rich-menu-item-disabled"));
@@ -245,8 +237,6 @@
assertNotNull(div);
assertEquals(HTML.DIV_ELEM, div.getNodeName());
classAttr = div.getAttributeValue(HTML.class_ATTRIBUTE);
- assertTrue(classAttr.contains("dr-menu-item"));
- assertTrue(classAttr.contains("dr-menu-item-enabled"));
assertTrue(classAttr.contains("rich-menu-item"));
assertTrue(classAttr.contains("rich-menu-item-enabled"));
Modified: trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuSeparatorComponentTest.java
===================================================================
--- trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuSeparatorComponentTest.java 2009-04-02 18:00:13 UTC (rev 13364)
+++ trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuSeparatorComponentTest.java 2009-04-02 19:07:12 UTC (rev 13365)
@@ -100,7 +100,6 @@
//System.out.println(page.asXml());
HtmlElement div = page.getHtmlElementById(menuSeparator.getClientId(facesContext));
String classAttr = div.getAttributeValue("class");
- assertTrue(classAttr.contains("dr-menu-separator"));
assertTrue(classAttr.contains("rich-menu-separator"));
classAttr = div.getAttributeValue("id");
assertEquals(menuSeparator.getClientId(facesContext), classAttr);
15 years, 8 months
JBoss Rich Faces SVN: r13364 - trunk/framework/impl/src/main/java/org/richfaces/component/util.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-04-02 14:00:13 -0400 (Thu, 02 Apr 2009)
New Revision: 13364
Modified:
trunk/framework/impl/src/main/java/org/richfaces/component/util/HtmlUtil.java
Log:
HtmlUtil: added conactClasses & concatStyles methods
Modified: trunk/framework/impl/src/main/java/org/richfaces/component/util/HtmlUtil.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/component/util/HtmlUtil.java 2009-04-02 17:12:33 UTC (rev 13363)
+++ trunk/framework/impl/src/main/java/org/richfaces/component/util/HtmlUtil.java 2009-04-02 18:00:13 UTC (rev 13364)
@@ -120,4 +120,39 @@
return false;
}
+ private static boolean isEmpty(String s) {
+ return s == null || s.length() == 0;
+ }
+
+ public static String concatClasses(String... classes) {
+ StringBuilder result = new StringBuilder();
+
+ for (String className : classes) {
+ if (!isEmpty(className)) {
+ if (result.length() != 0) {
+ result.append(' ');
+ }
+
+ result.append(className.trim());
+ }
+ }
+
+ return result.toString();
+ }
+
+ public static String concatStyles(String... styles) {
+ StringBuilder result = new StringBuilder();
+
+ for (String style : styles) {
+ if (!isEmpty(style)) {
+ if (result.length() != 0) {
+ result.append(';');
+ }
+
+ result.append(style.trim());
+ }
+ }
+
+ return result.toString();
+ }
}
15 years, 8 months
JBoss Rich Faces SVN: r13363 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: smukhina
Date: 2009-04-02 13:12:33 -0400 (Thu, 02 Apr 2009)
New Revision: 13363
Modified:
trunk/docs/userguide/en/src/main/docbook/included/colorPicker.xml
Log:
https://jira.jboss.org/jira/browse/RF-6581 -language is checked
Modified: trunk/docs/userguide/en/src/main/docbook/included/colorPicker.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/colorPicker.xml 2009-04-02 15:10:23 UTC (rev 13362)
+++ trunk/docs/userguide/en/src/main/docbook/included/colorPicker.xml 2009-04-02 17:12:33 UTC (rev 13363)
@@ -70,7 +70,7 @@
The <emphasis role="bold">
<property><rich:colorPicker></property>
</emphasis>
- component allows you simply select a color or define it in hex, RGB, or HSB input fields.
+ component allows you easily select a color or define it in hex, RGB, or HSB input fields.
There are two squares in the widget that help you to compare the currently selected color and
the already selected color.
</para>
@@ -80,7 +80,7 @@
<emphasis>"value"</emphasis>
</property>
attribute stores
- selected color.
+ the selected color.
</para>
<para>
The value of the
@@ -164,18 +164,18 @@
with the help of the
<property><emphasis>"arrows"</emphasis></property> facet.
- </para>
+ </para>
<programlisting role="XML">
<![CDATA[...
-<rich:colorPicker value="#{bean.color}">
+<rich:colorPicker value="#{bean.color}">
<f:facet name="icon">
<h:graphicImage value="/pages/colorPicker_ico.png" />
- </f:facet>
+ </f:facet>
<f:facet name="arrows">
- <f:verbatim>
- <div style="width: 33px; height: 5px; border: 1px solid #bed6f8; background:none;" />
+ <f:verbatim>
+ <div style="width: 33px; height: 5px; border: 1px solid #bed6f8; background:none;" />
</f:verbatim>
- </f:facet>
+ </f:facet>
</rich:colorPicker>
...]]>
</programlisting>
@@ -196,8 +196,8 @@
</imageobject>
</mediaobject>
</figure>
- </section>
-
+ </section>
+
<section>
<title>Look-and-Feel Customization</title>
<para>For skinnability implementation, the components use a <emphasis>
@@ -210,12 +210,12 @@
</emphasis> components at once:
<itemizedlist>
<listitem><para>Redefine the corresponding skin parameters</para></listitem>
- <listitem><para> Add to your style sheets style classes used by a <emphasis role="bold">
- <property><rich:colorPicker></property>
- </emphasis> component</para></listitem>
+ <listitem><para> Add style classes used by a <emphasis role="bold">
+ <property><rich:colorPicker></property>
+ </emphasis> component to your style sheets</para></listitem>
</itemizedlist>
</para>
- </section>
+ </section>
<section>
<title>Skin Parameters Redefinition</title>
<table>
@@ -235,14 +235,14 @@
<row>
<entry>generalSizeFont</entry>
<entry>font-size</entry>
- </row>
+ </row>
<row>
<entry>generalFamilyFont</entry>
<entry>font-family</entry>
</row>
</tbody>
</tgroup>
- </table>
+ </table>
<table>
<title>Skin parameters redefinition for the wrapper <div> element of a widget</title>
<tgroup cols="2">
@@ -256,18 +256,18 @@
<row>
<entry>panelBorderColor</entry>
<entry>border-color</entry>
- </row>
+ </row>
<row>
<entry>generalBackgroundColor</entry>
<entry>background-color</entry>
- </row>
+ </row>
<row>
<entry>generalFamilyFont</entry>
<entry>font-family</entry>
</row>
</tbody>
</tgroup>
- </table>
+ </table>
<table>
<title>Skin parameters redefinition for the icon, color palette, current color, and new color</title>
<tgroup cols="2">
@@ -284,7 +284,7 @@
</row>
</tbody>
</tgroup>
- </table>
+ </table>
<table>
<title>Skin parameters redefinition for the hex, RGB, and HSB input fileds</title>
<tgroup cols="2">
@@ -298,26 +298,26 @@
<row>
<entry>generalSizeFont</entry>
<entry>font-size</entry>
- </row>
+ </row>
<row>
<entry>generalFamilyFont</entry>
<entry>font-family</entry>
- </row>
+ </row>
<row>
<entry>generalTextColor</entry>
<entry>color</entry>
- </row>
+ </row>
<row>
<entry>panelBorderColor</entry>
<entry>border-color</entry>
- </row>
+ </row>
<row>
<entry>controlBackgroundColor</entry>
<entry>background-color</entry>
</row>
</tbody>
</tgroup>
- </table>
+ </table>
<table>
<title>Skin parameters redefinition for the "Apply" and "Cancel" button</title>
<tgroup cols="2">
@@ -331,27 +331,27 @@
<row>
<entry>buttonFontSize</entry>
<entry>font-size</entry>
- </row>
+ </row>
<row>
<entry>buttonFamilyFont</entry>
<entry>font-family</entry>
- </row>
+ </row>
<row>
<entry>headerTextColor</entry>
<entry>color</entry>
- </row>
+ </row>
<row>
<entry>headerBackgroundColor</entry>
<entry>border-color</entry>
- </row>
+ </row>
<row>
<entry>panelBorderColor</entry>
<entry>border-color</entry>
- </row>
+ </row>
<row>
<entry>generalSizeFont</entry>
<entry>font-size</entry>
- </row>
+ </row>
<row>
<entry>generalFamilyFont</entry>
<entry>font-family</entry>
@@ -362,8 +362,8 @@
</row>
</tbody>
</tgroup>
- </table>
- </section>
+ </table>
+ </section>
<!-- Definition of Custom Style Classes-->
<section>
<title>Definition of Custom Style Classes</title>
@@ -378,8 +378,8 @@
</mediaobject>
</figure>
<table id="colorPicker_cn_inline">
- <title>
- Classes names for the representation of the input field and icon containing selected color
+ <title>
+ Classes names for the representation of the input field and icon containing selected color
</title>
<tgroup cols="2">
<thead>
@@ -417,22 +417,22 @@
<row>
<entry>.rich-colorPicker-color</entry>
<entry>Defines styles for the color palette</entry>
- </row>
+ </row>
<row>
<entry>.rich-colorPicker-current-color</entry>
<entry>Defines styles for the currently selected color</entry>
- </row>
+ </row>
<row>
<entry>.rich-colorPicker-new-color</entry>
<entry>Defines styles for the already selected color</entry>
- </row>
+ </row>
<row>
<entry>.rich-colorPicker-colors-input</entry>
<entry>Defines styles for the hex, RGB, and HSB input fileds</entry>
</row>
</tbody>
</tgroup>
- </table>
+ </table>
<table id="colorPicker_cn_buttons">
<title>Classes names for the buttons representation</title>
<tgroup cols="2">
15 years, 8 months
JBoss Rich Faces SVN: r13362 - in trunk/docs/userguide/en/src/main: resources/images and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2009-04-02 11:10:23 -0400 (Thu, 02 Apr 2009)
New Revision: 13362
Added:
trunk/docs/userguide/en/src/main/resources/images/colorPicker_cn.png
trunk/docs/userguide/en/src/main/resources/images/colorPicker_pc.png
Modified:
trunk/docs/userguide/en/src/main/docbook/included/colorPicker.xml
Log:
https://jira.jboss.org/jira/browse/RF-6581 - Look and Feel customization is added
Modified: trunk/docs/userguide/en/src/main/docbook/included/colorPicker.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/colorPicker.xml 2009-04-02 14:48:10 UTC (rev 13361)
+++ trunk/docs/userguide/en/src/main/docbook/included/colorPicker.xml 2009-04-02 15:10:23 UTC (rev 13362)
@@ -101,7 +101,8 @@
<![CDATA[...
<rich:colorPicker value="#{bean.color}" colorMode="rgb" />
...]]>
- </programlisting>
+ </programlisting>
+ <para>This is the result:</para>
<figure>
<title>
Usage of the
@@ -172,19 +173,20 @@
</f:facet>
<f:facet name="arrows">
<f:verbatim>
- <div style="width: 33px; height: 5px; border: 1px solid #bed6f8; background:none;"></div>
+ <div style="width: 33px; height: 5px; border: 1px solid #bed6f8; background:none;" />
</f:verbatim>
</f:facet>
</rich:colorPicker>
...]]>
</programlisting>
+ <para>This is the result:</para>
<figure>
<title>
Usage of the
<emphasis>
- <property><icon></property>
+ <property>"icon"</property>
</emphasis>, and <emphasis>
- <property><arrows></property>
+ <property>"arrows"</property>
</emphasis>
facets
</title>
@@ -195,7 +197,173 @@
</mediaobject>
</figure>
</section>
-
+
+ <section>
+ <title>Look-and-Feel Customization</title>
+ <para>For skinnability implementation, the components use a <emphasis>
+ <property>style class redefinition method.</property>
+ </emphasis> Default style classes are mapped on <emphasis>
+ <property>skin parameters.</property>
+ </emphasis></para>
+ <para>There are two ways to redefine the appearance of all <emphasis role="bold">
+ <property><rich:colorPicker></property>
+ </emphasis> components at once:
+ <itemizedlist>
+ <listitem><para>Redefine the corresponding skin parameters</para></listitem>
+ <listitem><para> Add to your style sheets style classes used by a <emphasis role="bold">
+ <property><rich:colorPicker></property>
+ </emphasis> component</para></listitem>
+ </itemizedlist>
+ </para>
+ </section>
+ <section>
+ <title>Skin Parameters Redefinition</title>
+ <table>
+ <title>Skin parameters redefinition for the input field that contains selected color</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Skin parameters</entry>
+ <entry>CSS properties</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>panelBorderColor</entry>
+ <entry>border-color</entry>
+ </row>
+ <row>
+ <entry>generalSizeFont</entry>
+ <entry>font-size</entry>
+ </row>
+ <row>
+ <entry>generalFamilyFont</entry>
+ <entry>font-family</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <table>
+ <title>Skin parameters redefinition for the wrapper <div> element of a widget</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Skin parameters</entry>
+ <entry>CSS properties</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>panelBorderColor</entry>
+ <entry>border-color</entry>
+ </row>
+ <row>
+ <entry>generalBackgroundColor</entry>
+ <entry>background-color</entry>
+ </row>
+ <row>
+ <entry>generalFamilyFont</entry>
+ <entry>font-family</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <table>
+ <title>Skin parameters redefinition for the icon, color palette, current color, and new color</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Skin parameters</entry>
+ <entry>CSS properties</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>panelBorderColor</entry>
+ <entry>border-color</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <table>
+ <title>Skin parameters redefinition for the hex, RGB, and HSB input fileds</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Skin parameters</entry>
+ <entry>CSS properties</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>generalSizeFont</entry>
+ <entry>font-size</entry>
+ </row>
+ <row>
+ <entry>generalFamilyFont</entry>
+ <entry>font-family</entry>
+ </row>
+ <row>
+ <entry>generalTextColor</entry>
+ <entry>color</entry>
+ </row>
+ <row>
+ <entry>panelBorderColor</entry>
+ <entry>border-color</entry>
+ </row>
+ <row>
+ <entry>controlBackgroundColor</entry>
+ <entry>background-color</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <table>
+ <title>Skin parameters redefinition for the "Apply" and "Cancel" button</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Skin parameters</entry>
+ <entry>CSS properties</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>buttonFontSize</entry>
+ <entry>font-size</entry>
+ </row>
+ <row>
+ <entry>buttonFamilyFont</entry>
+ <entry>font-family</entry>
+ </row>
+ <row>
+ <entry>headerTextColor</entry>
+ <entry>color</entry>
+ </row>
+ <row>
+ <entry>headerBackgroundColor</entry>
+ <entry>border-color</entry>
+ </row>
+ <row>
+ <entry>panelBorderColor</entry>
+ <entry>border-color</entry>
+ </row>
+ <row>
+ <entry>generalSizeFont</entry>
+ <entry>font-size</entry>
+ </row>
+ <row>
+ <entry>generalFamilyFont</entry>
+ <entry>font-family</entry>
+ </row>
+ <row>
+ <entry>headerBackgroundColor</entry>
+ <entry>background-color</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </section>
<!-- Definition of Custom Style Classes-->
<section>
<title>Definition of Custom Style Classes</title>
@@ -216,14 +384,14 @@
<tgroup cols="2">
<thead>
<row>
- <entry>Class name</entry>
+ <entry>Selector name</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>.rich-colorPicker-span input</entry>
- <entry>Defines styles for the input filed containing selected color</entry>
+ <entry>Defines styles for the input field that contains selected color</entry>
</row>
<row>
<entry>.rich-colorPicker-icon</entry>
@@ -285,15 +453,72 @@
</row>
</tbody>
</tgroup>
- </table>
- </section>
-
-<section>
+ </table>
+ <para>In order to redefine styles for all <emphasis role="bold">
+ <property><rich:colorPicker></property>
+ </emphasis> components on a page using CSS, it's enough to create classes with the
+ same names (possible classes could be found in the tables <link linkend="colorPicker_cn_inline"> above</link>) and define necessary properties in them. </para>
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
+ <programlisting role="CSS"><![CDATA[...
+.rich-colorPicker-ext{
+ background-color: #ecf4fe;
+}
+...]]></programlisting>
+
+ <para>This is the result:</para>
+ <figure>
+ <title>Redefinition styles with predefined classes</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/colorPicker_pc.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>In the shown example the background color for the widget is changed.</para>
+
+ <!--para>It's aslo possible to change styles of a particular
+ <emphasis role="bold"> <property><rich:colorPicker></property></emphasis> component.
+ In this case you should create own style classes and use them in corresponding <emphasis role="bold"><property><rich:colorPicker></property></emphasis> <property>styleClass</property> attributes.
+ An example is placed below:</para>
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
+ <programlisting role="CSS"><![CDATA[...
+.myClass {
+ background-color:#bed6f8;
+}
+...]]></programlisting>
+ <para>The <emphasis><property>"viewClass"</property></emphasis> attribute for <emphasis role="bold"
+ ><property><rich:colorPicker> </property></emphasis> is defined as it's shown in the example below:</para>
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
+ <programlisting role="XML"><![CDATA[<rich:colorPicker value="click to edit" viewClass="myClass"/>
+]]></programlisting>
+
+ <para>This is a result:</para>
+
+ <figure>
+ <title>Modificaton of a look and feel with own classes and <emphasis><property>styleClass</property></emphasis> attributes</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/inplaceSelect_oc.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>As it could be seen on the picture above, the font style and background color in <property>view</property> state is changed.</para-->
+
+
+ </section>
+ <section>
<title>Relevant Resources Links</title>
<para>
<ulink url="http://livedemo.exadel.com/richfaces-demo/richfaces/colorPicker.jsf?c=col...">Here</ulink>
you can see the example of <emphasis role="bold">
- <property><rich:colorPicker></property> component
- </emphasis> usage and sources for the given example. </para>
+ <property><rich:colorPicker></property>
+ </emphasis> component usage and sources for the given example. </para>
</section>
</section>
Added: trunk/docs/userguide/en/src/main/resources/images/colorPicker_cn.png
===================================================================
(Binary files differ)
Property changes on: trunk/docs/userguide/en/src/main/resources/images/colorPicker_cn.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/docs/userguide/en/src/main/resources/images/colorPicker_pc.png
===================================================================
(Binary files differ)
Property changes on: trunk/docs/userguide/en/src/main/resources/images/colorPicker_pc.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
15 years, 8 months
JBoss Rich Faces SVN: r13361 - trunk/test-applications/richfaces-docs/web/src/main/webapp.
by richfaces-svn-commits@lists.jboss.org
Author: msorokin
Date: 2009-04-02 10:48:10 -0400 (Thu, 02 Apr 2009)
New Revision: 13361
Modified:
trunk/test-applications/richfaces-docs/web/src/main/webapp/layout.xhtml
trunk/test-applications/richfaces-docs/web/src/main/webapp/richPage.xhtml
trunk/test-applications/richfaces-docs/web/src/main/webapp/tree.xhtml
Log:
https://jira.jboss.org/jira/browse/RF-6593
files layout components
Modified: trunk/test-applications/richfaces-docs/web/src/main/webapp/layout.xhtml
===================================================================
--- trunk/test-applications/richfaces-docs/web/src/main/webapp/layout.xhtml 2009-04-02 13:14:05 UTC (rev 13360)
+++ trunk/test-applications/richfaces-docs/web/src/main/webapp/layout.xhtml 2009-04-02 14:48:10 UTC (rev 13361)
@@ -40,7 +40,7 @@
</rich:layout>
- <h3>Listing 1: top, left, center, right, bottom</h3>
+ <h3>Listing 2: center</h3>
<rich:layout>
<rich:layoutPanel position="center">
@@ -49,6 +49,9 @@
</rich:layout>
+
+
+
<table class="tableofattributes" cellpadding="0" cellspacing="0">
Modified: trunk/test-applications/richfaces-docs/web/src/main/webapp/richPage.xhtml
===================================================================
--- trunk/test-applications/richfaces-docs/web/src/main/webapp/richPage.xhtml 2009-04-02 13:14:05 UTC (rev 13360)
+++ trunk/test-applications/richfaces-docs/web/src/main/webapp/richPage.xhtml 2009-04-02 14:48:10 UTC (rev 13361)
@@ -6,7 +6,7 @@
<rich:page sidebarPosition="left" sidebarWidth="300"
- theme="simple" title="advisory" pageTitle="Gleb is back" contentType="text/html; charset=UTF-8" >
+ theme="simple" title="advisory" markupType="" pageTitle="Gleb is back" contentType="text/html; charset=UTF-8" >
<f:facet name="pageHeader" >
<title>Page Title 2</title>
Modified: trunk/test-applications/richfaces-docs/web/src/main/webapp/tree.xhtml
===================================================================
--- trunk/test-applications/richfaces-docs/web/src/main/webapp/tree.xhtml 2009-04-02 13:14:05 UTC (rev 13360)
+++ trunk/test-applications/richfaces-docs/web/src/main/webapp/tree.xhtml 2009-04-02 14:48:10 UTC (rev 13361)
@@ -63,7 +63,7 @@
<p>The <code>org.richfaces.model.TreeNode</code> interface, which is used in following case, accepts data worked with <code>org.richfaces.component.xml.XmlTreeDataBuilder</code> class and renders it as tree nodes.</p>
<h:form>
<rich:tree id="tree"
- value="#{hujations.data}"
+ value="#{hujatiorns.data}"
var="vardata" >
<rich:treeNode>
<h:outputText value="#{vardata.text}" />
15 years, 8 months
JBoss Rich Faces SVN: r13360 - trunk/test-applications/jsp/src/main/java/validator.
by richfaces-svn-commits@lists.jboss.org
Author: mvitenkov
Date: 2009-04-02 09:14:05 -0400 (Thu, 02 Apr 2009)
New Revision: 13360
Modified:
trunk/test-applications/jsp/src/main/java/validator/DataBean.java
trunk/test-applications/jsp/src/main/java/validator/GraphValidatorBean.java
trunk/test-applications/jsp/src/main/java/validator/ValidatorBean.java
Log:
Modified: trunk/test-applications/jsp/src/main/java/validator/DataBean.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/validator/DataBean.java 2009-04-02 13:13:38 UTC (rev 13359)
+++ trunk/test-applications/jsp/src/main/java/validator/DataBean.java 2009-04-02 13:14:05 UTC (rev 13360)
@@ -27,7 +27,25 @@
@Size(min=2,max=8,message="Size validation failed!!!!")
private ArrayList<Data> data;
private int length;
+ private String summary;
+ private boolean useType;
+ public boolean isUseType() {
+ return useType;
+ }
+
+ public void setUseType(boolean useType) {
+ this.useType = useType;
+ }
+
+ public String getSummary() {
+ return summary;
+ }
+
+ public void setSummary(String summary) {
+ this.summary = summary;
+ }
+
public int getLength() {
return length;
}
@@ -114,6 +132,8 @@
Random r = new Random();
for(int i = 0; i < 7; i++)
data.add(new Data(i, r.nextInt(1000), Data.Random(6), r.nextInt(10000) + 98389, Data.Random(r.nextInt(10) + 1), r.nextInt(500000), Data.statusIcon[i % 5], Data.Random(3), false)); //new Data(i, Data.Random(5), Data.statusIcon[i % 5], Data.Random(6), false));
+ summary = "GraphValidator summary";
+ useType = false;
}
@Max(value=20,message="Total value should be less then 20")
@@ -123,8 +143,5 @@
total += bean.getIntValue();
}
return total;
- }
-
-
-
+ }
}
Modified: trunk/test-applications/jsp/src/main/java/validator/GraphValidatorBean.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/validator/GraphValidatorBean.java 2009-04-02 13:13:38 UTC (rev 13359)
+++ trunk/test-applications/jsp/src/main/java/validator/GraphValidatorBean.java 2009-04-02 13:14:05 UTC (rev 13360)
@@ -2,10 +2,10 @@
import java.util.ArrayList;
import java.util.List;
+
import org.hibernate.validator.Max;
import org.hibernate.validator.Min;
import org.hibernate.validator.Valid;
-import org.richfaces.component.UIGraphValidator;
public class GraphValidatorBean {
@@ -17,7 +17,7 @@
}
public GraphValidatorBean() {
- beans = new ArrayList(1);
+ beans = new ArrayList<TestValidable>(1);
beans.add(new ValidatorBean());
}
@Max(value=50,message="total length > 50")
Modified: trunk/test-applications/jsp/src/main/java/validator/ValidatorBean.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/validator/ValidatorBean.java 2009-04-02 13:13:38 UTC (rev 13359)
+++ trunk/test-applications/jsp/src/main/java/validator/ValidatorBean.java 2009-04-02 13:14:05 UTC (rev 13360)
@@ -59,6 +59,7 @@
private int requestDelay;
private boolean selfRendered;
private boolean submitted;
+ private String summary;
private int timeout;
@Digits(integerDigits=1,fractionalDigits=3,message="Digits validation failed!")
private double digit;
@@ -68,7 +69,21 @@
private String newValue;
@Pattern(regex="^1234*$") //Searh "1234" as a whole word
private String patternValue;
+ private String temp;
+ public String getTemp() {
+ try {
+ Thread.sleep(10000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ return temp;
+ }
+
+ public void setTemp(String temp) {
+ this.temp = temp;
+ }
+
public String getPatternValue() {
return patternValue;
}
@@ -260,7 +275,7 @@
this.dateValue = Calendar.getInstance();
dateValue.set(Calendar.MONTH,8);
dateValue.set(Calendar.DATE,5);
- dateValue.set(Calendar.YEAR,2008);
+ dateValue.set(Calendar.YEAR,2050);
this.booleanValue = false;
this.ean = "97 81550 41198 0";
this.creditValue = "visa maestro";
@@ -282,18 +297,24 @@
this.requestDelay = 500;
this.selfRendered = false;
this.submitted = false;
- this.timeout = 3000;
+ this.timeout = 2000;
this.rangeValue = "3.14";
this.newValue = "not empty";
+ this.summary = "ajax_validator_summary";
+ this.temp = "";
}
-
+
public int getIntValue() {
return intValue;
}
public String getText() {
-
+ try {
+ Thread.sleep(10000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
return text;
}
@@ -346,4 +367,12 @@
public void setNewValue(String newValue) {
this.newValue = newValue;
}
+
+ public String getSummary() {
+ return summary;
+ }
+
+ public void setSummary(String summary) {
+ this.summary = summary;
+ }
}
15 years, 8 months
JBoss Rich Faces SVN: r13359 - trunk/test-applications/jsp/src/main/java/validator.
by richfaces-svn-commits@lists.jboss.org
Author: mvitenkov
Date: 2009-04-02 09:13:38 -0400 (Thu, 02 Apr 2009)
New Revision: 13359
Added:
trunk/test-applications/jsp/src/main/java/validator/CustomGraphValidator.java
Log:
add new features(type...)
Added: trunk/test-applications/jsp/src/main/java/validator/CustomGraphValidator.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/validator/CustomGraphValidator.java (rev 0)
+++ trunk/test-applications/jsp/src/main/java/validator/CustomGraphValidator.java 2009-04-02 13:13:38 UTC (rev 13359)
@@ -0,0 +1,29 @@
+package validator;
+
+import java.util.Set;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.ValidatorException;
+
+public class CustomGraphValidator extends
+ org.richfaces.validator.FacesBeanValidator implements
+ org.richfaces.validator.GraphValidator {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ public String[] validateGraph(FacesContext context, UIComponent component,
+ Object value, Set<String> profiles) throws ValidatorException {
+ System.out.println("======Inside validateGraph method=====");
+ return super.validateGraph(context, component, value, profiles);
+ }
+
+ public void validate(FacesContext context, UIComponent component, Object convertedValue)
+ throws ValidatorException {
+ System.out.println("======Inside validate method=====");
+ super.validate(context, component, convertedValue);
+ }
+
+}
15 years, 8 months
JBoss Rich Faces SVN: r13358 - in trunk/test-applications/facelets/src/main/webapp/ColorPicker: images and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: tkuprevich
Date: 2009-04-02 08:03:18 -0400 (Thu, 02 Apr 2009)
New Revision: 13358
Added:
trunk/test-applications/facelets/src/main/webapp/ColorPicker/images/
trunk/test-applications/facelets/src/main/webapp/ColorPicker/images/colorPicker_ico.png
Log:
Added: trunk/test-applications/facelets/src/main/webapp/ColorPicker/images/colorPicker_ico.png
===================================================================
(Binary files differ)
Property changes on: trunk/test-applications/facelets/src/main/webapp/ColorPicker/images/colorPicker_ico.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
15 years, 8 months
JBoss Rich Faces SVN: r13357 - in trunk/test-applications/facelets/src/main: webapp/ColorPicker and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: tkuprevich
Date: 2009-04-02 07:05:10 -0400 (Thu, 02 Apr 2009)
New Revision: 13357
Added:
trunk/test-applications/facelets/src/main/java/colorPicker/ColorPickerConverter.java
Modified:
trunk/test-applications/facelets/src/main/java/colorPicker/ColorPicker.java
trunk/test-applications/facelets/src/main/webapp/ColorPicker/ColorPicker.xhtml
trunk/test-applications/facelets/src/main/webapp/ColorPicker/ColorPickerProperty.xhtml
trunk/test-applications/facelets/src/main/webapp/WEB-INF/faces-config-Converter.xml
Log:
Modified: trunk/test-applications/facelets/src/main/java/colorPicker/ColorPicker.java
===================================================================
--- trunk/test-applications/facelets/src/main/java/colorPicker/ColorPicker.java 2009-04-02 11:04:33 UTC (rev 13356)
+++ trunk/test-applications/facelets/src/main/java/colorPicker/ColorPicker.java 2009-04-02 11:05:10 UTC (rev 13357)
@@ -17,23 +17,33 @@
public class ColorPicker implements Validator, Converter {
private HtmlColorPicker component;
private String colorMode;// hex, rgb
- private String converterMessage;
- private boolean disabled;
+ private String converterMessage;
private boolean flat;
private boolean immediate;
private boolean localValueSet;
private boolean rendered;
+ private boolean facets;
private boolean required;
private String requiredMessage;
private boolean valid;
private String validatorMessage;
private String value;
+ private String facetsValue;
private String bindLabel;
+ private String showEvent;
+ public String getShowEvent() {
+ return showEvent;
+ }
+
+ public void setShowEvent(String showEvent) {
+ this.showEvent = showEvent;
+ }
+
public ColorPicker() {
+ facets = false;
colorMode = "rgb";
- converterMessage = "custom converter message";
- disabled = false;
+ converterMessage = "custom converter message";
flat = false;
immediate = false;
localValueSet = true;
@@ -42,8 +52,10 @@
requiredMessage = "custom required message";
valid = true;
validatorMessage = "custom validator message";
- value = "rgb(255, 250, 240)";
+ value = new String();
+ facetsValue = new String();
bindLabel = "Click Binding";
+ showEvent = "onclick";
}
public void checkBinding(ActionEvent e){
@@ -71,9 +83,10 @@
public void validate(FacesContext context, UIComponent component,
Object value) throws ValidatorException {
+ System.out.println("<<<Color Picker Validator Works>>>");
String str = value.toString();
if (str.startsWith("rgb")) {
- if (str.indexOf("100") != -1)
+ if (str.indexOf("56") != -1)
throw new ValidatorException(new FacesMessage(
"Test validator: 100 is restricted!"));
}
@@ -115,16 +128,8 @@
public void setConverterMessage(String converterMessage) {
this.converterMessage = converterMessage;
- }
+ }
- public boolean isDisabled() {
- return disabled;
- }
-
- public void setDisabled(boolean disabled) {
- this.disabled = disabled;
- }
-
public boolean isFlat() {
return flat;
}
@@ -197,4 +202,21 @@
this.bindLabel = bindLabel;
}
+ public boolean isFacets() {
+ return facets;
+ }
+
+ public void setFacets(boolean facets) {
+ this.facets = facets;
+ }
+
+ public String getFacetsValue() {
+ return facetsValue;
+ }
+
+ public void setFacetsValue(String facetsValue) {
+ this.facetsValue = facetsValue;
+ }
+
+
}
Added: trunk/test-applications/facelets/src/main/java/colorPicker/ColorPickerConverter.java
===================================================================
--- trunk/test-applications/facelets/src/main/java/colorPicker/ColorPickerConverter.java (rev 0)
+++ trunk/test-applications/facelets/src/main/java/colorPicker/ColorPickerConverter.java 2009-04-02 11:05:10 UTC (rev 13357)
@@ -0,0 +1,30 @@
+package colorPicker;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+import javax.swing.tree.TreeNode;
+import util.data.*;
+
+public class ColorPickerConverter implements Converter {
+
+ public Object getAsObject(FacesContext context, UIComponent component,
+ String value) {
+ System.out.println("<<<ColorPicker Converter getAsObject() Called>>>");
+ String str = value.toString();
+ return str;
+ }
+
+ public String getAsString(FacesContext context, UIComponent component,
+ Object value) {
+ System.out.println("<<<ColorPicker Converter getAsString() Called>>>");
+ if (value instanceof String) {
+ String str = value.toString();
+ return str;
+ } else
+ throw new ConverterException(
+ "Test Application: Error in custom converted colorPicker.ColorPickerConverter.java");
+ }
+
+}
Modified: trunk/test-applications/facelets/src/main/webapp/ColorPicker/ColorPicker.xhtml
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/ColorPicker/ColorPicker.xhtml 2009-04-02 11:04:33 UTC (rev 13356)
+++ trunk/test-applications/facelets/src/main/webapp/ColorPicker/ColorPicker.xhtml 2009-04-02 11:05:10 UTC (rev 13357)
@@ -4,22 +4,43 @@
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.org/rich" id="calendarSubviewID">
<rich:colorPicker binding="#{colorPicker.component}"
- colorMode="hex" converter="colorPickerConverter"
+ colorMode="#{colorPicker.colorMode}" converter="colorPickerConverter"
converterMessage="#{colorPicker.converterMessage}"
- flat="#{colorPicker.flat}"
- id="colorPickerID" immediate="#{colorPicker.immediate}"
- localValueSet="#{colorPicker.localValueSet}"
+ flat="#{colorPicker.flat}" id="colorPickerID"
+ immediate="#{colorPicker.immediate}" onclick="#{event.onclick}"
+ ondblclick="#{event.ondblclick}" onkeydown="#{event.onkeydown}"
+ onkeypress="#{event.onkeypress}" onkeyup="#{event.onkeyup}"
+ onmousedown="#{event.onmousedown}" onmousemove="#{event.onmousemove}"
+ onmouseout="#{event.onmouseout}" onmouseover="#{event.onmouseover}"
+ onmouseup="#{event.onmouseup}"
+ rendered="#{colorPicker.rendered and !colorPicker.facets}"
+ showEvent="#{colorPicker.showEvent}"
+ validator="#{colorPicker.validate}"
+ validatorMessage="#{colorPicker.validatorMessage}"
+ value="#{colorPicker.value}"
+ valueChangeListener="#{colorPicker.changeValue}">
+ </rich:colorPicker>
+
+ <rich:colorPicker colorMode="#{colorPicker.colorMode}"
+ flat="#{colorPicker.flat}" id="colorPickerIDFacets"
onclick="#{event.onclick}" ondblclick="#{event.ondblclick}"
onkeydown="#{event.onkeydown}" onkeypress="#{event.onkeypress}"
onkeyup="#{event.onkeyup}" onmousedown="#{event.onmousedown}"
onmousemove="#{event.onmousemove}" onmouseout="#{event.onmouseout}"
onmouseover="#{event.onmouseover}" onmouseup="#{event.onmouseup}"
- rendered="#{colorPicker.rendered}" required="#{colorPicker.required}"
- requiredMessage="#{colorPicker.requiredMessage}"
- showEvent="onmouseover" valid="#{colorPicker.valid}"
+ rendered="#{colorPicker.rendered and colorPicker.facets}"
+ showEvent="#{colorPicker.showEvent}"
validator="#{colorPicker.validate}"
validatorMessage="#{colorPicker.validatorMessage}"
- value="#ffffff"
+ value="#{colorPicker.facetsValue}"
valueChangeListener="#{colorPicker.changeValue}">
+ <f:facet name="icon">
+ <h:graphicImage value="/ColorPicker/images/colorPicker_ico.png"
+ width="18px" height="18px"></h:graphicImage>
+ </f:facet>
+ <f:facet name="arrows">
+ <h:graphicImage value="/ColorPicker/images/colorPicker_ico.png"
+ width="30px" height="5px"></h:graphicImage>
+ </f:facet>
</rich:colorPicker>
</f:subview>
\ No newline at end of file
Modified: trunk/test-applications/facelets/src/main/webapp/ColorPicker/ColorPickerProperty.xhtml
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/ColorPicker/ColorPickerProperty.xhtml 2009-04-02 11:04:33 UTC (rev 13356)
+++ trunk/test-applications/facelets/src/main/webapp/ColorPicker/ColorPickerProperty.xhtml 2009-04-02 11:05:10 UTC (rev 13357)
@@ -7,57 +7,62 @@
action="#{colorPicker.addColorPicker}"></h:commandButton>
<h:panelGrid columns="2">
<h:outputText value="colorMode" />
- <h:selectOneRadio value="#{colorPicker.colorMode}"
- onchange="submit">
+ <h:selectOneRadio value="#{colorPicker.colorMode}">
<f:selectItem itemLabel="rgb" itemValue="rgb" />
<f:selectItem itemLabel="hex" itemValue="hex" />
</h:selectOneRadio>
+ <h:outputText value="showEvent: "></h:outputText>
+ <h:inputText value="#{colorPicker.showEvent}">
+ </h:inputText>
+
<h:outputText value="converterMessage: "></h:outputText>
- <h:inputText value="#{colorPicker.converterMessage}"
- onchange="submit"></h:inputText>
+ <h:inputText value="#{colorPicker.converterMessage}">
+ </h:inputText>
- <h:outputText value="disabled" />
- <h:selectBooleanCheckbox value="#{colorPicker.disabled}"
- onclick="submit" />
-
<h:outputText value="flat" />
- <h:selectBooleanCheckbox value="#{colorPicker.flat}"
- onclick="submit" />
+ <h:selectBooleanCheckbox value="#{colorPicker.flat}">
+ </h:selectBooleanCheckbox>
<h:outputText value="immediate" />
- <h:selectBooleanCheckbox value="#{colorPicker.immediate}"
- onclick="submit" />
+ <h:selectBooleanCheckbox value="#{colorPicker.immediate}">
+ </h:selectBooleanCheckbox>
<h:outputText value="localValueSet" />
- <h:selectBooleanCheckbox value="#{colorPicker.localValueSet}"
- onclick="submit" />
+ <h:selectBooleanCheckbox value="#{colorPicker.localValueSet}">
+ </h:selectBooleanCheckbox>
<h:outputText value="rendered" />
- <h:selectBooleanCheckbox value="#{colorPicker.rendered}"
- onclick="submit" />
+ <h:selectBooleanCheckbox value="#{colorPicker.rendered}">
+ </h:selectBooleanCheckbox>
<h:outputText value="required" />
- <h:selectBooleanCheckbox value="#{colorPicker.required}"
- onclick="submit" />
+ <h:selectBooleanCheckbox value="#{colorPicker.required}">
+ </h:selectBooleanCheckbox>
+ <h:outputText value="facets" />
+ <h:selectBooleanCheckbox value="#{colorPicker.facets}">
+ </h:selectBooleanCheckbox>
+
<h:outputText value="requiredMessage: "></h:outputText>
- <h:inputText value="#{colorPicker.requiredMessage}"
- onchange="submit"></h:inputText>
+ <h:inputText value="#{colorPicker.requiredMessage}">
+ </h:inputText>
<h:outputText value="valid" />
- <h:selectBooleanCheckbox value="#{colorPicker.valid}"
- onclick="submit" />
+ <h:selectBooleanCheckbox value="#{colorPicker.valid}">
+ </h:selectBooleanCheckbox>
<h:outputText value="validatorMessage: "></h:outputText>
- <h:inputText value="#{colorPicker.validatorMessage}"
- onchange="submit;"></h:inputText>
+ <h:inputText value="#{colorPicker.validatorMessage}">
+ </h:inputText>
<h:commandButton actionListener="#{colorPicker.checkBinding}"
value="Binding">
<a4j:support event="onclick" reRender="bindLabelID"></a4j:support>
</h:commandButton>
<h:outputText value="#{colorPicker.bindLabel}" id="bindLabelID" />
-
+
</h:panelGrid>
+
+
</f:subview>
\ No newline at end of file
Modified: trunk/test-applications/facelets/src/main/webapp/WEB-INF/faces-config-Converter.xml
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/WEB-INF/faces-config-Converter.xml 2009-04-02 11:04:33 UTC (rev 13356)
+++ trunk/test-applications/facelets/src/main/webapp/WEB-INF/faces-config-Converter.xml 2009-04-02 11:05:10 UTC (rev 13357)
@@ -2,20 +2,28 @@
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
"http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
<faces-config>
- <converter>
- <converter-id>listShuttleConverter</converter-id>
- <converter-class>util.converter.ListShuttleConverter</converter-class>
- </converter>
- <converter>
- <converter-id>orderingListConverter</converter-id>
- <converter-class>util.converter.OrderingListConverter</converter-class>
- </converter>
- <converter>
- <converter-id>inplaceInputConverter</converter-id>
- <converter-class>util.converter.InplaceInputConverter</converter-class>
- </converter>
- <converter>
- <converter-id>colorPickerConverter</converter-id>
- <converter-class>colorPicker.ColorPicker</converter-class>
- </converter>
+ <converter>
+ <converter-id>listShuttleConverter</converter-id>
+ <converter-class>
+ util.converter.ListShuttleConverter
+ </converter-class>
+ </converter>
+ <converter>
+ <converter-id>orderingListConverter</converter-id>
+ <converter-class>
+ util.converter.OrderingListConverter
+ </converter-class>
+ </converter>
+ <converter>
+ <converter-id>inplaceInputConverter</converter-id>
+ <converter-class>
+ util.converter.InplaceInputConverter
+ </converter-class>
+ </converter>
+ <converter>
+ <converter-id>colorPickerConverter</converter-id>
+ <converter-class>
+ colorPicker.ColorPickerConverter
+ </converter-class>
+ </converter>
</faces-config>
15 years, 8 months