JBoss Rich Faces SVN: r20637 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordion.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-12-17 05:52:54 -0500 (Fri, 17 Dec 2010)
New Revision: 20637
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordion/TestRichAccordion.java
Log:
* added issue tracking information
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordion/TestRichAccordion.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordion/TestRichAccordion.java 2010-12-17 09:48:55 UTC (rev 20636)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordion/TestRichAccordion.java 2010-12-17 10:52:54 UTC (rev 20637)
@@ -40,8 +40,8 @@
import org.jboss.test.selenium.locator.Attribute;
import org.jboss.test.selenium.locator.AttributeLocator;
import org.jboss.test.selenium.locator.JQueryLocator;
-import org.jboss.test.selenium.waiting.conditions.IsDisplayed;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
import org.testng.annotations.Test;
/**
@@ -121,6 +121,7 @@
}
@Test
+ @IssueTracking("https://issues.jboss.org/browse/RF-10040")
public void testSwitchTypeServer() {
JQueryLocator selectOption = pjq("input[type=radio][id$=switchTypeInput:3]");
selenium.click(selectOption);
14 years
JBoss Rich Faces SVN: r20636 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jJSFunction.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-12-17 04:48:55 -0500 (Fri, 17 Dec 2010)
New Revision: 20636
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jJSFunction/TestJSFunctionSimple.java
Log:
* added issue tracking information to testLimitRender
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jJSFunction/TestJSFunctionSimple.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jJSFunction/TestJSFunctionSimple.java 2010-12-17 09:23:12 UTC (rev 20635)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jJSFunction/TestJSFunctionSimple.java 2010-12-17 09:48:55 UTC (rev 20636)
@@ -35,6 +35,7 @@
import org.jboss.test.selenium.encapsulated.JavaScript;
import org.jboss.test.selenium.locator.JQueryLocator;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
import org.testng.annotations.Test;
/**
@@ -156,6 +157,7 @@
}
@Test
+ @IssueTracking("https://issues.jboss.org/browse/RF-10011")
public void testLimitRender() {
// set limitRender=true
JQueryLocator limitRenderInput = pjq("input[type=radio][name$=limitRenderInput][value=true]");
14 years
JBoss Rich Faces SVN: r20635 - in modules/tests/metamer/trunk/application/src/main: webapp/components/richDragIndicator and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-12-17 04:23:12 -0500 (Fri, 17 Dec 2010)
New Revision: 20635
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDragBehaviorBean.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDragIndicatorBean.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDropBehaviorBean.java
modules/tests/metamer/trunk/application/src/main/webapp/components/richDragIndicator/list.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richDropBehavior/list.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richDropBehavior/simple.xhtml
Log:
d-n-d: fixed compilation errors (caused by project changes) and fixed one dropBehavior sample (RF-9769)
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDragBehaviorBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDragBehaviorBean.java 2010-12-17 08:51:42 UTC (rev 20634)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDragBehaviorBean.java 2010-12-17 09:23:12 UTC (rev 20635)
@@ -58,7 +58,7 @@
logger = LoggerFactory.getLogger(getClass());
logger.debug("initializing bean " + getClass().getName());
- attributes = Attributes.getBehaviorAttributes(DragBehavior.class, getClass());
+ attributes = Attributes.getBehaviorAttributesFromClass(DragBehavior.class, getClass());
attributes.setAttribute("event", "mouseover");
attributes.setAttribute("type", "drg1");
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDragIndicatorBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDragIndicatorBean.java 2010-12-17 08:51:42 UTC (rev 20634)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDragIndicatorBean.java 2010-12-17 09:23:12 UTC (rev 20635)
@@ -52,7 +52,7 @@
logger = LoggerFactory.getLogger(getClass());
logger.debug("initializing bean " + getClass().getName());
- attributes = Attributes.getUIComponentAttributes(UIDragIndicator.class, getClass(), true);
+ attributes = Attributes.getComponentAttributesFromFacesConfig(UIDragIndicator.class, getClass());
attributes.setAttribute("rendered", true);
}
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDropBehaviorBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDropBehaviorBean.java 2010-12-17 08:51:42 UTC (rev 20634)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDropBehaviorBean.java 2010-12-17 09:23:12 UTC (rev 20635)
@@ -64,7 +64,7 @@
logger = LoggerFactory.getLogger(getClass());
logger.debug("initializing bean " + getClass().getName());
- attributes = Attributes.getBehaviorAttributes(DropBehavior.class, getClass());
+ attributes = Attributes.getBehaviorAttributesFromClass(DropBehavior.class, getClass());
attributes.setAttribute("event", "mouseover");
attributes.setAttribute("acceptedTypes", "drg1, drg2");
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richDragIndicator/list.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richDragIndicator/list.xhtml 2010-12-17 08:51:42 UTC (rev 20634)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richDragIndicator/list.xhtml 2010-12-17 09:23:12 UTC (rev 20635)
@@ -27,7 +27,7 @@
<ui:composition template="/templates/list.xhtml">
- <ui:define name="pageTitle">Rich Drag Behavior</ui:define>
+ <ui:define name="pageTitle">Rich Drag Indicator</ui:define>
<ui:define name="links">
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richDropBehavior/list.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richDropBehavior/list.xhtml 2010-12-17 08:51:42 UTC (rev 20634)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richDropBehavior/list.xhtml 2010-12-17 09:23:12 UTC (rev 20635)
@@ -27,7 +27,7 @@
<ui:composition template="/templates/list.xhtml">
- <ui:define name="pageTitle">Rich Drag Behavior</ui:define>
+ <ui:define name="pageTitle">Rich Drop Behavior</ui:define>
<ui:define name="links">
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richDropBehavior/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richDropBehavior/simple.xhtml 2010-12-17 08:51:42 UTC (rev 20634)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richDropBehavior/simple.xhtml 2010-12-17 09:23:12 UTC (rev 20635)
@@ -112,8 +112,14 @@
<h:outputLabel value="Drop Event:" rendered="#{not empty richDropListenerBean.dropEvent}" />
<h:panelGroup rendered="#{not empty richDropListenerBean.dropEvent}">
<h:panelGrid columns="2">
- <h:outputLabel value="Value:" />
- <h:outputText value="#{richDropListenerBean.dropEvent.dragBehavior.dragValue}" />
+ <h:outputLabel value="clientId:" />
+ <h:outputText value="#{richDropListenerBean.dropEvent.component.clientId}" />
+
+ <h:outputLabel value="Drag Value:" />
+ <h:outputText value="#{richDropListenerBean.dropEvent.dragValue}" />
+
+ <h:outputLabel value="Drop Value:" />
+ <h:outputText value="#{richDropListenerBean.dropEvent.dropValue}" />
</h:panelGrid>
</h:panelGroup>
</h:panelGrid>
14 years
JBoss Rich Faces SVN: r20634 - in modules/tests/metamer/trunk/application/src/main: java/org/richfaces/tests/metamer/model and 6 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-12-17 03:51:42 -0500 (Fri, 17 Dec 2010)
New Revision: 20634
Added:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDragBehaviorBean.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDragIndicatorBean.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDropBehaviorBean.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDropListenerBean.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/model/drag/
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/model/drag/DragValue.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/model/drag/DropValue.java
modules/tests/metamer/trunk/application/src/main/webapp/components/richDragBehavior/
modules/tests/metamer/trunk/application/src/main/webapp/components/richDragBehavior/list.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richDragBehavior/simple.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richDragIndicator/
modules/tests/metamer/trunk/application/src/main/webapp/components/richDragIndicator/list.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richDragIndicator/simple.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richDropBehavior/
modules/tests/metamer/trunk/application/src/main/webapp/components/richDropBehavior/list.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richDropBehavior/simple.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/resources/css/richDragBehavior.css
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java
Log:
drag-and-drop - added basic sample (RF-9769)
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java 2010-12-17 07:18:43 UTC (rev 20633)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java 2010-12-17 08:51:42 UTC (rev 20634)
@@ -128,6 +128,9 @@
components.put("richDataGrid", "Rich Data Grid");
components.put("richDataScroller", "Rich Data Scroller");
components.put("richDataTable", "Rich Data Table");
+ components.put("richDragBehavior", "Rich Drag Behavior");
+ components.put("richDragIndicator", "Rich Drag Indicator");
+ components.put("richDropBehavior", "Rich Drop Behavior");
components.put("richDropDownMenu", "Rich Drop Down Menu");
components.put("richExtendedDataTable", "Rich Extended Data Table");
components.put("richFileUpload", "Rich File Upload");
Added: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDragBehaviorBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDragBehaviorBean.java (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDragBehaviorBean.java 2010-12-17 08:51:42 UTC (rev 20634)
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.bean;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.PostConstruct;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ViewScoped;
+
+import org.richfaces.component.behavior.DragBehavior;
+import org.richfaces.tests.metamer.Attributes;
+import org.richfaces.tests.metamer.model.drag.DragValue;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+@ManagedBean(name = "richDragBehaviorBean")
+@ViewScoped
+public class RichDragBehaviorBean implements Serializable {
+
+ private static final int DRAG_VALUES = 3;
+ private static final long serialVersionUID = 4008175400649809L;
+ private static Logger logger;
+ private Attributes attributes;
+
+ private List<DragValue> dragValues = new ArrayList<DragValue>();
+
+ /**
+ * Initializes the managed bean.
+ */
+ @PostConstruct
+ public void init() {
+ logger = LoggerFactory.getLogger(getClass());
+ logger.debug("initializing bean " + getClass().getName());
+
+ attributes = Attributes.getBehaviorAttributes(DragBehavior.class, getClass());
+
+ attributes.setAttribute("event", "mouseover");
+ attributes.setAttribute("type", "drg1");
+
+ for (int i = 0; i < DRAG_VALUES; i++) {
+ dragValues.add(new DragValue(i + 1));
+ }
+ }
+
+ public Attributes getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(Attributes attributes) {
+ this.attributes = attributes;
+ }
+
+ public List<DragValue> getDragValues() {
+ return dragValues;
+ }
+
+ public void setDragValues(List<DragValue> dragValues) {
+ this.dragValues = dragValues;
+ }
+}
Added: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDragIndicatorBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDragIndicatorBean.java (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDragIndicatorBean.java 2010-12-17 08:51:42 UTC (rev 20634)
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.bean;
+
+import java.io.Serializable;
+
+import javax.annotation.PostConstruct;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ViewScoped;
+
+import org.richfaces.component.UIDragIndicator;
+import org.richfaces.tests.metamer.Attributes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+@ManagedBean(name = "richDragIndicatorBean")
+@ViewScoped
+public class RichDragIndicatorBean implements Serializable {
+
+ private static final long serialVersionUID = 4008175400649809L;
+ private static Logger logger;
+ private Attributes attributes;
+
+ /**
+ * Initializes the managed bean.
+ */
+ @PostConstruct
+ public void init() {
+ logger = LoggerFactory.getLogger(getClass());
+ logger.debug("initializing bean " + getClass().getName());
+
+ attributes = Attributes.getUIComponentAttributes(UIDragIndicator.class, getClass(), true);
+ attributes.setAttribute("rendered", true);
+ }
+
+ public Attributes getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(Attributes attributes) {
+ this.attributes = attributes;
+ }
+}
Added: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDropBehaviorBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDropBehaviorBean.java (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDropBehaviorBean.java 2010-12-17 08:51:42 UTC (rev 20634)
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.bean;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.annotation.PostConstruct;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ViewScoped;
+
+import org.richfaces.component.behavior.DropBehavior;
+import org.richfaces.tests.metamer.Attributes;
+import org.richfaces.tests.metamer.model.drag.DragValue;
+import org.richfaces.tests.metamer.model.drag.DropValue;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+@ManagedBean(name = "richDropBehaviorBean")
+@ViewScoped
+public class RichDropBehaviorBean implements Serializable {
+
+ private static final long serialVersionUID = 4008175400649809L;
+ private static Logger logger;
+ private Attributes attributes;
+
+ private Map<DropValue, DragValue> droppedValues = new LinkedHashMap<DropValue, DragValue>();
+ private DropValue dropValue;
+ private int dropValueCounter = 1;
+
+ /**
+ * Initializes the managed bean.
+ */
+ @PostConstruct
+ public void init() {
+ logger = LoggerFactory.getLogger(getClass());
+ logger.debug("initializing bean " + getClass().getName());
+
+ attributes = Attributes.getBehaviorAttributes(DropBehavior.class, getClass());
+
+ attributes.setAttribute("event", "mouseover");
+ attributes.setAttribute("acceptedTypes", "drg1, drg2");
+ attributes.setAttribute("render", "droppedValues");
+
+ increaseDropValue();
+ }
+
+ public Attributes getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(Attributes attributes) {
+ this.attributes = attributes;
+ }
+
+ public Map<DropValue, DragValue> getDroppedValues() {
+ return droppedValues;
+ }
+
+ public void increaseDropValue() {
+ dropValue = new DropValue(dropValueCounter++);
+ }
+
+ public DropValue getDropValue() {
+ return dropValue;
+ }
+
+ public List<Entry<DropValue, DragValue>> getDroppedEntries() {
+ List<Entry<DropValue, DragValue>> list = new LinkedList<Entry<DropValue, DragValue>>(droppedValues.entrySet());
+ Collections.reverse(list);
+ return list;
+ }
+}
Added: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDropListenerBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDropListenerBean.java (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDropListenerBean.java 2010-12-17 08:51:42 UTC (rev 20634)
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.bean;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ManagedProperty;
+import javax.faces.bean.RequestScoped;
+
+import org.richfaces.event.DropEvent;
+import org.richfaces.tests.metamer.model.drag.DragValue;
+import org.richfaces.tests.metamer.model.drag.DropValue;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+@RequestScoped
+@ManagedBean(name = "richDropListenerBean")
+public class RichDropListenerBean {
+
+ private DropEvent dropEvent;
+
+ @ManagedProperty("#{richDropBehaviorBean}")
+ private RichDropBehaviorBean richDropBehaviorBean;
+
+ public void processDragging(DropEvent dropEvent) {
+ DragValue dragValue = (DragValue) dropEvent.getDragValue();
+ DropValue dropValue = (DropValue) dropEvent.getDropValue();
+
+ this.dropEvent = dropEvent;
+ richDropBehaviorBean.increaseDropValue();
+ richDropBehaviorBean.getDroppedValues().put(dropValue, dragValue);
+ }
+
+ public DropEvent getDropEvent() {
+ return dropEvent;
+ }
+
+ public RichDropBehaviorBean getRichDropBehaviorBean() {
+ return richDropBehaviorBean;
+ }
+
+ public void setRichDropBehaviorBean(RichDropBehaviorBean richDropBehaviorBean) {
+ this.richDropBehaviorBean = richDropBehaviorBean;
+ }
+}
Added: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/model/drag/DragValue.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/model/drag/DragValue.java (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/model/drag/DragValue.java 2010-12-17 08:51:42 UTC (rev 20634)
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.model.drag;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class DragValue {
+ int number;
+
+ public DragValue(int number) {
+ this.number = number;
+ }
+
+ @Override
+ public String toString() {
+ return "DragValue [number=" + number + "]";
+ }
+}
\ No newline at end of file
Added: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/model/drag/DropValue.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/model/drag/DropValue.java (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/model/drag/DropValue.java 2010-12-17 08:51:42 UTC (rev 20634)
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.model.drag;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class DropValue {
+ int number;
+
+ public DropValue(int number) {
+ this.number = number;
+ }
+
+ @Override
+ public String toString() {
+ return "DropValue [number=" + number + "]";
+ }
+}
Added: modules/tests/metamer/trunk/application/src/main/webapp/components/richDragBehavior/list.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richDragBehavior/list.xhtml (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richDragBehavior/list.xhtml 2010-12-17 08:51:42 UTC (rev 20634)
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:metamer="http://java.sun.com/jsf/composite/metamer">
+
+ <!--
+JBoss, Home of Professional Open Source
+Copyright 2010, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software 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 software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ -->
+
+ <ui:composition template="/templates/list.xhtml">
+
+ <ui:define name="pageTitle">Rich Drag Behavior</ui:define>
+
+ <ui:define name="links">
+
+ <metamer:testPageLink id="simple" outcome="simple" value="Simple">
+
+ </metamer:testPageLink>
+
+ </ui:define>
+
+ </ui:composition>
+
+</html>
Added: modules/tests/metamer/trunk/application/src/main/webapp/components/richDragBehavior/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richDragBehavior/simple.xhtml (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richDragBehavior/simple.xhtml 2010-12-17 08:51:42 UTC (rev 20634)
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:metamer="http://java.sun.com/jsf/composite/metamer"
+ xmlns:rich="http://richfaces.org/rich"
+ xmlns:a4j="http://richfaces.org/a4j">
+
+<!--
+JBoss, Home of Professional Open Source
+Copyright 2010, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software 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 software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ -->
+
+<ui:composition template="/templates/template.xhtml">
+ <ui:param name="componentId" value="richTree" />
+
+ <ui:define name="head">
+ <f:metadata>
+ <f:viewParam name="templates" value="#{templateBean.templates}">
+ <f:converter converterId="templatesListConverter" />
+ </f:viewParam>
+ <f:event type="preRenderView"
+ listener="#{richTreeBean.preRenderView}" />
+ </f:metadata>
+ <h:outputStylesheet library="css" name="richDragBehavior.css" />
+ </ui:define>
+
+ <ui:define name="outOfTemplateBefore">
+ </ui:define>
+
+ <ui:define name="component">
+
+ <rich:dragIndicator id="indicator" />
+
+ <table>
+ <tr>
+ <td>
+ <a4j:outputPanel id="draggable1" layout="block" styleClass="draggable">
+ <h:outputText value="#{richDragBehaviorBean.dragValues[0]}" />
+ <rich:dragBehavior event="mouseover"
+ dragValue="#{richDragBehaviorBean.dragValues[0]}"
+
+ dragIndicator="#{richDragBehaviorBean.attributes['dragIndicator'].value}"
+ type="#{richDragBehaviorBean.attributes['type'].value}" />
+ </a4j:outputPanel>
+ </td>
+ <td>
+ <a4j:outputPanel id="draggable2" layout="block" styleClass="draggable">
+ <h:outputText value="#{richDragBehaviorBean.dragValues[1]}" />
+ <rich:dragBehavior event="mouseover" type="drg2" dragIndicator="indicator" dragValue="#{richDragBehaviorBean.dragValues[1]}" />
+ </a4j:outputPanel>
+ </td>
+ <td>
+ <a4j:outputPanel id="draggable3" layout="block" styleClass="draggable">
+ <h:outputText value="#{richDragBehaviorBean.dragValues[2]}" />
+ <rich:dragBehavior event="mouseover" type="drg3" dragIndicator="indicator" dragValue="#{richDragBehaviorBean.dragValues[2]}" />
+ </a4j:outputPanel>
+ </td>
+ </tr>
+ </table>
+
+ <a4j:outputPanel id="droppable" layout="block" styleClass="droppable">
+ <rich:dropBehavior event="mouseover"
+ dropValue="#{richDropBehaviorBean.dropValue}"
+ listener="#{richDropListenerBean.processDragging}"
+ acceptedTypes="drg1, drg2"
+ render="droppedValues"
+ />
+
+ <h:dataTable id="droppedValues" var="droppedValue" value="#{richDropBehaviorBean.droppedEntries}">
+ <h:column>
+ <h:outputText value="#{droppedValue.key}" />
+ </h:column>
+ <h:column>
+ <h:outputText value="#{droppedValue.value}" />
+ </h:column>
+ </h:dataTable>
+ </a4j:outputPanel>
+
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ <a4j:outputPanel ajaxRendered="true">
+ <h:panelGrid columns="2">
+ <h:outputLabel value="Drop Event:" rendered="#{not empty richDropListenerBean.dropEvent}" />
+ <h:panelGroup rendered="#{not empty richDropListenerBean.dropEvent}">
+ <h:panelGrid columns="2">
+ <h:outputLabel value="clientId:" />
+ <h:outputText value="#{richDropListenerBean.dropEvent.component.clientId}" />
+
+ <h:outputLabel value="Drag Value:" />
+ <h:outputText value="#{richDropListenerBean.dropEvent.dragValue}" />
+
+ <h:outputLabel value="Drop Value:" />
+ <h:outputText value="#{richDropListenerBean.dropEvent.dropValue}" />
+ </h:panelGrid>
+ </h:panelGroup>
+ </h:panelGrid>
+ </a4j:outputPanel>
+
+ <metamer:attributes value="#{richDragBehaviorBean.attributes}" id="attributes" />
+ </ui:define>
+
+</ui:composition>
+</html>
\ No newline at end of file
Added: modules/tests/metamer/trunk/application/src/main/webapp/components/richDragIndicator/list.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richDragIndicator/list.xhtml (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richDragIndicator/list.xhtml 2010-12-17 08:51:42 UTC (rev 20634)
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:metamer="http://java.sun.com/jsf/composite/metamer">
+
+ <!--
+JBoss, Home of Professional Open Source
+Copyright 2010, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software 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 software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ -->
+
+ <ui:composition template="/templates/list.xhtml">
+
+ <ui:define name="pageTitle">Rich Drag Behavior</ui:define>
+
+ <ui:define name="links">
+
+ <metamer:testPageLink id="simple" outcome="simple" value="Simple">
+
+ </metamer:testPageLink>
+
+ </ui:define>
+
+ </ui:composition>
+
+</html>
Added: modules/tests/metamer/trunk/application/src/main/webapp/components/richDragIndicator/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richDragIndicator/simple.xhtml (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richDragIndicator/simple.xhtml 2010-12-17 08:51:42 UTC (rev 20634)
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:metamer="http://java.sun.com/jsf/composite/metamer"
+ xmlns:rich="http://richfaces.org/rich"
+ xmlns:a4j="http://richfaces.org/a4j">
+
+<!--
+JBoss, Home of Professional Open Source
+Copyright 2010, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software 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 software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ -->
+
+<ui:composition template="/templates/template.xhtml">
+ <ui:param name="componentId" value="richTree" />
+
+ <ui:define name="head">
+ <f:metadata>
+ <f:viewParam name="templates" value="#{templateBean.templates}">
+ <f:converter converterId="templatesListConverter" />
+ </f:viewParam>
+ <f:event type="preRenderView"
+ listener="#{richTreeBean.preRenderView}" />
+ </f:metadata>
+ <h:outputStylesheet library="css" name="richDragBehavior.css" />
+ </ui:define>
+
+ <ui:define name="outOfTemplateBefore">
+ </ui:define>
+
+ <ui:define name="component">
+
+ <rich:dragIndicator id="indicator"
+ acceptClass="#{richDragIndicatorBean.attributes['acceptClass'].value}"
+ draggingClass="#{richDragIndicatorBean.attributes['draggingClass'].value}"
+ rejectClass="#{richDragIndicatorBean.attributes['rejectClass'].value}"
+ rendered="#{richDragIndicatorBean.attributes['rendered'].value}"
+ />
+
+ <table>
+ <tr>
+ <td>
+ <a4j:outputPanel id="draggable1" layout="block" styleClass="draggable">
+ <h:outputText value="#{richDragBehaviorBean.dragValues[0]}" />
+ <rich:dragBehavior event="mouseover"
+ dragValue="#{richDragBehaviorBean.dragValues[0]}"
+ type="drg1" />
+ </a4j:outputPanel>
+ </td>
+ <td>
+ <a4j:outputPanel id="draggable2" layout="block" styleClass="draggable">
+ <h:outputText value="#{richDragBehaviorBean.dragValues[1]}" />
+ <rich:dragBehavior event="mouseover" type="drg2" dragIndicator="indicator" dragValue="#{richDragBehaviorBean.dragValues[1]}" />
+ </a4j:outputPanel>
+ </td>
+ <td>
+ <a4j:outputPanel id="draggable3" layout="block" styleClass="draggable">
+ <h:outputText value="#{richDragBehaviorBean.dragValues[2]}" />
+ <rich:dragBehavior event="mouseover" type="drg3" dragIndicator="indicator" dragValue="#{richDragBehaviorBean.dragValues[2]}" />
+ </a4j:outputPanel>
+ </td>
+ </tr>
+ </table>
+
+ <a4j:outputPanel id="droppable" layout="block" styleClass="droppable">
+ <rich:dropBehavior event="mouseover"
+ dropValue="#{richDropBehaviorBean.dropValue}"
+ listener="#{richDropListenerBean.processDragging}"
+ acceptedTypes="drg1, drg2"
+ render="droppedValues"
+ />
+
+ <h:dataTable id="droppedValues" var="droppedValue" value="#{richDropBehaviorBean.droppedEntries}">
+ <h:column>
+ <h:outputText value="#{droppedValue}" />
+ </h:column>
+ </h:dataTable>
+ </a4j:outputPanel>
+
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ <a4j:outputPanel ajaxRendered="true">
+ <h:panelGrid columns="2">
+ <h:outputLabel value="Drop Event:" rendered="#{not empty richDropListenerBean.dropEvent}" />
+ <h:panelGroup rendered="#{not empty richDropListenerBean.dropEvent}">
+ <h:panelGrid columns="2">
+ <h:outputLabel value="clientId:" />
+ <h:outputText value="#{richDropListenerBean.dropEvent.component.clientId}" />
+
+ <h:outputLabel value="Drag Value:" />
+ <h:outputText value="#{richDropListenerBean.dropEvent.dragValue}" />
+
+ <h:outputLabel value="Drop Value:" />
+ <h:outputText value="#{richDropListenerBean.dropEvent.dropValue}" />
+ </h:panelGrid>
+ </h:panelGroup>
+ </h:panelGrid>
+ </a4j:outputPanel>
+
+ <metamer:attributes value="#{richDragIndicatorBean.attributes}" id="attributes" />
+ </ui:define>
+
+</ui:composition>
+</html>
\ No newline at end of file
Added: modules/tests/metamer/trunk/application/src/main/webapp/components/richDropBehavior/list.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richDropBehavior/list.xhtml (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richDropBehavior/list.xhtml 2010-12-17 08:51:42 UTC (rev 20634)
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:metamer="http://java.sun.com/jsf/composite/metamer">
+
+ <!--
+JBoss, Home of Professional Open Source
+Copyright 2010, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software 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 software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ -->
+
+ <ui:composition template="/templates/list.xhtml">
+
+ <ui:define name="pageTitle">Rich Drag Behavior</ui:define>
+
+ <ui:define name="links">
+
+ <metamer:testPageLink id="simple" outcome="simple" value="Simple">
+
+ </metamer:testPageLink>
+
+ </ui:define>
+
+ </ui:composition>
+
+</html>
Added: modules/tests/metamer/trunk/application/src/main/webapp/components/richDropBehavior/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richDropBehavior/simple.xhtml (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richDropBehavior/simple.xhtml 2010-12-17 08:51:42 UTC (rev 20634)
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:metamer="http://java.sun.com/jsf/composite/metamer"
+ xmlns:rich="http://richfaces.org/rich"
+ xmlns:a4j="http://richfaces.org/a4j">
+
+<!--
+JBoss, Home of Professional Open Source
+Copyright 2010, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software 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 software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ -->
+
+<ui:composition template="/templates/template.xhtml">
+ <ui:param name="componentId" value="richTree" />
+
+ <ui:define name="head">
+ <f:metadata>
+ <f:viewParam name="templates" value="#{templateBean.templates}">
+ <f:converter converterId="templatesListConverter" />
+ </f:viewParam>
+ <f:event type="preRenderView"
+ listener="#{richTreeBean.preRenderView}" />
+ </f:metadata>
+ <h:outputStylesheet library="css" name="richDragBehavior.css" />
+ </ui:define>
+
+ <ui:define name="outOfTemplateBefore">
+ </ui:define>
+
+ <ui:define name="component">
+
+ <rich:dragIndicator id="indicator" />
+
+ <table>
+ <tr>
+ <td>
+ <a4j:outputPanel id="draggable1" layout="block" styleClass="draggable">
+ <h:outputText value="#{richDragBehaviorBean.dragValues[0]}" />
+ <rich:dragBehavior event="mouseover"
+ dragValue="#{richDragBehaviorBean.dragValues[0]}"
+ type="drg1" />
+ </a4j:outputPanel>
+ </td>
+ <td>
+ <a4j:outputPanel id="draggable2" layout="block" styleClass="draggable">
+ <h:outputText value="#{richDragBehaviorBean.dragValues[1]}" />
+ <rich:dragBehavior event="mouseover" type="drg2" dragIndicator="indicator" dragValue="#{richDragBehaviorBean.dragValues[1]}" />
+ </a4j:outputPanel>
+ </td>
+ <td>
+ <a4j:outputPanel id="draggable3" layout="block" styleClass="draggable">
+ <h:outputText value="#{richDragBehaviorBean.dragValues[2]}" />
+ <rich:dragBehavior event="mouseover" type="drg3" dragIndicator="indicator" dragValue="#{richDragBehaviorBean.dragValues[2]}" />
+ </a4j:outputPanel>
+ </td>
+ </tr>
+ </table>
+
+ <a4j:outputPanel id="droppable" layout="block" styleClass="droppable">
+ <rich:dropBehavior event="mouseover"
+ dropValue="#{richDropBehaviorBean.dropValue}"
+ listener="#{richDropListenerBean.processDragging}"
+
+ acceptedTypes="#{richDragBehaviorBean.attributes['acceptedTypes'].value}"
+ bypassUpdates="#{richDragBehaviorBean.attributes['bypassUpdates'].value}"
+ data="#{richDragBehaviorBean.attributes['data'].value}"
+ disabled="#{richDragBehaviorBean.attributes['disabled'].value}"
+ execute="#{richDragBehaviorBean.attributes['execute'].value}"
+ immediate="#{richDragBehaviorBean.attributes['immediate'].value}"
+ limitRender="#{richDragBehaviorBean.attributes['limitRender'].value}"
+ onbeforedomupdate="#{richDragBehaviorBean.attributes['onbeforedomupdate'].value}"
+ onbegin="#{richDragBehaviorBean.attributes['onbegin'].value}"
+ oncomplete="#{richDragBehaviorBean.attributes['oncomplete'].value}"
+ onerror="#{richDragBehaviorBean.attributes['onerror'].value}"
+ queueId="#{richDragBehaviorBean.attributes['queueId'].value}"
+ render="#{richDragBehaviorBean.attributes['render'].value}"
+ status="#{richDragBehaviorBean.attributes['status'].value}"
+ />
+
+ <h:dataTable id="droppedValues" var="droppedValue" value="#{richDropBehaviorBean.droppedEntries}">
+ <h:column>
+ <h:outputText value="#{droppedValue}" />
+ </h:column>
+ </h:dataTable>
+ </a4j:outputPanel>
+
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ <a4j:outputPanel ajaxRendered="true">
+ <h:panelGrid columns="2">
+ <h:outputLabel value="Drop Event:" rendered="#{not empty richDropListenerBean.dropEvent}" />
+ <h:panelGroup rendered="#{not empty richDropListenerBean.dropEvent}">
+ <h:panelGrid columns="2">
+ <h:outputLabel value="Value:" />
+ <h:outputText value="#{richDropListenerBean.dropEvent.dragBehavior.dragValue}" />
+ </h:panelGrid>
+ </h:panelGroup>
+ </h:panelGrid>
+ </a4j:outputPanel>
+
+ <metamer:attributes value="#{richDropBehaviorBean.attributes}" id="dropBehaviorAttributes" />
+ </ui:define>
+
+</ui:composition>
+</html>
\ No newline at end of file
Added: modules/tests/metamer/trunk/application/src/main/webapp/resources/css/richDragBehavior.css
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/resources/css/richDragBehavior.css (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/webapp/resources/css/richDragBehavior.css 2010-12-17 08:51:42 UTC (rev 20634)
@@ -0,0 +1,38 @@
+.droppable {
+ border: 1px solid blue;
+ margin: 4px;
+ height: 300px;
+ width: 350px;
+ background-color: yellow;
+ overflow: auto;
+}
+
+.draggable {
+ border: 1px solid #000000;
+ background-color: grey;
+ opacity: 0.3;
+ margin: 2px;
+ height: 50px;
+ width: 100px;
+}
+
+.rf-ind {
+ height: 20px;
+ width: 20px;
+ border: 1px dotted red;
+ background-color: blue
+}
+
+.rf-ind-acpt {
+ height: 20px;
+ width: 20px;
+ border: 1px dotted red;
+ background-color: green;
+}
+
+.rf-ind-rejt {
+ height: 20px;
+ width: 20px;
+ border: 1px dotted green;
+ background-color: red;
+}
\ No newline at end of file
14 years
JBoss Rich Faces SVN: r20633 - in trunk: ui/common/api/src/main/java/org/richfaces/component and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2010-12-17 02:18:43 -0500 (Fri, 17 Dec 2010)
New Revision: 20633
Added:
trunk/ui/common/api/src/main/java/org/richfaces/component/Mode.java
Removed:
trunk/ui/output/ui/src/main/java/org/richfaces/component/MenuComponent.java
Modified:
trunk/core/api/src/test/java/org/richfaces/renderkit/util/HtmlDimensionsTest.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractDropDownMenu.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractMenuGroup.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractMenuItem.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/MenuGroupRendererBase.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java
Log:
RF-9789 Dropdown menu component: pre-promotion code review
- HtmlDimensionsTest was updated.
Modified: trunk/core/api/src/test/java/org/richfaces/renderkit/util/HtmlDimensionsTest.java
===================================================================
--- trunk/core/api/src/test/java/org/richfaces/renderkit/util/HtmlDimensionsTest.java 2010-12-17 01:27:58 UTC (rev 20632)
+++ trunk/core/api/src/test/java/org/richfaces/renderkit/util/HtmlDimensionsTest.java 2010-12-17 07:18:43 UTC (rev 20633)
@@ -21,7 +21,8 @@
*/
package org.richfaces.renderkit.util;
-import org.junit.Assert;
+import static org.junit.Assert.*;
+
import org.junit.Test;
/**
@@ -32,22 +33,23 @@
@Test
public void testFormatSize() {
- Assert.assertEquals("100px", HtmlDimensions.formatSize("100"));
- Assert.assertEquals("100px", HtmlDimensions.formatSize("100 "));
- Assert.assertEquals("100px", HtmlDimensions.formatSize(" 100"));
- Assert.assertEquals("100px", HtmlDimensions.formatSize(" 100 "));
- Assert.assertEquals("t100px", HtmlDimensions.formatSize("t100"));
- Assert.assertEquals("r100px", HtmlDimensions.formatSize("r100 "));
- Assert.assertEquals("100px ", HtmlDimensions.formatSize("100px "));
- Assert.assertEquals(" 100px", HtmlDimensions.formatSize(" 100px"));
- Assert.assertEquals(" 100px ", HtmlDimensions.formatSize(" 100px "));
- Assert.assertEquals("100px", HtmlDimensions.formatSize("100px"));
- Assert.assertEquals("100 px", HtmlDimensions.formatSize("100 px"));
- Assert.assertEquals("99%", HtmlDimensions.formatSize("99%"));
- Assert.assertEquals("99 %", HtmlDimensions.formatSize("99 %"));
- Assert.assertEquals("100em", HtmlDimensions.formatSize("100em"));
- Assert.assertEquals("size", HtmlDimensions.formatSize("size"));
- Assert.assertEquals("", HtmlDimensions.formatSize(""));
- Assert.assertEquals(" ", HtmlDimensions.formatSize(" "));
+ assertEquals("100px", HtmlDimensions.formatSize("100"));
+ assertEquals("100px", HtmlDimensions.formatSize("100 "));
+ assertEquals("100px", HtmlDimensions.formatSize(" 100"));
+ assertEquals("100px", HtmlDimensions.formatSize(" 100 "));
+ assertEquals("t100px", HtmlDimensions.formatSize("t100"));
+ assertEquals("r100px", HtmlDimensions.formatSize("r100 "));
+ assertEquals("100px ", HtmlDimensions.formatSize("100px "));
+ assertEquals(" 100px", HtmlDimensions.formatSize(" 100px"));
+ assertEquals(" 100px ", HtmlDimensions.formatSize(" 100px "));
+ assertEquals("100px", HtmlDimensions.formatSize("100px"));
+ assertEquals("100 px", HtmlDimensions.formatSize("100 px"));
+ assertEquals("99%", HtmlDimensions.formatSize("99%"));
+ assertEquals("99 %", HtmlDimensions.formatSize("99 %"));
+ assertEquals("100em", HtmlDimensions.formatSize("100em"));
+ assertEquals("size", HtmlDimensions.formatSize("size"));
+ assertEquals("", HtmlDimensions.formatSize(""));
+ assertEquals(" ", HtmlDimensions.formatSize(" "));
+ assertEquals(null, HtmlDimensions.formatSize(null));
}
}
Added: trunk/ui/common/api/src/main/java/org/richfaces/component/Mode.java
===================================================================
--- trunk/ui/common/api/src/main/java/org/richfaces/component/Mode.java (rev 0)
+++ trunk/ui/common/api/src/main/java/org/richfaces/component/Mode.java 2010-12-17 07:18:43 UTC (rev 20633)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.component;
+
+public enum Mode {
+ ajax,
+ client,
+ server;
+}
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractDropDownMenu.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractDropDownMenu.java 2010-12-17 01:27:58 UTC (rev 20632)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractDropDownMenu.java 2010-12-17 07:18:43 UTC (rev 20633)
@@ -13,8 +13,7 @@
renderer=@JsfRenderer(type = DropDownMenuRendererBase.RENDERER_TYPE),
tag = @Tag(name="dropDownMenu"),
attributes = {"events-props.xml", "core-props.xml", "i18n-props.xml"})
-public abstract class AbstractDropDownMenu extends UIComponentBase
- implements MenuComponent {
+public abstract class AbstractDropDownMenu extends UIComponentBase {
public static final String COMPONENT_TYPE = "org.richfaces.DropDownMenu";
@@ -23,7 +22,7 @@
@Attribute
public abstract String getShowEvent();
- @Attribute(defaultValue = MenuComponent.MODE_SERVER)
+ @Attribute(defaultValue = "server")
public abstract String getMode();
@Attribute
@@ -60,16 +59,7 @@
public abstract String getOnitemclick();
public enum Facets {
- LABEL("label"), LABEL_DISABLED("labelDisabled");
-
- private String facetName;
- private Facets(String name) {
- this.facetName = name;
- }
-
- @Override
- public String toString() {
- return facetName;
- }
+ label,
+ labelDisabled
}
}
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractMenuGroup.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractMenuGroup.java 2010-12-17 01:27:58 UTC (rev 20632)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractMenuGroup.java 2010-12-17 07:18:43 UTC (rev 20633)
@@ -54,16 +54,7 @@
public abstract String getOnhide();
public enum Facets {
- ICON("icon"), ICON_DISABLED("iconDisabled");
-
- private String facetName;
- private Facets(String name) {
- this.facetName = name;
- }
-
- @Override
- public String toString() {
- return facetName;
- }
+ icon,
+ iconDisabled
}
}
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractMenuItem.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractMenuItem.java 2010-12-17 01:27:58 UTC (rev 20632)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractMenuItem.java 2010-12-17 07:18:43 UTC (rev 20633)
@@ -12,8 +12,7 @@
renderer=@JsfRenderer(type = MenuItemRendererBase.RENDERER_TYPE),
tag = @Tag(name="menuItem"),
attributes = {"events-props.xml", "core-props.xml", "i18n-props.xml", "ajax-props.xml"})
-public abstract class AbstractMenuItem extends AbstractActionComponent
- implements MenuComponent {
+public abstract class AbstractMenuItem extends AbstractActionComponent {
public static final String COMPONENT_TYPE = "org.richfaces.MenuItem";
@@ -33,16 +32,7 @@
public abstract boolean isDisabled();
public enum Facets {
- ICON("icon"), ICON_DISABLED("iconDisabled");
-
- private String facetName;
- private Facets(String name) {
- this.facetName = name;
- }
-
- @Override
- public String toString() {
- return facetName;
- }
+ icon,
+ iconDisabled
}
}
Deleted: trunk/ui/output/ui/src/main/java/org/richfaces/component/MenuComponent.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/MenuComponent.java 2010-12-17 01:27:58 UTC (rev 20632)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/MenuComponent.java 2010-12-17 07:18:43 UTC (rev 20633)
@@ -1,44 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - 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_CLIENT = "client";
-
- /**
- * Getter for submit mode property.
- */
- public String getMode();
- public void setMode(String mode);
-}
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java 2010-12-17 01:27:58 UTC (rev 20632)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java 2010-12-17 07:18:43 UTC (rev 20633)
@@ -64,9 +64,9 @@
if (ddmenu != null) {
if (ddmenu.isDisabled()) {
- facet = ddmenu.getFacet(AbstractDropDownMenu.Facets.LABEL_DISABLED.toString());
+ facet = ddmenu.getFacet(AbstractDropDownMenu.Facets.labelDisabled.toString());
} else {
- facet = ddmenu.getFacet(AbstractDropDownMenu.Facets.LABEL.toString());
+ facet = ddmenu.getFacet(AbstractDropDownMenu.Facets.label.toString());
}
}
return facet;
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/MenuGroupRendererBase.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/MenuGroupRendererBase.java 2010-12-17 01:27:58 UTC (rev 20632)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/MenuGroupRendererBase.java 2010-12-17 07:18:43 UTC (rev 20633)
@@ -39,9 +39,9 @@
if (menuGroup != null) {
if (menuGroup.isDisabled()) {
- facet = menuGroup.getFacet(AbstractMenuGroup.Facets.ICON_DISABLED.toString());
+ facet = menuGroup.getFacet(AbstractMenuGroup.Facets.iconDisabled.toString());
} else {
- facet = menuGroup.getFacet(AbstractMenuGroup.Facets.ICON.toString());
+ facet = menuGroup.getFacet(AbstractMenuGroup.Facets.icon.toString());
}
}
return facet;
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java 2010-12-17 01:27:58 UTC (rev 20632)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java 2010-12-17 07:18:43 UTC (rev 20633)
@@ -11,7 +11,7 @@
import org.richfaces.component.AbstractDropDownMenu;
import org.richfaces.component.AbstractMenuGroup;
import org.richfaces.component.AbstractMenuItem;
-import org.richfaces.component.MenuComponent;
+import org.richfaces.component.Mode;
import org.richfaces.renderkit.AjaxCommandRendererBase;
public class MenuItemRendererBase extends AjaxCommandRendererBase {
@@ -31,9 +31,9 @@
if (menuItem != null) {
if (menuItem.isDisabled()) {
- facet = menuItem.getFacet(AbstractMenuItem.Facets.ICON_DISABLED.toString());
+ facet = menuItem.getFacet(AbstractMenuItem.Facets.iconDisabled.toString());
} else {
- facet = menuItem.getFacet(AbstractMenuItem.Facets.ICON.toString());
+ facet = menuItem.getFacet(AbstractMenuItem.Facets.icon.toString());
}
}
return facet;
@@ -58,8 +58,8 @@
AbstractMenuItem menuItem = (AbstractMenuItem) component;
if (menuItem != null) {
- String mode = resolveSubmitMode(menuItem);
- if (!MenuComponent.MODE_CLIENT.equalsIgnoreCase(mode)) {
+ Mode mode = resolveSubmitMode(menuItem);
+ if (!Mode.client.equals(mode)) {
super.doDecode(context, component);
}
}
@@ -96,39 +96,35 @@
protected String getOnClickFunction(FacesContext facesContext, UIComponent component) {
AbstractMenuItem menuItem = (AbstractMenuItem) component;
- String subminMode = resolveSubmitMode(menuItem);
+ Mode subminMode = resolveSubmitMode(menuItem);
if (menuItem.isDisabled()) {
return "";
- } else if (subminMode == null || MenuComponent.MODE_SERVER.equalsIgnoreCase(subminMode)) {
+ } else if (subminMode == null || Mode.server.equals(subminMode)) {
return getServerSubmitFunction(menuItem);
- } else if (MenuComponent.MODE_AJAX.equalsIgnoreCase(subminMode)) {
+ } else if (Mode.ajax.equals(subminMode)) {
return getOnClick(facesContext, menuItem);
- } else if (MenuComponent.MODE_CLIENT.equalsIgnoreCase(subminMode)) {
+ } else if (Mode.client.equals(subminMode)) {
return "";
}
return "";
}
- protected String resolveSubmitMode(AbstractMenuItem menuItem) {
+ protected Mode resolveSubmitMode(AbstractMenuItem menuItem) {
String submitMode = menuItem.getMode();
if (null != submitMode) {
- return submitMode;
+ return Mode.valueOf(submitMode);
}
- UIComponent parent = menuItem.getParent();
- while (null != parent) {
- if (parent instanceof MenuComponent) {
- return ((MenuComponent) parent).getMode();
- }
- parent = parent.getParent();
+ AbstractDropDownMenu parent = getDDMenu(menuItem);
+ if (parent != null) {
+ return Mode.valueOf(parent.getMode());
}
-
- return MenuComponent.MODE_SERVER;
+ return Mode.server;
}
protected String getStyleClass(FacesContext facesContext, UIComponent component, String ddMenuStyle, String menuGroupStyle, String menuItemStyle) {
- UIComponent ddMenu = getDDMenu(facesContext, component);
- UIComponent menuGroup = getMenuGroup(facesContext, component);
+ UIComponent ddMenu = getDDMenu(component);
+ UIComponent menuGroup = getMenuGroup(component);
Object styleClass = null;
if (ddMenu != null && ddMenuStyle != null && ddMenuStyle.length() > 0) {
styleClass = ddMenu.getAttributes().get(ddMenuStyle);
@@ -140,38 +136,35 @@
return concatClasses(styleClass, component.getAttributes().get(menuItemStyle));
}
+ private UIComponent getParent(UIComponent component, Class<?> parentClass) {
+ if (component != null && parentClass != null) {
+ UIComponent parent = component.getParent();
+ while (parent != null) {
+ if (parentClass.isInstance(parent)) {
+ return parent;
+ }
+ parent = parent.getParent();
+ }
+ }
+ return null;
+ }
+
/**
* Returns a parent <code>AbstractDropDownMenu</code> object of the given component.
- * @param facesContext
* @param component
- * @return <code>UIComponent</code>
+ * @return <code>AbstractDropDownMenu</code>
*/
- protected UIComponent getDDMenu(FacesContext facesContext, UIComponent component) {
- UIComponent parent = component.getParent();
- while (parent != null) {
- if (parent instanceof AbstractDropDownMenu) {
- return parent;
- }
- parent = parent.getParent();
- }
- return null;
+ protected AbstractDropDownMenu getDDMenu(UIComponent component) {
+ return (AbstractDropDownMenu) getParent(component, AbstractDropDownMenu.class);
}
/**
* Returns a parent <code>AbstractMenuGroup</code> object of the given component.
- * @param facesContext
* @param component
- * @return <code>UIComponent</code>
+ * @return <code>AbstractMenuGroup</code>
*/
- protected UIComponent getMenuGroup(FacesContext facesContext, UIComponent component) {
- UIComponent parent = component.getParent();
- while (parent != null) {
- if (parent instanceof AbstractMenuGroup) {
- return parent;
- }
- parent = parent.getParent();
- }
- return null;
+ protected AbstractMenuGroup getMenuGroup(UIComponent component) {
+ return (AbstractMenuGroup) getParent(component, AbstractMenuGroup.class);
}
/**
14 years
JBoss Rich Faces SVN: r20632 - in branches/RF-7654/ui/validator/ui/src: test/resources/org/richfaces/component and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-12-16 20:27:58 -0500 (Thu, 16 Dec 2010)
New Revision: 20632
Modified:
branches/RF-7654/ui/validator/ui/src/main/java/org/richfaces/renderkit/MessageRendererBase.java
branches/RF-7654/ui/validator/ui/src/test/resources/org/richfaces/component/test.xhtml
Log:
CODING IN PROGRESS - issue RF-7654: rich:message/rich:messages
https://issues.jboss.org/browse/RF-7654
Modified: branches/RF-7654/ui/validator/ui/src/main/java/org/richfaces/renderkit/MessageRendererBase.java
===================================================================
--- branches/RF-7654/ui/validator/ui/src/main/java/org/richfaces/renderkit/MessageRendererBase.java 2010-12-17 01:21:37 UTC (rev 20631)
+++ branches/RF-7654/ui/validator/ui/src/main/java/org/richfaces/renderkit/MessageRendererBase.java 2010-12-17 01:27:58 UTC (rev 20632)
@@ -23,12 +23,14 @@
package org.richfaces.renderkit;
+import java.io.IOException;
import java.util.Iterator;
import javax.faces.application.FacesMessage;
import javax.faces.application.FacesMessage.Severity;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
import javax.faces.render.Renderer;
import org.richfaces.renderkit.util.RendererUtils;
@@ -118,9 +120,11 @@
return (String) component.getAttributes().get("for");
}
- protected void encodeMessage(FacesContext facesContext, UIComponent component, Object msg) {
+ protected void encodeMessage(FacesContext facesContext, UIComponent component, Object msg) throws IOException {
// TODO fix generator to properly detect iteration variable type
FacesMessage message = (FacesMessage) msg;
+ ResponseWriter responseWriter = facesContext.getResponseWriter();
+ responseWriter.writeText(message.getSummary(),"value");
}
static SeverityAttributes attrs(String styleAttribute, String classAttribute, String markerStyleAttribute,
Modified: branches/RF-7654/ui/validator/ui/src/test/resources/org/richfaces/component/test.xhtml
===================================================================
--- branches/RF-7654/ui/validator/ui/src/test/resources/org/richfaces/component/test.xhtml 2010-12-17 01:21:37 UTC (rev 20631)
+++ branches/RF-7654/ui/validator/ui/src/test/resources/org/richfaces/component/test.xhtml 2010-12-17 01:27:58 UTC (rev 20632)
@@ -10,7 +10,7 @@
<csv:validator event="keyup" />
</h:inputText>
<h:outputText id="out" value="#{test.value}"></h:outputText>
- <h:message id="message" for="text" />
+ <csv:message id="message" for="text" />
</h:form>
</h:body>
</html>
14 years
JBoss Rich Faces SVN: r20631 - in branches/RF-7654/ui/validator/ui/src: test/java/org/richfaces/javascript/client/message and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-12-16 20:21:37 -0500 (Thu, 16 Dec 2010)
New Revision: 20631
Added:
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/ClearMessageTest.java
Modified:
branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/csv.js
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/MessageTestBase.java
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/SendMessageTest.java
Log:
CODING IN PROGRESS - issue RF-7654: rich:message/rich:messages
https://issues.jboss.org/browse/RF-7654
Modified: branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/csv.js
===================================================================
--- branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/csv.js 2010-12-17 01:09:52 UTC (rev 20630)
+++ branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/csv.js 2010-12-17 01:21:37 UTC (rev 20631)
@@ -28,10 +28,10 @@
return {detail:_interpolateMessage(facesMessage.detail,values),summary:_interpolateMessage(facesMessage.summary,values)};
},
sendMessage: function (componentId, message) {
- rf.Event.fire(window.document, rf.csv.MESSAGE_EVENT_NAME, {componentId:componentId, message:message});
+ rf.Event.fire(window.document, rf.csv.MESSAGE_EVENT_NAME, {'componentId':componentId, 'message':message});
},
clearMessage: function (componentId) {
- rf.Event.fire(window.document, rf.csv.MESSAGE_EVENT_NAME, {componentId:componentId, message:''});
+ rf.Event.fire(window.document, rf.csv.MESSAGE_EVENT_NAME, {'componentId':componentId, 'message':''});
},
getValue: function (clientId, element){
var value;
Added: branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/ClearMessageTest.java
===================================================================
--- branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/ClearMessageTest.java (rev 0)
+++ branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/ClearMessageTest.java 2010-12-17 01:21:37 UTC (rev 20631)
@@ -0,0 +1,59 @@
+/*
+ * $Id$
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.javascript.client.message;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class ClearMessageTest extends MessageTestBase {
+
+ private static final String ERROR_MESSAGE = "Error";
+
+ @Test
+ public void testClear() throws Exception {
+ sendMessage();
+ HtmlElement htmlElement = getMessageContentElement();
+ String text = htmlElement.asText();
+ assertFalse(text.contains(ERROR_MESSAGE));
+ }
+
+ @Override
+ protected String getMessageContent() {
+
+ return "<li>Error</li>";
+ }
+ @Override
+ protected String getJavaScriptFunctionName() {
+ return "clearMessage";
+ }
+}
Property changes on: branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/ClearMessageTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/MessageTestBase.java
===================================================================
--- branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/MessageTestBase.java 2010-12-17 01:09:52 UTC (rev 20630)
+++ branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/MessageTestBase.java 2010-12-17 01:21:37 UTC (rev 20631)
@@ -1,5 +1,7 @@
package org.richfaces.javascript.client.message;
+import static org.junit.Assert.*;
+
import org.ajax4jsf.javascript.JSFunction;
import org.jboss.test.qunit.Qunit;
import org.jboss.test.qunit.Qunit.Builder;
@@ -7,6 +9,9 @@
import org.junit.Rule;
import org.richfaces.javascript.Message;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
public class MessageTestBase {
@Rule
@@ -49,4 +54,11 @@
return new Message(2,"error","script error");
}
+ protected HtmlElement getMessageContentElement() {
+ HtmlPage page = qunit.getPage();
+ HtmlElement htmlElement = page.getElementById(MY_MESSAGE+":Content");
+ assertNotNull(htmlElement);
+ return htmlElement;
+ }
+
}
Modified: branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/SendMessageTest.java
===================================================================
--- branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/SendMessageTest.java 2010-12-17 01:09:52 UTC (rev 20630)
+++ branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/SendMessageTest.java 2010-12-17 01:21:37 UTC (rev 20631)
@@ -28,7 +28,6 @@
import org.junit.Test;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
/**
* <p class="changed_added_4_0"></p>
@@ -40,9 +39,7 @@
@Test
public void testSend() throws Exception {
sendMessage();
- HtmlPage page = qunit.getPage();
- HtmlElement htmlElement = page.getElementById(MY_MESSAGE+":Content");
- assertNotNull(htmlElement);
+ HtmlElement htmlElement = getMessageContentElement();
String text = htmlElement.asText();
assertTrue(text.contains(getErrorMessage().getSummary()));
}
14 years
JBoss Rich Faces SVN: r20630 - in branches/RF-7654: ui/validator/ui/src/main and 10 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-12-16 20:09:52 -0500 (Thu, 16 Dec 2010)
New Revision: 20630
Added:
branches/RF-7654/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/TagExtensionBase.java
branches/RF-7654/ui/validator/ui/src/main/config/
branches/RF-7654/ui/validator/ui/src/main/config/faces-config.xml
branches/RF-7654/ui/validator/ui/src/main/config/messages.xml
branches/RF-7654/ui/validator/ui/src/main/java/org/richfaces/renderkit/MessageRendererBase.java
branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/message.js
branches/RF-7654/ui/validator/ui/src/main/templates/
branches/RF-7654/ui/validator/ui/src/main/templates/message.template.xml
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/MessageTestBase.java
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/SendMessageTest.java
branches/RF-7654/ui/validator/ui/src/test/resources/1.html
Removed:
branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/csv.taglib.xml
branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/faces-config.xml
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/convert/
Modified:
branches/RF-7654/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/BehaviorBean.java
branches/RF-7654/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentBean.java
branches/RF-7654/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ConverterBean.java
branches/RF-7654/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ValidatorBean.java
branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/csv.js
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/MockTestBase.java
branches/RF-7654/ui/validator/ui/src/test/resources/org/richfaces/component/client-test.xhtml
Log:
CODING IN PROGRESS - issue RF-7654: rich:message/rich:messages
https://issues.jboss.org/browse/RF-7654
Modified: branches/RF-7654/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/BehaviorBean.java
===================================================================
--- branches/RF-7654/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/BehaviorBean.java 2010-12-16 22:32:17 UTC (rev 20629)
+++ branches/RF-7654/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/BehaviorBean.java 2010-12-17 01:09:52 UTC (rev 20630)
@@ -34,6 +34,7 @@
import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.PropertyModel;
+
/**
* @author akolonitsky
* @since Jan 21, 2010
@@ -90,6 +91,7 @@
super.setExtension(extension);
}
- public static class BehaviorExtension extends ExtensionBeanBase {
+ public static class BehaviorExtension extends TagExtensionBase {
+
}
}
Modified: branches/RF-7654/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentBean.java
===================================================================
--- branches/RF-7654/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentBean.java 2010-12-16 22:32:17 UTC (rev 20629)
+++ branches/RF-7654/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentBean.java 2010-12-17 01:09:52 UTC (rev 20630)
@@ -37,7 +37,6 @@
import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.FacetModel;
import org.richfaces.cdk.model.PropertyModel;
-import org.richfaces.cdk.model.TagModel;
import com.google.common.collect.Lists;
@@ -144,10 +143,9 @@
super.setExtension(extension);
}
- public static class ComponentExtension extends ExtensionBeanBase {
+ public static class ComponentExtension extends TagExtensionBase {
private FacesId rendererType;
private List<EventModel> events = Lists.newArrayList();
- private List<TagModel> tags = Lists.newArrayList();
private FacesId family;
/**
@@ -207,25 +205,6 @@
public void setEvents(List<EventModel> events) {
this.events = events;
}
-
- /**
- * <p class="changed_added_4_0"></p>
- *
- * @return the tags
- */
- @XmlElement(name = "tag", namespace = ComponentLibrary.CDK_EXTENSIONS_NAMESPACE)
- public List<TagModel> getTags() {
- return this.tags;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- *
- * @param tags the tags to set
- */
- public void setTags(List<TagModel> tags) {
- this.tags = tags;
- }
}
}
Modified: branches/RF-7654/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ConverterBean.java
===================================================================
--- branches/RF-7654/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ConverterBean.java 2010-12-16 22:32:17 UTC (rev 20629)
+++ branches/RF-7654/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ConverterBean.java 2010-12-17 01:09:52 UTC (rev 20630)
@@ -33,6 +33,7 @@
import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.PropertyModel;
+
/**
* @author akolonitsky
* @since Jan 6, 2010
@@ -100,7 +101,7 @@
return super.getExtension();
}
- public static class ConverterExtension extends ExtensionBeanBase {
+ public static class ConverterExtension extends TagExtensionBase {
}
}
Added: branches/RF-7654/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/TagExtensionBase.java
===================================================================
--- branches/RF-7654/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/TagExtensionBase.java (rev 0)
+++ branches/RF-7654/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/TagExtensionBase.java 2010-12-17 01:09:52 UTC (rev 20630)
@@ -0,0 +1,36 @@
+package org.richfaces.cdk.xmlconfig.model;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+
+import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.TagModel;
+
+import com.google.common.collect.Lists;
+
+public class TagExtensionBase extends ExtensionBeanBase {
+
+ private List<TagModel> tags = Lists.newArrayList();
+
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @return the tags
+ */
+ @XmlElement(name = "tag", namespace = ComponentLibrary.CDK_EXTENSIONS_NAMESPACE)
+ public List<TagModel> getTags() {
+ return this.tags;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ *
+ * @param tags the tags to set
+ */
+ public void setTags(List<TagModel> tags) {
+ this.tags = tags;
+ }
+
+}
\ No newline at end of file
Property changes on: branches/RF-7654/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/TagExtensionBase.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/RF-7654/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ValidatorBean.java
===================================================================
--- branches/RF-7654/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ValidatorBean.java 2010-12-16 22:32:17 UTC (rev 20629)
+++ branches/RF-7654/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ValidatorBean.java 2010-12-17 01:09:52 UTC (rev 20630)
@@ -33,6 +33,7 @@
import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.PropertyModel;
+
/**
* @author akolonitsky
* @since Jan 13, 2010
@@ -91,7 +92,7 @@
super.setExtension(extension);
}
- public static class ValidatorExtension extends ExtensionBeanBase {
+ public static class ValidatorExtension extends TagExtensionBase {
}
}
Copied: branches/RF-7654/ui/validator/ui/src/main/config/faces-config.xml (from rev 20621, branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/faces-config.xml)
===================================================================
--- branches/RF-7654/ui/validator/ui/src/main/config/faces-config.xml (rev 0)
+++ branches/RF-7654/ui/validator/ui/src/main/config/faces-config.xml 2010-12-17 01:09:52 UTC (rev 20630)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faces-config version="2.0" metadata-complete="false"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
+ xmlns="http://java.sun.com/xml/ns/javaee" xmlns:cdk="http://jboss.org/schema/richfaces/cdk/extensions"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <behavior>
+ <behavior-id>org.richfaces.behavior.ClientValidator</behavior-id>
+ <behavior-class>org.richfaces.component.behavior.ClientValidatorImpl</behavior-class>
+ <behavior-extension>
+ <cdk:tag>
+ <cdk:tag-name>validator</cdk:tag-name>
+ <cdk:tag-type>Facelets</cdk:tag-type>
+ </cdk:tag>
+ </behavior-extension>
+ </behavior>
+ <render-kit>
+ <client-behavior-renderer>
+ <client-behavior-renderer-type>org.richfaces.ClientValidatorRenderer</client-behavior-renderer-type>
+ <client-behavior-renderer-class>org.richfaces.renderkit.html.ClientValidatorRenderer</client-behavior-renderer-class>
+ </client-behavior-renderer>
+ </render-kit>
+ <faces-config-extension>
+ <cdk:taglib>
+ <cdk:shortName>csv</cdk:shortName>
+ <cdk:uri>http://richfaces.org/csv</cdk:uri>
+ </cdk:taglib>
+ </faces-config-extension>
+
+</faces-config>
\ No newline at end of file
Property changes on: branches/RF-7654/ui/validator/ui/src/main/config/faces-config.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: branches/RF-7654/ui/validator/ui/src/main/config/messages.xml
===================================================================
--- branches/RF-7654/ui/validator/ui/src/main/config/messages.xml (rev 0)
+++ branches/RF-7654/ui/validator/ui/src/main/config/messages.xml 2010-12-17 01:09:52 UTC (rev 20630)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<faces-config version="2.0" metadata-complete="false"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
+ xmlns="http://java.sun.com/xml/ns/javaee" xmlns:cdk="http://jboss.org/schema/richfaces/cdk/extensions"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <component>
+ <component-type>org.richfaces.Message</component-type>
+ <component-class>org.richfaces.component.html.HtmlMessage</component-class>
+ <component-extension>
+ <cdk:generate>true</cdk:generate>
+ <cdk:base-class>javax.faces.component.UIMessage</cdk:base-class>
+ <cdk:component-family>javax.faces.Message</cdk:component-family>
+ <cdk:renderer-type>org.richfaces.MessageRenderer</cdk:renderer-type>
+ <cdk:tag>
+ <cdk:tag-name>message</cdk:tag-name>
+ <cdk:tag-type>Facelets</cdk:tag-type>
+ </cdk:tag>
+ </component-extension>
+ </component>
+</faces-config>
Property changes on: branches/RF-7654/ui/validator/ui/src/main/config/messages.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/RF-7654/ui/validator/ui/src/main/java/org/richfaces/renderkit/MessageRendererBase.java
===================================================================
--- branches/RF-7654/ui/validator/ui/src/main/java/org/richfaces/renderkit/MessageRendererBase.java (rev 0)
+++ branches/RF-7654/ui/validator/ui/src/main/java/org/richfaces/renderkit/MessageRendererBase.java 2010-12-17 01:09:52 UTC (rev 20630)
@@ -0,0 +1,152 @@
+/*
+ * $Id$
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.renderkit;
+
+import java.util.Iterator;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.application.FacesMessage.Severity;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.render.Renderer;
+
+import org.richfaces.renderkit.util.RendererUtils;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Iterators;
+import com.google.common.collect.Lists;
+import com.google.common.collect.UnmodifiableIterator;
+
+/**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class MessageRendererBase extends Renderer {
+
+ private static final ImmutableMap<Severity, SeverityAttributes> SEVERITY_MAP = ImmutableMap
+ .of(FacesMessage.SEVERITY_INFO,
+ attrs("infoStyle", "infoClass", "infoMarkerStyle", "infoMarkerClass", "infoLabelStyle", "infoLabelClass"),
+ FacesMessage.SEVERITY_WARN,
+ attrs("warnStyle", "warnClass", "warnMarkerStyle", "warnMarkerClass", "warnLabelStyle", "warnLabelClass"),
+ FacesMessage.SEVERITY_ERROR,
+ attrs("errorStyle", "errorClass", "errorMarkerStyle", "errorMarkerClass", "errorLabelStyle",
+ "errorLabelClass"),
+ FacesMessage.SEVERITY_FATAL,
+ attrs("fatalStyle", "fatalClass", "fatalMarkerStyle", "fatalMarkerClass", "fatalLabelStyle",
+ "fatalLabelClass"));
+
+ protected Iterator<FacesMessage> getMessages(FacesContext context, String forClientId, UIComponent component) {
+
+ Iterator<FacesMessage> msgIter;
+
+ if (forClientId != null) {
+
+ if (forClientId.length() != 0) {
+
+ UIComponent result = RendererUtils.getInstance().findComponentFor(component, forClientId);
+ if (result == null) {
+ msgIter = Iterators.emptyIterator();
+ } else {
+ msgIter = context.getMessages(result.getClientId(context));
+ }
+
+ } else {
+ msgIter = context.getMessages(null);
+ }
+
+ } else {
+ msgIter = context.getMessages();
+ }
+
+ return msgIter;
+ }
+
+ /**
+ * <p class="changed_added_4_0">TODO - make Generator aware of Iterator.</p>
+ * @param context
+ * @param component
+ * @return
+ */
+ protected Iterable<FacesMessage> getVisibleMessages(FacesContext context, UIComponent component) {
+ String forId = getFor(component);
+ Iterator<FacesMessage> messages = getMessages(context, forId, component);
+ UnmodifiableIterator<FacesMessage> filteredMessages =
+ Iterators.filter(messages, getMessagesFilter(context, component));
+ return Lists.newArrayList(filteredMessages);
+
+ }
+
+ private Predicate<FacesMessage> getMessagesFilter(FacesContext context, UIComponent component) {
+
+ Object levelName = component.getAttributes().get("level");
+ final Severity level =
+ (Severity) (FacesMessage.VALUES_MAP.containsKey(levelName) ? FacesMessage.VALUES_MAP.get(levelName)
+ : FacesMessage.SEVERITY_INFO);
+ return new Predicate<FacesMessage>() {
+ public boolean apply(FacesMessage input) {
+ return input.getSeverity().compareTo(level) >= 0;
+ }
+ };
+ }
+
+ private String getFor(UIComponent component) {
+ return (String) component.getAttributes().get("for");
+ }
+
+ protected void encodeMessage(FacesContext facesContext, UIComponent component, Object msg) {
+ // TODO fix generator to properly detect iteration variable type
+ FacesMessage message = (FacesMessage) msg;
+ }
+
+ static SeverityAttributes attrs(String styleAttribute, String classAttribute, String markerStyleAttribute,
+ String markerClassAttribute, String labelStyleAttribute, String labelClassAttribute) {
+ SeverityAttributes attrs =
+ new SeverityAttributes(styleAttribute, classAttribute, markerStyleAttribute, markerClassAttribute,
+ labelStyleAttribute, labelClassAttribute);
+ return attrs;
+ }
+
+ private static final class SeverityAttributes {
+ private final String styleAttribute;
+ private final String classAttribute;
+ private final String markerStyleAttribute;
+ private final String markerClassAttribute;
+ private final String labelStyleAttribute;
+ private final String labelClassAttribute;
+
+ private SeverityAttributes(String styleAttribute2, String classAttribute2, String markerStyleAttribute2,
+ String markerClassAttribute2, String labelStyleAttribute2, String labelClassAttribute2) {
+ this.styleAttribute = styleAttribute2;
+ this.classAttribute = classAttribute2;
+ this.markerStyleAttribute = markerStyleAttribute2;
+ this.markerClassAttribute = markerClassAttribute2;
+ this.labelStyleAttribute = labelStyleAttribute2;
+ this.labelClassAttribute = labelClassAttribute2;
+ }
+ }
+}
Property changes on: branches/RF-7654/ui/validator/ui/src/main/java/org/richfaces/renderkit/MessageRendererBase.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/csv.taglib.xml
===================================================================
--- branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/csv.taglib.xml 2010-12-16 22:32:17 UTC (rev 20629)
+++ branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/csv.taglib.xml 2010-12-17 01:09:52 UTC (rev 20630)
@@ -1,15 +0,0 @@
-<?xml-stylesheet type="text/xsl" href=""?>
-<facelet-taglib xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd"
- version="2.0">
- <namespace>http://richfaces.org/csv</namespace>
-
- <tag>
- <tag-name>validator</tag-name>
- <behavior>
- <behavior-id>org.richfaces.behavior.ClientValidator</behavior-id>
- </behavior>
- </tag>
-
-</facelet-taglib>
Deleted: branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/faces-config.xml
===================================================================
--- branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/faces-config.xml 2010-12-16 22:32:17 UTC (rev 20629)
+++ branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/faces-config.xml 2010-12-17 01:09:52 UTC (rev 20630)
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<faces-config version="2.0" metadata-complete="false" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:cdk="http://jboss.org/schema/richfaces/cdk/extensions" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-<behavior>
- <behavior-id>org.richfaces.behavior.ClientValidator</behavior-id>
- <behavior-class>org.richfaces.component.behavior.ClientValidatorImpl</behavior-class>
-</behavior>
-<render-kit>
- <client-behavior-renderer>
- <client-behavior-renderer-type>org.richfaces.ClientValidatorRenderer</client-behavior-renderer-type>
- <client-behavior-renderer-class>org.richfaces.renderkit.html.ClientValidatorRenderer</client-behavior-renderer-class>
- </client-behavior-renderer>
-</render-kit>
-</faces-config>
\ No newline at end of file
Modified: branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/csv.js
===================================================================
--- branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/csv.js 2010-12-16 22:32:17 UTC (rev 20629)
+++ branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/csv.js 2010-12-17 01:09:52 UTC (rev 20630)
@@ -22,18 +22,16 @@
$.extend(rf.csv, {
RE_DIGITS: /^-?\d+$/,
RE_FLOAT: /^(-?\d+)?(\.(\d+)?(e[+-]?\d+)?)?$/,
- MESSAGE_EVENT_NAME: "onmessage."+rf.Event.RICH_NAMESPACE,
+ MESSAGE_EVENT_NAME: "onmessage",
// Messages API
getMessage :function(facesMessage,values){
return {detail:_interpolateMessage(facesMessage.detail,values),summary:_interpolateMessage(facesMessage.summary,values)};
},
sendMessage: function (componentId, message) {
- rf.Event.fireById(document, rf.csv.MESSAGE_EVENT_NAME, message);
- rf.Event.fireById(componentId, rf.csv.MESSAGE_EVENT_NAME, message);
+ rf.Event.fire(window.document, rf.csv.MESSAGE_EVENT_NAME, {componentId:componentId, message:message});
},
clearMessage: function (componentId) {
- rf.Event.fireById(document, rf.csv.MESSAGE_EVENT_NAME, message);
- rf.Event.fireById(componentId, rf.csv.MESSAGE_EVENT_NAME, message);
+ rf.Event.fire(window.document, rf.csv.MESSAGE_EVENT_NAME, {componentId:componentId, message:''});
},
getValue: function (clientId, element){
var value;
Added: branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/message.js
===================================================================
--- branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/message.js (rev 0)
+++ branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/message.js 2010-12-17 01:09:52 UTC (rev 20630)
@@ -0,0 +1,77 @@
+(function($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ // Constructor definition
+ rf.ui.Base = function(componentId, options, defaultOptions) {
+ this.namespace = "."+rf.Event.createNamespace(this.name, componentId);
+ // call constructor of parent class
+ $super.constructor.call(this, componentId);
+ this.options = $.extend(this.options, defaultOptions, options);
+ this.attachToDom();
+ this.__bindEventHandlers();
+ };
+
+ // Extend component class and add protected methods from parent class to our container
+ rf.BaseComponent.extend(rf.ui.Base);
+
+ // define super class link
+ var $super = rf.ui.Base.$super;
+
+ $.extend(rf.ui.Base.prototype, {
+ __bindEventHandlers: function () {
+ },
+ destroy: function () {
+ rf.Event.unbind(this.id, this.namespace);
+ $super.destroy.call(this);
+ }
+ });
+
+})(jQuery, window.RichFaces || (window.RichFaces={}));
+
+(function($, rf) {
+
+ // Constructor definition
+ rf.ui.Message = function(componentId, options) {
+ // call constructor of parent class
+ $super.constructor.call(this, componentId, options, defaultOptions);
+ };
+
+ // Extend component class and add protected methods from parent class to our container
+ rf.ui.Base.extend(rf.ui.Message);
+
+ // define super class link
+ var $super = rf.ui.Message.$super;
+
+ var defaultOptions = {
+
+ };
+
+ var componentHash = {};
+ var componentIndex = 0;
+
+ var onMessage = function (event, element, data) {
+ if (!this.options.forComponentId) {
+ var index = componentHash[data.componentId];
+ if (typeof index != undefined) {
+ $(rf.getDomElement(this.id+":Content"+index)).remove();
+ }
+ var content = content = $(rf.getDomElement(this.id+":Content"));
+
+ componentIndex ++;
+ if (data.message) content.append('<li id="'+this.id+":Content"+componentIndex+'">'+data.message+'</li>');
+ componentHash[data.componentId] = componentIndex;
+
+ } else if (this.options.forComponentId==data.componentId) {
+ rf.getDomElement(this.id+":Content").innerHTML = data.message ? '<li>'+data.message+'</li>' : '';
+ }
+ }
+
+ $.extend(rf.ui.Message.prototype, {
+ name: "Message",
+ __bindEventHandlers: function () {
+ rf.Event.bind(window.document, rf.Event.MESSAGE_EVENT_TYPE+this.namespace, onMessage, this);
+ }
+ });
+
+})(jQuery, window.RichFaces || (window.RichFaces={}));
\ No newline at end of file
Property changes on: branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/message.js
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/RF-7654/ui/validator/ui/src/main/templates/message.template.xml
===================================================================
--- branches/RF-7654/ui/validator/ui/src/main/templates/message.template.xml (rev 0)
+++ branches/RF-7654/ui/validator/ui/src/main/templates/message.template.xml 2010-12-17 01:09:52 UTC (rev 20630)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+JBoss, Home of Professional Open Source
+Copyright ${year}, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+
+This software 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 software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+<cdk:root xmlns="http://jboss.org/schema/richfaces/cdk/xhtml-el" xmlns:cdk="http://jboss.org/schema/richfaces/cdk/core"
+ xmlns:cc="http://jboss.org/schema/richfaces/cdk/jsf/composite" xmlns:c="http://jboss.org/schema/richfaces/cdk/jstl/core"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+ <cc:interface>
+ <cdk:class>org.richfaces.renderkit.html.HtmlMessageRenderer</cdk:class>
+ <cdk:superclass>org.richfaces.renderkit.MessageRendererBase</cdk:superclass>
+ <cdk:component-family>javax.faces.Message</cdk:component-family>
+ <cdk:renderer-type>org.richfaces.MessageRenderer</cdk:renderer-type>
+ <cdk:resource-dependency library="org.richfaces" name="base-component.reslib" />
+ <cdk:resource-dependency library="org.richfaces" name="message.js" />
+ </cc:interface>
+ <cc:implementation>
+ <span id="#{clientId}" class="rf-msg #{component.attributes['styleClass']}" cdk:passThroughWithExclusions="id class">
+ <ul id="#{clientId}:Content" >
+ <c:forEach var="msg" items="#{getVisibleMessages(facesContext,component)}">
+ <li><cdk:call>encodeMessage(facesContext,component,msg)</cdk:call></li>
+ </c:forEach>
+ </ul>
+ </span>
+ </cc:implementation>
+</cdk:root>
Property changes on: branches/RF-7654/ui/validator/ui/src/main/templates/message.template.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/MockTestBase.java
===================================================================
--- branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/MockTestBase.java 2010-12-16 22:32:17 UTC (rev 20629)
+++ branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/MockTestBase.java 2010-12-17 01:09:52 UTC (rev 20630)
@@ -21,14 +21,15 @@
public abstract class MockTestBase {
@Rule
- public final Qunit qunit = Qunit.builder().loadJsfResource("jquery.js").loadJsfResource("richfaces.js")
- .loadJsfResource("richfaces-event.js").loadJsfResource("csv.js", "org.richfaces").build();
+ public final Qunit qunit;
+
protected final RunParameters criteria;
protected MockFacesEnvironment facesEnvironment;
protected UIComponent component;
public MockTestBase(RunParameters criteria) {
this.criteria = criteria;
+ this.qunit = createQunitPage().build();
}
@Before
@@ -59,6 +60,11 @@
return criteria.getOptions();
}
+ protected org.jboss.test.qunit.Qunit.Builder createQunitPage() {
+ return Qunit.builder().loadJsfResource("jquery.js").loadJsfResource("richfaces.js")
+ .loadJsfResource("richfaces-event.js").loadJsfResource("csv.js", "org.richfaces");
+ }
+
protected abstract String getJavaScriptFunctionName();
protected static List<RunParameters[]> options(RunParameters ...criterias){
Added: branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/MessageTestBase.java
===================================================================
--- branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/MessageTestBase.java (rev 0)
+++ branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/MessageTestBase.java 2010-12-17 01:09:52 UTC (rev 20630)
@@ -0,0 +1,52 @@
+package org.richfaces.javascript.client.message;
+
+import org.ajax4jsf.javascript.JSFunction;
+import org.jboss.test.qunit.Qunit;
+import org.jboss.test.qunit.Qunit.Builder;
+import org.junit.Before;
+import org.junit.Rule;
+import org.richfaces.javascript.Message;
+
+public class MessageTestBase {
+
+ @Rule
+ public final Qunit qunit;
+
+ public static final String COMPONENT = "component";
+
+ public static final String MY_MESSAGE = "myMessage";
+
+ public MessageTestBase() {
+ this.qunit = createQunitPage().build();
+ }
+
+ public void setUpMessage(){
+ qunit.runScript("new RichFaces.ui.Message(\"" + MY_MESSAGE + "\", {forComponentId:\"" + COMPONENT + "\"})");
+ }
+
+ protected Builder createQunitPage() {
+ return Qunit.builder().loadJsfResource("jquery.js").loadJsfResource("richfaces.js")
+ .loadJsfResource("richfaces-event.js").loadJsfResource("richfaces-base-component.js").
+ loadJsfResource("csv.js", "org.richfaces").loadJsfResource("message.js", "org.richfaces").content("<div id=\"" + MY_MESSAGE + "\" ><ul id=\"" + MY_MESSAGE + ":Content\">"+getMessageContent()+"</ul></div>");
+ }
+
+
+ protected String getMessageContent() {
+ return "";
+ }
+
+ protected Object sendMessage() {
+ setUpMessage();
+ JSFunction clientSideFunction = new JSFunction("RichFaces.csv." + getJavaScriptFunctionName(),COMPONENT,getErrorMessage());
+ return qunit.runScript(clientSideFunction.toScript());
+
+ }
+ protected String getJavaScriptFunctionName() {
+ return "sendMessage";
+ }
+
+ protected Message getErrorMessage() {
+ return new Message(2,"error","script error");
+ }
+
+}
Property changes on: branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/MessageTestBase.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/SendMessageTest.java
===================================================================
--- branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/SendMessageTest.java (rev 0)
+++ branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/SendMessageTest.java 2010-12-17 01:09:52 UTC (rev 20630)
@@ -0,0 +1,50 @@
+/*
+ * $Id$
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.javascript.client.message;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class SendMessageTest extends MessageTestBase {
+
+ @Test
+ public void testSend() throws Exception {
+ sendMessage();
+ HtmlPage page = qunit.getPage();
+ HtmlElement htmlElement = page.getElementById(MY_MESSAGE+":Content");
+ assertNotNull(htmlElement);
+ String text = htmlElement.asText();
+ assertTrue(text.contains(getErrorMessage().getSummary()));
+ }
+
+}
Property changes on: branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/SendMessageTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/RF-7654/ui/validator/ui/src/test/resources/1.html
===================================================================
--- branches/RF-7654/ui/validator/ui/src/test/resources/1.html (rev 0)
+++ branches/RF-7654/ui/validator/ui/src/test/resources/1.html 2010-12-17 01:09:52 UTC (rev 20630)
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <script type="text/javascript" src="jquery.js"></script>
+ <script type="text/javascript" src="richfaces.js"></script>
+ <script type="text/javascript" src="richfaces-event.js"></script>
+ <script type="text/javascript" src="richfaces-base-component.js"></script>
+ <script type="text/javascript" src="richfaces-csv.js"></script>
+ <script type="text/javascript" src="richfaces-message.js"></script>
+ </head>
+ <body>
+ <form>
+ Global Message Component:<br />
+ <div id="myMessage1" style="border:1px dotted #000000; margin:4px; padding:2px;">
+ <ul id="myMessage1Content"></ul>
+ <script type="text/javascript">
+ new RichFaces.ui.Message("myMessage1", {});
+ </script>
+ </div>
+ <br />
+ Message Component for component1:<br />
+ <div id="myMessage2" style="border:1px dotted #000000; margin:4px; padding:2px;">
+ <ul id="myMessage2Content"></ul>
+ <script type="text/javascript">
+ new RichFaces.ui.Message("myMessage2", {forComponentId:"component1"});
+ </script>
+
+ </div>
+ <br />
+ Message Component for component2:<br />
+ <div id="myMessage3" style="border:1px dotted #000000; margin:4px; padding:2px;">
+ <ul id="myMessage3Content"></ul>
+ <script type="text/javascript">
+ new RichFaces.ui.Message("myMessage3", {forComponentId:"component2"});
+ </script>
+
+ </div>
+ <br />
+ <input type="button" value="send message for component1" onclick = "RichFaces.Event.fire(window.document, 'onmessage', {componentId:'component1', message:'Message for component1'});" />
+ <input type="button" value="send message for component2" onclick = "RichFaces.Event.fire(window.document, 'onmessage', {componentId:'component2', message:'Message for component2'});" />
+ <br />
+ <input type="button" value="clear message for component1" onclick = "RichFaces.Event.fire(window.document, 'onmessage', {componentId:'component1', message:''});" />
+ <input type="button" value="clear message for component2" onclick = "RichFaces.Event.fire(window.document, 'onmessage', {componentId:'component2', message:''});" />
+
+ </form>
+ </body>
+</html>
Property changes on: branches/RF-7654/ui/validator/ui/src/test/resources/1.html
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/RF-7654/ui/validator/ui/src/test/resources/org/richfaces/component/client-test.xhtml
===================================================================
--- branches/RF-7654/ui/validator/ui/src/test/resources/org/richfaces/component/client-test.xhtml 2010-12-16 22:32:17 UTC (rev 20629)
+++ branches/RF-7654/ui/validator/ui/src/test/resources/org/richfaces/component/client-test.xhtml 2010-12-17 01:09:52 UTC (rev 20630)
@@ -10,7 +10,7 @@
<csv:validator event="keyup" />
</h:inputText>
<h:outputText id="out" value="#{test.value}"></h:outputText>
- <h:message id="message" for="text" />
+ <csv:message id="message" for="text" />
</h:form>
</h:body>
</html>
14 years
JBoss Rich Faces SVN: r20629 - in trunk/ui/iteration/ui/src/main/java/org/richfaces: convert and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-12-16 17:32:17 -0500 (Thu, 16 Dec 2010)
New Revision: 20629
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/DeclarativeTreeDataModelWalker.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/convert/DeclarativeModelSequenceKeyConverter.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelImpl.java
Log:
DeclarativeTreeDataModelWalker refactoring
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/DeclarativeTreeDataModelWalker.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/DeclarativeTreeDataModelWalker.java 2010-12-16 21:35:18 UTC (rev 20628)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/DeclarativeTreeDataModelWalker.java 2010-12-16 22:32:17 UTC (rev 20629)
@@ -51,47 +51,33 @@
private Map<String, Object> contextMap;
+ private Object modelData;
+
private Object data;
- public DeclarativeTreeDataModelWalker(AbstractTree rootComponent) {
+ public DeclarativeTreeDataModelWalker(FacesContext facesContext, AbstractTree rootComponent) {
super();
this.rootComponent = rootComponent;
- this.facesContext = FacesContext.getCurrentInstance();
+ this.facesContext = facesContext;
this.contextMap = rootComponent.getVariablesMap(facesContext);
this.var = rootComponent.getVar();
this.currentComponent = rootComponent;
}
- protected UIComponent getChildModelComponent(String modelId) {
- UIComponent modelComponent;
-
+ private void setupChildModelContext(String modelId) {
if (currentComponent instanceof TreeModelRecursiveAdaptor && modelId.equals(currentComponent.getId())) {
- modelComponent = currentComponent;
+ //currentComponent already set
+ modelData = ((TreeModelRecursiveAdaptor) currentComponent).getNodes();
} else {
- modelComponent = Iterables.find(currentComponent.getChildren(), ComponentPredicates.withId(modelId));
- }
-
- return modelComponent;
- }
-
- protected Object getNodes(UIComponent modelComponent) {
- Object nodes = null;
-
- if (modelComponent instanceof TreeModelRecursiveAdaptor) {
- TreeModelRecursiveAdaptor recursiveAdaptor = (TreeModelRecursiveAdaptor) modelComponent;
-
- if (currentComponent.equals(modelComponent)) {
- nodes = recursiveAdaptor.getNodes();
+ currentComponent = Iterables.find(currentComponent.getChildren(), ComponentPredicates.withId(modelId));
+ if (currentComponent instanceof TreeModelRecursiveAdaptor) {
+ modelData = ((TreeModelRecursiveAdaptor) currentComponent).getRoots();
} else {
- nodes = recursiveAdaptor.getRoots();
+ modelData = ((TreeModelAdaptor) currentComponent).getNodes();
}
- } else {
- nodes = ((TreeModelAdaptor) modelComponent).getNodes();
}
-
- return nodes;
}
protected FacesContext getFacesContext() {
@@ -143,24 +129,21 @@
}
}
- protected void walkSimpleKeys(Object simpleKey) {
- DeclarativeModelKey segment = (DeclarativeModelKey) simpleKey;
-
+ protected void walkSimpleKey(DeclarativeModelKey segment) {
if (var != null) {
- contextMap.put(var, this.data);
+ contextMap.put(var, data);
}
- UIComponent modelComponent = getChildModelComponent(segment.getModelId());
- Object nodes = getNodes(modelComponent);
-
- this.currentComponent = modelComponent;
- DeclarativeModelKey convertedKey = convertKey(nodes, segment);
- this.data = getData(nodes, convertedKey.getModelKey());
+ setupChildModelContext(segment.getModelId());
+
+ DeclarativeModelKey convertedKey = convertKey(modelData, segment);
+ data = getData(modelData, convertedKey.getModelKey());
}
protected void walkSimpleKeys(Object[] simpleKeys) {
for (Object simpleKey : simpleKeys) {
- walkSimpleKeys(simpleKey);
+ DeclarativeModelKey declarativeKey = (DeclarativeModelKey) simpleKey;
+ walkSimpleKey(declarativeKey);
}
}
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/convert/DeclarativeModelSequenceKeyConverter.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/convert/DeclarativeModelSequenceKeyConverter.java 2010-12-16 21:35:18 UTC (rev 20628)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/convert/DeclarativeModelSequenceKeyConverter.java 2010-12-16 22:32:17 UTC (rev 20629)
@@ -45,8 +45,8 @@
private int keysIdx;
- private KeyConvertingWalker(AbstractTree rootComponent, FacesContext context) {
- super(rootComponent);
+ private KeyConvertingWalker(FacesContext context, AbstractTree rootComponent) {
+ super(context, rootComponent);
this.context = context;
}
@@ -93,7 +93,7 @@
if (key != null) {
- KeyConvertingWalker walker = new KeyConvertingWalker((AbstractTree) component, context);
+ KeyConvertingWalker walker = new KeyConvertingWalker(context, (AbstractTree) component);
walker.walk(key);
key = new SequenceRowKey((Object[]) walker.getConvertedSimpleKeys());
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelImpl.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelImpl.java 2010-12-16 21:35:18 UTC (rev 20628)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelImpl.java 2010-12-16 22:32:17 UTC (rev 20629)
@@ -24,6 +24,7 @@
import java.util.Iterator;
import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import org.richfaces.component.AbstractTree;
@@ -90,7 +91,7 @@
this.currentComponent = tree;
if (key != null) {
- DeclarativeTreeDataModelWalker walker = new DeclarativeTreeDataModelWalker(tree);
+ DeclarativeTreeDataModelWalker walker = new DeclarativeTreeDataModelWalker(FacesContext.getCurrentInstance(), tree);
walker.walk(key);
setRowKeyAndData(key, walker.getData());
14 years
JBoss Rich Faces SVN: r20628 - branches/enterprise.
by richfaces-svn-commits@lists.jboss.org
Author: jbalunas(a)redhat.com
Date: 2010-12-16 16:35:18 -0500 (Thu, 16 Dec 2010)
New Revision: 20628
Added:
branches/enterprise/3.3.1.SP2_RFPL-967/
Log:
Crated branch for one off patch
Copied: branches/enterprise/3.3.1.SP2_RFPL-967 (from rev 20627, tags/3.3.1.SP2)
14 years