JBoss Rich Faces SVN: r338 - trunk/richfaces/dropdown-menu/src/test/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: d.bulahov
Date: 2007-04-10 09:02:07 -0400 (Tue, 10 Apr 2007)
New Revision: 338
Added:
trunk/richfaces/dropdown-menu/src/test/java/org/richfaces/component/DropDownMenuComponentTest.java
Removed:
trunk/richfaces/dropdown-menu/src/test/java/org/richfaces/component/JSFComponentTest.java
Log:
Unit tests development
Added: trunk/richfaces/dropdown-menu/src/test/java/org/richfaces/component/DropDownMenuComponentTest.java
===================================================================
--- trunk/richfaces/dropdown-menu/src/test/java/org/richfaces/component/DropDownMenuComponentTest.java (rev 0)
+++ trunk/richfaces/dropdown-menu/src/test/java/org/richfaces/component/DropDownMenuComponentTest.java 2007-04-10 13:02:07 UTC (rev 338)
@@ -0,0 +1,156 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * 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.component;
+
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlScript;
+import org.richfaces.event.SwitchablePanelSwitchEvent;
+import org.richfaces.component.UISwitchablePanel;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.apache.commons.lang.StringUtils;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIForm;
+import javax.faces.component.UIOutput;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.event.ActionEvent;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Unit test for Datascroller component.
+ */
+public class DropDownMenuComponentTest extends AbstractAjax4JsfTestCase {
+ private static Set javaScripts = new HashSet();
+
+ static {
+ javaScripts.add("prototype.js");
+ javaScripts.add("org.ajax4jsf.framework.ajax.AjaxScript");
+ javaScripts.add("scripts/menu.js");
+ }
+
+ private UIDropDownMenu dropDownMenu;
+ private UIForm form;
+
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public DropDownMenuComponentTest(String testName) {
+ super(testName);
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+
+
+
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+ dropDownMenu = (UIDropDownMenu)application.createComponent("org.richfaces.DropDownMenu");
+ dropDownMenu.setId("DropDownMenu");
+ form.getChildren().add(dropDownMenu);
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+ dropDownMenu = null;
+ form = null;
+ }
+
+ /**
+ * Test component rendering
+ *
+ * @throws Exception
+ */
+
+ public void testRender() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ //System.out.println(page.asXml());
+ HtmlElement div = page.getHtmlElementById(dropDownMenu.getClientId(facesContext));
+ assertNotNull(div);
+ assertEquals("div", div.getNodeName());
+ String classAttr = div.getAttributeValue("class");
+ assertTrue(classAttr.contains("dr-menu-label"));
+ assertTrue(classAttr.contains("dr-menu-label-unselect"));
+ assertTrue(classAttr.contains("rich-menu-label"));
+ assertTrue(classAttr.contains("rich-menu-label-unselect"));
+ }
+ /**
+ * Test style rendering
+ *
+ * @throws Exception
+ */
+ public void testRenderStyle() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ List links = page.getDocumentElement().getHtmlElementsByTagName("link");
+ assertEquals(1, links.size());
+ HtmlElement link = (HtmlElement) links.get(0);
+ assertTrue(link.getAttributeValue("href").contains("org/richfaces/renderkit/html/css/dropdownmenu.xcss"));
+ }
+
+ /**
+ * Test script rendering
+ *
+ * @throws Exception
+ */
+ public void testRenderScript() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ List scripts = page.getDocumentElement().getHtmlElementsByTagName("script");
+ for (Iterator it = scripts.iterator(); it.hasNext();) {
+ HtmlScript item = (HtmlScript) it.next();
+ String srcAttr = item.getSrcAttribute();
+ if (StringUtils.isNotBlank(srcAttr)) {
+ boolean found = false;
+ for (Iterator srcIt = javaScripts.iterator(); srcIt.hasNext();) {
+ String src = (String) srcIt.next();
+ found = srcAttr.contains(src);
+ if (found) {
+ break;
+ }
+ }
+ assertTrue(found);
+ }
+ }
+ }
+
+
+}
+
+
+
+
Deleted: trunk/richfaces/dropdown-menu/src/test/java/org/richfaces/component/JSFComponentTest.java
===================================================================
--- trunk/richfaces/dropdown-menu/src/test/java/org/richfaces/component/JSFComponentTest.java 2007-04-10 11:24:10 UTC (rev 337)
+++ trunk/richfaces/dropdown-menu/src/test/java/org/richfaces/component/JSFComponentTest.java 2007-04-10 13:02:07 UTC (rev 338)
@@ -1,53 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * 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.component;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import javax.faces.component.UIComponent;
-
-/**
- * Unit test for simple Component.
- */
-public class JSFComponentTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public JSFComponentTest( String testName )
- {
- super( testName );
- }
-
-
- /**
- * Rigourous Test :-)
- */
- public void testComponent()
- {
- assertTrue( true );
- }
-}
19 years
JBoss Rich Faces SVN: r337 - trunk/richfaces/menu-components/src/main/templates/org/richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: a.izobov
Date: 2007-04-10 07:24:10 -0400 (Tue, 10 Apr 2007)
New Revision: 337
Modified:
trunk/richfaces/menu-components/src/main/templates/org/richfaces/htmlMenuGroup.jspx
trunk/richfaces/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx
Log:
event support(onmouseout and onmouseover) for menuGroup and menuItem changed
Modified: trunk/richfaces/menu-components/src/main/templates/org/richfaces/htmlMenuGroup.jspx
===================================================================
--- trunk/richfaces/menu-components/src/main/templates/org/richfaces/htmlMenuGroup.jspx 2007-04-10 11:22:55 UTC (rev 336)
+++ trunk/richfaces/menu-components/src/main/templates/org/richfaces/htmlMenuGroup.jspx 2007-04-10 11:24:10 UTC (rev 337)
@@ -29,12 +29,10 @@
style="#{component.attributes['style']}"
onmouseout="this.className='dr-menu-item dr-menu-item-enabled rich-menu-group';
$('ref#{clientId}:icon').className='dr-menu-icon rich-menu-item-icon #{component.attributes['iconClass']}';
- $('ref#{clientId}:anchor').className='dr-menu-label rich-menu-item-label';
- #{component.attributes['onmouseout']}"
+ $('ref#{clientId}:anchor').className='dr-menu-label rich-menu-item-label';"
onmouseover="this.className='dr-menu-item dr-menu-item-hover rich-menu-group rich-menu-group-hover'; #{component.attributes['selectClass']}
$('ref#{clientId}:icon').className='dr-menu-icon dr-menu-icon-selected rich-menu-item-icon rich-menu-item-icon-selected #{component.attributes['iconClass']}';
- $('ref#{clientId}:anchor').className='dr-menu-label dr-menu-label-selected rich-menu-item-label rich-menu-item-label-selected';
- #{component.attributes['onmouseover']}"
+ $('ref#{clientId}:anchor').className='dr-menu-label dr-menu-label-selected rich-menu-item-label rich-menu-item-label-selected';"
onmousemove="#{component.attributes['onmousemove']}">
<span id="ref#{clientId}:icon"
Modified: trunk/richfaces/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx
===================================================================
--- trunk/richfaces/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx 2007-04-10 11:22:55 UTC (rev 336)
+++ trunk/richfaces/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx 2007-04-10 11:24:10 UTC (rev 337)
@@ -40,15 +40,13 @@
onmouseout="this.className='dr-menu-item dr-menu-item-enabled rich-menu-item rich-menu-item-enabled #{component.attributes['styleClass']}';
#{onmouseoutInlineStyles}
$('#{clientId}:icon').className='dr-menu-icon rich-menu-item-icon #{component.attributes['iconClass']}';
- $('#{clientId}:anchor').className='dr-menu-label rich-menu-item-label';
- #{component.attributes['onmouseout']};"
+ $('#{clientId}:anchor').className='dr-menu-label rich-menu-item-label';"
onmouseover="this.className='dr-menu-item dr-menu-item-hover rich-menu-item rich-menu-item-hover #{component.attributes['styleClass']} #{component.attributes['selectClass']}';
#{onmouseoverInlineStyles}
$('#{clientId}:icon').className='dr-menu-icon dr-menu-icon-selected rich-menu-item-icon rich-menu-item-icon-selected #{component.attributes['iconClass']}';
- $('#{clientId}:anchor').className='dr-menu-label dr-menu-label-selected rich-menu-item-label rich-menu-item-label-selected';
- #{component.attributes['onmouseover']};"
+ $('#{clientId}:anchor').className='dr-menu-label dr-menu-label-selected rich-menu-item-label rich-menu-item-label-selected';"
style="#{component.attributes['style']}"
- onclick="#{component.attributes['onselect']}; #{onclick}">
+ onclick="this.className='dr-menu-item dr-menu-item-enabled rich-menu-item rich-menu-item-enabled #{component.attributes['styleClass']}'; #{component.attributes['onselect']}; #{onclick}">
<f:call name="utils.encodeAttributes">
<f:parameter value="onmousedown,onmouseup,onmousemove" />
</f:call>
19 years
JBoss Rich Faces SVN: r336 - trunk/richfaces/menu-components/src/test/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: F.antonov
Date: 2007-04-10 07:22:55 -0400 (Tue, 10 Apr 2007)
New Revision: 336
Added:
trunk/richfaces/menu-components/src/test/java/org/richfaces/component/MenuSeparatorComponentTest.java
Modified:
trunk/richfaces/menu-components/src/test/java/org/richfaces/component/MenuItemComponentTest.java
Log:
Menu components test cases development.
Modified: trunk/richfaces/menu-components/src/test/java/org/richfaces/component/MenuItemComponentTest.java
===================================================================
--- trunk/richfaces/menu-components/src/test/java/org/richfaces/component/MenuItemComponentTest.java 2007-04-10 11:20:28 UTC (rev 335)
+++ trunk/richfaces/menu-components/src/test/java/org/richfaces/component/MenuItemComponentTest.java 2007-04-10 11:22:55 UTC (rev 336)
@@ -31,10 +31,15 @@
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
+
+import javax.faces.component.UICommand;
import javax.faces.component.UIComponent;
import javax.faces.component.UIForm;
import javax.faces.component.html.HtmlForm;
import javax.faces.component.html.HtmlOutputText;
+import javax.faces.convert.IntegerConverter;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.PhaseId;
import org.richfaces.component.html.HtmlMenuItem;
import org.richfaces.renderkit.html.MenuItemRenderer;
@@ -44,10 +49,14 @@
import com.gargoylesoftware.htmlunit.html.HtmlScript;
import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.ajax4jsf.tests.MockViewRoot;
+import org.ajax4jsf.ajax.UIActionParameter;
import org.ajax4jsf.framework.renderer.ComponentVariables;
import org.ajax4jsf.framework.renderer.ComponentsVariableResolver;
+import org.apache.commons.collections.Buffer;
import org.apache.commons.lang.StringUtils;
+import org.apache.shale.test.mock.MockActionListener;
/**
@@ -84,7 +93,7 @@
form.setId("form");
facesContext.getViewRoot().getChildren().add(form);
- menuItem = (HtmlMenuItem) application.createComponent(HtmlMenuItem.COMPONENT_TYPE);
+ menuItem = (UIMenuItem) application.createComponent(HtmlMenuItem.COMPONENT_TYPE);
menuItem.setId("menuItem");
menuItem.setValue("Menu Item");
@@ -98,7 +107,7 @@
}
/**
- * Rigourous Test :-)
+ * MenuItem rendering test.
*/
public void testMenuItemRender() throws Exception
{
@@ -110,6 +119,9 @@
assertEquals("div", div.getNodeName());
}
+ /**
+ * MenuItem facets test.
+ */
public void testMenuItemIconFacet() throws Exception
{
UIComponent text = createComponent(HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(), null, null , null);
@@ -122,6 +134,9 @@
assertNotNull(span);
}
+ /**
+ * Test for MenuItem component in disabled mode.
+ */
public void testDisabledMenuItem() throws Exception
{
menuItem.setDisabled(true);
@@ -148,6 +163,9 @@
assertTrue(classAttr.contains("dr-menu-item dr-menu-item-disabled rich-menu-item rich-menu-item-disabled"));
}
+ /**
+ * Test for MenuItem component in enabled mode.
+ */
public void testEnabledMenuItem() throws Exception
{
assertEquals(false, menuItem.isDisabled());
@@ -176,6 +194,9 @@
assertTrue(classAttr.contains("dr-menu-item dr-menu-item-enabled rich-menu-item rich-menu-item-enabled"));
}
+ /**
+ * CSS link test.
+ */
public void testRenderStyle() throws Exception {
HtmlPage page = renderView();
assertNotNull(page);
@@ -210,5 +231,22 @@
}
}
*/
-
+ /**
+ * doDecode method trst.
+ */
+ public void testMenuItemDoDecode() throws Exception {
+
+ menuItem.setImmediate(true);
+ menuItem.setMode(MenuComponent.MODE_AJAX);
+
+ externalContext.getRequestParameterMap().put(menuItem.getClientId(facesContext), "Action");
+ menuItem.decode(facesContext);
+
+ MockViewRoot mockViewRoot = (MockViewRoot) facesContext.getViewRoot();
+ Buffer events = mockViewRoot.getEventsQueue(facesContext, PhaseId.APPLY_REQUEST_VALUES);
+ assertNotNull(events);
+ assertEquals(1, events.size());
+
+ }
+
}
Added: trunk/richfaces/menu-components/src/test/java/org/richfaces/component/MenuSeparatorComponentTest.java
===================================================================
--- trunk/richfaces/menu-components/src/test/java/org/richfaces/component/MenuSeparatorComponentTest.java (rev 0)
+++ trunk/richfaces/menu-components/src/test/java/org/richfaces/component/MenuSeparatorComponentTest.java 2007-04-10 11:22:55 UTC (rev 336)
@@ -0,0 +1,110 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * 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.component;
+
+import javax.faces.component.UIForm;
+import javax.faces.component.html.HtmlForm;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.richfaces.component.html.HtmlMenuItem;
+import org.richfaces.component.html.HtmlMenuSeparator;
+
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+/**
+ * Unit test for MenuSeparator Component.
+ */
+public class MenuSeparatorComponentTest
+ extends AbstractAjax4JsfTestCase
+{
+
+/* private static Set javaScripts = new HashSet();
+
+ static {
+ javaScripts.add("org.ajax4jsf.framework.ajax.AjaxScript()");
+ javaScripts.add("org.ajax4jsf.framework.resource.PrototypeScript()");
+ javaScripts.add("org.ajax4jsf.framework.util.command.CommandScript()");
+ }
+*/
+ private UIMenuSeparator menuSeparator;
+ private UIForm form;
+
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public MenuSeparatorComponentTest(String testName)
+ {
+ super(testName);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+
+ menuSeparator = (UIMenuSeparator) application.createComponent(HtmlMenuSeparator.COMPONENT_TYPE);
+ menuSeparator.setId("menuSeparator");
+
+ form.getChildren().add(menuSeparator);
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+ menuSeparator = null;
+ form = null;
+ }
+
+ /**
+ * MenuSeparator rendering test.
+ */
+ public void testMenuSeparatorRender() throws Exception
+ {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ //System.out.println(page.asXml());
+ HtmlElement div = page.getHtmlElementById(menuSeparator.getClientId(facesContext));
+ assertNotNull(div);
+ assertEquals("div", div.getNodeName());
+ }
+
+ /**
+ * MenuSeparator attributes test.
+ */
+ public void testMenuSeparatorAttributes() throws Exception
+ {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ //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);
+ }
+
+}
\ No newline at end of file
19 years
JBoss Rich Faces SVN: r335 - in trunk/richfaces/dropdown-menu/src/main: resources/org/richfaces/renderkit/html/scripts and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: a.izobov
Date: 2007-04-10 07:20:28 -0400 (Tue, 10 Apr 2007)
New Revision: 335
Modified:
trunk/richfaces/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java
trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
Log:
event support(onmouseout and onmouseover) for menuGroup and menuItem changed
Modified: trunk/richfaces/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java
===================================================================
--- trunk/richfaces/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java 2007-04-10 11:02:40 UTC (rev 334)
+++ trunk/richfaces/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java 2007-04-10 11:20:28 UTC (rev 335)
@@ -193,11 +193,16 @@
flcloseonclick=0;
}
if(itemId != null){
- buffer
- .append(".addItem('")
- .append(itemId)
- .append("',")
- .append(flcloseonclick+")");
+ function = new JSFunction("addItem");
+ function.addParameter(itemId);
+ function.addParameter(new Integer(flcloseonclick));
+
+ ScriptOptions options = new ScriptOptions(kid);
+ options.addOption("onmouseout", kid.getAttributes().get("onmouseout"));
+ options.addOption("onmouseover", kid.getAttributes().get("onmouseover"));
+ function.addParameter(options);
+ buffer.append('.');
+ function.appendScript(buffer);
}
}
Modified: trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
===================================================================
--- trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2007-04-10 11:02:40 UTC (rev 334)
+++ trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2007-04-10 11:20:28 UTC (rev 335)
@@ -194,6 +194,8 @@
} // if
tmpLayer.style.visibility = 'hidden';
+ tmpLayer.style.left = "-"+tmpLayer.clientWidth;
+// Element.hide(tmpLayer);
} // else
},
@@ -459,7 +461,7 @@
this.bottom = this.top + dim.height;
this.right = this.left + dim.width;
-
+
this.layerdim = Element.getDimensions(this.layer);
var options = Exadel.Menu.Layers.layers[this.layer.id].options;
@@ -518,9 +520,9 @@
this.layer = $(layer);
this.show = function() {
- if (!Exadel.Menu.Layers.isVisible(this.layer)){
- this.reposition();
- Exadel.Menu.Layers.LMPopUp(this.layer, false);
+ if (!Exadel.Menu.Layers.isVisible(this.layer)){
+ this.reposition();
+ Exadel.Menu.Layers.LMPopUp(this.layer, false);
}
}.bind(this);
}
@@ -815,68 +817,73 @@
},
//addItem: function(itemId, hoverClass, plainClass, hoverStyle, plainStyle){
- addItem: function(itemId, flag_close_onclick){
+ addItem: function(itemId, flag_close_onclick, options) {
var dis = this;
var item = {};
- //item.hoverClass = hoverClass;// = hoverClass.split(" ");
- //item.plainClass = plainClass;//.split(" ");
- //if (hoverStyle) item.hoverStyle = Exadel.extractCamelizedRules(hoverStyle);
- //if (plainStyle) item.plainStyle = Exadel.extractCamelizedRules(plainStyle);
item.id = itemId;
item.obj = $(itemId);
item.menu = this;
+ item.options = options || {};
+ if (item.options.onmouseover != ""){
+ item.eventOnMouseOver = new Function("event",item.options.onmouseover).bindAsEventListener(item);
+ }
+ if (item.options.onmouseout != ""){
+ item.eventOnMouseOut = new Function("event",item.options.onmouseout).bindAsEventListener(item);
+ }
this.items[itemId] = item;
+
var onmouseover =
function(e){
- //if (this.hoverClass) $(this.id).className = this.hoverClass;
- //if(this.hoverStyle) {
- // Exadel.replaceStyleHash($(this.id), this.plainStyle, this.hoverStyle);
- //}
this.menu.closeMinors(this.id);
+ if (this.eventOnMouseOver) {
+ var reltg = (e.relatedTarget) ? e.relatedTarget : e.fromElement;
+ while (reltg && reltg != this.obj && reltg.nodeName != 'BODY')
+ reltg = reltg.parentNode;
+ if (reltg == this.obj) return;
+ this.eventOnMouseOver();
+ }
}.bindAsEventListener(item);
- //var onmouseout =
- // function(e){
- //if (this.plainClass) $(this.id).className = this.plainClass;
- //if(this.hoverStyle) {
- // Exadel.replaceStyleHash($(this.id), this.hoverStyle, this.plainStyle);
- //}
- // }.bindAsEventListener(item);
+
+ var onmouseout =
+ function(e){
+ if (this.eventOnMouseOut) {
+ var reltg = (e.relatedTarget) ? e.relatedTarget : e.toElement;
+ while (reltg && reltg != this.obj && reltg.nodeName != 'BODY')
+ reltg = reltg.parentNode;
+ if (reltg == this.obj) return;
+ this.eventOnMouseOut();
+ }
+ }.bindAsEventListener(item);
var onmouseclick =
function(e){
-
- var menuLayer = item.menu;
- //if (menuLayer.level>0) {
+ var menuLayer = item.menu;
while (menuLayer.level > 0) {
menuLayer = Exadel.Menu.Layers.layers[(Exadel.Menu.Layers.father[menuLayer.id])];
}
if (menuLayer && menuLayer.eventOnItemSelect) menuLayer.eventOnItemSelect();
- //}
-
- Exadel.Menu.Layers.shutdown();
+ Exadel.Menu.Layers.shutdown();
}.bindAsEventListener(item);
-
var binding = new Exadel.Menu.Layer.Binding (
item.id,
"mouseover",
onmouseover);
-
this.bindings.push(binding);
binding.refresh();
- //binding = new Exadel.Menu.Layer.Binding (
- // item.id,
- // "mouseout",
- // onmouseout);
- //this.bindings.push(binding);
- //binding.refresh();
- if (flag_close_onclick==1){
binding = new Exadel.Menu.Layer.Binding (
item.id,
- "click",
- onmouseclick);
+ "mouseout",
+ onmouseout);
this.bindings.push(binding);
binding.refresh();
+ if (flag_close_onclick==1){
+ binding = new Exadel.Menu.Layer.Binding (
+ item.id,
+ "click",
+ onmouseclick);
+ this.bindings.push(binding);
+ binding.refresh();
}
return this;
19 years
JBoss Rich Faces SVN: r334 - trunk/richfaces/togglePanel/src/test/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: d.bulahov
Date: 2007-04-10 07:02:40 -0400 (Tue, 10 Apr 2007)
New Revision: 334
Modified:
trunk/richfaces/togglePanel/src/test/java/org/richfaces/component/TogglePanelComponentTest.java
Log:
Unit tests development
Modified: trunk/richfaces/togglePanel/src/test/java/org/richfaces/component/TogglePanelComponentTest.java
===================================================================
--- trunk/richfaces/togglePanel/src/test/java/org/richfaces/component/TogglePanelComponentTest.java 2007-04-10 10:59:51 UTC (rev 333)
+++ trunk/richfaces/togglePanel/src/test/java/org/richfaces/component/TogglePanelComponentTest.java 2007-04-10 11:02:40 UTC (rev 334)
@@ -25,11 +25,14 @@
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlScript;
+import org.richfaces.event.SwitchablePanelSwitchEvent;
+import org.richfaces.component.UISwitchablePanel;
import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
import org.apache.commons.lang.StringUtils;
import javax.faces.component.UIComponent;
import javax.faces.component.UIOutput;
import javax.faces.component.html.HtmlForm;
+import javax.faces.event.ActionEvent;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -99,7 +102,7 @@
toggleControl = (UIToggleControl)application.createComponent("org.richfaces.ToggleControl");
toggleControl.setId("ToggleControl");
toggleControl.setFor(togglePanel.getId());
- toggleControl.setFor(togglePanel.getId());
+
form.getChildren().add(toggleControl);
}
@@ -118,6 +121,7 @@
*
* @throws Exception
*/
+
public void testRender() throws Exception {
HtmlPage page = renderView();
assertNotNull(page);
@@ -132,7 +136,6 @@
assertTrue(classAttr.contains("dr-tglctrl"));
assertTrue(classAttr.contains("rich-tglctrl"));
}
-
/**
* Test style rendering
*
@@ -147,12 +150,11 @@
HtmlElement link = (HtmlElement) links.get(0);
assertTrue(link.getAttributeValue("href").contains("org/richfaces/renderkit/html/css/toggleControl.xcss"));
}
-
/**
* Test script rendering
*
* @throws Exception
- */
+ */
public void testRenderScript() throws Exception {
HtmlPage page = renderView();
assertNotNull(page);
@@ -177,6 +179,23 @@
}
}
}
+
+ public void testSwitch() throws Exception {
+
+ HtmlPage page = renderView();
+ System.out.println(page.asXml());
+ togglePanel.setValue("a");
+ togglePanel.broadcast(new SwitchablePanelSwitchEvent(togglePanel,null, toggleControl));
+ assertFalse(((String)togglePanel.getValue()).equals("a"));
+ assertTrue(((String)togglePanel.getValue()).equals("b"));
+
+ toggleControl.setSwitchToState("a");
+ togglePanel.broadcast(new SwitchablePanelSwitchEvent(togglePanel,"null", toggleControl));
+ assertFalse(((String)togglePanel.getValue()).equals("b"));
+ assertTrue(((String)togglePanel.getValue()).equals("a"));
+
+ }
+
}
19 years
JBoss Rich Faces SVN: r333 - in trunk/richfaces/togglePanel/src/main: templates and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: d.bulahov
Date: 2007-04-10 06:59:51 -0400 (Tue, 10 Apr 2007)
New Revision: 333
Modified:
trunk/richfaces/togglePanel/src/main/java/org/richfaces/renderkit/html/ToggleControlRenderer.java
trunk/richfaces/togglePanel/src/main/templates/toggleControl.jspx
Log:
In new ajax4jsf-1.1.1-SNAPSHOT.jar not rendering childs in toggleControl. Has corrected
Modified: trunk/richfaces/togglePanel/src/main/java/org/richfaces/renderkit/html/ToggleControlRenderer.java
===================================================================
--- trunk/richfaces/togglePanel/src/main/java/org/richfaces/renderkit/html/ToggleControlRenderer.java 2007-04-09 23:46:48 UTC (rev 332)
+++ trunk/richfaces/togglePanel/src/main/java/org/richfaces/renderkit/html/ToggleControlRenderer.java 2007-04-10 10:59:51 UTC (rev 333)
@@ -38,6 +38,7 @@
import org.richfaces.component.UIToggleControl;
import org.richfaces.component.UITogglePanel;
import org.richfaces.event.SwitchablePanelSwitchEvent;
+import java.io.IOException;
/**
* @author igels
@@ -157,6 +158,11 @@
return null;
}
+
+ public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
+ super.encodeChildren(context, component);
+ }
+
/*
private String getFormId(FacesContext context,UIComponent component) {
while (component != null && !(component instanceof UIForm)) {
Modified: trunk/richfaces/togglePanel/src/main/templates/toggleControl.jspx
===================================================================
--- trunk/richfaces/togglePanel/src/main/templates/toggleControl.jspx 2007-04-09 23:46:48 UTC (rev 332)
+++ trunk/richfaces/togglePanel/src/main/templates/toggleControl.jspx 2007-04-10 10:59:51 UTC (rev 333)
@@ -20,5 +20,9 @@
onclick="#{this:getOnClick(context,component)}; return false;"
class="dr-tglctrl rich-tglctrl #{component.attributes['styleClass']}"
- >#{component.attributes['value']}<vcp:body/></a>
+ >#{component.attributes['value']}
+ <vcp:body>
+ <f:call name="renderChildren" />
+ </vcp:body>
+</a>
</f:root>
\ No newline at end of file
19 years
JBoss Rich Faces SVN: r332 - trunk/richfaces/panel/src/test/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-04-09 19:46:48 -0400 (Mon, 09 Apr 2007)
New Revision: 332
Added:
trunk/richfaces/panel/src/test/java/org/richfaces/component/PanelComponentTest.java
Removed:
trunk/richfaces/panel/src/test/java/org/richfaces/component/JSFComponentTest.java
Log:
Test renamed to PanelComponentTest.java
Deleted: trunk/richfaces/panel/src/test/java/org/richfaces/component/JSFComponentTest.java
===================================================================
--- trunk/richfaces/panel/src/test/java/org/richfaces/component/JSFComponentTest.java 2007-04-09 20:03:14 UTC (rev 331)
+++ trunk/richfaces/panel/src/test/java/org/richfaces/component/JSFComponentTest.java 2007-04-09 23:46:48 UTC (rev 332)
@@ -1,141 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * 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.component;
-
-import java.util.List;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import javax.faces.component.UIComponent;
-import javax.faces.component.html.HtmlCommandLink;
-import javax.faces.component.html.HtmlOutputText;
-import javax.faces.render.Renderer;
-
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-import org.richfaces.component.html.HtmlPanel;
-import org.richfaces.renderkit.html.PanelRenderer;
-
-import com.gargoylesoftware.htmlunit.html.HtmlElement;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-
-/**
- * Unit test for simple Component.
- */
-public class JSFComponentTest
- extends AbstractAjax4JsfTestCase
-{
-
-
- HtmlPanel htmlPanel;
-
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public JSFComponentTest( String testName )
- {
- super( testName );
- }
-
- public void setUp() throws Exception {
- super.setUp();
- htmlPanel = new HtmlPanel();
- htmlPanel.setId("panel");
- htmlPanel.setRendererType("panelRenderer");
- facesContext.getViewRoot().getChildren().add(htmlPanel);
- renderKit.addRenderer(HtmlPanel.COMPONENT_FAMILY, "panelRenderer", new PanelRenderer());
- }
-
- public void tearDown() throws Exception {
- super.tearDown();
- htmlPanel = null;
- }
- /**
- * Rigourous Test :-)
- * @throws Exception
- */
- public void testRender() throws Exception
- {
- HtmlPage page = renderView();
- assertNotNull(page);
- System.out.println(page.asXml());
- HtmlElement div = page.getHtmlElementById("panel");
- assertNotNull(div);
- assertEquals("div", div.getNodeName());
- }
-
- /**
- * Rigourous Test :-)
- * @throws Exception
- */
- public void testRenderStyle() throws Exception
- {
- HtmlPage page = renderView();
- assertNotNull(page);
- List elementsByTagName = page.getDocumentElement().getHtmlElementsByTagName("link");
- assertEquals(1, elementsByTagName.size());
- HtmlElement link = (HtmlElement) elementsByTagName.get(0);
- assertTrue(link.getAttributeValue("href").contains("org/richfaces/renderkit/html/css/panel.xcss"));
- }
-
- /**
- * Rigourous Test :-)
- * @throws Exception
- */
- public void testRenderHeader() throws Exception
- {
- UIComponent text = createComponent(HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(), null, null , null);
- htmlPanel.getFacets().put("header", text);
- HtmlPage page = renderView();
- assertNotNull(page);
- System.out.println(page.asXml());
- HtmlElement div = page.getHtmlElementById("panel_header");
- assertNotNull(div);
- }
-
- /**
- * Rigourous Test :-)
- * @throws Exception
- */
- public void testRenderAttributes() throws Exception
- {
- Object[][] attributes ={{"style","xxx","style","xxx"},{"onclick","alert()","onclick","alert()"},{"styleClass","yyy","class","dr-pnl rich-panel yyy"}};
- UIComponent text = createComponent(HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(), null, null , null);
- htmlPanel.getFacets().put("header", text);
- for (int i = 0; i < attributes.length; i++) {
- Object[] attr = attributes[i];
- htmlPanel.getAttributes().put(attr[0], attr[1]);
- }
- HtmlPage page = renderView();
- assertNotNull(page);
- System.out.println(page.asXml());
- HtmlElement div = page.getHtmlElementById("panel");
- assertNotNull(div);
- for (int i = 0; i < attributes.length; i++) {
- Object[] attr = attributes[i];
- assertEquals(attr[3],div.getAttributeValue((String) attr[2]));
- }
-
- }
-}
Copied: trunk/richfaces/panel/src/test/java/org/richfaces/component/PanelComponentTest.java (from rev 331, trunk/richfaces/panel/src/test/java/org/richfaces/component/JSFComponentTest.java)
===================================================================
--- trunk/richfaces/panel/src/test/java/org/richfaces/component/PanelComponentTest.java (rev 0)
+++ trunk/richfaces/panel/src/test/java/org/richfaces/component/PanelComponentTest.java 2007-04-09 23:46:48 UTC (rev 332)
@@ -0,0 +1,141 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * 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.component;
+
+import java.util.List;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlCommandLink;
+import javax.faces.component.html.HtmlOutputText;
+import javax.faces.render.Renderer;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.richfaces.component.html.HtmlPanel;
+import org.richfaces.renderkit.html.PanelRenderer;
+
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+/**
+ * Unit test for simple Component.
+ */
+public class PanelComponentTest
+ extends AbstractAjax4JsfTestCase
+{
+
+
+ HtmlPanel htmlPanel;
+
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public PanelComponentTest( String testName )
+ {
+ super( testName );
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+ htmlPanel = new HtmlPanel();
+ htmlPanel.setId("panel");
+ htmlPanel.setRendererType("panelRenderer");
+ facesContext.getViewRoot().getChildren().add(htmlPanel);
+ renderKit.addRenderer(HtmlPanel.COMPONENT_FAMILY, "panelRenderer", new PanelRenderer());
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+ htmlPanel = null;
+ }
+ /**
+ * Rigourous Test :-)
+ * @throws Exception
+ */
+ public void testRender() throws Exception
+ {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ System.out.println(page.asXml());
+ HtmlElement div = page.getHtmlElementById("panel");
+ assertNotNull(div);
+ assertEquals("div", div.getNodeName());
+ }
+
+ /**
+ * Rigourous Test :-)
+ * @throws Exception
+ */
+ public void testRenderStyle() throws Exception
+ {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ List elementsByTagName = page.getDocumentElement().getHtmlElementsByTagName("link");
+ assertEquals(1, elementsByTagName.size());
+ HtmlElement link = (HtmlElement) elementsByTagName.get(0);
+ assertTrue(link.getAttributeValue("href").contains("org/richfaces/renderkit/html/css/panel.xcss"));
+ }
+
+ /**
+ * Rigourous Test :-)
+ * @throws Exception
+ */
+ public void testRenderHeader() throws Exception
+ {
+ UIComponent text = createComponent(HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(), null, null , null);
+ htmlPanel.getFacets().put("header", text);
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ System.out.println(page.asXml());
+ HtmlElement div = page.getHtmlElementById("panel_header");
+ assertNotNull(div);
+ }
+
+ /**
+ * Rigourous Test :-)
+ * @throws Exception
+ */
+ public void testRenderAttributes() throws Exception
+ {
+ Object[][] attributes ={{"style","xxx","style","xxx"},{"onclick","alert()","onclick","alert()"},{"styleClass","yyy","class","dr-pnl rich-panel yyy"}};
+ UIComponent text = createComponent(HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(), null, null , null);
+ htmlPanel.getFacets().put("header", text);
+ for (int i = 0; i < attributes.length; i++) {
+ Object[] attr = attributes[i];
+ htmlPanel.getAttributes().put(attr[0], attr[1]);
+ }
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ System.out.println(page.asXml());
+ HtmlElement div = page.getHtmlElementById("panel");
+ assertNotNull(div);
+ for (int i = 0; i < attributes.length; i++) {
+ Object[] attr = attributes[i];
+ assertEquals(attr[3],div.getAttributeValue((String) attr[2]));
+ }
+
+ }
+}
19 years
JBoss Rich Faces SVN: r331 - trunk/richfaces-samples/dataFilterSliderDemo.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-04-09 16:03:14 -0400 (Mon, 09 Apr 2007)
New Revision: 331
Modified:
trunk/richfaces-samples/dataFilterSliderDemo/pom.xml
Log:
version corrected in dataFilterSliderDemo/pom.xml
Modified: trunk/richfaces-samples/dataFilterSliderDemo/pom.xml
===================================================================
--- trunk/richfaces-samples/dataFilterSliderDemo/pom.xml 2007-04-09 20:02:27 UTC (rev 330)
+++ trunk/richfaces-samples/dataFilterSliderDemo/pom.xml 2007-04-09 20:03:14 UTC (rev 331)
@@ -19,7 +19,7 @@
<dependency>
<groupId>org.richfaces</groupId>
<artifactId>dataFilterSlider</artifactId>
- <version>1.0-SNAPSHOT</version>
+ <version>${project.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
19 years
JBoss Rich Faces SVN: r330 - in trunk/richfaces/tree/src/test/java/org/richfaces/component: events and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-04-09 16:02:27 -0400 (Mon, 09 Apr 2007)
New Revision: 330
Added:
trunk/richfaces/tree/src/test/java/org/richfaces/component/ListRowKeyTest.java
trunk/richfaces/tree/src/test/java/org/richfaces/component/events/TreeEventsListenersTest.java
Modified:
trunk/richfaces/tree/src/test/java/org/richfaces/component/events/TreeEventsTest.java
Log:
Tree unit tests updated & created
Added: trunk/richfaces/tree/src/test/java/org/richfaces/component/ListRowKeyTest.java
===================================================================
--- trunk/richfaces/tree/src/test/java/org/richfaces/component/ListRowKeyTest.java (rev 0)
+++ trunk/richfaces/tree/src/test/java/org/richfaces/component/ListRowKeyTest.java 2007-04-09 20:02:27 UTC (rev 330)
@@ -0,0 +1,134 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * 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.component;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+/**
+ * @author Nick Belaevski - nbelaevski(a)exadel.com
+ * created 09.04.2007
+ *
+ */
+public class ListRowKeyTest extends TestCase {
+
+ public void testConstructors() {
+ ListRowKey key = new ListRowKey();
+
+ assertEquals(0, key.depth());
+ assertEquals(0, key.getPath().length());
+
+ List list = new LinkedList();
+ list.add(new Long(2));
+ list.add(new Long(4));
+
+ key = new ListRowKey(list);
+
+ assertEquals(2, key.depth());
+ Iterator iterator = key.iterator();
+ assertTrue(iterator.hasNext());
+ assertEquals(new Long(2), iterator.next());
+
+ assertTrue(iterator.hasNext());
+ assertEquals(new Long(4), iterator.next());
+
+ assertFalse(iterator.hasNext());
+
+ key = new ListRowKey(new Long(5));
+ assertEquals(1, key.depth());
+ iterator = key.iterator();
+ assertTrue(iterator.hasNext());
+ assertEquals(new Long(5), iterator.next());
+
+ assertFalse(iterator.hasNext());
+
+ key = new ListRowKey(new ListRowKey(new Long(6)), new Long(7));
+ assertEquals(2, key.depth());
+ iterator = key.iterator();
+ assertTrue(iterator.hasNext());
+ assertEquals(new Long(6), iterator.next());
+
+ assertTrue(iterator.hasNext());
+ assertEquals(new Long(7), iterator.next());
+
+ assertFalse(iterator.hasNext());
+
+ key = new ListRowKey(key);
+ assertEquals(2, key.depth());
+ iterator = key.iterator();
+ assertTrue(iterator.hasNext());
+ assertEquals(new Long(6), iterator.next());
+
+ assertTrue(iterator.hasNext());
+ assertEquals(new Long(7), iterator.next());
+
+ assertFalse(iterator.hasNext());
+
+ key = new ListRowKey("12_:34:56__78_:9");
+ assertEquals(2, key.depth());
+ iterator = key.iterator();
+ assertTrue(iterator.hasNext());
+ assertEquals("12:34", iterator.next());
+
+ assertTrue(iterator.hasNext());
+ assertEquals("56_78:9", iterator.next());
+
+ assertFalse(iterator.hasNext());
+
+
+ key = new ListRowKey("12_:34:56__78_:9:");
+ assertEquals(2, key.depth());
+ iterator = key.iterator();
+ assertTrue(iterator.hasNext());
+ assertEquals("12:34", iterator.next());
+
+ assertTrue(iterator.hasNext());
+ assertEquals("56_78:9", iterator.next());
+
+ assertFalse(iterator.hasNext());
+ }
+
+ public void testObjectMethods() {
+ String[] data = new String[] {
+ "test1", "test:2", "test3"
+ };
+
+ ListRowKey key1 = new ListRowKey(Arrays.asList(data));
+
+ ListRowKey key2 = new ListRowKey();
+ for (int i = 0; i < data.length; i++) {
+ String string = data[i];
+
+ key2 = new ListRowKey(key2, string);
+ }
+
+ assertTrue(key1.hashCode() == key2.hashCode());
+ assertTrue(key1.equals(key2));
+ assertTrue(key1.toString().equals(key2.toString()));
+ }
+}
Added: trunk/richfaces/tree/src/test/java/org/richfaces/component/events/TreeEventsListenersTest.java
===================================================================
--- trunk/richfaces/tree/src/test/java/org/richfaces/component/events/TreeEventsListenersTest.java (rev 0)
+++ trunk/richfaces/tree/src/test/java/org/richfaces/component/events/TreeEventsListenersTest.java 2007-04-09 20:02:27 UTC (rev 330)
@@ -0,0 +1,114 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * 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.component.events;
+
+import javax.faces.component.UIComponentBase;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+
+import junit.framework.TestCase;
+
+/**
+ * @author Nick Belaevski - nbelaevski(a)exadel.com
+ * created 09.04.2007
+ *
+ */
+public class TreeEventsListenersTest extends TestCase {
+ private UIComponentBase source;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ source = new UIComponentBase() {
+
+ public String getFamily() {
+ return null;
+ }};
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+
+ this.source = null;
+ }
+
+ public void testNodeExpandedListener() {
+ NodeExpandedEvent event = new NodeExpandedEvent(source);
+
+ ExpandListener listener = new ExpandListener();
+
+ assertTrue(event.isAppropriateListener(listener));
+ assertFalse(event.isAppropriateListener(new FacesListener(){
+
+ }));
+
+ event.processListener(listener);
+
+ assertSame(event, listener.getEvent());
+ }
+
+ public void testNodeSelectedListener() {
+ NodeSelectedEvent event = new NodeSelectedEvent(source);
+
+ SelectListener listener = new SelectListener();
+
+ assertTrue(event.isAppropriateListener(listener));
+ assertFalse(event.isAppropriateListener(new FacesListener(){
+
+ }));
+
+ event.processListener(listener);
+
+ assertSame(event, listener.getEvent());
+ }
+}
+
+class ExpandListener implements NodeExpandedListener {
+
+ private FacesEvent event;
+
+ public void processExpansion(NodeExpandedEvent nodeExpandedEvent)
+ throws AbortProcessingException {
+
+ event = nodeExpandedEvent;
+ }
+
+ public FacesEvent getEvent() {
+ return event;
+ }
+}
+
+class SelectListener implements NodeSelectedListener {
+
+ private FacesEvent event;
+
+ public void processSelection(NodeSelectedEvent nodeSelectedEvent)
+ throws AbortProcessingException {
+
+ event = nodeSelectedEvent;
+ }
+
+ public FacesEvent getEvent() {
+ return event;
+ }
+}
\ No newline at end of file
Modified: trunk/richfaces/tree/src/test/java/org/richfaces/component/events/TreeEventsTest.java
===================================================================
--- trunk/richfaces/tree/src/test/java/org/richfaces/component/events/TreeEventsTest.java 2007-04-09 20:01:56 UTC (rev 329)
+++ trunk/richfaces/tree/src/test/java/org/richfaces/component/events/TreeEventsTest.java 2007-04-09 20:02:27 UTC (rev 330)
@@ -21,13 +21,13 @@
package org.richfaces.component.events;
-import javax.faces.application.Application;
import javax.faces.component.UIViewRoot;
+import javax.faces.event.AbortProcessingException;
import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
import org.ajax4jsf.dnd.event.DragEvent;
import org.ajax4jsf.dnd.event.DropEvent;
-import org.ajax4jsf.framework.ajax.AjaxViewRoot;
import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
import org.ajax4jsf.tests.MockMethodBinding;
import org.ajax4jsf.tests.MockViewRoot;
@@ -71,6 +71,26 @@
this.treeNode = null;
}
+ public void testPassThroughGenericEvent() {
+ //just to be sure generic events pass through ok
+ TreeEvents.invokeListenerBindings(treeNode, new FacesEvent(treeNode) {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 2196096358111753037L;
+
+ public boolean isAppropriateListener(FacesListener listener) {
+ return false;
+ }
+
+ public void processListener(FacesListener listener) {
+ throw new AbortProcessingException();
+ }
+
+ }, facesContext);
+ }
+
public void testAjaxSelectedEvent() {
MockViewRoot mockViewRoot = (MockViewRoot) facesContext.getViewRoot();
tree.setAjaxSubmitSelection(true);
@@ -92,26 +112,31 @@
assertEquals(1, args.length);
assertEquals(1, args[0].length);
assertSame(event, args[0][0]);
+ }
- events.clear();
- binding.clear();
+ public void testAjaxSelectedEventListenersOff() {
+ MockViewRoot mockViewRoot = (MockViewRoot) facesContext.getViewRoot();
+ tree.setAjaxSubmitSelection(false);
+ treeNode.setAjaxSubmitSelection("inherit");
- //now ajax events switched off
- tree.setAjaxSubmitSelection(false);
+ MockMethodBinding binding = new MockMethodBinding();
+ treeNode.setNodeSelectListener(binding);
+
+ Buffer events = mockViewRoot.getAjaxEventsQueue(facesContext);
assertNotNull(events);
assertEquals(0, events.size());
assertEquals(0, binding.getInvocationArgs().length);
- event = new AjaxSelectedEvent(treeNode);
+ AjaxSelectedEvent event = new AjaxSelectedEvent(treeNode);
TreeEvents.invokeListenerBindings(treeNode, event, facesContext);
+ assertNotNull(events);
assertEquals(0, events.size());
-
- args = binding.getInvocationArgs();
- assertEquals(0, args.length);
-
+ assertEquals(0, binding.getInvocationArgs().length);
}
+
+
public void testNodeExpansionEvent() {
MockMethodBinding binding = new MockMethodBinding();
treeNode.setChangeExpandListener(binding);
19 years
JBoss Rich Faces SVN: r329 - trunk/richfaces/dataFilterSlider.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-04-09 16:01:56 -0400 (Mon, 09 Apr 2007)
New Revision: 329
Modified:
trunk/richfaces/dataFilterSlider/pom.xml
Log:
version corrected in dataFilterSlider/pom.xml
Modified: trunk/richfaces/dataFilterSlider/pom.xml
===================================================================
--- trunk/richfaces/dataFilterSlider/pom.xml 2007-04-09 18:08:12 UTC (rev 328)
+++ trunk/richfaces/dataFilterSlider/pom.xml 2007-04-09 20:01:56 UTC (rev 329)
@@ -7,7 +7,6 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.richfaces</groupId>
<artifactId>dataFilterSlider</artifactId>
- <version>1.1-SNAPSHOT</version>
<name>Data Filter Slider</name>
<build>
<plugins>
19 years