JBoss Rich Faces SVN: r19103 - in modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest: a4jStatus and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-09-02 23:53:33 -0400 (Thu, 02 Sep 2010)
New Revision: 19103
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/annotations/IssueTracking.java
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MetamerFailureLoggingTestListener.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestInstantAttributes.java
Log:
introduced principle of issue tracking
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MetamerFailureLoggingTestListener.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MetamerFailureLoggingTestListener.java 2010-09-03 03:07:09 UTC (rev 19102)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MetamerFailureLoggingTestListener.java 2010-09-03 03:53:33 UTC (rev 19103)
@@ -21,7 +21,13 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest;
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.StringUtils;
import org.jboss.test.selenium.listener.FailureLoggingTestListener;
+import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
import org.testng.ITestResult;
/**
@@ -39,4 +45,20 @@
String id = super.getSeleniumLogIdentification(result);
return id + " " + MetamerTestInfo.getConfigurationInfoInParenthesses();
}
+
+ @Override
+ protected void onFailure(ITestResult result) {
+ super.onFailure(result);
+ IssueTracking issueTracking = result.getMethod().getMethod().getAnnotation(IssueTracking.class);
+ if (issueTracking != null && issueTracking.value().length > 0) {
+ String issues = StringUtils.join(issueTracking.value(), "\n");
+ String filenameIdentification = getFilenameIdentification(result);
+ File issueTrackingOutputFile = new File(failuresOutputDir, filenameIdentification + "/issues.txt");
+ try {
+ FileUtils.writeStringToFile(issueTrackingOutputFile, issues);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestInstantAttributes.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestInstantAttributes.java 2010-09-03 03:07:09 UTC (rev 19102)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestInstantAttributes.java 2010-09-03 03:53:33 UTC (rev 19103)
@@ -30,6 +30,7 @@
import org.jboss.test.selenium.encapsulated.JavaScript;
import org.jboss.test.selenium.locator.ElementLocator;
+import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -74,6 +75,8 @@
}
@Test
+ @IssueTracking({ "https://jira.jboss.org/browse/RF-9118",
+ "https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=1788" })
public void testOnError() {
for (int i = 0; i < 2; i++) {
attributes.setOnError(alert.parametrize("error" + i));
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/annotations/IssueTracking.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/annotations/IssueTracking.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/annotations/IssueTracking.java 2010-09-03 03:53:33 UTC (rev 19103)
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * 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.ftest.annotations;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import static java.lang.annotation.ElementType.*;
+
+/**
+ * @author <a href="mailto:ppitonak@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+@Target({ METHOD })
+(a)Retention(RetentionPolicy.RUNTIME)
+public @interface IssueTracking {
+ String[] value() default "";
+}
14 years, 3 months
JBoss Rich Faces SVN: r19102 - in modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest: richDataScroller and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-09-02 23:07:09 -0400 (Thu, 02 Sep 2010)
New Revision: 19102
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataScroller/AbstractScrollerTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataScroller/TestScrollerInTableFooter.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataScroller/TestScrollerOutsideTable.java
Removed:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataScroller/TestPagination.java
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/AbstractScrollerTest.java
Log:
fixed tests for iteration components which can't be controlled by scroller outside of another iteration component (rich:dataScroller tests)
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/AbstractScrollerTest.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/AbstractScrollerTest.java 2010-09-03 02:51:06 UTC (rev 19101)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/AbstractScrollerTest.java 2010-09-03 03:07:09 UTC (rev 19102)
@@ -39,7 +39,7 @@
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
* @version $Revision$
*/
-@Uses({ @Use(field = "elements", ints = 7), @Use(field = "dataScroller", value = "dataScroller2") })
+@Use(field = "elements", ints = 7)
public abstract class AbstractScrollerTest extends AbstractDataGridTest {
@Inject
@@ -79,26 +79,18 @@
return buildUrl(contextPath, "faces/components/richDataGrid/scroller.xhtml");
}
- // @Test
- // @Use(field = "columns", ints = { 1, 3, 11, ELEMENTS_TOTAL / 2, ELEMENTS_TOTAL - 1, ELEMENTS_TOTAL,
- // ELEMENTS_TOTAL + 1 })
- @Use(field = "columns", ints = { 3 })
+ @Use(field = "columns", ints = { 1, 3, 11, ELEMENTS_TOTAL / 2, ELEMENTS_TOTAL - 1, ELEMENTS_TOTAL,
+ ELEMENTS_TOTAL + 1 })
public void testColumnsAttribute() {
paginationTester.testNumberedPages();
}
- // @Test
- // @Use(field = "elements", ints = { 0, 1, ELEMENTS_TOTAL / 2, ELEMENTS_TOTAL - 1, ELEMENTS_TOTAL, ELEMENTS_TOTAL +
- // 1 })
- @Use(field = "elements", ints = { 3 })
+ @Use(field = "elements", ints = { 0, 1, ELEMENTS_TOTAL / 2, ELEMENTS_TOTAL - 1, ELEMENTS_TOTAL, ELEMENTS_TOTAL + 1 })
public void testElementsAttribute() {
paginationTester.testNumberedPages();
}
- // @Test
- // @Use(field = "first", ints = { 0, 1, ELEMENTS_TOTAL / 2, ELEMENTS_TOTAL - 1, ELEMENTS_TOTAL, ELEMENTS_TOTAL + 1
- // })
- @Use(field = "first", ints = { 3 })
+ @Use(field = "first", ints = { 0, 1, ELEMENTS_TOTAL / 2, ELEMENTS_TOTAL - 1, ELEMENTS_TOTAL, ELEMENTS_TOTAL + 1 })
public void testFirstAttributeDoesntInfluentScroller() {
// the attribute for component was already set, now verify that this attribute doesn't influent rendering (it
// means dataGrid with scroller ignores this attribute, it means it is always equal to zero)
Copied: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataScroller/AbstractScrollerTest.java (from rev 19087, modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataScroller/TestPagination.java)
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataScroller/AbstractScrollerTest.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataScroller/AbstractScrollerTest.java 2010-09-03 03:07:09 UTC (rev 19102)
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * 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.ftest.richDataScroller;
+
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardHttp;
+import static org.jboss.test.selenium.locator.LocatorFactory.id;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.locator.IdLocator;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.richfaces.tests.metamer.ftest.annotations.Inject;
+import org.richfaces.tests.metamer.ftest.annotations.Use;
+import org.richfaces.tests.metamer.ftest.model.DataScroller;
+import org.richfaces.tests.metamer.ftest.model.DataTable;
+import org.testng.annotations.BeforeMethod;
+
+/**
+ * Test the functionality of switching pages using DataScroller bound to DataTable.
+ *
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public abstract class AbstractScrollerTest extends AbstractMetamerTest {
+
+ @Inject
+ @Use(ints = { 2, 3 })
+ int fastStep;
+
+ @Inject
+ @Use(ints = { 3, 4 })
+ int maxPages;
+
+ @Inject
+ DataScroller dataScroller;
+ DataScroller dataScroller1 = PaginationTester.DATA_SCROLLER_OUTSIDE_TABLE;
+ DataScroller dataScroller2 = PaginationTester.DATA_SCROLLER_IN_TABLE_FOOTER;
+
+ PaginationTester paginationTester = new PaginationTester() {
+
+ @Override
+ protected void verifyBeforeScrolling() {
+ tableText = dataTable.getTableText();
+ }
+
+ @Override
+ protected void verifyAfterScrolling() {
+ assertFalse(tableText.equals(dataTable.getTableText()));
+ assertEquals(maxPages, dataScroller.getCountOfVisiblePages());
+ }
+ };
+
+ IdLocator attributeFastStep = id("form:attributes:fastStepInput");
+ IdLocator attributeMaxPages = id("form:attributes:maxPagesInput");
+
+ DataTable dataTable = new DataTable(pjq("table.rf-dt[id$=richDataTable]"));
+
+ String tableText;
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/richDataScroller/simple.xhtml");
+ }
+
+ @BeforeMethod
+ public void prepareComponent() {
+ guardHttp(selenium).type(attributeFastStep, String.valueOf(fastStep));
+ guardHttp(selenium).type(attributeMaxPages, String.valueOf(maxPages));
+
+ paginationTester.setDataScroller(dataScroller);
+ dataScroller.setFastStep(fastStep);
+
+ int lastPage = dataScroller.obtainLastPage();
+ dataScroller.setLastPage(lastPage);
+ paginationTester.initializeTestedPages(lastPage);
+ }
+
+ public void testNumberedPages() {
+ paginationTester.testNumberedPages();
+ }
+}
Deleted: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataScroller/TestPagination.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataScroller/TestPagination.java 2010-09-03 02:51:06 UTC (rev 19101)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataScroller/TestPagination.java 2010-09-03 03:07:09 UTC (rev 19102)
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * 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.ftest.richDataScroller;
-
-import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardHttp;
-import static org.jboss.test.selenium.locator.LocatorFactory.id;
-import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-
-import java.net.URL;
-
-import org.jboss.test.selenium.locator.IdLocator;
-import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
-import org.richfaces.tests.metamer.ftest.annotations.Inject;
-import org.richfaces.tests.metamer.ftest.annotations.Use;
-import org.richfaces.tests.metamer.ftest.model.DataScroller;
-import org.richfaces.tests.metamer.ftest.model.DataTable;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-/**
- * Test the functionality of switching pages using DataScroller bound to DataTable.
- *
- * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
- * @version $Revision$
- */
-public class TestPagination extends AbstractMetamerTest {
-
- @Inject
- @Use(ints = { 2, 3 })
- int fastStep;
-
- @Inject
- @Use(ints = { 3, 4 })
- int maxPages;
-
- @Inject
- @Use("dataScroller*")
- DataScroller dataScroller;
- DataScroller dataScroller1 = PaginationTester.DATA_SCROLLER_OUTSIDE_TABLE;
- DataScroller dataScroller2 = PaginationTester.DATA_SCROLLER_IN_TABLE_FOOTER;
-
- PaginationTester paginationTester = new PaginationTester() {
-
- @Override
- protected void verifyBeforeScrolling() {
- tableText = dataTable.getTableText();
- }
-
- @Override
- protected void verifyAfterScrolling() {
- assertFalse(tableText.equals(dataTable.getTableText()));
- assertEquals(maxPages, dataScroller.getCountOfVisiblePages());
- }
- };
-
- IdLocator attributeFastStep = id("form:attributes:fastStepInput");
- IdLocator attributeMaxPages = id("form:attributes:maxPagesInput");
-
- DataTable dataTable = new DataTable(pjq("table.rf-dt[id$=richDataTable]"));
-
- String tableText;
-
- @Override
- public URL getTestUrl() {
- return buildUrl(contextPath, "faces/components/richDataScroller/simple.xhtml");
- }
-
- @BeforeMethod
- public void prepareComponent() {
- guardHttp(selenium).type(attributeFastStep, String.valueOf(fastStep));
- guardHttp(selenium).type(attributeMaxPages, String.valueOf(maxPages));
-
- paginationTester.setDataScroller(dataScroller);
- dataScroller.setFastStep(fastStep);
-
- int lastPage = dataScroller.obtainLastPage();
- dataScroller.setLastPage(lastPage);
- paginationTester.initializeTestedPages(lastPage);
- }
-
- @Test
- public void testNumberedPages() {
- paginationTester.testNumberedPages();
- }
-}
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataScroller/TestScrollerInTableFooter.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataScroller/TestScrollerInTableFooter.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataScroller/TestScrollerInTableFooter.java 2010-09-03 03:07:09 UTC (rev 19102)
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * 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.ftest.richDataScroller;
+
+import javax.xml.bind.JAXBException;
+
+import org.richfaces.tests.metamer.ftest.annotations.Use;
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+@Use(field = "dataScroller", value = "dataScroller2")
+public class TestScrollerInTableFooter extends AbstractScrollerTest {
+
+ public TestScrollerInTableFooter() throws JAXBException {
+ }
+
+ @Test
+ public void testNumberedPages() {
+ super.testNumberedPages();
+ }
+}
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataScroller/TestScrollerOutsideTable.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataScroller/TestScrollerOutsideTable.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataScroller/TestScrollerOutsideTable.java 2010-09-03 03:07:09 UTC (rev 19102)
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * 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.ftest.richDataScroller;
+
+import javax.xml.bind.JAXBException;
+
+import org.richfaces.tests.metamer.ftest.annotations.Templates;
+import org.richfaces.tests.metamer.ftest.annotations.Use;
+import org.testng.annotations.Test;
+
+/**
+ * <p>
+ * Templates: doesn't work inside iteration components.
+ * </p>
+ *
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+@Use(field = "dataScroller", value = "dataScroller1")
+@Templates(exclude = { "a4jRepeat1", "a4jRepeat2", "hDataTable1", "hDataTable2", "richDataTable1,redDiv",
+ "richDataTable2,redDiv", "uiRepeat1", "uiRepeat2" })
+public class TestScrollerOutsideTable extends AbstractScrollerTest {
+
+ public TestScrollerOutsideTable() throws JAXBException {
+ }
+
+ @Test
+ @Override
+ public void testNumberedPages() {
+ super.testNumberedPages();
+ }
+}
14 years, 3 months
JBoss Rich Faces SVN: r19101 - in modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest: richExtendedDataTable and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-09-02 22:51:06 -0400 (Thu, 02 Sep 2010)
New Revision: 19101
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/TestScrollerOutsideTable.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/TestScroller.java
Log:
fixed tests for iteration components which can't be controlled by scroller outside of another iteration component
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/TestScrollerOutsideTable.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/TestScrollerOutsideTable.java 2010-09-02 16:57:55 UTC (rev 19100)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/TestScrollerOutsideTable.java 2010-09-03 02:51:06 UTC (rev 19101)
@@ -28,11 +28,16 @@
import org.testng.annotations.Test;
/**
+ * <p>
+ * Templates: doesn't work inside iteration components.
+ * </p>
+ *
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
* @version $Revision$
*/
@Use(field = "dataScroller", value = "dataScroller1")
-@Templates(value = "plain")
+@Templates(exclude = { "a4jRepeat1", "a4jRepeat2", "hDataTable1", "hDataTable2", "richDataTable1,redDiv",
+ "richDataTable2,redDiv", "uiRepeat1", "uiRepeat2" })
public class TestScrollerOutsideTable extends AbstractScrollerTest {
public TestScrollerOutsideTable() throws JAXBException {
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/TestScroller.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/TestScroller.java 2010-09-02 16:57:55 UTC (rev 19100)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/TestScroller.java 2010-09-03 02:51:06 UTC (rev 19101)
@@ -29,6 +29,7 @@
import org.jboss.test.selenium.locator.IdLocator;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.richfaces.tests.metamer.ftest.annotations.Templates;
import org.richfaces.tests.metamer.ftest.model.AssertingDataScroller;
import org.richfaces.tests.metamer.ftest.model.DataScroller;
import org.richfaces.tests.metamer.ftest.model.DataTable;
@@ -66,11 +67,19 @@
}
/**
+ * <p>
* Tests row count for scroller outside of the EDT.
+ * </p>
*
+ * <p>
+ * Templates: doesn't work inside iteration components.
+ * </p>
+ *
* @see {@link #testRowCount(DataScroller)}
*/
@Test
+ @Templates(exclude = { "a4jRepeat1", "a4jRepeat2", "hDataTable1", "hDataTable2", "richDataTable1,redDiv",
+ "richDataTable2,redDiv", "uiRepeat1", "uiRepeat2" })
public void testRowCountOutsideTable() {
testRowCount(dataScroller1);
}
14 years, 3 months
JBoss Rich Faces SVN: r19100 - in trunk: ui/input/ui/src/main/java/org/richfaces/component and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2010-09-02 12:57:55 -0400 (Thu, 02 Sep 2010)
New Revision: 19100
Modified:
trunk/examples/input-demo/src/main/webapp/autocomplete.xhtml
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js
Log:
https://jira.jboss.org/browse/RF-9106
Modified: trunk/examples/input-demo/src/main/webapp/autocomplete.xhtml
===================================================================
--- trunk/examples/input-demo/src/main/webapp/autocomplete.xhtml 2010-09-02 15:13:52 UTC (rev 19099)
+++ trunk/examples/input-demo/src/main/webapp/autocomplete.xhtml 2010-09-02 16:57:55 UTC (rev 19100)
@@ -23,7 +23,7 @@
block text block text block text block text block text block text
block text block
- <input:autocomplete mode="#{autoCompleteBean.mode}" minChars="2" autocompleteMethod="#{autoCompleteBean.autocomplete}" var="country" fetchValue="#{country.name}" showButton="true">
+ <input:autocomplete clientFilter="if(subString.length>1) if(value.indexOf(subString)!=-1) return true;" mode="#{autoCompleteBean.mode}" minChars="2" autocompleteMethod="#{autoCompleteBean.autocomplete}" var="country" fetchValue="#{country.name}" showButton="true">
#{country.name} #{country.iso} #{country.domain}
</input:autocomplete>
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java 2010-09-02 15:13:52 UTC (rev 19099)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java 2010-09-02 16:57:55 UTC (rev 19100)
@@ -195,6 +195,9 @@
@Attribute(events = @EventName("beforedomupdate"))
public abstract String getOnbeforedomupdate();
+
+ @Attribute
+ public abstract String getClientFilter();
@Override
public Converter getConverter() {
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java 2010-09-02 15:13:52 UTC (rev 19099)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java 2010-09-02 16:57:55 UTC (rev 19100)
@@ -46,6 +46,7 @@
import javax.servlet.jsp.jstl.sql.Result;
import org.ajax4jsf.context.AjaxContext;
+import org.ajax4jsf.javascript.JSFunctionDefinition;
import org.ajax4jsf.javascript.ScriptUtils;
import org.ajax4jsf.renderkit.RendererUtils;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
@@ -72,6 +73,19 @@
})
public abstract class AutocompleteRendererBase extends InputRendererBase implements MetaComponentRenderer {
+ public JSFunctionDefinition getClientFilterFunction(UIComponent component) {
+ AbstractAutocomplete autocomplete = (AbstractAutocomplete) component;
+ String clientFilter = (String)autocomplete.getAttributes().get("clientFilter");
+ if (clientFilter != null && clientFilter.length() != 0) {
+ JSFunctionDefinition clientFilterFunction = new JSFunctionDefinition("subString");
+ clientFilterFunction.addParameter("value");
+ clientFilterFunction.addToBody(clientFilter);
+ return clientFilterFunction;
+ }
+
+ return null;
+ }
+
public String getScriptOptions(UIComponent component) {
Map<String, Object> attributes = component.getAttributes();
Map<String, Object> options = new HashMap<String, Object>();
@@ -89,6 +103,7 @@
utils.addToScriptHash(options, "onerror", attributes.get("onerror"));
utils.addToScriptHash(options, "onbeforedomupdate", attributes.get("onbeforedomupdate"));
utils.addToScriptHash(options, "onchange", attributes.get("onchange"));
+ utils.addToScriptHash(options, "filterFunction", getClientFilterFunction(component));
String mode = (String)attributes.get("mode");
if (mode != null) {
if (mode.equals("ajax")){
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js 2010-09-02 15:13:52 UTC (rev 19099)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js 2010-09-02 16:57:55 UTC (rev 19100)
@@ -29,7 +29,7 @@
return result;
}
- var getItems = function (key) {
+ var getItems = function (key, filterFunction) {
key = key.toLowerCase();
var newCache = [];
@@ -40,12 +40,17 @@
if (this.cache[key]) {
newCache = this.cache[key];
} else {
+ var useCustomFilterFunction = typeof filterFunction == "function";
var itemsCache = this.cache[this.key];
for (var i = 0; i<this.values.length; i++) {
var value = this.values[i];
- var p = value.indexOf(key);
- if (p == 0) {
+ if (useCustomFilterFunction && filterFunction(key, value)) {
newCache.push(itemsCache[i]);
+ } else {
+ var p = value.indexOf(key);
+ if (p == 0) {
+ newCache.push(itemsCache[i]);
+ }
}
}
@@ -119,7 +124,8 @@
lazyClientMode:false,
isCachedAjax:true,
tokens: "",
- attachToBody:true
+ attachToBody:true,
+ filterFunction: undefined
};
var ID = {
@@ -274,7 +280,7 @@
};
var updateItemsFromCache = function (value) {
- var newItems = this.cache.getItems(value);
+ var newItems = this.cache.getItems(value, this.options.filterFunction);
this.items = $(newItems);
//TODO: works only with simple markup, not with <tr>
$(rf.getDomElement(this.id+ID.ITEMS)).empty().append(this.items);
14 years, 3 months
JBoss Rich Faces SVN: r19099 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-09-02 11:13:52 -0400 (Thu, 02 Sep 2010)
New Revision: 19099
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/AbstractScrollerTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/TestScrollerInTableFooter.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/TestScrollerOutsideTable.java
Removed:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/TestPagination.java
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/AbstractDataGridTest.java
Log:
fixed rich:dataGrid tests (incl. RFPL-752)
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/AbstractDataGridTest.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/AbstractDataGridTest.java 2010-09-02 15:12:44 UTC (rev 19098)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/AbstractDataGridTest.java 2010-09-02 15:13:52 UTC (rev 19099)
@@ -158,7 +158,7 @@
}
expectedRows = ceil((float) expectedElements / columns);
- expectedColumns = columns;
+ expectedColumns = Math.min(columns, expectedElements);
}
private Iterator<Capital> getExpectedCapitalsIterator() {
Copied: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/AbstractScrollerTest.java (from rev 19087, modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/TestPagination.java)
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/AbstractScrollerTest.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/AbstractScrollerTest.java 2010-09-02 15:13:52 UTC (rev 19099)
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * 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.ftest.richDataGrid;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+
+import java.net.URL;
+
+import javax.xml.bind.JAXBException;
+
+import org.richfaces.tests.metamer.ftest.annotations.Inject;
+import org.richfaces.tests.metamer.ftest.annotations.Use;
+import org.richfaces.tests.metamer.ftest.annotations.Uses;
+import org.richfaces.tests.metamer.ftest.model.DataScroller;
+import org.richfaces.tests.metamer.ftest.richDataScroller.PaginationTester;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+@Uses({ @Use(field = "elements", ints = 7), @Use(field = "dataScroller", value = "dataScroller2") })
+public abstract class AbstractScrollerTest extends AbstractDataGridTest {
+
+ @Inject
+ DataScroller dataScroller;
+ DataScroller dataScroller1 = PaginationTester.DATA_SCROLLER_OUTSIDE_TABLE;
+ DataScroller dataScroller2 = PaginationTester.DATA_SCROLLER_IN_TABLE_FOOTER;
+
+ PaginationTester paginationTester = new PaginationTester() {
+
+ @Override
+ protected void verifyBeforeScrolling() {
+ }
+
+ @Override
+ protected void verifyAfterScrolling() {
+ page = dataScroller.getCurrentPage();
+ lastPage = dataScroller.getLastPage();
+ verifyGrid();
+ }
+ };
+
+ public AbstractScrollerTest() throws JAXBException {
+ super();
+ }
+
+ @BeforeMethod
+ public void setupDataScroller() {
+ paginationTester.setDataScroller(dataScroller);
+
+ int lastPage = dataScroller.obtainLastPage();
+ dataScroller.setLastPage(lastPage);
+ paginationTester.initializeTestedPages(lastPage);
+ }
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/richDataGrid/scroller.xhtml");
+ }
+
+ // @Test
+ // @Use(field = "columns", ints = { 1, 3, 11, ELEMENTS_TOTAL / 2, ELEMENTS_TOTAL - 1, ELEMENTS_TOTAL,
+ // ELEMENTS_TOTAL + 1 })
+ @Use(field = "columns", ints = { 3 })
+ public void testColumnsAttribute() {
+ paginationTester.testNumberedPages();
+ }
+
+ // @Test
+ // @Use(field = "elements", ints = { 0, 1, ELEMENTS_TOTAL / 2, ELEMENTS_TOTAL - 1, ELEMENTS_TOTAL, ELEMENTS_TOTAL +
+ // 1 })
+ @Use(field = "elements", ints = { 3 })
+ public void testElementsAttribute() {
+ paginationTester.testNumberedPages();
+ }
+
+ // @Test
+ // @Use(field = "first", ints = { 0, 1, ELEMENTS_TOTAL / 2, ELEMENTS_TOTAL - 1, ELEMENTS_TOTAL, ELEMENTS_TOTAL + 1
+ // })
+ @Use(field = "first", ints = { 3 })
+ public void testFirstAttributeDoesntInfluentScroller() {
+ // the attribute for component was already set, now verify that this attribute doesn't influent rendering (it
+ // means dataGrid with scroller ignores this attribute, it means it is always equal to zero)
+ first = 0;
+ paginationTester.testNumberedPages();
+ }
+}
Deleted: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/TestPagination.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/TestPagination.java 2010-09-02 15:12:44 UTC (rev 19098)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/TestPagination.java 2010-09-02 15:13:52 UTC (rev 19099)
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * 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.ftest.richDataGrid;
-
-import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
-
-import java.net.URL;
-
-import javax.xml.bind.JAXBException;
-
-import org.richfaces.tests.metamer.ftest.annotations.Inject;
-import org.richfaces.tests.metamer.ftest.annotations.Use;
-import org.richfaces.tests.metamer.ftest.model.DataScroller;
-import org.richfaces.tests.metamer.ftest.richDataScroller.PaginationTester;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-/**
- * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
- * @version $Revision$
- */
-@Use(field = "elements", ints = 7)
-public class TestPagination extends AbstractDataGridTest {
-
- @Inject
- @Use("dataScroller*")
- DataScroller dataScroller;
- DataScroller dataScroller1 = PaginationTester.DATA_SCROLLER_OUTSIDE_TABLE;
- DataScroller dataScroller2 = PaginationTester.DATA_SCROLLER_IN_TABLE_FOOTER;
-
- PaginationTester paginationTester = new PaginationTester() {
-
- @Override
- protected void verifyBeforeScrolling() {
- }
-
- @Override
- protected void verifyAfterScrolling() {
- page = dataScroller.getCurrentPage();
- lastPage = dataScroller.getLastPage();
- verifyGrid();
- }
- };
-
- public TestPagination() throws JAXBException {
- super();
- }
-
- @BeforeMethod
- public void setupDataScroller() {
- paginationTester.setDataScroller(dataScroller);
-
- int lastPage = dataScroller.obtainLastPage();
- dataScroller.setLastPage(lastPage);
- paginationTester.initializeTestedPages(lastPage);
- }
-
- @Override
- public URL getTestUrl() {
- return buildUrl(contextPath, "faces/components/richDataGrid/scroller.xhtml");
- }
-
- @Test
- @Use(field = "columns", ints = { 1, 3, 11, ELEMENTS_TOTAL / 2, ELEMENTS_TOTAL - 1, ELEMENTS_TOTAL,
- ELEMENTS_TOTAL + 1 })
- public void testColumnsAttribute() {
- paginationTester.testNumberedPages();
- }
-
- @Test
- @Use(field = "elements", ints = { 0, 1, ELEMENTS_TOTAL / 2, ELEMENTS_TOTAL - 1, ELEMENTS_TOTAL, ELEMENTS_TOTAL + 1 })
- public void testElementsAttribute() {
- paginationTester.testNumberedPages();
- }
-
- @Test
- @Use(field = "first", ints = { 0, 1, ELEMENTS_TOTAL / 2, ELEMENTS_TOTAL - 1, ELEMENTS_TOTAL, ELEMENTS_TOTAL + 1 })
- public void testFirstAttribute() {
- paginationTester.testNumberedPages();
- }
-}
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/TestScrollerInTableFooter.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/TestScrollerInTableFooter.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/TestScrollerInTableFooter.java 2010-09-02 15:13:52 UTC (rev 19099)
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * 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.ftest.richDataGrid;
+
+import javax.xml.bind.JAXBException;
+
+import org.richfaces.tests.metamer.ftest.annotations.Templates;
+import org.richfaces.tests.metamer.ftest.annotations.Use;
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+@Use(field = "dataScroller", value = "dataScroller2")
+public class TestScrollerInTableFooter extends AbstractScrollerTest {
+
+ public TestScrollerInTableFooter() throws JAXBException {
+ }
+
+ @Test
+ @Override
+ public void testColumnsAttribute() {
+ super.testColumnsAttribute();
+ }
+
+ @Test
+ @Override
+ public void testElementsAttribute() {
+ super.testElementsAttribute();
+ }
+
+ @Test
+ @Override
+ public void testFirstAttributeDoesntInfluentScroller() {
+ super.testFirstAttributeDoesntInfluentScroller();
+ }
+}
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/TestScrollerOutsideTable.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/TestScrollerOutsideTable.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataGrid/TestScrollerOutsideTable.java 2010-09-02 15:13:52 UTC (rev 19099)
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * 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.ftest.richDataGrid;
+
+import javax.xml.bind.JAXBException;
+
+import org.richfaces.tests.metamer.ftest.annotations.Templates;
+import org.richfaces.tests.metamer.ftest.annotations.Use;
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+@Use(field = "dataScroller", value = "dataScroller1")
+@Templates(value = "plain")
+public class TestScrollerOutsideTable extends AbstractScrollerTest {
+
+ public TestScrollerOutsideTable() throws JAXBException {
+ }
+
+ @Test
+ @Override
+ public void testColumnsAttribute() {
+ super.testColumnsAttribute();
+ }
+
+ @Test
+ @Override
+ public void testElementsAttribute() {
+ super.testElementsAttribute();
+ }
+
+ @Test
+ @Override
+ public void testFirstAttributeDoesntInfluentScroller() {
+ super.testFirstAttributeDoesntInfluentScroller();
+ }
+}
14 years, 3 months
JBoss Rich Faces SVN: r19098 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-09-02 11:12:44 -0400 (Thu, 02 Sep 2010)
New Revision: 19098
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java
Log:
removed 'Optimization for skipping all subsequent test method invocations, if the method failed for plan template.' (it caused skipping too much matrix configured methods)
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java 2010-09-02 14:37:25 UTC (rev 19097)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java 2010-09-02 15:12:44 UTC (rev 19098)
@@ -83,18 +83,6 @@
}
/**
- * Optimization for skipping all subsequent test method invocations, if the method failed for plan template.
- */
- @AfterMethod(alwaysRun = true)
- public void skipAllAfterPlainTemplateFailure(ITestResult result) {
- if (template.size() == 1 && template.get(0) == Template.PLAIN) {
- if (result.getStatus() == ITestResult.FAILURE) {
- result.getMethod().setSkipFailedInvocations(true);
- }
- }
- }
-
- /**
* Invalidates session by clicking on a button on tested page.
*/
@AfterMethod(alwaysRun = true)
14 years, 3 months
JBoss Rich Faces SVN: r19097 - in trunk: examples/output-demo/src/main/webapp/qunit and 5 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-09-02 10:37:25 -0400 (Thu, 02 Sep 2010)
New Revision: 19097
Modified:
trunk/examples/output-demo/src/main/webapp/examples/collapsiblePanel.xhtml
trunk/examples/output-demo/src/main/webapp/qunit/accordionHeaders.xhtml
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractCollapsiblePanel.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlCollapsiblePanel.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java
trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js
Log:
RF-9274 Accordion rendered wrong in IE8
Modified: trunk/examples/output-demo/src/main/webapp/examples/collapsiblePanel.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/examples/collapsiblePanel.xhtml 2010-09-02 13:15:31 UTC (rev 19096)
+++ trunk/examples/output-demo/src/main/webapp/examples/collapsiblePanel.xhtml 2010-09-02 14:37:25 UTC (rev 19097)
@@ -28,15 +28,6 @@
</pn:collapsiblePanel>
</h:form>
-
- <p>Result</p>
- <div>
- <ol id="qunit-tests"></ol>
-
- <div id="testDiv" style="margin-top:10px; border:1px solid #a0a0a0">Main Test Div</div>
-
- </div>
- <h:outputScript name="tests/richfaces-collapsible-panel-qunit.js" />
</ui:define>
</ui:composition>
</body>
Modified: trunk/examples/output-demo/src/main/webapp/qunit/accordionHeaders.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/qunit/accordionHeaders.xhtml 2010-09-02 13:15:31 UTC (rev 19096)
+++ trunk/examples/output-demo/src/main/webapp/qunit/accordionHeaders.xhtml 2010-09-02 14:37:25 UTC (rev 19097)
@@ -42,6 +42,27 @@
content 3
</pn:accordionItem>
</pn:accordion>
+
+ <h:outputLink>
+ <pn:toggleControl targetPanel="panel" targetItem="@first" event="click"/>
+ |< first
+ </h:outputLink>
+ |
+ <h:outputLink>
+ <pn:toggleControl targetPanel="panel" targetItem="@prev" event="click"/>
+ <- prev
+ </h:outputLink>
+ |
+ <h:outputLink>
+ <pn:toggleControl targetPanel="panel" targetItem="@next" event="click"/>
+ next ->
+ </h:outputLink>
+ |
+ <h:outputLink>
+ <pn:toggleControl targetPanel="panel" targetItem="@last" event="click"/>
+ last >|
+ </h:outputLink>
+
</h:form>
<p>Result</p>
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractCollapsiblePanel.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractCollapsiblePanel.java 2010-09-02 13:15:31 UTC (rev 19096)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractCollapsiblePanel.java 2010-09-02 14:37:25 UTC (rev 19097)
@@ -22,12 +22,15 @@
package org.richfaces.component;
+import org.richfaces.event.ChangeExpandEvent;
+import org.richfaces.event.ChangeExpandListener;
+import org.richfaces.event.ChangeExpandSource;
+import org.richfaces.event.ItemChangeEvent;
+
import javax.el.MethodExpression;
import javax.faces.component.UIComponent;
+import javax.faces.event.FacesEvent;
-import org.richfaces.event.ChangeExpandSource;
-import org.richfaces.event.ChangeExpandListener;
-
/**
* @author akolonitsky
* @since 2010-08-27
@@ -81,9 +84,18 @@
public abstract MethodExpression getChangeExpandListener();
-
+ @Override
+ public void queueEvent(FacesEvent facesEvent) {
+ ChangeExpandEvent event = null;
+ if ((facesEvent instanceof ItemChangeEvent) && (facesEvent.getComponent() == this)) {
+ event = new ChangeExpandEvent(this, Boolean.valueOf(((ItemChangeEvent) facesEvent).getNewItem()));
+ setEventPhase(event);
+ }
+ super.queueEvent(event != null ? event : facesEvent);
+ }
+
// ------------------------------------------------ Event Processing Methods
public void addChangeExpandListener(ChangeExpandListener listener) {
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java 2010-09-02 13:15:31 UTC (rev 19096)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java 2010-09-02 14:37:25 UTC (rev 19097)
@@ -383,18 +383,23 @@
@Override
public void queueEvent(FacesEvent event) {
if ((event instanceof ItemChangeEvent) && (event.getComponent() == this)) {
- if (isImmediate()) {
- event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
- } else if (isBypassUpdates()) {
- event.setPhaseId(PhaseId.PROCESS_VALIDATIONS);
- } else {
- event.setPhaseId(PhaseId.INVOKE_APPLICATION);
- }
+ setEventPhase(event);
}
super.queueEvent(event);
}
+ protected void setEventPhase(FacesEvent event) {
+ if (isImmediate()) {
+ event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
+ } else if (isBypassUpdates()) {
+ event.setPhaseId(PhaseId.PROCESS_VALIDATIONS);
+ } else {
+ event.setPhaseId(PhaseId.INVOKE_APPLICATION);
+ }
+ }
+
+
@Override
public void broadcast(FacesEvent event) throws AbortProcessingException {
super.broadcast(event);
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlCollapsiblePanel.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlCollapsiblePanel.java 2010-09-02 13:15:31 UTC (rev 19096)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlCollapsiblePanel.java 2010-09-02 14:37:25 UTC (rev 19097)
@@ -40,8 +40,8 @@
public static final String COMPONENT_FAMILY = "org.richfaces.CollapsiblePanel";
private static final Collection<String> EVENT_NAMES = Collections.unmodifiableCollection(Arrays.asList(
- "onswitch",
- "onbeforeswitch",
+ "switch",
+ "beforeswitch",
"click",
"dblclick",
"mousedown",
@@ -58,8 +58,8 @@
headerControlClass,
oncomplete,
onbeforedomupdate,
- ononswitch,
- ononbeforeswitch,
+ onswitch,
+ onbeforeswitch,
lang,
title,
style,
@@ -123,20 +123,20 @@
getStateHelper().put(PropertyKeys.onbeforedomupdate, onbeforedomupdate);
}
- public String getOnonswitch() {
- return (String) getStateHelper().eval(PropertyKeys.ononswitch);
+ public String getOnswitch() {
+ return (String) getStateHelper().eval(PropertyKeys.onswitch);
}
- public void setOnonswitch(String ononswitch) {
- getStateHelper().put(PropertyKeys.ononswitch, ononswitch);
+ public void setOnswitch(String onswitch) {
+ getStateHelper().put(PropertyKeys.onswitch, onswitch);
}
- public String getOnonbeforeswitch() {
- return (String) getStateHelper().eval(PropertyKeys.ononbeforeswitch);
+ public String getOnbeforeswitch() {
+ return (String) getStateHelper().eval(PropertyKeys.onbeforeswitch);
}
- public void setOnonbeforeswitch(String ononbeforeswitch) {
- getStateHelper().put(PropertyKeys.ononbeforeswitch, ononbeforeswitch);
+ public void setOnbeforeswitch(String onbeforeswitch) {
+ getStateHelper().put(PropertyKeys.onbeforeswitch, onbeforeswitch);
}
public String getLang() {
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2010-09-02 13:15:31 UTC (rev 19096)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2010-09-02 14:37:25 UTC (rev 19097)
@@ -159,7 +159,7 @@
HandlersChain handlersChain = new HandlersChain(context, component);
handlersChain.addInlineHandlerFromAttribute(ON + eventName);
handlersChain.addBehaviors(eventName);
- handlersChain.addAjaxSubmitFunction();
+// handlersChain.addAjaxSubmitFunction();
String handler = handlersChain.toScript();
if (handler != null) {
Modified: trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml 2010-09-02 13:15:31 UTC (rev 19096)
+++ trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml 2010-09-02 14:37:25 UTC (rev 19097)
@@ -132,12 +132,12 @@
</attribute>
<attribute>
<description></description>
- <name>ononswitch</name>
+ <name>onswitch</name>
<type>java.lang.String</type>
</attribute>
<attribute>
<description></description>
- <name>ononbeforeswitch</name>
+ <name>onbeforeswitch</name>
<type>java.lang.String</type>
</attribute>
<attribute>
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js 2010-09-02 13:15:31 UTC (rev 19096)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js 2010-09-02 14:37:25 UTC (rev 19097)
@@ -41,7 +41,14 @@
this.index = options["index"];
this.getTogglePanel().getItems()[this.index] = this;
- rf.Event.bindById(this.id + ":header", "click", this.__onHeaderClick, this)
+ rf.Event.bindById(this.id + ":header", "click", this.__onHeaderClick, this);
+
+ if (this.isSelected()) {
+ var item = this;
+ $(this.togglePanelId).ready(function () {
+ item.__fitToHeight(item.getTogglePanel());
+ });
+ }
},
/***************************** Public Methods ****************************************************************/
@@ -83,15 +90,8 @@
__enter : function () {
var parentPanel = this.getTogglePanel();
if (parentPanel.isKeepHeight) {
- this.__content().hide();
- var h = parentPanel.getInnerHeight();
-
- var items = parentPanel.getItems();
- for (var i = 0; i < items.length; i++) {
- h -= items[i].__header().outerHeight();
- }
-
- this.__content().height(h - 20); // 20 it is padding top and bottom
+ this.__content().hide(); // TODO ?
+ this.__fitToHeight(parentPanel);
}
this.__content().show();
@@ -101,6 +101,17 @@
return this.__fireEnter();
},
+ __fitToHeight : function (parentPanel) {
+ var h = parentPanel.getInnerHeight();
+
+ var items = parentPanel.getItems();
+ for (var i = 0; i < items.length; i++) {
+ h -= items[i].__header().outerHeight();
+ }
+
+ this.__content().height(h - 20); // 20 it is padding top and bottom
+ },
+
getHeight : function (recalculate) {
if (recalculate || !this.__height) {
this.__height = $(rf.getDomElement(this.id)).outerHeight(true)
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js 2010-09-02 13:15:31 UTC (rev 19096)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js 2010-09-02 14:37:25 UTC (rev 19097)
@@ -40,6 +40,9 @@
rf.ui.TogglePanel.call(this, componentId, options);
this.switchMode = options.switchMode;
+ this.__addUserEventHandler("beforeswitch");
+ this.__addUserEventHandler("switch");
+
this.items = [
new RichFaces.ui.CollapsiblePanelItem(
this.id + ":content", {"index":0, "togglePanelId":this.id, "switchMode":this.switchMode, "name":"true"}),
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js 2010-09-02 13:15:31 UTC (rev 19096)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js 2010-09-02 14:37:25 UTC (rev 19097)
@@ -159,12 +159,16 @@
this.options = options;
this.activeItem = this.options.activeItem;
this.items = this.options.items;
+
+ this.__addUserEventHandler("itemchange");
+ this.__addUserEventHandler("beforeitemchange");
},
- /***************************** Public Methods ********************************************************************/
+ /***************************** Public Methods ****************************************************************/
/**
* @methodOf
+ *
* @name TogglePanel#getSelectItem
*
* @return {String} name of current selected panel item
@@ -360,6 +364,16 @@
/**
* @private
+ * */
+ __addUserEventHandler : function (name) {
+ var handler = this.options["on" + name];
+ if (handler) {
+ rf.Event.bindById(this.id, name, handler);
+ }
+ },
+
+ /**
+ * @private
* @param {Number} index - array index
*
* @return {TogglePanelItem}
14 years, 3 months
JBoss Rich Faces SVN: r19096 - trunk/ui/iteration/ui/src/main/templates.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-09-02 09:15:31 -0400 (Thu, 02 Sep 2010)
New Revision: 19096
Added:
trunk/ui/iteration/ui/src/main/templates/buttons.template.include
Log:
add html templates for the controls
Added: trunk/ui/iteration/ui/src/main/templates/buttons.template.include
===================================================================
--- trunk/ui/iteration/ui/src/main/templates/buttons.template.include (rev 0)
+++ trunk/ui/iteration/ui/src/main/templates/buttons.template.include 2010-09-02 13:15:31 UTC (rev 19096)
@@ -0,0 +1,51 @@
+<!--
+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.
+-->
+
+<c:choose xmlns:c="http://jboss.org/schema/richfaces/cdk/jstl/core" xmlns:cdk="http://jboss.org/schema/richfaces/cdk/core">
+ <c:when test="#{isEnabled}">
+ <a id="#{id}" class="#{enabledStyles}" href="javascript:void(0);" >
+ <c:choose>
+ <c:when test="#{facet != null}">
+ <cdk:call expression="encodeFacet(facesContext, facet);"/>
+ </c:when>
+ <c:otherwise>
+ #{defaultText}
+ </c:otherwise>
+ </c:choose>
+ </a>
+ </c:when>
+ <c:otherwise>
+ <span id="#{id}" class="#{disabledStyles}">
+ <c:choose>
+ <c:when test="#{facet != null}">
+ <cdk:call expression="encodeFacet(facesContext, facet);"/>
+ </c:when>
+ <c:otherwise>
+ #{defaultText}
+ </c:otherwise>
+ </c:choose>
+ </span>
+ </c:otherwise>
+</c:choose>
14 years, 3 months
JBoss Rich Faces SVN: r19095 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-09-02 09:11:40 -0400 (Thu, 02 Sep 2010)
New Revision: 19095
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MatrixConfigurator.java
Log:
MatrixConfigurator - added selenium debug output for configureMethod method
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MatrixConfigurator.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MatrixConfigurator.java 2010-09-02 12:25:55 UTC (rev 19094)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MatrixConfigurator.java 2010-09-02 13:11:40 UTC (rev 19095)
@@ -41,6 +41,7 @@
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
+import org.jboss.test.selenium.SystemProperties;
import org.jboss.test.selenium.listener.TestMethodSelector;
import org.richfaces.tests.metamer.Template;
import org.richfaces.tests.metamer.TemplatesList;
@@ -134,6 +135,10 @@
}
protected void configureMethod(ITestResult testResult) {
+ if (SystemProperties.isSeleniumDebug()) {
+ System.out.println("$configureMethod");
+ }
+
Method realMethod = getCurrentRealMethod();
if (realMethod == null) {
14 years, 3 months
JBoss Rich Faces SVN: r19094 - in trunk: examples/input-demo/src/main/webapp and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2010-09-02 08:25:55 -0400 (Thu, 02 Sep 2010)
New Revision: 19094
Modified:
trunk/examples/input-demo/src/main/java/org/richfaces/demo/AutoCompleteBean.java
trunk/examples/input-demo/src/main/webapp/autocomplete.xhtml
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/AutocompleteBase.js
Log:
merge changes from branch
Modified: trunk/examples/input-demo/src/main/java/org/richfaces/demo/AutoCompleteBean.java
===================================================================
--- trunk/examples/input-demo/src/main/java/org/richfaces/demo/AutoCompleteBean.java 2010-09-02 12:22:46 UTC (rev 19093)
+++ trunk/examples/input-demo/src/main/java/org/richfaces/demo/AutoCompleteBean.java 2010-09-02 12:25:55 UTC (rev 19094)
@@ -22,6 +22,7 @@
package org.richfaces.demo;
import java.io.Serializable;
+import java.util.Arrays;
import java.util.Locale;
import javax.faces.bean.ManagedBean;
@@ -30,6 +31,8 @@
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
+import org.richfaces.component.UIAutocomplete;
+
import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
@@ -60,7 +63,17 @@
return input.getName().toLowerCase(Locale.US).startsWith(countryNamePrefix);
}
}
+
+ private String mode = "lazyClient";
+ public String getMode() {
+ return mode;
+ }
+
+ public void setMode(String mode) {
+ this.mode = mode;
+ }
+
@ManagedProperty(value = "#{countriesBean}")
private CountriesBean countriesBean;
@@ -69,7 +82,13 @@
}
public Object autocomplete(FacesContext facesContext, UIComponent component, String value) {
- return Collections2.filter(countriesBean.getCountries(), new CountryNamePredicate(value));
+ // for tests when value does not starts with prefix
+ /*String str = value;
+ if (str.charAt(0)=='i') {
+ str = str.substring(1);
+ }*/
+ String v = mode.equals("lazyClient") || mode.equals("client") ? "" : value;
+ return Collections2.filter(countriesBean.getCountries(), new CountryNamePredicate(v.toLowerCase()));
}
}
Modified: trunk/examples/input-demo/src/main/webapp/autocomplete.xhtml
===================================================================
--- trunk/examples/input-demo/src/main/webapp/autocomplete.xhtml 2010-09-02 12:22:46 UTC (rev 19093)
+++ trunk/examples/input-demo/src/main/webapp/autocomplete.xhtml 2010-09-02 12:25:55 UTC (rev 19094)
@@ -13,11 +13,17 @@
<h:body style="margin: 30px;">
<h:form id="form">
+ <h:selectOneMenu value="#{autoCompleteBean.mode}" onchange="submit()">
+ <f:selectItem itemValue="lazyClient"/>
+ <f:selectItem itemValue="client"/>
+ <f:selectItem itemValue="cachedAjax"/>
+ <f:selectItem itemValue="ajax"/>
+ </h:selectOneMenu>
<div style="height: 300px; width: 300px; overflow: auto;">Text
block text block text block text block text block text block text
block text block
- <input:autocomplete mode="" minChars="2" autocompleteMethod="#{autoCompleteBean.autocomplete}" var="country" fetchValue="#{country.name}" showButton="true">
+ <input:autocomplete mode="#{autoCompleteBean.mode}" minChars="2" autocompleteMethod="#{autoCompleteBean.autocomplete}" var="country" fetchValue="#{country.name}" showButton="true">
#{country.name} #{country.iso} #{country.domain}
</input:autocomplete>
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js 2010-09-02 12:22:46 UTC (rev 19093)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js 2010-09-02 12:25:55 UTC (rev 19094)
@@ -1,14 +1,23 @@
(function ($, rf) {
rf.utils = rf.utils || {};
- rf.utils.Cache = function (key, items, values) {
+ rf.utils.Cache = function (key, items, values, useCache) {
this.key = key.toLowerCase();
this.cache = {}
this.cache[this.key] = items || [];
- this.values = typeof values != "function" ? values || this.cache[this.key] : values(items);
- this.useCache = checkValuesPrefix.call(this);
+ this.originalValues = typeof values == "function" ? values(items) : values || this.cache[this.key];
+ this.values = processValues(this.originalValues);
+ this.useCache = useCache || checkValuesPrefix.call(this);
};
+ var processValues = function (values) {
+ var processedValues = [];
+ for (var i = 0; i<values.length; i++) {
+ processedValues.push(values[i].toLowerCase());
+ }
+ return processedValues;
+ }
+
var checkValuesPrefix = function () {
var result = true;
for (var i = 0; i<this.values.length; i++) {
@@ -33,7 +42,7 @@
} else {
var itemsCache = this.cache[this.key];
for (var i = 0; i<this.values.length; i++) {
- var value = this.values[i].toLowerCase();
+ var value = this.values[i];
var p = value.indexOf(key);
if (p == 0) {
newCache.push(itemsCache[i]);
@@ -52,7 +61,7 @@
};
var getItemValue = function (item) {
- return this.values[this.cache[this.key].index(item)];
+ return this.originalValues[this.cache[this.key].index(item)];
};
var isCached = function (key) {
@@ -107,8 +116,9 @@
minChars:1,
selectFirst:true,
ajaxMode:true,
+ lazyClientMode:false,
isCachedAjax:true,
- tokens: ",",
+ tokens: "",
attachToBody:true
};
@@ -150,9 +160,7 @@
if (element) {
if (event.type=="mouseover") {
var index = this.items.index(element);
- if (index!=this.index) {
- selectItem.call(this, index);
- }
+ selectItem.call(this, event, index);
} else {
this.__onChangeValue(event, getSelectedItemValue.call(this));
rf.Selection.setCaretTo(rf.getDomElement(this.fieldId));
@@ -164,7 +172,7 @@
var updateItemsList = function (value, fetchValues) {
this.items = $(rf.getDomElement(this.id+ID.ITEMS)).find("."+this.options.itemClass);
if (this.items.length>0) {
- this.cache = new rf.utils.Cache(value, this.items, fetchValues || getData);
+ this.cache = new rf.utils.Cache((this.options.ajaxMode ? value : ""), this.items, fetchValues || getData, !this.options.ajaxMode);
}
};
@@ -194,18 +202,25 @@
}
};
- var callAjax = function(event, value) {
+ var callAjax = function(event, value, callback) {
clearItems.call(this);
rf.getDomElement(this.id+ID.VALUE).value = value;
var _this = this;
+ var _event = event;
var ajaxSuccess = function (event) {
updateItemsList.call(_this, _this.value, event.componentData && event.componentData[_this.id]);
- if (_this.isVisible && _this.options.selectFirst) {
- selectItem.call(_this, 0);
+ if (_this.options.lazyClientMode && _this.value.length!=0) {
+ updateItemsFromCache.call(_this, _this.value);
}
+ if (_this.focused && _this.items.length!=0 && callback) {
+ callback.call(_this, _event);
+ }
+ if (!callback && _this.isVisible && _this.options.selectFirst) {
+ selectItem.call(_this, _event, 0);
+ }
}
var ajaxError = function (event) {
@@ -219,8 +234,8 @@
rf.ajax(this.id, event, {parameters: params, error: ajaxError, complete:ajaxSuccess});
};
- var selectItem = function(index, isOffset, noAutoFill) {
- if (this.items.length==0) return;
+ var selectItem = function(event, index, isOffset) {
+ if (this.items.length==0 || (!isOffset && this.index == index)) return;
if (this.index!=-1) {
this.items.eq(this.index).removeClass(this.options.selectedItemClass);
@@ -233,11 +248,11 @@
if (isOffset) {
this.index += index;
- if ( this.index<0 ) {
- this.index = this.items.length - 1;
- } else if (this.index >= this.items.length) {
- this.index = 0;
- }
+ if ( this.index<0 ) {
+ this.index = this.items.length - 1;
+ } else if (this.index >= this.items.length) {
+ this.index = 0;
+ }
} else {
if (index<0) {
index = 0;
@@ -249,14 +264,21 @@
var item = this.items.eq(this.index);
item.addClass(this.options.selectedItemClass);
scrollToSelectedItem.call(this);
- !noAutoFill && autoFill.call(this, this.value, getSelectedItemValue.call(this));
+ if (event &&
+ event.which != rf.KEYS.BACKSPACE &&
+ event.which != rf.KEYS.DEL &&
+ event.which != rf.KEYS.LEFT &&
+ event.which != rf.KEYS.RIGHT) {
+ autoFill.call(this, this.value, getSelectedItemValue.call(this));
+ }
};
var updateItemsFromCache = function (value) {
var newItems = this.cache.getItems(value);
this.items = $(newItems);
//TODO: works only with simple markup, not with <tr>
- $(rf.getDomElement(this.id+ID.ITEMS)).empty().append(newItems);
+ $(rf.getDomElement(this.id+ID.ITEMS)).empty().append(this.items);
+ window.console && console.log && console.log("updateItemsFromCache");
};
var clearItems = function () {
@@ -264,31 +286,34 @@
this.items = [];
};
- var onChangeValue = function (event, value) {
- selectItem.call(this);
- this.index = -1;
+ var onChangeValue = function (event, value, callback) {
+ selectItem.call(this, event);
// value is undefined if called from AutocompleteBase onChange
var subValue = (typeof value == "undefined") ? this.__getSubValue() : value;
var oldValue = this.value;
this.value = subValue;
- if (this.cache && this.cache.isCached(subValue)) {
- updateItemsFromCache.call(this, subValue);
- if (this.options.selectFirst) {
- if (event.which == rf.KEYS.RETURN || event.type == "click") {
- this.setInputValue(subValue);
- } else {
- selectItem.call(this, 0, false, event.which == rf.KEYS.BACKSPACE || event.which == rf.KEYS.LEFT || event.which == rf.KEYS.RIGHT);
- }
+ if ((this.options.isCachedAjax || !this.options.ajaxMode) &&
+ this.cache && this.cache.isCached(subValue)) {
+ if (oldValue!=subValue) {
+ updateItemsFromCache.call(this, subValue);
}
+ if (this.items.length!=0 && callback) {
+ callback.call(this, event);
+ }
+ if (event.which == rf.KEYS.RETURN || event.type == "click") {
+ this.setInputValue(subValue);
+ } else if (this.options.selectFirst) {
+ selectItem.call(this, event, 0);
+ }
} else {
if (event.which == rf.KEYS.RETURN || event.type == "click") {
this.setInputValue(subValue);
}
if (subValue.length>=this.options.minChars) {
- if (this.options.ajaxMode && oldValue!=subValue) {
- this.options.ajaxMode && callAjax.call(this, event, subValue);
+ if ((this.options.ajaxMode || this.options.lazyClientMode) && oldValue!=subValue) {
+ callAjax.call(this, event, subValue, callback);
}
} else {
if (this.options.ajaxMode) {
@@ -365,9 +390,11 @@
*/
__updateState: function (event) {
var subValue = this.__getSubValue();
- // called from onShow method, not actually value changed
- if (this.items.length==0 && subValue.length>=this.options.minChars && this.isFirstAjax) {
- this.options.ajaxMode && callAjax.call(this, event, subValue);
+ // called from AutocompleteBase when not actually value changed
+ if (this.items.length==0 && this.isFirstAjax) {
+ if ((this.options.ajaxMode && subValue.length>=this.options.minChars) || this.options.lazyClientMode) {
+ callAjax.call(this, event, subValue);
+ }
}
return;
},
@@ -383,16 +410,16 @@
/*
* Override abstract protected methods
*/
- __onKeyUp: function () {
- selectItem.call(this, -1, true);
+ __onKeyUp: function (event) {
+ selectItem.call(this, event, -1, true);
},
- __onKeyDown: function () {
- selectItem.call(this, 1, true);
+ __onKeyDown: function (event) {
+ selectItem.call(this, event, 1, true);
},
- __onPageUp: function () {
+ __onPageUp: function (event) {
},
- __onPageDown: function () {
+ __onPageDown: function (event) {
},
__onBeforeShow: function (event) {
@@ -404,14 +431,12 @@
//rf.getDomElement(this.fieldId).focus();
},
__onShow: function (event) {
- if (event.which != rf.KEYS.BACKSPACE && this.items && this.items.length>0) {
- if (this.index!=0 && this.options.selectFirst) {
- selectItem.call(this, 0);
- }
+ if (this.options.selectFirst) {
+ selectItem.call(this, event, 0);
}
},
- __onHide: function () {
- selectItem.call(this);
+ __onHide: function (event) {
+ selectItem.call(this, event);
},
/*
* Destructor
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/AutocompleteBase.js
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/AutocompleteBase.js 2010-09-02 12:22:46 UTC (rev 19093)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/AutocompleteBase.js 2010-09-02 12:25:55 UTC (rev 19094)
@@ -107,6 +107,7 @@
};
var onFocus = function (event) {
+ this.focused = true;
};
var onBlur = function (event) {
@@ -116,6 +117,7 @@
} else if (this.isVisible && !this.isMouseDown) {
var _this = this;
this.timeoutId = window.setTimeout(function(){_this.hide();}, 200);
+ this.focused=false;
}
};
@@ -128,15 +130,11 @@
//TODO: is it needed to chesk keys?
//TODO: we need to set value when autoFill used when LEFT or RIGHT was pressed
if (event.which == rf.KEYS.LEFT || event.which == rf.KEYS.RIGHT || flag) {
- if (flag || this.isVisible) {
- this.__onChangeValue(event);
- }
if (flag) {
+ this.__onChangeValue(event, undefined, (!this.isVisible ? this.show : undefined));
this.currentValue = this.getInputValue();
- /*if(value && value.length>=this.options.minChars){
- onShow.call(this, event);
- }*/ // TODO: AMarkhel: is this check needed??? for what?
- onShow.call(this, event);
+ } else if (this.isVisible) {
+ this.__onChangeValue(event);
}
}
};
14 years, 3 months