JBoss Rich Faces SVN: r308 - in trunk/richfaces/menu-components/src/test/java/org/richfaces: component and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: F.antonov
Date: 2007-04-06 10:16:36 -0400 (Fri, 06 Apr 2007)
New Revision: 308
Added:
trunk/richfaces/menu-components/src/test/java/org/richfaces/component/MenuGroupComponentTest.java
Removed:
trunk/richfaces/menu-components/src/test/java/org/richfaces/component/html/
trunk/richfaces/menu-components/src/test/java/org/richfaces/taglib/
Modified:
trunk/richfaces/menu-components/src/test/java/org/richfaces/component/MenuItemComponentTest.java
Log:
Menu components test cases development.
Added: trunk/richfaces/menu-components/src/test/java/org/richfaces/component/MenuGroupComponentTest.java
===================================================================
--- trunk/richfaces/menu-components/src/test/java/org/richfaces/component/MenuGroupComponentTest.java (rev 0)
+++ trunk/richfaces/menu-components/src/test/java/org/richfaces/component/MenuGroupComponentTest.java 2007-04-06 14:16:36 UTC (rev 308)
@@ -0,0 +1,112 @@
+/**
+ * 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.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import junit.framework.Assert;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIForm;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.component.html.HtmlOutputText;
+
+import org.richfaces.component.html.HtmlMenuGroup;
+import org.richfaces.component.html.HtmlMenuItem;
+import org.richfaces.renderkit.html.MenuItemRenderer;
+
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlScript;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+
+import org.ajax4jsf.framework.renderer.ComponentVariables;
+import org.ajax4jsf.framework.renderer.ComponentsVariableResolver;
+
+
+/**
+ * Unit test for MenuGroup Component.
+ */
+public class MenuGroupComponentTest
+ 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 UIMenuGroup menuGroup;
+ private UIForm form;
+
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public MenuGroupComponentTest( String testName )
+ {
+ super( testName );
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+
+ menuGroup = (HtmlMenuGroup) application.createComponent(HtmlMenuGroup.COMPONENT_TYPE);
+ menuGroup.setId("menuGroup");
+ menuGroup.setValue("Menu Group");
+
+ form.getChildren().add(menuGroup);
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+ menuGroup = null;
+ form = null;
+ }
+
+ /**
+ * Rigourous Test :-)
+ */
+ public void testMenuGroupRender() throws Exception
+ {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ System.out.println(page.asXml());
+ HtmlElement div = page.getHtmlElementById(menuGroup.getClientId(facesContext));
+ assertNotNull(div);
+ assertEquals("div", div.getNodeName());
+ }
+
+}
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-06 13:56:20 UTC (rev 307)
+++ trunk/richfaces/menu-components/src/test/java/org/richfaces/component/MenuItemComponentTest.java 2007-04-06 14:16:36 UTC (rev 308)
@@ -50,7 +50,7 @@
/**
- * Unit test for simple Component.
+ * Unit test for MenuItem Component.
*/
public class MenuItemComponentTest
extends AbstractAjax4JsfTestCase
@@ -63,7 +63,7 @@
javaScripts.add("org.ajax4jsf.framework.util.command.CommandScript()");
}
*/
- private HtmlMenuItem menuItem;
+ private UIMenuItem menuItem;
private UIForm form;
/**
@@ -104,7 +104,7 @@
HtmlPage page = renderView();
assertNotNull(page);
System.out.println(page.asXml());
- HtmlElement div = page.getHtmlElementById(form.getId() + ":" + menuItem.getId());
+ HtmlElement div = page.getHtmlElementById(menuItem.getClientId(facesContext));
assertNotNull(div);
assertEquals("div", div.getNodeName());
}
@@ -116,7 +116,7 @@
HtmlPage page = renderView();
assertNotNull(page);
System.out.println(page.asXml());
- HtmlElement span = page.getHtmlElementById(form.getId() + ":" + menuItem.getId() + ":icon");
+ HtmlElement span = page.getHtmlElementById(menuItem.getClientId(facesContext) + ":icon");
assertEquals("span", span.getNodeName());
assertNotNull(span);
}
@@ -128,19 +128,19 @@
assertNotNull(page);
System.out.println(page.asXml());
- HtmlElement span = page.getHtmlElementById(form.getId() + ":" + menuItem.getId() + ":disabled");
+ HtmlElement span = page.getHtmlElementById(menuItem.getClientId(facesContext) + ":disabled");
assertNotNull(span);
assertEquals("span", span.getNodeName());
String classAttr = span.getAttributeValue("class");
Assert.assertTrue(classAttr.contains("dr-menu-label dr-menu-label-disabled rich-menu-item-label rich-menu-item-label-disabled"));
- span = page.getHtmlElementById(form.getId() + ":" + menuItem.getId() + ":icon");
+ span = page.getHtmlElementById(menuItem.getClientId(facesContext) + ":icon");
assertNotNull(span);
assertEquals("span", span.getNodeName());
classAttr = span.getAttributeValue("class");
- Assert.assertTrue(classAttr.contains("dr-menu-icon dr-menu-icon-disabled rich-menu-item-icon rich-menu-item-icon-disabled"));
+ Assert.assertTrue(classAttr.contains("dr-menu-icon rich-menu-item-icon dr-menu-icon-disabled rich-menu-item-icon-disabled"));
- HtmlElement div = page.getHtmlElementById(form.getId() + ":" + menuItem.getId());
+ HtmlElement div = page.getHtmlElementById(menuItem.getClientId(facesContext));
assertNotNull(div);
assertEquals("div", div.getNodeName());
classAttr = div.getAttributeValue("class");
@@ -150,24 +150,25 @@
public void testEnabledMenuItem() throws Exception
{
assertEquals(false, menuItem.isDisabled());
- menuItem.setIconClass("iconClass");
+ menuItem.getAttributes().put("iconClass", "iconClass");
HtmlPage page = renderView();
assertNotNull(page);
System.out.println(page.asXml());
- HtmlElement anchor = page.getHtmlElementById(form.getId() + ":" + menuItem.getId() + ":anchor");
+ HtmlElement anchor = page.getHtmlElementById(menuItem.getClientId(facesContext) + ":anchor");
assertNotNull(anchor);
assertEquals("a", anchor.getNodeName());
String classAttr = anchor.getAttributeValue("class");
Assert.assertTrue(classAttr.contains("dr-menu-label rich-menu-item-label"));
- HtmlElement span = page.getHtmlElementById(form.getId() + ":" + menuItem.getId() + ":icon");
+ HtmlElement span = page.getHtmlElementById(menuItem.getClientId(facesContext) + ":icon");
assertNotNull(span);
assertEquals("span", span.getNodeName());
classAttr = span.getAttributeValue("class");
- Assert.assertTrue(classAttr.contains("dr-menu-icon rich-menu-item-icon " + menuItem.getIconClass()));
+ Assert.assertTrue(classAttr.contains("dr-menu-icon rich-menu-item-icon"));
+ Assert.assertTrue(classAttr.contains((String) menuItem.getAttributes().get("iconClass")));
- HtmlElement div = page.getHtmlElementById(form.getId() + ":" + menuItem.getId());
+ HtmlElement div = page.getHtmlElementById(menuItem.getClientId(facesContext));
assertNotNull(div);
assertEquals("div", div.getNodeName());
classAttr = div.getAttributeValue("class");
@@ -206,6 +207,6 @@
assertTrue(found);
}
}
- }
-*/
+ } */
+
}
19 years
JBoss Rich Faces SVN: r307 - trunk/richfaces/tree/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-04-06 09:56:20 -0400 (Fri, 06 Apr 2007)
New Revision: 307
Modified:
trunk/richfaces/tree/src/main/java/org/richfaces/component/UITree.java
Log:
Drag/drop values restored to row key to provide TreeNode access
Modified: trunk/richfaces/tree/src/main/java/org/richfaces/component/UITree.java
===================================================================
--- trunk/richfaces/tree/src/main/java/org/richfaces/component/UITree.java 2007-04-06 13:54:53 UTC (rev 306)
+++ trunk/richfaces/tree/src/main/java/org/richfaces/component/UITree.java 2007-04-06 13:56:20 UTC (rev 307)
@@ -584,7 +584,7 @@
}
public Object getDragValue() {
- return getRowData();
+ return getRowKey();
}
public UIComponent getComponent() {
@@ -592,7 +592,7 @@
}
public Object getDropValue() {
- return getRowData();
+ return getRowKey();
}
public void addDropListener(DropListener listener) {
19 years
JBoss Rich Faces SVN: r306 - trunk/richfaces/inputnumber-slider/src/main/resources/org/richfaces/renderkit/html/script.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-04-06 09:54:53 -0400 (Fri, 06 Apr 2007)
New Revision: 306
Modified:
trunk/richfaces/inputnumber-slider/src/main/resources/org/richfaces/renderkit/html/script/SliderScript.js
Log:
RFA-315: slider not working in Safari
fixed
Modified: trunk/richfaces/inputnumber-slider/src/main/resources/org/richfaces/renderkit/html/script/SliderScript.js
===================================================================
--- trunk/richfaces/inputnumber-slider/src/main/resources/org/richfaces/renderkit/html/script/SliderScript.js 2007-04-06 13:19:25 UTC (rev 305)
+++ trunk/richfaces/inputnumber-slider/src/main/resources/org/richfaces/renderkit/html/script/SliderScript.js 2007-04-06 13:54:53 UTC (rev 306)
@@ -204,7 +204,6 @@
},
startDrag: function(event) {
-
window.document.onmouseup = this.eventMouseUp.bindAsEventListener(this);
window.document.onmousemove = this.eventMouseMove.bindAsEventListener(this);
this.editBlur();
@@ -216,7 +215,7 @@
if (this.options.currValue){
this.tip.style.display = "block";
}
- Richfaces.createEvent("mousedown", this.mainTable, "MouseEvents", null).fire();
+ Richfaces.createEvent("mousedown", this.mainTable, null, null).fire();
this.active = true;
var handle = Event.element(event);
var pointer = Event.pointerX(event);
@@ -231,6 +230,7 @@
update: function(event) {
if(this.active) {
+
if(!this.dragging) this.dragging = true;
this.draw(event);
Event.stop(event);
@@ -262,11 +262,11 @@
if(this.active && this.dragging) {
this.active = false;
this.dragging = false;
- Richfaces.createEvent("mouseup", this.mainTable, "MouseEvents", null).fire();
+ Richfaces.createEvent("mouseup", this.mainTable, null, null).fire();
Event.stop(event);
}
if (RichFaces.navigatorType() != "MSIE")
- Richfaces.createEvent("change", this.input, "HTMLEvents", null).fire();
+ Richfaces.createEvent("change", this.input, null, null).fire();
},
fireClickIfNeeded: function(event){
@@ -275,7 +275,7 @@
|| (RichFaces.getOperaVersion()
&& RichFaces.getOperaVersion() < 9.0
&& event.target.tagName.toLowerCase() != "div")) {
- Richfaces.createEvent("click", this.mainTable, "MouseEvents", null).fire();
+ Richfaces.createEvent("click", this.mainTable, null, null).fire();
}
},
19 years
JBoss Rich Faces SVN: r305 - trunk/richfaces/dropdown-menu/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: F.antonov
Date: 2007-04-06 09:19:25 -0400 (Fri, 06 Apr 2007)
New Revision: 305
Modified:
trunk/richfaces/dropdown-menu/src/main/java/org/richfaces/component/UIDropDownMenu.java
Log:
DropDownMenu component development.
Modified: trunk/richfaces/dropdown-menu/src/main/java/org/richfaces/component/UIDropDownMenu.java
===================================================================
--- trunk/richfaces/dropdown-menu/src/main/java/org/richfaces/component/UIDropDownMenu.java 2007-04-06 13:14:49 UTC (rev 304)
+++ trunk/richfaces/dropdown-menu/src/main/java/org/richfaces/component/UIDropDownMenu.java 2007-04-06 13:19:25 UTC (rev 305)
@@ -28,18 +28,16 @@
* JSF component class
*
*/
-public abstract class UIDropDownMenu extends UIComponentBase {
+public abstract class UIDropDownMenu extends UIComponentBase implements MenuComponent {
public static final String COMPONENT_TYPE = "org.richfaces.dropDownMenu";
public abstract void setEvent(String Event);
public abstract String getEvent();
+
+ public abstract void setMode(String mode);
+ public abstract String getMode();
+
-
- public static final String SERVER_TYPE = "server";
- public static final String CLIENT_TYPE = "client";
- public static final String AJAX_TYPE = "ajax";
-
-
}
19 years
JBoss Rich Faces SVN: r304 - trunk/richfaces/menu-components/src/main/config/component.
by richfaces-svn-commits@lists.jboss.org
Author: F.antonov
Date: 2007-04-06 09:14:49 -0400 (Fri, 06 Apr 2007)
New Revision: 304
Modified:
trunk/richfaces/menu-components/src/main/config/component/menucomponents.xml
Log:
MenuItem component development.
Modified: trunk/richfaces/menu-components/src/main/config/component/menucomponents.xml
===================================================================
--- trunk/richfaces/menu-components/src/main/config/component/menucomponents.xml 2007-04-06 13:13:19 UTC (rev 303)
+++ trunk/richfaces/menu-components/src/main/config/component/menucomponents.xml 2007-04-06 13:14:49 UTC (rev 304)
@@ -168,7 +168,7 @@
<property>
<name>disabled</name>
<classname>boolean</classname>
- <description>If “true” sets state of the item to disabled state. “false” is default</description>
+ <description>If "true" sets state of the item to disabled state. "false" is default</description>
<defaultvalue>false</defaultvalue>
</property>
<!-- property>
@@ -188,7 +188,8 @@
<property>
<name>target</name>
<classname>java.lang.Object</classname>
- <description></description>
+ <description>Name of a frame where the resource retrieved via this hyperlink is to be displayed</description>
+ <defaultvalue>""</defaultvalue>
</property>
<!-- Events attributes -->
@@ -197,6 +198,7 @@
<name>onselect</name>
<classname>java.lang.String</classname>
<description>HTML: script expression; The onselect event occurs when a user selects some menu item.</description>
+ <defaultvalue>""</defaultvalue>
</property>
<property hidden="true">
<name>ondblclick</name>
19 years
JBoss Rich Faces SVN: r303 - trunk/richfaces/menu-components/src/main/templates/org/richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: F.antonov
Date: 2007-04-06 09:13:19 -0400 (Fri, 06 Apr 2007)
New Revision: 303
Modified:
trunk/richfaces/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx
Log:
MenuItem component development.
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-06 13:12:20 UTC (rev 302)
+++ trunk/richfaces/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx 2007-04-06 13:13:19 UTC (rev 303)
@@ -19,60 +19,102 @@
<f:call name="initializeResources" />
- <f:clientid var="clientId"/>
+ <f:clientid var="clientId"/>
+
+
+ <jsp:scriptlet><![CDATA[
+ if (((org.richfaces.component.UIMenuItem) component).isDisabled()) {
+ ]]></jsp:scriptlet>
+
+ <div id="#{clientId}"
+ class="dr-menu-item dr-menu-item-disabled rich-menu-item rich-menu-item-disabled #{component.attributes['styleClass']}"
+ style="#{component.attributes['style']}"
+ onclick="Event.stop(event || window.event);">
+
+ <jsp:scriptlet><![CDATA[
+ } else {
+ ]]></jsp:scriptlet>
+
<div id="#{clientId}"
- class="#{class}"
- onmouseout="#{onmouseout}"
- onmouseover="#{onmouseover}"
+ class="dr-menu-item dr-menu-item-enabled rich-menu-item rich-menu-item-enabled #{component.attributes['styleClass']}"
+ 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']};"
+ 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']};"
style="#{component.attributes['style']}"
- onclick="#{onclick}">
- <jsp:scriptlet><![CDATA[
- if (!((org.richfaces.component.UIMenuItem) component).isDisabled()) {
- ]]></jsp:scriptlet>
+ onclick="#{component.attributes['onselect']}; #{onclick}">
<f:call name="utils.encodeAttributes">
<f:parameter value="onmousedown,onmouseup,onmousemove" />
</f:call>
- <jsp:scriptlet><![CDATA[
- }
- ]]></jsp:scriptlet>
+ <jsp:scriptlet><![CDATA[
+ }
+ ]]></jsp:scriptlet>
+
+
<span id="#{clientId}:icon"
- class="#{iconClass}"
+ class="dr-menu-icon rich-menu-item-icon #{iconDisabledClasses} #{component.attributes['iconClass']}"
style="#{component.attributes['iconStyle']}">
+
<jsp:scriptlet><![CDATA[
UIComponent iconFacet = getIconFacet((org.richfaces.component.UIMenuItem) component);
if (null != iconFacet) {
renderChild(context, iconFacet);
} else {
]]></jsp:scriptlet>
+
<img width="16"
height="16"
src="#{icon}" />
+
<jsp:scriptlet><![CDATA[
}
]]></jsp:scriptlet>
+
</span>
<jsp:scriptlet><![CDATA[
if (((org.richfaces.component.UIMenuItem) component).isDisabled()) {
]]></jsp:scriptlet>
+
<span id="#{clientId}:disabled"
- class="#{labelClass}">
- #{value}
+ class="dr-menu-label dr-menu-label-disabled rich-menu-item-label rich-menu-item-label-disabled"
+ >
+ #{component.attributes['value']}
<f:call name="renderChildren" />
</span>
+
<jsp:scriptlet><![CDATA[
} else {
]]></jsp:scriptlet>
+
<a id="#{clientId}:anchor"
href="#"
- class="#{labelClass}">
- #{value}
+ class="dr-menu-label rich-menu-item-label">
+ #{component.attributes['value']}
<f:call name="renderChildren" />
</a>
+
<jsp:scriptlet><![CDATA[
}
- ]]></jsp:scriptlet>
+ ]]></jsp:scriptlet>
+
+ <jsp:scriptlet><![CDATA[
+ if (((org.richfaces.component.UIMenuItem) component).isDisabled()) {
+ ]]></jsp:scriptlet>
</div>
+ <jsp:scriptlet><![CDATA[
+ } else {
+ ]]></jsp:scriptlet>
+ </div>
+ <jsp:scriptlet><![CDATA[
+ }
+ ]]></jsp:scriptlet>
</f:root>
\ No newline at end of file
19 years
JBoss Rich Faces SVN: r302 - in trunk/richfaces/menu-components/src/main/java/org/richfaces: renderkit/html and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: F.antonov
Date: 2007-04-06 09:12:20 -0400 (Fri, 06 Apr 2007)
New Revision: 302
Added:
trunk/richfaces/menu-components/src/main/java/org/richfaces/component/MenuComponent.java
Modified:
trunk/richfaces/menu-components/src/main/java/org/richfaces/component/UIMenuItem.java
trunk/richfaces/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java
Log:
MenuItem component development.
Added: trunk/richfaces/menu-components/src/main/java/org/richfaces/component/MenuComponent.java
===================================================================
--- trunk/richfaces/menu-components/src/main/java/org/richfaces/component/MenuComponent.java (rev 0)
+++ trunk/richfaces/menu-components/src/main/java/org/richfaces/component/MenuComponent.java 2007-04-06 13:12:20 UTC (rev 302)
@@ -0,0 +1,44 @@
+/**
+ * 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;
+
+
+/**
+ * Interface which main menu must implements in order to menu components could works correctly.
+ * @author F. Antonov
+ *
+ */
+public interface MenuComponent {
+
+ /**
+ * Possible values for submit mode property.
+ */
+ public static final String MODE_AJAX = "ajax";
+ public static final String MODE_SERVER = "server";
+ public static final String MODE_NONE = "none";
+
+ /**
+ * Getter for submit mode property.
+ */
+ public String getMode();
+
+}
Modified: trunk/richfaces/menu-components/src/main/java/org/richfaces/component/UIMenuItem.java
===================================================================
--- trunk/richfaces/menu-components/src/main/java/org/richfaces/component/UIMenuItem.java 2007-04-06 11:56:56 UTC (rev 301)
+++ trunk/richfaces/menu-components/src/main/java/org/richfaces/component/UIMenuItem.java 2007-04-06 13:12:20 UTC (rev 302)
@@ -36,9 +36,6 @@
public static final String COMPONENT_TYPE = "org.richfaces.DropDownMenu";
- public static final String MODE_AJAX = "ajax";
- public static final String MODE_SERVER = "server";
- public static final String MODE_NONE = "none";
public abstract String getMode();
public abstract void setMode(String mode);
Modified: trunk/richfaces/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java
===================================================================
--- trunk/richfaces/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java 2007-04-06 11:56:56 UTC (rev 301)
+++ trunk/richfaces/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java 2007-04-06 13:12:20 UTC (rev 302)
@@ -33,7 +33,7 @@
import org.ajax4jsf.framework.renderer.AjaxRendererUtils;
import org.ajax4jsf.framework.renderer.ComponentVariables;
import org.ajax4jsf.framework.renderer.ComponentsVariableResolver;
-import org.ajax4jsf.framework.renderer.RendererUtils;
+import org.richfaces.component.MenuComponent;
import org.richfaces.component.UIMenuItem;
import org.richfaces.component.util.ViewUtil;
import org.richfaces.renderkit.CompositeRenderer;
@@ -43,7 +43,6 @@
public class MenuItemRendererBase extends CompositeRenderer {
-// private static RendererUtils rendererUtils = new RendererUtils();
protected Class getComponentClass() {
return UIMenuItem.class;
@@ -70,7 +69,7 @@
// taken from forId attribute
String mode = menuItem.getMode();
- if (!UIMenuItem.MODE_NONE.equalsIgnoreCase(mode)) {
+ if (!MenuComponent.MODE_NONE.equalsIgnoreCase(mode)) {
ActionEvent actionEvent = new ActionEvent(menuItem);
if (menuItem.isImmediate()) {
@@ -95,60 +94,18 @@
variables.setVariable("icon", resource);
if (menuItem.isDisabled()) {
- resource = "dr-menu-item dr-menu-item-disabled rich-menu-item rich-menu-item-disabled "
- + getStringAttributeOrEmptyString(menuItem, "styleClass");
- variables.setVariable("class", resource);
-
- resource = "dr-menu-icon dr-menu-icon-disabled rich-menu-item-icon rich-menu-item-icon-disabled "
- + getStringAttributeOrEmptyString(menuItem, "iconClass");
- variables.setVariable("iconClass", resource);
-
- resource = "dr-menu-label dr-menu-label-disabled rich-menu-item-label rich-menu-item-label-disabled";
- variables.setVariable("labelClass", resource);
-
- variables.setVariable("onclick", "Event.stop(event || window.event);");
-
+ variables.setVariable("iconDisabledClasses", "dr-menu-icon-disabled rich-menu-item-icon-disabled");
} else {
- StringBuffer scriptValue = new StringBuffer();
- scriptValue.append("this.className='dr-menu-item dr-menu-item-enabled rich-menu-item rich-menu-item-enabled ")
- .append(getStringAttributeOrEmptyString(menuItem, "styleClass") + "'; ");
- processInlineStyles(context, menuItem, scriptValue, false);
- scriptValue.append("document.getElementById('" + menuItem.getClientId(context) + ":icon').className='dr-menu-icon rich-menu-item-icon ")
- .append(getStringAttributeOrEmptyString(menuItem, "iconClass") + "'; ");
- scriptValue.append("document.getElementById('" + menuItem.getClientId(context) + ":anchor').className='dr-menu-label rich-menu-item-label'; ")
- .append(getStringAttributeOrEmptyString(menuItem, "onmouseout"));
- variables.setVariable("onmouseout", scriptValue);
+ variables.setVariable("onmouseoutInlineStyles", processInlineStyles(context, menuItem, false));
+ variables.setVariable("onmouseoverInlineStyles", processInlineStyles(context, menuItem, true));
- scriptValue = new StringBuffer();
- scriptValue.append("this.className='dr-menu-item dr-menu-item-hover rich-menu-item rich-menu-item-hover ")
- .append(getStringAttributeOrEmptyString(menuItem, "styleClass") + " ")
- .append(getStringAttributeOrEmptyString(menuItem, "selectClass") + "'; ");
- processInlineStyles(context, menuItem, scriptValue, true);
- scriptValue.append("document.getElementById('" + menuItem.getClientId(context) + ":icon').className='dr-menu-icon dr-menu-icon-selected rich-menu-item-icon rich-menu-item-icon-selected ")
- .append(getStringAttributeOrEmptyString(menuItem, "iconClass") + "'; ");
- scriptValue.append("document.getElementById('" + menuItem.getClientId(context) + ":anchor').className='dr-menu-label dr-menu-label-selected rich-menu-item-label rich-menu-item-label-selected'; ")
- .append(getStringAttributeOrEmptyString(menuItem, "onmouseout"));
- variables.setVariable("onmouseover", scriptValue);
-
- resource = "dr-menu-item dr-menu-item-enabled rich-menu-item rich-menu-item-enabled "
- + getStringAttributeOrEmptyString(menuItem, "styleClass");
- variables.setVariable("class", resource);
-
- resource = "dr-menu-icon rich-menu-item-icon "
- + getStringAttributeOrEmptyString(menuItem, "iconClass");
- variables.setVariable("iconClass", resource);
-
- resource = "dr-menu-label rich-menu-item-label";
- variables.setVariable("labelClass", resource);
-
- scriptValue = new StringBuffer();
- scriptValue.append(getStringAttributeOrEmptyString(menuItem, "onselect"));
+ StringBuffer scriptValue = new StringBuffer();
String mode = resolveSubmitMode(menuItem);
- if (mode.equalsIgnoreCase(UIMenuItem.MODE_AJAX)) {
+ if (mode.equalsIgnoreCase(MenuComponent.MODE_AJAX)) {
scriptValue.append(AjaxRendererUtils.buildOnClick(menuItem, context).toString());
//scriptValue.append("; Exadel.Menu.Layers.shutdown();return false;");
- } else if (mode.equalsIgnoreCase(UIMenuItem.MODE_SERVER)) {
+ } else if (mode.equalsIgnoreCase(MenuComponent.MODE_SERVER)) {
CommandScriptBuilder builder = new CommandScriptBuilder(menuItem);
builder.setCheckActionAndListener(true);
Object target = menuItem.getAttributes().get("target");
@@ -162,14 +119,13 @@
builder.addParameter(id + ":hidden", id);
scriptValue.append(builder.toString());
} else {
- scriptValue.append("; " + getStringAttributeOrEmptyString(menuItem, "onclick"));
+ scriptValue.append(getStringAttributeOrEmptyString(menuItem, "onclick"));
}
if (resource.length() > 0) {
variables.setVariable("onclick", scriptValue.toString());
}
}
- variables.setVariable("value", getStringAttributeOrEmptyString(menuItem, "value"));
}
protected String getStringAttributeOrEmptyString(UIComponent component, String attributeName) {
@@ -199,23 +155,24 @@
}
UIComponent parent = menuItem.getParent();
while (null != parent) {
- submitMode = (String) parent.getAttributes().get("mode");
- if (null != submitMode) {
- return submitMode;
+ if (parent instanceof MenuComponent) {
+ return ((MenuComponent) parent).getMode();
}
parent = parent.getParent();
}
- return UIMenuItem.MODE_SERVER;
+
+ return MenuComponent.MODE_SERVER;
}
- private void processInlineStyles(FacesContext context, UIMenuItem menuItem, StringBuffer buffer, boolean isOnmouseover) {
+ private String processInlineStyles(FacesContext context, UIMenuItem menuItem, boolean isOnmouseover) {
+ StringBuffer buffer = new StringBuffer();
Object style = menuItem.getAttributes().get("style");
Object selectStyle = menuItem.getAttributes().get("selectStyle");
if (null == selectStyle) {
- return;
+ return "";
}
- buffer.append("document.getElementById('" + menuItem.getClientId(context) + "').style.cssText='");
+ buffer.append("$('" + menuItem.getClientId(context) + "').style.cssText='");
if (null != style) {
buffer.append(style.toString() + "; ");
}
@@ -224,6 +181,7 @@
} else {
buffer.append("';");
}
+ return buffer.toString();
}
}
19 years
JBoss Rich Faces SVN: r301 - trunk/richfaces/datascroller/src/test/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: A.Skokov
Date: 2007-04-06 07:56:56 -0400 (Fri, 06 Apr 2007)
New Revision: 301
Modified:
trunk/richfaces/datascroller/src/test/java/org/richfaces/component/DatascrollerComponentTest.java
Log:
test updated
Modified: trunk/richfaces/datascroller/src/test/java/org/richfaces/component/DatascrollerComponentTest.java
===================================================================
--- trunk/richfaces/datascroller/src/test/java/org/richfaces/component/DatascrollerComponentTest.java 2007-04-06 11:15:12 UTC (rev 300)
+++ trunk/richfaces/datascroller/src/test/java/org/richfaces/component/DatascrollerComponentTest.java 2007-04-06 11:56:56 UTC (rev 301)
@@ -29,6 +29,7 @@
import javax.faces.component.UIComponent;
import javax.faces.component.UIData;
+import javax.faces.component.UIOutput;
import javax.faces.component.html.HtmlDataTable;
import javax.faces.component.html.HtmlForm;
import java.util.HashSet;
@@ -50,6 +51,12 @@
private UIDatascroller scroller;
private UIComponent form;
private UIData data;
+ private UIOutput first;
+ private UIOutput fastrewind;
+ private UIOutput previous;
+ private UIOutput fastforward;
+ private UIOutput next;
+ private UIOutput last;
/**
* Create the test case
@@ -79,6 +86,32 @@
scroller.setId("dataScroller");
scroller.setFor(data.getId());
+ first = (UIOutput) application.createComponent(UIOutput.COMPONENT_TYPE);
+ first.setId("first");
+ first.setValue("first");
+ fastrewind = (UIOutput) application.createComponent(UIOutput.COMPONENT_TYPE);
+ fastrewind.setId("fastrewind");
+ fastrewind.setValue("fastrewind");
+ previous = (UIOutput) application.createComponent(UIOutput.COMPONENT_TYPE);
+ previous.setId("previous");
+ previous.setValue("previous");
+ fastforward = (UIOutput) application.createComponent(UIOutput.COMPONENT_TYPE);
+ fastforward.setId("fastforward");
+ fastforward.setValue("fastforward");
+ next = (UIOutput) application.createComponent(UIOutput.COMPONENT_TYPE);
+ next.setId("next");
+ next.setValue("next");
+ last = (UIOutput) application.createComponent(UIOutput.COMPONENT_TYPE);
+ last.setId("last");
+ last.setValue("last");
+
+ scroller.getFacets().put(first.getId(), first);
+ scroller.getFacets().put(fastrewind.getId(), fastrewind);
+ scroller.getFacets().put(previous.getId(), previous);
+ scroller.getFacets().put(fastforward.getId(), fastforward);
+ scroller.getFacets().put(next.getId(), next);
+ scroller.getFacets().put(last.getId(), last);
+
form.getChildren().add(scroller);
}
@@ -90,6 +123,12 @@
scroller = null;
form = null;
data = null;
+ first = null;
+ fastrewind = null;
+ previous = null;
+ fastforward = null;
+ next = null;
+ last = null;
}
/**
@@ -106,6 +145,19 @@
assertNotNull(div);
assertEquals("div", div.getNodeName());
+ HtmlElement f1 = page.getHtmlElementById(first.getClientId(facesContext));
+ assertNotNull(f1);
+ HtmlElement f2 = page.getHtmlElementById(last.getClientId(facesContext));
+ assertNotNull(f2);
+ HtmlElement f3 = page.getHtmlElementById(fastforward.getClientId(facesContext));
+ assertNotNull(f3);
+ HtmlElement f4 = page.getHtmlElementById(fastrewind.getClientId(facesContext));
+ assertNotNull(f4);
+ HtmlElement f5 = page.getHtmlElementById(next.getClientId(facesContext));
+ assertNotNull(f5);
+ HtmlElement f6 = page.getHtmlElementById(previous.getClientId(facesContext));
+ assertNotNull(f6);
+
String classAttr = div.getAttributeValue("class");
assertTrue(classAttr.contains("dr-dscr"));
assertTrue(classAttr.contains("rich-datascr"));
19 years
JBoss Rich Faces SVN: r300 - trunk/richfaces/tabPanel/src/main/templates.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-04-06 07:15:12 -0400 (Fri, 06 Apr 2007)
New Revision: 300
Modified:
trunk/richfaces/tabPanel/src/main/templates/tabPanel.jspx
Log:
http://jira.jboss.com/jira/browse/RF-78 fixed. Missing "name" attribute restored
Modified: trunk/richfaces/tabPanel/src/main/templates/tabPanel.jspx
===================================================================
--- trunk/richfaces/tabPanel/src/main/templates/tabPanel.jspx 2007-04-06 08:43:14 UTC (rev 299)
+++ trunk/richfaces/tabPanel/src/main/templates/tabPanel.jspx 2007-04-06 11:15:12 UTC (rev 300)
@@ -36,21 +36,26 @@
<td align="#{component.headerAlignment}"><f:call
name="utils.encodeBeginFormIfNessesary" />
- <table border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td><img src="#{spacer}" width="2" height="1" alt=""
- border="0" /></td>
- <f:call name="encodeTabs" />
- <td><img src="#{spacer}" width="1" height="1" alt=""
- border="0" /></td>
- </tr>
- </table>
- <c:if test="#{clientSide}">
- <div style="display: none;"><input type="hidden"
- id="#{clientId}_input"
- value="#{this:getValueAsString(context, component)}" /> <f:call
- name="encodeTabsScript" /></div>
- </c:if> <f:call name="utils.encodeEndFormIfNessesary" /></td>
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><img src="#{spacer}" width="2" height="1" alt=""
+ border="0" /></td>
+ <f:call name="encodeTabs" />
+ <td><img src="#{spacer}" width="1" height="1" alt=""
+ border="0" /></td>
+ </tr>
+ </table>
+ <c:if test="#{clientSide}">
+ <div style="display: none;">
+ <input type="hidden"
+ id="#{clientId}_input"
+ name="#{clientId}"
+ value="#{this:getValueAsString(context, component)}" />
+ <f:call name="encodeTabsScript" />
+ </div>
+ </c:if>
+ <f:call name="utils.encodeEndFormIfNessesary" />
+ </td>
</tr>
<tr>
<vcp:body>
19 years
JBoss Rich Faces SVN: r299 - trunk/richfaces/toolBar/src/test/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: A.Skokov
Date: 2007-04-06 04:43:14 -0400 (Fri, 06 Apr 2007)
New Revision: 299
Modified:
trunk/richfaces/toolBar/src/test/java/org/richfaces/component/ToolBarComponentTest.java
Log:
test updated
Modified: trunk/richfaces/toolBar/src/test/java/org/richfaces/component/ToolBarComponentTest.java
===================================================================
--- trunk/richfaces/toolBar/src/test/java/org/richfaces/component/ToolBarComponentTest.java 2007-04-06 08:42:42 UTC (rev 298)
+++ trunk/richfaces/toolBar/src/test/java/org/richfaces/component/ToolBarComponentTest.java 2007-04-06 08:43:14 UTC (rev 299)
@@ -25,7 +25,6 @@
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import junit.framework.Assert;
import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-import org.richfaces.component.html.HtmlToolBar;
import org.richfaces.component.html.HtmlToolBarGroup;
import javax.faces.component.UIForm;
@@ -38,8 +37,8 @@
*/
public class ToolBarComponentTest extends AbstractAjax4JsfTestCase {
- private HtmlToolBar toolBar;
- private HtmlToolBarGroup toolBarGroup;
+ private UIToolBar toolBar;
+ private UIToolBarGroup toolBarGroup;
private HtmlCommandButton button1;
private HtmlCommandButton button2;
private UIForm form;
@@ -63,7 +62,7 @@
form.setId("form");
facesContext.getViewRoot().getChildren().add(form);
- toolBar = (HtmlToolBar)application.createComponent(HtmlToolBar.COMPONENT_TYPE);
+ toolBar = (UIToolBar)application.createComponent("org.richfaces.ToolBar");
toolBar.setId("toolBar");
form.getChildren().add(toolBar);
@@ -71,7 +70,7 @@
button1.setValue("Change 1");
toolBar.getChildren().add(button1);
- toolBarGroup = (HtmlToolBarGroup)application.createComponent(HtmlToolBarGroup.COMPONENT_TYPE);
+ toolBarGroup = (HtmlToolBarGroup)application.createComponent("org.richfaces.ToolBarGroup");
button2 = (HtmlCommandButton)application.createComponent(HtmlCommandButton.COMPONENT_TYPE);
button2.setValue("Change 2");
toolBarGroup.getChildren().add(button2);
@@ -90,33 +89,22 @@
}
/**
- * Test component default values
- *
- * @throws Exception
- */
- public void testDefaultValues() throws Exception {
- Assert.assertEquals("100%", toolBar.getWidth());
- Assert.assertEquals("none", toolBar.getItemSeparator());
- Assert.assertEquals("none", toolBarGroup.getItemSeparator());
- Assert.assertEquals("left", toolBarGroup.getLocation());
- }
- /**
* Test component rendering
*
* @throws Exception
*/
public void testRender() throws Exception {
HtmlPage page = renderView();
- Assert.assertNotNull(page);
+ assertNotNull(page);
System.out.println(page.asXml());
HtmlElement table = page.getHtmlElementById(form.getId() + ":" + toolBar.getId());
- Assert.assertNotNull(table);
- Assert.assertEquals("table", table.getNodeName());
+ assertNotNull(table);
+ assertEquals("table", table.getNodeName());
String classAttr = table.getAttributeValue("class");
- Assert.assertTrue(classAttr.contains("dr-toolbar-ext"));
- Assert.assertTrue(classAttr.contains("rich-toolbar"));
+ assertTrue(classAttr.contains("dr-toolbar-ext"));
+ assertTrue(classAttr.contains("rich-toolbar"));
}
/**
@@ -128,8 +116,8 @@
HtmlPage page = renderView();
Assert.assertNotNull(page);
List links = page.getDocumentElement().getHtmlElementsByTagName("link");
- Assert.assertEquals(1, links.size());
+ assertEquals(1, links.size());
HtmlElement link = (HtmlElement) links.get(0);
- Assert.assertTrue(link.getAttributeValue("href").contains("org/richfaces/renderkit/html/css/toolBar.xcss"));
+ assertTrue(link.getAttributeValue("href").contains("org/richfaces/renderkit/html/css/toolBar.xcss"));
}
}
19 years