JBoss Rich Faces SVN: r20215 - in trunk: core/api/src/main/java/org/richfaces/log and 9 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-11-29 15:44:15 -0500 (Mon, 29 Nov 2010)
New Revision: 20215
Added:
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/TreeModelBean.java
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/ArchiveEntry.java
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/ArchiveFile.java
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/Class.java
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/Directory.java
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/Entry.java
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/File.java
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/Package.java
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/Project.java
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/Root.java
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/SimpleRecursiveNode.java
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/SourceDirectory.java
trunk/examples/iteration-demo/src/main/resources/org/richfaces/demo/model/
trunk/examples/iteration-demo/src/main/resources/org/richfaces/demo/model/tree/
trunk/examples/iteration-demo/src/main/resources/org/richfaces/demo/model/tree/tree-model-data.xml
trunk/examples/iteration-demo/src/main/webapp/treeModel.xhtml
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeModelAdaptor.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeModelRecursiveAdaptor.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/TreeModelAdaptor.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/TreeModelRecursiveAdaptor.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeModelKey.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelImpl.java
Modified:
trunk/core/api/src/main/java/org/richfaces/component/ComponentPredicates.java
trunk/core/api/src/main/java/org/richfaces/log/RichfacesLogger.java
trunk/examples/iteration-demo/src/main/webapp/index.xhtml
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/model/SwingTreeNodeDataModelImpl.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/model/TreeSequenceKeyModel.java
Log:
RF-9680
Modified: trunk/core/api/src/main/java/org/richfaces/component/ComponentPredicates.java
===================================================================
--- trunk/core/api/src/main/java/org/richfaces/component/ComponentPredicates.java 2010-11-29 20:36:39 UTC (rev 20214)
+++ trunk/core/api/src/main/java/org/richfaces/component/ComponentPredicates.java 2010-11-29 20:44:15 UTC (rev 20215)
@@ -31,6 +31,21 @@
*/
public final class ComponentPredicates {
+ private static final class WithIdPredicate implements Predicate<UIComponent> {
+
+ private final String id;
+
+ public WithIdPredicate(String id) {
+ super();
+ this.id = id;
+ }
+
+ public boolean apply(UIComponent input) {
+ return id.equals(input.getId());
+ }
+
+ }
+
private static final Predicate<UIComponent> IS_RENDERED = new Predicate<UIComponent>() {
public boolean apply(UIComponent input) {
return input.isRendered();
@@ -42,4 +57,12 @@
public static Predicate<UIComponent> isRendered() {
return IS_RENDERED;
}
+
+ public static Predicate<UIComponent> withId(String id) {
+ if (id == null) {
+ throw new NullPointerException("id");
+ }
+
+ return new WithIdPredicate(id);
+ }
}
Modified: trunk/core/api/src/main/java/org/richfaces/log/RichfacesLogger.java
===================================================================
--- trunk/core/api/src/main/java/org/richfaces/log/RichfacesLogger.java 2010-11-29 20:36:39 UTC (rev 20214)
+++ trunk/core/api/src/main/java/org/richfaces/log/RichfacesLogger.java 2010-11-29 20:44:15 UTC (rev 20215)
@@ -8,9 +8,9 @@
*
*/
public enum RichfacesLogger {
- RESOURCE("Resource"), RENDERKIT("Renderkit"), CONFIG("Config"), CONNECTION("Connection"),
- APPLICATION("Application"),
- CACHE("Cache"), CONTEXT("Context"), COMPONENTS("Components"), WEBAPP("Webapp"), UTIL("Util");
+ RESOURCE("Resource"), RENDERKIT("Renderkit"), CONFIG("Config"), CONNECTION("Connection"),
+ APPLICATION("Application"), CACHE("Cache"), CONTEXT("Context"), COMPONENTS("Components"),
+ WEBAPP("Webapp"), UTIL("Util"), MODEL("Model");
private static final String LOGGER_NAME_PREFIX = "org.richfaces.log.";
private String loggerName;
Added: trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/TreeModelBean.java
===================================================================
--- trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/TreeModelBean.java (rev 0)
+++ trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/TreeModelBean.java 2010-11-29 20:44:15 UTC (rev 20215)
@@ -0,0 +1,36 @@
+/**
+ *
+ */
+package org.richfaces.demo.model.tree;
+
+import javax.faces.bean.ApplicationScoped;
+import javax.faces.bean.ManagedBean;
+import javax.xml.bind.JAXB;
+
+import org.richfaces.demo.model.tree.adaptors.Root;
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 25.07.2007
+ *
+ */
+@ManagedBean
+@ApplicationScoped
+public class TreeModelBean {
+
+ private Root root;
+
+ private void initializeRoot() {
+ root = JAXB.unmarshal(TreeModelBean.class.getResource("tree-model-data.xml"), Root.class);
+ }
+
+ public Root getRoot() {
+ if (root == null) {
+ initializeRoot();
+ }
+
+ return root;
+ }
+
+}
Copied: trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/ArchiveEntry.java (from rev 20214, trunk/core/api/src/main/java/org/richfaces/component/ComponentPredicates.java)
===================================================================
--- trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/ArchiveEntry.java (rev 0)
+++ trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/ArchiveEntry.java 2010-11-29 20:44:15 UTC (rev 20215)
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+package org.richfaces.demo.model.tree.adaptors;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 04.08.2007
+ *
+ */
+public class ArchiveEntry extends Entry {
+
+ @XmlElement(name = "archiveEntry")
+ private List<ArchiveEntry> archiveEntries;
+
+ @XmlElement(name = "archiveEntryFile")
+ private List<ArchiveEntry> archiveEntryFiles;
+
+ public List<ArchiveEntry> getArchiveEntries() {
+ return archiveEntries;
+ }
+
+ public List<ArchiveEntry> getArchiveEntryFiles() {
+ return archiveEntryFiles;
+ }
+}
Copied: trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/ArchiveFile.java (from rev 20214, trunk/core/api/src/main/java/org/richfaces/component/ComponentPredicates.java)
===================================================================
--- trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/ArchiveFile.java (rev 0)
+++ trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/ArchiveFile.java 2010-11-29 20:44:15 UTC (rev 20215)
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+package org.richfaces.demo.model.tree.adaptors;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+
+import com.google.common.collect.Lists;
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 04.08.2007
+ *
+ */
+public class ArchiveFile extends File {
+
+ @XmlElement(name = "archiveEntry")
+ private List<ArchiveEntry> archiveEntries = Lists.newArrayList();
+
+ public List<ArchiveEntry> getArchiveEntries() {
+ return archiveEntries;
+ }
+
+}
Copied: trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/Class.java (from rev 20214, trunk/core/api/src/main/java/org/richfaces/component/ComponentPredicates.java)
===================================================================
--- trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/Class.java (rev 0)
+++ trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/Class.java 2010-11-29 20:44:15 UTC (rev 20215)
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+package org.richfaces.demo.model.tree.adaptors;
+
+
+/**
+ * @author Nick Belaevski
+ */
+public class Class extends Entry {
+}
Copied: trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/Directory.java (from rev 20214, trunk/core/api/src/main/java/org/richfaces/component/ComponentPredicates.java)
===================================================================
--- trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/Directory.java (rev 0)
+++ trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/Directory.java 2010-11-29 20:44:15 UTC (rev 20215)
@@ -0,0 +1,56 @@
+/*
+ * 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.
+ */
+package org.richfaces.demo.model.tree.adaptors;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 24.07.2007
+ *
+ */
+public class Directory extends Entry {
+
+ @XmlElement(name = "directory")
+ private List<Directory> directories;
+
+ @XmlElement(name = "file")
+ private List<File> files;
+
+ @XmlElement(name = "archive")
+ private List<ArchiveFile> archiveFiles;
+
+ public List<Directory> getDirectories() {
+ return directories;
+ }
+
+ public List<File> getFiles() {
+ return files;
+ }
+
+ public List<ArchiveFile> getArchiveFiles() {
+ return archiveFiles;
+ }
+}
Copied: trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/Entry.java (from rev 20214, trunk/core/api/src/main/java/org/richfaces/component/ComponentPredicates.java)
===================================================================
--- trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/Entry.java (rev 0)
+++ trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/Entry.java 2010-11-29 20:44:15 UTC (rev 20215)
@@ -0,0 +1,56 @@
+/*
+ * 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.
+ */
+package org.richfaces.demo.model.tree.adaptors;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 29.07.2007
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+public abstract class Entry {
+
+ @XmlAttribute
+ private String name;
+
+ public String toString() {
+ return this.getClass().getSimpleName() + "[" + name + "]";
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void click() {
+ }
+
+}
Copied: trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/File.java (from rev 20214, trunk/core/api/src/main/java/org/richfaces/component/ComponentPredicates.java)
===================================================================
--- trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/File.java (rev 0)
+++ trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/File.java 2010-11-29 20:44:15 UTC (rev 20215)
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+package org.richfaces.demo.model.tree.adaptors;
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 25.07.2007
+ *
+ */
+public class File extends Entry {
+
+}
Copied: trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/Package.java (from rev 20214, trunk/core/api/src/main/java/org/richfaces/component/ComponentPredicates.java)
===================================================================
--- trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/Package.java (rev 0)
+++ trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/Package.java 2010-11-29 20:44:15 UTC (rev 20215)
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+package org.richfaces.demo.model.tree.adaptors;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+
+/**
+ * @author Nick Belaevski mailto:nbelaevski@exadel.com created 25.07.2007
+ *
+ */
+public class Package extends Entry {
+
+ @XmlElement(name = "class")
+ private List<Class> classes;
+
+ public List<Class> getClasses() {
+ return classes;
+ }
+
+}
Copied: trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/Project.java (from rev 20214, trunk/core/api/src/main/java/org/richfaces/component/ComponentPredicates.java)
===================================================================
--- trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/Project.java (rev 0)
+++ trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/Project.java 2010-11-29 20:44:15 UTC (rev 20215)
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ */
+package org.richfaces.demo.model.tree.adaptors;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 24.07.2007
+ *
+ */
+public class Project extends Entry {
+
+ @XmlElement(name = "sourceDirectory")
+ private List<SourceDirectory> sourceDirectories;
+
+ @XmlElement(name = "directory")
+ private List<Directory> commonDirectories;
+
+ public List<SourceDirectory> getSourceDirectories() {
+ return sourceDirectories;
+ }
+
+ public List<Directory> getCommonDirectories() {
+ return commonDirectories;
+ }
+}
Copied: trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/Root.java (from rev 20214, trunk/core/api/src/main/java/org/richfaces/component/ComponentPredicates.java)
===================================================================
--- trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/Root.java (rev 0)
+++ trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/Root.java 2010-11-29 20:44:15 UTC (rev 20215)
@@ -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.demo.model.tree.adaptors;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@XmlRootElement(name = "root")
+public class Root {
+
+ @XmlElement(name = "project")
+ private List<Project> projects;
+
+ public List<Project> getProjects() {
+ return projects;
+ }
+
+}
Added: trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/SimpleRecursiveNode.java
===================================================================
--- trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/SimpleRecursiveNode.java (rev 0)
+++ trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/SimpleRecursiveNode.java 2010-11-29 20:44:15 UTC (rev 20215)
@@ -0,0 +1,76 @@
+/*
+ * 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.
+ */
+
+package org.richfaces.demo.model.tree.adaptors;
+
+import java.util.List;
+
+import com.google.common.collect.Lists;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.2
+ */
+
+public class SimpleRecursiveNode {
+
+ private SimpleRecursiveNode parent;
+
+ private List<SimpleRecursiveNode> children = Lists.newArrayList();
+
+ private String text;
+
+ public SimpleRecursiveNode(SimpleRecursiveNode parent, String text) {
+ super();
+ this.parent = parent;
+ if (parent != null) {
+ parent.addChild(this);
+ }
+ this.text = text;
+ }
+
+ public void addChild(SimpleRecursiveNode node) {
+ children.add(node);
+ }
+
+ public void removeChild(SimpleRecursiveNode node) {
+ children.remove(node);
+ }
+
+ public void remove() {
+ if (parent != null) {
+ parent.removeChild(this);
+ }
+ }
+
+ public SimpleRecursiveNode getParent() {
+ return parent;
+ }
+
+ public List<SimpleRecursiveNode> getChildren() {
+ return children;
+ }
+
+ public String getText() {
+ return text;
+ }
+}
Copied: trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/SourceDirectory.java (from rev 20214, trunk/core/api/src/main/java/org/richfaces/component/ComponentPredicates.java)
===================================================================
--- trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/SourceDirectory.java (rev 0)
+++ trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/SourceDirectory.java 2010-11-29 20:44:15 UTC (rev 20215)
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+
+package org.richfaces.demo.model.tree.adaptors;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 24.07.2007
+ *
+ */
+public class SourceDirectory extends Entry {
+
+ @XmlElement(name = "package")
+ private List<Package> packages;
+
+ public List<Package> getPackages() {
+ return packages;
+ }
+
+}
Added: trunk/examples/iteration-demo/src/main/resources/org/richfaces/demo/model/tree/tree-model-data.xml
===================================================================
--- trunk/examples/iteration-demo/src/main/resources/org/richfaces/demo/model/tree/tree-model-data.xml (rev 0)
+++ trunk/examples/iteration-demo/src/main/resources/org/richfaces/demo/model/tree/tree-model-data.xml 2010-11-29 20:44:15 UTC (rev 20215)
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<root>
+ <!-- project name="ajax4jsf">
+ <sourceDirectory name="src/main/java">
+ <package name="org.ajax4jsf">
+ <class name="FastFilter.java" />
+ <class name="Filter.java" />
+ </package>
+ <package name="org.ajax4jsf.component">
+ <class name="UIDataAdaptor.java" />
+ <class name="AjaxActionComponent.java" />
+ </package>
+ <package name="org.ajax4jsf.renderkit">
+ <class name="AjaxChildrenRenderer.java" />
+ <class name="AjaxComponentRendererBase.java" />
+ </package>
+ </sourceDirectory>
+ <sourceDirectory name="src/main/resources">
+ <package name="org.ajax4jsf">
+ </package>
+ <package name="org.ajax4jsf.javascript">
+ </package>
+ </sourceDirectory>
+ </project -->
+
+ <project name="richfaces">
+ <!-- sourceDirectory name="src/main/java">
+ <package name="org.richfaces">
+ </package>
+ <package name="org.richfaces.component">
+ </package>
+ <package name="org.richfaces.model">
+ </package>
+ </sourceDirectory>
+ <sourceDirectory name="src/main/resources">
+ <package name="org.richfaces">
+ </package>
+ <package name="org.richfaces.renderkit">
+ </package>
+ </sourceDirectory>
+ <sourceDirectory name="target/generated/java">
+ <package name="org.richfaces">
+ </package>
+ <package name="org.richfaces.component">
+ </package>
+ <package name="org.richfaces.renderkit">
+ </package>
+ </sourceDirectory>
+ <directory name="design">
+ <directory name="funcspec">
+ <file name="FunctionalSpecification-1.0.doc" />
+ <file name="Requirements-1.0.doc" />
+ </directory>
+ </directory -->
+ <directory name="src">
+ <directory name="main">
+ <directory name="config">
+ <directory name="org">
+ <directory name="richfaces">
+ <directory name="component">
+ <file name="tree.config.xml" />
+ <file name="treeNode.config.xml" />
+ </directory>
+ </directory>
+ </directory>
+ </directory>
+ <directory name="templates"></directory>
+ </directory>
+ <directory name="test"></directory>
+ </directory>
+ <directory name="target">
+ <directory name="generated-component">
+ </directory>
+ <directory name="surefire-reports">
+ <file name="org.richfaces.JSFComponentTest.txt" />
+ <file name="TEST-ComponentTest.xml" />
+ </directory>
+ <file name="richfaces-3.1.0-snapshot" />
+ <file name="richfaces-3.1.0-javadoc" />
+ <archive name="richfaces-3.1.0-sources">
+ <archiveEntry name="org">
+ <archiveEntry name="richfaces">
+ <archiveEntry name="component">
+ <archiveEntryFile name="UITree" />
+ <archiveEntryFile name="UITreeNode" />
+ <archiveEntryFile name="UICalendar" />
+ <archiveEntryFile name="UIRangedNumberInput" />
+ </archiveEntry>
+ </archiveEntry>
+ </archiveEntry>
+ </archive>
+ </directory>
+ </project>
+</root>
\ No newline at end of file
Modified: trunk/examples/iteration-demo/src/main/webapp/index.xhtml
===================================================================
--- trunk/examples/iteration-demo/src/main/webapp/index.xhtml 2010-11-29 20:36:39 UTC (rev 20214)
+++ trunk/examples/iteration-demo/src/main/webapp/index.xhtml 2010-11-29 20:44:15 UTC (rev 20215)
@@ -14,6 +14,7 @@
<li><h:link outcome="filteringAndSorting">filtering and sorting feature</h:link></li>
<li><h:link outcome="list">rich:list</h:link></li>
<li><h:link outcome="tree">rich:tree</h:link></li>
+ <li><h:link outcome="treeModel">rich:treeModelAdaptor and rich:treeModelRecursiveAdaptor</h:link></li>
</ul>
Added: trunk/examples/iteration-demo/src/main/webapp/treeModel.xhtml
===================================================================
--- trunk/examples/iteration-demo/src/main/webapp/treeModel.xhtml (rev 0)
+++ trunk/examples/iteration-demo/src/main/webapp/treeModel.xhtml 2010-11-29 20:44:15 UTC (rev 20215)
@@ -0,0 +1,37 @@
+<!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:it="http://richfaces.org/iteration"
+ xmlns:a4j="http://richfaces.org/a4j">
+<f:view contentType="text/html" />
+
+<h:head>
+ <title>Richfaces Tree Models</title>
+</h:head>
+
+<h:body>
+ <h:messages id="messages" />
+
+ <h:form id="form">
+ <it:tree id="tree" var="node" toggleType="ajax">
+ <it:treeModelAdaptor nodes="#{treeModelBean.root.projects}">
+ <it:treeModelAdaptor nodes="#{node.sourceDirectories}">
+ <it:treeModelAdaptor nodes="#{node.packages}">
+ <it:treeModelAdaptor nodes="#{node.classes}" />
+ </it:treeModelAdaptor>
+ </it:treeModelAdaptor>
+
+ <it:treeModelRecursiveAdaptor roots="#{node.commonDirectories}" nodes="#{node.directories}">
+ <it:treeModelRecursiveAdaptor roots="#{node.archiveFiles}" nodes="#{node.archiveEntries}">
+ <it:treeModelAdaptor rendered="#{node.class.simpleName eq 'ArchiveEntry'}"
+ nodes="#{node.archiveEntryFiles}" />
+ </it:treeModelRecursiveAdaptor>
+ <it:treeModelAdaptor nodes="#{node.files}" />
+ </it:treeModelRecursiveAdaptor>
+ </it:treeModelAdaptor>
+ </it:tree>
+ </h:form>
+</h:body>
+</html>
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java 2010-11-29 20:36:39 UTC (rev 20214)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java 2010-11-29 20:44:15 UTC (rev 20215)
@@ -68,6 +68,7 @@
import org.richfaces.event.TreeToggleEvent;
import org.richfaces.event.TreeToggleListener;
import org.richfaces.event.TreeToggleSource;
+import org.richfaces.model.DeclarativeTreeDataModelImpl;
import org.richfaces.model.SwingTreeNodeDataModelImpl;
import org.richfaces.model.TreeDataModel;
import org.richfaces.model.TreeDataModelTuple;
@@ -467,8 +468,16 @@
@Override
protected ExtendedDataModel<?> createExtendedDataModel() {
- SwingTreeNodeDataModelImpl dataModel = new SwingTreeNodeDataModelImpl();
- dataModel.setWrappedData(getValue());
+ ExtendedDataModel<?> dataModel;
+
+ Object value = getValue();
+ if (value == null) {
+ dataModel = new DeclarativeTreeDataModelImpl(this, getVar(), getVariablesMap(getFacesContext()));
+ } else {
+ dataModel = new SwingTreeNodeDataModelImpl();
+ dataModel.setWrappedData(getValue());
+ }
+
return dataModel;
}
Copied: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeModelAdaptor.java (from rev 20214, trunk/core/api/src/main/java/org/richfaces/component/ComponentPredicates.java)
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeModelAdaptor.java (rev 0)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeModelAdaptor.java 2010-11-29 20:44:15 UTC (rev 20215)
@@ -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.component;
+
+import javax.faces.component.UIComponentBase;
+
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.Tag;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@JsfComponent(type = AbstractTreeModelAdaptor.COMPONENT_TYPE,
+ tag = @Tag(name = "treeModelAdaptor"))
+public abstract class AbstractTreeModelAdaptor extends UIComponentBase implements TreeModelAdaptor {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.TreeModelAdaptor";
+
+}
Copied: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeModelRecursiveAdaptor.java (from rev 20214, trunk/core/api/src/main/java/org/richfaces/component/ComponentPredicates.java)
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeModelRecursiveAdaptor.java (rev 0)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeModelRecursiveAdaptor.java 2010-11-29 20:44:15 UTC (rev 20215)
@@ -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.component;
+
+import javax.faces.component.UIComponentBase;
+
+import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.Tag;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@JsfComponent(type = AbstractTreeModelRecursiveAdaptor.COMPONENT_TYPE,
+ tag = @Tag(name = "treeModelRecursiveAdaptor"))
+public abstract class AbstractTreeModelRecursiveAdaptor extends UIComponentBase implements TreeModelRecursiveAdaptor {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.TreeModelRecursiveAdaptor";
+
+ @Attribute(defaultValue = "first")
+ public abstract String getRecursionOrder();
+
+}
Copied: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/TreeModelAdaptor.java (from rev 20214, trunk/core/api/src/main/java/org/richfaces/component/ComponentPredicates.java)
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/TreeModelAdaptor.java (rev 0)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/TreeModelAdaptor.java 2010-11-29 20:44:15 UTC (rev 20215)
@@ -0,0 +1,32 @@
+/*
+ * 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;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public interface TreeModelAdaptor {
+
+ public Object getNodes();
+
+}
Copied: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/TreeModelRecursiveAdaptor.java (from rev 20214, trunk/core/api/src/main/java/org/richfaces/component/ComponentPredicates.java)
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/TreeModelRecursiveAdaptor.java (rev 0)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/TreeModelRecursiveAdaptor.java 2010-11-29 20:44:15 UTC (rev 20215)
@@ -0,0 +1,34 @@
+/*
+ * 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;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public interface TreeModelRecursiveAdaptor extends TreeModelAdaptor {
+
+ public Object getRoots();
+
+ public String getRecursionOrder();
+
+}
Added: trunk/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeModelKey.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeModelKey.java (rev 0)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeModelKey.java 2010-11-29 20:44:15 UTC (rev 20215)
@@ -0,0 +1,94 @@
+/*
+ * 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.model;
+
+import java.io.Serializable;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class DeclarativeModelKey implements Serializable {
+
+ private static final long serialVersionUID = 7065813074553570168L;
+
+ private String modelId;
+
+ private Object modelKey;
+
+ public DeclarativeModelKey(String modelId, Object modelKey) {
+ super();
+ this.modelId = modelId;
+ this.modelKey = modelKey;
+ }
+
+ public String getModelId() {
+ return modelId;
+ }
+
+ public Object getModelKey() {
+ return modelKey;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((modelId == null) ? 0 : modelId.hashCode());
+ result = prime * result + ((modelKey == null) ? 0 : modelKey.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ DeclarativeModelKey other = (DeclarativeModelKey) obj;
+ if (modelId == null) {
+ if (other.modelId != null) {
+ return false;
+ }
+ } else if (!modelId.equals(other.modelId)) {
+ return false;
+ }
+ if (modelKey == null) {
+ if (other.modelKey != null) {
+ return false;
+ }
+ } else if (!modelKey.equals(other.modelKey)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return getModelId() + '.' + getModelKey();
+ }
+}
Added: trunk/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelImpl.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelImpl.java (rev 0)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelImpl.java 2010-11-29 20:44:15 UTC (rev 20215)
@@ -0,0 +1,265 @@
+/*
+ * 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.model;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+
+import org.richfaces.component.AbstractTree;
+import org.richfaces.component.ComponentPredicates;
+import org.richfaces.component.TreeModelAdaptor;
+import org.richfaces.component.TreeModelRecursiveAdaptor;
+import org.richfaces.log.Logger;
+import org.richfaces.log.RichfacesLogger;
+
+import com.google.common.base.Predicates;
+import com.google.common.collect.ForwardingIterator;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Iterators;
+import com.google.common.collect.Lists;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class DeclarativeTreeDataModelImpl extends TreeSequenceKeyModel<DeclarativeModelKey, Object> {
+
+ private static final Logger LOGGER = RichfacesLogger.MODEL.getLogger();
+
+ private final class DeclarativeModelIterator implements Iterator<TreeDataModelTuple> {
+
+ private UIComponent component;
+
+ private SequenceRowKey<DeclarativeModelKey> baseKey;
+
+ private int counter = 0;
+
+ private Iterator<?> nodesIterator;
+
+ public DeclarativeModelIterator(UIComponent component, SequenceRowKey<DeclarativeModelKey> baseKey, Iterator<?> nodesIterator) {
+ super();
+ this.component = component;
+ this.baseKey = baseKey;
+ this.nodesIterator = nodesIterator;
+ }
+
+ public TreeDataModelTuple next() {
+ Object nextNode = nodesIterator.next();
+ DeclarativeModelKey key = new DeclarativeModelKey(component.getId(), counter++);
+
+ SequenceRowKey<DeclarativeModelKey> newKey = baseKey.append(key);
+ setCurrentState(newKey, nextNode, component);
+
+ return new TreeDataModelTuple(newKey, nextNode);
+ }
+
+ public boolean hasNext() {
+ return nodesIterator.hasNext();
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+
+ }
+
+ private final class DeclarativeModelCompositeIterator extends ForwardingIterator<TreeDataModelTuple> {
+
+ private UIComponent component;
+
+ private SequenceRowKey<DeclarativeModelKey> key;
+
+ private Iterator<TreeDataModelTuple> iterator;
+
+ public DeclarativeModelCompositeIterator(UIComponent component, SequenceRowKey<DeclarativeModelKey> key) {
+ super();
+ this.component = component;
+ this.key = key;
+ }
+
+ @Override
+ protected Iterator<TreeDataModelTuple> delegate() {
+ if (iterator == null) {
+ List<Iterator<TreeDataModelTuple>> list = Lists.newArrayList();
+
+ if (component instanceof TreeModelRecursiveAdaptor) {
+ TreeModelRecursiveAdaptor parentRecursiveAdaptor = (TreeModelRecursiveAdaptor) component;
+
+ Collection<?> nodes = (Collection<?>) parentRecursiveAdaptor.getNodes();
+
+ if (nodes != null) {
+ list.add(new DeclarativeModelIterator(component, key, nodes.iterator()));
+ }
+ }
+
+ if (component.getChildCount() > 0) {
+ for (UIComponent child : Iterables.filter(component.getChildren(), ComponentPredicates.isRendered())) {
+ Collection<?> nodes = null;
+
+ if (child instanceof TreeModelRecursiveAdaptor) {
+ TreeModelRecursiveAdaptor treeModelRecursiveAdaptor = (TreeModelRecursiveAdaptor) child;
+
+ nodes = (Collection<?>) treeModelRecursiveAdaptor.getRoots();
+ } else if (child instanceof TreeModelAdaptor) {
+ TreeModelAdaptor treeModelAdaptor = (TreeModelAdaptor) child;
+
+ nodes = (Collection<?>) treeModelAdaptor.getNodes();
+ }
+
+ if (nodes != null) {
+ list.add(new DeclarativeModelIterator(child, key, nodes.iterator()));
+ }
+ }
+ }
+
+ iterator = Iterators.concat(list.iterator());
+ }
+
+ return iterator;
+ }
+
+ }
+
+ private String var;
+
+ private Map<String, Object> contextMap;
+
+ private UIComponent tree;
+
+ private UIComponent currentComponent;
+
+ public DeclarativeTreeDataModelImpl(AbstractTree tree, String var, Map<String, Object> contextMap) {
+ super();
+ this.tree = tree;
+ this.currentComponent = tree;
+ this.var = var;
+ this.contextMap = contextMap;
+ }
+
+ protected UIComponent getCurrentComponent() {
+ return currentComponent;
+ }
+
+ protected void setCurrentState(SequenceRowKey<DeclarativeModelKey> key, Object data, UIComponent currentComponent) {
+ setRowKeyAndData(key, data);
+ this.currentComponent = currentComponent;
+ }
+
+ public boolean isLeaf() {
+ if (currentComponent instanceof TreeModelRecursiveAdaptor) {
+ return false;
+ }
+
+ if (currentComponent.getChildCount() == 0) {
+ return true;
+ }
+
+ return Iterables.contains(currentComponent.getChildren(), Predicates.instanceOf(TreeModelAdaptor.class));
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.model.TreeDataModel#children()
+ */
+ public Iterator<TreeDataModelTuple> children() {
+ return new DeclarativeModelCompositeIterator(currentComponent, safeGetRowKey());
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.model.TreeDataModel#getParentRowKey(java.lang.Object)
+ */
+ public Object getParentRowKey(Object rowKey) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Object getWrappedData() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void setWrappedData(Object data) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ protected void walkKey(SequenceRowKey<DeclarativeModelKey> key) {
+ Object initialContextValue = null;
+
+ if (var != null) {
+ initialContextValue = contextMap.remove(var);
+ }
+
+ try {
+ this.currentComponent = tree;
+
+ super.walkKey(key);
+ } finally {
+ if (var != null) {
+ try {
+ contextMap.put(var, initialContextValue);
+ } catch (Exception e) {
+ LOGGER.error(e.getMessage(), e);
+ }
+ }
+ }
+ }
+
+ @Override
+ protected void walkNext(DeclarativeModelKey segment) {
+ String modelId = segment.getModelId();
+
+ UIComponent modelComponent;
+
+ if (currentComponent instanceof TreeModelRecursiveAdaptor && modelId.equals(currentComponent.getId())) {
+ modelComponent = currentComponent;
+ } else {
+ modelComponent = Iterables.find(currentComponent.getChildren(), ComponentPredicates.withId(modelId));
+ }
+
+ Object nodes = null;
+
+ if (modelComponent instanceof TreeModelRecursiveAdaptor) {
+ TreeModelRecursiveAdaptor recursiveAdaptor = (TreeModelRecursiveAdaptor) modelComponent;
+
+ if (currentComponent.equals(modelComponent)) {
+ nodes = recursiveAdaptor.getNodes();
+ } else {
+ nodes = recursiveAdaptor.getRoots();
+ }
+ } else {
+ nodes = ((TreeModelAdaptor) modelComponent).getNodes();
+ }
+
+ Object data = Iterables.get((Iterable<?>) nodes, (Integer) segment.getModelKey());
+ setCurrentState(safeGetRowKey().append(segment), data, modelComponent);
+
+ if (var != null) {
+ contextMap.put(var, data);
+ }
+ }
+
+}
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/model/SwingTreeNodeDataModelImpl.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/model/SwingTreeNodeDataModelImpl.java 2010-11-29 20:36:39 UTC (rev 20214)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/model/SwingTreeNodeDataModelImpl.java 2010-11-29 20:44:15 UTC (rev 20215)
@@ -166,14 +166,8 @@
return rootNode.getWrappedData();
}
- @Override
protected TreeNode findChild(TreeNode parent, Integer simpleKey) {
- int idx = simpleKey.intValue();
- if (idx >= 0 && idx < parent.getChildCount()) {
- return parent.getChildAt(idx);
- }
-
- return null;
+ return parent.getChildAt(simpleKey.intValue());
}
public Iterator<TreeDataModelTuple> children() {
@@ -188,4 +182,13 @@
return !getData().getAllowsChildren();
}
}
+
+ @Override
+ protected void walkNext(Integer segment) {
+ TreeNode child = findChild(getData(), segment);
+ //TODO what if node is missing?
+ //TODO - optimize - remove partial keys creation
+ setRowKeyAndData(safeGetRowKey().append(segment), child);
+ }
+
}
\ No newline at end of file
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/model/TreeSequenceKeyModel.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/model/TreeSequenceKeyModel.java 2010-11-29 20:36:39 UTC (rev 20214)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/model/TreeSequenceKeyModel.java 2010-11-29 20:44:15 UTC (rev 20215)
@@ -34,6 +34,8 @@
*/
public abstract class TreeSequenceKeyModel<K, V> extends ExtendedDataModel<V> implements TreeDataModel<V> {
+ private final SequenceRowKey<K> emptyKey = new SequenceRowKey<K>();
+
private V rootNode;
private V data;
@@ -44,20 +46,33 @@
return rowKey;
}
+ protected SequenceRowKey<K> safeGetRowKey() {
+ SequenceRowKey<K> key = getRowKey();
+
+ if (key == null) {
+ key = emptyKey;
+ }
+
+ return key;
+ }
+
public void setRowKey(Object rowKey) {
if (this.rowKey == null || !this.rowKey.equals(rowKey)) {
- this.rowKey = (SequenceRowKey<K>) rowKey;
- this.data = findData(this.rowKey);
+ walkKey((SequenceRowKey<K>) rowKey);
}
}
+ protected void resetRowKeyAndData() {
+ setRowKeyAndData(null, rootNode);
+ }
+
protected void setRowKeyAndData(SequenceRowKey<K> key, V data) {
this.rowKey = key;
this.data = data;
}
public boolean isDataAvailable() {
- return data != null;
+ return getRowKey() == null || data != null;
}
public V getData() {
@@ -67,26 +82,18 @@
return data;
}
+
+ protected void walkKey(SequenceRowKey<K> key) {
+ resetRowKeyAndData();
- protected V findData(SequenceRowKey<K> key) {
- if (key == null) {
- return rootNode;
- }
-
- V result = rootNode;
-
- for (K simpleKey : key.getSimpleKeys()) {
- result = findChild(result, simpleKey);
-
- if (result == null) {
- break;
+ if (key != null) {
+ for (K simpleKey: key.getSimpleKeys()) {
+ walkNext(simpleKey);
}
}
-
- return result;
}
-
- protected abstract V findChild(V parent, K simpleKey);
+
+ protected abstract void walkNext(K segment);
protected V getRootNode() {
return rootNode;
14 years
JBoss Rich Faces SVN: r20214 - trunk/ui/iteration/ui/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-11-29 15:36:39 -0500 (Mon, 29 Nov 2010)
New Revision: 20214
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java
Log:
Added TODO to AbstractTree
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java 2010-11-29 20:28:16 UTC (rev 20213)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java 2010-11-29 20:36:39 UTC (rev 20214)
@@ -90,6 +90,7 @@
renderer = @JsfRenderer(type = "org.richfaces.TreeRenderer"),
attributes = {"events-props.xml", "core-props.xml", "i18n-props.xml"}
)
+//TODO add rowData caching for wrapper events
public abstract class AbstractTree extends UIDataAdaptor implements MetaComponentResolver, MetaComponentEncoder, TreeSelectionChangeSource, TreeToggleSource {
public static final String COMPONENT_TYPE = "org.richfaces.Tree";
14 years
JBoss Rich Faces SVN: r20213 - in trunk: ui/common/ui/src/main/java/org/richfaces/component and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-11-29 15:28:16 -0500 (Mon, 29 Nov 2010)
New Revision: 20213
Added:
trunk/ui/iteration/api/src/main/java/org/richfaces/model/TreeDataModelTuple.java
Removed:
trunk/ui/iteration/ui/src/main/java/org/richfaces/model/ExtendedTreeDataModelImpl.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/model/SequenceRowKeyIterator.java
Modified:
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/LazyTreeNode.java
trunk/ui/common/ui/src/main/java/org/richfaces/component/RowKeyContextEventWrapper.java
trunk/ui/common/ui/src/main/java/org/richfaces/component/UIDataAdaptor.java
trunk/ui/iteration/api/src/main/java/org/richfaces/model/TreeDataModel.java
trunk/ui/iteration/api/src/main/java/org/richfaces/model/TreeDataVisitor.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/TreeRange.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/model/SwingTreeNodeDataModelImpl.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/model/TreeSequenceKeyModel.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeEncoderBase.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeRendererBase.java
Log:
RF-9680:
- Added children() method to TreeDataModel & tuples
- Related refactorings for UIDataAdaptor
- Redesign API for walking over model
- Renderer updated for new API
Modified: trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/LazyTreeNode.java
===================================================================
--- trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/LazyTreeNode.java 2010-11-29 20:14:12 UTC (rev 20212)
+++ trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/LazyTreeNode.java 2010-11-29 20:28:16 UTC (rev 20213)
@@ -93,11 +93,7 @@
}
public boolean isLeaf() {
- if (children == null) {
- return false;
- }
-
- return children.isEmpty();
+ return false;
}
public Enumeration children() {
Modified: trunk/ui/common/ui/src/main/java/org/richfaces/component/RowKeyContextEventWrapper.java
===================================================================
--- trunk/ui/common/ui/src/main/java/org/richfaces/component/RowKeyContextEventWrapper.java 2010-11-29 20:14:12 UTC (rev 20212)
+++ trunk/ui/common/ui/src/main/java/org/richfaces/component/RowKeyContextEventWrapper.java 2010-11-29 20:28:16 UTC (rev 20213)
@@ -23,26 +23,34 @@
package org.richfaces.component;
import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
import javax.faces.event.FacesEvent;
import javax.faces.event.FacesListener;
import javax.faces.event.PhaseId;
+import org.richfaces.log.Logger;
+import org.richfaces.log.RichfacesLogger;
+
/**
* @author Nick Belaevski
*/
-class RowKeyContextEventWrapper extends FacesEvent {
+public class RowKeyContextEventWrapper extends FacesEvent {
- /**
- *
- */
private static final long serialVersionUID = -869970815228914529L;
+
+ private static final Logger LOGGER = RichfacesLogger.COMPONENTS.getLogger();
+
private FacesEvent event;
- private Object rowKey;
+ private Object eventRowKey;
- public RowKeyContextEventWrapper(UIComponent component, FacesEvent event, Object rowKey) {
+ private Object initialRowKey;
+
+ public RowKeyContextEventWrapper(UIDataAdaptor component, FacesEvent event, Object eventRowKey) {
super(component);
+
this.event = event;
- this.rowKey = rowKey;
+ this.eventRowKey = eventRowKey;
}
public FacesEvent getFacesEvent() {
@@ -65,10 +73,54 @@
throw new IllegalStateException();
}
- /**
- * @return the rowKey
- */
- public Object getRowKey() {
- return rowKey;
+ public UIDataAdaptor getComponent() {
+ return (UIDataAdaptor) super.getComponent();
}
+
+ public Object getEventRowKey() {
+ return eventRowKey;
+ }
+
+ protected void setupEventContext(FacesContext facesContext) {
+ getComponent().setRowKey(facesContext, getEventRowKey());
+ }
+
+ public void broadcast(FacesContext context) throws AbortProcessingException {
+ // Set up the correct context and fire our wrapped event
+ UIDataAdaptor dataAdaptor = getComponent();
+ initialRowKey = dataAdaptor.getRowKey();
+
+ UIComponent compositeParent = null;
+
+ UIComponent targetComponent = event.getComponent();
+
+ try {
+ if (!UIComponent.isCompositeComponent(targetComponent)) {
+ compositeParent = UIComponent.getCompositeComponentParent(targetComponent);
+ }
+
+ if (compositeParent != null) {
+ compositeParent.pushComponentToEL(context, null);
+ }
+
+ setupEventContext(context);
+
+ targetComponent.pushComponentToEL(context, null);
+ targetComponent.broadcast(event);
+ } finally {
+ try {
+ dataAdaptor.setRowKey(context, initialRowKey);
+ } catch (Exception e) {
+ LOGGER.error(e.getMessage(), e);
+ }
+
+ initialRowKey = null;
+
+ targetComponent.popComponentFromEL(context);
+
+ if (compositeParent != null) {
+ compositeParent.popComponentFromEL(context);
+ }
+ }
+ }
}
Modified: trunk/ui/common/ui/src/main/java/org/richfaces/component/UIDataAdaptor.java
===================================================================
--- trunk/ui/common/ui/src/main/java/org/richfaces/component/UIDataAdaptor.java 2010-11-29 20:14:12 UTC (rev 20212)
+++ trunk/ui/common/ui/src/main/java/org/richfaces/component/UIDataAdaptor.java 2010-11-29 20:28:16 UTC (rev 20213)
@@ -29,7 +29,6 @@
import java.util.Collections;
import java.util.Iterator;
import java.util.Map;
-import java.util.Set;
import javax.el.ValueExpression;
import javax.faces.FacesException;
@@ -244,8 +243,13 @@
//TODO nick - PSH support?
private DataComponentState componentState = null;
private ExtendedDataModel<?> extendedDataModel = null;
+
private Object rowKey = null;
+ private boolean rowDataIsSet = false;
+
+ private Object rowData;
+
private String clientId;
private Object originalVarValue;
@@ -348,18 +352,6 @@
}
/*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.component.AjaxChildrenEncoder#encodeAjaxChild(javax.faces.context.FacesContext,
- * java.lang.String, java.util.Set, java.util.Set)
- */
- public void encodeAjaxChild(FacesContext context, String path, Set<String> ids, Set<String> renderedAreas)
- throws IOException {
-
- // TODO Auto-generated method stub
- }
-
- /*
* (non-Javadoc)
* @see javax.faces.component.UniqueIdVendor#createUniqueId(javax.faces.context.FacesContext, java.lang.String)
*/
@@ -379,6 +371,34 @@
return rowKey;
}
+ private void setRowKeyAndData(FacesContext facesContext, Object rowKey, boolean localRowDataAvailable, Object localRowData) {
+ this.saveChildState(facesContext);
+
+ this.rowKey = rowKey;
+
+ if (localRowDataAvailable) {
+ this.rowData = localRowData;
+ this.rowDataIsSet = (rowKey != null);
+ } else {
+ this.rowData = null;
+ this.rowDataIsSet = false;
+
+ getExtendedDataModel().setRowKey(rowKey);
+ }
+
+ this.clientId = null;
+
+ boolean rowSelected = (rowKey != null) && isRowAvailable();
+
+ setupVariable(facesContext, rowSelected);
+
+ this.restoreChildState(facesContext);
+ }
+
+ protected void setRowKeyAndData(FacesContext facesContext, Object rowKey, Object localRowData) {
+ setRowKeyAndData(facesContext, rowKey, true, localRowData);
+ }
+
/**
* Setup current row by key. Perform same functionality as
* {@link javax.faces.component.UIData#setRowIndex(int)}, but for key object - it may be not only
@@ -390,15 +410,7 @@
* @param key new key value.
*/
public void setRowKey(FacesContext facesContext, Object rowKey) {
- this.saveChildState(facesContext);
- this.rowKey = rowKey;
- this.clientId = null;
- getExtendedDataModel().setRowKey(rowKey);
-
- boolean rowSelected = (rowKey != null) && isRowAvailable();
-
- setupVariable(facesContext, rowSelected);
- this.restoreChildState(facesContext);
+ setRowKeyAndData(facesContext, rowKey, false, null);
}
/**
@@ -546,13 +558,13 @@
setRowKey(getFacesContext(), rowKey);
}
- /*
- * (non-Javadoc)
- * @see javax.faces.component.UIComponentBase#queueEvent(javax.faces.event.FacesEvent)
- */
+ protected FacesEvent wrapEvent(FacesEvent event) {
+ return new RowKeyContextEventWrapper(this, event, getRowKey());
+ }
+
@Override
public void queueEvent(FacesEvent event) {
- super.queueEvent(new RowKeyContextEventWrapper(this, event, getRowKey()));
+ super.queueEvent(wrapEvent(event));
}
/*
@@ -561,64 +573,16 @@
*/
@Override
public void broadcast(FacesEvent event) throws AbortProcessingException {
- if (!(event instanceof RowKeyContextEventWrapper)) {
- if (!broadcastLocal(event)) {
- super.broadcast(event);
- }
-
- return;
+ if (event instanceof RowKeyContextEventWrapper) {
+ RowKeyContextEventWrapper eventWrapper = (RowKeyContextEventWrapper) event;
+
+ eventWrapper.broadcast(getFacesContext());
+ } else {
+ super.broadcast(event);
}
-
- FacesContext context = getFacesContext();
-
- // Set up the correct context and fire our wrapped event
- RowKeyContextEventWrapper revent = (RowKeyContextEventWrapper) event;
- Object oldRowKey = getRowKey();
-
- setRowKey(context, revent.getRowKey());
-
- FacesEvent rowEvent = revent.getFacesEvent();
- UIComponent source = rowEvent.getComponent();
- UIComponent compositeParent = null;
-
- try {
- if (!UIComponent.isCompositeComponent(source)) {
- compositeParent = UIComponent.getCompositeComponentParent(source);
- }
-
- if (compositeParent != null) {
- compositeParent.pushComponentToEL(context, null);
- }
-
- source.pushComponentToEL(context, null);
- source.broadcast(rowEvent);
- } finally {
- source.popComponentFromEL(context);
-
- if (compositeParent != null) {
- compositeParent.popComponentFromEL(context);
- }
- }
-
- setRowKey(context, oldRowKey);
}
/**
- * Process events targetted for concrete implementation. Hook method called
- * from {@link #broadcast(FacesEvent)}
- *
- * @param event -
- * processed event.
- * @return true if event processed, false if component must continue
- * processing.
- */
-
- // TODO - is it still actual?
- protected boolean broadcastLocal(FacesEvent event) {
- return false;
- }
-
- /**
* @return the extendedDataModel
*/
protected ExtendedDataModel<?> getExtendedDataModel() {
@@ -671,11 +635,15 @@
}
public Object getRowData() {
+ if (rowDataIsSet) {
+ return rowData;
+ }
+
return getExtendedDataModel().getRowData();
}
public boolean isRowAvailable() {
- return getExtendedDataModel().isRowAvailable();
+ return rowDataIsSet || getExtendedDataModel().isRowAvailable();
}
/**
Modified: trunk/ui/iteration/api/src/main/java/org/richfaces/model/TreeDataModel.java
===================================================================
--- trunk/ui/iteration/api/src/main/java/org/richfaces/model/TreeDataModel.java 2010-11-29 20:14:12 UTC (rev 20212)
+++ trunk/ui/iteration/api/src/main/java/org/richfaces/model/TreeDataModel.java 2010-11-29 20:28:16 UTC (rev 20213)
@@ -21,10 +21,8 @@
*/
package org.richfaces.model;
-import javax.faces.context.FacesContext;
+import java.util.Iterator;
-import org.ajax4jsf.model.DataVisitor;
-import org.ajax4jsf.model.Range;
/**
* @author Nick Belaevski
@@ -43,12 +41,8 @@
public E getData();
- public void walk(FacesContext context, DataVisitor visitor, Range range, Object argument);
+ public Iterator<TreeDataModelTuple> children();
- public void enterNode(DataVisitor visitor);
-
- public void exitNode(DataVisitor visitor);
-
public Object getParentRowKey(Object rowKey);
public Object getWrappedData();
Copied: trunk/ui/iteration/api/src/main/java/org/richfaces/model/TreeDataModelTuple.java (from rev 20136, trunk/ui/iteration/api/src/main/java/org/richfaces/model/TreeDataVisitor.java)
===================================================================
--- trunk/ui/iteration/api/src/main/java/org/richfaces/model/TreeDataModelTuple.java (rev 0)
+++ trunk/ui/iteration/api/src/main/java/org/richfaces/model/TreeDataModelTuple.java 2010-11-29 20:28:16 UTC (rev 20213)
@@ -0,0 +1,48 @@
+/*
+ * 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.model;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class TreeDataModelTuple {
+
+ private Object rowKey;
+
+ private Object data;
+
+ public TreeDataModelTuple(Object rowKey, Object data) {
+ super();
+ this.rowKey = rowKey;
+ this.data = data;
+ }
+
+ public Object getRowKey() {
+ return rowKey;
+ }
+
+ public Object getData() {
+ return data;
+ }
+
+}
Modified: trunk/ui/iteration/api/src/main/java/org/richfaces/model/TreeDataVisitor.java
===================================================================
--- trunk/ui/iteration/api/src/main/java/org/richfaces/model/TreeDataVisitor.java 2010-11-29 20:14:12 UTC (rev 20212)
+++ trunk/ui/iteration/api/src/main/java/org/richfaces/model/TreeDataVisitor.java 2010-11-29 20:28:16 UTC (rev 20213)
@@ -21,13 +21,12 @@
*/
package org.richfaces.model;
-import org.ajax4jsf.model.DataVisitor;
/**
* @author Nick Belaevski
*
*/
-public interface TreeDataVisitor extends DataVisitor {
+public interface TreeDataVisitor {
public void enterNode();
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java 2010-11-29 20:14:12 UTC (rev 20212)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java 2010-11-29 20:28:16 UTC (rev 20213)
@@ -45,11 +45,10 @@
import javax.faces.event.ExceptionQueuedEventContext;
import javax.faces.event.FacesEvent;
import javax.faces.event.PhaseId;
-import javax.swing.tree.TreeNode;
import org.ajax4jsf.model.DataComponentState;
+import org.ajax4jsf.model.DataVisitor;
import org.ajax4jsf.model.ExtendedDataModel;
-import org.ajax4jsf.model.Range;
import org.richfaces.application.MessageFactory;
import org.richfaces.application.ServiceTracker;
import org.richfaces.appplication.FacesMessages;
@@ -69,9 +68,10 @@
import org.richfaces.event.TreeToggleEvent;
import org.richfaces.event.TreeToggleListener;
import org.richfaces.event.TreeToggleSource;
-import org.richfaces.model.ExtendedTreeDataModelImpl;
import org.richfaces.model.SwingTreeNodeDataModelImpl;
import org.richfaces.model.TreeDataModel;
+import org.richfaces.model.TreeDataModelTuple;
+import org.richfaces.model.TreeDataVisitor;
import org.richfaces.renderkit.MetaComponentRenderer;
import com.google.common.base.Predicate;
@@ -125,31 +125,31 @@
private static final Converter ROW_KEY_CONVERTER = new SequenceRowKeyConverter();
- /**
- * @author Nick Belaevski
- *
- */
- private final class TreeComponentState implements DataComponentState {
- public Range getRange() {
- return new TreeRange(getFacesContext(), AbstractTree.this);
- }
- }
-
private enum PropertyKeys {
selection
}
-
+
@Attribute(generate = false, signature = @Signature(returnType = Void.class, parameters = TreeSelectionChangeEvent.class))
private MethodExpression selectionChangeListener;
@Attribute(generate = false, signature = @Signature(returnType = Void.class, parameters = TreeToggleListener.class))
private MethodExpression toggleListener;
+ private transient TreeRange treeRange;
+
public AbstractTree() {
setKeepSaved(true);
setRendererType("org.richfaces.TreeRenderer");
}
+ protected TreeRange getTreeRange() {
+ if (treeRange == null) {
+ treeRange = new TreeRange(this);
+ }
+
+ return treeRange;
+ }
+
public abstract Object getValue();
public abstract boolean isImmediate();
@@ -217,13 +217,6 @@
}
@Override
- protected ExtendedDataModel<?> createExtendedDataModel() {
- ExtendedTreeDataModelImpl<?> model = new ExtendedTreeDataModelImpl<TreeNode>(new SwingTreeNodeDataModelImpl());
- model.setWrappedData(getValue());
- return model;
- }
-
- @Override
protected DataComponentState createComponentState() {
// TODO Auto-generated method stub
return null;
@@ -403,11 +396,6 @@
}
}
- @Override
- public DataComponentState getComponentState() {
- return new TreeComponentState();
- }
-
public void addTreeSelectionChangeListener(TreeSelectionChangeListener listener) {
addFacesListener(listener);
}
@@ -448,12 +436,87 @@
return treeNode.isExpanded();
}
+ //TODO review
+ protected TreeDataModel<?> getTreeDataModel() {
+ return (TreeDataModel<?>) getExtendedDataModel();
+ }
+
@Attribute(hidden = true)
public boolean isLeaf() {
if (getRowKey() == null) {
return false;
}
- return ((TreeDataModel<?>) getExtendedDataModel()).isLeaf();
+ return getTreeDataModel().isLeaf();
}
+
+ @Override
+ public void walk(final FacesContext faces, final DataVisitor visitor, final Object argument) {
+ walkModel(faces, new TreeDataVisitor() {
+
+ public void enterNode() {
+ visitor.process(faces, getRowKey(), argument);
+ }
+
+ public void exitNode() {
+ }
+
+ });
+ }
+
+ @Override
+ protected ExtendedDataModel<?> createExtendedDataModel() {
+ SwingTreeNodeDataModelImpl dataModel = new SwingTreeNodeDataModelImpl();
+ dataModel.setWrappedData(getValue());
+ return dataModel;
+ }
+
+ public void walkModel(FacesContext context, TreeDataVisitor dataVisitor) {
+ TreeDataModel<?> model = getTreeDataModel();
+
+ if (!getTreeRange().shouldProcessNode()) {
+ return;
+ }
+
+ boolean isRootNode = (getRowKey() == null);
+
+ if (!isRootNode) {
+ dataVisitor.enterNode();
+ }
+
+ walkModelChildren(context, dataVisitor, model);
+
+ if (!isRootNode) {
+ dataVisitor.exitNode();
+ }
+ }
+
+ private void walkModelChildren(FacesContext context, TreeDataVisitor dataVisitor, TreeDataModel<?> model) {
+ if (!getTreeRange().shouldIterateChildren()) {
+ return;
+ }
+
+ Iterator<TreeDataModelTuple> childrenTuples = model.children();
+ while (childrenTuples.hasNext()) {
+ TreeDataModelTuple tuple = childrenTuples.next();
+
+ setRowKeyAndData(context, tuple.getRowKey(), tuple.getData());
+
+ if (!getTreeRange().shouldProcessNode()) {
+ continue;
+ }
+
+ dataVisitor.enterNode();
+
+ walkModelChildren(context, dataVisitor, model);
+
+ dataVisitor.exitNode();
+ }
+ }
+
+ @Override
+ protected void resetDataModel() {
+ super.resetDataModel();
+ treeRange = null;
+ }
}
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/TreeRange.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/TreeRange.java 2010-11-29 20:14:12 UTC (rev 20212)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/TreeRange.java 2010-11-29 20:28:16 UTC (rev 20213)
@@ -21,8 +21,6 @@
*/
package org.richfaces.component;
-import javax.faces.context.FacesContext;
-
import org.ajax4jsf.model.Range;
/**
@@ -31,26 +29,27 @@
*/
public class TreeRange implements Range {
- private FacesContext facesContext;
-
private AbstractTree tree;
private boolean traverseAll;
- public TreeRange(FacesContext facesContext, AbstractTree tree) {
+ public TreeRange(AbstractTree tree) {
super();
- this.facesContext = facesContext;
this.tree = tree;
traverseAll = (SwitchType.client == tree.getToggleType());
}
- public boolean shouldIterateChildren(Object rowKey) {
- if (traverseAll) {
- return true;
+ public boolean shouldProcessNode() {
+ return tree.findTreeNodeComponent() != null;
+ }
+
+ public boolean shouldIterateChildren() {
+ if (tree.isLeaf()) {
+ return false;
}
- return !tree.isLeaf() && tree.isExpanded();
+ return traverseAll || tree.isExpanded();
}
}
Deleted: trunk/ui/iteration/ui/src/main/java/org/richfaces/model/ExtendedTreeDataModelImpl.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/model/ExtendedTreeDataModelImpl.java 2010-11-29 20:14:12 UTC (rev 20212)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/model/ExtendedTreeDataModelImpl.java 2010-11-29 20:28:16 UTC (rev 20213)
@@ -1,133 +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.model;
-
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.model.DataVisitor;
-import org.ajax4jsf.model.ExtendedDataModel;
-import org.ajax4jsf.model.Range;
-
-/**
- * @author Nick Belaevski
- *
- */
-public class ExtendedTreeDataModelImpl<E> extends ExtendedDataModel<E> implements TreeDataModel<E> {
-
- private TreeDataModel<E> wrappedModel;
-
- public ExtendedTreeDataModelImpl(TreeDataModel<E> wrappedModel) {
- super();
- this.wrappedModel = wrappedModel;
- }
-
- public boolean isDataAvailable() {
- return wrappedModel.isDataAvailable();
- }
-
- public E getData() {
- return wrappedModel.getData();
- }
-
- public Object getParentRowKey(Object rowKey) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setRowKey(Object key) {
- wrappedModel.setRowKey(key);
- }
-
- @Override
- public Object getRowKey() {
- return wrappedModel.getRowKey();
- }
-
- @Override
- public void walk(FacesContext context, DataVisitor visitor, Range range, Object argument) {
- wrappedModel.enterNode(visitor);
- wrappedModel.walk(context, visitor, range, argument);
- wrappedModel.exitNode(visitor);
- }
-
- @Override
- public boolean isRowAvailable() {
- return wrappedModel.isDataAvailable();
- }
-
- @Override
- public int getRowCount() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public E getRowData() {
- return wrappedModel.getData();
- }
-
- @Override
- public int getRowIndex() {
- throw new UnsupportedOperationException();
- }
-
- public void setRowIndex(int rowIndex) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Object getWrappedData() {
- return wrappedModel.getWrappedData();
- }
-
- @Override
- public void setWrappedData(Object data) {
- wrappedModel.setWrappedData(data);
- }
-
- /* (non-Javadoc)
- * @see org.richfaces.model.TreeDataModel#isLeaf()
- */
- public boolean isLeaf() {
- // TODO Auto-generated method stub
- return wrappedModel.isLeaf();
- }
-
- /* (non-Javadoc)
- * @see org.richfaces.model.TreeDataModel#enterNode(org.ajax4jsf.model.DataVisitor)
- */
- public void enterNode(DataVisitor visitor) {
- // TODO Auto-generated method stub
-
- wrappedModel.enterNode(visitor);
- }
-
- /* (non-Javadoc)
- * @see org.richfaces.model.TreeDataModel#exitNode(org.ajax4jsf.model.DataVisitor)
- */
- public void exitNode(DataVisitor visitor) {
- // TODO Auto-generated method stub
-
- wrappedModel.exitNode(visitor);
- }
-
-
-}
Deleted: trunk/ui/iteration/ui/src/main/java/org/richfaces/model/SequenceRowKeyIterator.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/model/SequenceRowKeyIterator.java 2010-11-29 20:14:12 UTC (rev 20212)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/model/SequenceRowKeyIterator.java 2010-11-29 20:28:16 UTC (rev 20213)
@@ -1,98 +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.model;
-
-import java.util.Iterator;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-
-/**
- * @author Nick Belaevski
- *
- */
-public abstract class SequenceRowKeyIterator<K, T> implements Iterator<Object> {
-
- private SequenceRowKey<K> baseKey;
-
- private Iterator<T> itr;
-
- private T element;
-
- private SequenceRowKey<K> elementKey;
-
- private T baseElement;
-
- public SequenceRowKeyIterator(SequenceRowKey<K> baseKey, T baseElement, Iterator<T> itr) {
- super();
- this.baseKey = baseKey;
- this.baseElement = baseElement;
- this.itr = itr;
- }
-
- public boolean hasNext() {
- return itr.hasNext();
- }
-
- protected abstract K nextKey();
-
- public Object next() {
- element = itr.next();
-
- if (baseKey != null) {
- elementKey = baseKey.append(nextKey());
- } else {
- elementKey = new SequenceRowKey<K>(nextKey());
- }
-
- return elementKey;
- }
-
- public T getElement() {
- return element;
- }
-
- public SequenceRowKey<K> getBaseKey() {
- return baseKey;
- }
-
- public T getBaseElement() {
- return baseElement;
- }
-
- public SequenceRowKey<K> getElementKey() {
- return elementKey;
- }
-
- public void remove() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public String toString() {
- ToStringHelper helper = Objects.toStringHelper(this);
-
- helper.add("element", element).add("elementKey", elementKey);
-
- return helper.toString();
- }
-}
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/model/SwingTreeNodeDataModelImpl.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/model/SwingTreeNodeDataModelImpl.java 2010-11-29 20:14:12 UTC (rev 20212)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/model/SwingTreeNodeDataModelImpl.java 2010-11-29 20:28:16 UTC (rev 20213)
@@ -38,35 +38,49 @@
*/
public class SwingTreeNodeDataModelImpl extends TreeSequenceKeyModel<Integer, TreeNode> {
- /**
- * @author Nick Belaevski
- *
- */
- private static final class SwingTreeNodeRowKeyIterator extends SequenceRowKeyIterator<Integer, TreeNode> {
+ private final class SwingTreeNodeRowKeyIterator implements Iterator<TreeDataModelTuple> {
+
+ private SequenceRowKey<Integer> baseKey;
+ private Iterator<TreeNode> children;
+
private int counter = 0;
- /**
- * @param baseKey
- * @param baseElement
- * @param itr
- */
- private SwingTreeNodeRowKeyIterator(SequenceRowKey<Integer> baseKey, TreeNode baseElement,
- Iterator<TreeNode> itr) {
- super(baseKey, baseElement, itr);
+ private SwingTreeNodeRowKeyIterator(SequenceRowKey<Integer> baseKey, Iterator<TreeNode> children) {
+ this.baseKey = baseKey;
+ this.children = children;
}
- @Override
- protected Integer nextKey() {
+ private int getNextCounterValue() {
return counter++;
}
+
+ public boolean hasNext() {
+ return children.hasNext();
+ }
+
+ public TreeDataModelTuple next() {
+ TreeNode node = children.next();
+
+ SequenceRowKey<Integer> key;
+
+ if (baseKey != null) {
+ key = baseKey.append(getNextCounterValue());
+ } else {
+ key = new SequenceRowKey<Integer>(getNextCounterValue());
+ }
+
+ setRowKeyAndData(key, node);
+
+ return new TreeDataModelTuple(key, node);
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+
}
-
- /**
- * @author Nick Belaevski
- *
- */
private final class FakeRootNode implements TreeNode {
private Collection<TreeNode> wrappedData;
@@ -125,7 +139,9 @@
}
}
- private Iterator<TreeNode> safeGetChildren(SequenceRowKey<Integer> key, TreeNode treeNode) {
+ private boolean asksAllowsChildren = false;
+
+ private Iterator<TreeNode> safeGetChildren(TreeNode treeNode) {
if (treeNode == null) {
return Iterators.emptyIterator();
}
@@ -138,16 +154,6 @@
throw new UnsupportedOperationException();
}
- public boolean isLeaf() {
- if (!isDataAvailable()) {
- throw new IllegalStateException();
- }
-
- TreeNode treeNode = getData();
-
- return !treeNode.getAllowsChildren() || treeNode.isLeaf();
- }
-
public void setWrappedData(Object data) {
setRootNode(new FakeRootNode((Collection<TreeNode>) data));
}
@@ -170,11 +176,16 @@
return null;
}
+ public Iterator<TreeDataModelTuple> children() {
+ return new SwingTreeNodeRowKeyIterator(getRowKey(), safeGetChildren(getData()));
+ }
- @Override
- protected SequenceRowKeyIterator<Integer, TreeNode> createChildrenIterator(SequenceRowKey<Integer> baseKey,
- TreeNode value) {
-
- return new SwingTreeNodeRowKeyIterator(baseKey, value, safeGetChildren(baseKey, value));
+
+ public boolean isLeaf() {
+ if (!asksAllowsChildren) {
+ return getData().isLeaf();
+ } else {
+ return !getData().getAllowsChildren();
+ }
}
-}
+}
\ No newline at end of file
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/model/TreeSequenceKeyModel.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/model/TreeSequenceKeyModel.java 2010-11-29 20:14:12 UTC (rev 20212)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/model/TreeSequenceKeyModel.java 2010-11-29 20:28:16 UTC (rev 20213)
@@ -21,85 +21,58 @@
*/
package org.richfaces.model;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.ListIterator;
-
import javax.faces.context.FacesContext;
import org.ajax4jsf.model.DataVisitor;
+import org.ajax4jsf.model.ExtendedDataModel;
import org.ajax4jsf.model.Range;
-import org.richfaces.component.TreeRange;
+
/**
* @author Nick Belaevski
*
*/
-public abstract class TreeSequenceKeyModel<K, V> implements TreeDataModel<V> {
+public abstract class TreeSequenceKeyModel<K, V> extends ExtendedDataModel<V> implements TreeDataModel<V> {
private V rootNode;
- private V currentData;
+ private V data;
- private SequenceRowKey<K> currentRowKey;
+ private SequenceRowKey<K> rowKey;
- private LinkedList<SequenceRowKeyIterator<K, V>> keysStack = new LinkedList<SequenceRowKeyIterator<K, V>>();
-
public SequenceRowKey<K> getRowKey() {
- return currentRowKey;
+ return rowKey;
}
public void setRowKey(Object rowKey) {
- this.currentRowKey = (SequenceRowKey<K>) rowKey;
- this.currentData = findData(currentRowKey);
+ if (this.rowKey == null || !this.rowKey.equals(rowKey)) {
+ this.rowKey = (SequenceRowKey<K>) rowKey;
+ this.data = findData(this.rowKey);
+ }
}
+ protected void setRowKeyAndData(SequenceRowKey<K> key, V data) {
+ this.rowKey = key;
+ this.data = data;
+ }
+
public boolean isDataAvailable() {
- return currentRowKey == null || currentData != null;
+ return data != null;
}
- public abstract boolean isLeaf();
-
public V getData() {
if (!isDataAvailable()) {
throw new IllegalArgumentException();
}
- return currentData;
+ return data;
}
- protected boolean isRootNodeKey(SequenceRowKey<K> key) {
- return key == null || key.getLastKeySegment() == null;
- }
-
protected V findData(SequenceRowKey<K> key) {
if (key == null) {
return rootNode;
}
- if (!keysStack.isEmpty()) {
- ListIterator<SequenceRowKeyIterator<K, V>> listIterator = keysStack.listIterator(keysStack.size());
-
- while (listIterator.hasPrevious()) {
- SequenceRowKeyIterator<K, V> previous = listIterator.previous();
-
- V baseNode = null;
-
- SequenceRowKey<K> baseKey = previous.getBaseKey();
- if (isRootNodeKey(baseKey) && isRootNodeKey(key.getParent())) {
- baseNode = rootNode;
- } else if (baseKey.equals(key.getParent())) {
- baseNode = previous.getBaseElement();
- }
-
- if (baseNode == null) {
- continue;
- }
-
- return findChild(baseNode, key.getLastKeySegment());
- }
- }
-
V result = rootNode;
for (K simpleKey : key.getSimpleKeys()) {
@@ -115,54 +88,47 @@
protected abstract V findChild(V parent, K simpleKey);
- protected abstract SequenceRowKeyIterator<K, V> createChildrenIterator(SequenceRowKey<K> baseKey, V value);
+ protected V getRootNode() {
+ return rootNode;
+ }
- public void enterNode(DataVisitor visitor) {
- SequenceRowKey<K> sequenceKey = getRowKey();
- V data = findData(sequenceKey);
-
- keysStack.addLast(createChildrenIterator(sequenceKey, data));
+ protected void setRootNode(V rootNode) {
+ this.rootNode = rootNode;
+ }
+
+ //TODO ExtendedDataModel legacy
+ @Override
+ public void walk(FacesContext context, DataVisitor visitor, Range range, Object argument) {
+ throw new UnsupportedOperationException();
+ }
- if (visitor instanceof TreeDataVisitor) {
- ((TreeDataVisitor) visitor).enterNode();
- }
+
+ @Override
+ public boolean isRowAvailable() {
+ return isDataAvailable();
}
- public void walk(FacesContext context, DataVisitor visitor, Range range, Object argument) {
- if (getRowKey() != null) {
- visitor.process(context, getRowKey(), argument);
- }
- TreeRange treeRange = (TreeRange) range;
-
- if (treeRange.shouldIterateChildren(getRowKey())) {
- enterNode(visitor);
- Iterator<Object> keysIterator = keysStack.getLast();
- while (keysIterator.hasNext()) {
- Object key = (Object) keysIterator.next();
- setRowKey(key);
- walk(context, visitor, range, argument);
- }
- exitNode(visitor);
- }
+ @Override
+ public int getRowCount() {
+ throw new UnsupportedOperationException();
}
- public void exitNode(DataVisitor visitor) {
- if (visitor instanceof TreeDataVisitor) {
- ((TreeDataVisitor) visitor).exitNode();
- }
- keysStack.removeLast();
+ @Override
+ public V getRowData() {
+ return getData();
}
- public abstract Object getParentRowKey(Object rowKey);
- protected V getRootNode() {
- return rootNode;
+ @Override
+ public int getRowIndex() {
+ throw new UnsupportedOperationException();
}
-
- protected void setRootNode(V rootNode) {
- this.rootNode = rootNode;
+
+
+ @Override
+ public void setRowIndex(int rowIndex) {
+ throw new UnsupportedOperationException();
}
-
}
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeEncoderBase.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeEncoderBase.java 2010-11-29 20:14:12 UTC (rev 20212)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeEncoderBase.java 2010-11-29 20:28:16 UTC (rev 20213)
@@ -22,20 +22,16 @@
package org.richfaces.renderkit;
import java.io.IOException;
-import java.util.LinkedList;
-import javax.faces.FacesException;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.javascript.JSFunction;
-import org.ajax4jsf.model.DataVisitResult;
import org.richfaces.component.AbstractTree;
import org.richfaces.component.AbstractTreeNode;
import org.richfaces.component.util.HtmlUtil;
import org.richfaces.model.TreeDataVisitor;
-import org.richfaces.renderkit.TreeRendererBase.QueuedData;
abstract class TreeEncoderBase implements TreeDataVisitor {
@@ -47,10 +43,6 @@
protected final AbstractTree tree;
- private LinkedList<QueuedData> queuedDataList = new LinkedList<QueuedData>();
-
- private QueuedData queuedData;
-
public TreeEncoderBase(FacesContext context, AbstractTree tree) {
super();
this.context = context;
@@ -59,87 +51,36 @@
}
protected void encodeTree() throws IOException {
- tree.walk(context, this, null);
+ tree.walkModel(context, this);
}
- protected void flushNode() throws IOException {
- if (!queuedData.isEncoded()) {
- tree.setRowKey(context, queuedData.getRowKey());
-
- TreeNodeState state;
- if (tree.isLeaf()) {
- state = TreeNodeState.leaf;
+ public void enterNode() {
+ TreeNodeState state;
+ if (tree.isLeaf()) {
+ state = TreeNodeState.leaf;
+ } else {
+ if (tree.isExpanded()) {
+ state = TreeNodeState.expanded;
} else {
- if (queuedData.isVisited()) {
- state = TreeNodeState.leaf;
- } else {
- state = TreeNodeState.collapsed;
- }
+ state = TreeNodeState.collapsed;
}
-
- writeTreeNodeStartElement(state);
}
-
- writeTreeNodeEndElement();
- }
-
- protected void flushParentNode() throws IOException {
- if (queuedDataList.isEmpty()) {
- return;
- }
- QueuedData data = queuedDataList.getLast();
- if (!data.isEncoded()) {
- data.setEncoded(true);
- tree.setRowKey(context, data.getRowKey());
-
- writeTreeNodeStartElement(tree.isExpanded() ? TreeNodeState.expanded : TreeNodeState.collapsed);
- }
- }
-
- public void enterNode() {
- if (queuedData != null) {
- queuedData.makeVisited();
- queuedDataList.add(queuedData);
- queuedData = null;
- }
- }
-
- public DataVisitResult process(FacesContext context, Object rowKey, Object argument) {
try {
- if (queuedData != null) {
- flushNode();
- queuedData = null;
- } else {
- flushParentNode();
- }
+ writeTreeNodeStartElement(state);
+ tree.findTreeNodeComponent().encodeAll(context);
} catch (IOException e) {
- throw new FacesException(e.getMessage(), e);
+ // TODO Auto-generated catch block
+ e.printStackTrace();
}
-
- if (rowKey != null) {
- tree.setRowKey(context, rowKey);
-
- if (tree.isRowAvailable() && tree.findTreeNodeComponent() != null) {
- queuedData = new QueuedData(rowKey);
- }
- }
-
- return DataVisitResult.CONTINUE;
}
-
+
public void exitNode() {
try {
- if (queuedData != null) {
- flushNode();
- queuedData = null;
- }
-
- if (!queuedDataList.isEmpty()) {
- queuedData = queuedDataList.removeLast();
- }
+ writeTreeNodeEndElement();
} catch (IOException e) {
- throw new FacesException(e.getMessage(), e);
+ // TODO Auto-generated catch block
+ e.printStackTrace();
}
}
@@ -155,7 +96,6 @@
responseWriter.writeAttribute(HtmlConstants.ID_ATTRIBUTE, treeNodeComponent.getClientId(context), null);
emitClientToggleEvent(treeNodeComponent, nodeState);
- treeNodeComponent.encodeAll(context);
}
protected void writeTreeNodeEndElement() throws IOException {
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeRendererBase.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeRendererBase.java 2010-11-29 20:14:12 UTC (rev 20212)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeRendererBase.java 2010-11-29 20:28:16 UTC (rev 20213)
@@ -84,39 +84,6 @@
}
}
- static final class QueuedData {
-
- private Object rowKey;
-
- private boolean encoded;
-
- private boolean visited;
-
- public QueuedData(Object rowKey) {
- this.rowKey = rowKey;
- }
-
- public void setEncoded(boolean encoded) {
- this.encoded = encoded;
- }
-
- public boolean isEncoded() {
- return encoded;
- }
-
- public Object getRowKey() {
- return rowKey;
- }
-
- public boolean isVisited() {
- return visited;
- }
-
- public void makeVisited() {
- visited = true;
- }
- }
-
public void encodeTree(FacesContext context, UIComponent component) throws IOException {
AbstractTree tree = (AbstractTree) component;
14 years
JBoss Rich Faces SVN: r20212 - in trunk: examples/output-demo/src/main/webapp/examples and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-11-29 15:14:12 -0500 (Mon, 29 Nov 2010)
New Revision: 20212
Modified:
trunk/examples/output-demo/src/main/java/org/richfaces/ProgressBarBean.java
trunk/examples/output-demo/src/main/webapp/examples/progressbar.xhtml
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarBaseRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarState.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarStateEncoder.java
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/progressBar.ecss
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/progressBar.js
trunk/ui/output/ui/src/main/templates/progressBar.template.xml
Log:
Small progress bar fixes:
- Incorrect state displayed when no 'initial' or 'finish' facet was provided
- rf-pb class was not encoded
- Incorrect alignment in IE7
Modified: trunk/examples/output-demo/src/main/java/org/richfaces/ProgressBarBean.java
===================================================================
--- trunk/examples/output-demo/src/main/java/org/richfaces/ProgressBarBean.java 2010-11-29 18:38:41 UTC (rev 20211)
+++ trunk/examples/output-demo/src/main/java/org/richfaces/ProgressBarBean.java 2010-11-29 20:14:12 UTC (rev 20212)
@@ -31,7 +31,11 @@
private boolean childrenRendered = false;
private boolean enabled = false;
-
+
+ private boolean initialFacetRendered = true;
+
+ private boolean finishFacetRendered = true;
+
public boolean isEnabled() {
return enabled;
}
@@ -80,6 +84,22 @@
this.childrenRendered = childrenRendered;
}
+ public boolean isInitialFacetRendered() {
+ return initialFacetRendered;
+ }
+
+ public void setInitialFacetRendered(boolean renderInitialFacet) {
+ this.initialFacetRendered = renderInitialFacet;
+ }
+
+ public boolean isFinishFacetRendered() {
+ return finishFacetRendered;
+ }
+
+ public void setFinishFacetRendered(boolean renderFinishFacet) {
+ this.finishFacetRendered = renderFinishFacet;
+ }
+
public void decreaseValueByFive() {
value -= 5;
}
Modified: trunk/examples/output-demo/src/main/webapp/examples/progressbar.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/examples/progressbar.xhtml 2010-11-29 18:38:41 UTC (rev 20211)
+++ trunk/examples/output-demo/src/main/webapp/examples/progressbar.xhtml 2010-11-29 20:14:12 UTC (rev 20212)
@@ -41,6 +41,14 @@
<br />
+ 'initial' facet rendered: <h:selectBooleanCheckbox value="#{progressBarBean.initialFacetRendered}" onclick="submit()" />
+
+ <br />
+
+ 'finish' facet rendered: <h:selectBooleanCheckbox value="#{progressBarBean.finishFacetRendered}" onclick="submit()" />
+
+ <br />
+
Enabled: <h:selectBooleanCheckbox value="#{progressBarBean.enabled}" onclick="submit()" />
</h:form>
@@ -54,11 +62,15 @@
<h:outputText value="child + " rendered="#{progressBarBean.childrenRendered}" />
<f:facet name="initial">
- <h:outputText value="In initial state" />
+ <h:panelGroup rendered="#{progressBarBean.initialFacetRendered}">
+ <h:outputText value="In initial state" />
+ </h:panelGroup>
</f:facet>
<f:facet name="finish">
- <h:outputText value="Finished progress" />
+ <h:panelGroup rendered="#{progressBarBean.finishFacetRendered}">
+ <h:outputText value="Finished progress" />
+ </h:panelGroup>
</f:facet>
</rich:progressBar>
@@ -78,11 +90,15 @@
<h:outputText value="child + " rendered="#{progressBarBean.childrenRendered}" />
<f:facet name="initial">
- <h:outputText value="initial ~ #{progressBarBean.currentTimeAsString}" />
+ <h:panelGroup rendered="#{progressBarBean.initialFacetRendered}">
+ <h:outputText value="initial ~ #{progressBarBean.currentTimeAsString}" />
+ </h:panelGroup>
</f:facet>
<f:facet name="finish">
- <h:outputText value="finish ~ #{progressBarBean.currentTimeAsString}" />
+ <h:panelGroup rendered="#{progressBarBean.finishFacetRendered}">
+ <h:outputText value="finish ~ #{progressBarBean.currentTimeAsString}" />
+ </h:panelGroup>
</f:facet>
</rich:progressBar>
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarBaseRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarBaseRenderer.java 2010-11-29 18:38:41 UTC (rev 20211)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarBaseRenderer.java 2010-11-29 20:14:12 UTC (rev 20212)
@@ -107,13 +107,24 @@
Number minValue = NumberUtils.getNumber(component.getAttributes().get("minValue"));
Number maxValue = NumberUtils.getNumber(component.getAttributes().get("maxValue"));
Number value = NumberUtils.getNumber(component.getAttributes().get("value"));
+
+ ProgressBarState result;
+
if (value.doubleValue() <= minValue.doubleValue()) {
- return ProgressBarState.initialState;
+ result = ProgressBarState.initialState;
} else if (value.doubleValue() > maxValue.doubleValue()) {
- return ProgressBarState.finishState;
+ result = ProgressBarState.finishState;
} else {
- return ProgressBarState.progressState;
+ result = ProgressBarState.progressState;
}
+
+ if (result == ProgressBarState.initialState || result == ProgressBarState.finishState) {
+ if (!result.hasContent(context, component)) {
+ result = ProgressBarState.progressState;
+ }
+ }
+
+ return result;
}
protected String getStateDisplayStyle(String currentState, String state) {
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarState.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarState.java 2010-11-29 18:38:41 UTC (rev 20211)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarState.java 2010-11-29 20:14:12 UTC (rev 20212)
@@ -43,13 +43,16 @@
@Override
public void encodeContent(FacesContext context, UIComponent component) throws IOException {
- UIComponent facet = component.getFacet("initial");
- if (facet != null) {
- facet.encodeAll(context);
- }
+ component.getFacet("initial").encodeAll(context);
}
@Override
+ public boolean hasContent(FacesContext context, UIComponent component) {
+ UIComponent facet = component.getFacet("initial");
+ return facet != null && facet.isRendered();
+ }
+
+ @Override
public void encodeStateForMetaComponent(FacesContext context, UIComponent component,
ProgressBarStateEncoder encoder) throws IOException {
@@ -87,6 +90,11 @@
}
@Override
+ public boolean hasContent(FacesContext context, UIComponent component) {
+ return true;
+ }
+
+ @Override
public void encodeStateForMetaComponent(FacesContext context, UIComponent component,
ProgressBarStateEncoder encoder) throws IOException {
@@ -114,6 +122,12 @@
}
@Override
+ public boolean hasContent(FacesContext context, UIComponent component) {
+ UIComponent facet = component.getFacet("finish");
+ return facet != null && facet.isRendered();
+ }
+
+ @Override
public void encodeStateForMetaComponent(FacesContext context, UIComponent component,
ProgressBarStateEncoder encoder) throws IOException {
@@ -127,5 +141,7 @@
public abstract void encodeContent(FacesContext context, UIComponent component) throws IOException;
+ public abstract boolean hasContent(FacesContext context, UIComponent component);
+
public abstract void encodeStateForMetaComponent(FacesContext context, UIComponent component, ProgressBarStateEncoder encoder) throws IOException;
}
\ No newline at end of file
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarStateEncoder.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarStateEncoder.java 2010-11-29 18:38:41 UTC (rev 20211)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarStateEncoder.java 2010-11-29 20:14:12 UTC (rev 20212)
@@ -50,6 +50,11 @@
private void encodeStateFacet(FacesContext context, UIComponent component, ProgressBarState state,
ProgressBarState currentState) throws IOException {
+
+ if (!state.hasContent(context, component)) {
+ return;
+ }
+
String clientId = state.getStateClientId(context, component);
ResponseWriter responseWriter = context.getResponseWriter();
@@ -103,6 +108,11 @@
public void encodeProgressStateContent(FacesContext context, UIComponent component, ProgressBarState currentState)
throws IOException {
+
+ if (!ProgressBarState.progressState.hasContent(context, component)) {
+ return;
+ }
+
ResponseWriter responseWriter = context.getResponseWriter();
String stateClientId = ProgressBarState.progressState.getStateClientId(context, component);
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/progressBar.ecss
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/progressBar.ecss 2010-11-29 18:38:41 UTC (rev 20211)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/progressBar.ecss 2010-11-29 20:14:12 UTC (rev 20212)
@@ -15,7 +15,6 @@
font-size: '#{richSkin.generalSizeFont}';
font-weight: bold;
- text-align: center;
text-color: '#{richSkin.controlTextColor}';
background-color: '#{richSkin.controlBackgroundColor}';
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/progressBar.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/progressBar.js 2010-11-29 18:38:41 UTC (rev 20211)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/progressBar.js 2010-11-29 20:14:12 UTC (rev 20212)
@@ -110,6 +110,11 @@
__showState: function (state) {
var stateElt = $(stateSelectors[state], this.__elt);
+
+ if (stateElt.length == 0 && (state == 'initial' || state == 'finish')) {
+ stateElt = $(stateSelectors['progress'], this.__elt)
+ }
+
stateElt.show().siblings().hide();
},
@@ -125,19 +130,24 @@
if (this.__isInitialState()) {
this.__showState("initial");
} else if (this.__isFinishState()) {
- rf.Event.callHandler(this.__elt, "finish");
this.__showState("finish");
} else {
this.__showState("progress");
-
- var p = this.__calculatePercent(this.value);
- $(".rf-pb-prgs", this.__elt).css('width', p + "%");
}
+
+ var p = this.__calculatePercent(this.value);
+ $(".rf-pb-prgs", this.__elt).css('width', p + "%");
},
setValue: function(val) {
+ var wasInFinishState = this.__isFinishState();
+
this.__setValue(val);
this.__updateVisualState();
+
+ if (!wasInFinishState && this.__isFinishState()) {
+ rf.Event.callHandler(this.__elt, "finish");
+ }
},
getMaxValue: function() {
Modified: trunk/ui/output/ui/src/main/templates/progressBar.template.xml
===================================================================
--- trunk/ui/output/ui/src/main/templates/progressBar.template.xml 2010-11-29 18:38:41 UTC (rev 20211)
+++ trunk/ui/output/ui/src/main/templates/progressBar.template.xml 2010-11-29 20:14:12 UTC (rev 20212)
@@ -16,7 +16,7 @@
<cc:implementation>
- <div id="#{clientId}" cdk:passThroughWithExclusions="">
+ <div id="#{clientId}" cdk:passThroughWithExclusions="" class="#{concatClasses('rf-pb', component.attributes['styleClass'])}">
<cdk:object name="encoder" value="#{getEncoder(facesContext, component)}" type="ProgressBarStateEncoder" />
<cdk:object name="currentState" value="#{getCurrentState(facesContext, component)}" type="ProgressBarState" />
14 years
JBoss Rich Faces SVN: r20211 - in sandbox/trunk/examples/dnd-demo/src/main: webapp/examples and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-11-29 13:38:41 -0500 (Mon, 29 Nov 2010)
New Revision: 20211
Modified:
sandbox/trunk/examples/dnd-demo/src/main/java/org/demo/DataBean.java
sandbox/trunk/examples/dnd-demo/src/main/webapp/examples/dnd.xhtml
Log:
extend demo
Modified: sandbox/trunk/examples/dnd-demo/src/main/java/org/demo/DataBean.java
===================================================================
--- sandbox/trunk/examples/dnd-demo/src/main/java/org/demo/DataBean.java 2010-11-29 18:25:10 UTC (rev 20210)
+++ sandbox/trunk/examples/dnd-demo/src/main/java/org/demo/DataBean.java 2010-11-29 18:38:41 UTC (rev 20211)
@@ -1,5 +1,8 @@
package org.demo;
+import java.util.ArrayList;
+import java.util.List;
+
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
@@ -9,7 +12,52 @@
@SessionScoped
public class DataBean {
+ private List<String> dropValues = new ArrayList<String>();
+
+ private String dragValue1 = "dragValue 1";
+
+ private String dragValue2 = "dragValue 3";
+
+ private String dragValue3 = "dragValue 3";
+
+
+ public List<String> getDropValues(){
+ return dropValues;
+ }
+
+ public String getDragValue1() {
+ return dragValue1;
+ }
+
+ public void setDragValue1(String dragValue1) {
+ this.dragValue1 = dragValue1;
+ }
+
+ public String getDragValue2() {
+ return dragValue2;
+ }
+
+ public void setDragValue2(String dragValue2) {
+ this.dragValue2 = dragValue2;
+ }
+
+ public String getDragValue3() {
+ return dragValue3;
+ }
+
+ public void setDragValue3(String dragValue3) {
+ this.dragValue3 = dragValue3;
+ }
+
+ public void setDropValues(List<String> dropValues){
+ this.dropValues = dropValues;
+ }
+
public void processEvent(DropEvent event) {
+ String value = (String)event.getDragValue();
+ dropValues.add(value);
System.out.println("DataBean.processEvent()");
}
+
+
}
Modified: sandbox/trunk/examples/dnd-demo/src/main/webapp/examples/dnd.xhtml
===================================================================
--- sandbox/trunk/examples/dnd-demo/src/main/webapp/examples/dnd.xhtml 2010-11-29 18:25:10 UTC (rev 20210)
+++ sandbox/trunk/examples/dnd-demo/src/main/webapp/examples/dnd.xhtml 2010-11-29 18:38:41 UTC (rev 20211)
@@ -15,6 +15,7 @@
height: 200px;
width: 200px;
background-color: yellow;
+ overflow: auto;
}
.draggable {
@@ -51,30 +52,33 @@
<h:body>
<h:form>
<dnd:dragIndicator id="ind" styleClass="rf-ind" acceptClass="rf-ind-acp" rejectClass="rf-ind-rej" />
+
<table>
<tr>
- <td><a4j:outputPanel id="drg1" layout="block"
- styleClass="draggable">
- <dnd:dragBehavior event="mouseover" type="drg1" indicator="ind" />
+ <td><a4j:outputPanel id="drg1" layout="block" styleClass="draggable">
+ <h:outputText value="#{dataBean.dragValue1}"/>
+ <dnd:dragBehavior event="mouseover" type="drg1" dragIndicator="ind" dragValue="#{dataBean.dragValue1}"/>
</a4j:outputPanel></td>
- <td><a4j:outputPanel id="drg2" layout="block"
- styleClass="draggable">
- <dnd:dragBehavior event="mouseover" type="drg2" indicator="ind" />
+ <td><a4j:outputPanel id="drg2" layout="block" styleClass="draggable">
+ <h:outputText value="#{dataBean.dragValue2}"/>
+ <dnd:dragBehavior event="mouseover" type="drg2" dragIndicator="ind" dragValue="#{dataBean.dragValue2}"/>
</a4j:outputPanel></td>
- <td><a4j:outputPanel id="drg3" layout="block"
- styleClass="draggable">
- <dnd:dragBehavior event="mouseover" type="drg3" indicator="ind" />
+ <td><a4j:outputPanel id="drg3" layout="block" styleClass="draggable">
+ <h:outputText value="#{dataBean.dragValue3}"/>
+ <dnd:dragBehavior event="mouseover" type="drg3" dragIndicator="ind" dragValue="#{dataBean.dragValue3}"/>
</a4j:outputPanel></td>
</tr>
</table>
+
<a4j:outputPanel id="drp" layout="block" styleClass="droppable">
- <dnd:dropBehavior event="mouseover" acceptType="drg1, drg2" dropListener="#{dataBean.processEvent}"></dnd:dropBehavior>
- <a4j:ajax event="click"/>
+ <dnd:dropBehavior event="mouseover" acceptedTypes="drg1, drg2" listener="#{dataBean.processEvent}" render="grid"></dnd:dropBehavior>
+ <h:dataTable id="grid" var="dropValue" value="#{dataBean.dropValues}">
+ <h:column>
+ <h:outputText value="#{dropValue}"/>
+ </h:column>
+ </h:dataTable>
</a4j:outputPanel>
-
- <h:inputText >
- </h:inputText>
</h:form>
</h:body>
</html>
\ No newline at end of file
14 years
JBoss Rich Faces SVN: r20210 - in sandbox/trunk/ui/drag-drop/ui/src/main: java/org/richfaces/renderkit and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-11-29 13:25:10 -0500 (Mon, 29 Nov 2010)
New Revision: 20210
Added:
sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/view/facelets/tag/
sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/view/facelets/tag/DropBehaviorRule.java
Modified:
sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/component/behavior/DragBehavior.java
sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/component/behavior/DropBehavior.java
sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/renderkit/DragBehaviorRendererBase.java
sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/renderkit/DropBehaviorRendererBase.java
sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/view/facelets/DropBehaviorHandler.java
sandbox/trunk/ui/drag-drop/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-draggable.js
sandbox/trunk/ui/drag-drop/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-droppable.js
Log:
fix attributes names, add provide support for the ajax behavior attributes, implement DropBehaviorRule,
Modified: sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/component/behavior/DragBehavior.java
===================================================================
--- sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/component/behavior/DragBehavior.java 2010-11-29 18:16:44 UTC (rev 20209)
+++ sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/component/behavior/DragBehavior.java 2010-11-29 18:25:10 UTC (rev 20210)
@@ -41,7 +41,7 @@
public static final String BEHAVIOR_ID = "org.richfaces.component.behavior.DragBehavior";
enum PropertyKeys {
- type, indicator, dragValue;
+ type, dragIndicator, dragValue;
}
public void setDragValue(Object dragValue) {
@@ -49,15 +49,15 @@
}
public Object getDragValue() {
- return getStateHelper().get(PropertyKeys.dragValue);
+ return getStateHelper().eval(PropertyKeys.dragValue);
}
- public void setIndicator(String indicator) {
- getStateHelper().put(PropertyKeys.indicator, indicator);
+ public void setDragIndicator(String indicator) {
+ getStateHelper().put(PropertyKeys.dragIndicator, indicator);
}
- public String getIndicator() {
- return (String)getStateHelper().get(PropertyKeys.indicator);
+ public String getDragIndicator() {
+ return (String)getStateHelper().eval(PropertyKeys.dragIndicator);
}
public void setType(String type) {
@@ -72,8 +72,8 @@
public void setLiteralAttribute(String name, Object value) {
if(compare(PropertyKeys.type, name)) {
setType((String)value);
- } else if(compare(PropertyKeys.indicator, name)){
- setIndicator((String)value);
+ } else if(compare(PropertyKeys.dragIndicator, name)){
+ setDragIndicator((String)value);
} else if(compare(PropertyKeys.dragValue, name)) {
setDragValue(value);
}
Modified: sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/component/behavior/DropBehavior.java
===================================================================
--- sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/component/behavior/DropBehavior.java 2010-11-29 18:16:44 UTC (rev 20209)
+++ sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/component/behavior/DropBehavior.java 2010-11-29 18:25:10 UTC (rev 20210)
@@ -25,7 +25,8 @@
import java.util.Set;
-import org.ajax4jsf.component.behavior.ClientBehavior;
+
+import org.ajax4jsf.component.behavior.AjaxBehavior;
import org.richfaces.cdk.annotations.JsfBehavior;
import org.richfaces.cdk.annotations.Tag;
import org.richfaces.cdk.annotations.TagType;
@@ -40,12 +41,12 @@
@JsfBehavior(
id = DropBehavior.BEHAVIOR_ID, tag = @Tag(name = "dropBehavior", handler = "org.richfaces.view.facelets.DropBehaviorHandler", type = TagType.Facelets)
)
-public class DropBehavior extends ClientBehavior implements ClientDropBehavior {
+public class DropBehavior extends AjaxBehavior implements ClientDropBehavior {
public static final String BEHAVIOR_ID = "org.richfaces.component.behavior.DropBehavior";
enum PropertyKeys {
- acceptType, dropValue
+ acceptedTypes, dropValue
}
public void setDropValue(Object dropValue) {
@@ -53,15 +54,15 @@
}
public Object getDropValue() {
- return getStateHelper().get(PropertyKeys.dropValue);
+ return getStateHelper().eval(PropertyKeys.dropValue);
}
- public void setAcceptType(Set<String> acceptType) {
- getStateHelper().put(PropertyKeys.acceptType, acceptType);
+ public void setAcceptedTypes(Set<String> acceptType) {
+ getStateHelper().put(PropertyKeys.acceptedTypes, acceptType);
}
- public Set<String> getAcceptType() {
- return (Set<String>)getStateHelper().eval(PropertyKeys.acceptType);
+ public Set<String> getAcceptedTypes() {
+ return (Set<String>)getStateHelper().eval(PropertyKeys.acceptedTypes);
}
public void addDropListener(DropListener listener) {
@@ -71,16 +72,17 @@
public void removeDropListener(DropListener listener) {
removeBehaviorListener(listener);
}
-
+
@Override
public void setLiteralAttribute(String name, Object value) {
- if(compare(PropertyKeys.acceptType, name)) {
- setAcceptType(CoreAjaxRendererUtils.asSimpleSet(value));
+ super.setLiteralAttribute(name, value);
+ if(compare(PropertyKeys.acceptedTypes, name)) {
+ setAcceptedTypes(CoreAjaxRendererUtils.asSimpleSet(value));
} else if(compare(PropertyKeys.dropValue, name)) {
setDropValue(value);
}
}
-
+
@Override
public String getRendererType() {
return BEHAVIOR_ID;
Modified: sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/renderkit/DragBehaviorRendererBase.java
===================================================================
--- sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/renderkit/DragBehaviorRendererBase.java 2010-11-29 18:16:44 UTC (rev 20209)
+++ sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/renderkit/DragBehaviorRendererBase.java 2010-11-29 18:25:10 UTC (rev 20210)
@@ -71,7 +71,7 @@
}
public String getDragIndicatorClientId(ClientBehaviorContext clientBehaviorContext, ClientDragBehavior dragBehavior) {
- String indicatorId = dragBehavior.getIndicator();
+ String indicatorId = dragBehavior.getDragIndicator();
if(indicatorId != null) {
FacesContext facesContext = clientBehaviorContext.getFacesContext();
UIComponent clientBehaviorHolder = clientBehaviorContext.getComponent();
Modified: sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/renderkit/DropBehaviorRendererBase.java
===================================================================
--- sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/renderkit/DropBehaviorRendererBase.java 2010-11-29 18:16:44 UTC (rev 20209)
+++ sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/renderkit/DropBehaviorRendererBase.java 2010-11-29 18:25:10 UTC (rev 20210)
@@ -30,12 +30,15 @@
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
+import javax.faces.component.ActionSource;
import javax.faces.component.ContextCallback;
+import javax.faces.component.EditableValueHolder;
import javax.faces.component.UIComponent;
import javax.faces.component.behavior.ClientBehavior;
import javax.faces.component.behavior.ClientBehaviorContext;
import javax.faces.component.behavior.ClientBehaviorHolder;
import javax.faces.context.FacesContext;
+import javax.faces.event.PhaseId;
import javax.faces.render.FacesBehaviorRenderer;
import javax.faces.render.RenderKitFactory;
@@ -55,6 +58,7 @@
@ResourceDependencies({
@ResourceDependency(name = "jquery.js"),
+ @ResourceDependency(name = "jquery.position.js"),
@ResourceDependency(name = "richfaces.js"),
@ResourceDependency(name = "richfaces.js"),
@ResourceDependency(library = "org.richfaces", name = "jquery-ui-core.js"),
@@ -85,7 +89,7 @@
if(behavior instanceof ClientDropBehavior) {
ClientDropBehavior dropBehavior = (ClientDropBehavior)behavior;
- options.put("acceptType", dropBehavior.getAcceptType());
+ options.put("acceptedTypes", dropBehavior.getAcceptedTypes());
}
return options;
@@ -104,19 +108,52 @@
public void invokeContextCallback(FacesContext context, UIComponent target) {
ClientDragBehavior dragBehavior = getDragBehavior(target, "mouseover");
-
if(dragBehavior != null) {
DropEvent dropEvent = new DropEvent(dropSource, dropBehavior);
dropEvent.setDragSource(target);
dropEvent.setDragValue(dragBehavior.getDragValue());
dropEvent.setDropValue(dropBehavior.getDropValue());
- dropEvent.setAcceptType(dropBehavior.getAcceptType());
- dropEvent.queue();
+ dropEvent.setAcceptedTypes(dropBehavior.getAcceptedTypes());
+ queueDropEvent(dropEvent);
} else {
//TODO: log
}
}
+ private void queueDropEvent(DropEvent event) {
+ PhaseId phaseId = PhaseId.INVOKE_APPLICATION;
+
+ if (isImmediate()) {
+ phaseId = PhaseId.APPLY_REQUEST_VALUES;
+ } else if (isBypassUpdates()) {
+ phaseId = PhaseId.PROCESS_VALIDATIONS;
+ }
+
+ event.setPhaseId(phaseId);
+ this.dropSource.queueEvent(event);
+ }
+
+ private boolean isImmediate(){
+ boolean immediate = this.dropBehavior.isImmediate();
+ if(!immediate) {
+ if (dropSource instanceof EditableValueHolder) {
+ immediate = ((EditableValueHolder) dropSource).isImmediate();
+ } else if (dropSource instanceof ActionSource) {
+ immediate = ((ActionSource) dropSource).isImmediate();
+ }
+ }
+
+ return immediate;
+ }
+
+ private boolean isBypassUpdates(){
+ boolean bypassUpdates = this.dropBehavior.isBypassUpdates();
+ if (!bypassUpdates) {
+ bypassUpdates = getUtils().isBooleanAttribute(this.dropSource, "bypassUpdates");
+ }
+ return bypassUpdates;
+ }
+
private ClientDragBehavior getDragBehavior(UIComponent parent, String event) {
if(parent instanceof ClientBehaviorHolder) {
Map<String, List<ClientBehavior>> behaviorsMap = ((ClientBehaviorHolder)parent).getClientBehaviors();
Modified: sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/view/facelets/DropBehaviorHandler.java
===================================================================
--- sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/view/facelets/DropBehaviorHandler.java 2010-11-29 18:16:44 UTC (rev 20209)
+++ sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/view/facelets/DropBehaviorHandler.java 2010-11-29 18:25:10 UTC (rev 20210)
@@ -23,16 +23,10 @@
package org.richfaces.view.facelets;
import javax.faces.view.facelets.BehaviorConfig;
-import javax.faces.view.facelets.FaceletContext;
-import javax.faces.view.facelets.MetaRule;
import javax.faces.view.facelets.MetaRuleset;
-import javax.faces.view.facelets.Metadata;
-import javax.faces.view.facelets.MetadataTarget;
-import javax.faces.view.facelets.TagAttribute;
-import org.richfaces.component.behavior.ClientDropBehavior;
-import org.richfaces.event.MethodExpressionDropListener;
import org.richfaces.view.facelets.html.CustomBehaviorHandler;
+import org.richfaces.view.facelets.tag.DropBehaviorRule;
/**
* @author abelevich
@@ -40,7 +34,7 @@
*/
public class DropBehaviorHandler extends CustomBehaviorHandler{
- private static final DropBehaviorMetaRule METARULE = new DropBehaviorMetaRule();
+ private static final DropBehaviorRule METARULE = new DropBehaviorRule();
public DropBehaviorHandler(BehaviorConfig config) {
super(config);
@@ -51,29 +45,4 @@
m.addRule(METARULE);
return m;
}
-
- static class DropBehaviorMetaRule extends MetaRule {
- public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
- if (meta.isTargetInstanceOf(ClientDropBehavior.class) && "dropListener".equals(name)) {
- return new DropBehaviorMapper(attribute);
- }
- return null;
- }
- }
-
- static class DropBehaviorMapper extends Metadata {
-
- private static final Class[] SIGNATURE = new Class[] { org.richfaces.event.DropEvent.class };
-
- private final TagAttribute attribute;
-
- public DropBehaviorMapper(TagAttribute attribute) {
- this.attribute = attribute;
- }
-
- public void applyMetadata(FaceletContext ctx, Object instance) {
- ((ClientDropBehavior) instance).addDropListener((new MethodExpressionDropListener( this.attribute.getMethodExpression(ctx, null, SIGNATURE))));
- }
- }
-
}
Added: sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/view/facelets/tag/DropBehaviorRule.java
===================================================================
--- sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/view/facelets/tag/DropBehaviorRule.java (rev 0)
+++ sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/view/facelets/tag/DropBehaviorRule.java 2010-11-29 18:25:10 UTC (rev 20210)
@@ -0,0 +1,88 @@
+/*
+ * 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.
+ */
+
+
+package org.richfaces.view.facelets.tag;
+
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.Metadata;
+import javax.faces.view.facelets.MetadataTarget;
+import javax.faces.view.facelets.TagAttribute;
+
+import org.richfaces.component.behavior.ClientDropBehavior;
+import org.richfaces.event.MethodExpressionDropListener;
+
+/**
+ * @author abelevich
+ *
+ */
+public class DropBehaviorRule extends BehaviorRule {
+
+ public static final String EXECUTE = "execute";
+
+ public static final String RENDER = "render";
+
+ public static final String LISTENER = "listener";
+
+ @Override
+ public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
+ if (meta.isTargetInstanceOf(ClientDropBehavior.class)) {
+ if (!attribute.isLiteral()) {
+ if(LISTENER.equals(name)) {
+ return new DropBehaviorMapper(attribute);
+ }
+
+ Class<?> type = meta.getPropertyType(name);
+
+ if (EXECUTE.equals(name) || RENDER.equals(name)) {
+ type = Object.class;
+ }
+
+ if (type == null) {
+ type = Object.class;
+ }
+
+ return new ValueExpressionMetadata(name, type, attribute);
+
+ } else if(meta != null && meta.getWriteMethod(name) != null) {
+ return new LiteralAttributeMetadata(name, attribute.getValue());
+ }
+ }
+ return null;
+ }
+
+ static class DropBehaviorMapper extends Metadata {
+
+ private static final Class[] SIGNATURE = new Class[] { org.richfaces.event.DropEvent.class };
+
+ private final TagAttribute attribute;
+
+ public DropBehaviorMapper(TagAttribute attribute) {
+ this.attribute = attribute;
+ }
+
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ ((ClientDropBehavior) instance).addDropListener((new MethodExpressionDropListener( this.attribute.getMethodExpression(ctx, null, SIGNATURE))));
+ }
+ }
+
+}
Modified: sandbox/trunk/ui/drag-drop/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-draggable.js
===================================================================
--- sandbox/trunk/ui/drag-drop/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-draggable.js 2010-11-29 18:16:44 UTC (rev 20209)
+++ sandbox/trunk/ui/drag-drop/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-draggable.js 2010-11-29 18:25:10 UTC (rev 20210)
@@ -4,7 +4,7 @@
rf.ui.Draggable = function(id, options) {
this.dragElement = $(document.getElementById(id));
- this.dragElement.draggable({addClasses: false});
+ this.dragElement.draggable({addClasses: false, appendTo: 'body'});
if(options.indicator) {
var element = document.getElementById(options.indicator);
@@ -30,10 +30,13 @@
$.extend(rf.ui.Draggable.prototype, ( function () {
return {
dragStart: function(e, ui) {
- if(ui.helper && this.indicator) {
- ui.helper.show();
+ if(ui.helper) {
+ var element = ui.helper[0];
+ this.parentElement = element.parentNode;
+ ui.helper.detach().appendTo("body");
+ ui.helper.setPosition(e).show();
}
- },
+ },
drag: function(e, ui) {
var helper = ui.helper;
@@ -43,14 +46,14 @@
},
dragStop: function(e, ui){
- if(ui.helper && this.indicator) {
+ if(ui.helper) {
ui.helper.hide();
+ ui.helper.detach().appendTo(this.parentElement);
+ if(ui.helper[0] != this.dragElement[0]) {
+ //fix to prevent remove custom indicator from DOM tree. see jQuery draggable._clear method for details
+ ui.helper[0] = this.dragElement[0];
+ }
}
-
- if(ui.helper[0] != this.dragElement[0]) {
- //fix to prevent remove custom indicator from DOM tree. see jQuery draggable._clear method for details
- ui.helper[0] = this.dragElement[0];
- }
}
}
})());
Modified: sandbox/trunk/ui/drag-drop/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-droppable.js
===================================================================
--- sandbox/trunk/ui/drag-drop/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-droppable.js 2010-11-29 18:16:44 UTC (rev 20209)
+++ sandbox/trunk/ui/drag-drop/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-droppable.js 2010-11-29 18:25:10 UTC (rev 20210)
@@ -56,7 +56,7 @@
var accept;
var acceptType = draggable.data("type");
if(acceptType) {
- $.each(this.options.acceptType, function() {
+ $.each(this.options.acceptedTypes, function() {
accept = (acceptType == this); return !(accept);
});
}
14 years
JBoss Rich Faces SVN: r20209 - in sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces: event and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-11-29 13:16:44 -0500 (Mon, 29 Nov 2010)
New Revision: 20209
Modified:
sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/behavior/ClientDragBehavior.java
sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/behavior/ClientDropBehavior.java
sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropEvent.java
Log:
rename attributes according wiki migration article, add isImmediate & isBypassUpdates to the ClientDropBehavior
Modified: sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/behavior/ClientDragBehavior.java
===================================================================
--- sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/behavior/ClientDragBehavior.java 2010-11-29 18:01:15 UTC (rev 20208)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/behavior/ClientDragBehavior.java 2010-11-29 18:16:44 UTC (rev 20209)
@@ -33,7 +33,7 @@
public String getType();
- public String getIndicator();
+ public String getDragIndicator();
public Object getDragValue();
Modified: sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/behavior/ClientDropBehavior.java
===================================================================
--- sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/behavior/ClientDropBehavior.java 2010-11-29 18:01:15 UTC (rev 20208)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/behavior/ClientDropBehavior.java 2010-11-29 18:16:44 UTC (rev 20209)
@@ -24,8 +24,7 @@
import java.util.Set;
-import javax.faces.component.behavior.ClientBehavior;
-
+import org.ajax4jsf.component.AjaxClientBehavior;
import org.richfaces.event.DropListener;
@@ -33,14 +32,17 @@
* @author abelevich
*
*/
-public interface ClientDropBehavior extends ClientBehavior{
+public interface ClientDropBehavior extends AjaxClientBehavior {
- public Set<String> getAcceptType();
+ public Set<String> getAcceptedTypes();
public Object getDropValue();
public void addDropListener(DropListener dropListener);
public void removeDropListener(DropListener dropListener);
-
+
+ public boolean isImmediate();
+
+ public boolean isBypassUpdates();
}
Modified: sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropEvent.java
===================================================================
--- sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropEvent.java 2010-11-29 18:01:15 UTC (rev 20208)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropEvent.java 2010-11-29 18:16:44 UTC (rev 20209)
@@ -41,7 +41,7 @@
private Object dragValue;
- private Set<String> acceptType;
+ private Set<String> acceptedTypes;
private UIComponent dragSource;
@@ -50,12 +50,12 @@
super(component, behavior);
}
- public Set<String> getAcceptType() {
- return acceptType;
+ public Set<String> getAcceptedTypes() {
+ return acceptedTypes;
}
- public void setAcceptType(Set<String> acceptType) {
- this.acceptType = acceptType;
+ public void setAcceptedTypes(Set<String> acceptedTypes) {
+ this.acceptedTypes = acceptedTypes;
}
public Object getDropValue() {
@@ -91,5 +91,5 @@
public void processListener(FacesListener listener) {
((DropListener) listener).processDrop(this);
}
-
-}
+
+}
\ No newline at end of file
14 years
JBoss Rich Faces SVN: r20208 - in branches/RF-8742-1: core/api/src/main/java/org/richfaces/renderkit/util and 29 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-11-29 13:01:15 -0500 (Mon, 29 Nov 2010)
New Revision: 20208
Added:
branches/RF-8742-1/ui/input/api/src/main/java/org/richfaces/event/MethodExpressionCurrentDateChangeListener.java
branches/RF-8742-1/ui/input/ui/src/main/java/org/richfaces/view/facelets/CalendarHandler.java
branches/RF-8742-1/ui/input/ui/src/test/java/org/richfaces/component/
branches/RF-8742-1/ui/input/ui/src/test/java/org/richfaces/component/CalendarBean.java
branches/RF-8742-1/ui/input/ui/src/test/java/org/richfaces/component/CalendarDataModelImpl.java
branches/RF-8742-1/ui/input/ui/src/test/java/org/richfaces/component/CalendarDataModelItemImpl.java
branches/RF-8742-1/ui/input/ui/src/test/java/org/richfaces/component/CalendarRenderTest.java
branches/RF-8742-1/ui/input/ui/src/test/resources/org/richfaces/component/
branches/RF-8742-1/ui/input/ui/src/test/resources/org/richfaces/component/calendarContent.xmlunit.xml
branches/RF-8742-1/ui/input/ui/src/test/resources/org/richfaces/component/calendarScript.xmlunit.xml
branches/RF-8742-1/ui/input/ui/src/test/resources/org/richfaces/component/calendarTest.xhtml
branches/RF-8742-1/ui/input/ui/src/test/resources/org/richfaces/component/faces-config.xml
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarState.java
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarStateEncoder.java
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconBasic.java
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevron.java
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronBasic.java
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronDown.java
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronLeft.java
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronUp.java
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconDisc.java
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconGrid.java
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconSpacer.java
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangle.java
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleBasic.java
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleDown.java
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleLeft.java
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleUp.java
branches/RF-8742-1/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-topGroup.xhtml
branches/RF-8742-1/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-topGroup.xmlunit.xml
Removed:
branches/RF-8742-1/ui/input/ui/src/main/java/org/richfaces/taglib/
branches/RF-8742-1/ui/input/ui/src/test/java/org/richfaces/component/CalendarBean.java
branches/RF-8742-1/ui/input/ui/src/test/java/org/richfaces/component/CalendarDataModelImpl.java
branches/RF-8742-1/ui/input/ui/src/test/java/org/richfaces/component/CalendarDataModelItemImpl.java
branches/RF-8742-1/ui/input/ui/src/test/java/org/richfaces/component/CalendarRenderTest.java
branches/RF-8742-1/ui/input/ui/src/test/resources/org/richfaces/component/calendarContent.xmlunit.xml
branches/RF-8742-1/ui/input/ui/src/test/resources/org/richfaces/component/calendarScript.xmlunit.xml
branches/RF-8742-1/ui/input/ui/src/test/resources/org/richfaces/component/calendarTest.xhtml
branches/RF-8742-1/ui/input/ui/src/test/resources/org/richfaces/component/faces-config.xml
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconBasic.java
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevron.java
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronBasic.java
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronDown.java
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronLeft.java
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronUp.java
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconDisc.java
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconGrid.java
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconSpacer.java
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangle.java
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleBasic.java
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleDown.java
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleLeft.java
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleUp.java
Modified:
branches/RF-8742-1/
branches/RF-8742-1/core/api/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java
branches/RF-8742-1/core/impl/src/main/resources/META-INF/resources/jquery.js
branches/RF-8742-1/core/impl/src/main/resources/META-INF/resources/richfaces-event.js
branches/RF-8742-1/core/impl/src/main/resources/META-INF/resources/richfaces.js
branches/RF-8742-1/examples/output-demo/src/main/java/org/richfaces/ProgressBarBean.java
branches/RF-8742-1/examples/output-demo/src/main/webapp/examples/progressbar.xhtml
branches/RF-8742-1/examples/output-demo/src/main/webapp/resources/PanelMenu.js
branches/RF-8742-1/examples/output-demo/src/main/webapp/resources/PanelMenuGroup.js
branches/RF-8742-1/examples/output-demo/src/main/webapp/resources/PanelMenuItem.js
branches/RF-8742-1/examples/output-demo/src/main/webapp/templates/template.xhtml
branches/RF-8742-1/examples/push-demo/src/main/webapp/WEB-INF/web.xml
branches/RF-8742-1/examples/richfaces-showcase/src/main/webapp-gae/WEB-INF/appengine-web.xml
branches/RF-8742-1/examples/richfaces-showcase/src/main/webapp-gae/WEB-INF/web.xml
branches/RF-8742-1/examples/richfaces-showcase/src/main/webapp/templates/main.xhtml
branches/RF-8742-1/examples/validator-demo/src/main/java/org/richfaces/example/Bean.java
branches/RF-8742-1/ui/common/ui/src/main/java/org/richfaces/renderkit/RendererBase.java
branches/RF-8742-1/ui/core/ui/src/main/java/org/richfaces/view/facelets/tag/BehaviorRule.java
branches/RF-8742-1/ui/input/ui/src/main/java/org/richfaces/component/AbstractCalendar.java
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuItem.java
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/component/AbstractProgressBar.java
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuItem.java
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java
branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarBaseRenderer.java
branches/RF-8742-1/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml
branches/RF-8742-1/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml
branches/RF-8742-1/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenu.ecss
branches/RF-8742-1/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/progressBar.ecss
branches/RF-8742-1/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/progressBar.js
branches/RF-8742-1/ui/output/ui/src/main/resources/META-INF/richfaces/resource-mappings.properties
branches/RF-8742-1/ui/output/ui/src/main/templates/progressBar.template.xml
branches/RF-8742-1/ui/output/ui/src/test/java/org/richfaces/renderkit/html/PanelMenuGroupRendererTest.java
branches/RF-8742-1/ui/output/ui/src/test/java/org/richfaces/renderkit/html/PanelMenuItemRendererTest.java
branches/RF-8742-1/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-expanded.xmlunit.xml
branches/RF-8742-1/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup.xmlunit.xml
branches/RF-8742-1/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuItem.xmlunit.xml
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/convert/DateTimeConverterTest.java
Log:
Merged revisions 20143-20144,20157,20159-20160,20163,20175-20181,20185,20187,20190-20198,20204-20206 via svnmerge from
https://svn.jboss.org/repos/richfaces/trunk
.......
r20143 | ilya_shaikovsky | 2010-11-23 01:48:04 -0800 (Tue, 23 Nov 2010) | 3 lines
https://jira.jboss.org/browse/RFPL-926
new analytics account created for (richfaces-showcase.appspot.com) and identificator update in script performed.
.......
r20144 | ilya_shaikovsky | 2010-11-23 02:22:00 -0800 (Tue, 23 Nov 2010) | 1 line
https://jira.jboss.org/browse/RFPL-924 - corrections in web.xml for GAE (production set) and appengine-web.xml(name correction)
.......
r20157 | pyaschenko | 2010-11-24 05:27:13 -0800 (Wed, 24 Nov 2010) | 1 line
commit test
.......
r20159 | abelevich | 2010-11-24 10:44:08 -0800 (Wed, 24 Nov 2010) | 1 line
fix bug what setLiteralValue didn't invokes for the our ClienBehaviors
.......
r20160 | abelevich | 2010-11-24 10:45:07 -0800 (Wed, 24 Nov 2010) | 1 line
add asSimpleSet method
.......
r20163 | abelevich | 2010-11-24 11:07:35 -0800 (Wed, 24 Nov 2010) | 1 line
remove logger
.......
r20175 | ilya_shaikovsky | 2010-11-26 06:04:44 -0800 (Fri, 26 Nov 2010) | 1 line
minor correction for tomcat 6.
.......
r20176 | nbelaevski | 2010-11-26 06:26:49 -0800 (Fri, 26 Nov 2010) | 1 line
https://jira.jboss.org/browse/RFPL-934
.......
r20177 | nbelaevski | 2010-11-26 06:35:45 -0800 (Fri, 26 Nov 2010) | 1 line
https://jira.jboss.org/browse/RFPL-934
.......
r20178 | pyaschenko | 2010-11-26 06:37:13 -0800 (Fri, 26 Nov 2010) | 1 line
RF-9496
.......
r20179 | pyaschenko | 2010-11-26 06:38:02 -0800 (Fri, 26 Nov 2010) | 1 line
cosmetic changes
.......
r20180 | nbelaevski | 2010-11-26 07:55:54 -0800 (Fri, 26 Nov 2010) | 1 line
https://jira.jboss.org/browse/RF-9566
.......
r20181 | amarkhel | 2010-11-26 08:20:08 -0800 (Fri, 26 Nov 2010) | 1 line
visitTree method was replaced.
.......
r20185 | nbelaevski | 2010-11-26 08:48:59 -0800 (Fri, 26 Nov 2010) | 1 line
Added parameters support for 'enable' CS-API function
.......
r20187 | konstantin.mishin | 2010-11-26 09:27:32 -0800 (Fri, 26 Nov 2010) | 1 line
RF-9496
.......
r20190 | abelevich | 2010-11-26 10:29:33 -0800 (Fri, 26 Nov 2010) | 1 line
.......
r20191 | abelevich | 2010-11-26 10:35:06 -0800 (Fri, 26 Nov 2010) | 1 line
move custom handler to appropriate package
.......
r20192 | abelevich | 2010-11-26 10:42:29 -0800 (Fri, 26 Nov 2010) | 1 line
move
.......
r20193 | abelevich | 2010-11-26 10:47:16 -0800 (Fri, 26 Nov 2010) | 1 line
move class from impl
.......
r20194 | abelevich | 2010-11-26 10:49:44 -0800 (Fri, 26 Nov 2010) | 1 line
fix packages, remove unn package
.......
r20195 | abelevich | 2010-11-26 10:51:28 -0800 (Fri, 26 Nov 2010) | 1 line
move to the api
.......
r20196 | abelevich | 2010-11-26 10:51:52 -0800 (Fri, 26 Nov 2010) | 1 line
add CalendarHandler
.......
r20197 | abelevich | 2010-11-26 10:53:22 -0800 (Fri, 26 Nov 2010) | 1 line
fix MethodExpressionCurrentDateChangeListener.java package
.......
r20198 | abelevich | 2010-11-26 10:55:11 -0800 (Fri, 26 Nov 2010) | 1 line
fix checkstyle
.......
r20204 | Alex.Kolonitsky | 2010-11-29 01:59:46 -0800 (Mon, 29 Nov 2010) | 1 line
fix build
.......
r20205 | Alex.Kolonitsky | 2010-11-29 02:02:29 -0800 (Mon, 29 Nov 2010) | 1 line
RF-9317 panelMenu components
.......
r20206 | amarkhel | 2010-11-29 06:35:51 -0800 (Mon, 29 Nov 2010) | 1 line
RF-9171:Calendar: server side tests development (junit)
.......
Property changes on: branches/RF-8742-1
___________________________________________________________________
Name: svnmerge-integrated
- /trunk:1-20140
+ /trunk:1-20207
Modified: branches/RF-8742-1/core/api/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java
===================================================================
--- branches/RF-8742-1/core/api/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/core/api/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -210,6 +210,10 @@
return asIdsSet(areas);
}
+
+ public static Set<String> asSimpleSet(Object valueToSet) {
+ return asSet(valueToSet, false);
+ }
public static Set<String> asIdsSet(Object valueToSet) {
return asSet(valueToSet, true);
Modified: branches/RF-8742-1/core/impl/src/main/resources/META-INF/resources/jquery.js
===================================================================
--- branches/RF-8742-1/core/impl/src/main/resources/META-INF/resources/jquery.js 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/core/impl/src/main/resources/META-INF/resources/jquery.js 2010-11-29 18:01:15 UTC (rev 20208)
@@ -1,5 +1,5 @@
/*!
- * jQuery JavaScript Library v1.4.2
+ * jQuery JavaScript Library v1.4.4
* http://jquery.com/
*
* Copyright 2010, John Resig
@@ -11,10 +11,14 @@
* Copyright 2010, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
*
- * Date: Sat Feb 13 22:33:48 2010 -0500
+ * Date: Thu Nov 11 19:04:53 2010 -0500
*/
(function( window, undefined ) {
+// Use the correct document accordingly with window argument (sandbox)
+var document = window.document;
+var jQuery = (function() {
+
// Define a local copy of jQuery
var jQuery = function( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
@@ -27,28 +31,45 @@
// Map over the $ in case of overwrite
_$ = window.$,
- // Use the correct document accordingly with window argument (sandbox)
- document = window.document,
-
// A central reference to the root jQuery(document)
rootjQuery,
// A simple way to check for HTML strings or ID strings
// (both of which we optimize for)
- quickExpr = /^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,
+ quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,
// Is it a simple selector
isSimple = /^.[^:#\[\.,]*$/,
// Check if a string has a non-whitespace character in it
rnotwhite = /\S/,
+ rwhite = /\s/,
// Used for trimming whitespace
- rtrim = /^(\s|\u00A0)+|(\s|\u00A0)+$/g,
+ trimLeft = /^\s+/,
+ trimRight = /\s+$/,
+ // Check for non-word characters
+ rnonword = /\W/,
+
+ // Check for digits
+ rdigit = /\d/,
+
// Match a standalone tag
rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
+ // JSON RegExp
+ rvalidchars = /^[\],:{}\s]*$/,
+ rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
+ rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
+ rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
+
+ // Useragent RegExp
+ rwebkit = /(webkit)[ \/]([\w.]+)/,
+ ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
+ rmsie = /(msie) ([\w.]+)/,
+ rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
+
// Keep a UserAgent string for use with jQuery.browser
userAgent = navigator.userAgent,
@@ -66,10 +87,14 @@
// Save a reference to some core methods
toString = Object.prototype.toString,
- hasOwnProperty = Object.prototype.hasOwnProperty,
+ hasOwn = Object.prototype.hasOwnProperty,
push = Array.prototype.push,
slice = Array.prototype.slice,
- indexOf = Array.prototype.indexOf;
+ trim = String.prototype.trim,
+ indexOf = Array.prototype.indexOf,
+
+ // [[Class]] -> type pairs
+ class2type = {};
jQuery.fn = jQuery.prototype = {
init: function( selector, context ) {
@@ -88,7 +113,7 @@
}
// The body element only exists once, optimize finding it
- if ( selector === "body" && !context ) {
+ if ( selector === "body" && !context && document.body ) {
this.context = document;
this[0] = document.body;
this.selector = "body";
@@ -122,7 +147,7 @@
}
} else {
- ret = buildFragment( [ match[1] ], [ doc ] );
+ ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes;
}
@@ -132,7 +157,9 @@
} else {
elem = document.getElementById( match[2] );
- if ( elem ) {
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ if ( elem && elem.parentNode ) {
// Handle the case where IE and Opera return items
// by name instead of ID
if ( elem.id !== match[2] ) {
@@ -150,7 +177,7 @@
}
// HANDLE: $("TAG")
- } else if ( !context && /^\w+$/.test( selector ) ) {
+ } else if ( !context && !rnonword.test( selector ) ) {
this.selector = selector;
this.context = document;
selector = document.getElementsByTagName( selector );
@@ -184,7 +211,7 @@
selector: "",
// The current version of jQuery being used
- jquery: "1.4.2",
+ jquery: "1.4.4",
// The default length of a jQuery object is 0
length: 0,
@@ -303,8 +330,11 @@
jQuery.fn.init.prototype = jQuery.fn;
jQuery.extend = jQuery.fn.extend = function() {
- // copy reference to target object
- var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options, name, src, copy;
+ var options, name, src, copy, copyIsArray, clone,
+ target = arguments[0] || {},
+ i = 1,
+ length = arguments.length,
+ deep = false;
// Handle a deep copy situation
if ( typeof target === "boolean" ) {
@@ -338,11 +368,16 @@
continue;
}
- // Recurse if we're merging object literal values or arrays
- if ( deep && copy && ( jQuery.isPlainObject(copy) || jQuery.isArray(copy) ) ) {
- var clone = src && ( jQuery.isPlainObject(src) || jQuery.isArray(src) ) ? src
- : jQuery.isArray(copy) ? [] : {};
+ // Recurse if we're merging plain objects or arrays
+ if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
+ if ( copyIsArray ) {
+ copyIsArray = false;
+ clone = src && jQuery.isArray(src) ? src : [];
+ } else {
+ clone = src && jQuery.isPlainObject(src) ? src : {};
+ }
+
// Never move original objects, clone them
target[ name ] = jQuery.extend( deep, clone, copy );
@@ -371,34 +406,51 @@
// Is the DOM ready to be used? Set to true once it occurs.
isReady: false,
+
+ // A counter to track how many items to wait for before
+ // the ready event fires. See #6781
+ readyWait: 1,
// Handle when the DOM is ready
- ready: function() {
+ ready: function( wait ) {
+ // A third-party is pushing the ready event forwards
+ if ( wait === true ) {
+ jQuery.readyWait--;
+ }
+
// Make sure that the DOM is not already loaded
- if ( !jQuery.isReady ) {
+ if ( !jQuery.readyWait || (wait !== true && !jQuery.isReady) ) {
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
if ( !document.body ) {
- return setTimeout( jQuery.ready, 13 );
+ return setTimeout( jQuery.ready, 1 );
}
// Remember that the DOM is ready
jQuery.isReady = true;
+ // If a normal DOM Ready event fired, decrement, and wait if need be
+ if ( wait !== true && --jQuery.readyWait > 0 ) {
+ return;
+ }
+
// If there are functions bound, to execute
if ( readyList ) {
// Execute all of them
- var fn, i = 0;
- while ( (fn = readyList[ i++ ]) ) {
- fn.call( document, jQuery );
- }
+ var fn,
+ i = 0,
+ ready = readyList;
// Reset the list of functions
readyList = null;
- }
- // Trigger any bound ready events
- if ( jQuery.fn.triggerHandler ) {
- jQuery( document ).triggerHandler( "ready" );
+ while ( (fn = ready[ i++ ]) ) {
+ fn.call( document, jQuery );
+ }
+
+ // Trigger any bound ready events
+ if ( jQuery.fn.trigger ) {
+ jQuery( document ).trigger( "ready" ).unbind( "ready" );
+ }
}
}
},
@@ -413,7 +465,8 @@
// Catch cases where $(document).ready() is called after the
// browser event has already occurred.
if ( document.readyState === "complete" ) {
- return jQuery.ready();
+ // Handle it asynchronously to allow scripts the opportunity to delay ready
+ return setTimeout( jQuery.ready, 1 );
}
// Mozilla, Opera and webkit nightlies currently support this event
@@ -451,25 +504,40 @@
// Since version 1.3, DOM methods and functions like alert
// aren't supported. They return false on IE (#2968).
isFunction: function( obj ) {
- return toString.call(obj) === "[object Function]";
+ return jQuery.type(obj) === "function";
},
- isArray: function( obj ) {
- return toString.call(obj) === "[object Array]";
+ isArray: Array.isArray || function( obj ) {
+ return jQuery.type(obj) === "array";
},
+ // A crude way of determining if an object is a window
+ isWindow: function( obj ) {
+ return obj && typeof obj === "object" && "setInterval" in obj;
+ },
+
+ isNaN: function( obj ) {
+ return obj == null || !rdigit.test( obj ) || isNaN( obj );
+ },
+
+ type: function( obj ) {
+ return obj == null ?
+ String( obj ) :
+ class2type[ toString.call(obj) ] || "object";
+ },
+
isPlainObject: function( obj ) {
// Must be an Object.
// Because of IE, we also have to check the presence of the constructor property.
// Make sure that DOM nodes and window objects don't pass through, as well
- if ( !obj || toString.call(obj) !== "[object Object]" || obj.nodeType || obj.setInterval ) {
+ if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
return false;
}
// Not own constructor property must be Object
- if ( obj.constructor
- && !hasOwnProperty.call(obj, "constructor")
- && !hasOwnProperty.call(obj.constructor.prototype, "isPrototypeOf") ) {
+ if ( obj.constructor &&
+ !hasOwn.call(obj, "constructor") &&
+ !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
return false;
}
@@ -479,7 +547,7 @@
var key;
for ( key in obj ) {}
- return key === undefined || hasOwnProperty.call( obj, key );
+ return key === undefined || hasOwn.call( obj, key );
},
isEmptyObject: function( obj ) {
@@ -503,9 +571,9 @@
// Make sure the incoming data is actual JSON
// Logic borrowed from http://json.org/json2.js
- if ( /^[\],:{}\s]*$/.test(data.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@")
- .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]")
- .replace(/(?:^|:|,)(?:\s*\[)+/g, "")) ) {
+ if ( rvalidchars.test(data.replace(rvalidescape, "@")
+ .replace(rvalidtokens, "]")
+ .replace(rvalidbraces, "")) ) {
// Try to use the native JSON parser first
return window.JSON && window.JSON.parse ?
@@ -584,10 +652,21 @@
return object;
},
- trim: function( text ) {
- return (text || "").replace( rtrim, "" );
- },
+ // Use native String.trim function wherever possible
+ trim: trim ?
+ function( text ) {
+ return text == null ?
+ "" :
+ trim.call( text );
+ } :
+ // Otherwise use our own trimming functionality
+ function( text ) {
+ return text == null ?
+ "" :
+ text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
+ },
+
// results is for internal usage only
makeArray: function( array, results ) {
var ret = results || [];
@@ -596,7 +675,10 @@
// The window, strings (and functions) also have 'length'
// The extra typeof function check is to prevent crashes
// in Safari 2 (See: #3039)
- if ( array.length == null || typeof array === "string" || jQuery.isFunction(array) || (typeof array !== "function" && array.setInterval) ) {
+ // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
+ var type = jQuery.type(array);
+
+ if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
push.call( ret, array );
} else {
jQuery.merge( ret, array );
@@ -621,7 +703,8 @@
},
merge: function( first, second ) {
- var i = first.length, j = 0;
+ var i = first.length,
+ j = 0;
if ( typeof second.length === "number" ) {
for ( var l = second.length; j < l; j++ ) {
@@ -640,12 +723,14 @@
},
grep: function( elems, callback, inv ) {
- var ret = [];
+ var ret = [], retVal;
+ inv = !!inv;
// Go through the array, only saving the items
// that pass the validator function
for ( var i = 0, length = elems.length; i < length; i++ ) {
- if ( !inv !== !callback( elems[ i ], i ) ) {
+ retVal = !!callback( elems[ i ], i );
+ if ( inv !== retVal ) {
ret.push( elems[ i ] );
}
}
@@ -701,16 +786,49 @@
return proxy;
},
+ // Mutifunctional method to get and set values to a collection
+ // The value/s can be optionally by executed if its a function
+ access: function( elems, key, value, exec, fn, pass ) {
+ var length = elems.length;
+
+ // Setting many attributes
+ if ( typeof key === "object" ) {
+ for ( var k in key ) {
+ jQuery.access( elems, k, key[k], exec, fn, value );
+ }
+ return elems;
+ }
+
+ // Setting one attribute
+ if ( value !== undefined ) {
+ // Optionally, function values get executed if exec is true
+ exec = !pass && exec && jQuery.isFunction(value);
+
+ for ( var i = 0; i < length; i++ ) {
+ fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
+ }
+
+ return elems;
+ }
+
+ // Getting an attribute
+ return length ? fn( elems[0], key ) : undefined;
+ },
+
+ now: function() {
+ return (new Date()).getTime();
+ },
+
// Use of jQuery.browser is frowned upon.
// More details: http://docs.jquery.com/Utilities/jQuery.browser
uaMatch: function( ua ) {
ua = ua.toLowerCase();
- var match = /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
- /(opera)(?:.*version)?[ \/]([\w.]+)/.exec( ua ) ||
- /(msie) ([\w.]+)/.exec( ua ) ||
- !/compatible/.test( ua ) && /(mozilla)(?:.*? rv:([\w.]+))?/.exec( ua ) ||
- [];
+ var match = rwebkit.exec( ua ) ||
+ ropera.exec( ua ) ||
+ rmsie.exec( ua ) ||
+ ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
+ [];
return { browser: match[1] || "", version: match[2] || "0" };
},
@@ -718,6 +836,11 @@
browser: {}
});
+// Populate the class2type map
+jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
+ class2type[ "[object " + name + "]" ] = name.toLowerCase();
+});
+
browserMatch = jQuery.uaMatch( userAgent );
if ( browserMatch.browser ) {
jQuery.browser[ browserMatch.browser ] = true;
@@ -735,6 +858,13 @@
};
}
+// Verify that \s matches non-breaking spaces
+// (IE fails on this test)
+if ( !rwhite.test( "\xA0" ) ) {
+ trimLeft = /^[\s\xA0]+/;
+ trimRight = /[\s\xA0]+$/;
+}
+
// All jQuery objects should point back to these
rootjQuery = jQuery(document);
@@ -765,7 +895,7 @@
// If IE is used, use the trick by Diego Perini
// http://javascript.nwbox.com/IEContentLoaded/
document.documentElement.doScroll("left");
- } catch( error ) {
+ } catch(e) {
setTimeout( doScrollCheck, 1 );
return;
}
@@ -774,54 +904,12 @@
jQuery.ready();
}
-function evalScript( i, elem ) {
- if ( elem.src ) {
- jQuery.ajax({
- url: elem.src,
- async: false,
- dataType: "script"
- });
- } else {
- jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
- }
+// Expose jQuery to the global object
+return (window.jQuery = window.$ = jQuery);
- if ( elem.parentNode ) {
- elem.parentNode.removeChild( elem );
- }
-}
+})();
-// Mutifunctional method to get and set values to a collection
-// The value/s can be optionally by executed if its a function
-function access( elems, key, value, exec, fn, pass ) {
- var length = elems.length;
-
- // Setting many attributes
- if ( typeof key === "object" ) {
- for ( var k in key ) {
- access( elems, k, key[k], exec, fn, value );
- }
- return elems;
- }
-
- // Setting one attribute
- if ( value !== undefined ) {
- // Optionally, function values get executed if exec is true
- exec = !pass && exec && jQuery.isFunction(value);
-
- for ( var i = 0; i < length; i++ ) {
- fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
- }
-
- return elems;
- }
-
- // Getting an attribute
- return length ? fn( elems[0], key ) : undefined;
-}
-function now() {
- return (new Date).getTime();
-}
(function() {
jQuery.support = {};
@@ -829,13 +917,15 @@
var root = document.documentElement,
script = document.createElement("script"),
div = document.createElement("div"),
- id = "script" + now();
+ id = "script" + jQuery.now();
div.style.display = "none";
div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
var all = div.getElementsByTagName("*"),
- a = div.getElementsByTagName("a")[0];
+ a = div.getElementsByTagName("a")[0],
+ select = document.createElement("select"),
+ opt = select.appendChild( document.createElement("option") );
// Can't get basic test support
if ( !all || !all.length || !a ) {
@@ -878,18 +968,25 @@
// Make sure that a selected-by-default option has a working selected property.
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
- optSelected: document.createElement("select").appendChild( document.createElement("option") ).selected,
+ optSelected: opt.selected,
- parentNode: div.removeChild( div.appendChild( document.createElement("div") ) ).parentNode === null,
-
// Will be defined later
deleteExpando: true,
+ optDisabled: false,
checkClone: false,
scriptEval: false,
noCloneEvent: true,
- boxModel: null
+ boxModel: null,
+ inlineBlockNeedsLayout: false,
+ shrinkWrapBlocks: false,
+ reliableHiddenOffsets: true
};
+ // Make sure that the options inside disabled selects aren't marked as disabled
+ // (WebKit marks them as diabled)
+ select.disabled = true;
+ jQuery.support.optDisabled = !opt.disabled;
+
script.type = "text/javascript";
try {
script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
@@ -909,7 +1006,7 @@
// Fails in Internet Explorer
try {
delete script.test;
-
+
} catch(e) {
jQuery.support.deleteExpando = false;
}
@@ -943,27 +1040,63 @@
document.body.appendChild( div );
jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
- document.body.removeChild( div ).style.display = 'none';
- div = null;
+ if ( "zoom" in div.style ) {
+ // Check if natively block-level elements act like inline-block
+ // elements when setting their display to 'inline' and giving
+ // them layout
+ // (IE < 8 does this)
+ div.style.display = "inline";
+ div.style.zoom = 1;
+ jQuery.support.inlineBlockNeedsLayout = div.offsetWidth === 2;
+
+ // Check if elements with layout shrink-wrap their children
+ // (IE 6 does this)
+ div.style.display = "";
+ div.innerHTML = "<div style='width:4px;'></div>";
+ jQuery.support.shrinkWrapBlocks = div.offsetWidth !== 2;
+ }
+
+ div.innerHTML = "<table><tr><td style='padding:0;display:none'></td><td>t</td></tr></table>";
+ var tds = div.getElementsByTagName("td");
+
+ // Check if table cells still have offsetWidth/Height when they are set
+ // to display:none and there are still other visible table cells in a
+ // table row; if so, offsetWidth/Height are not reliable for use when
+ // determining if an element has been hidden directly using
+ // display:none (it is still safe to use offsets if a parent element is
+ // hidden; don safety goggles and see bug #4512 for more information).
+ // (only IE 8 fails this test)
+ jQuery.support.reliableHiddenOffsets = tds[0].offsetHeight === 0;
+
+ tds[0].style.display = "";
+ tds[1].style.display = "none";
+
+ // Check if empty table cells still have offsetWidth/Height
+ // (IE < 8 fail this test)
+ jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0;
+ div.innerHTML = "";
+
+ document.body.removeChild( div ).style.display = "none";
+ div = tds = null;
});
// Technique from Juriy Zaytsev
// http://thinkweb2.com/projects/prototype/detecting-event-support-without-b...
- var eventSupported = function( eventName ) {
- var el = document.createElement("div");
- eventName = "on" + eventName;
+ var eventSupported = function( eventName ) {
+ var el = document.createElement("div");
+ eventName = "on" + eventName;
- var isSupported = (eventName in el);
- if ( !isSupported ) {
- el.setAttribute(eventName, "return;");
- isSupported = typeof el[eventName] === "function";
- }
- el = null;
+ var isSupported = (eventName in el);
+ if ( !isSupported ) {
+ el.setAttribute(eventName, "return;");
+ isSupported = typeof el[eventName] === "function";
+ }
+ el = null;
- return isSupported;
+ return isSupported;
};
-
+
jQuery.support.submitBubbles = eventSupported("submit");
jQuery.support.changeBubbles = eventSupported("change");
@@ -971,35 +1104,31 @@
root = script = div = all = a = null;
})();
-jQuery.props = {
- "for": "htmlFor",
- "class": "className",
- readonly: "readOnly",
- maxlength: "maxLength",
- cellspacing: "cellSpacing",
- rowspan: "rowSpan",
- colspan: "colSpan",
- tabindex: "tabIndex",
- usemap: "useMap",
- frameborder: "frameBorder"
-};
-var expando = "jQuery" + now(), uuid = 0, windowData = {};
+
+var windowData = {},
+ rbrace = /^(?:\{.*\}|\[.*\])$/;
+
jQuery.extend({
cache: {},
-
- expando:expando,
+ // Please use with caution
+ uuid: 0,
+
+ // Unique for each copy of jQuery on the page
+ expando: "jQuery" + jQuery.now(),
+
// The following elements throw uncatchable exceptions if you
// attempt to add expando properties to them.
noData: {
"embed": true,
- "object": true,
+ // Ban all objects except for Flash (which handle expandos)
+ "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
"applet": true
},
data: function( elem, name, data ) {
- if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
+ if ( !jQuery.acceptData( elem ) ) {
return;
}
@@ -1007,29 +1136,38 @@
windowData :
elem;
- var id = elem[ expando ], cache = jQuery.cache, thisCache;
+ var isNode = elem.nodeType,
+ id = isNode ? elem[ jQuery.expando ] : null,
+ cache = jQuery.cache, thisCache;
- if ( !id && typeof name === "string" && data === undefined ) {
- return null;
+ if ( isNode && !id && typeof name === "string" && data === undefined ) {
+ return;
}
+ // Get the data from the object directly
+ if ( !isNode ) {
+ cache = elem;
+
// Compute a unique ID for the element
- if ( !id ) {
- id = ++uuid;
+ } else if ( !id ) {
+ elem[ jQuery.expando ] = id = ++jQuery.uuid;
}
// Avoid generating a new cache unless none exists and we
// want to manipulate it.
if ( typeof name === "object" ) {
- elem[ expando ] = id;
- thisCache = cache[ id ] = jQuery.extend(true, {}, name);
+ if ( isNode ) {
+ cache[ id ] = jQuery.extend(cache[ id ], name);
- } else if ( !cache[ id ] ) {
- elem[ expando ] = id;
+ } else {
+ jQuery.extend( cache, name );
+ }
+
+ } else if ( isNode && !cache[ id ] ) {
cache[ id ] = {};
}
- thisCache = cache[ id ];
+ thisCache = isNode ? cache[ id ] : cache;
// Prevent overriding the named cache with undefined values
if ( data !== undefined ) {
@@ -1040,7 +1178,7 @@
},
removeData: function( elem, name ) {
- if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
+ if ( !jQuery.acceptData( elem ) ) {
return;
}
@@ -1048,7 +1186,10 @@
windowData :
elem;
- var id = elem[ expando ], cache = jQuery.cache, thisCache = cache[ id ];
+ var isNode = elem.nodeType,
+ id = isNode ? elem[ jQuery.expando ] : elem,
+ cache = jQuery.cache,
+ thisCache = isNode ? cache[ id ] : id;
// If we want to remove a specific section of the element's data
if ( name ) {
@@ -1057,31 +1198,67 @@
delete thisCache[ name ];
// If we've removed all the data, remove the element's cache
- if ( jQuery.isEmptyObject(thisCache) ) {
+ if ( isNode && jQuery.isEmptyObject(thisCache) ) {
jQuery.removeData( elem );
}
}
// Otherwise, we want to remove all of the element's data
} else {
- if ( jQuery.support.deleteExpando ) {
+ if ( isNode && jQuery.support.deleteExpando ) {
delete elem[ jQuery.expando ];
} else if ( elem.removeAttribute ) {
elem.removeAttribute( jQuery.expando );
- }
// Completely remove the data cache
- delete cache[ id ];
+ } else if ( isNode ) {
+ delete cache[ id ];
+
+ // Remove all fields from the object
+ } else {
+ for ( var n in elem ) {
+ delete elem[ n ];
+ }
+ }
}
+ },
+
+ // A method for determining if a DOM node can handle the data expando
+ acceptData: function( elem ) {
+ if ( elem.nodeName ) {
+ var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
+
+ if ( match ) {
+ return !(match === true || elem.getAttribute("classid") !== match);
+ }
+ }
+
+ return true;
}
});
jQuery.fn.extend({
data: function( key, value ) {
- if ( typeof key === "undefined" && this.length ) {
- return jQuery.data( this[0] );
+ var data = null;
+ if ( typeof key === "undefined" ) {
+ if ( this.length ) {
+ var attr = this[0].attributes, name;
+ data = jQuery.data( this[0] );
+
+ for ( var i = 0, l = attr.length; i < l; i++ ) {
+ name = attr[i].name;
+
+ if ( name.indexOf( "data-" ) === 0 ) {
+ name = name.substr( 5 );
+ dataAttr( this[0], name, data[ name ] );
+ }
+ }
+ }
+
+ return data;
+
} else if ( typeof key === "object" ) {
return this.each(function() {
jQuery.data( this, key );
@@ -1092,17 +1269,26 @@
parts[1] = parts[1] ? "." + parts[1] : "";
if ( value === undefined ) {
- var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
+ data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
+ // Try to fetch any internally stored data first
if ( data === undefined && this.length ) {
data = jQuery.data( this[0], key );
+ data = dataAttr( this[0], key, data );
}
+
return data === undefined && parts[1] ?
this.data( parts[0] ) :
data;
+
} else {
- return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function() {
+ return this.each(function() {
+ var $this = jQuery( this ),
+ args = [ parts[0], value ];
+
+ $this.triggerHandler( "setData" + parts[1] + "!", args );
jQuery.data( this, key, value );
+ $this.triggerHandler( "changeData" + parts[1] + "!", args );
});
}
},
@@ -1113,6 +1299,37 @@
});
}
});
+
+function dataAttr( elem, key, data ) {
+ // If nothing was found internally, try to fetch any
+ // data from the HTML5 data-* attribute
+ if ( data === undefined && elem.nodeType === 1 ) {
+ data = elem.getAttribute( "data-" + key );
+
+ if ( typeof data === "string" ) {
+ try {
+ data = data === "true" ? true :
+ data === "false" ? false :
+ data === "null" ? null :
+ !jQuery.isNaN( data ) ? parseFloat( data ) :
+ rbrace.test( data ) ? jQuery.parseJSON( data ) :
+ data;
+ } catch( e ) {}
+
+ // Make sure we set the data so it isn't changed later
+ jQuery.data( elem, key, data );
+
+ } else {
+ data = undefined;
+ }
+ }
+
+ return data;
+}
+
+
+
+
jQuery.extend({
queue: function( elem, type, data ) {
if ( !elem ) {
@@ -1140,7 +1357,8 @@
dequeue: function( elem, type ) {
type = type || "fx";
- var queue = jQuery.queue( elem, type ), fn = queue.shift();
+ var queue = jQuery.queue( elem, type ),
+ fn = queue.shift();
// If the fx queue is dequeued, always remove the progress sentinel
if ( fn === "inprogress" ) {
@@ -1171,7 +1389,7 @@
if ( data === undefined ) {
return jQuery.queue( this[0], type );
}
- return this.each(function( i, elem ) {
+ return this.each(function( i ) {
var queue = jQuery.queue( this, type, data );
if ( type === "fx" && queue[0] !== "inprogress" ) {
@@ -1203,18 +1421,35 @@
return this.queue( type || "fx", [] );
}
});
+
+
+
+
var rclass = /[\n\t]/g,
- rspace = /\s+/,
+ rspaces = /\s+/,
rreturn = /\r/g,
- rspecialurl = /href|src|style/,
- rtype = /(button|input)/i,
- rfocusable = /(button|input|object|select|textarea)/i,
- rclickable = /^(a|area)$/i,
- rradiocheck = /radio|checkbox/;
+ rspecialurl = /^(?:href|src|style)$/,
+ rtype = /^(?:button|input)$/i,
+ rfocusable = /^(?:button|input|object|select|textarea)$/i,
+ rclickable = /^a(?:rea)?$/i,
+ rradiocheck = /^(?:radio|checkbox)$/i;
+jQuery.props = {
+ "for": "htmlFor",
+ "class": "className",
+ readonly: "readOnly",
+ maxlength: "maxLength",
+ cellspacing: "cellSpacing",
+ rowspan: "rowSpan",
+ colspan: "colSpan",
+ tabindex: "tabIndex",
+ usemap: "useMap",
+ frameborder: "frameBorder"
+};
+
jQuery.fn.extend({
attr: function( name, value ) {
- return access( this, name, value, true, jQuery.attr );
+ return jQuery.access( this, name, value, true, jQuery.attr );
},
removeAttr: function( name, fn ) {
@@ -1235,7 +1470,7 @@
}
if ( value && typeof value === "string" ) {
- var classNames = (value || "").split( rspace );
+ var classNames = (value || "").split( rspaces );
for ( var i = 0, l = this.length; i < l; i++ ) {
var elem = this[i];
@@ -1245,7 +1480,9 @@
elem.className = value;
} else {
- var className = " " + elem.className + " ", setClass = elem.className;
+ var className = " " + elem.className + " ",
+ setClass = elem.className;
+
for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) {
setClass += " " + classNames[c];
@@ -1269,7 +1506,7 @@
}
if ( (value && typeof value === "string") || value === undefined ) {
- var classNames = (value || "").split(rspace);
+ var classNames = (value || "").split( rspaces );
for ( var i = 0, l = this.length; i < l; i++ ) {
var elem = this[i];
@@ -1293,7 +1530,8 @@
},
toggleClass: function( value, stateVal ) {
- var type = typeof value, isBool = typeof stateVal === "boolean";
+ var type = typeof value,
+ isBool = typeof stateVal === "boolean";
if ( jQuery.isFunction( value ) ) {
return this.each(function(i) {
@@ -1305,9 +1543,11 @@
return this.each(function() {
if ( type === "string" ) {
// toggle individual class names
- var className, i = 0, self = jQuery(this),
+ var className,
+ i = 0,
+ self = jQuery( this ),
state = stateVal,
- classNames = value.split( rspace );
+ classNames = value.split( rspaces );
while ( (className = classNames[ i++ ]) ) {
// check each className given, space seperated list
@@ -1339,12 +1579,15 @@
},
val: function( value ) {
- if ( value === undefined ) {
+ if ( !arguments.length ) {
var elem = this[0];
if ( elem ) {
if ( jQuery.nodeName( elem, "option" ) ) {
- return (elem.attributes.value || {}).specified ? elem.value : elem.text;
+ // attributes.value is undefined in Blackberry 4.7 but
+ // uses .value. See #6932
+ var val = elem.attributes.value;
+ return !val || val.specified ? elem.value : elem.text;
}
// We need to handle select boxes special
@@ -1363,8 +1606,11 @@
for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
var option = options[ i ];
- if ( option.selected ) {
- // Get the specifc value for the option
+ // Don't return options that are disabled or in a disabled optgroup
+ if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
+ (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
+
+ // Get the specific value for the option
value = jQuery(option).val();
// We don't need an array for one selects
@@ -1407,10 +1653,15 @@
val = value.call(this, i, self.val());
}
- // Typecast each time if the value is a Function and the appended
- // value is therefore different each time.
- if ( typeof val === "number" ) {
+ // Treat null/undefined as ""; convert numbers to string
+ if ( val == null ) {
+ val = "";
+ } else if ( typeof val === "number" ) {
val += "";
+ } else if ( jQuery.isArray(val) ) {
+ val = jQuery.map(val, function (value) {
+ return value == null ? "" : value + "";
+ });
}
if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) {
@@ -1463,89 +1714,103 @@
// Try to normalize/fix the name
name = notxml && jQuery.props[ name ] || name;
- // Only do all the following if this is a node (faster for style)
- if ( elem.nodeType === 1 ) {
- // These attributes require special treatment
- var special = rspecialurl.test( name );
+ // These attributes require special treatment
+ var special = rspecialurl.test( name );
- // Safari mis-reports the default selected property of an option
- // Accessing the parent's selectedIndex property fixes it
- if ( name === "selected" && !jQuery.support.optSelected ) {
- var parent = elem.parentNode;
- if ( parent ) {
- parent.selectedIndex;
-
- // Make sure that it also works with optgroups, see #5701
- if ( parent.parentNode ) {
- parent.parentNode.selectedIndex;
- }
+ // Safari mis-reports the default selected property of an option
+ // Accessing the parent's selectedIndex property fixes it
+ if ( name === "selected" && !jQuery.support.optSelected ) {
+ var parent = elem.parentNode;
+ if ( parent ) {
+ parent.selectedIndex;
+
+ // Make sure that it also works with optgroups, see #5701
+ if ( parent.parentNode ) {
+ parent.parentNode.selectedIndex;
}
}
+ }
- // If applicable, access the attribute via the DOM 0 way
- if ( name in elem && notxml && !special ) {
- if ( set ) {
- // We can't allow the type property to be changed (since it causes problems in IE)
- if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) {
- jQuery.error( "type property can't be changed" );
+ // If applicable, access the attribute via the DOM 0 way
+ // 'in' checks fail in Blackberry 4.7 #6931
+ if ( (name in elem || elem[ name ] !== undefined) && notxml && !special ) {
+ if ( set ) {
+ // We can't allow the type property to be changed (since it causes problems in IE)
+ if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) {
+ jQuery.error( "type property can't be changed" );
+ }
+
+ if ( value === null ) {
+ if ( elem.nodeType === 1 ) {
+ elem.removeAttribute( name );
}
+ } else {
elem[ name ] = value;
}
+ }
- // browsers index elements by id/name on forms, give priority to attributes.
- if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) {
- return elem.getAttributeNode( name ).nodeValue;
- }
+ // browsers index elements by id/name on forms, give priority to attributes.
+ if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) {
+ return elem.getAttributeNode( name ).nodeValue;
+ }
- // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
- // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabi...
- if ( name === "tabIndex" ) {
- var attributeNode = elem.getAttributeNode( "tabIndex" );
+ // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
+ // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabi...
+ if ( name === "tabIndex" ) {
+ var attributeNode = elem.getAttributeNode( "tabIndex" );
- return attributeNode && attributeNode.specified ?
- attributeNode.value :
- rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
- 0 :
- undefined;
- }
-
- return elem[ name ];
+ return attributeNode && attributeNode.specified ?
+ attributeNode.value :
+ rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
+ 0 :
+ undefined;
}
- if ( !jQuery.support.style && notxml && name === "style" ) {
- if ( set ) {
- elem.style.cssText = "" + value;
- }
+ return elem[ name ];
+ }
- return elem.style.cssText;
- }
-
+ if ( !jQuery.support.style && notxml && name === "style" ) {
if ( set ) {
- // convert the value to a string (all browsers do this but IE) see #1070
- elem.setAttribute( name, "" + value );
+ elem.style.cssText = "" + value;
}
- var attr = !jQuery.support.hrefNormalized && notxml && special ?
- // Some attributes require a special call on IE
- elem.getAttribute( name, 2 ) :
- elem.getAttribute( name );
+ return elem.style.cssText;
+ }
- // Non-existent attributes return null, we normalize to undefined
- return attr === null ? undefined : attr;
+ if ( set ) {
+ // convert the value to a string (all browsers do this but IE) see #1070
+ elem.setAttribute( name, "" + value );
}
- // elem is actually elem.style ... set the style
- // Using attr for specific style information is now deprecated. Use style instead.
- return jQuery.style( elem, name, value );
+ // Ensure that missing attributes return undefined
+ // Blackberry 4.7 returns "" from getAttribute #6938
+ if ( !elem.attributes[ name ] && (elem.hasAttribute && !elem.hasAttribute( name )) ) {
+ return undefined;
+ }
+
+ var attr = !jQuery.support.hrefNormalized && notxml && special ?
+ // Some attributes require a special call on IE
+ elem.getAttribute( name, 2 ) :
+ elem.getAttribute( name );
+
+ // Non-existent attributes return null, we normalize to undefined
+ return attr === null ? undefined : attr;
}
});
+
+
+
+
var rnamespaces = /\.(.*)$/,
+ rformElems = /^(?:textarea|input|select)$/i,
+ rperiod = /\./g,
+ rspace = / /g,
+ rescape = /[^\w\s.|`]/g,
fcleanup = function( nm ) {
- return nm.replace(/[^\w\s\.\|`]/g, function( ch ) {
- return "\\" + ch;
- });
- };
+ return nm.replace(rescape, "\\$&");
+ },
+ focusCounts = { focusin: 0, focusout: 0 };
/*
* A number of helper functions used for managing events.
@@ -1563,10 +1828,17 @@
// For whatever reason, IE has trouble passing the window object
// around, causing it to be cloned in the process
- if ( elem.setInterval && ( elem !== window && !elem.frameElement ) ) {
+ if ( jQuery.isWindow( elem ) && ( elem !== window && !elem.frameElement ) ) {
elem = window;
}
+ if ( handler === false ) {
+ handler = returnFalse;
+ } else if ( !handler ) {
+ // Fixes bug #7229. Fix recommended by jdalton
+ return;
+ }
+
var handleObjIn, handleObj;
if ( handler.handler ) {
@@ -1588,9 +1860,29 @@
return;
}
- var events = elemData.events = elemData.events || {},
- eventHandle = elemData.handle, eventHandle;
+ // Use a key less likely to result in collisions for plain JS objects.
+ // Fixes bug #7150.
+ var eventKey = elem.nodeType ? "events" : "__events__",
+ events = elemData[ eventKey ],
+ eventHandle = elemData.handle;
+
+ if ( typeof events === "function" ) {
+ // On plain objects events is a fn that holds the the data
+ // which prevents this data from being JSON serialized
+ // the function does not need to be called, it just contains the data
+ eventHandle = events.handle;
+ events = events.events;
+ } else if ( !events ) {
+ if ( !elem.nodeType ) {
+ // On plain objects, create a fn that acts as the holder
+ // of the values to avoid JSON serialization of event data
+ elemData[ eventKey ] = elemData = function(){};
+ }
+
+ elemData.events = events = {};
+ }
+
if ( !eventHandle ) {
elemData.handle = eventHandle = function() {
// Handle the second event of a trigger and when
@@ -1628,7 +1920,9 @@
}
handleObj.type = type;
- handleObj.guid = handler.guid;
+ if ( !handleObj.guid ) {
+ handleObj.guid = handler.guid;
+ }
// Get the current list of functions bound to this event
var handlers = events[ type ],
@@ -1680,13 +1974,23 @@
return;
}
- var ret, type, fn, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType,
+ if ( handler === false ) {
+ handler = returnFalse;
+ }
+
+ var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType,
+ eventKey = elem.nodeType ? "events" : "__events__",
elemData = jQuery.data( elem ),
- events = elemData && elemData.events;
+ events = elemData && elemData[ eventKey ];
if ( !elemData || !events ) {
return;
}
+
+ if ( typeof events === "function" ) {
+ elemData = events;
+ events = events.events;
+ }
// types is actually an event object here
if ( types && types.type ) {
@@ -1721,7 +2025,7 @@
type = namespaces.shift();
namespace = new RegExp("(^|\\.)" +
- jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)")
+ jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)");
}
eventType = events[ type ];
@@ -1731,7 +2035,7 @@
}
if ( !handler ) {
- for ( var j = 0; j < eventType.length; j++ ) {
+ for ( j = 0; j < eventType.length; j++ ) {
handleObj = eventType[ j ];
if ( all || namespace.test( handleObj.namespace ) ) {
@@ -1745,7 +2049,7 @@
special = jQuery.event.special[ type ] || {};
- for ( var j = pos || 0; j < eventType.length; j++ ) {
+ for ( j = pos || 0; j < eventType.length; j++ ) {
handleObj = eventType[ j ];
if ( handler.guid === handleObj.guid ) {
@@ -1769,7 +2073,7 @@
// remove generic event handler if no more handlers exist
if ( eventType.length === 0 || pos != null && eventType.length === 1 ) {
if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
- removeEvent( elem, type, elemData.handle );
+ jQuery.removeEvent( elem, type, elemData.handle );
}
ret = null;
@@ -1787,7 +2091,10 @@
delete elemData.events;
delete elemData.handle;
- if ( jQuery.isEmptyObject( elemData ) ) {
+ if ( typeof elemData === "function" ) {
+ jQuery.removeData( elem, eventKey );
+
+ } else if ( jQuery.isEmptyObject( elemData ) ) {
jQuery.removeData( elem );
}
}
@@ -1802,7 +2109,7 @@
if ( !bubbling ) {
event = typeof event === "object" ?
// jQuery.Event object
- event[expando] ? event :
+ event[ jQuery.expando ] ? event :
// Object literal
jQuery.extend( jQuery.Event(type), event ) :
// Just the event type (string)
@@ -1847,7 +2154,10 @@
event.currentTarget = elem;
// Trigger the event, it is assumed that "handle" is a function
- var handle = jQuery.data( elem, "handle" );
+ var handle = elem.nodeType ?
+ jQuery.data( elem, "handle" ) :
+ (jQuery.data( elem, "__events__" ) || {}).handle;
+
if ( handle ) {
handle.apply( elem, data );
}
@@ -1859,41 +2169,44 @@
if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) {
if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) {
event.result = false;
+ event.preventDefault();
}
}
// prevent IE from throwing an error for some elements with some event types, see #3533
- } catch (e) {}
+ } catch (inlineError) {}
if ( !event.isPropagationStopped() && parent ) {
jQuery.event.trigger( event, data, parent, true );
} else if ( !event.isDefaultPrevented() ) {
- var target = event.target, old,
- isClick = jQuery.nodeName(target, "a") && type === "click",
- special = jQuery.event.special[ type ] || {};
+ var old,
+ target = event.target,
+ targetType = type.replace( rnamespaces, "" ),
+ isClick = jQuery.nodeName( target, "a" ) && targetType === "click",
+ special = jQuery.event.special[ targetType ] || {};
if ( (!special._default || special._default.call( elem, event ) === false) &&
!isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) {
try {
- if ( target[ type ] ) {
+ if ( target[ targetType ] ) {
// Make sure that we don't accidentally re-trigger the onFOO events
- old = target[ "on" + type ];
+ old = target[ "on" + targetType ];
if ( old ) {
- target[ "on" + type ] = null;
+ target[ "on" + targetType ] = null;
}
jQuery.event.triggered = true;
- target[ type ]();
+ target[ targetType ]();
}
// prevent IE from throwing an error for some elements with some event types, see #3533
- } catch (e) {}
+ } catch (triggerError) {}
if ( old ) {
- target[ "on" + type ] = old;
+ target[ "on" + targetType ] = old;
}
jQuery.event.triggered = false;
@@ -1902,9 +2215,11 @@
},
handle: function( event ) {
- var all, handlers, namespaces, namespace, events;
+ var all, handlers, namespaces, namespace_re, events,
+ namespace_sort = [],
+ args = jQuery.makeArray( arguments );
- event = arguments[0] = jQuery.event.fix( event || window.event );
+ event = args[0] = jQuery.event.fix( event || window.event );
event.currentTarget = this;
// Namespaced event handlers
@@ -1913,11 +2228,20 @@
if ( !all ) {
namespaces = event.type.split(".");
event.type = namespaces.shift();
- namespace = new RegExp("(^|\\.)" + namespaces.slice(0).sort().join("\\.(?:.*\\.)?") + "(\\.|$)");
+ namespace_sort = namespaces.slice(0).sort();
+ namespace_re = new RegExp("(^|\\.)" + namespace_sort.join("\\.(?:.*\\.)?") + "(\\.|$)");
}
- var events = jQuery.data(this, "events"), handlers = events[ event.type ];
+ event.namespace = event.namespace || namespace_sort.join(".");
+ events = jQuery.data(this, this.nodeType ? "events" : "__events__");
+
+ if ( typeof events === "function" ) {
+ events = events.events;
+ }
+
+ handlers = (events || {})[ event.type ];
+
if ( events && handlers ) {
// Clone the handlers to prevent manipulation
handlers = handlers.slice(0);
@@ -1926,14 +2250,14 @@
var handleObj = handlers[ j ];
// Filter the functions by class
- if ( all || namespace.test( handleObj.namespace ) ) {
+ if ( all || namespace_re.test( handleObj.namespace ) ) {
// Pass in a reference to the handler function itself
// So that we can later remove it
event.handler = handleObj.handler;
event.data = handleObj.data;
event.handleObj = handleObj;
- var ret = handleObj.handler.apply( this, arguments );
+ var ret = handleObj.handler.apply( this, args );
if ( ret !== undefined ) {
event.result = ret;
@@ -1953,10 +2277,10 @@
return event.result;
},
- props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
+ props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
fix: function( event ) {
- if ( event[ expando ] ) {
+ if ( event[ jQuery.expando ] ) {
return event;
}
@@ -1972,7 +2296,8 @@
// Fix target property, if necessary
if ( !event.target ) {
- event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either
+ // Fixes #1925 where srcElement might not be defined either
+ event.target = event.srcElement || document;
}
// check if target is a textnode (safari)
@@ -1987,14 +2312,16 @@
// Calculate pageX/Y if missing and clientX/Y available
if ( event.pageX == null && event.clientX != null ) {
- var doc = document.documentElement, body = document.body;
+ var doc = document.documentElement,
+ body = document.body;
+
event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
}
// Add which for key events
- if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) ) {
- event.which = event.charCode || event.keyCode;
+ if ( event.which == null && (event.charCode != null || event.keyCode != null) ) {
+ event.which = event.charCode != null ? event.charCode : event.keyCode;
}
// Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
@@ -2026,36 +2353,24 @@
live: {
add: function( handleObj ) {
- jQuery.event.add( this, handleObj.origType, jQuery.extend({}, handleObj, {handler: liveHandler}) );
+ jQuery.event.add( this,
+ liveConvert( handleObj.origType, handleObj.selector ),
+ jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) );
},
remove: function( handleObj ) {
- var remove = true,
- type = handleObj.origType.replace(rnamespaces, "");
-
- jQuery.each( jQuery.data(this, "events").live || [], function() {
- if ( type === this.origType.replace(rnamespaces, "") ) {
- remove = false;
- return false;
- }
- });
-
- if ( remove ) {
- jQuery.event.remove( this, handleObj.origType, liveHandler );
- }
+ jQuery.event.remove( this, liveConvert( handleObj.origType, handleObj.selector ), handleObj );
}
-
},
beforeunload: {
setup: function( data, namespaces, eventHandle ) {
// We only want to do this special case on windows
- if ( this.setInterval ) {
+ if ( jQuery.isWindow( this ) ) {
this.onbeforeunload = eventHandle;
}
+ },
- return false;
- },
teardown: function( namespaces, eventHandle ) {
if ( this.onbeforeunload === eventHandle ) {
this.onbeforeunload = null;
@@ -2065,12 +2380,16 @@
}
};
-var removeEvent = document.removeEventListener ?
+jQuery.removeEvent = document.removeEventListener ?
function( elem, type, handle ) {
- elem.removeEventListener( type, handle, false );
+ if ( elem.removeEventListener ) {
+ elem.removeEventListener( type, handle, false );
+ }
} :
function( elem, type, handle ) {
- elem.detachEvent( "on" + type, handle );
+ if ( elem.detachEvent ) {
+ elem.detachEvent( "on" + type, handle );
+ }
};
jQuery.Event = function( src ) {
@@ -2090,10 +2409,10 @@
// timeStamp is buggy for some events on Firefox(#3843)
// So we won't rely on the native value
- this.timeStamp = now();
+ this.timeStamp = jQuery.now();
// Mark it as fixed
- this[ expando ] = true;
+ this[ jQuery.expando ] = true;
};
function returnFalse() {
@@ -2117,9 +2436,11 @@
// if preventDefault exists run it on the original event
if ( e.preventDefault ) {
e.preventDefault();
+
+ // otherwise set the returnValue property of the original event to false (IE)
+ } else {
+ e.returnValue = false;
}
- // otherwise set the returnValue property of the original event to false (IE)
- e.returnValue = false;
},
stopPropagation: function() {
this.isPropagationStopped = returnTrue;
@@ -2199,17 +2520,21 @@
setup: function( data, namespaces ) {
if ( this.nodeName.toLowerCase() !== "form" ) {
jQuery.event.add(this, "click.specialSubmit", function( e ) {
- var elem = e.target, type = elem.type;
+ var elem = e.target,
+ type = elem.type;
if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {
+ e.liveFired = undefined;
return trigger( "submit", this, arguments );
}
});
jQuery.event.add(this, "keypress.specialSubmit", function( e ) {
- var elem = e.target, type = elem.type;
+ var elem = e.target,
+ type = elem.type;
if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {
+ e.liveFired = undefined;
return trigger( "submit", this, arguments );
}
});
@@ -2229,10 +2554,8 @@
// change delegation, happens here so we have bind.
if ( !jQuery.support.changeBubbles ) {
- var formElems = /textarea|input|select/i,
+ var changeFilters,
- changeFilters,
-
getVal = function( elem ) {
var type = elem.type, val = elem.value;
@@ -2256,7 +2579,7 @@
testChange = function testChange( e ) {
var elem = e.target, data, val;
- if ( !formElems.test( elem.nodeName ) || elem.readOnly ) {
+ if ( !rformElems.test( elem.nodeName ) || elem.readOnly ) {
return;
}
@@ -2274,6 +2597,7 @@
if ( data != null || val ) {
e.type = "change";
+ e.liveFired = undefined;
return jQuery.event.trigger( e, arguments[1], elem );
}
};
@@ -2282,6 +2606,8 @@
filters: {
focusout: testChange,
+ beforedeactivate: testChange,
+
click: function( e ) {
var elem = e.target, type = elem.type;
@@ -2304,7 +2630,7 @@
// Beforeactivate happens also before the previous element is blurred
// with this event you can't trigger a change event, but you can store
- // information/focus[in] is not needed anymore
+ // information
beforeactivate: function( e ) {
var elem = e.target;
jQuery.data( elem, "_change_data", getVal(elem) );
@@ -2320,17 +2646,20 @@
jQuery.event.add( this, type + ".specialChange", changeFilters[type] );
}
- return formElems.test( this.nodeName );
+ return rformElems.test( this.nodeName );
},
teardown: function( namespaces ) {
jQuery.event.remove( this, ".specialChange" );
- return formElems.test( this.nodeName );
+ return rformElems.test( this.nodeName );
}
};
changeFilters = jQuery.event.special.change.filters;
+
+ // Handle when the input is .focus()'d
+ changeFilters.focus = changeFilters.beforeactivate;
}
function trigger( type, elem, args ) {
@@ -2343,17 +2672,21 @@
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
jQuery.event.special[ fix ] = {
setup: function() {
- this.addEventListener( orig, handler, true );
+ if ( focusCounts[fix]++ === 0 ) {
+ document.addEventListener( orig, handler, true );
+ }
},
teardown: function() {
- this.removeEventListener( orig, handler, true );
+ if ( --focusCounts[fix] === 0 ) {
+ document.removeEventListener( orig, handler, true );
+ }
}
};
function handler( e ) {
e = jQuery.event.fix( e );
e.type = fix;
- return jQuery.event.handle.call( this, e );
+ return jQuery.event.trigger( e, null, e.target );
}
});
}
@@ -2368,7 +2701,7 @@
return this;
}
- if ( jQuery.isFunction( data ) ) {
+ if ( jQuery.isFunction( data ) || data === false ) {
fn = data;
data = undefined;
}
@@ -2439,7 +2772,8 @@
toggle: function( fn ) {
// Save reference to arguments for access in closure
- var args = arguments, i = 1;
+ var args = arguments,
+ i = 1;
// link all the functions, so any of them can unbind this click handler
while ( i < args.length ) {
@@ -2476,6 +2810,14 @@
var type, i = 0, match, namespaces, preType,
selector = origSelector || this.selector,
context = origSelector ? this : jQuery( this.context );
+
+ if ( typeof types === "object" && !types.preventDefault ) {
+ for ( var key in types ) {
+ context[ name ]( key, data, types[key], selector );
+ }
+
+ return this;
+ }
if ( jQuery.isFunction( data ) ) {
fn = data;
@@ -2510,30 +2852,39 @@
if ( name === "live" ) {
// bind live handler
- context.each(function(){
- jQuery.event.add( this, liveConvert( type, selector ),
+ for ( var j = 0, l = context.length; j < l; j++ ) {
+ jQuery.event.add( context[j], "live." + liveConvert( type, selector ),
{ data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } );
- });
+ }
} else {
// unbind live handler
- context.unbind( liveConvert( type, selector ), fn );
+ context.unbind( "live." + liveConvert( type, selector ), fn );
}
}
return this;
- }
+ };
});
function liveHandler( event ) {
- var stop, elems = [], selectors = [], args = arguments,
- related, match, handleObj, elem, j, i, l, data,
- events = jQuery.data( this, "events" );
+ var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret,
+ elems = [],
+ selectors = [],
+ events = jQuery.data( this, this.nodeType ? "events" : "__events__" );
+ if ( typeof events === "function" ) {
+ events = events.events;
+ }
+
// Make sure we avoid non-left-click bubbling in Firefox (#3861)
if ( event.liveFired === this || !events || !events.live || event.button && event.type === "click" ) {
return;
}
+
+ if ( event.namespace ) {
+ namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)");
+ }
event.liveFired = this;
@@ -2553,20 +2904,23 @@
match = jQuery( event.target ).closest( selectors, event.currentTarget );
for ( i = 0, l = match.length; i < l; i++ ) {
+ close = match[i];
+
for ( j = 0; j < live.length; j++ ) {
handleObj = live[j];
- if ( match[i].selector === handleObj.selector ) {
- elem = match[i].elem;
+ if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) ) {
+ elem = close.elem;
related = null;
// Those two events require additional checking
if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) {
+ event.type = handleObj.preType;
related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0];
}
if ( !related || related !== elem ) {
- elems.push({ elem: elem, handleObj: handleObj });
+ elems.push({ elem: elem, handleObj: handleObj, level: close.level });
}
}
}
@@ -2574,13 +2928,26 @@
for ( i = 0, l = elems.length; i < l; i++ ) {
match = elems[i];
+
+ if ( maxLevel && match.level > maxLevel ) {
+ break;
+ }
+
event.currentTarget = match.elem;
event.data = match.handleObj.data;
event.handleObj = match.handleObj;
- if ( match.handleObj.origHandler.apply( match.elem, args ) === false ) {
- stop = false;
- break;
+ ret = match.handleObj.origHandler.apply( match.elem, arguments );
+
+ if ( ret === false || event.isPropagationStopped() ) {
+ maxLevel = match.level;
+
+ if ( ret === false ) {
+ stop = false;
+ }
+ if ( event.isImmediatePropagationStopped() ) {
+ break;
+ }
}
}
@@ -2588,7 +2955,7 @@
}
function liveConvert( type, selector ) {
- return "live." + (type && type !== "*" ? type + "." : "") + selector.replace(/\./g, "`").replace(/ /g, "&");
+ return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspace, "&");
}
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
@@ -2596,8 +2963,15 @@
"change select submit keydown keypress keyup error").split(" "), function( i, name ) {
// Handle event binding
- jQuery.fn[ name ] = function( fn ) {
- return fn ? this.bind( name, fn ) : this.trigger( name );
+ jQuery.fn[ name ] = function( data, fn ) {
+ if ( fn == null ) {
+ fn = data;
+ data = null;
+ }
+
+ return arguments.length > 0 ?
+ this.bind( name, data, fn ) :
+ this.trigger( name );
};
if ( jQuery.attrFn ) {
@@ -2610,7 +2984,7 @@
// More info:
// - http://isaacschlueter.com/2006/10/msie-memory-leaks/
if ( window.attachEvent && !window.addEventListener ) {
- window.attachEvent("onunload", function() {
+ jQuery(window).bind("unload", function() {
for ( var id in jQuery.cache ) {
if ( jQuery.cache[ id ].handle ) {
// Try/Catch is to handle iframes being unloaded, see #4280
@@ -2621,6 +2995,8 @@
}
});
}
+
+
/*!
* Sizzle CSS Selector Engine - v1.0
* Copyright 2009, The Dojo Foundation
@@ -2629,7 +3005,7 @@
*/
(function(){
-var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
+var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
done = 0,
toString = Object.prototype.toString,
hasDuplicate = false,
@@ -2639,15 +3015,17 @@
// optimization where it does not always call our comparision
// function. If that is the case, discard the hasDuplicate value.
// Thus far that includes Google Chrome.
-[0, 0].sort(function(){
+[0, 0].sort(function() {
baseHasDuplicate = false;
return 0;
});
-var Sizzle = function(selector, context, results, seed) {
+var Sizzle = function( selector, context, results, seed ) {
results = results || [];
- var origContext = context = context || document;
+ context = context || document;
+ var origContext = context;
+
if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
return [];
}
@@ -2656,24 +3034,34 @@
return results;
}
- var parts = [], m, set, checkSet, extra, prune = true, contextXML = isXML(context),
+ var m, set, checkSet, extra, ret, cur, pop, i,
+ prune = true,
+ contextXML = Sizzle.isXML( context ),
+ parts = [],
soFar = selector;
// Reset the position of the chunker regexp (start from head)
- while ( (chunker.exec(""), m = chunker.exec(soFar)) !== null ) {
- soFar = m[3];
+ do {
+ chunker.exec( "" );
+ m = chunker.exec( soFar );
+
+ if ( m ) {
+ soFar = m[3];
- parts.push( m[1] );
+ parts.push( m[1] );
- if ( m[2] ) {
- extra = m[3];
- break;
+ if ( m[2] ) {
+ extra = m[3];
+ break;
+ }
}
- }
+ } while ( m );
if ( parts.length > 1 && origPOS.exec( selector ) ) {
+
if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
set = posProcess( parts[0] + parts[1], context );
+
} else {
set = Expr.relative[ parts[0] ] ?
[ context ] :
@@ -2689,29 +3077,38 @@
set = posProcess( selector, set );
}
}
+
} else {
// Take a shortcut and set the context if the root selector is an ID
// (but not if it'll be faster if the inner selector is an ID)
if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
- var ret = Sizzle.find( parts.shift(), context, contextXML );
- context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0];
+
+ ret = Sizzle.find( parts.shift(), context, contextXML );
+ context = ret.expr ?
+ Sizzle.filter( ret.expr, ret.set )[0] :
+ ret.set[0];
}
if ( context ) {
- var ret = seed ?
+ ret = seed ?
{ expr: parts.pop(), set: makeArray(seed) } :
Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
- set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set;
+ set = ret.expr ?
+ Sizzle.filter( ret.expr, ret.set ) :
+ ret.set;
+
if ( parts.length > 0 ) {
- checkSet = makeArray(set);
+ checkSet = makeArray( set );
+
} else {
prune = false;
}
while ( parts.length ) {
- var cur = parts.pop(), pop = cur;
+ cur = parts.pop();
+ pop = cur;
if ( !Expr.relative[ cur ] ) {
cur = "";
@@ -2725,6 +3122,7 @@
Expr.relative[ cur ]( checkSet, pop, contextXML );
}
+
} else {
checkSet = parts = [];
}
@@ -2741,19 +3139,22 @@
if ( toString.call(checkSet) === "[object Array]" ) {
if ( !prune ) {
results.push.apply( results, checkSet );
+
} else if ( context && context.nodeType === 1 ) {
- for ( var i = 0; checkSet[i] != null; i++ ) {
- if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) {
+ for ( i = 0; checkSet[i] != null; i++ ) {
+ if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
results.push( set[i] );
}
}
+
} else {
- for ( var i = 0; checkSet[i] != null; i++ ) {
+ for ( i = 0; checkSet[i] != null; i++ ) {
if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
results.push( set[i] );
}
}
}
+
} else {
makeArray( checkSet, results );
}
@@ -2766,15 +3167,15 @@
return results;
};
-Sizzle.uniqueSort = function(results){
+Sizzle.uniqueSort = function( results ) {
if ( sortOrder ) {
hasDuplicate = baseHasDuplicate;
- results.sort(sortOrder);
+ results.sort( sortOrder );
if ( hasDuplicate ) {
for ( var i = 1; i < results.length; i++ ) {
- if ( results[i] === results[i-1] ) {
- results.splice(i--, 1);
+ if ( results[i] === results[ i - 1 ] ) {
+ results.splice( i--, 1 );
}
}
}
@@ -2783,27 +3184,33 @@
return results;
};
-Sizzle.matches = function(expr, set){
- return Sizzle(expr, null, null, set);
+Sizzle.matches = function( expr, set ) {
+ return Sizzle( expr, null, null, set );
};
-Sizzle.find = function(expr, context, isXML){
- var set, match;
+Sizzle.matchesSelector = function( node, expr ) {
+ return Sizzle( expr, null, null, [node] ).length > 0;
+};
+Sizzle.find = function( expr, context, isXML ) {
+ var set;
+
if ( !expr ) {
return [];
}
for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
- var type = Expr.order[i], match;
+ var match,
+ type = Expr.order[i];
if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
var left = match[1];
- match.splice(1,1);
+ match.splice( 1, 1 );
if ( left.substr( left.length - 1 ) !== "\\" ) {
match[1] = (match[1] || "").replace(/\\/g, "");
set = Expr.find[ type ]( match, context, isXML );
+
if ( set != null ) {
expr = expr.replace( Expr.match[ type ], "" );
break;
@@ -2813,20 +3220,26 @@
}
if ( !set ) {
- set = context.getElementsByTagName("*");
+ set = context.getElementsByTagName( "*" );
}
- return {set: set, expr: expr};
+ return { set: set, expr: expr };
};
-Sizzle.filter = function(expr, set, inplace, not){
- var old = expr, result = [], curLoop = set, match, anyFound,
- isXMLFilter = set && set[0] && isXML(set[0]);
+Sizzle.filter = function( expr, set, inplace, not ) {
+ var match, anyFound,
+ old = expr,
+ result = [],
+ curLoop = set,
+ isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );
while ( expr && set.length ) {
for ( var type in Expr.filter ) {
if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
- var filter = Expr.filter[ type ], found, item, left = match[1];
+ var found, item,
+ filter = Expr.filter[ type ],
+ left = match[1];
+
anyFound = false;
match.splice(1,1);
@@ -2844,6 +3257,7 @@
if ( !match ) {
anyFound = found = true;
+
} else if ( match === true ) {
continue;
}
@@ -2858,9 +3272,11 @@
if ( inplace && found != null ) {
if ( pass ) {
anyFound = true;
+
} else {
curLoop[i] = false;
}
+
} else if ( pass ) {
result.push( item );
anyFound = true;
@@ -2889,6 +3305,7 @@
if ( expr === old ) {
if ( anyFound == null ) {
Sizzle.error( expr );
+
} else {
break;
}
@@ -2906,30 +3323,35 @@
var Expr = Sizzle.selectors = {
order: [ "ID", "NAME", "TAG" ],
+
match: {
- ID: /#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,
- CLASS: /\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,
- NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,
- ATTR: /\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
- TAG: /^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,
- CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,
- POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,
- PSEUDO: /:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
+ ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
+ CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
+ NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
+ ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
+ TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
+ CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,
+ POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
+ PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
},
+
leftMatch: {},
+
attrMap: {
"class": "className",
"for": "htmlFor"
},
+
attrHandle: {
- href: function(elem){
- return elem.getAttribute("href");
+ href: function( elem ) {
+ return elem.getAttribute( "href" );
}
},
+
relative: {
"+": function(checkSet, part){
var isPartStr = typeof part === "string",
- isTag = isPartStr && !/\W/.test(part),
+ isTag = isPartStr && !/\W/.test( part ),
isPartStrNotTag = isPartStr && !isTag;
if ( isTag ) {
@@ -2950,22 +3372,29 @@
Sizzle.filter( part, checkSet, true );
}
},
- ">": function(checkSet, part){
- var isPartStr = typeof part === "string";
- if ( isPartStr && !/\W/.test(part) ) {
+ ">": function( checkSet, part ) {
+ var elem,
+ isPartStr = typeof part === "string",
+ i = 0,
+ l = checkSet.length;
+
+ if ( isPartStr && !/\W/.test( part ) ) {
part = part.toLowerCase();
- for ( var i = 0, l = checkSet.length; i < l; i++ ) {
- var elem = checkSet[i];
+ for ( ; i < l; i++ ) {
+ elem = checkSet[i];
+
if ( elem ) {
var parent = elem.parentNode;
checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
}
}
+
} else {
- for ( var i = 0, l = checkSet.length; i < l; i++ ) {
- var elem = checkSet[i];
+ for ( ; i < l; i++ ) {
+ elem = checkSet[i];
+
if ( elem ) {
checkSet[i] = isPartStr ?
elem.parentNode :
@@ -2978,37 +3407,50 @@
}
}
},
+
"": function(checkSet, part, isXML){
- var doneName = done++, checkFn = dirCheck;
+ var nodeCheck,
+ doneName = done++,
+ checkFn = dirCheck;
if ( typeof part === "string" && !/\W/.test(part) ) {
- var nodeCheck = part = part.toLowerCase();
+ part = part.toLowerCase();
+ nodeCheck = part;
checkFn = dirNodeCheck;
}
- checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML);
+ checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );
},
- "~": function(checkSet, part, isXML){
- var doneName = done++, checkFn = dirCheck;
- if ( typeof part === "string" && !/\W/.test(part) ) {
- var nodeCheck = part = part.toLowerCase();
+ "~": function( checkSet, part, isXML ) {
+ var nodeCheck,
+ doneName = done++,
+ checkFn = dirCheck;
+
+ if ( typeof part === "string" && !/\W/.test( part ) ) {
+ part = part.toLowerCase();
+ nodeCheck = part;
checkFn = dirNodeCheck;
}
- checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML);
+ checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );
}
},
+
find: {
- ID: function(match, context, isXML){
+ ID: function( match, context, isXML ) {
if ( typeof context.getElementById !== "undefined" && !isXML ) {
var m = context.getElementById(match[1]);
- return m ? [m] : [];
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ return m && m.parentNode ? [m] : [];
}
},
- NAME: function(match, context){
+
+ NAME: function( match, context ) {
if ( typeof context.getElementsByName !== "undefined" ) {
- var ret = [], results = context.getElementsByName(match[1]);
+ var ret = [],
+ results = context.getElementsByName( match[1] );
for ( var i = 0, l = results.length; i < l; i++ ) {
if ( results[i].getAttribute("name") === match[1] ) {
@@ -3019,12 +3461,13 @@
return ret.length === 0 ? null : ret;
}
},
- TAG: function(match, context){
- return context.getElementsByTagName(match[1]);
+
+ TAG: function( match, context ) {
+ return context.getElementsByTagName( match[1] );
}
},
preFilter: {
- CLASS: function(match, curLoop, inplace, result, not, isXML){
+ CLASS: function( match, curLoop, inplace, result, not, isXML ) {
match = " " + match[1].replace(/\\/g, "") + " ";
if ( isXML ) {
@@ -3037,6 +3480,7 @@
if ( !inplace ) {
result.push( elem );
}
+
} else if ( inplace ) {
curLoop[i] = false;
}
@@ -3045,13 +3489,16 @@
return false;
},
- ID: function(match){
+
+ ID: function( match ) {
return match[1].replace(/\\/g, "");
},
- TAG: function(match, curLoop){
+
+ TAG: function( match, curLoop ) {
return match[1].toLowerCase();
},
- CHILD: function(match){
+
+ CHILD: function( match ) {
if ( match[1] === "nth" ) {
// parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
@@ -3068,7 +3515,8 @@
return match;
},
- ATTR: function(match, curLoop, inplace, result, not, isXML){
+
+ ATTR: function( match, curLoop, inplace, result, not, isXML ) {
var name = match[1].replace(/\\/g, "");
if ( !isXML && Expr.attrMap[name] ) {
@@ -3081,160 +3529,204 @@
return match;
},
- PSEUDO: function(match, curLoop, inplace, result, not){
+
+ PSEUDO: function( match, curLoop, inplace, result, not ) {
if ( match[1] === "not" ) {
// If we're dealing with a complex expression, or a simple one
if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
match[3] = Sizzle(match[3], null, null, curLoop);
+
} else {
var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
+
if ( !inplace ) {
result.push.apply( result, ret );
}
+
return false;
}
+
} else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
return true;
}
return match;
},
- POS: function(match){
+
+ POS: function( match ) {
match.unshift( true );
+
return match;
}
},
+
filters: {
- enabled: function(elem){
+ enabled: function( elem ) {
return elem.disabled === false && elem.type !== "hidden";
},
- disabled: function(elem){
+
+ disabled: function( elem ) {
return elem.disabled === true;
},
- checked: function(elem){
+
+ checked: function( elem ) {
return elem.checked === true;
},
- selected: function(elem){
+
+ selected: function( elem ) {
// Accessing this property makes selected-by-default
// options in Safari work properly
elem.parentNode.selectedIndex;
+
return elem.selected === true;
},
- parent: function(elem){
+
+ parent: function( elem ) {
return !!elem.firstChild;
},
- empty: function(elem){
+
+ empty: function( elem ) {
return !elem.firstChild;
},
- has: function(elem, i, match){
+
+ has: function( elem, i, match ) {
return !!Sizzle( match[3], elem ).length;
},
- header: function(elem){
- return /h\d/i.test( elem.nodeName );
+
+ header: function( elem ) {
+ return (/h\d/i).test( elem.nodeName );
},
- text: function(elem){
+
+ text: function( elem ) {
return "text" === elem.type;
},
- radio: function(elem){
+ radio: function( elem ) {
return "radio" === elem.type;
},
- checkbox: function(elem){
+
+ checkbox: function( elem ) {
return "checkbox" === elem.type;
},
- file: function(elem){
+
+ file: function( elem ) {
return "file" === elem.type;
},
- password: function(elem){
+ password: function( elem ) {
return "password" === elem.type;
},
- submit: function(elem){
+
+ submit: function( elem ) {
return "submit" === elem.type;
},
- image: function(elem){
+
+ image: function( elem ) {
return "image" === elem.type;
},
- reset: function(elem){
+
+ reset: function( elem ) {
return "reset" === elem.type;
},
- button: function(elem){
+
+ button: function( elem ) {
return "button" === elem.type || elem.nodeName.toLowerCase() === "button";
},
- input: function(elem){
- return /input|select|textarea|button/i.test(elem.nodeName);
+
+ input: function( elem ) {
+ return (/input|select|textarea|button/i).test( elem.nodeName );
}
},
setFilters: {
- first: function(elem, i){
+ first: function( elem, i ) {
return i === 0;
},
- last: function(elem, i, match, array){
+
+ last: function( elem, i, match, array ) {
return i === array.length - 1;
},
- even: function(elem, i){
+
+ even: function( elem, i ) {
return i % 2 === 0;
},
- odd: function(elem, i){
+
+ odd: function( elem, i ) {
return i % 2 === 1;
},
- lt: function(elem, i, match){
+
+ lt: function( elem, i, match ) {
return i < match[3] - 0;
},
- gt: function(elem, i, match){
+
+ gt: function( elem, i, match ) {
return i > match[3] - 0;
},
- nth: function(elem, i, match){
+
+ nth: function( elem, i, match ) {
return match[3] - 0 === i;
},
- eq: function(elem, i, match){
+
+ eq: function( elem, i, match ) {
return match[3] - 0 === i;
}
},
filter: {
- PSEUDO: function(elem, match, i, array){
- var name = match[1], filter = Expr.filters[ name ];
+ PSEUDO: function( elem, match, i, array ) {
+ var name = match[1],
+ filter = Expr.filters[ name ];
if ( filter ) {
return filter( elem, i, match, array );
+
} else if ( name === "contains" ) {
- return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0;
+ return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0;
+
} else if ( name === "not" ) {
var not = match[3];
- for ( var i = 0, l = not.length; i < l; i++ ) {
- if ( not[i] === elem ) {
+ for ( var j = 0, l = not.length; j < l; j++ ) {
+ if ( not[j] === elem ) {
return false;
}
}
return true;
+
} else {
Sizzle.error( "Syntax error, unrecognized expression: " + name );
}
},
- CHILD: function(elem, match){
- var type = match[1], node = elem;
- switch (type) {
- case 'only':
- case 'first':
+
+ CHILD: function( elem, match ) {
+ var type = match[1],
+ node = elem;
+
+ switch ( type ) {
+ case "only":
+ case "first":
while ( (node = node.previousSibling) ) {
if ( node.nodeType === 1 ) {
return false;
}
}
+
if ( type === "first" ) {
return true;
}
+
node = elem;
- case 'last':
+
+ case "last":
while ( (node = node.nextSibling) ) {
if ( node.nodeType === 1 ) {
return false;
}
}
+
return true;
- case 'nth':
- var first = match[2], last = match[3];
+ case "nth":
+ var first = match[2],
+ last = match[3];
+
if ( first === 1 && last === 0 ) {
return true;
}
@@ -3244,33 +3736,41 @@
if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
var count = 0;
+
for ( node = parent.firstChild; node; node = node.nextSibling ) {
if ( node.nodeType === 1 ) {
node.nodeIndex = ++count;
}
}
+
parent.sizcache = doneName;
}
var diff = elem.nodeIndex - last;
+
if ( first === 0 ) {
return diff === 0;
+
} else {
return ( diff % first === 0 && diff / first >= 0 );
}
}
},
- ID: function(elem, match){
+
+ ID: function( elem, match ) {
return elem.nodeType === 1 && elem.getAttribute("id") === match;
},
- TAG: function(elem, match){
+
+ TAG: function( elem, match ) {
return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;
},
- CLASS: function(elem, match){
+
+ CLASS: function( elem, match ) {
return (" " + (elem.className || elem.getAttribute("class")) + " ")
.indexOf( match ) > -1;
},
- ATTR: function(elem, match){
+
+ ATTR: function( elem, match ) {
var name = match[1],
result = Expr.attrHandle[ name ] ?
Expr.attrHandle[ name ]( elem ) :
@@ -3301,9 +3801,11 @@
value === check || value.substr(0, check.length + 1) === check + "-" :
false;
},
- POS: function(elem, match, i, array){
- var name = match[2], filter = Expr.setFilters[ name ];
+ POS: function( elem, match, i, array ) {
+ var name = match[2],
+ filter = Expr.setFilters[ name ];
+
if ( filter ) {
return filter( elem, i, match, array );
}
@@ -3311,16 +3813,17 @@
}
};
-var origPOS = Expr.match.POS;
+var origPOS = Expr.match.POS,
+ fescape = function(all, num){
+ return "\\" + (num - 0 + 1);
+ };
for ( var type in Expr.match ) {
- Expr.match[ type ] = new RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source );
- Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, function(all, num){
- return "\\" + (num - 0 + 1);
- }));
+ Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
+ Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
}
-var makeArray = function(array, results) {
+var makeArray = function( array, results ) {
array = Array.prototype.slice.call( array, 0 );
if ( results ) {
@@ -3339,19 +3842,22 @@
Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
// Provide a fallback method if it does not work
-} catch(e){
- makeArray = function(array, results) {
- var ret = results || [];
+} catch( e ) {
+ makeArray = function( array, results ) {
+ var i = 0,
+ ret = results || [];
if ( toString.call(array) === "[object Array]" ) {
Array.prototype.push.apply( ret, array );
+
} else {
if ( typeof array.length === "number" ) {
- for ( var i = 0, l = array.length; i < l; i++ ) {
+ for ( var l = array.length; i < l; i++ ) {
ret.push( array[i] );
}
+
} else {
- for ( var i = 0; array[i]; i++ ) {
+ for ( ; array[i]; i++ ) {
ret.push( array[i] );
}
}
@@ -3361,62 +3867,99 @@
};
}
-var sortOrder;
+var sortOrder, siblingCheck;
if ( document.documentElement.compareDocumentPosition ) {
sortOrder = function( a, b ) {
+ if ( a === b ) {
+ hasDuplicate = true;
+ return 0;
+ }
+
if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
- if ( a == b ) {
- hasDuplicate = true;
- }
return a.compareDocumentPosition ? -1 : 1;
}
- var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1;
- if ( ret === 0 ) {
+ return a.compareDocumentPosition(b) & 4 ? -1 : 1;
+ };
+
+} else {
+ sortOrder = function( a, b ) {
+ var al, bl,
+ ap = [],
+ bp = [],
+ aup = a.parentNode,
+ bup = b.parentNode,
+ cur = aup;
+
+ // The nodes are identical, we can exit early
+ if ( a === b ) {
hasDuplicate = true;
+ return 0;
+
+ // If the nodes are siblings (or identical) we can do a quick check
+ } else if ( aup === bup ) {
+ return siblingCheck( a, b );
+
+ // If no parents were found then the nodes are disconnected
+ } else if ( !aup ) {
+ return -1;
+
+ } else if ( !bup ) {
+ return 1;
}
- return ret;
- };
-} else if ( "sourceIndex" in document.documentElement ) {
- sortOrder = function( a, b ) {
- if ( !a.sourceIndex || !b.sourceIndex ) {
- if ( a == b ) {
- hasDuplicate = true;
+
+ // Otherwise they're somewhere else in the tree so we need
+ // to build up a full list of the parentNodes for comparison
+ while ( cur ) {
+ ap.unshift( cur );
+ cur = cur.parentNode;
+ }
+
+ cur = bup;
+
+ while ( cur ) {
+ bp.unshift( cur );
+ cur = cur.parentNode;
+ }
+
+ al = ap.length;
+ bl = bp.length;
+
+ // Start walking down the tree looking for a discrepancy
+ for ( var i = 0; i < al && i < bl; i++ ) {
+ if ( ap[i] !== bp[i] ) {
+ return siblingCheck( ap[i], bp[i] );
}
- return a.sourceIndex ? -1 : 1;
}
- var ret = a.sourceIndex - b.sourceIndex;
- if ( ret === 0 ) {
- hasDuplicate = true;
+ // We ended someplace up the tree so do a sibling check
+ return i === al ?
+ siblingCheck( a, bp[i], -1 ) :
+ siblingCheck( ap[i], b, 1 );
+ };
+
+ siblingCheck = function( a, b, ret ) {
+ if ( a === b ) {
+ return ret;
}
- return ret;
- };
-} else if ( document.createRange ) {
- sortOrder = function( a, b ) {
- if ( !a.ownerDocument || !b.ownerDocument ) {
- if ( a == b ) {
- hasDuplicate = true;
+
+ var cur = a.nextSibling;
+
+ while ( cur ) {
+ if ( cur === b ) {
+ return -1;
}
- return a.ownerDocument ? -1 : 1;
+
+ cur = cur.nextSibling;
}
- var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange();
- aRange.setStart(a, 0);
- aRange.setEnd(a, 0);
- bRange.setStart(b, 0);
- bRange.setEnd(b, 0);
- var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange);
- if ( ret === 0 ) {
- hasDuplicate = true;
- }
- return ret;
+ return 1;
};
}
// Utility function for retreiving the text value of an array of DOM nodes
-function getText( elems ) {
+Sizzle.getText = function( elems ) {
var ret = "", elem;
for ( var i = 0; elems[i]; i++ ) {
@@ -3428,43 +3971,52 @@
// Traverse everything else, except comment nodes
} else if ( elem.nodeType !== 8 ) {
- ret += getText( elem.childNodes );
+ ret += Sizzle.getText( elem.childNodes );
}
}
return ret;
-}
+};
// Check to see if the browser returns elements by name when
// querying by getElementById (and provide a workaround)
(function(){
// We're going to inject a fake input element with a specified name
var form = document.createElement("div"),
- id = "script" + (new Date).getTime();
+ id = "script" + (new Date()).getTime(),
+ root = document.documentElement;
+
form.innerHTML = "<a name='" + id + "'/>";
// Inject it into the root element, check its status, and remove it quickly
- var root = document.documentElement;
root.insertBefore( form, root.firstChild );
// The workaround has to do additional checks after a getElementById
// Which slows things down for other browsers (hence the branching)
if ( document.getElementById( id ) ) {
- Expr.find.ID = function(match, context, isXML){
+ Expr.find.ID = function( match, context, isXML ) {
if ( typeof context.getElementById !== "undefined" && !isXML ) {
var m = context.getElementById(match[1]);
- return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : [];
+
+ return m ?
+ m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?
+ [m] :
+ undefined :
+ [];
}
};
- Expr.filter.ID = function(elem, match){
+ Expr.filter.ID = function( elem, match ) {
var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
+
return elem.nodeType === 1 && node && node.nodeValue === match;
};
}
root.removeChild( form );
- root = form = null; // release memory in IE
+
+ // release memory in IE
+ root = form = null;
})();
(function(){
@@ -3477,8 +4029,8 @@
// Make sure no comments are found
if ( div.getElementsByTagName("*").length > 0 ) {
- Expr.find.TAG = function(match, context){
- var results = context.getElementsByTagName(match[1]);
+ Expr.find.TAG = function( match, context ) {
+ var results = context.getElementsByTagName( match[1] );
// Filter out possible comments
if ( match[1] === "*" ) {
@@ -3499,19 +4051,25 @@
// Check to see if an attribute returns normalized href attributes
div.innerHTML = "<a href='#'></a>";
+
if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
div.firstChild.getAttribute("href") !== "#" ) {
- Expr.attrHandle.href = function(elem){
- return elem.getAttribute("href", 2);
+
+ Expr.attrHandle.href = function( elem ) {
+ return elem.getAttribute( "href", 2 );
};
}
- div = null; // release memory in IE
+ // release memory in IE
+ div = null;
})();
if ( document.querySelectorAll ) {
(function(){
- var oldSizzle = Sizzle, div = document.createElement("div");
+ var oldSizzle = Sizzle,
+ div = document.createElement("div"),
+ id = "__sizzle__";
+
div.innerHTML = "<p class='TEST'></p>";
// Safari can't handle uppercase or unicode characters when
@@ -3520,15 +4078,42 @@
return;
}
- Sizzle = function(query, context, extra, seed){
+ Sizzle = function( query, context, extra, seed ) {
context = context || document;
+ // Make sure that attribute selectors are quoted
+ query = query.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
+
// Only use querySelectorAll on non-XML documents
// (ID selectors don't work in non-HTML documents)
- if ( !seed && context.nodeType === 9 && !isXML(context) ) {
- try {
- return makeArray( context.querySelectorAll(query), extra );
- } catch(e){}
+ if ( !seed && !Sizzle.isXML(context) ) {
+ if ( context.nodeType === 9 ) {
+ try {
+ return makeArray( context.querySelectorAll(query), extra );
+ } catch(qsaError) {}
+
+ // qSA works strangely on Element-rooted queries
+ // We can work around this by specifying an extra ID on the root
+ // and working up from there (Thanks to Andrew Dupont for the technique)
+ // IE 8 doesn't work on object elements
+ } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
+ var old = context.getAttribute( "id" ),
+ nid = old || id;
+
+ if ( !old ) {
+ context.setAttribute( "id", nid );
+ }
+
+ try {
+ return makeArray( context.querySelectorAll( "#" + nid + " " + query ), extra );
+
+ } catch(pseudoError) {
+ } finally {
+ if ( !old ) {
+ context.removeAttribute( "id" );
+ }
+ }
+ }
}
return oldSizzle(query, context, extra, seed);
@@ -3538,11 +4123,44 @@
Sizzle[ prop ] = oldSizzle[ prop ];
}
- div = null; // release memory in IE
+ // release memory in IE
+ div = null;
})();
}
(function(){
+ var html = document.documentElement,
+ matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector,
+ pseudoWorks = false;
+
+ try {
+ // This should fail with an exception
+ // Gecko does not error, returns false instead
+ matches.call( document.documentElement, "[test!='']:sizzle" );
+
+ } catch( pseudoError ) {
+ pseudoWorks = true;
+ }
+
+ if ( matches ) {
+ Sizzle.matchesSelector = function( node, expr ) {
+ // Make sure that attribute selectors are quoted
+ expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
+
+ if ( !Sizzle.isXML( node ) ) {
+ try {
+ if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
+ return matches.call( node, expr );
+ }
+ } catch(e) {}
+ }
+
+ return Sizzle(expr, null, null, [node]).length > 0;
+ };
+ }
+})();
+
+(function(){
var div = document.createElement("div");
div.innerHTML = "<div class='test e'></div><div class='test'></div>";
@@ -3561,22 +4179,25 @@
}
Expr.order.splice(1, 0, "CLASS");
- Expr.find.CLASS = function(match, context, isXML) {
+ Expr.find.CLASS = function( match, context, isXML ) {
if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
return context.getElementsByClassName(match[1]);
}
};
- div = null; // release memory in IE
+ // release memory in IE
+ div = null;
})();
function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
var elem = checkSet[i];
+
if ( elem ) {
- elem = elem[dir];
var match = false;
+ elem = elem[dir];
+
while ( elem ) {
if ( elem.sizcache === doneName ) {
match = checkSet[elem.sizset];
@@ -3604,9 +4225,11 @@
function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
var elem = checkSet[i];
+
if ( elem ) {
+ var match = false;
+
elem = elem[dir];
- var match = false;
while ( elem ) {
if ( elem.sizcache === doneName ) {
@@ -3619,6 +4242,7 @@
elem.sizcache = doneName;
elem.sizset = i;
}
+
if ( typeof cur !== "string" ) {
if ( elem === cur ) {
match = true;
@@ -3639,21 +4263,34 @@
}
}
-var contains = document.compareDocumentPosition ? function(a, b){
- return !!(a.compareDocumentPosition(b) & 16);
-} : function(a, b){
- return a !== b && (a.contains ? a.contains(b) : true);
-};
+if ( document.documentElement.contains ) {
+ Sizzle.contains = function( a, b ) {
+ return a !== b && (a.contains ? a.contains(b) : true);
+ };
-var isXML = function(elem){
+} else if ( document.documentElement.compareDocumentPosition ) {
+ Sizzle.contains = function( a, b ) {
+ return !!(a.compareDocumentPosition(b) & 16);
+ };
+
+} else {
+ Sizzle.contains = function() {
+ return false;
+ };
+}
+
+Sizzle.isXML = function( elem ) {
// documentElement is verified for cases where it doesn't yet exist
// (such as loading iframes in IE - #4833)
var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
+
return documentElement ? documentElement.nodeName !== "HTML" : false;
};
-var posProcess = function(selector, context){
- var tmpSet = [], later = "", match,
+var posProcess = function( selector, context ) {
+ var match,
+ tmpSet = [],
+ later = "",
root = context.nodeType ? [context] : context;
// Position selectors must be done after the filter
@@ -3677,53 +4314,26 @@
jQuery.expr = Sizzle.selectors;
jQuery.expr[":"] = jQuery.expr.filters;
jQuery.unique = Sizzle.uniqueSort;
-jQuery.text = getText;
-jQuery.isXMLDoc = isXML;
-jQuery.contains = contains;
+jQuery.text = Sizzle.getText;
+jQuery.isXMLDoc = Sizzle.isXML;
+jQuery.contains = Sizzle.contains;
-return;
-window.Sizzle = Sizzle;
+})();
-})();
+
var runtil = /Until$/,
rparentsprev = /^(?:parents|prevUntil|prevAll)/,
// Note: This RegExp should be improved, or likely pulled from Sizzle
rmultiselector = /,/,
- slice = Array.prototype.slice;
+ isSimple = /^.[^:#\[\.,]*$/,
+ slice = Array.prototype.slice,
+ POS = jQuery.expr.match.POS;
-// Implement the identical functionality for filter and not
-var winnow = function( elements, qualifier, keep ) {
- if ( jQuery.isFunction( qualifier ) ) {
- return jQuery.grep(elements, function( elem, i ) {
- return !!qualifier.call( elem, i, elem ) === keep;
- });
-
- } else if ( qualifier.nodeType ) {
- return jQuery.grep(elements, function( elem, i ) {
- return (elem === qualifier) === keep;
- });
-
- } else if ( typeof qualifier === "string" ) {
- var filtered = jQuery.grep(elements, function( elem ) {
- return elem.nodeType === 1;
- });
-
- if ( isSimple.test( qualifier ) ) {
- return jQuery.filter(qualifier, filtered, !keep);
- } else {
- qualifier = jQuery.filter( qualifier, filtered );
- }
- }
-
- return jQuery.grep(elements, function( elem, i ) {
- return (jQuery.inArray( elem, qualifier ) >= 0) === keep;
- });
-};
-
jQuery.fn.extend({
find: function( selector ) {
- var ret = this.pushStack( "", "find", selector ), length = 0;
+ var ret = this.pushStack( "", "find", selector ),
+ length = 0;
for ( var i = 0, l = this.length; i < l; i++ ) {
length = ret.length;
@@ -3769,11 +4379,15 @@
},
closest: function( selectors, context ) {
+ var ret = [], i, l, cur = this[0];
+
if ( jQuery.isArray( selectors ) ) {
- var ret = [], cur = this[0], match, matches = {}, selector;
+ var match, selector,
+ matches = {},
+ level = 1;
if ( cur && selectors.length ) {
- for ( var i = 0, l = selectors.length; i < l; i++ ) {
+ for ( i = 0, l = selectors.length; i < l; i++ ) {
selector = selectors[i];
if ( !matches[selector] ) {
@@ -3788,29 +4402,41 @@
match = matches[selector];
if ( match.jquery ? match.index(cur) > -1 : jQuery(cur).is(match) ) {
- ret.push({ selector: selector, elem: cur });
- delete matches[selector];
+ ret.push({ selector: selector, elem: cur, level: level });
}
}
+
cur = cur.parentNode;
+ level++;
}
}
return ret;
}
- var pos = jQuery.expr.match.POS.test( selectors ) ?
+ var pos = POS.test( selectors ) ?
jQuery( selectors, context || this.context ) : null;
- return this.map(function( i, cur ) {
- while ( cur && cur.ownerDocument && cur !== context ) {
- if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selectors) ) {
- return cur;
+ for ( i = 0, l = this.length; i < l; i++ ) {
+ cur = this[i];
+
+ while ( cur ) {
+ if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
+ ret.push( cur );
+ break;
+
+ } else {
+ cur = cur.parentNode;
+ if ( !cur || !cur.ownerDocument || cur === context ) {
+ break;
+ }
}
- cur = cur.parentNode;
}
- return null;
- });
+ }
+
+ ret = ret.length > 1 ? jQuery.unique(ret) : ret;
+
+ return this.pushStack( ret, "closest", selectors );
},
// Determine the position of an element within
@@ -3918,11 +4544,15 @@
expr = ":not(" + expr + ")";
}
- return jQuery.find.matches(expr, elems);
+ return elems.length === 1 ?
+ jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
+ jQuery.find.matches(expr, elems);
},
dir: function( elem, dir, until ) {
- var matched = [], cur = elem[dir];
+ var matched = [],
+ cur = elem[ dir ];
+
while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
if ( cur.nodeType === 1 ) {
matched.push( cur );
@@ -3957,20 +4587,50 @@
return r;
}
});
+
+// Implement the identical functionality for filter and not
+function winnow( elements, qualifier, keep ) {
+ if ( jQuery.isFunction( qualifier ) ) {
+ return jQuery.grep(elements, function( elem, i ) {
+ var retVal = !!qualifier.call( elem, i, elem );
+ return retVal === keep;
+ });
+
+ } else if ( qualifier.nodeType ) {
+ return jQuery.grep(elements, function( elem, i ) {
+ return (elem === qualifier) === keep;
+ });
+
+ } else if ( typeof qualifier === "string" ) {
+ var filtered = jQuery.grep(elements, function( elem ) {
+ return elem.nodeType === 1;
+ });
+
+ if ( isSimple.test( qualifier ) ) {
+ return jQuery.filter(qualifier, filtered, !keep);
+ } else {
+ qualifier = jQuery.filter( qualifier, filtered );
+ }
+ }
+
+ return jQuery.grep(elements, function( elem, i ) {
+ return (jQuery.inArray( elem, qualifier ) >= 0) === keep;
+ });
+}
+
+
+
+
var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
rleadingWhitespace = /^\s+/,
- rxhtmlTag = /(<([\w:]+)[^>]*?)\/>/g,
- rselfClosing = /^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,
+ rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
rtagName = /<([\w:]+)/,
rtbody = /<tbody/i,
rhtml = /<|&#?\w+;/,
- rnocache = /<script|<object|<embed|<option|<style/i,
- rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, // checked="checked" or checked (html5)
- fcloseTag = function( all, front, tag ) {
- return rselfClosing.test( tag ) ?
- all :
- front + "></" + tag + ">";
- },
+ rnocache = /<(?:script|object|embed|option|style)/i,
+ // checked="checked" or checked (html5)
+ rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
+ raction = /\=([^="'>\s]+\/)>/g,
wrapMap = {
option: [ 1, "<select multiple='multiple'>", "</select>" ],
legend: [ 1, "<fieldset>", "</fieldset>" ],
@@ -3995,7 +4655,8 @@
text: function( text ) {
if ( jQuery.isFunction(text) ) {
return this.each(function(i) {
- var self = jQuery(this);
+ var self = jQuery( this );
+
self.text( text.call(this, i, self.text()) );
});
}
@@ -4044,7 +4705,8 @@
}
return this.each(function() {
- var self = jQuery( this ), contents = self.contents();
+ var self = jQuery( this ),
+ contents = self.contents();
if ( contents.length ) {
contents.wrapAll( html );
@@ -4155,7 +4817,9 @@
// attributes in IE that are actually only stored
// as properties will not be copied (such as the
// the name attribute on an input).
- var html = this.outerHTML, ownerDocument = this.ownerDocument;
+ var html = this.outerHTML,
+ ownerDocument = this.ownerDocument;
+
if ( !html ) {
var div = ownerDocument.createElement("div");
div.appendChild( this.cloneNode(true) );
@@ -4164,7 +4828,7 @@
return jQuery.clean([html.replace(rinlinejQuery, "")
// Handle the case in IE 8 where action=/test/> self-closes a tag
- .replace(/=([^="'>\s]+\/)>/g, '="$1">')
+ .replace(raction, '="$1">')
.replace(rleadingWhitespace, "")], ownerDocument)[0];
} else {
return this.cloneNode(true);
@@ -4192,7 +4856,7 @@
(jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
!wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
- value = value.replace(rxhtmlTag, fcloseTag);
+ value = value.replace(rxhtmlTag, "<$1></$2>");
try {
for ( var i = 0, l = this.length; i < l; i++ ) {
@@ -4210,10 +4874,9 @@
} else if ( jQuery.isFunction( value ) ) {
this.each(function(i){
- var self = jQuery(this), old = self.html();
- self.empty().append(function(){
- return value.call( this, i, old );
- });
+ var self = jQuery( this );
+
+ self.html( value.call(this, i, self.html()) );
});
} else {
@@ -4235,13 +4898,14 @@
}
if ( typeof value !== "string" ) {
- value = jQuery(value).detach();
+ value = jQuery( value ).detach();
}
return this.each(function() {
- var next = this.nextSibling, parent = this.parentNode;
+ var next = this.nextSibling,
+ parent = this.parentNode;
- jQuery(this).remove();
+ jQuery( this ).remove();
if ( next ) {
jQuery(next).before( value );
@@ -4259,7 +4923,9 @@
},
domManip: function( args, table, callback ) {
- var results, first, value = args[0], scripts = [], fragment, parent;
+ var results, first, fragment, parent,
+ value = args[0],
+ scripts = [];
// We can't cloneNode fragments that contain checked, in WebKit
if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
@@ -4284,7 +4950,7 @@
results = { fragment: parent };
} else {
- results = buildFragment( args, this, scripts );
+ results = jQuery.buildFragment( args, this, scripts );
}
fragment = results.fragment;
@@ -4316,16 +4982,16 @@
}
return this;
-
- function root( elem, cur ) {
- return jQuery.nodeName(elem, "table") ?
- (elem.getElementsByTagName("tbody")[0] ||
- elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
- elem;
- }
}
});
+function root( elem, cur ) {
+ return jQuery.nodeName(elem, "table") ?
+ (elem.getElementsByTagName("tbody")[0] ||
+ elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
+ elem;
+}
+
function cloneCopyEvent(orig, ret) {
var i = 0;
@@ -4334,7 +5000,9 @@
return;
}
- var oldData = jQuery.data( orig[i++] ), curData = jQuery.data( this, oldData ), events = oldData && oldData.events;
+ var oldData = jQuery.data( orig[i++] ),
+ curData = jQuery.data( this, oldData ),
+ events = oldData && oldData.events;
if ( events ) {
delete curData.handle;
@@ -4349,7 +5017,7 @@
});
}
-function buildFragment( args, nodes, scripts ) {
+jQuery.buildFragment = function( args, nodes, scripts ) {
var fragment, cacheable, cacheresults,
doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document);
@@ -4379,7 +5047,7 @@
}
return { fragment: fragment, cacheable: cacheable };
-}
+};
jQuery.fragments = {};
@@ -4391,7 +5059,8 @@
replaceAll: "replaceWith"
}, function( name, original ) {
jQuery.fn[ name ] = function( selector ) {
- var ret = [], insert = jQuery( selector ),
+ var ret = [],
+ insert = jQuery( selector ),
parent = this.length === 1 && this[0].parentNode;
if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
@@ -4401,7 +5070,7 @@
} else {
for ( var i = 0, l = insert.length; i < l; i++ ) {
var elems = (i > 0 ? this.clone(true) : this).get();
- jQuery.fn[ original ].apply( jQuery(insert[i]), elems );
+ jQuery( insert[i] )[ original ]( elems );
ret = ret.concat( elems );
}
@@ -4436,7 +5105,7 @@
} else if ( typeof elem === "string" ) {
// Fix "XHTML"-style tags in all browsers
- elem = elem.replace(rxhtmlTag, fcloseTag);
+ elem = elem.replace(rxhtmlTag, "<$1></$2>");
// Trim whitespace, otherwise indexOf won't work as expected
var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(),
@@ -4489,7 +5158,7 @@
}
if ( fragment ) {
- for ( var i = 0; ret[i]; i++ ) {
+ for ( i = 0; ret[i]; i++ ) {
if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
@@ -4511,18 +5180,22 @@
deleteExpando = jQuery.support.deleteExpando;
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
+ if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
+ continue;
+ }
+
id = elem[ jQuery.expando ];
if ( id ) {
data = cache[ id ];
- if ( data.events ) {
+ if ( data && data.events ) {
for ( var type in data.events ) {
if ( special[ type ] ) {
jQuery.event.remove( elem, type );
} else {
- removeEvent( elem, type, data.handle );
+ jQuery.removeEvent( elem, type, data.handle );
}
}
}
@@ -4539,252 +5212,379 @@
}
}
});
-// exclude the following css properties to add px
-var rexclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
- ralpha = /alpha\([^)]*\)/,
+
+function evalScript( i, elem ) {
+ if ( elem.src ) {
+ jQuery.ajax({
+ url: elem.src,
+ async: false,
+ dataType: "script"
+ });
+ } else {
+ jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
+ }
+
+ if ( elem.parentNode ) {
+ elem.parentNode.removeChild( elem );
+ }
+}
+
+
+
+
+var ralpha = /alpha\([^)]*\)/i,
ropacity = /opacity=([^)]*)/,
- rfloat = /float/i,
rdashAlpha = /-([a-z])/ig,
rupper = /([A-Z])/g,
rnumpx = /^-?\d+(?:px)?$/i,
rnum = /^-?\d/,
- cssShow = { position: "absolute", visibility: "hidden", display:"block" },
+ cssShow = { position: "absolute", visibility: "hidden", display: "block" },
cssWidth = [ "Left", "Right" ],
cssHeight = [ "Top", "Bottom" ],
+ curCSS,
- // cache check for defaultView.getComputedStyle
- getComputedStyle = document.defaultView && document.defaultView.getComputedStyle,
- // normalize float css property
- styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat",
+ getComputedStyle,
+ currentStyle,
+
fcamelCase = function( all, letter ) {
return letter.toUpperCase();
};
jQuery.fn.css = function( name, value ) {
- return access( this, name, value, true, function( elem, name, value ) {
- if ( value === undefined ) {
- return jQuery.curCSS( elem, name );
- }
-
- if ( typeof value === "number" && !rexclude.test(name) ) {
- value += "px";
- }
+ // Setting 'undefined' is a no-op
+ if ( arguments.length === 2 && value === undefined ) {
+ return this;
+ }
- jQuery.style( elem, name, value );
+ return jQuery.access( this, name, value, true, function( elem, name, value ) {
+ return value !== undefined ?
+ jQuery.style( elem, name, value ) :
+ jQuery.css( elem, name );
});
};
jQuery.extend({
- style: function( elem, name, value ) {
- // don't set styles on text and comment nodes
- if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
- return undefined;
+ // Add in style property hooks for overriding the default
+ // behavior of getting and setting a style property
+ cssHooks: {
+ opacity: {
+ get: function( elem, computed ) {
+ if ( computed ) {
+ // We should always get a number back from opacity
+ var ret = curCSS( elem, "opacity", "opacity" );
+ return ret === "" ? "1" : ret;
+
+ } else {
+ return elem.style.opacity;
+ }
+ }
}
+ },
- // ignore negative width and height values #1599
- if ( (name === "width" || name === "height") && parseFloat(value) < 0 ) {
- value = undefined;
+ // Exclude the following css properties to add px
+ cssNumber: {
+ "zIndex": true,
+ "fontWeight": true,
+ "opacity": true,
+ "zoom": true,
+ "lineHeight": true
+ },
+
+ // Add in properties whose names you wish to fix before
+ // setting or getting the value
+ cssProps: {
+ // normalize float css property
+ "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
+ },
+
+ // Get and set the style property on a DOM Node
+ style: function( elem, name, value, extra ) {
+ // Don't set styles on text and comment nodes
+ if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
+ return;
}
- var style = elem.style || elem, set = value !== undefined;
+ // Make sure that we're working with the right name
+ var ret, origName = jQuery.camelCase( name ),
+ style = elem.style, hooks = jQuery.cssHooks[ origName ];
- // IE uses filters for opacity
- if ( !jQuery.support.opacity && name === "opacity" ) {
- if ( set ) {
- // IE has trouble with opacity if it does not have layout
- // Force it by setting the zoom level
- style.zoom = 1;
+ name = jQuery.cssProps[ origName ] || origName;
- // Set the alpha filter to set the opacity
- var opacity = parseInt( value, 10 ) + "" === "NaN" ? "" : "alpha(opacity=" + value * 100 + ")";
- var filter = style.filter || jQuery.curCSS( elem, "filter" ) || "";
- style.filter = ralpha.test(filter) ? filter.replace(ralpha, opacity) : opacity;
+ // Check if we're setting a value
+ if ( value !== undefined ) {
+ // Make sure that NaN and null values aren't set. See: #7116
+ if ( typeof value === "number" && isNaN( value ) || value == null ) {
+ return;
}
- return style.filter && style.filter.indexOf("opacity=") >= 0 ?
- (parseFloat( ropacity.exec(style.filter)[1] ) / 100) + "":
- "";
+ // If a number was passed in, add 'px' to the (except for certain CSS properties)
+ if ( typeof value === "number" && !jQuery.cssNumber[ origName ] ) {
+ value += "px";
+ }
+
+ // If a hook was provided, use that value, otherwise just set the specified value
+ if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {
+ // Wrapped to prevent IE from throwing errors when 'invalid' values are provided
+ // Fixes bug #5509
+ try {
+ style[ name ] = value;
+ } catch(e) {}
+ }
+
+ } else {
+ // If a hook was provided get the non-computed value from there
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
+ return ret;
+ }
+
+ // Otherwise just get the value from the style object
+ return style[ name ];
}
+ },
- // Make sure we're using the right name for getting the float value
- if ( rfloat.test( name ) ) {
- name = styleFloat;
+ css: function( elem, name, extra ) {
+ // Make sure that we're working with the right name
+ var ret, origName = jQuery.camelCase( name ),
+ hooks = jQuery.cssHooks[ origName ];
+
+ name = jQuery.cssProps[ origName ] || origName;
+
+ // If a hook was provided get the computed value from there
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {
+ return ret;
+
+ // Otherwise, if a way to get the computed value exists, use that
+ } else if ( curCSS ) {
+ return curCSS( elem, name, origName );
}
+ },
- name = name.replace(rdashAlpha, fcamelCase);
+ // A method for quickly swapping in/out CSS properties to get correct calculations
+ swap: function( elem, options, callback ) {
+ var old = {};
- if ( set ) {
- style[ name ] = value;
+ // Remember the old values, and insert the new ones
+ for ( var name in options ) {
+ old[ name ] = elem.style[ name ];
+ elem.style[ name ] = options[ name ];
}
- return style[ name ];
+ callback.call( elem );
+
+ // Revert the old values
+ for ( name in options ) {
+ elem.style[ name ] = old[ name ];
+ }
},
- css: function( elem, name, force, extra ) {
- if ( name === "width" || name === "height" ) {
- var val, props = cssShow, which = name === "width" ? cssWidth : cssHeight;
+ camelCase: function( string ) {
+ return string.replace( rdashAlpha, fcamelCase );
+ }
+});
- function getWH() {
- val = name === "width" ? elem.offsetWidth : elem.offsetHeight;
+// DEPRECATED, Use jQuery.css() instead
+jQuery.curCSS = jQuery.css;
- if ( extra === "border" ) {
- return;
+jQuery.each(["height", "width"], function( i, name ) {
+ jQuery.cssHooks[ name ] = {
+ get: function( elem, computed, extra ) {
+ var val;
+
+ if ( computed ) {
+ if ( elem.offsetWidth !== 0 ) {
+ val = getWH( elem, name, extra );
+
+ } else {
+ jQuery.swap( elem, cssShow, function() {
+ val = getWH( elem, name, extra );
+ });
}
- jQuery.each( which, function() {
- if ( !extra ) {
- val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
+ if ( val <= 0 ) {
+ val = curCSS( elem, name, name );
+
+ if ( val === "0px" && currentStyle ) {
+ val = currentStyle( elem, name, name );
}
- if ( extra === "margin" ) {
- val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0;
- } else {
- val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
+ if ( val != null ) {
+ // Should return "auto" instead of 0, use 0 for
+ // temporary backwards-compat
+ return val === "" || val === "auto" ? "0px" : val;
}
- });
+ }
+
+ if ( val < 0 || val == null ) {
+ val = elem.style[ name ];
+
+ // Should return "auto" instead of 0, use 0 for
+ // temporary backwards-compat
+ return val === "" || val === "auto" ? "0px" : val;
+ }
+
+ return typeof val === "string" ? val : val + "px";
}
+ },
- if ( elem.offsetWidth !== 0 ) {
- getWH();
+ set: function( elem, value ) {
+ if ( rnumpx.test( value ) ) {
+ // ignore negative width and height values #1599
+ value = parseFloat(value);
+
+ if ( value >= 0 ) {
+ return value + "px";
+ }
+
} else {
- jQuery.swap( elem, props, getWH );
+ return value;
}
-
- return Math.max(0, Math.round(val));
}
+ };
+});
- return jQuery.curCSS( elem, name, force );
- },
+if ( !jQuery.support.opacity ) {
+ jQuery.cssHooks.opacity = {
+ get: function( elem, computed ) {
+ // IE uses filters for opacity
+ return ropacity.test((computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "") ?
+ (parseFloat(RegExp.$1) / 100) + "" :
+ computed ? "1" : "";
+ },
- curCSS: function( elem, name, force ) {
- var ret, style = elem.style, filter;
+ set: function( elem, value ) {
+ var style = elem.style;
- // IE uses filters for opacity
- if ( !jQuery.support.opacity && name === "opacity" && elem.currentStyle ) {
- ret = ropacity.test(elem.currentStyle.filter || "") ?
- (parseFloat(RegExp.$1) / 100) + "" :
- "";
+ // IE has trouble with opacity if it does not have layout
+ // Force it by setting the zoom level
+ style.zoom = 1;
- return ret === "" ?
- "1" :
- ret;
- }
+ // Set the alpha filter to set the opacity
+ var opacity = jQuery.isNaN(value) ?
+ "" :
+ "alpha(opacity=" + value * 100 + ")",
+ filter = style.filter || "";
- // Make sure we're using the right name for getting the float value
- if ( rfloat.test( name ) ) {
- name = styleFloat;
+ style.filter = ralpha.test(filter) ?
+ filter.replace(ralpha, opacity) :
+ style.filter + ' ' + opacity;
}
+ };
+}
- if ( !force && style && style[ name ] ) {
- ret = style[ name ];
+if ( document.defaultView && document.defaultView.getComputedStyle ) {
+ getComputedStyle = function( elem, newName, name ) {
+ var ret, defaultView, computedStyle;
- } else if ( getComputedStyle ) {
+ name = name.replace( rupper, "-$1" ).toLowerCase();
- // Only "float" is needed here
- if ( rfloat.test( name ) ) {
- name = "float";
+ if ( !(defaultView = elem.ownerDocument.defaultView) ) {
+ return undefined;
+ }
+
+ if ( (computedStyle = defaultView.getComputedStyle( elem, null )) ) {
+ ret = computedStyle.getPropertyValue( name );
+ if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
+ ret = jQuery.style( elem, name );
}
+ }
- name = name.replace( rupper, "-$1" ).toLowerCase();
+ return ret;
+ };
+}
- var defaultView = elem.ownerDocument.defaultView;
+if ( document.documentElement.currentStyle ) {
+ currentStyle = function( elem, name ) {
+ var left, rsLeft,
+ ret = elem.currentStyle && elem.currentStyle[ name ],
+ style = elem.style;
- if ( !defaultView ) {
- return null;
- }
+ // From the awesome hack by Dean Edwards
+ // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
- var computedStyle = defaultView.getComputedStyle( elem, null );
+ // If we're not dealing with a regular pixel number
+ // but a number that has a weird ending, we need to convert it to pixels
+ if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {
+ // Remember the original values
+ left = style.left;
+ rsLeft = elem.runtimeStyle.left;
- if ( computedStyle ) {
- ret = computedStyle.getPropertyValue( name );
- }
+ // Put in the new values to get a computed value out
+ elem.runtimeStyle.left = elem.currentStyle.left;
+ style.left = name === "fontSize" ? "1em" : (ret || 0);
+ ret = style.pixelLeft + "px";
- // We should always get a number back from opacity
- if ( name === "opacity" && ret === "" ) {
- ret = "1";
- }
+ // Revert the changed values
+ style.left = left;
+ elem.runtimeStyle.left = rsLeft;
+ }
- } else if ( elem.currentStyle ) {
- var camelCase = name.replace(rdashAlpha, fcamelCase);
+ return ret === "" ? "auto" : ret;
+ };
+}
- ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];
+curCSS = getComputedStyle || currentStyle;
- // From the awesome hack by Dean Edwards
- // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
+function getWH( elem, name, extra ) {
+ var which = name === "width" ? cssWidth : cssHeight,
+ val = name === "width" ? elem.offsetWidth : elem.offsetHeight;
- // If we're not dealing with a regular pixel number
- // but a number that has a weird ending, we need to convert it to pixels
- if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {
- // Remember the original values
- var left = style.left, rsLeft = elem.runtimeStyle.left;
+ if ( extra === "border" ) {
+ return val;
+ }
- // Put in the new values to get a computed value out
- elem.runtimeStyle.left = elem.currentStyle.left;
- style.left = camelCase === "fontSize" ? "1em" : (ret || 0);
- ret = style.pixelLeft + "px";
-
- // Revert the changed values
- style.left = left;
- elem.runtimeStyle.left = rsLeft;
- }
+ jQuery.each( which, function() {
+ if ( !extra ) {
+ val -= parseFloat(jQuery.css( elem, "padding" + this )) || 0;
}
- return ret;
- },
+ if ( extra === "margin" ) {
+ val += parseFloat(jQuery.css( elem, "margin" + this )) || 0;
- // A method for quickly swapping in/out CSS properties to get correct calculations
- swap: function( elem, options, callback ) {
- var old = {};
-
- // Remember the old values, and insert the new ones
- for ( var name in options ) {
- old[ name ] = elem.style[ name ];
- elem.style[ name ] = options[ name ];
+ } else {
+ val -= parseFloat(jQuery.css( elem, "border" + this + "Width" )) || 0;
}
+ });
- callback.call( elem );
+ return val;
+}
- // Revert the old values
- for ( var name in options ) {
- elem.style[ name ] = old[ name ];
- }
- }
-});
-
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.hidden = function( elem ) {
- var width = elem.offsetWidth, height = elem.offsetHeight,
- skip = elem.nodeName.toLowerCase() === "tr";
+ var width = elem.offsetWidth,
+ height = elem.offsetHeight;
- return width === 0 && height === 0 && !skip ?
- true :
- width > 0 && height > 0 && !skip ?
- false :
- jQuery.curCSS(elem, "display") === "none";
+ return (width === 0 && height === 0) || (!jQuery.support.reliableHiddenOffsets && (elem.style.display || jQuery.css( elem, "display" )) === "none");
};
jQuery.expr.filters.visible = function( elem ) {
return !jQuery.expr.filters.hidden( elem );
};
}
-var jsc = now(),
- rscript = /<script(.|\s)*?\/script>/gi,
- rselectTextarea = /select|textarea/i,
- rinput = /color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,
- jsre = /=\?(&|$)/,
+
+
+
+
+var jsc = jQuery.now(),
+ rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
+ rselectTextarea = /^(?:select|textarea)/i,
+ rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
+ rnoContent = /^(?:GET|HEAD)$/,
+ rbracket = /\[\]$/,
+ jsre = /\=\?(&|$)/,
rquery = /\?/,
- rts = /(\?|&)_=.*?(&|$)/,
+ rts = /([?&])_=[^&]*/,
rurl = /^(\w+:)?\/\/([^\/?#]+)/,
r20 = /%20/g,
+ rhash = /#.*$/,
// Keep a copy of the old load method
_load = jQuery.fn.load;
jQuery.fn.extend({
load: function( url, params, callback ) {
- if ( typeof url !== "string" ) {
- return _load.call( this, url );
+ if ( typeof url !== "string" && _load ) {
+ return _load.apply( this, arguments );
// Don't do a request if no elements are being requested
} else if ( !this.length ) {
@@ -4829,7 +5629,7 @@
// See if a selector was specified
self.html( selector ?
// Create a dummy div to hold the results
- jQuery("<div />")
+ jQuery("<div>")
// inject the contents of the document in, removing the scripts
// to avoid any 'Permission Denied' errors in IE
.append(res.responseText.replace(rscript, ""))
@@ -4853,6 +5653,7 @@
serialize: function() {
return jQuery.param(this.serializeArray());
},
+
serializeArray: function() {
return this.map(function() {
return this.elements ? jQuery.makeArray(this.elements) : this;
@@ -4884,7 +5685,6 @@
});
jQuery.extend({
-
get: function( url, data, callback, type ) {
// shift arguments if data argument was omited
if ( jQuery.isFunction( data ) ) {
@@ -4945,19 +5745,10 @@
password: null,
traditional: false,
*/
- // Create the request object; Microsoft failed to properly
- // implement the XMLHttpRequest in IE7 (can't request local files),
- // so we use the ActiveXObject when it is available
// This function can be overriden by calling jQuery.ajaxSetup
- xhr: window.XMLHttpRequest && (window.location.protocol !== "file:" || !window.ActiveXObject) ?
- function() {
- return new window.XMLHttpRequest();
- } :
- function() {
- try {
- return new window.ActiveXObject("Microsoft.XMLHTTP");
- } catch(e) {}
- },
+ xhr: function() {
+ return new window.XMLHttpRequest();
+ },
accepts: {
xml: "application/xml, text/xml",
html: "text/html",
@@ -4968,17 +5759,15 @@
}
},
- // Last-Modified header cache for next request
- lastModified: {},
- etag: {},
-
ajax: function( origSettings ) {
- var s = jQuery.extend(true, {}, jQuery.ajaxSettings, origSettings);
-
- var jsonp, status, data,
- callbackContext = origSettings && origSettings.context || s,
- type = s.type.toUpperCase();
+ var s = jQuery.extend(true, {}, jQuery.ajaxSettings, origSettings),
+ jsonp, status, data, type = s.type.toUpperCase(), noContent = rnoContent.test(type);
+ s.url = s.url.replace( rhash, "" );
+
+ // Use original (not extended) context object if it was provided
+ s.context = origSettings && origSettings.context != null ? origSettings.context : s;
+
// convert data if not already a string
if ( s.data && s.processData && typeof s.data !== "string" ) {
s.data = jQuery.param( s.data, s.traditional );
@@ -5012,17 +5801,25 @@
s.dataType = "script";
// Handle JSONP-style loading
- window[ jsonp ] = window[ jsonp ] || function( tmp ) {
- data = tmp;
- success();
- complete();
- // Garbage collect
- window[ jsonp ] = undefined;
+ var customJsonp = window[ jsonp ];
- try {
- delete window[ jsonp ];
- } catch(e) {}
+ window[ jsonp ] = function( tmp ) {
+ if ( jQuery.isFunction( customJsonp ) ) {
+ customJsonp( tmp );
+ } else {
+ // Garbage collect
+ window[ jsonp ] = undefined;
+
+ try {
+ delete window[ jsonp ];
+ } catch( jsonpError ) {}
+ }
+
+ data = tmp;
+ jQuery.handleSuccess( s, xhr, status, data );
+ jQuery.handleComplete( s, xhr, status, data );
+
if ( head ) {
head.removeChild( script );
}
@@ -5033,39 +5830,39 @@
s.cache = false;
}
- if ( s.cache === false && type === "GET" ) {
- var ts = now();
+ if ( s.cache === false && noContent ) {
+ var ts = jQuery.now();
// try replacing _= if it is there
- var ret = s.url.replace(rts, "$1_=" + ts + "$2");
+ var ret = s.url.replace(rts, "$1_=" + ts);
// if nothing was replaced, add timestamp to the end
s.url = ret + ((ret === s.url) ? (rquery.test(s.url) ? "&" : "?") + "_=" + ts : "");
}
- // If data is available, append data to url for get requests
- if ( s.data && type === "GET" ) {
+ // If data is available, append data to url for GET/HEAD requests
+ if ( s.data && noContent ) {
s.url += (rquery.test(s.url) ? "&" : "?") + s.data;
}
// Watch for a new set of requests
- if ( s.global && ! jQuery.active++ ) {
+ if ( s.global && jQuery.active++ === 0 ) {
jQuery.event.trigger( "ajaxStart" );
}
// Matches an absolute URL, and saves the domain
var parts = rurl.exec( s.url ),
- remote = parts && (parts[1] && parts[1] !== location.protocol || parts[2] !== location.host);
+ remote = parts && (parts[1] && parts[1].toLowerCase() !== location.protocol || parts[2].toLowerCase() !== location.host);
// If we're requesting a remote document
// and trying to load JSON or Script with a GET
if ( s.dataType === "script" && type === "GET" && remote ) {
var head = document.getElementsByTagName("head")[0] || document.documentElement;
var script = document.createElement("script");
- script.src = s.url;
if ( s.scriptCharset ) {
script.charset = s.scriptCharset;
}
+ script.src = s.url;
// Handle Script loading
if ( !jsonp ) {
@@ -5076,8 +5873,8 @@
if ( !done && (!this.readyState ||
this.readyState === "loaded" || this.readyState === "complete") ) {
done = true;
- success();
- complete();
+ jQuery.handleSuccess( s, xhr, status, data );
+ jQuery.handleComplete( s, xhr, status, data );
// Handle memory leak in IE
script.onload = script.onreadystatechange = null;
@@ -5115,8 +5912,8 @@
// Need an extra try/catch for cross domain requests in Firefox 3
try {
- // Set the correct header, if data is being sent
- if ( s.data || origSettings && origSettings.contentType ) {
+ // Set content-type if data specified and content-body is valid for this type
+ if ( (s.data != null && !noContent) || (origSettings && origSettings.contentType) ) {
xhr.setRequestHeader("Content-Type", s.contentType);
}
@@ -5139,14 +5936,14 @@
// Set the Accepts header for the server, depending on the dataType
xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
- s.accepts[ s.dataType ] + ", */*" :
+ s.accepts[ s.dataType ] + ", */*; q=0.01" :
s.accepts._default );
- } catch(e) {}
+ } catch( headerError ) {}
// Allow custom headers/mimetypes and early abort
- if ( s.beforeSend && s.beforeSend.call(callbackContext, xhr, s) === false ) {
+ if ( s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false ) {
// Handle the global AJAX counter
- if ( s.global && ! --jQuery.active ) {
+ if ( s.global && jQuery.active-- === 1 ) {
jQuery.event.trigger( "ajaxStop" );
}
@@ -5156,7 +5953,7 @@
}
if ( s.global ) {
- trigger("ajaxSend", [xhr, s]);
+ jQuery.triggerGlobal( s, "ajaxSend", [xhr, s] );
}
// Wait for a response to come back
@@ -5166,7 +5963,7 @@
// Opera doesn't call onreadystatechange before this point
// so we simulate the call
if ( !requestDone ) {
- complete();
+ jQuery.handleComplete( s, xhr, status, data );
}
requestDone = true;
@@ -5194,9 +5991,9 @@
try {
// process the data (runs the xml through httpData regardless of callback)
data = jQuery.httpData( xhr, s.dataType, s );
- } catch(err) {
+ } catch( parserError ) {
status = "parsererror";
- errMsg = err;
+ errMsg = parserError;
}
}
@@ -5204,14 +6001,16 @@
if ( status === "success" || status === "notmodified" ) {
// JSONP handles its own success callback
if ( !jsonp ) {
- success();
+ jQuery.handleSuccess( s, xhr, status, data );
}
} else {
- jQuery.handleError(s, xhr, status, errMsg);
+ jQuery.handleError( s, xhr, status, errMsg );
}
// Fire the complete handlers
- complete();
+ if ( !jsonp ) {
+ jQuery.handleComplete( s, xhr, status, data );
+ }
if ( isTimeout === "timeout" ) {
xhr.abort();
@@ -5224,18 +6023,21 @@
}
};
- // Override the abort handler, if we can (IE doesn't allow it, but that's OK)
+ // Override the abort handler, if we can (IE 6 doesn't allow it, but that's OK)
// Opera doesn't fire onreadystatechange at all on abort
try {
var oldAbort = xhr.abort;
xhr.abort = function() {
if ( xhr ) {
- oldAbort.call( xhr );
+ // oldAbort has no call property in IE7 so
+ // just do it this way, which works in all
+ // browsers
+ Function.prototype.call.call( oldAbort, xhr );
}
onreadystatechange( "abort" );
};
- } catch(e) { }
+ } catch( abortError ) {}
// Timeout checker
if ( s.async && s.timeout > 0 ) {
@@ -5249,11 +6051,13 @@
// Send the data
try {
- xhr.send( type === "POST" || type === "PUT" || type === "DELETE" ? s.data : null );
- } catch(e) {
- jQuery.handleError(s, xhr, null, e);
+ xhr.send( noContent || s.data == null ? null : s.data );
+
+ } catch( sendError ) {
+ jQuery.handleError( s, xhr, null, sendError );
+
// Fire the complete handlers
- complete();
+ jQuery.handleComplete( s, xhr, status, data );
}
// firefox 1.5 doesn't fire statechange for sync requests
@@ -5261,66 +6065,145 @@
onreadystatechange();
}
- function success() {
- // If a local callback was specified, fire it and pass it the data
- if ( s.success ) {
- s.success.call( callbackContext, data, status, xhr );
- }
+ // return XMLHttpRequest to allow aborting the request etc.
+ return xhr;
+ },
- // Fire the global callback
- if ( s.global ) {
- trigger( "ajaxSuccess", [xhr, s] );
+ // Serialize an array of form elements or a set of
+ // key/values into a query string
+ param: function( a, traditional ) {
+ var s = [],
+ add = function( key, value ) {
+ // If value is a function, invoke it and return its value
+ value = jQuery.isFunction(value) ? value() : value;
+ s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
+ };
+
+ // Set traditional to true for jQuery <= 1.3.2 behavior.
+ if ( traditional === undefined ) {
+ traditional = jQuery.ajaxSettings.traditional;
+ }
+
+ // If an array was passed in, assume that it is an array of form elements.
+ if ( jQuery.isArray(a) || a.jquery ) {
+ // Serialize the form elements
+ jQuery.each( a, function() {
+ add( this.name, this.value );
+ });
+
+ } else {
+ // If traditional, encode the "old" way (the way 1.3.2 or older
+ // did it), otherwise encode params recursively.
+ for ( var prefix in a ) {
+ buildParams( prefix, a[prefix], traditional, add );
}
}
- function complete() {
- // Process result
- if ( s.complete ) {
- s.complete.call( callbackContext, xhr, status);
- }
+ // Return the resulting serialization
+ return s.join("&").replace(r20, "+");
+ }
+});
- // The request was completed
- if ( s.global ) {
- trigger( "ajaxComplete", [xhr, s] );
+function buildParams( prefix, obj, traditional, add ) {
+ if ( jQuery.isArray(obj) && obj.length ) {
+ // Serialize array item.
+ jQuery.each( obj, function( i, v ) {
+ if ( traditional || rbracket.test( prefix ) ) {
+ // Treat each array item as a scalar.
+ add( prefix, v );
+
+ } else {
+ // If array item is non-scalar (array or object), encode its
+ // numeric index to resolve deserialization ambiguity issues.
+ // Note that rack (as of 1.0.0) can't currently deserialize
+ // nested arrays properly, and attempting to do so may cause
+ // a server error. Possible fixes are to modify rack's
+ // deserialization algorithm or to provide an option or flag
+ // to force array serialization to be shallow.
+ buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add );
}
+ });
+
+ } else if ( !traditional && obj != null && typeof obj === "object" ) {
+ if ( jQuery.isEmptyObject( obj ) ) {
+ add( prefix, "" );
- // Handle the global AJAX counter
- if ( s.global && ! --jQuery.active ) {
- jQuery.event.trigger( "ajaxStop" );
- }
+ // Serialize object item.
+ } else {
+ jQuery.each( obj, function( k, v ) {
+ buildParams( prefix + "[" + k + "]", v, traditional, add );
+ });
}
-
- function trigger(type, args) {
- (s.context ? jQuery(s.context) : jQuery.event).trigger(type, args);
- }
+
+ } else {
+ // Serialize scalar item.
+ add( prefix, obj );
+ }
+}
- // return XMLHttpRequest to allow aborting the request etc.
- return xhr;
- },
+// This is still on the jQuery object... for now
+// Want to move this to jQuery.ajax some day
+jQuery.extend({
+ // Counter for holding the number of active queries
+ active: 0,
+
+ // Last-Modified header cache for next request
+ lastModified: {},
+ etag: {},
+
handleError: function( s, xhr, status, e ) {
// If a local callback was specified, fire it
if ( s.error ) {
- s.error.call( s.context || s, xhr, status, e );
+ s.error.call( s.context, xhr, status, e );
}
// Fire the global callback
if ( s.global ) {
- (s.context ? jQuery(s.context) : jQuery.event).trigger( "ajaxError", [xhr, s, e] );
+ jQuery.triggerGlobal( s, "ajaxError", [xhr, s, e] );
}
},
- // Counter for holding the number of active queries
- active: 0,
+ handleSuccess: function( s, xhr, status, data ) {
+ // If a local callback was specified, fire it and pass it the data
+ if ( s.success ) {
+ s.success.call( s.context, data, status, xhr );
+ }
+ // Fire the global callback
+ if ( s.global ) {
+ jQuery.triggerGlobal( s, "ajaxSuccess", [xhr, s] );
+ }
+ },
+
+ handleComplete: function( s, xhr, status ) {
+ // Process result
+ if ( s.complete ) {
+ s.complete.call( s.context, xhr, status );
+ }
+
+ // The request was completed
+ if ( s.global ) {
+ jQuery.triggerGlobal( s, "ajaxComplete", [xhr, s] );
+ }
+
+ // Handle the global AJAX counter
+ if ( s.global && jQuery.active-- === 1 ) {
+ jQuery.event.trigger( "ajaxStop" );
+ }
+ },
+
+ triggerGlobal: function( s, type, args ) {
+ (s.context && s.context.url == null ? jQuery(s.context) : jQuery.event).trigger(type, args);
+ },
+
// Determines if an XMLHttpRequest was successful or not
httpSuccess: function( xhr ) {
try {
// IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
return !xhr.status && location.protocol === "file:" ||
- // Opera returns 0 when status is 304
- ( xhr.status >= 200 && xhr.status < 300 ) ||
- xhr.status === 304 || xhr.status === 1223 || xhr.status === 0;
+ xhr.status >= 200 && xhr.status < 300 ||
+ xhr.status === 304 || xhr.status === 1223;
} catch(e) {}
return false;
@@ -5339,8 +6222,7 @@
jQuery.etag[url] = etag;
}
- // Opera returns 0 when status is 304
- return xhr.status === 304 || xhr.status === 0;
+ return xhr.status === 304;
},
httpData: function( xhr, type, s ) {
@@ -5371,77 +6253,40 @@
}
return data;
- },
+ }
- // Serialize an array of form elements or a set of
- // key/values into a query string
- param: function( a, traditional ) {
- var s = [];
-
- // Set traditional to true for jQuery <= 1.3.2 behavior.
- if ( traditional === undefined ) {
- traditional = jQuery.ajaxSettings.traditional;
+});
+
+/*
+ * Create the request object; Microsoft failed to properly
+ * implement the XMLHttpRequest in IE7 (can't request local files),
+ * so we use the ActiveXObject when it is available
+ * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
+ * we need a fallback.
+ */
+if ( window.ActiveXObject ) {
+ jQuery.ajaxSettings.xhr = function() {
+ if ( window.location.protocol !== "file:" ) {
+ try {
+ return new window.XMLHttpRequest();
+ } catch(xhrError) {}
}
-
- // If an array was passed in, assume that it is an array of form elements.
- if ( jQuery.isArray(a) || a.jquery ) {
- // Serialize the form elements
- jQuery.each( a, function() {
- add( this.name, this.value );
- });
-
- } else {
- // If traditional, encode the "old" way (the way 1.3.2 or older
- // did it), otherwise encode params recursively.
- for ( var prefix in a ) {
- buildParams( prefix, a[prefix] );
- }
- }
- // Return the resulting serialization
- return s.join("&").replace(r20, "+");
+ try {
+ return new window.ActiveXObject("Microsoft.XMLHTTP");
+ } catch(activeError) {}
+ };
+}
- function buildParams( prefix, obj ) {
- if ( jQuery.isArray(obj) ) {
- // Serialize array item.
- jQuery.each( obj, function( i, v ) {
- if ( traditional || /\[\]$/.test( prefix ) ) {
- // Treat each array item as a scalar.
- add( prefix, v );
- } else {
- // If array item is non-scalar (array or object), encode its
- // numeric index to resolve deserialization ambiguity issues.
- // Note that rack (as of 1.0.0) can't currently deserialize
- // nested arrays properly, and attempting to do so may cause
- // a server error. Possible fixes are to modify rack's
- // deserialization algorithm or to provide an option or flag
- // to force array serialization to be shallow.
- buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v );
- }
- });
-
- } else if ( !traditional && obj != null && typeof obj === "object" ) {
- // Serialize object item.
- jQuery.each( obj, function( k, v ) {
- buildParams( prefix + "[" + k + "]", v );
- });
-
- } else {
- // Serialize scalar item.
- add( prefix, obj );
- }
- }
+// Does this browser support XHR requests?
+jQuery.support.ajax = !!jQuery.ajaxSettings.xhr();
- function add( key, value ) {
- // If value is a function, invoke it and return its value
- value = jQuery.isFunction(value) ? value() : value;
- s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
- }
- }
-});
+
+
+
var elemdisplay = {},
- rfxtypes = /toggle|show|hide/,
- rfxnum = /^([+-]=)?([\d+-.]+)(.*)$/,
+ rfxtypes = /^(?:toggle|show|hide)$/,
+ rfxnum = /^([+\-]=)?([\d+.\-]+)(.*)$/,
timerId,
fxAttrs = [
// height animations
@@ -5453,66 +6298,63 @@
];
jQuery.fn.extend({
- show: function( speed, callback ) {
- if ( speed || speed === 0) {
- return this.animate( genFx("show", 3), speed, callback);
+ show: function( speed, easing, callback ) {
+ var elem, display;
+ if ( speed || speed === 0 ) {
+ return this.animate( genFx("show", 3), speed, easing, callback);
+
} else {
- for ( var i = 0, l = this.length; i < l; i++ ) {
- var old = jQuery.data(this[i], "olddisplay");
+ for ( var i = 0, j = this.length; i < j; i++ ) {
+ elem = this[i];
+ display = elem.style.display;
- this[i].style.display = old || "";
+ // Reset the inline display of this element to learn if it is
+ // being hidden by cascaded rules or not
+ if ( !jQuery.data(elem, "olddisplay") && display === "none" ) {
+ display = elem.style.display = "";
+ }
- if ( jQuery.css(this[i], "display") === "none" ) {
- var nodeName = this[i].nodeName, display;
-
- if ( elemdisplay[ nodeName ] ) {
- display = elemdisplay[ nodeName ];
-
- } else {
- var elem = jQuery("<" + nodeName + " />").appendTo("body");
-
- display = elem.css("display");
-
- if ( display === "none" ) {
- display = "block";
- }
-
- elem.remove();
-
- elemdisplay[ nodeName ] = display;
- }
-
- jQuery.data(this[i], "olddisplay", display);
+ // Set elements which have been overridden with display: none
+ // in a stylesheet to whatever the default browser style is
+ // for such an element
+ if ( display === "" && jQuery.css( elem, "display" ) === "none" ) {
+ jQuery.data(elem, "olddisplay", defaultDisplay(elem.nodeName));
}
}
- // Set the display of the elements in a second loop
+ // Set the display of most of the elements in a second loop
// to avoid the constant reflow
- for ( var j = 0, k = this.length; j < k; j++ ) {
- this[j].style.display = jQuery.data(this[j], "olddisplay") || "";
+ for ( i = 0; i < j; i++ ) {
+ elem = this[i];
+ display = elem.style.display;
+
+ if ( display === "" || display === "none" ) {
+ elem.style.display = jQuery.data(elem, "olddisplay") || "";
+ }
}
return this;
}
},
- hide: function( speed, callback ) {
+ hide: function( speed, easing, callback ) {
if ( speed || speed === 0 ) {
- return this.animate( genFx("hide", 3), speed, callback);
+ return this.animate( genFx("hide", 3), speed, easing, callback);
} else {
- for ( var i = 0, l = this.length; i < l; i++ ) {
- var old = jQuery.data(this[i], "olddisplay");
- if ( !old && old !== "none" ) {
- jQuery.data(this[i], "olddisplay", jQuery.css(this[i], "display"));
+ for ( var i = 0, j = this.length; i < j; i++ ) {
+ var display = jQuery.css( this[i], "display" );
+
+ if ( display !== "none" ) {
+ jQuery.data( this[i], "olddisplay", display );
}
}
// Set the display of the elements in a second loop
// to avoid the constant reflow
- for ( var j = 0, k = this.length; j < k; j++ ) {
- this[j].style.display = "none";
+ for ( i = 0; i < j; i++ ) {
+ this[i].style.display = "none";
}
return this;
@@ -5522,7 +6364,7 @@
// Save the old toggle function
_toggle: jQuery.fn.toggle,
- toggle: function( fn, fn2 ) {
+ toggle: function( fn, fn2, callback ) {
var bool = typeof fn === "boolean";
if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {
@@ -5535,15 +6377,15 @@
});
} else {
- this.animate(genFx("toggle", 3), fn, fn2);
+ this.animate(genFx("toggle", 3), fn, fn2, callback);
}
return this;
},
- fadeTo: function( speed, to, callback ) {
+ fadeTo: function( speed, to, easing, callback ) {
return this.filter(":hidden").css("opacity", 0).show().end()
- .animate({opacity: to}, speed, callback);
+ .animate({opacity: to}, speed, easing, callback);
},
animate: function( prop, speed, easing, callback ) {
@@ -5554,12 +6396,16 @@
}
return this[ optall.queue === false ? "each" : "queue" ](function() {
+ // XXX 'this' does not always have a nodeName when running the
+ // test suite
+
var opt = jQuery.extend({}, optall), p,
- hidden = this.nodeType === 1 && jQuery(this).is(":hidden"),
+ isElement = this.nodeType === 1,
+ hidden = isElement && jQuery(this).is(":hidden"),
self = this;
for ( p in prop ) {
- var name = p.replace(rdashAlpha, fcamelCase);
+ var name = jQuery.camelCase( p );
if ( p !== name ) {
prop[ name ] = prop[ p ];
@@ -5571,12 +6417,35 @@
return opt.complete.call(this);
}
- if ( ( p === "height" || p === "width" ) && this.style ) {
- // Store display property
- opt.display = jQuery.css(this, "display");
+ if ( isElement && ( p === "height" || p === "width" ) ) {
+ // Make sure that nothing sneaks out
+ // Record all 3 overflow attributes because IE does not
+ // change the overflow attribute when overflowX and
+ // overflowY are set to the same value
+ opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];
- // Make sure that nothing sneaks out
- opt.overflow = this.style.overflow;
+ // Set display property to inline-block for height/width
+ // animations on inline elements that are having width/height
+ // animated
+ if ( jQuery.css( this, "display" ) === "inline" &&
+ jQuery.css( this, "float" ) === "none" ) {
+ if ( !jQuery.support.inlineBlockNeedsLayout ) {
+ this.style.display = "inline-block";
+
+ } else {
+ var display = defaultDisplay(this.nodeName);
+
+ // inline-level elements accept inline-block;
+ // block-level elements need to be inline with layout
+ if ( display === "inline" ) {
+ this.style.display = "inline-block";
+
+ } else {
+ this.style.display = "inline";
+ this.style.zoom = 1;
+ }
+ }
+ }
}
if ( jQuery.isArray( prop[p] ) ) {
@@ -5600,7 +6469,7 @@
} else {
var parts = rfxnum.exec(val),
- start = e.cur(true) || 0;
+ start = e.cur() || 0;
if ( parts ) {
var end = parseFloat( parts[2] ),
@@ -5608,9 +6477,9 @@
// We need to compute starting value
if ( unit !== "px" ) {
- self.style[ name ] = (end || 1) + unit;
- start = ((end || 1) / e.cur(true)) * start;
- self.style[ name ] = start + unit;
+ jQuery.style( self, name, (end || 1) + unit);
+ start = ((end || 1) / e.cur()) * start;
+ jQuery.style( self, name, start + unit);
}
// If a +=/-= token was provided, we're doing a relative animation
@@ -5662,22 +6531,33 @@
});
+function genFx( type, num ) {
+ var obj = {};
+
+ jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() {
+ obj[ this ] = type;
+ });
+
+ return obj;
+}
+
// Generate shortcuts for custom animations
jQuery.each({
slideDown: genFx("show", 1),
slideUp: genFx("hide", 1),
slideToggle: genFx("toggle", 1),
fadeIn: { opacity: "show" },
- fadeOut: { opacity: "hide" }
+ fadeOut: { opacity: "hide" },
+ fadeToggle: { opacity: "toggle" }
}, function( name, props ) {
- jQuery.fn[ name ] = function( speed, callback ) {
- return this.animate( props, speed, callback );
+ jQuery.fn[ name ] = function( speed, easing, callback ) {
+ return this.animate( props, speed, easing, callback );
};
});
jQuery.extend({
speed: function( speed, easing, fn ) {
- var opt = speed && typeof speed === "object" ? speed : {
+ var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
complete: fn || !fn && easing ||
jQuery.isFunction( speed ) && speed,
duration: speed,
@@ -5685,7 +6565,7 @@
};
opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
- jQuery.fx.speeds[opt.duration] || jQuery.fx.speeds._default;
+ opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default;
// Queueing
opt.old = opt.complete;
@@ -5732,33 +6612,30 @@
}
(jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
-
- // Set display property to block for height/width animations
- if ( ( this.prop === "height" || this.prop === "width" ) && this.elem.style ) {
- this.elem.style.display = "block";
- }
},
// Get the current size
- cur: function( force ) {
+ cur: function() {
if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
return this.elem[ this.prop ];
}
- var r = parseFloat(jQuery.css(this.elem, this.prop, force));
- return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0;
+ var r = parseFloat( jQuery.css( this.elem, this.prop ) );
+ return r && r > -10000 ? r : 0;
},
// Start an animation from one number to another
custom: function( from, to, unit ) {
- this.startTime = now();
+ var self = this,
+ fx = jQuery.fx;
+
+ this.startTime = jQuery.now();
this.start = from;
this.end = to;
this.unit = unit || this.unit || "px";
this.now = this.start;
this.pos = this.state = 0;
- var self = this;
function t( gotoEnd ) {
return self.step(gotoEnd);
}
@@ -5766,7 +6643,7 @@
t.elem = this.elem;
if ( t() && jQuery.timers.push(t) && !timerId ) {
- timerId = setInterval(jQuery.fx.tick, 13);
+ timerId = setInterval(fx.tick, fx.interval);
}
},
@@ -5797,7 +6674,7 @@
// Each step of an animation
step: function( gotoEnd ) {
- var t = now(), done = true;
+ var t = jQuery.now(), done = true;
if ( gotoEnd || t >= this.options.duration + this.startTime ) {
this.now = this.end;
@@ -5813,17 +6690,14 @@
}
if ( done ) {
- if ( this.options.display != null ) {
- // Reset the overflow
- this.elem.style.overflow = this.options.overflow;
+ // Reset the overflow
+ if ( this.options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
+ var elem = this.elem,
+ options = this.options;
- // Reset the display
- var old = jQuery.data(this.elem, "olddisplay");
- this.elem.style.display = old ? old : this.options.display;
-
- if ( jQuery.css(this.elem, "display") === "none" ) {
- this.elem.style.display = "block";
- }
+ jQuery.each( [ "", "X", "Y" ], function (index, value) {
+ elem.style[ "overflow" + value ] = options.overflow[index];
+ } );
}
// Hide the element if the "hide" operation was done
@@ -5834,7 +6708,7 @@
// Reset the properties, if the item has been hidden or shown
if ( this.options.hide || this.options.show ) {
for ( var p in this.options.curAnim ) {
- jQuery.style(this.elem, p, this.options.orig[p]);
+ jQuery.style( this.elem, p, this.options.orig[p] );
}
}
@@ -5876,22 +6750,24 @@
jQuery.fx.stop();
}
},
-
+
+ interval: 13,
+
stop: function() {
clearInterval( timerId );
timerId = null;
},
-
+
speeds: {
slow: 600,
- fast: 200,
- // Default speed
- _default: 400
+ fast: 200,
+ // Default speed
+ _default: 400
},
step: {
opacity: function( fx ) {
- jQuery.style(fx.elem, "opacity", fx.now);
+ jQuery.style( fx.elem, "opacity", fx.now );
},
_default: function( fx ) {
@@ -5912,18 +6788,32 @@
};
}
-function genFx( type, num ) {
- var obj = {};
+function defaultDisplay( nodeName ) {
+ if ( !elemdisplay[ nodeName ] ) {
+ var elem = jQuery("<" + nodeName + ">").appendTo("body"),
+ display = elem.css("display");
- jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() {
- obj[ this ] = type;
- });
+ elem.remove();
- return obj;
+ if ( display === "none" || display === "" ) {
+ display = "block";
+ }
+
+ elemdisplay[ nodeName ] = display;
+ }
+
+ return elemdisplay[ nodeName ];
}
+
+
+
+
+var rtable = /^t(?:able|d|h)$/i,
+ rroot = /^(?:body|html)$/i;
+
if ( "getBoundingClientRect" in document.documentElement ) {
jQuery.fn.offset = function( options ) {
- var elem = this[0];
+ var elem = this[0], box;
if ( options ) {
return this.each(function( i ) {
@@ -5939,11 +6829,27 @@
return jQuery.offset.bodyOffset( elem );
}
- var box = elem.getBoundingClientRect(), doc = elem.ownerDocument, body = doc.body, docElem = doc.documentElement,
- clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0,
- top = box.top + (self.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop ) - clientTop,
- left = box.left + (self.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft) - clientLeft;
+ try {
+ box = elem.getBoundingClientRect();
+ } catch(e) {}
+ var doc = elem.ownerDocument,
+ docElem = doc.documentElement;
+
+ // Make sure we're not dealing with a disconnected DOM node
+ if ( !box || !jQuery.contains( docElem, elem ) ) {
+ return box || { top: 0, left: 0 };
+ }
+
+ var body = doc.body,
+ win = getWindow(doc),
+ clientTop = docElem.clientTop || body.clientTop || 0,
+ clientLeft = docElem.clientLeft || body.clientLeft || 0,
+ scrollTop = (win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop ),
+ scrollLeft = (win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft),
+ top = box.top + scrollTop - clientTop,
+ left = box.left + scrollLeft - clientLeft;
+
return { top: top, left: left };
};
@@ -5967,11 +6873,16 @@
jQuery.offset.initialize();
- var offsetParent = elem.offsetParent, prevOffsetParent = elem,
- doc = elem.ownerDocument, computedStyle, docElem = doc.documentElement,
- body = doc.body, defaultView = doc.defaultView,
+ var computedStyle,
+ offsetParent = elem.offsetParent,
+ prevOffsetParent = elem,
+ doc = elem.ownerDocument,
+ docElem = doc.documentElement,
+ body = doc.body,
+ defaultView = doc.defaultView,
prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
- top = elem.offsetTop, left = elem.offsetLeft;
+ top = elem.offsetTop,
+ left = elem.offsetLeft;
while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
@@ -5986,12 +6897,13 @@
top += elem.offsetTop;
left += elem.offsetLeft;
- if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(elem.nodeName)) ) {
+ if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {
top += parseFloat( computedStyle.borderTopWidth ) || 0;
left += parseFloat( computedStyle.borderLeftWidth ) || 0;
}
- prevOffsetParent = offsetParent, offsetParent = elem.offsetParent;
+ prevOffsetParent = offsetParent;
+ offsetParent = elem.offsetParent;
}
if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {
@@ -6018,7 +6930,7 @@
jQuery.offset = {
initialize: function() {
- var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.curCSS(body, "marginTop", true) ) || 0,
+ var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.css(body, "marginTop") ) || 0,
html = "<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
jQuery.extend( container.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" } );
@@ -6032,12 +6944,16 @@
this.doesNotAddBorder = (checkDiv.offsetTop !== 5);
this.doesAddBorderForTableAndCells = (td.offsetTop === 5);
- checkDiv.style.position = "fixed", checkDiv.style.top = "20px";
+ checkDiv.style.position = "fixed";
+ checkDiv.style.top = "20px";
+
// safari subtracts parent border width here which is 5px
this.supportsFixedPosition = (checkDiv.offsetTop === 20 || checkDiv.offsetTop === 15);
checkDiv.style.position = checkDiv.style.top = "";
- innerDiv.style.overflow = "hidden", innerDiv.style.position = "relative";
+ innerDiv.style.overflow = "hidden";
+ innerDiv.style.position = "relative";
+
this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);
this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop);
@@ -6048,36 +6964,52 @@
},
bodyOffset: function( body ) {
- var top = body.offsetTop, left = body.offsetLeft;
+ var top = body.offsetTop,
+ left = body.offsetLeft;
jQuery.offset.initialize();
if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) {
- top += parseFloat( jQuery.curCSS(body, "marginTop", true) ) || 0;
- left += parseFloat( jQuery.curCSS(body, "marginLeft", true) ) || 0;
+ top += parseFloat( jQuery.css(body, "marginTop") ) || 0;
+ left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
}
return { top: top, left: left };
},
setOffset: function( elem, options, i ) {
+ var position = jQuery.css( elem, "position" );
+
// set position first, in-case top/left are set even on static elem
- if ( /static/.test( jQuery.curCSS( elem, "position" ) ) ) {
+ if ( position === "static" ) {
elem.style.position = "relative";
}
- var curElem = jQuery( elem ),
+
+ var curElem = jQuery( elem ),
curOffset = curElem.offset(),
- curTop = parseInt( jQuery.curCSS( elem, "top", true ), 10 ) || 0,
- curLeft = parseInt( jQuery.curCSS( elem, "left", true ), 10 ) || 0;
+ curCSSTop = jQuery.css( elem, "top" ),
+ curCSSLeft = jQuery.css( elem, "left" ),
+ calculatePosition = (position === "absolute" && jQuery.inArray('auto', [curCSSTop, curCSSLeft]) > -1),
+ props = {}, curPosition = {}, curTop, curLeft;
+ // need to be able to calculate position if either top or left is auto and position is absolute
+ if ( calculatePosition ) {
+ curPosition = curElem.position();
+ }
+
+ curTop = calculatePosition ? curPosition.top : parseInt( curCSSTop, 10 ) || 0;
+ curLeft = calculatePosition ? curPosition.left : parseInt( curCSSLeft, 10 ) || 0;
+
if ( jQuery.isFunction( options ) ) {
options = options.call( elem, i, curOffset );
}
- var props = {
- top: (options.top - curOffset.top) + curTop,
- left: (options.left - curOffset.left) + curLeft
- };
+ if (options.top != null) {
+ props.top = (options.top - curOffset.top) + curTop;
+ }
+ if (options.left != null) {
+ props.left = (options.left - curOffset.left) + curLeft;
+ }
if ( "using" in options ) {
options.using.call( elem, props );
@@ -6101,17 +7033,17 @@
// Get correct offsets
offset = this.offset(),
- parentOffset = /^body|html$/i.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
+ parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
// Subtract element margins
// note: when an element has margin: auto the offsetLeft and marginLeft
// are the same in Safari causing offset.left to incorrectly be 0
- offset.top -= parseFloat( jQuery.curCSS(elem, "marginTop", true) ) || 0;
- offset.left -= parseFloat( jQuery.curCSS(elem, "marginLeft", true) ) || 0;
+ offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;
+ offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;
// Add offsetParent borders
- parentOffset.top += parseFloat( jQuery.curCSS(offsetParent[0], "borderTopWidth", true) ) || 0;
- parentOffset.left += parseFloat( jQuery.curCSS(offsetParent[0], "borderLeftWidth", true) ) || 0;
+ parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;
+ parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;
// Subtract the two offsets
return {
@@ -6123,7 +7055,7 @@
offsetParent: function() {
return this.map(function() {
var offsetParent = this.offsetParent || document.body;
- while ( offsetParent && (!/^body|html$/i.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
+ while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
offsetParent = offsetParent.offsetParent;
}
return offsetParent;
@@ -6171,30 +7103,30 @@
});
function getWindow( elem ) {
- return ("scrollTo" in elem && elem.document) ?
+ return jQuery.isWindow( elem ) ?
elem :
elem.nodeType === 9 ?
elem.defaultView || elem.parentWindow :
false;
}
-
//added by nick
var detectedCompatMode;
-
-function getCompatMode() {
- var compatMode = document.compatMode || detectedCompatMode;
+
+function getCompatMode(elem) {
+ var compatMode = elem.document.compatMode || detectedCompatMode;
if (!compatMode) {
//detect compatMode as described in http://code.google.com/p/doctype/wiki/ArticleCompatMode
- var width = jQuery(document.createElement("div")).attr('style', 'position:absolute;width:0;height:0;width:1').css('width');
+ var width = jQuery(elem.document.createElement("div")).attr('style', 'position:absolute;width:0;height:0;width:1').css('width');
detectedCompatMode = compatMode = (width == '1px' ? 'BackCompat' : 'CSS1Compat');
}
-
+
return compatMode;
}
-
+
//end of added by nick
+
// Create innerHeight, innerWidth, outerHeight and outerWidth methods
jQuery.each([ "Height", "Width" ], function( i, name ) {
@@ -6203,14 +7135,14 @@
// innerHeight and innerWidth
jQuery.fn["inner" + name] = function() {
return this[0] ?
- jQuery.css( this[0], type, false, "padding" ) :
+ parseFloat( jQuery.css( this[0], type, "padding" ) ) :
null;
};
// outerHeight and outerWidth
jQuery.fn["outer" + name] = function( margin ) {
return this[0] ?
- jQuery.css( this[0], type, false, margin ? "margin" : "border" ) :
+ parseFloat( jQuery.css( this[0], type, margin ? "margin" : "border" ) ) :
null;
};
@@ -6228,31 +7160,34 @@
});
}
- return ("scrollTo" in elem && elem.document) ? // does it walk and quack like a window?
+ if ( jQuery.isWindow( elem ) ) {
// Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
- getCompatMode() /* changed by nick */ === "CSS1Compat" && elem.document.documentElement[ "client" + name ] ||
- elem.document.body[ "client" + name ] :
+ return getCompatMode(elem) === "CSS1Compat" && elem.document.documentElement[ "client" + name ] ||
+ elem.document.body[ "client" + name ];
- // Get document width or height
- (elem.nodeType === 9) ? // is it a document
- // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
- Math.max(
- elem.documentElement["client" + name],
- elem.body["scroll" + name], elem.documentElement["scroll" + name],
- elem.body["offset" + name], elem.documentElement["offset" + name]
- ) :
+ // Get document width or height
+ } else if ( elem.nodeType === 9 ) {
+ // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
+ return Math.max(
+ elem.documentElement["client" + name],
+ elem.body["scroll" + name], elem.documentElement["scroll" + name],
+ elem.body["offset" + name], elem.documentElement["offset" + name]
+ );
- // Get or set width or height on the element
- size === undefined ?
- // Get width or height on the element
- jQuery.css( elem, type ) :
+ // Get or set width or height on the element
+ } else if ( size === undefined ) {
+ var orig = jQuery.css( elem, type ),
+ ret = parseFloat( orig );
- // Set the width or height on the element (default to pixels if value is unitless)
- this.css( type, typeof size === "string" ? size : size + "px" );
+ return jQuery.isNaN( ret ) ? orig : ret;
+
+ // Set the width or height on the element (default to pixels if value is unitless)
+ } else {
+ return this.css( type, typeof size === "string" ? size : size + "px" );
+ }
};
});
-// Expose jQuery to the global object
-window.jQuery = window.$ = jQuery;
+
})(window);
\ No newline at end of file
Modified: branches/RF-8742-1/core/impl/src/main/resources/META-INF/resources/richfaces-event.js
===================================================================
--- branches/RF-8742-1/core/impl/src/main/resources/META-INF/resources/richfaces-event.js 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/core/impl/src/main/resources/META-INF/resources/richfaces-event.js 2010-11-29 18:01:15 UTC (rev 20208)
@@ -225,7 +225,7 @@
* */
fire : function(selector, eventType, data) {
var event = $.Event(eventType);
- getEventElement(selector).trigger(event, data);
+ getEventElement(selector).trigger(event, [data]);
return !event.isDefaultPrevented();
},
@@ -241,7 +241,7 @@
* */
fireById : function(id, eventType, data) {
var event = $.Event(eventType);
- $(document.getElementById(id)).trigger(event, data);
+ $(document.getElementById(id)).trigger(event, [data]);
return !event.isDefaultPrevented();
},
@@ -260,7 +260,7 @@
* @return value that was returned by the handler
* */
callHandler : function(selector, eventType, data) {
- return getEventElement(selector).triggerHandler(eventType, data);
+ return getEventElement(selector).triggerHandler(eventType, [data]);
},
/**
@@ -274,7 +274,7 @@
* @return value that was returned by the handler
* */
callHandlerById : function(id, eventType, data) {
- return $(document.getElementById(id)).triggerHandler(eventType, data);
+ return $(document.getElementById(id)).triggerHandler(eventType, [data]);
},
/**
Modified: branches/RF-8742-1/core/impl/src/main/resources/META-INF/resources/richfaces.js
===================================================================
--- branches/RF-8742-1/core/impl/src/main/resources/META-INF/resources/richfaces.js 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/core/impl/src/main/resources/META-INF/resources/richfaces.js 2010-11-29 18:01:15 UTC (rev 20208)
@@ -684,21 +684,6 @@
}
};
}()));
-
- var ajaxOnComplete = function (data) {
- var type = data.type;
- var responseXML = data.responseXML;
-
- if (data.type == 'event' && data.status == 'complete' && responseXML) {
- var partialResponse = jQuery(responseXML).children("partial-response");
- if (partialResponse && partialResponse.length) {
- var elements = partialResponse.children('changes').children('update, delete');
- jQuery.each(elements, function () {
- richfaces.cleanDom(jQuery(this).attr('id'));
- });
- }
- }
- };
//keys codes
richfaces.KEYS = {
@@ -715,6 +700,20 @@
DEL: 46
};
+ var ajaxOnComplete = function (data) {
+ var type = data.type;
+ var responseXML = data.responseXML;
+
+ if (data.type == 'event' && data.status == 'complete' && responseXML) {
+ var partialResponse = jQuery(responseXML).children("partial-response");
+ if (partialResponse && partialResponse.length) {
+ var elements = partialResponse.children('changes').children('update, delete');
+ jQuery.each(elements, function () {
+ richfaces.cleanDom(jQuery(this).attr('id'));
+ });
+ }
+ }
+ };
var attachAjaxDOMCleaner = function() {
// move this code to somewhere
Modified: branches/RF-8742-1/examples/output-demo/src/main/java/org/richfaces/ProgressBarBean.java
===================================================================
--- branches/RF-8742-1/examples/output-demo/src/main/java/org/richfaces/ProgressBarBean.java 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/examples/output-demo/src/main/java/org/richfaces/ProgressBarBean.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -3,8 +3,10 @@
*/
package org.richfaces;
+import java.io.Serializable;
+import java.text.DateFormat;
import java.util.Date;
-
+
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
@@ -14,37 +16,22 @@
*/
@ManagedBean
@ViewScoped
-public class ProgressBarBean {
+public class ProgressBarBean implements Serializable {
+
+ private static final long serialVersionUID = -446286889238296278L;
+
+ private int minValue = 0;
+
+ private int maxValue = 100;
+
+ private int value = 50;
+
+ private String label = "'label' attribute";
+
+ private boolean childrenRendered = false;
+
+ private boolean enabled = false;
- private boolean buttonRendered = true;
- private boolean enabled=false;
- private Long startTime;
-
- public String startProcess() {
- setEnabled(true);
- setButtonRendered(false);
- setStartTime(new Date().getTime());
- return null;
- }
-
- public Long getCurrentValue(){
- if (isEnabled()) {
- Long current = (new Date().getTime() - startTime)/1000;
- if (current>100){
- setButtonRendered(true);
- } else if (current.equals(0)) {
- return new Long(1);
- }
- return (new Date().getTime() - startTime)/1000;
- }
- if (startTime == null) {
- return Long.valueOf(-1);
- } else {
- return Long.valueOf(101);
- }
-
- }
-
public boolean isEnabled() {
return enabled;
}
@@ -53,19 +40,55 @@
this.enabled = enabled;
}
- public Long getStartTime() {
- return startTime;
+ public int getMinValue() {
+ return minValue;
}
-
- public void setStartTime(Long startTime) {
- this.startTime = startTime;
+
+ public void setMinValue(int minValue) {
+ this.minValue = minValue;
}
-
- public boolean isButtonRendered() {
- return buttonRendered;
+
+ public int getMaxValue() {
+ return maxValue;
}
-
- public void setButtonRendered(boolean buttonRendered) {
- this.buttonRendered = buttonRendered;
+
+ public void setMaxValue(int maxValue) {
+ this.maxValue = maxValue;
}
+
+ public int getValue() {
+ return value;
+ }
+
+ public void setValue(int value) {
+ this.value = value;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public boolean isChildrenRendered() {
+ return childrenRendered;
+ }
+
+ public void setChildrenRendered(boolean childrenRendered) {
+ this.childrenRendered = childrenRendered;
+ }
+
+ public void decreaseValueByFive() {
+ value -= 5;
+ }
+
+ public void increaseValueByFive() {
+ value += 5;
+ }
+
+ public String getCurrentTimeAsString() {
+ return DateFormat.getTimeInstance().format(new Date());
+ }
}
\ No newline at end of file
Modified: branches/RF-8742-1/examples/output-demo/src/main/webapp/examples/progressbar.xhtml
===================================================================
--- branches/RF-8742-1/examples/output-demo/src/main/webapp/examples/progressbar.xhtml 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/examples/output-demo/src/main/webapp/examples/progressbar.xhtml 2010-11-29 18:01:15 UTC (rev 20208)
@@ -1,79 +1,105 @@
<ui:composition 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:a4j="http://richfaces.org/a4j"
- xmlns:rich="http://richfaces.org/output" template="/templates/template.xhtml">
-
- <ui:define name="body">
- <script>
-//<![CDATA[
- var counter = 1;
- var intervalID;
- function updateProgress(i) {
- RichFaces.$('form2:progressBar').setValue(counter*5);
- if ((counter++)>20){
- clearInterval(intervalID);
- document.getElementById('button').disabled=false;
- }
- }
-
- function startProgress(){
- counter=1;
- document.getElementById('button').disabled=true;
- RichFaces.$('form2:progressBar').enable();
- RichFaces.$('form2:progressBar').setValue(1);
- intervalID = setInterval(updateProgress,5000);
- }
-//]]>
- </script>
- <h:form id="form">
- Ajax mode:
- <rich:progressBar mode="ajax" value="#{progressBarBean.currentValue}"
- interval="2000"
- enabled="#{progressBarBean.enabled}" minValue="-1" maxValue="100"
- reRenderAfterComplete="progressPanel">
- <f:facet name="initial">
- <br />
- <h:outputText value="Process doesn't started yet" />
- <a4j:commandButton action="#{progressBarBean.startProcess}"
- value="Start Process"
- render="form"
- style="margin: 9px 0px 5px;" />
- </f:facet>
- <f:facet name="complete">
- <br />
- <h:outputText value="Process Done" />
- <a4j:commandButton action="#{progressBarBean.startProcess}"
- value="Restart Process" execute="@form"
- rendered="#{progressBarBean.buttonRendered}"
- style="margin: 9px 0px 5px;" />
- </f:facet>
- <h:outputText value="#{progressBarBean.currentValue} %"/>
- </rich:progressBar>
- <h:panelGroup id="progressPanel">
- <h:outputText value="#{progressBarBean.currentValue}"/>
- </h:panelGroup>
- </h:form>
-
+ 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:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/output"
+ template="/templates/template.xhtml">
+ <ui:define name="body">
+ <h:form>
+ Min value: <h:selectOneMenu value="#{progressBarBean.minValue}" onchange="submit()">
+ <f:selectItem itemLabel="0" itemValue="0" />
+ <f:selectItem itemLabel="-50" itemValue="-50" />
+ </h:selectOneMenu>
- Client mode:
+ <br />
+
+ Value: <h:selectOneMenu value="#{progressBarBean.value}" onchange="submit()">
+ <f:selectItem itemLabel="-25" itemValue="-25" />
+ <f:selectItem itemLabel="0" itemValue="0" />
+ <f:selectItem itemLabel="25" itemValue="25" />
+ <f:selectItem itemLabel="50" itemValue="50" />
+ <f:selectItem itemLabel="100" itemValue="100" />
+ <f:selectItem itemLabel="150" itemValue="150" />
+ </h:selectOneMenu>
+
+ <br />
+
+ Max value: <h:selectOneMenu value="#{progressBarBean.maxValue}" onchange="submit()">
+ <f:selectItem itemLabel="50" itemValue="50" />
+ <f:selectItem itemLabel="100" itemValue="100" />
+ </h:selectOneMenu>
+
+ <br />
+
+ Label: <h:inputText value="#{progressBarBean.label}" onchange="submit()" />
+
+ <br />
+
+ Children rendered: <h:selectBooleanCheckbox value="#{progressBarBean.childrenRendered}" onclick="submit()" />
+
+ <br />
+
+ Enabled: <h:selectBooleanCheckbox value="#{progressBarBean.enabled}" onclick="submit()" />
+ </h:form>
+
+ Client mode:
+ <h:form id="clientPBForm">
+
+ <rich:progressBar mode="client" id="progressBar" value="#{progressBarBean.value}"
+ maxValue="#{progressBarBean.maxValue}" minValue="#{progressBarBean.minValue}" label="#{progressBarBean.label}">
- <h:form id="form2">
- <rich:progressBar mode="client" id="progressBar">
- <f:facet name="initial">
- <h:outputText value="Process doesn't started yet"/>
- </f:facet>
- <f:facet name="complete">
- <h:outputText value="Process Done"/>
- </f:facet>
- </rich:progressBar>
- <button type="button" onclick="startProgress();" style="margin: 9px 0px 5px;" id="button">Start Progress</button>
- </h:form>
+ <h:outputText value="child + " rendered="#{progressBarBean.childrenRendered}" />
+
+ <f:facet name="initial">
+ <h:outputText value="In initial state" />
+ </f:facet>
+
+ <f:facet name="finish">
+ <h:outputText value="Finished progress" />
+ </f:facet>
+
+ </rich:progressBar>
+
+ Set value via CS-API: <h:inputText size="3" onchange="RichFaces.$('clientPBForm:progressBar').setValue(this.value)" />
+
+ </h:form>
+
+
+ <h:form id="ajaxPBForm">
+ Ajax mode:
+ <rich:progressBar id="progressBar" mode="ajax" interval="2000" value="#{progressBarBean.value}"
+ maxValue="#{progressBarBean.maxValue}" minValue="#{progressBarBean.minValue}"
+ label="#{progressBarBean.value} % ~ #{progressBarBean.currentTimeAsString}" reRenderAfterComplete="progressPanel"
+ onfinish="alert('\'finish\' event handler: ' + this.tagName)"
+ enabled="#{progressBarBean.enabled}">
+ <h:outputText value="child + " rendered="#{progressBarBean.childrenRendered}" />
+
+ <f:facet name="initial">
+ <h:outputText value="initial ~ #{progressBarBean.currentTimeAsString}" />
+ </f:facet>
+
+ <f:facet name="finish">
+ <h:outputText value="finish ~ #{progressBarBean.currentTimeAsString}" />
+ </f:facet>
+ </rich:progressBar>
+
+ Current value: <h:panelGroup id="currentValue">#{progressBarBean.value}</h:panelGroup>
+ <br />
+ <a4j:commandLink value="-5" action="#{progressBarBean.decreaseValueByFive}" render="currentValue" />
+
+ <h:outputText value=" / " />
+
+ <a4j:commandLink value="+5" action="#{progressBarBean.increaseValueByFive}" render="currentValue" />
+
+ <h:outputText value=" / " />
+
+ <a4j:commandLink value="re-render progress bar" render="progressBar" />
+ </h:form>
</ui:define>
</ui:composition>
-
+
Modified: branches/RF-8742-1/examples/output-demo/src/main/webapp/resources/PanelMenu.js
===================================================================
--- branches/RF-8742-1/examples/output-demo/src/main/webapp/resources/PanelMenu.js 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/examples/output-demo/src/main/webapp/resources/PanelMenu.js 2010-11-29 18:01:15 UTC (rev 20208)
@@ -48,6 +48,7 @@
this.options = $.extend({}, __DEFAULT_OPTIONS, options || {});
this.activeItem = this.__getValueInput().value;
+ this.nestingLevel = 0;
var menuGroup = this;
if (menuGroup.options.expandSingle) {
@@ -178,12 +179,14 @@
/***************************** Private Methods ****************************************************************/
+
+
__panelMenu : function () {
return $(rf.getDomElement(this.id));
},
__childGroups : function () {
- return this.__panelMenu().children(".rf-pm-gr")
+ return this.__panelMenu().children(".rf-pm-top-gr")
},
/**
Modified: branches/RF-8742-1/examples/output-demo/src/main/webapp/resources/PanelMenuGroup.js
===================================================================
--- branches/RF-8742-1/examples/output-demo/src/main/webapp/resources/PanelMenuGroup.js 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/examples/output-demo/src/main/webapp/resources/PanelMenuGroup.js 2010-11-29 18:01:15 UTC (rev 20208)
@@ -254,14 +254,6 @@
},
/***************************** Private Methods ****************************************************************/
- __parentGroup : function () {
- var parentGroup = this.__group().parents(".rf-pm-gr")[0];
- if (parentGroup) {
- return parentGroup;
- }
- return this.__panelMenu();
- },
-
__childGroups : function () {
return this.__content().children(".rf-pm-gr")
},
@@ -304,7 +296,7 @@
__changeState : function () {
var state = {};
- state["expanded"] = this.__setExpandValue(this.__getExpandValue());
+ state["expanded"] = this.__setExpandValue(!this.__getExpandValue());
if (this.options.selectable) {
state["itemName"] = this.__rfPanelMenu().selectedItem(this.itemName); // TODO bad function name for function which change component state
}
Modified: branches/RF-8742-1/examples/output-demo/src/main/webapp/resources/PanelMenuItem.js
===================================================================
--- branches/RF-8742-1/examples/output-demo/src/main/webapp/resources/PanelMenuItem.js 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/examples/output-demo/src/main/webapp/resources/PanelMenuItem.js 2010-11-29 18:01:15 UTC (rev 20208)
@@ -31,7 +31,8 @@
mode: "client",
unselectable: false,
highlight: true,
- stylePrefix: "rf-pm-itm"
+ stylePrefix: "rf-pm-itm",
+ itemStep: 20
};
var SELECT_ITEM = {
@@ -157,6 +158,11 @@
}
}
+ item = this;
+ $(this.__panelMenu()).ready(function () {
+ item.__renderNestingLevel();
+ });
+
this.__addUserEventHandler("select");
},
@@ -212,6 +218,36 @@
},
/***************************** Private Methods ****************************************************************/
+ __rfParentItem : function () {
+ var res = this.__item().parents(".rf-pm-gr")[0];
+ if (!res) {
+ res = this.__item().parents(".rf-pm-top-gr")[0];
+ }
+
+ if (!res) {
+ res = this.__panelMenu();
+ }
+
+ return res ? rf.$(res) : null;
+ },
+
+ __getNestingLevel : function () {
+ if (!this.nestingLevel) {
+ var parentItem = this.__rfParentItem();
+ if (parentItem && parentItem.__getNestingLevel) {
+ this.nestingLevel = parentItem.__getNestingLevel() + 1;
+ } else {
+ this.nestingLevel = 0;
+ }
+ }
+
+ return this.nestingLevel;
+ },
+
+ __renderNestingLevel : function () {
+ this.__item().find("td").first().css("padding-left", this.options.itemStep * this.__getNestingLevel());
+ },
+
__panelMenu : function () {
return this.__item().parents(".rf-pm")[0];
},
Modified: branches/RF-8742-1/examples/output-demo/src/main/webapp/templates/template.xhtml
===================================================================
--- branches/RF-8742-1/examples/output-demo/src/main/webapp/templates/template.xhtml 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/examples/output-demo/src/main/webapp/templates/template.xhtml 2010-11-29 18:01:15 UTC (rev 20208)
@@ -10,6 +10,7 @@
</title>
<meta http-equiv="content-type" content="text/xhtml; charset=UTF-8" />
+ <h:outputScript library="javax.faces" name="jsf.js" target="head" />
</h:head>
<h:body>
Modified: branches/RF-8742-1/examples/push-demo/src/main/webapp/WEB-INF/web.xml
===================================================================
--- branches/RF-8742-1/examples/push-demo/src/main/webapp/WEB-INF/web.xml 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/examples/push-demo/src/main/webapp/WEB-INF/web.xml 2010-11-29 18:01:15 UTC (rev 20208)
@@ -12,17 +12,16 @@
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
-
- <filter-mapping>
- <filter-name>PushFilter</filter-name>
- <url-pattern>/faces/*</url-pattern>
- </filter-mapping>
-
<filter>
<filter-name>PushFilter</filter-name>
<filter-class>org.richfaces.webapp.PushFilter</filter-class>
<async-supported>true</async-supported>
</filter>
+
+ <filter-mapping>
+ <filter-name>PushFilter</filter-name>
+ <url-pattern>/faces/*</url-pattern>
+ </filter-mapping>
<!-- context-param>
<param-name>org.atmosphere.useWebSocket</param-name>
Modified: branches/RF-8742-1/examples/richfaces-showcase/src/main/webapp/templates/main.xhtml
===================================================================
--- branches/RF-8742-1/examples/richfaces-showcase/src/main/webapp/templates/main.xhtml 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/examples/richfaces-showcase/src/main/webapp/templates/main.xhtml 2010-11-29 18:01:15 UTC (rev 20208)
@@ -12,17 +12,15 @@
<title>Components Gallery</title>
<script type="text/javascript">
var _gaq = _gaq || [];
- _gaq.push(['_setAccount', 'UA-7306415-3']);
+ _gaq.push(['_setAccount', 'UA-7306415-4']);
_gaq.push(['_trackPageview']);
+
(function() {
- if (window.location.hostname.indexOf("appspot.com") != -1) {
- var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
- ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
- }
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
-
-</script>
+</script>
</h:head>
<h:body>
<h:outputStylesheet library="org.richfaces.showcase" name="page.ecss" />
Modified: branches/RF-8742-1/examples/richfaces-showcase/src/main/webapp-gae/WEB-INF/appengine-web.xml
===================================================================
--- branches/RF-8742-1/examples/richfaces-showcase/src/main/webapp-gae/WEB-INF/appengine-web.xml 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/examples/richfaces-showcase/src/main/webapp-gae/WEB-INF/appengine-web.xml 2010-11-29 18:01:15 UTC (rev 20208)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
- <application>richfaces-showcase-gae</application>
+ <application>richfaces-showcase</application>
<version>11</version>
<sessions-enabled>true</sessions-enabled>
Modified: branches/RF-8742-1/examples/richfaces-showcase/src/main/webapp-gae/WEB-INF/web.xml
===================================================================
--- branches/RF-8742-1/examples/richfaces-showcase/src/main/webapp-gae/WEB-INF/web.xml 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/examples/richfaces-showcase/src/main/webapp-gae/WEB-INF/web.xml 2010-11-29 18:01:15 UTC (rev 20208)
@@ -30,7 +30,7 @@
</context-param>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
- <param-value>Development</param-value>
+ <param-value>Production</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
Modified: branches/RF-8742-1/examples/validator-demo/src/main/java/org/richfaces/example/Bean.java
===================================================================
--- branches/RF-8742-1/examples/validator-demo/src/main/java/org/richfaces/example/Bean.java 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/examples/validator-demo/src/main/java/org/richfaces/example/Bean.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -24,8 +24,6 @@
import javax.validation.constraints.Pattern;
-
-
/**
* JSF bean with text property validation.
*/
Modified: branches/RF-8742-1/ui/common/ui/src/main/java/org/richfaces/renderkit/RendererBase.java
===================================================================
--- branches/RF-8742-1/ui/common/ui/src/main/java/org/richfaces/renderkit/RendererBase.java 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/ui/common/ui/src/main/java/org/richfaces/renderkit/RendererBase.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -151,8 +151,6 @@
component.getClass().getName()));
}
- preEncodeBegin(context, component);
-
if (component.isRendered()) {
ResponseWriter writer = context.getResponseWriter();
Modified: branches/RF-8742-1/ui/core/ui/src/main/java/org/richfaces/view/facelets/tag/BehaviorRule.java
===================================================================
--- branches/RF-8742-1/ui/core/ui/src/main/java/org/richfaces/view/facelets/tag/BehaviorRule.java 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/ui/core/ui/src/main/java/org/richfaces/view/facelets/tag/BehaviorRule.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -29,8 +29,6 @@
import javax.faces.view.facelets.TagAttribute;
import org.ajax4jsf.component.behavior.ClientBehavior;
-import org.richfaces.log.RichfacesLogger;
-import org.richfaces.log.Logger;
/**
* @author Anton Belevich
@@ -40,8 +38,6 @@
public static final BehaviorRule INSTANCE = new BehaviorRule();
- private static Logger log = RichfacesLogger.CONNECTION.getLogger();
-
static final class LiteralAttributeMetadata extends Metadata {
private final String name;
@@ -80,23 +76,14 @@
@Override
public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
if (meta.isTargetInstanceOf(ClientBehavior.class)) {
-
if (!attribute.isLiteral()) {
Class<?> type = meta.getPropertyType(name);
if (type == null) {
type = Object.class;
}
-
return new ValueExpressionMetadata(name, type, attribute);
- } else if (meta != null && meta.getWriteMethod(name) == null) {
-
- if (log.isDebugEnabled()) {
- log
- .debug(attribute + " Property '" + name + "' is not on type: "
- + meta.getTargetClass().getName());
- }
-
+ } else {
return new LiteralAttributeMetadata(name, attribute.getValue());
}
}
Copied: branches/RF-8742-1/ui/input/api/src/main/java/org/richfaces/event/MethodExpressionCurrentDateChangeListener.java (from rev 20206, trunk/ui/input/api/src/main/java/org/richfaces/event/MethodExpressionCurrentDateChangeListener.java)
===================================================================
--- branches/RF-8742-1/ui/input/api/src/main/java/org/richfaces/event/MethodExpressionCurrentDateChangeListener.java (rev 0)
+++ branches/RF-8742-1/ui/input/api/src/main/java/org/richfaces/event/MethodExpressionCurrentDateChangeListener.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+package org.richfaces.event;
+
+import javax.el.MethodExpression;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author amarkhel
+ *
+ */
+public class MethodExpressionCurrentDateChangeListener implements CurrentDateChangeListener {
+
+ private MethodExpression methodExpression;
+
+ public MethodExpressionCurrentDateChangeListener() {
+ super();
+ }
+
+ public MethodExpressionCurrentDateChangeListener(MethodExpression methodExpression) {
+ super();
+ this.methodExpression = methodExpression;
+ }
+
+ public void processCurrentDateChange(CurrentDateChangeEvent event) {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ methodExpression.invoke(facesContext.getELContext(), new Object[] { event });
+ }
+}
Modified: branches/RF-8742-1/ui/input/ui/src/main/java/org/richfaces/component/AbstractCalendar.java
===================================================================
--- branches/RF-8742-1/ui/input/ui/src/main/java/org/richfaces/component/AbstractCalendar.java 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/ui/input/ui/src/main/java/org/richfaces/component/AbstractCalendar.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -27,6 +27,7 @@
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.TimeZone;
@@ -68,7 +69,7 @@
*
*/
-@JsfComponent(type = AbstractCalendar.COMPONENT_TYPE, family = AbstractCalendar.COMPONENT_FAMILY, generate = "org.richfaces.component.UICalendar", renderer = @JsfRenderer(type = "org.richfaces.CalendarRenderer"), tag = @Tag(name = "calendar"))
+@JsfComponent(type = AbstractCalendar.COMPONENT_TYPE, family = AbstractCalendar.COMPONENT_FAMILY, generate = "org.richfaces.component.UICalendar", renderer = @JsfRenderer(type = "org.richfaces.CalendarRenderer"), tag = @Tag(name = "calendar", handler="org.richfaces.view.facelets.CalendarHandler"))
public abstract class AbstractCalendar extends UIInput implements MetaComponentResolver, MetaComponentEncoder {
public static final String DAYSDATA_META_COMPONENT_ID = "daysData";
@@ -375,7 +376,7 @@
addFacesListener(listener);
}
- public void removeToggleListener(CurrentDateChangeListener listener) {
+ public void removeCurrentDateChangeListener(CurrentDateChangeListener listener) {
removeFacesListener(listener);
}
@@ -478,21 +479,49 @@
@Override
public boolean visitTree(VisitContext context, VisitCallback callback) {
- if (context instanceof ExtendedVisitContext) {
- ExtendedVisitContext extendedVisitContext = (ExtendedVisitContext) context;
- if (extendedVisitContext.getVisitMode() == ExtendedVisitContextMode.RENDER) {
+ if (!isVisitable(context)) {
+ return false;
+ }
- VisitResult result = extendedVisitContext.invokeMetaComponentVisitCallback(this, callback,
- DAYSDATA_META_COMPONENT_ID);
- if (result == VisitResult.COMPLETE) {
- return true;
- } else if (result == VisitResult.REJECT) {
- return false;
+ FacesContext facesContext = context.getFacesContext();
+ pushComponentToEL(facesContext, null);
+
+ try {
+ VisitResult result = context.invokeVisitCallback(this, callback);
+
+ if (result == VisitResult.COMPLETE) {
+ return true;
+ }
+
+ if (result == VisitResult.ACCEPT) {
+ if (context instanceof ExtendedVisitContext) {
+ ExtendedVisitContext extendedVisitContext = (ExtendedVisitContext) context;
+ if (extendedVisitContext.getVisitMode() == ExtendedVisitContextMode.RENDER) {
+
+ result = extendedVisitContext.invokeMetaComponentVisitCallback(this, callback, DAYSDATA_META_COMPONENT_ID);
+ if (result == VisitResult.COMPLETE) {
+ return true;
+ }
+ }
}
}
+
+ if (result == VisitResult.ACCEPT) {
+ Iterator<UIComponent> kids = this.getFacetsAndChildren();
+
+ while(kids.hasNext()) {
+ boolean done = kids.next().visitTree(context, callback);
+
+ if (done) {
+ return true;
+ }
+ }
+ }
+ } finally {
+ popComponentFromEL(facesContext);
}
- return super.visitTree(context, callback);
+ return false;
}
public void encodeMetaComponent(FacesContext context, String metaComponentId) throws IOException {
Copied: branches/RF-8742-1/ui/input/ui/src/main/java/org/richfaces/view/facelets/CalendarHandler.java (from rev 20206, trunk/ui/input/ui/src/main/java/org/richfaces/view/facelets/CalendarHandler.java)
===================================================================
--- branches/RF-8742-1/ui/input/ui/src/main/java/org/richfaces/view/facelets/CalendarHandler.java (rev 0)
+++ branches/RF-8742-1/ui/input/ui/src/main/java/org/richfaces/view/facelets/CalendarHandler.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -0,0 +1,82 @@
+/*
+ * 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.view.facelets;
+
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.MetaRule;
+import javax.faces.view.facelets.MetaRuleset;
+import javax.faces.view.facelets.Metadata;
+import javax.faces.view.facelets.MetadataTarget;
+import javax.faces.view.facelets.TagAttribute;
+
+import org.richfaces.component.AbstractCalendar;
+import org.richfaces.event.MethodExpressionCurrentDateChangeListener;
+
+/**
+ * @author amarkhel
+ *
+ */
+public class CalendarHandler extends ComponentHandler {
+
+ private static final CalendarHandlerMetaRule METARULE = new CalendarHandlerMetaRule();
+
+ public CalendarHandler(ComponentConfig config) {
+ super(config);
+ }
+
+ protected MetaRuleset createMetaRuleset(Class type) {
+ MetaRuleset m = super.createMetaRuleset(type);
+ m.addRule(METARULE);
+ return m;
+ }
+
+ static class CalendarHandlerMetaRule extends MetaRule {
+
+ public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
+ if (meta.isTargetInstanceOf(AbstractCalendar.class) && "currentDataChangeListener".equals(name)) {
+ return new CalendarMapper(attribute);
+ }
+ return null;
+ }
+
+ }
+
+ static class CalendarMapper extends Metadata {
+
+ private static final Class[] SIGNATURE = new Class[] { org.richfaces.event.CurrentDateChangeListener.class };
+
+ private final TagAttribute attribute;
+
+ public CalendarMapper(TagAttribute attribute) {
+ this.attribute = attribute;
+ }
+
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ ((AbstractCalendar) instance).addCurrentDateChangeListener((new MethodExpressionCurrentDateChangeListener(
+ this.attribute.getMethodExpression(ctx, null, SIGNATURE))));
+ }
+ }
+}
Copied: branches/RF-8742-1/ui/input/ui/src/test/java/org/richfaces/component (from rev 20206, trunk/ui/input/ui/src/test/java/org/richfaces/component)
Deleted: branches/RF-8742-1/ui/input/ui/src/test/java/org/richfaces/component/CalendarBean.java
===================================================================
--- trunk/ui/input/ui/src/test/java/org/richfaces/component/CalendarBean.java 2010-11-29 14:35:51 UTC (rev 20206)
+++ branches/RF-8742-1/ui/input/ui/src/test/java/org/richfaces/component/CalendarBean.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -1,100 +0,0 @@
-package org.richfaces.component;
-
-import java.util.Calendar;
-import java.util.Date;
-import java.util.Locale;
-
-import javax.faces.event.ValueChangeEvent;
-
-public class CalendarBean {
-
- public static int CURRENT_YEAR = 2010;
- public static int CURRENT_MONTH = 10;
- public static int CURRENT_DAY = 16;
-
- private Locale locale;
- private boolean popup;
- private String pattern;
- private Date selectedDate = null;
- private boolean showApply = true;
- private boolean useCustomDayLabels;
- private String mode;
-
- public CalendarBean() {
-
- locale = Locale.US;
- popup = true;
- pattern = "d/M/yy HH:mm";
- mode = "client";
-
- Calendar calendar = Calendar.getInstance();
- calendar.set(CURRENT_YEAR, CURRENT_MONTH, CURRENT_DAY, 0, 0, 0);
- selectedDate = calendar.getTime();
- }
-
- public String getMode() {
- return mode;
- }
-
- public void setMode(String mode) {
- this.mode = mode;
- }
-
- public Locale getLocale() {
- return locale;
- }
-
- public void setLocale(Locale locale) {
- this.locale = locale;
- }
-
- public boolean isPopup() {
- return popup;
- }
-
- public void setPopup(boolean popup) {
- this.popup = popup;
- }
-
- public String getPattern() {
- return pattern;
- }
-
- public void setPattern(String pattern) {
- this.pattern = pattern;
- }
-
- public void selectLocale(ValueChangeEvent event) {
-
- String tLocale = (String) event.getNewValue();
- if (tLocale != null) {
- String lang = tLocale.substring(0, 2);
- String country = tLocale.substring(3);
- locale = new Locale(lang, country, "");
- }
- }
-
- public boolean isUseCustomDayLabels() {
- return useCustomDayLabels;
- }
-
- public void setUseCustomDayLabels(boolean useCustomDayLabels) {
- this.useCustomDayLabels = useCustomDayLabels;
- }
-
- public Date getSelectedDate() {
- return selectedDate;
- }
-
- public void setSelectedDate(Date selectedDate) {
- this.selectedDate = selectedDate;
- }
-
- public boolean isShowApply() {
- return showApply;
- }
-
- public void setShowApply(boolean showApply) {
- this.showApply = showApply;
- }
-}
\ No newline at end of file
Copied: branches/RF-8742-1/ui/input/ui/src/test/java/org/richfaces/component/CalendarBean.java (from rev 20206, trunk/ui/input/ui/src/test/java/org/richfaces/component/CalendarBean.java)
===================================================================
--- branches/RF-8742-1/ui/input/ui/src/test/java/org/richfaces/component/CalendarBean.java (rev 0)
+++ branches/RF-8742-1/ui/input/ui/src/test/java/org/richfaces/component/CalendarBean.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -0,0 +1,100 @@
+package org.richfaces.component;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Locale;
+
+import javax.faces.event.ValueChangeEvent;
+
+public class CalendarBean {
+
+ public static int CURRENT_YEAR = 2010;
+ public static int CURRENT_MONTH = 10;
+ public static int CURRENT_DAY = 16;
+
+ private Locale locale;
+ private boolean popup;
+ private String pattern;
+ private Date selectedDate = null;
+ private boolean showApply = true;
+ private boolean useCustomDayLabels;
+ private String mode;
+
+ public CalendarBean() {
+
+ locale = Locale.US;
+ popup = true;
+ pattern = "d/M/yy HH:mm";
+ mode = "client";
+
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(CURRENT_YEAR, CURRENT_MONTH, CURRENT_DAY, 0, 0, 0);
+ selectedDate = calendar.getTime();
+ }
+
+ public String getMode() {
+ return mode;
+ }
+
+ public void setMode(String mode) {
+ this.mode = mode;
+ }
+
+ public Locale getLocale() {
+ return locale;
+ }
+
+ public void setLocale(Locale locale) {
+ this.locale = locale;
+ }
+
+ public boolean isPopup() {
+ return popup;
+ }
+
+ public void setPopup(boolean popup) {
+ this.popup = popup;
+ }
+
+ public String getPattern() {
+ return pattern;
+ }
+
+ public void setPattern(String pattern) {
+ this.pattern = pattern;
+ }
+
+ public void selectLocale(ValueChangeEvent event) {
+
+ String tLocale = (String) event.getNewValue();
+ if (tLocale != null) {
+ String lang = tLocale.substring(0, 2);
+ String country = tLocale.substring(3);
+ locale = new Locale(lang, country, "");
+ }
+ }
+
+ public boolean isUseCustomDayLabels() {
+ return useCustomDayLabels;
+ }
+
+ public void setUseCustomDayLabels(boolean useCustomDayLabels) {
+ this.useCustomDayLabels = useCustomDayLabels;
+ }
+
+ public Date getSelectedDate() {
+ return selectedDate;
+ }
+
+ public void setSelectedDate(Date selectedDate) {
+ this.selectedDate = selectedDate;
+ }
+
+ public boolean isShowApply() {
+ return showApply;
+ }
+
+ public void setShowApply(boolean showApply) {
+ this.showApply = showApply;
+ }
+}
\ No newline at end of file
Deleted: branches/RF-8742-1/ui/input/ui/src/test/java/org/richfaces/component/CalendarDataModelImpl.java
===================================================================
--- trunk/ui/input/ui/src/test/java/org/richfaces/component/CalendarDataModelImpl.java 2010-11-29 14:35:51 UTC (rev 20206)
+++ branches/RF-8742-1/ui/input/ui/src/test/java/org/richfaces/component/CalendarDataModelImpl.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -1,64 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.component;
-
-import java.util.Date;
-
-import javax.faces.bean.ApplicationScoped;
-import javax.faces.bean.ManagedBean;
-
-import org.richfaces.model.CalendarDataModel;
-import org.richfaces.model.CalendarDataModelItem;
-
-/**
- * @author Nick Belaevski - mailto:nbelaevski@exadel.com
- * created 30.06.2007
- *
- */
-@ManagedBean(name="calendarDataModel")
-@ApplicationScoped
-public class CalendarDataModelImpl implements CalendarDataModel {
-
- /* (non-Javadoc)
- * @see org.richfaces.component.CalendarDataModel#getData(java.util.Date[])
- */
- public CalendarDataModelItem[] getData(Date[] dateArray) {
- if (dateArray == null) {
- return null;
- }
-
- CalendarDataModelItem[] items = new CalendarDataModelItem[dateArray.length];
- for (int i = 0; i < dateArray.length; i++) {
- items[i] = createDataModelItem(dateArray[i]);
- }
-
- return items;
- }
-
- protected CalendarDataModelItem createDataModelItem(Date date) {
- CalendarDataModelItemImpl item = new CalendarDataModelItemImpl();
-
- item.setEnabled(false);
-
- return item;
- }
-}
Copied: branches/RF-8742-1/ui/input/ui/src/test/java/org/richfaces/component/CalendarDataModelImpl.java (from rev 20206, trunk/ui/input/ui/src/test/java/org/richfaces/component/CalendarDataModelImpl.java)
===================================================================
--- branches/RF-8742-1/ui/input/ui/src/test/java/org/richfaces/component/CalendarDataModelImpl.java (rev 0)
+++ branches/RF-8742-1/ui/input/ui/src/test/java/org/richfaces/component/CalendarDataModelImpl.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -0,0 +1,64 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+import java.util.Date;
+
+import javax.faces.bean.ApplicationScoped;
+import javax.faces.bean.ManagedBean;
+
+import org.richfaces.model.CalendarDataModel;
+import org.richfaces.model.CalendarDataModelItem;
+
+/**
+ * @author Nick Belaevski - mailto:nbelaevski@exadel.com
+ * created 30.06.2007
+ *
+ */
+@ManagedBean(name="calendarDataModel")
+@ApplicationScoped
+public class CalendarDataModelImpl implements CalendarDataModel {
+
+ /* (non-Javadoc)
+ * @see org.richfaces.component.CalendarDataModel#getData(java.util.Date[])
+ */
+ public CalendarDataModelItem[] getData(Date[] dateArray) {
+ if (dateArray == null) {
+ return null;
+ }
+
+ CalendarDataModelItem[] items = new CalendarDataModelItem[dateArray.length];
+ for (int i = 0; i < dateArray.length; i++) {
+ items[i] = createDataModelItem(dateArray[i]);
+ }
+
+ return items;
+ }
+
+ protected CalendarDataModelItem createDataModelItem(Date date) {
+ CalendarDataModelItemImpl item = new CalendarDataModelItemImpl();
+
+ item.setEnabled(false);
+
+ return item;
+ }
+}
Deleted: branches/RF-8742-1/ui/input/ui/src/test/java/org/richfaces/component/CalendarDataModelItemImpl.java
===================================================================
--- trunk/ui/input/ui/src/test/java/org/richfaces/component/CalendarDataModelItemImpl.java 2010-11-29 14:35:51 UTC (rev 20206)
+++ branches/RF-8742-1/ui/input/ui/src/test/java/org/richfaces/component/CalendarDataModelItemImpl.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -1,58 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.component;
-
-import org.richfaces.model.CalendarDataModelItem;
-
-/**
- * @author Nick Belaevski - mailto:nbelaevski@exadel.com
- * created 04.07.2007
- *
- */
-public class CalendarDataModelItemImpl implements CalendarDataModelItem {
-
- private boolean enabled = true;
- private String styleClass = "";
-
-
- /* (non-Javadoc)
- * @see org.richfaces.component.CalendarDataModelItem#isEnabled()
- */
- public boolean isEnabled() {
- return enabled;
- }
-
- /**
- * @param enabled the enabled to set
- */
- public void setEnabled(boolean enabled) {
- this.enabled = enabled;
- }
-
- public String getStyleClass() {
- return styleClass;
- }
-
- public void setStyleClass(String styleClass) {
- this.styleClass = styleClass;
- }
-}
Copied: branches/RF-8742-1/ui/input/ui/src/test/java/org/richfaces/component/CalendarDataModelItemImpl.java (from rev 20206, trunk/ui/input/ui/src/test/java/org/richfaces/component/CalendarDataModelItemImpl.java)
===================================================================
--- branches/RF-8742-1/ui/input/ui/src/test/java/org/richfaces/component/CalendarDataModelItemImpl.java (rev 0)
+++ branches/RF-8742-1/ui/input/ui/src/test/java/org/richfaces/component/CalendarDataModelItemImpl.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -0,0 +1,58 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+import org.richfaces.model.CalendarDataModelItem;
+
+/**
+ * @author Nick Belaevski - mailto:nbelaevski@exadel.com
+ * created 04.07.2007
+ *
+ */
+public class CalendarDataModelItemImpl implements CalendarDataModelItem {
+
+ private boolean enabled = true;
+ private String styleClass = "";
+
+
+ /* (non-Javadoc)
+ * @see org.richfaces.component.CalendarDataModelItem#isEnabled()
+ */
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ /**
+ * @param enabled the enabled to set
+ */
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ }
+
+ public String getStyleClass() {
+ return styleClass;
+ }
+
+ public void setStyleClass(String styleClass) {
+ this.styleClass = styleClass;
+ }
+}
Deleted: branches/RF-8742-1/ui/input/ui/src/test/java/org/richfaces/component/CalendarRenderTest.java
===================================================================
--- trunk/ui/input/ui/src/test/java/org/richfaces/component/CalendarRenderTest.java 2010-11-29 14:35:51 UTC (rev 20206)
+++ branches/RF-8742-1/ui/input/ui/src/test/java/org/richfaces/component/CalendarRenderTest.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -1,91 +0,0 @@
-package org.richfaces.component;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.net.URISyntaxException;
-import java.util.Calendar;
-import java.util.List;
-import java.util.Locale;
-
-import org.jboss.test.faces.htmlunit.HtmlUnitEnvironment;
-import org.junit.Assert;
-import org.junit.Test;
-import org.richfaces.renderkit.html.RendererTestBase;
-
-import com.gargoylesoftware.htmlunit.html.HtmlElement;
-import com.gargoylesoftware.htmlunit.html.HtmlImage;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-import com.gargoylesoftware.htmlunit.html.HtmlTableDataCell;
-
-public class CalendarRenderTest extends RendererTestBase {
-
- @Override
- public void setUp() throws URISyntaxException {
- environment = new HtmlUnitEnvironment();
- environment.withWebRoot(new File(this.getClass().getResource(".").toURI()));
- environment.withResource("/WEB-INF/faces-config.xml", "org/richfaces/component/faces-config.xml");
- environment.start();
- }
-
- @Test
- public void testExistenceCalendarPopup() throws Exception {
- HtmlPage page = environment.getPage("/calendarTest.jsf");
- HtmlElement calendarPopupElement = page.getElementById("form:calendarPopup");
- Assert.assertNotNull("form:calendarPopup element missed.", calendarPopupElement);
- }
-
- @Test
- public void testExistenceCalendarContent() throws Exception {
- HtmlPage page = environment.getPage("/calendarTest.jsf");
- HtmlElement calendarContentElement = page.getElementById("form:calendarContent");
- Assert.assertNotNull("form:calendarContent element missed.", calendarContentElement);
- }
-
- @Test
- public void testRenderCalendarScript() throws Exception {
- doTest("calendarTest", "calendarScript", "form:calendarScript");
- }
-
- @Test
- public void testRenderCalendarContent() throws Exception {
- doTest("calendarTest", "calendarContent", "form:calendarContent");
- }
-
- @Test
- public void testCalendarScrolling() throws Exception {
- HtmlPage page = environment.getPage("/calendarTest.jsf");
-
- HtmlImage calendarPopupButton = (HtmlImage) page.getElementById("form:calendarPopupButton");
- assertNotNull(calendarPopupButton);
- page = (HtmlPage) calendarPopupButton.click();
- HtmlElement calendarHeaderElement = page.getElementById("form:calendarHeader");
- assertNotNull("form:calendarHeader element missed.", calendarHeaderElement);
-
- HtmlTableDataCell nextTD = null;
- List<?> tds = calendarHeaderElement.getByXPath("table/tbody/tr/td");
- for (Object td : tds)
- {
- HtmlTableDataCell htdc = (HtmlTableDataCell) td;
- if (">".equals(htdc.asText())) {
- nextTD = htdc;
- }
- }
- assertNotNull(nextTD);
- HtmlElement div = nextTD.getChildElements().iterator().next();
-
- //Before click
- Calendar calendar = Calendar.getInstance();
- calendar.set(CalendarBean.CURRENT_YEAR, CalendarBean.CURRENT_MONTH, CalendarBean.CURRENT_DAY);
- String month = calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.US);
- assertTrue(calendarHeaderElement.asText().indexOf(month) > -1);
-
- page = div.click();
-
- //After click
- calendar.add(Calendar.MONTH, 1);
- month = calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.US);
- assertTrue(calendarHeaderElement.asText().indexOf(month) > -1);
- }
-}
Copied: branches/RF-8742-1/ui/input/ui/src/test/java/org/richfaces/component/CalendarRenderTest.java (from rev 20206, trunk/ui/input/ui/src/test/java/org/richfaces/component/CalendarRenderTest.java)
===================================================================
--- branches/RF-8742-1/ui/input/ui/src/test/java/org/richfaces/component/CalendarRenderTest.java (rev 0)
+++ branches/RF-8742-1/ui/input/ui/src/test/java/org/richfaces/component/CalendarRenderTest.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -0,0 +1,91 @@
+package org.richfaces.component;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.net.URISyntaxException;
+import java.util.Calendar;
+import java.util.List;
+import java.util.Locale;
+
+import org.jboss.test.faces.htmlunit.HtmlUnitEnvironment;
+import org.junit.Assert;
+import org.junit.Test;
+import org.richfaces.renderkit.html.RendererTestBase;
+
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlImage;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlTableDataCell;
+
+public class CalendarRenderTest extends RendererTestBase {
+
+ @Override
+ public void setUp() throws URISyntaxException {
+ environment = new HtmlUnitEnvironment();
+ environment.withWebRoot(new File(this.getClass().getResource(".").toURI()));
+ environment.withResource("/WEB-INF/faces-config.xml", "org/richfaces/component/faces-config.xml");
+ environment.start();
+ }
+
+ @Test
+ public void testExistenceCalendarPopup() throws Exception {
+ HtmlPage page = environment.getPage("/calendarTest.jsf");
+ HtmlElement calendarPopupElement = page.getElementById("form:calendarPopup");
+ Assert.assertNotNull("form:calendarPopup element missed.", calendarPopupElement);
+ }
+
+ @Test
+ public void testExistenceCalendarContent() throws Exception {
+ HtmlPage page = environment.getPage("/calendarTest.jsf");
+ HtmlElement calendarContentElement = page.getElementById("form:calendarContent");
+ Assert.assertNotNull("form:calendarContent element missed.", calendarContentElement);
+ }
+
+ @Test
+ public void testRenderCalendarScript() throws Exception {
+ doTest("calendarTest", "calendarScript", "form:calendarScript");
+ }
+
+ @Test
+ public void testRenderCalendarContent() throws Exception {
+ doTest("calendarTest", "calendarContent", "form:calendarContent");
+ }
+
+ @Test
+ public void testCalendarScrolling() throws Exception {
+ HtmlPage page = environment.getPage("/calendarTest.jsf");
+
+ HtmlImage calendarPopupButton = (HtmlImage) page.getElementById("form:calendarPopupButton");
+ assertNotNull(calendarPopupButton);
+ page = (HtmlPage) calendarPopupButton.click();
+ HtmlElement calendarHeaderElement = page.getElementById("form:calendarHeader");
+ assertNotNull("form:calendarHeader element missed.", calendarHeaderElement);
+
+ HtmlTableDataCell nextTD = null;
+ List<?> tds = calendarHeaderElement.getByXPath("table/tbody/tr/td");
+ for (Object td : tds)
+ {
+ HtmlTableDataCell htdc = (HtmlTableDataCell) td;
+ if (">".equals(htdc.asText())) {
+ nextTD = htdc;
+ }
+ }
+ assertNotNull(nextTD);
+ HtmlElement div = nextTD.getChildElements().iterator().next();
+
+ //Before click
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(CalendarBean.CURRENT_YEAR, CalendarBean.CURRENT_MONTH, CalendarBean.CURRENT_DAY);
+ String month = calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.US);
+ assertTrue(calendarHeaderElement.asText().indexOf(month) > -1);
+
+ page = div.click();
+
+ //After click
+ calendar.add(Calendar.MONTH, 1);
+ month = calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.US);
+ assertTrue(calendarHeaderElement.asText().indexOf(month) > -1);
+ }
+}
Copied: branches/RF-8742-1/ui/input/ui/src/test/resources/org/richfaces/component (from rev 20206, trunk/ui/input/ui/src/test/resources/org/richfaces/component)
Deleted: branches/RF-8742-1/ui/input/ui/src/test/resources/org/richfaces/component/calendarContent.xmlunit.xml
===================================================================
--- trunk/ui/input/ui/src/test/resources/org/richfaces/component/calendarContent.xmlunit.xml 2010-11-29 14:35:51 UTC (rev 20206)
+++ branches/RF-8742-1/ui/input/ui/src/test/resources/org/richfaces/component/calendarContent.xmlunit.xml 2010-11-29 18:01:15 UTC (rev 20208)
@@ -1,108 +0,0 @@
-<table id="form:calendarContent" border="0" cellpadding="0" cellspacing="0" class="rf-ca-extr rf-ca-popup undefined" style="display:none; position:absolute;z-index: 3;width:200px" onclick="RichFaces.$('form:calendar').skipEventOnCollapse=true;">
- <tbody>
- <tr>
- <td class="rf-ca-hdr" colspan="8" id="form:calendarHeader"/>
- </tr>
- <tr id="form:calendarWeekDay">
- <td class="rf-ca-days">
- <br/>
- </td>
- <td class="rf-ca-days rf-ca-weekends" id="form:calendarWeekDayCell0">
- Sun
- </td>
- <td class="rf-ca-days" id="form:calendarWeekDayCell1">
- Mon
- </td>
- <td class="rf-ca-days" id="form:calendarWeekDayCell2">
- Tue
- </td>
- <td class="rf-ca-days" id="form:calendarWeekDayCell3">
- Wed
- </td>
- <td class="rf-ca-days" id="form:calendarWeekDayCell4">
- Thu
- </td>
- <td class="rf-ca-days" id="form:calendarWeekDayCell5">
- Fri
- </td>
- <td class="rf-ca-days rf-ca-weekends rf-rgh-cell" id="form:calendarWeekDayCell6">
- Sat
- </td>
- </tr>
- <tr id="form:calendarWeekNum1">
- <td class="rf-ca-week " id="form:calendarWeekNumCell1">
- 1
- </td>
- <td class="rf-ca-c-size rf-ca-c rf-ca-holly" id="form:calendarDayCell0" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell1" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell2" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell3" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell4" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell5" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- <td class="rf-ca-c-size rf-ca-c rf-ca-holly rf-rgh-c" id="form:calendarDayCell6" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- </tr>
- <tr id="form:calendarWeekNum2">
- <td class="rf-ca-week " id="form:calendarWeekNumCell2">
- 2
- </td>
- <td class="rf-ca-c-size rf-ca-c rf-ca-holly" id="form:calendarDayCell7" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell8" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell9" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell10" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell11" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell12" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- <td class="rf-ca-c-size rf-ca-c rf-ca-holly rf-rgh-c" id="form:calendarDayCell13" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- </tr>
- <tr id="form:calendarWeekNum3">
- <td class="rf-ca-week " id="form:calendarWeekNumCell3">
- 3
- </td>
- <td class="rf-ca-c-size rf-ca-c rf-ca-holly" id="form:calendarDayCell14" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell15" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell16" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell17" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell18" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell19" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- <td class="rf-ca-c-size rf-ca-c rf-ca-holly rf-rgh-c" id="form:calendarDayCell20" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- </tr>
- <tr id="form:calendarWeekNum4">
- <td class="rf-ca-week " id="form:calendarWeekNumCell4">
- 4
- </td>
- <td class="rf-ca-c-size rf-ca-c rf-ca-holly" id="form:calendarDayCell21" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell22" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell23" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell24" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell25" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell26" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- <td class="rf-ca-c-size rf-ca-c rf-ca-holly rf-rgh-c" id="form:calendarDayCell27" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- </tr>
- <tr id="form:calendarWeekNum5">
- <td class="rf-ca-week " id="form:calendarWeekNumCell5">
- 5
- </td>
- <td class="rf-ca-c-size rf-ca-c rf-ca-holly" id="form:calendarDayCell28" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell29" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell30" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell31" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell32" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell33" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- <td class="rf-ca-c-size rf-ca-c rf-ca-holly rf-rgh-c" id="form:calendarDayCell34" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- </tr>
- <tr id="form:calendarWeekNum6">
- <td class="rf-ca-week rf-btm-c " id="form:calendarWeekNumCell6">
- 6
- </td>
- <td class="rf-btm-c rf-ca-c-size rf-ca-c rf-ca-holly" id="form:calendarDayCell35" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- <td class="rf-btm-c rf-ca-c-size rf-ca-c" id="form:calendarDayCell36" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- <td class="rf-btm-c rf-ca-c-size rf-ca-c" id="form:calendarDayCell37" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- <td class="rf-btm-c rf-ca-c-size rf-ca-c" id="form:calendarDayCell38" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- <td class="rf-btm-c rf-ca-c-size rf-ca-c" id="form:calendarDayCell39" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- <td class="rf-btm-c rf-ca-c-size rf-ca-c" id="form:calendarDayCell40" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- <td class="rf-btm-c rf-ca-c-size rf-ca-c rf-ca-holly rf-rgh-c" id="form:calendarDayCell41" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
- </tr>
- <tr>
- <td class="rf-ca-ftr" colspan="8" id="form:calendarFooter"/>
- </tr>
- </tbody>
-</table>
\ No newline at end of file
Copied: branches/RF-8742-1/ui/input/ui/src/test/resources/org/richfaces/component/calendarContent.xmlunit.xml (from rev 20206, trunk/ui/input/ui/src/test/resources/org/richfaces/component/calendarContent.xmlunit.xml)
===================================================================
--- branches/RF-8742-1/ui/input/ui/src/test/resources/org/richfaces/component/calendarContent.xmlunit.xml (rev 0)
+++ branches/RF-8742-1/ui/input/ui/src/test/resources/org/richfaces/component/calendarContent.xmlunit.xml 2010-11-29 18:01:15 UTC (rev 20208)
@@ -0,0 +1,108 @@
+<table id="form:calendarContent" border="0" cellpadding="0" cellspacing="0" class="rf-ca-extr rf-ca-popup undefined" style="display:none; position:absolute;z-index: 3;width:200px" onclick="RichFaces.$('form:calendar').skipEventOnCollapse=true;">
+ <tbody>
+ <tr>
+ <td class="rf-ca-hdr" colspan="8" id="form:calendarHeader"/>
+ </tr>
+ <tr id="form:calendarWeekDay">
+ <td class="rf-ca-days">
+ <br/>
+ </td>
+ <td class="rf-ca-days rf-ca-weekends" id="form:calendarWeekDayCell0">
+ Sun
+ </td>
+ <td class="rf-ca-days" id="form:calendarWeekDayCell1">
+ Mon
+ </td>
+ <td class="rf-ca-days" id="form:calendarWeekDayCell2">
+ Tue
+ </td>
+ <td class="rf-ca-days" id="form:calendarWeekDayCell3">
+ Wed
+ </td>
+ <td class="rf-ca-days" id="form:calendarWeekDayCell4">
+ Thu
+ </td>
+ <td class="rf-ca-days" id="form:calendarWeekDayCell5">
+ Fri
+ </td>
+ <td class="rf-ca-days rf-ca-weekends rf-rgh-cell" id="form:calendarWeekDayCell6">
+ Sat
+ </td>
+ </tr>
+ <tr id="form:calendarWeekNum1">
+ <td class="rf-ca-week " id="form:calendarWeekNumCell1">
+ 1
+ </td>
+ <td class="rf-ca-c-size rf-ca-c rf-ca-holly" id="form:calendarDayCell0" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell1" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell2" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell3" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell4" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell5" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c rf-ca-holly rf-rgh-c" id="form:calendarDayCell6" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ </tr>
+ <tr id="form:calendarWeekNum2">
+ <td class="rf-ca-week " id="form:calendarWeekNumCell2">
+ 2
+ </td>
+ <td class="rf-ca-c-size rf-ca-c rf-ca-holly" id="form:calendarDayCell7" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell8" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell9" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell10" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell11" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell12" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c rf-ca-holly rf-rgh-c" id="form:calendarDayCell13" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ </tr>
+ <tr id="form:calendarWeekNum3">
+ <td class="rf-ca-week " id="form:calendarWeekNumCell3">
+ 3
+ </td>
+ <td class="rf-ca-c-size rf-ca-c rf-ca-holly" id="form:calendarDayCell14" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell15" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell16" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell17" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell18" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell19" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c rf-ca-holly rf-rgh-c" id="form:calendarDayCell20" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ </tr>
+ <tr id="form:calendarWeekNum4">
+ <td class="rf-ca-week " id="form:calendarWeekNumCell4">
+ 4
+ </td>
+ <td class="rf-ca-c-size rf-ca-c rf-ca-holly" id="form:calendarDayCell21" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell22" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell23" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell24" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell25" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell26" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c rf-ca-holly rf-rgh-c" id="form:calendarDayCell27" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ </tr>
+ <tr id="form:calendarWeekNum5">
+ <td class="rf-ca-week " id="form:calendarWeekNumCell5">
+ 5
+ </td>
+ <td class="rf-ca-c-size rf-ca-c rf-ca-holly" id="form:calendarDayCell28" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell29" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell30" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell31" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell32" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell33" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c rf-ca-holly rf-rgh-c" id="form:calendarDayCell34" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ </tr>
+ <tr id="form:calendarWeekNum6">
+ <td class="rf-ca-week rf-btm-c " id="form:calendarWeekNumCell6">
+ 6
+ </td>
+ <td class="rf-btm-c rf-ca-c-size rf-ca-c rf-ca-holly" id="form:calendarDayCell35" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-btm-c rf-ca-c-size rf-ca-c" id="form:calendarDayCell36" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-btm-c rf-ca-c-size rf-ca-c" id="form:calendarDayCell37" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-btm-c rf-ca-c-size rf-ca-c" id="form:calendarDayCell38" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-btm-c rf-ca-c-size rf-ca-c" id="form:calendarDayCell39" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-btm-c rf-ca-c-size rf-ca-c" id="form:calendarDayCell40" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-btm-c rf-ca-c-size rf-ca-c rf-ca-holly rf-rgh-c" id="form:calendarDayCell41" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ </tr>
+ <tr>
+ <td class="rf-ca-ftr" colspan="8" id="form:calendarFooter"/>
+ </tr>
+ </tbody>
+</table>
\ No newline at end of file
Deleted: branches/RF-8742-1/ui/input/ui/src/test/resources/org/richfaces/component/calendarScript.xmlunit.xml
===================================================================
--- trunk/ui/input/ui/src/test/resources/org/richfaces/component/calendarScript.xmlunit.xml 2010-11-29 14:35:51 UTC (rev 20206)
+++ branches/RF-8742-1/ui/input/ui/src/test/resources/org/richfaces/component/calendarScript.xmlunit.xml 2010-11-29 18:01:15 UTC (rev 20208)
@@ -1,7 +0,0 @@
- <span id="form:calendarScript" style="display: none;">
- <script type="text/javascript">
-//<![CDATA[
-RichFaces.ui.Calendar.addLocale("en_US",{"monthLabels":["January","February","March","April","May","June","July","August","September","October","November","December"] ,"minDaysInFirstWeek":1,"monthLabelsShort":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"] ,"firstWeekDay":0,"weekDayLabels":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"] ,"weekDayLabelsShort":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"] } );new RichFaces.ui.Calendar("form:calendar","en_US",{"horizontalOffset":"0","showApplyButton":true,"showFooter":true,"selectedDate":new Date(2010,10,16,0,0,0),"verticalOffset":"0","datePattern":"d\/M\/yy HH:mm","direction":"AA","labels":{} ,"mode":"client","todayControlMode":"select","showWeeksBar":true,"resetTimeOnDateSelect":false,"style":"z\u002Dindex: 3;width:200px","showWeekDaysBar":true,"currentDate":new Date(2010,10,16),"showHeader":true,"popup":true,"enableManualInput":false,"showInput":true,"boundaryDatesMode":"ina!
ctive","disabled":false,"jointPoint":"AA","hidePopupOnScroll":"true"} ,"").load({"startDate":{"month":10,"year":2010} ,"days":[{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"sty!
leClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":fa!
lse,"sty
leClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ] } );
-//]]>
- </script>
- </span>
\ No newline at end of file
Copied: branches/RF-8742-1/ui/input/ui/src/test/resources/org/richfaces/component/calendarScript.xmlunit.xml (from rev 20206, trunk/ui/input/ui/src/test/resources/org/richfaces/component/calendarScript.xmlunit.xml)
===================================================================
--- branches/RF-8742-1/ui/input/ui/src/test/resources/org/richfaces/component/calendarScript.xmlunit.xml (rev 0)
+++ branches/RF-8742-1/ui/input/ui/src/test/resources/org/richfaces/component/calendarScript.xmlunit.xml 2010-11-29 18:01:15 UTC (rev 20208)
@@ -0,0 +1,7 @@
+ <span id="form:calendarScript" style="display: none;">
+ <script type="text/javascript">
+//<![CDATA[
+RichFaces.ui.Calendar.addLocale("en_US",{"monthLabels":["January","February","March","April","May","June","July","August","September","October","November","December"] ,"minDaysInFirstWeek":1,"monthLabelsShort":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"] ,"firstWeekDay":0,"weekDayLabels":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"] ,"weekDayLabelsShort":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"] } );new RichFaces.ui.Calendar("form:calendar","en_US",{"horizontalOffset":"0","showApplyButton":true,"showFooter":true,"selectedDate":new Date(2010,10,16,0,0,0),"verticalOffset":"0","datePattern":"d\/M\/yy HH:mm","direction":"AA","labels":{} ,"mode":"client","todayControlMode":"select","showWeeksBar":true,"resetTimeOnDateSelect":false,"style":"z\u002Dindex: 3;width:200px","showWeekDaysBar":true,"currentDate":new Date(2010,10,16),"showHeader":true,"popup":true,"enableManualInput":false,"showInput":true,"boundaryDatesMode":"ina!
ctive","disabled":false,"jointPoint":"AA","hidePopupOnScroll":"true"} ,"").load({"startDate":{"month":10,"year":2010} ,"days":[{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"sty!
leClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":fa!
lse,"sty
leClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ] } );
+//]]>
+ </script>
+ </span>
\ No newline at end of file
Deleted: branches/RF-8742-1/ui/input/ui/src/test/resources/org/richfaces/component/calendarTest.xhtml
===================================================================
--- trunk/ui/input/ui/src/test/resources/org/richfaces/component/calendarTest.xhtml 2010-11-29 14:35:51 UTC (rev 20206)
+++ branches/RF-8742-1/ui/input/ui/src/test/resources/org/richfaces/component/calendarTest.xhtml 2010-11-29 18:01:15 UTC (rev 20208)
@@ -1,29 +0,0 @@
-<!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:in="http://richfaces.org/input">
-<f:view contentType="text/html" />
-
-<h:head>
- <title>Richfaces Calendar</title>
-</h:head>
-
-<h:body>
- <h:form id="form">
- <in:calendar value="#{calendarBean.selectedDate}" id="calendar"
- locale="#{calendarBean.locale}" popup="#{calendarBean.popup}"
- datePattern="#{calendarBean.pattern}"
- dataModel="#{calendarDataModel}"
- mode="#{calendarBean.mode}"
- showHeader="true"
- currentDate="#{calendarBean.selectedDate}"
- showApplyButton="#{calendarBean.showApply}" cellWidth="24px"
- cellHeight="22px" style="width:200px">
- <f:convertDateTime pattern="#{calendarBean.pattern}"
- onchange="alert('1')" />
- </in:calendar>
- </h:form>
-</h:body>
-</html>
Copied: branches/RF-8742-1/ui/input/ui/src/test/resources/org/richfaces/component/calendarTest.xhtml (from rev 20206, trunk/ui/input/ui/src/test/resources/org/richfaces/component/calendarTest.xhtml)
===================================================================
--- branches/RF-8742-1/ui/input/ui/src/test/resources/org/richfaces/component/calendarTest.xhtml (rev 0)
+++ branches/RF-8742-1/ui/input/ui/src/test/resources/org/richfaces/component/calendarTest.xhtml 2010-11-29 18:01:15 UTC (rev 20208)
@@ -0,0 +1,29 @@
+<!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:in="http://richfaces.org/input">
+<f:view contentType="text/html" />
+
+<h:head>
+ <title>Richfaces Calendar</title>
+</h:head>
+
+<h:body>
+ <h:form id="form">
+ <in:calendar value="#{calendarBean.selectedDate}" id="calendar"
+ locale="#{calendarBean.locale}" popup="#{calendarBean.popup}"
+ datePattern="#{calendarBean.pattern}"
+ dataModel="#{calendarDataModel}"
+ mode="#{calendarBean.mode}"
+ showHeader="true"
+ currentDate="#{calendarBean.selectedDate}"
+ showApplyButton="#{calendarBean.showApply}" cellWidth="24px"
+ cellHeight="22px" style="width:200px">
+ <f:convertDateTime pattern="#{calendarBean.pattern}"
+ onchange="alert('1')" />
+ </in:calendar>
+ </h:form>
+</h:body>
+</html>
Deleted: branches/RF-8742-1/ui/input/ui/src/test/resources/org/richfaces/component/faces-config.xml
===================================================================
--- trunk/ui/input/ui/src/test/resources/org/richfaces/component/faces-config.xml 2010-11-29 14:35:51 UTC (rev 20206)
+++ branches/RF-8742-1/ui/input/ui/src/test/resources/org/richfaces/component/faces-config.xml 2010-11-29 18:01:15 UTC (rev 20208)
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<faces-config 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-facesconfig_2_0.xsd"
- version="2.0">
-
- <managed-bean>
- <managed-bean-name>calendarBean</managed-bean-name>
- <managed-bean-class>org.richfaces.component.CalendarBean</managed-bean-class>
- <managed-bean-scope>session</managed-bean-scope>
- </managed-bean>
- <managed-bean>
- <managed-bean-name>calendarDataModel</managed-bean-name>
- <managed-bean-class>org.richfaces.component.CalendarDataModelImpl</managed-bean-class>
- <managed-bean-scope>application</managed-bean-scope>
- </managed-bean>
-
-</faces-config>
\ No newline at end of file
Copied: branches/RF-8742-1/ui/input/ui/src/test/resources/org/richfaces/component/faces-config.xml (from rev 20206, trunk/ui/input/ui/src/test/resources/org/richfaces/component/faces-config.xml)
===================================================================
--- branches/RF-8742-1/ui/input/ui/src/test/resources/org/richfaces/component/faces-config.xml (rev 0)
+++ branches/RF-8742-1/ui/input/ui/src/test/resources/org/richfaces/component/faces-config.xml 2010-11-29 18:01:15 UTC (rev 20208)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<faces-config 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-facesconfig_2_0.xsd"
+ version="2.0">
+
+ <managed-bean>
+ <managed-bean-name>calendarBean</managed-bean-name>
+ <managed-bean-class>org.richfaces.component.CalendarBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>calendarDataModel</managed-bean-name>
+ <managed-bean-class>org.richfaces.component.CalendarDataModelImpl</managed-bean-class>
+ <managed-bean-scope>application</managed-bean-scope>
+ </managed-bean>
+
+</faces-config>
\ No newline at end of file
Modified: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuItem.java
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuItem.java 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuItem.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -25,6 +25,7 @@
import org.richfaces.PanelMenuMode;
+import javax.faces.component.UIComponent;
import javax.faces.component.UIOutput;
/**
@@ -37,10 +38,64 @@
public static final String COMPONENT_FAMILY = "org.richfaces.PanelMenuItem";
+ public enum Icons {
+ disc("rf-pm-disc"),
+ grid("rf-pm-grid"),
+ chevron("rf-pm-chevron"),
+ chevronUp("rf-pm-chevron-up"),
+ chevronDown("rf-pm-chevron-down"),
+ triangle("rf-pm-triangle"),
+ triangleUp("rf-pm-triangle-up"),
+ triangleDown("rf-pm-triangle-down");
+
+ public static final Icons DEFAULT = grid;
+
+ private final String cssClass;
+
+ Icons(String cssClass) {
+ this.cssClass = cssClass;
+ }
+
+ public String cssClass() {
+ return cssClass;
+ }
+ }
+
protected AbstractPanelMenuItem() {
setRendererType("org.richfaces.PanelMenuItem");
}
+ public boolean isTopItem() {
+ return getParentItem() instanceof AbstractPanelMenu;
+ }
+
+ public AbstractPanelMenu getPanelMenu() { // TODO refactor
+ UIComponent parentItem = getParent();
+ while (parentItem != null) {
+ if (parentItem instanceof AbstractPanelMenu) {
+ return (AbstractPanelMenu) parentItem;
+ }
+
+ parentItem = parentItem.getParent();
+ }
+
+ return null;
+ }
+
+ public UIComponent getParentItem() {
+ UIComponent parentItem = getParent();
+ while (parentItem != null) {
+ if (parentItem instanceof AbstractPanelMenuGroup
+ || parentItem instanceof AbstractPanelMenu) {
+ return parentItem;
+ }
+
+ parentItem = parentItem.getParent();
+ }
+
+ return null;
+ }
+
@Override
public String getFamily() {
return COMPONENT_FAMILY;
Modified: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/component/AbstractProgressBar.java
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/component/AbstractProgressBar.java 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/component/AbstractProgressBar.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -27,28 +27,25 @@
package org.richfaces.component;
-import java.util.HashMap;
+import java.io.IOException;
import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
+import javax.faces.component.UIComponent;
import javax.faces.component.UIComponentBase;
+import javax.faces.component.visit.VisitCallback;
+import javax.faces.component.visit.VisitContext;
+import javax.faces.component.visit.VisitResult;
import javax.faces.context.FacesContext;
-import javax.faces.context.PartialViewContext;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.FacesEvent;
-import org.ajax4jsf.javascript.JSLiteral;
-import org.ajax4jsf.javascript.ScriptUtils;
import org.richfaces.cdk.annotations.Attribute;
import org.richfaces.cdk.annotations.EventName;
import org.richfaces.cdk.annotations.JsfComponent;
import org.richfaces.cdk.annotations.JsfRenderer;
import org.richfaces.cdk.annotations.Tag;
import org.richfaces.cdk.annotations.TagType;
-import org.richfaces.renderkit.HtmlConstants;
-import org.richfaces.renderkit.html.ProgressBarBaseRenderer;
-import org.richfaces.renderkit.util.CoreAjaxRendererUtils;
+import org.richfaces.context.ExtendedVisitContext;
+import org.richfaces.context.ExtendedVisitContextMode;
+import org.richfaces.renderkit.MetaComponentRenderer;
/**
* Class provides base component class for progress bar
@@ -57,46 +54,16 @@
*
*/
@JsfComponent(tag = @Tag(type = TagType.Facelets), renderer = @JsfRenderer(type = "org.richfaces.ProgressBarRenderer"))
-public abstract class AbstractProgressBar extends UIComponentBase{
+public abstract class AbstractProgressBar extends UIComponentBase implements MetaComponentResolver, MetaComponentEncoder {
- /** Component type */
+ /** Component type */
public static final String COMPONENT_TYPE = "org.richfaces.ProgressBar";
- /** Component family */
+ /** Component family */
public static final String COMPONENT_FAMILY = "org.richfaces.ProgressBar";
- /** Request parameter name containing component state to render */
- public static final String FORCE_PERCENT_PARAM = "forcePercent";
+ public static final String STATE_META_COMPONENT_ID = "state";
- /** Percent param name */
- private static final String PERCENT_PARAM = "percent";
-
- /** Max value attribute name */
- private static final String MAXVALUE = "maxValue";
-
- /** Min value attribute name */
- private static final String MINVALUE = "minValue";
-
- /** Enabled attribute name */
- private static final String ENABLED = "enabled";
-
- /** Enabled attribute name */
- private static final String INTERVAL = "interval";
-
- /** Markup data key */
- private static final String MARKUP = "markup";
-
- /** Complete class attribute name */
- private static final String COMPLETECLASS = "completeClass";
-
- /** Remain class attribute name */
- private static final String REMAINCLASS = "remainClass";
-
- /** Style class attribute name */
- private static final String STYLECLASS = "styleClass";
-
- /** Context key */
- private static final String CONTEXT = "context";
@Attribute(events = @EventName("click"))
public abstract String getOnclick();
@@ -117,17 +84,18 @@
@Attribute(events = @EventName("mouseout"))
public abstract String getOnmouseout();
-
- @Attribute(events = @EventName("submit"))
- public abstract String getOnsubmit();
-
-
+
+ @Attribute(events = @EventName("begin"))
+ public abstract String getOnbegin();
+
@Attribute
public abstract String getLabel();
-
+
@Attribute
public abstract Object getData();
+
public abstract void setData(Object data);
+
@Attribute(defaultValue = "1000")
public abstract int getInterval();
@@ -139,206 +107,96 @@
@Attribute(events = @EventName("complete"))
public abstract String getOncomplete();
-
+
+ @Attribute(events = @EventName("finish"))
+ public abstract String getOnfinish();
+
@Attribute
- public abstract String getCompleteClass();
-
- @Attribute
- public abstract String getFinishClass();
-
- @Attribute
public abstract String getInitialClass();
-
+
@Attribute
- public abstract String getRemainClass();
-
+ public abstract String getRemainingClass();
+
@Attribute
- public abstract String getFocus();
-
+ public abstract String getProgressClass();
+
@Attribute
- public abstract String getReRenderAfterComplete();
-
+ public abstract String getFinishClass();
+
+ @Attribute(defaultValue = "SwitchType.DEFAULT")
+ public abstract SwitchType getMode();
+
@Attribute
- public abstract String getMode();
-
- @Attribute
public abstract int getMaxValue();
-
+
@Attribute
public abstract int getMinValue();
-
+
@Attribute
public abstract Object getValue();
-
- @Attribute
- public abstract Object getParameters();
-
-
- /**
- * Method performs broadcasting of jsf events to progress bar component
- *
- * @param event -
- * Faces Event instance
- */
- public void broadcast(FacesEvent event) throws AbortProcessingException {
- FacesContext facesContext = FacesContext.getCurrentInstance();
- Map<String, String> params = facesContext.getExternalContext().getRequestParameterMap();
- String clientId = this.getClientId(facesContext);
+ public void encodeMetaComponent(FacesContext context, String metaComponentId) throws IOException {
+ ((MetaComponentRenderer) getRenderer(context)).encodeMetaComponent(context, this, metaComponentId);
+ }
- if (!params.containsKey(clientId)) {
- return;
+ @Override
+ public boolean visitTree(VisitContext context, VisitCallback callback) {
+ if (!isVisitable(context)) {
+ return false;
}
- if (!params.containsKey(FORCE_PERCENT_PARAM)
- && params.containsKey(PERCENT_PARAM)) {
- Number value = NumberUtils.getNumber(this.getAttributes().get(
- HtmlConstants.VALUE_ATTRIBUTE));
- PartialViewContext pvc = FacesContext.getCurrentInstance().getPartialViewContext();
- pvc.getRenderIds().remove(
- this.getClientId());
- this.setData(getResponseData(value, facesContext));
- } else if (params.containsKey(FORCE_PERCENT_PARAM)) {
- PartialViewContext pvc = FacesContext.getCurrentInstance().getPartialViewContext();
- pvc.getRenderIds().add(this.getClientId());
- String forcedState = params.get(FORCE_PERCENT_PARAM);
- if ("completeState".equals(forcedState)) {
- Object reRender = this.getAttributes().get("reRenderAfterComplete");
- Set<String> ajaxRegions = CoreAjaxRendererUtils.asIdsSet(reRender);
- if (ajaxRegions != null) {
- for (Iterator<String> iter = ajaxRegions.iterator(); iter.hasNext();) {
- String id = iter.next();
- pvc.getExecuteIds().add(id);
- pvc.getRenderIds().add(id);
+ FacesContext facesContext = context.getFacesContext();
+ pushComponentToEL(facesContext, null);
+
+ try {
+ VisitResult result = context.invokeVisitCallback(this, callback);
+
+ if (result == VisitResult.COMPLETE) {
+ return true;
+ }
+
+ if (result == VisitResult.ACCEPT) {
+ if (context instanceof ExtendedVisitContext) {
+ ExtendedVisitContext extendedVisitContext = (ExtendedVisitContext) context;
+ if (extendedVisitContext.getVisitMode() == ExtendedVisitContextMode.RENDER) {
+
+ result = extendedVisitContext.invokeMetaComponentVisitCallback(this, callback, STATE_META_COMPONENT_ID);
+ if (result == VisitResult.COMPLETE) {
+ return true;
+ }
}
}
}
- }
- }
-
- /**
- * Returns ajax response data
- *
- * @param uiComponent
- * @param percent
- * @return
- */
- private Map<Object, Object> getResponseData(Number value,
- FacesContext facesContext) {
+
+ if (result == VisitResult.ACCEPT) {
+ Iterator<UIComponent> kids = this.getFacetsAndChildren();
- ProgressBarBaseRenderer renderer = (ProgressBarBaseRenderer) this
- .getRenderer(facesContext);
+ while(kids.hasNext()) {
+ boolean done = kids.next().visitTree(context, callback);
- Map<Object, Object> map = new HashMap<Object, Object>();
- map.put(HtmlConstants.VALUE_ATTRIBUTE, value);
- map.put(INTERVAL, this.getInterval());
-
- if (this.getAttributes().get(HtmlConstants.STYLE_ATTRIBUTE) != null) {
- map.put(HtmlConstants.STYLE_ATTRIBUTE, this.getAttributes()
- .get(HtmlConstants.STYLE_ATTRIBUTE));
+ if (done) {
+ return true;
+ }
+ }
+ }
+ } finally {
+ popComponentFromEL(facesContext);
}
- map.put(ENABLED, (Boolean) this.getAttributes().get(ENABLED));
-
- if (!isSimple(renderer)) {
- map.put(MARKUP, getMarkup(facesContext, renderer));
- map.put(CONTEXT, getContext(renderer, value));
- }
-
- addStyles2Responce(map, COMPLETECLASS, this.getAttributes().get(
- COMPLETECLASS));
- addStyles2Responce(map, REMAINCLASS, this.getAttributes().get(
- REMAINCLASS));
- addStyles2Responce(map, STYLECLASS, this.getAttributes().get(
- STYLECLASS));
- return map;
-
+ return false;
}
- /**
- * Returns context for macrosubstitution
- *
- * @param renderer
- * @param percent
- * @return
- */
- private JSLiteral getContext(ProgressBarBaseRenderer renderer,
- Number percent) {
- StringBuffer buffer = new StringBuffer("{");
- buffer.append("\"value\":");
- buffer.append(ScriptUtils.toScript(percent.toString())).append(",");
- buffer.append("\"minValue\":");
- buffer.append(
- ScriptUtils.toScript(this.getAttributes().get(MINVALUE)
- .toString())).append(",");
- buffer.append("\"maxValue\":");
- buffer.append(ScriptUtils.toScript(this.getAttributes().get(MAXVALUE)
- .toString()));
+ public String resolveClientId(FacesContext facesContext, UIComponent contextComponent, String metaComponentId) {
- String parameters = handleParameters(renderer.getParameters(this));
- if (parameters != null) {
- buffer.append(",");
- buffer.append(parameters);
+ if (STATE_META_COMPONENT_ID.equals(metaComponentId)) {
+ return contextComponent.getClientId(facesContext) + MetaComponentResolver.META_COMPONENT_SEPARATOR_CHAR + metaComponentId;
}
- buffer.append("}");
- return new JSLiteral(buffer.toString());
- }
- private String handleParameters(String str){
- if (str != null && str.length() > 0) {
- StringBuilder s = new StringBuilder();
- while(str.indexOf(":") != -1){
- String a = str.substring(0, str.indexOf(":"));
- str = str.substring(str.indexOf(":") );
- s.append("\"");
- s.append(a);
- s.append("\"");
- if (str.indexOf(",") != -1) {
- String b = str.substring(0, str.indexOf(",") +1);
- str = str.substring(str.indexOf(",") +1 );
- s.append(b);
- } else{
- s.append(str);
- return s.toString();
- }
- }
- }
return null;
}
-
- /**
- * Return true if markup is simple
- *
- * @return
- */
- private boolean isSimple(ProgressBarBaseRenderer renderer) {
- return renderer.isSimpleMarkup(this);
- }
- /**
- * Returns label markup
- *
- * @param context
- * @param renderer
- * @return
- */
- private String getMarkup(FacesContext context,
- ProgressBarBaseRenderer renderer) {
- return renderer.getMarkup(context, this).toString();
+ public String substituteUnresolvedClientId(FacesContext facesContext, UIComponent contextComponent,
+ String metaComponentId) {
+ return null;
}
-
- /**
- * Add component classes to ajax response
- *
- * @param buffer
- * @param attr
- * @param newValue
- */
- private void addStyles2Responce(Map<Object, Object> map, String key,
- Object className) {
- if (className != null) {
- map.put(key, className);
- }
- }
-
}
Modified: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuItem.java
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuItem.java 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuItem.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -46,7 +46,7 @@
}
public String getIcon() {
- return (String) getStateHelper().eval(PropertyKeys.icon);
+ return (String) getStateHelper().eval(PropertyKeys.icon, Icons.DEFAULT.toString());
}
public void setIcon(String icon) {
Modified: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -10,7 +10,7 @@
* 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
+ * buticon 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.
*
Modified: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -26,6 +26,7 @@
import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.javascript.JSObject;
import org.richfaces.component.AbstractPanelMenuGroup;
+import org.richfaces.component.AbstractPanelMenuItem;
import org.richfaces.component.html.HtmlPanelMenuGroup;
import org.richfaces.renderkit.HtmlConstants;
@@ -52,8 +53,9 @@
public static final String BEFORE_COLLAPSE = "beforecollapse";
public static final String BEFORE_EXPAND = "beforeexpand";
public static final String BEFORE_SWITCH = "beforeswitch";
+ private static final String CSS_CLASS_PREFIX = "rf-pm-gr";
+ private static final String TOP_CSS_CLASS_PREFIX = "rf-pm-top-gr";
-
@Override
protected void doDecode(FacesContext context, UIComponent component) {
AbstractPanelMenuGroup menuGroup = (AbstractPanelMenuGroup) component;
@@ -106,15 +108,22 @@
private void encodeHeader(ResponseWriter writer, FacesContext context, HtmlPanelMenuGroup menuGroup) throws IOException {
writer.startElement("div", null);
writer.writeAttribute("id", menuGroup.getClientId(context) + ":hdr", null);
- writer.writeAttribute("class", "rf-pm-gr-hdr", null);
- writer.writeText(menuGroup.getLabel(), null);
+ writer.writeAttribute("class", getCssClass(menuGroup, "-hdr"), null);
+ PanelMenuItemRenderer.encodeHeaderGroup(writer, context, menuGroup, getCssClass(menuGroup, ""));
+// writer.writeText(menuGroup.getLabel(), null);
writer.endElement("div");
}
+ public String getCssClass(AbstractPanelMenuItem item, String postfix) {
+ return (item.isTopItem() ? TOP_CSS_CLASS_PREFIX : CSS_CLASS_PREFIX) + postfix;
+ }
+
private void encodeContentBegin(ResponseWriter writer, FacesContext context, HtmlPanelMenuGroup menuGroup) throws IOException {
writer.startElement("div", null);
writer.writeAttribute("id", menuGroup.getClientId(context) + ":cnt", null);
- writer.writeAttribute("class", concatClasses("rf-pm-gr-cnt", menuGroup.isExpanded() ? "rf-pm-exp" : "rf-pm-colps"), null);
+ writer.writeAttribute("class", concatClasses(getCssClass(menuGroup, "-cnt"), menuGroup.isExpanded() ? "rf-pm-exp" : "rf-pm-colps"), null);
+
+ writeJavaScript(writer, context, menuGroup);
}
private void encodeContentEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
@@ -123,7 +132,7 @@
@Override
protected String getStyleClass(UIComponent component) {
- return concatClasses("rf-pm-gr", attributeAsString(component, "styleClass"));
+ return concatClasses(getCssClass((AbstractPanelMenuItem) component, ""), attributeAsString(component, "styleClass"));
}
@Override
@@ -160,7 +169,7 @@
protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
encodeContentEnd(writer, context, component);
- super.doEncodeEnd(writer, context, component);
+ writer.endElement(HtmlConstants.DIV_ELEM);
}
@Override
Modified: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -26,6 +26,9 @@
import org.ajax4jsf.javascript.JSObject;
import org.richfaces.component.AbstractPanelMenuItem;
import org.richfaces.component.html.HtmlPanelMenuItem;
+import org.richfaces.component.util.HtmlUtil;
+import org.richfaces.renderkit.HtmlConstants;
+import org.richfaces.renderkit.RenderKitUtils;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -34,7 +37,6 @@
import java.util.HashMap;
import java.util.Map;
-import static org.richfaces.component.util.HtmlUtil.concatClasses;
import static org.richfaces.renderkit.html.TogglePanelRenderer.addEventOption;
import static org.richfaces.renderkit.html.TogglePanelRenderer.getAjaxOptions;
@@ -47,17 +49,57 @@
public static final String UNSELECT = "unselect";
public static final String SELECT = "select";
public static final String BEFORE_SELECT = "beforeselect";
+
+ private static final String CSS_CLASS_PREFIX = "rf-pm-itm";
@Override
protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
super.doEncodeBegin(writer, context, component);
- writer.writeText(((AbstractPanelMenuItem) component).getLabel(), null);
+ encodeHeaderGroup(writer, context, (AbstractPanelMenuItem) component, CSS_CLASS_PREFIX);
}
+ static void encodeHeaderGroup(ResponseWriter writer, FacesContext context, AbstractPanelMenuItem menuItem, String classPrefix) throws IOException {
+ writer.startElement("table", null);
+ writer.writeAttribute("class", classPrefix + "-gr", null);
+ writer.startElement("tr", null);
+
+ encodeTdIcon(writer, context, classPrefix, menuItem.getIcon());
+
+ writer.startElement("td", null);
+ writer.writeAttribute("class", classPrefix + "-lbl", null);
+ writer.writeText(menuItem.getLabel(), null);
+ writer.endElement("td");
+
+ writer.startElement("td", null);
+ writer.writeAttribute("class", HtmlUtil.concatClasses(classPrefix + "-exp-ico", "rf-pm-triangle-down"), null);
+ writer.endElement("td");
+
+ writer.endElement("tr");
+ writer.endElement("table");
+ }
+
+ private static void encodeTdIcon(ResponseWriter writer, FacesContext context, String classPrefix, String attrIconValue) throws IOException {
+ writer.startElement("td", null);
+ try {
+ AbstractPanelMenuItem.Icons icon = AbstractPanelMenuItem.Icons.valueOf(attrIconValue);
+ writer.writeAttribute("class", HtmlUtil.concatClasses(classPrefix + "-ico", icon.cssClass()), null);
+ } catch (IllegalArgumentException e) {
+ writer.writeAttribute("class", classPrefix + "-ico", null);
+ if(attrIconValue != null && attrIconValue.trim().length() != 0) {
+ writer.startElement(HtmlConstants.IMG_ELEMENT, null);
+ writer.writeAttribute(HtmlConstants.ALT_ATTRIBUTE, "", null);
+ writer.writeURIAttribute(HtmlConstants.SRC_ATTRIBUTE, RenderKitUtils.getResourceURL(attrIconValue, context), null);
+ writer.endElement(HtmlConstants.IMG_ELEMENT);
+ }
+ }
+
+ writer.endElement("td");
+ }
+
@Override
protected String getStyleClass(UIComponent component) {
- return concatClasses("rf-pm-itm", attributeAsString(component, "styleClass"));
+ return concatClasses(CSS_CLASS_PREFIX, attributeAsString(component, "styleClass"));
}
@Override
Modified: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarBaseRenderer.java
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarBaseRenderer.java 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarBaseRenderer.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -27,227 +27,65 @@
package org.richfaces.renderkit.html;
-import static org.richfaces.renderkit.RenderKitUtils.addToScriptHash;
-
import java.io.IOException;
-import java.io.StringWriter;
-import java.util.HashMap;
import java.util.Map;
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
+import javax.faces.context.PartialResponseWriter;
import javax.faces.context.PartialViewContext;
-import javax.faces.context.ResponseWriter;
-import javax.faces.event.ActionEvent;
-import org.ajax4jsf.javascript.JSLiteral;
-import org.ajax4jsf.javascript.ScriptUtils;
+import org.ajax4jsf.context.AjaxContext;
+import org.ajax4jsf.javascript.JSFunction;
+import org.ajax4jsf.javascript.JSReference;
import org.richfaces.component.AbstractProgressBar;
+import org.richfaces.component.MetaComponentResolver;
import org.richfaces.component.NumberUtils;
-import org.richfaces.log.Logger;
-import org.richfaces.log.RichfacesLogger;
+import org.richfaces.component.SwitchType;
+import org.richfaces.renderkit.AjaxEventOptions;
+import org.richfaces.renderkit.MetaComponentRenderer;
import org.richfaces.renderkit.RendererBase;
-import org.richfaces.renderkit.util.RendererUtils;
+import org.richfaces.renderkit.util.AjaxRendererUtils;
/**
* Abstract progress bar renderer
*
- * @author "Andrey Markavtsov"
+ * @author Nick Belaevski
*
*/
@ResourceDependencies( {
@ResourceDependency(library = "org.richfaces", name = "ajax.reslib"),
@ResourceDependency(library = "org.richfaces", name = "base-component.reslib"),
+ @ResourceDependency(name = "richfaces-event.js"),
@ResourceDependency(library = "org.richfaces", name = "progressBar.js"),
@ResourceDependency(library = "org.richfaces", name = "progressBar.ecss")
})
-public class ProgressBarBaseRenderer extends RendererBase {
+public class ProgressBarBaseRenderer extends RendererBase implements MetaComponentRenderer {
- private static final String INITIAL_FACET = "initial";
- private static final String COMPLETE_FACET = "complete";
- private static final Logger LOG = RichfacesLogger.APPLICATION.getLogger();
-
-
- @Override
- protected void doDecode(FacesContext context, UIComponent component) {
- super.doDecode(context, component);
- if (component.isRendered()) {
- new ActionEvent(component).queue();
- PartialViewContext pvc = context.getPartialViewContext();
- pvc.getRenderIds().add(component.getClientId(context));
- }
-
- }
+ private static final JSReference BEFORE_UPDATE_HANDLER = new JSReference("beforeUpdateHandler");
- /*
- * (non-Javadoc)
- *
- * @see org.richfaces.renderkit.TemplateEncoderRendererBase#encodeChildren(javax.faces.context.FacesContext,
- * javax.faces.component.UIComponent)
- */
- @Override
- public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
-
- }
+ private static final JSReference AFTER_UPDATE_HANDLER = new JSReference("afterUpdateHandler");
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.renderkit.RendererBase#doEncodeChildren(javax.faces.context.ResponseWriter,
- * javax.faces.context.FacesContext, javax.faces.component.UIComponent)
- */
- @Override
- public void doEncodeChildren(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
-
- }
-
- public final boolean getRendersChildren() {
- return true;
- }
-
- /**
- * Gets state forced from javascript
- *
- * @param component
- * @return
- */
- public String getForcedState(FacesContext context, UIComponent component) {
- String forcedState = null;
- Map<String, String> params = context.getExternalContext()
- .getRequestParameterMap();
- if (params.containsKey(AbstractProgressBar.FORCE_PERCENT_PARAM)) {
- forcedState = params.get(AbstractProgressBar.FORCE_PERCENT_PARAM);
- }
- return forcedState;
- }
+ private static final JSReference PARAMS = new JSReference("params");
- /**
- * Renderes label markup
- *
- * @param context
- * @param component
- * @return
- */
- public StringBuffer getMarkup(FacesContext context, UIComponent component) {
- StringBuffer result = new StringBuffer();
- try {
- result = new StringBuffer(getMarkupBody(context, component, hasChildren(component)));
-
- } catch (Exception e) {
- LOG.error("Error occurred during rendering of progress bar label. It switched to empty string", e);
- }
-
- return result;
-
- }
-
+ private static final ProgressBarStateEncoder FULL_ENCODER = new ProgressBarStateEncoder(false);
-
- protected String getMarkupBody(FacesContext context, UIComponent component, boolean children) throws IOException {
- ResponseWriter writer = context.getResponseWriter();
- StringWriter dumpingWriter = new StringWriter();
- ResponseWriter clonedWriter = writer.cloneWithWriter(dumpingWriter);
- context.setResponseWriter(clonedWriter);
- try {
- if (children) {
- this.renderChildren(context, component);
- } else if (component.getAttributes().get("label") != null) {
- clonedWriter.write(component.getAttributes().get("label").toString());
- }
- } finally {
- clonedWriter.flush();
- context.setResponseWriter(writer);
- }
+ private static final ProgressBarStateEncoder PARTIAL_ENCODER = new ProgressBarStateEncoder(true);
- return dumpingWriter.toString();
- }
-
-
-
+ @Override
+ protected void doDecode(FacesContext context, UIComponent component) {
+ super.doDecode(context, component);
- /**
- * Encodes script for state rendering in client mode
- *
- * @param context
- * @param component
- * @param state
- * @throws IOException
- */
- public String getRenderStateScript(FacesContext context,
- UIComponent component, String state) throws IOException {
- StringBuffer script = new StringBuffer("\n");
- script.append(
- "RichFaces.$('" + component.getClientId(context)
- + "').renderState('").append(state).append(
- "');");
- return script.toString();
- }
-
-
-
- /**
- * Encode initial javascript
- *
- * @param context
- * @param component
- * @throws IOException
- */
- public String getInitialScript(FacesContext context,
- UIComponent component, String state) throws IOException {
- AbstractProgressBar progressBar = (AbstractProgressBar) component;
- StringBuffer script = new StringBuffer();
- Map<String, Object> options = new HashMap<String, Object>();
- RendererUtils utils = getUtils();
-
- String clientId = component.getClientId(context);
-
- addToScriptHash(options, "mode", component.getAttributes().get("mode"), "ajax");
- addToScriptHash(options, "minValue", component.getAttributes().get("minValue"), "0");
- addToScriptHash(options, "maxValue", component.getAttributes().get("maxValue"), "100");
- addToScriptHash(options, "context", getContext(component));
-
- Integer interval = new Integer(progressBar.getInterval());
- addToScriptHash(options, "pollinterval", interval);
- addToScriptHash(options, "enabled", progressBar.isEnabled());
- addToScriptHash(options, "pollId", progressBar.getClientId(context));
- addToScriptHash(options, "state", state, "initialState");
- addToScriptHash(options, "value", NumberUtils.getNumber(component.getAttributes().get("value")));
- addToScriptHash(options, "onsubmit", buildEventFunction(component.getAttributes().get("onsubmit")));
- script.append("new RichFaces.ui.ProgressBar('").append(clientId).append("'");
- if (!options.isEmpty()) {
- script.append(",").append(ScriptUtils.toScript(options));
- }
- script.append(")\n;");
- return script.toString();
- }
-
- private Object buildEventFunction(Object eventFunction) {
- if(eventFunction != null && eventFunction.toString().length() > 0) {
- return "new Function(\"" + eventFunction.toString() + "\");";
+ Map<String, String> params = context.getExternalContext().getRequestParameterMap();
+ if (params.get(component.getClientId(context)) != null) {
+ PartialViewContext pvc = context.getPartialViewContext();
+ pvc.getRenderIds().add(component.getClientId(context) +
+ MetaComponentResolver.META_COMPONENT_SEPARATOR_CHAR + AbstractProgressBar.STATE_META_COMPONENT_ID);
}
- return null;
}
-
- /**
- * Creates options map for AJAX requests
- *
- * @param clientId
- * @param progressBar
- * @param context
- * @return
- */
- public String getPollScript(FacesContext context, UIComponent component) {
- return "RichFaces.$('" + component.getClientId() + "').poll()";
-
- }
-
- public String getStopPollScript(FacesContext context, UIComponent component) {
- return "RichFaces.$('" + component.getClientId() + "').disable()";
-
- }
/**
* Check if component mode is AJAX
@@ -256,141 +94,75 @@
* @return
*/
public boolean isAjaxMode(UIComponent component) {
- String mode = (String) component.getAttributes().get("mode");
- return "ajax".equalsIgnoreCase(mode);
- }
-
- public String getCurrentOrForcedState(FacesContext context, UIComponent component){
- String forcedState = getForcedState(context,component);
- if (forcedState != null) {
- return forcedState;
+ SwitchType mode = (SwitchType) component.getAttributes().get("mode");
+
+ if (mode == SwitchType.server) {
+ throw new IllegalArgumentException("Progress bar doesn't support 'server' mode");
}
- return getCurrentState(context, component);
+
+ return SwitchType.ajax == mode;
}
- public String getCurrentState(FacesContext context, UIComponent component){
+ protected ProgressBarState getCurrentState(FacesContext context, UIComponent component){
Number minValue = NumberUtils.getNumber(component.getAttributes().get("minValue"));
Number maxValue = NumberUtils.getNumber(component.getAttributes().get("maxValue"));
Number value = NumberUtils.getNumber(component.getAttributes().get("value"));
if (value.doubleValue() <= minValue.doubleValue()) {
- return "initialState";
+ return ProgressBarState.initialState;
} else if (value.doubleValue() > maxValue.doubleValue()) {
- return "completeState";
- } else {
- return "progressState";
+ return ProgressBarState.finishState;
+ } else {
+ return ProgressBarState.progressState;
}
}
- public String getShellStyle(FacesContext context, UIComponent component){
- return (!isSimpleMarkup(component)) ? "rf-pb-shl-dig "
- : "rf-pb-shl ";
+ protected String getStateDisplayStyle(String currentState, String state) {
+ if (currentState.equals(state)) {
+ return null;
+ }
+
+ return "display: none";
}
- public String getWidth(UIComponent component){
- Number value = NumberUtils.getNumber(component.getAttributes().get("value"));
- Number minValue = NumberUtils.getNumber(component.getAttributes().get("minValue"));
- Number maxValue = NumberUtils.getNumber(component.getAttributes().get("maxValue"));
- Number percent = calculatePercent(value, minValue, maxValue);
-
- return String.valueOf(percent.intValue());
+ protected String getSubmitFunction(FacesContext facesContext, UIComponent component) {
+ if (!isAjaxMode(component)) {
+ return null;
+ }
+
+ JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(facesContext, component, AjaxRendererUtils.AJAX_FUNCTION_NAME);
+ AjaxEventOptions eventOptions = AjaxRendererUtils.buildEventOptions(facesContext, component);
+ eventOptions.set("beforedomupdate", BEFORE_UPDATE_HANDLER);
+ eventOptions.set("complete", AFTER_UPDATE_HANDLER);
+ eventOptions.setClientParameters(PARAMS);
+ ajaxFunction.addParameter(eventOptions);
+ return ajaxFunction.toScript();
}
- public void renderInitialFacet(FacesContext context, UIComponent component) throws IOException {
- renderFacet(context, component, INITIAL_FACET);
- }
+ public void encodeMetaComponent(FacesContext context, UIComponent component, String metaComponentId)
+ throws IOException {
- public void renderCompleteFacet(FacesContext context, UIComponent component) throws IOException {
- renderFacet(context, component, COMPLETE_FACET);
- }
+ if (AbstractProgressBar.STATE_META_COMPONENT_ID.equals(metaComponentId)) {
+ ProgressBarState state = getCurrentState(context, component);
+
+ AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
+ ajaxContext.getResponseComponentDataMap().put(component.getClientId(context), NumberUtils.getNumber(component.getAttributes().get("value")));
- private void renderFacet(FacesContext context, UIComponent component, String facet) throws IOException {
- UIComponent headerFacet = component.getFacet(facet);
- if(headerFacet != null) {
- headerFacet.encodeAll(context);
- }
- }
-
-
- /**
- * Returns parameters attr
- *
- * @param component
- * @param renderer
- * @param percent
- * @return
- */
- public String getParameters(UIComponent component) {
- String parameters = (String) component.getAttributes()
- .get("parameters");
- return parameters;
- }
-
- /**
- * Returns context for macrosubstitution
- *
- * @param component
- * @return
- */
- private JSLiteral getContext(UIComponent component) {
- StringBuffer buffer = new StringBuffer();
- String parameters = getParameters(component);
- JSLiteral literal = null;
- if (parameters != null) {
- buffer.append("{").append(parameters).append("}");
- literal = new JSLiteral(buffer.toString());
- }
- return literal;
- }
-
- /**
- * Return true if component has children components
- *
- * @param component
- * @return
- */
- private boolean hasChildren(UIComponent component) {
- return (component.getChildCount() != 0);
- }
-
- /**
- * Returns true if markup should rendered as simple 2 divs
- *
- * @param component
- * @return
- */
- public boolean isSimpleMarkup(UIComponent component) {
- if (hasChildren(component)) {
- return false;
+ PartialResponseWriter partialResponseWriter = context.getPartialViewContext().getPartialResponseWriter();
+ partialResponseWriter.startUpdate(state.getStateClientId(context, component));
+
+ state.encodeStateForMetaComponent(context, component, PARTIAL_ENCODER);
+
+ partialResponseWriter.endUpdate();
} else {
- if (component.getAttributes().get("label") != null) {
- return false;
- }
+ throw new IllegalArgumentException(metaComponentId);
}
- return true;
}
-
-
-
- /**
- * Calculates percent value according to min & max value
- *
- * @param value
- * @param minValue
- * @param maxValue
- * @return
- */
- public Number calculatePercent(Number value, Number minValue,
- Number maxValue) {
- if (minValue.doubleValue() < value.doubleValue()
- && value.doubleValue() < maxValue.doubleValue()) {
- return (Number) ((value.doubleValue() - minValue.doubleValue()) * 100.0 / (maxValue
- .doubleValue() - minValue.doubleValue()));
- } else if (value.doubleValue() <= minValue.doubleValue()) {
- return 0;
- } else if (value.doubleValue() >= maxValue.doubleValue()) {
- return 100;
- }
- return 0;
+
+ public void decodeMetaComponent(FacesContext context, UIComponent component, String metaComponentId) {
+ throw new UnsupportedOperationException();
}
-
+
+ protected ProgressBarStateEncoder getEncoder(FacesContext facesContext, UIComponent component) {
+ return isAjaxMode(component) ? PARTIAL_ENCODER : FULL_ENCODER;
+ }
}
Copied: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarState.java (from rev 20206, trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarState.java)
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarState.java (rev 0)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarState.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -0,0 +1,131 @@
+/*
+ * 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.html;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.richfaces.component.util.HtmlUtil;
+
+enum ProgressBarState {
+ initialState {
+ @Override
+ public String getStateClientId(FacesContext context, UIComponent component) {
+ return component.getClientId(context) + ".init";
+ }
+
+ @Override
+ public String getStyleClass(FacesContext context, UIComponent component) {
+ return HtmlUtil.concatClasses("rf-pb-init", component.getAttributes().get("initialClass"));
+ }
+
+ @Override
+ public void encodeContent(FacesContext context, UIComponent component) throws IOException {
+ UIComponent facet = component.getFacet("initial");
+ if (facet != null) {
+ facet.encodeAll(context);
+ }
+ }
+
+ @Override
+ public void encodeStateForMetaComponent(FacesContext context, UIComponent component,
+ ProgressBarStateEncoder encoder) throws IOException {
+
+ encoder.encodeInitialState(context, component, this);
+ }
+
+ },
+
+ progressState {
+
+ @Override
+ public String getStateClientId(FacesContext context, UIComponent component) {
+ return component.getClientId(context) + ".lbl";
+ }
+
+ @Override
+ public String getStyleClass(FacesContext context, UIComponent component) {
+ return "rf-pb-lbl";
+ }
+
+ @Override
+ public void encodeContent(FacesContext context, UIComponent component) throws IOException {
+ ResponseWriter responseWriter = context.getResponseWriter();
+
+ if (component.getChildCount() > 0) {
+ for (UIComponent child: component.getChildren()) {
+ child.encodeAll(context);
+ }
+ }
+
+ Object label = component.getAttributes().get("label");
+ if (label != null) {
+ responseWriter.writeText(label, null);
+ }
+ }
+
+ @Override
+ public void encodeStateForMetaComponent(FacesContext context, UIComponent component,
+ ProgressBarStateEncoder encoder) throws IOException {
+
+ encoder.encodeProgressStateContent(context, component, this);
+ }
+ },
+
+ finishState {
+ @Override
+ public String getStateClientId(FacesContext context, UIComponent component) {
+ return component.getClientId(context) + ".fin";
+ }
+
+ @Override
+ public String getStyleClass(FacesContext context, UIComponent component) {
+ return HtmlUtil.concatClasses("rf-pb-fin", component.getAttributes().get("finishClass"));
+ }
+
+ @Override
+ public void encodeContent(FacesContext context, UIComponent component) throws IOException {
+ UIComponent facet = component.getFacet("finish");
+ if (facet != null) {
+ facet.encodeAll(context);
+ }
+ }
+
+ @Override
+ public void encodeStateForMetaComponent(FacesContext context, UIComponent component,
+ ProgressBarStateEncoder encoder) throws IOException {
+
+ encoder.encodeCompleteState(context, component, this);
+ }
+ };
+
+ public abstract String getStateClientId(FacesContext context, UIComponent component);
+
+ public abstract String getStyleClass(FacesContext context, UIComponent component);
+
+ public abstract void encodeContent(FacesContext context, UIComponent component) throws IOException;
+
+ public abstract void encodeStateForMetaComponent(FacesContext context, UIComponent component, ProgressBarStateEncoder encoder) throws IOException;
+}
\ No newline at end of file
Copied: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarStateEncoder.java (from rev 20206, trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarStateEncoder.java)
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarStateEncoder.java (rev 0)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarStateEncoder.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -0,0 +1,162 @@
+/*
+ * 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.html;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.richfaces.component.NumberUtils;
+import org.richfaces.component.util.HtmlUtil;
+import org.richfaces.renderkit.HtmlConstants;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+class ProgressBarStateEncoder {
+
+ private boolean renderContentAsPlaceHolders;
+
+ public ProgressBarStateEncoder(boolean renderContentAsPlaceHolders) {
+ super();
+ this.renderContentAsPlaceHolders = renderContentAsPlaceHolders;
+ }
+
+ protected String getContentStyle(boolean sameState) {
+ return sameState ? null : "display: none";
+ }
+
+ private void encodeStateFacet(FacesContext context, UIComponent component, ProgressBarState state,
+ ProgressBarState currentState) throws IOException {
+ String clientId = state.getStateClientId(context, component);
+
+ ResponseWriter responseWriter = context.getResponseWriter();
+
+ responseWriter.startElement(HtmlConstants.DIV_ELEM, component);
+ responseWriter.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, state.getStyleClass(context, component), null);
+ responseWriter.writeAttribute(HtmlConstants.ID_ATTRIBUTE, clientId, null);
+
+ responseWriter.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, getContentStyle(state == currentState), null);
+
+ if (!renderContentAsPlaceHolders || state == currentState) {
+ state.encodeContent(context, component);
+ }
+
+ responseWriter.endElement(HtmlConstants.DIV_ELEM);
+ }
+
+ public void encodeInitialState(FacesContext context, UIComponent component, ProgressBarState currentState)
+ throws IOException {
+ encodeStateFacet(context, component, ProgressBarState.initialState, currentState);
+ }
+
+ protected String getWidth(UIComponent component) {
+ Number value = NumberUtils.getNumber(component.getAttributes().get("value"));
+ Number minValue = NumberUtils.getNumber(component.getAttributes().get("minValue"));
+ Number maxValue = NumberUtils.getNumber(component.getAttributes().get("maxValue"));
+ Number percent = calculatePercent(value, minValue, maxValue);
+
+ return String.valueOf(percent.intValue());
+ }
+
+ /**
+ * Calculates percent value according to min & max value
+ *
+ * @param value
+ * @param minValue
+ * @param maxValue
+ * @return
+ */
+ protected Number calculatePercent(Number value, Number minValue, Number maxValue) {
+ if (minValue.doubleValue() < value.doubleValue() && value.doubleValue() < maxValue.doubleValue()) {
+ return (Number) ((value.doubleValue() - minValue.doubleValue()) * 100.0 / (maxValue.doubleValue() - minValue
+ .doubleValue()));
+ } else if (value.doubleValue() <= minValue.doubleValue()) {
+ return 0;
+ } else if (value.doubleValue() >= maxValue.doubleValue()) {
+ return 100;
+ }
+ return 0;
+ }
+
+ public void encodeProgressStateContent(FacesContext context, UIComponent component, ProgressBarState currentState)
+ throws IOException {
+ ResponseWriter responseWriter = context.getResponseWriter();
+ String stateClientId = ProgressBarState.progressState.getStateClientId(context, component);
+
+ responseWriter.startElement(HtmlConstants.DIV_ELEM, component);
+ responseWriter.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE,
+ ProgressBarState.progressState.getStyleClass(context, component), null);
+ responseWriter.writeAttribute(HtmlConstants.ID_ATTRIBUTE, stateClientId, null);
+
+ if (!renderContentAsPlaceHolders || currentState == ProgressBarState.progressState) {
+ ProgressBarState.progressState.encodeContent(context, component);
+ }
+
+ responseWriter.endElement(HtmlConstants.DIV_ELEM);
+ }
+
+ protected void encodeProgressStateProlog(FacesContext context, UIComponent component, ProgressBarState currentState)
+ throws IOException {
+
+ ResponseWriter responseWriter = context.getResponseWriter();
+ responseWriter.startElement(HtmlConstants.DIV_ELEM, component);
+ responseWriter.writeAttribute(HtmlConstants.ID_ATTRIBUTE, component.getClientId(context) + ".rmng",
+ null);
+ responseWriter.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE,
+ HtmlUtil.concatClasses("rf-pb-rmng", component.getAttributes().get("remainingClass")), null);
+
+
+ responseWriter.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE,
+ getContentStyle(currentState == ProgressBarState.progressState), null);
+
+ responseWriter.startElement(HtmlConstants.DIV_ELEM, component);
+ responseWriter.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE,
+ HtmlUtil.concatClasses("rf-pb-prgs", component.getAttributes().get("progressClass")), null);
+ responseWriter.writeAttribute(HtmlConstants.ID_ATTRIBUTE, component.getClientId(context) + ".prgs", null);
+ responseWriter.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, "width: " + getWidth(component) + "%", null);
+ responseWriter.endElement(HtmlConstants.DIV_ELEM);
+ }
+
+ protected void encodeProgressStateEpilog(FacesContext context, UIComponent component, ProgressBarState currentState)
+ throws IOException {
+
+ ResponseWriter responseWriter = context.getResponseWriter();
+ responseWriter.endElement(HtmlConstants.DIV_ELEM);
+ }
+
+ public void encodeProgressState(FacesContext context, UIComponent component, ProgressBarState currentState)
+ throws IOException {
+
+ encodeProgressStateProlog(context, component, currentState);
+ encodeProgressStateContent(context, component, currentState);
+ encodeProgressStateEpilog(context, component, currentState);
+ }
+
+ public void encodeCompleteState(FacesContext context, UIComponent component, ProgressBarState currentState)
+ throws IOException {
+ encodeStateFacet(context, component, ProgressBarState.finishState, currentState);
+ }
+}
Copied: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages (from rev 20206, trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages)
Deleted: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconBasic.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconBasic.java 2010-11-29 14:35:51 UTC (rev 20206)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconBasic.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -1,88 +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.renderkit.html.iconimages;
-
-import org.richfaces.resource.AbstractJava2DUserResource;
-import org.richfaces.resource.StateHolderResource;
-import org.richfaces.skin.Skin;
-import org.richfaces.skin.SkinFactory;
-
-import javax.faces.context.FacesContext;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Graphics2D;
-import java.awt.RenderingHints;
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-/**
- * @author Alex.Kolonitsky
- */
-public abstract class PanelMenuIconBasic extends AbstractJava2DUserResource implements StateHolderResource {
- private static final String TOP_BULLET_COLOR = Skin.HEADER_TEXT_COLOR;
- private static final String ORDINAL_BULLET_COLOR = Skin.HEADER_BACKGROUND_COLOR;
-
- private static final Dimension DIMENSION = new Dimension(16, 16);
-
- private Color color;
- private Color topBulletColor;
- private Color ordinalBulletColor;
-
- protected PanelMenuIconBasic() {
- super(DIMENSION);
- }
-
- public void paint(Graphics2D graphics2D) {
- if (color == null || graphics2D == null) {
- return;
- }
-
- graphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
- graphics2D.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
- graphics2D.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
- graphics2D.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
- graphics2D.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
-
- paintImage(graphics2D, color);
- }
-
- protected abstract void paintImage(Graphics2D g2d, Color color);
-
- public boolean isTransient() {
- return false;
- }
-
- public void writeState(FacesContext context, DataOutput dataOutput) throws IOException {
- Skin skin = SkinFactory.getInstance(context).getSkin(context);
- dataOutput.writeInt(skin.getColorParameter(context, Skin.SELECT_CONTROL_COLOR));
- dataOutput.writeInt(skin.getColorParameter(context, TOP_BULLET_COLOR));
- dataOutput.writeInt(skin.getColorParameter(context, ORDINAL_BULLET_COLOR));
- }
-
- public void readState(FacesContext context, DataInput dataInput) throws IOException {
- color = new Color(dataInput.readInt());
- topBulletColor = new Color(dataInput.readInt());
- ordinalBulletColor = new Color(dataInput.readInt());
- }
-
-}
Copied: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconBasic.java (from rev 20206, trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconBasic.java)
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconBasic.java (rev 0)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconBasic.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -0,0 +1,88 @@
+/**
+ * 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.renderkit.html.iconimages;
+
+import org.richfaces.resource.AbstractJava2DUserResource;
+import org.richfaces.resource.StateHolderResource;
+import org.richfaces.skin.Skin;
+import org.richfaces.skin.SkinFactory;
+
+import javax.faces.context.FacesContext;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+/**
+ * @author Alex.Kolonitsky
+ */
+public abstract class PanelMenuIconBasic extends AbstractJava2DUserResource implements StateHolderResource {
+ private static final String TOP_BULLET_COLOR = Skin.HEADER_TEXT_COLOR;
+ private static final String ORDINAL_BULLET_COLOR = Skin.HEADER_BACKGROUND_COLOR;
+
+ private static final Dimension DIMENSION = new Dimension(16, 16);
+
+ private Color color;
+ private Color topBulletColor;
+ private Color ordinalBulletColor;
+
+ protected PanelMenuIconBasic() {
+ super(DIMENSION);
+ }
+
+ public void paint(Graphics2D graphics2D) {
+ if (color == null || graphics2D == null) {
+ return;
+ }
+
+ graphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+ graphics2D.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
+ graphics2D.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
+ graphics2D.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+ graphics2D.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
+
+ paintImage(graphics2D, color);
+ }
+
+ protected abstract void paintImage(Graphics2D g2d, Color color);
+
+ public boolean isTransient() {
+ return false;
+ }
+
+ public void writeState(FacesContext context, DataOutput dataOutput) throws IOException {
+ Skin skin = SkinFactory.getInstance(context).getSkin(context);
+ dataOutput.writeInt(skin.getColorParameter(context, Skin.SELECT_CONTROL_COLOR));
+ dataOutput.writeInt(skin.getColorParameter(context, TOP_BULLET_COLOR));
+ dataOutput.writeInt(skin.getColorParameter(context, ORDINAL_BULLET_COLOR));
+ }
+
+ public void readState(FacesContext context, DataInput dataInput) throws IOException {
+ color = new Color(dataInput.readInt());
+ topBulletColor = new Color(dataInput.readInt());
+ ordinalBulletColor = new Color(dataInput.readInt());
+ }
+
+}
Deleted: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevron.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevron.java 2010-11-29 14:35:51 UTC (rev 20206)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevron.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -1,42 +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.renderkit.html.iconimages;
-
-import org.richfaces.resource.DynamicUserResource;
-
-import java.awt.geom.GeneralPath;
-
-@DynamicUserResource
-public class PanelMenuIconChevron extends PanelMenuIconChevronBasic {
-
- protected void draw(GeneralPath path) {
- path.moveTo(1, 1);
-
- path.lineTo(17, 1);
- path.lineTo(47, 31);
- path.lineTo(17, 61);
- path.lineTo(1, 61);
- path.lineTo(31, 31);
- path.closePath();
- }
-
-}
Copied: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevron.java (from rev 20206, trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevron.java)
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevron.java (rev 0)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevron.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -0,0 +1,42 @@
+/**
+ * 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.renderkit.html.iconimages;
+
+import org.richfaces.resource.DynamicUserResource;
+
+import java.awt.geom.GeneralPath;
+
+@DynamicUserResource
+public class PanelMenuIconChevron extends PanelMenuIconChevronBasic {
+
+ protected void draw(GeneralPath path) {
+ path.moveTo(1, 1);
+
+ path.lineTo(17, 1);
+ path.lineTo(47, 31);
+ path.lineTo(17, 61);
+ path.lineTo(1, 61);
+ path.lineTo(31, 31);
+ path.closePath();
+ }
+
+}
Deleted: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronBasic.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronBasic.java 2010-11-29 14:35:51 UTC (rev 20206)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronBasic.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -1,79 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.renderkit.html.iconimages;
-
-import java.awt.BasicStroke;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Graphics2D;
-import java.awt.RenderingHints;
-import java.awt.geom.AffineTransform;
-import java.awt.geom.GeneralPath;
-import java.awt.image.AffineTransformOp;
-import java.awt.image.BufferedImage;
-
-/**
- * @author Alex.Kolonitsky
- */
-public abstract class PanelMenuIconChevronBasic extends PanelMenuIconBasic {
- private static final int BUFFER_IMAGE_SIZE = 128;
-
- @Override
- protected void paintImage(Graphics2D graphics2d, Color color) {
-
- BufferedImage bufferedImage = new BufferedImage(BUFFER_IMAGE_SIZE, BUFFER_IMAGE_SIZE, BufferedImage.TYPE_INT_ARGB);
- Graphics2D g2d = bufferedImage.createGraphics();
-
- g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
- g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
- g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
- g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
- g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
- g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
- g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
-
- Dimension dimension = getDimension();
- g2d.setStroke(new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER));
- g2d.translate(28, 28);
- g2d.setColor(color);
-
- GeneralPath path = new GeneralPath();
- draw(path);
-
- g2d.fill(path);
- if (this instanceof PanelMenuIconChevron
- || this instanceof PanelMenuIconChevronLeft) {
- g2d.translate(24, 0);
- } else {
- g2d.translate(0, 24);
- }
- g2d.fill(path);
-
- AffineTransform transform = AffineTransform.getScaleInstance(dimension.getHeight() / BUFFER_IMAGE_SIZE, dimension.getHeight() / BUFFER_IMAGE_SIZE);
- AffineTransformOp transformOp = new AffineTransformOp(transform, AffineTransformOp.TYPE_BILINEAR);
-
- graphics2d.drawImage(bufferedImage, transformOp, 0, 0);
- g2d.dispose();
- }
-
- abstract void draw(GeneralPath draw);
-}
Copied: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronBasic.java (from rev 20206, trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronBasic.java)
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronBasic.java (rev 0)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronBasic.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -0,0 +1,79 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.renderkit.html.iconimages;
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.GeneralPath;
+import java.awt.image.AffineTransformOp;
+import java.awt.image.BufferedImage;
+
+/**
+ * @author Alex.Kolonitsky
+ */
+public abstract class PanelMenuIconChevronBasic extends PanelMenuIconBasic {
+ private static final int BUFFER_IMAGE_SIZE = 128;
+
+ @Override
+ protected void paintImage(Graphics2D graphics2d, Color color) {
+
+ BufferedImage bufferedImage = new BufferedImage(BUFFER_IMAGE_SIZE, BUFFER_IMAGE_SIZE, BufferedImage.TYPE_INT_ARGB);
+ Graphics2D g2d = bufferedImage.createGraphics();
+
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
+ g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
+ g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
+ g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
+ g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
+
+ Dimension dimension = getDimension();
+ g2d.setStroke(new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER));
+ g2d.translate(28, 28);
+ g2d.setColor(color);
+
+ GeneralPath path = new GeneralPath();
+ draw(path);
+
+ g2d.fill(path);
+ if (this instanceof PanelMenuIconChevron
+ || this instanceof PanelMenuIconChevronLeft) {
+ g2d.translate(24, 0);
+ } else {
+ g2d.translate(0, 24);
+ }
+ g2d.fill(path);
+
+ AffineTransform transform = AffineTransform.getScaleInstance(dimension.getHeight() / BUFFER_IMAGE_SIZE, dimension.getHeight() / BUFFER_IMAGE_SIZE);
+ AffineTransformOp transformOp = new AffineTransformOp(transform, AffineTransformOp.TYPE_BILINEAR);
+
+ graphics2d.drawImage(bufferedImage, transformOp, 0, 0);
+ g2d.dispose();
+ }
+
+ abstract void draw(GeneralPath draw);
+}
Deleted: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronDown.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronDown.java 2010-11-29 14:35:51 UTC (rev 20206)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronDown.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -1,42 +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.renderkit.html.iconimages;
-
-import org.richfaces.resource.DynamicUserResource;
-
-import java.awt.geom.GeneralPath;
-
-@DynamicUserResource
-public class PanelMenuIconChevronDown extends PanelMenuIconChevronBasic {
-
- protected void draw(GeneralPath path) {
-
- path.moveTo(1, 0);
- path.lineTo(31, 30);
- path.lineTo(61, 0);
- path.lineTo(61, 16);
- path.lineTo(31, 46);
- path.lineTo(1, 16);
- path.closePath();
-
- }
-}
Copied: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronDown.java (from rev 20206, trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronDown.java)
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronDown.java (rev 0)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronDown.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -0,0 +1,42 @@
+/**
+ * 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.renderkit.html.iconimages;
+
+import org.richfaces.resource.DynamicUserResource;
+
+import java.awt.geom.GeneralPath;
+
+@DynamicUserResource
+public class PanelMenuIconChevronDown extends PanelMenuIconChevronBasic {
+
+ protected void draw(GeneralPath path) {
+
+ path.moveTo(1, 0);
+ path.lineTo(31, 30);
+ path.lineTo(61, 0);
+ path.lineTo(61, 16);
+ path.lineTo(31, 46);
+ path.lineTo(1, 16);
+ path.closePath();
+
+ }
+}
Deleted: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronLeft.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronLeft.java 2010-11-29 14:35:51 UTC (rev 20206)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronLeft.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -1,41 +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.renderkit.html.iconimages;
-
-import org.richfaces.resource.DynamicUserResource;
-
-import java.awt.geom.GeneralPath;
-
-@DynamicUserResource
-public class PanelMenuIconChevronLeft extends PanelMenuIconChevronBasic {
-
- void draw(GeneralPath path) {
- path.moveTo(61, 1);
- path.lineTo(45, 1);
- path.lineTo(15, 31);
- path.lineTo(45, 61);
- path.lineTo(61, 61);
- path.lineTo(30, 31);
- path.closePath();
- }
-
-}
Copied: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronLeft.java (from rev 20206, trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronLeft.java)
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronLeft.java (rev 0)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronLeft.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -0,0 +1,41 @@
+/**
+ * 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.renderkit.html.iconimages;
+
+import org.richfaces.resource.DynamicUserResource;
+
+import java.awt.geom.GeneralPath;
+
+@DynamicUserResource
+public class PanelMenuIconChevronLeft extends PanelMenuIconChevronBasic {
+
+ void draw(GeneralPath path) {
+ path.moveTo(61, 1);
+ path.lineTo(45, 1);
+ path.lineTo(15, 31);
+ path.lineTo(45, 61);
+ path.lineTo(61, 61);
+ path.lineTo(30, 31);
+ path.closePath();
+ }
+
+}
Deleted: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronUp.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronUp.java 2010-11-29 14:35:51 UTC (rev 20206)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronUp.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -1,43 +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.renderkit.html.iconimages;
-
-import org.richfaces.resource.DynamicUserResource;
-
-import java.awt.geom.GeneralPath;
-
-@DynamicUserResource
-public class PanelMenuIconChevronUp extends PanelMenuIconChevronBasic {
-
- protected void draw(GeneralPath path) {
-
- path.moveTo(0, 46);
- path.lineTo(0, 31);
- path.lineTo(30, 1);
- path.lineTo(61, 31);
- path.lineTo(61, 46);
- path.lineTo(30, 16);
- path.closePath();
-
- }
-
-}
Copied: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronUp.java (from rev 20206, trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronUp.java)
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronUp.java (rev 0)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronUp.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -0,0 +1,43 @@
+/**
+ * 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.renderkit.html.iconimages;
+
+import org.richfaces.resource.DynamicUserResource;
+
+import java.awt.geom.GeneralPath;
+
+@DynamicUserResource
+public class PanelMenuIconChevronUp extends PanelMenuIconChevronBasic {
+
+ protected void draw(GeneralPath path) {
+
+ path.moveTo(0, 46);
+ path.lineTo(0, 31);
+ path.lineTo(30, 1);
+ path.lineTo(61, 31);
+ path.lineTo(61, 46);
+ path.lineTo(30, 16);
+ path.closePath();
+
+ }
+
+}
Deleted: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconDisc.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconDisc.java 2010-11-29 14:35:51 UTC (rev 20206)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconDisc.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -1,48 +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.renderkit.html.iconimages;
-
-import org.richfaces.resource.DynamicUserResource;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Graphics2D;
-import java.awt.RenderingHints;
-import java.awt.geom.Ellipse2D;
-
-@DynamicUserResource
-public class PanelMenuIconDisc extends PanelMenuIconBasic {
-
- @Override
- protected void paintImage(Graphics2D g2d, Color color) {
-
- Dimension dimension = getDimension();
- long dim = Math.round(dimension.getWidth() / 3);
-
- g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
- g2d.setColor(color);
- g2d.translate(dim, dim);
-
- g2d.fill(new Ellipse2D.Double(0, 0, dim, dim));
- }
-
-}
Copied: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconDisc.java (from rev 20206, trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconDisc.java)
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconDisc.java (rev 0)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconDisc.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -0,0 +1,48 @@
+/**
+ * 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.renderkit.html.iconimages;
+
+import org.richfaces.resource.DynamicUserResource;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.geom.Ellipse2D;
+
+@DynamicUserResource
+public class PanelMenuIconDisc extends PanelMenuIconBasic {
+
+ @Override
+ protected void paintImage(Graphics2D g2d, Color color) {
+
+ Dimension dimension = getDimension();
+ long dim = Math.round(dimension.getWidth() / 3);
+
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+ g2d.setColor(color);
+ g2d.translate(dim, dim);
+
+ g2d.fill(new Ellipse2D.Double(0, 0, dim, dim));
+ }
+
+}
Deleted: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconGrid.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconGrid.java 2010-11-29 14:35:51 UTC (rev 20206)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconGrid.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -1,67 +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.renderkit.html.iconimages;
-
-import org.richfaces.resource.DynamicUserResource;
-
-import java.awt.BasicStroke;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Graphics2D;
-import java.awt.RenderingHints;
-import java.awt.geom.Rectangle2D;
-
-@DynamicUserResource
-public class PanelMenuIconGrid extends PanelMenuIconBasic {
-
- @Override
- protected void paintImage(Graphics2D g2d, Color color) {
-
- g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
- g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
- g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
- g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
- g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
- g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
- g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
-
- Rectangle2D.Float path = new Rectangle2D.Float();
- Dimension dimension = getDimension();
-
- g2d.setStroke(new BasicStroke(16, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL));
- g2d.scale(dimension.getHeight() / 128, dimension.getHeight() / 128);
- g2d.translate(40, 40);
-
- path.setRect(0, 0, 40, 40);
-
- g2d.setColor(color);
-
- Color bcolor = new Color(1f, 1f, 1f, 0f);
-
- g2d.setBackground(bcolor);
- g2d.fill(path);
- g2d.clearRect(16, 0, 8, 40);
- g2d.clearRect(0, 16, 40, 8);
-
- }
-
-}
Copied: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconGrid.java (from rev 20206, trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconGrid.java)
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconGrid.java (rev 0)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconGrid.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -0,0 +1,67 @@
+/**
+ * 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.renderkit.html.iconimages;
+
+import org.richfaces.resource.DynamicUserResource;
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.geom.Rectangle2D;
+
+@DynamicUserResource
+public class PanelMenuIconGrid extends PanelMenuIconBasic {
+
+ @Override
+ protected void paintImage(Graphics2D g2d, Color color) {
+
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+ g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
+ g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
+ g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
+ g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
+
+ Rectangle2D.Float path = new Rectangle2D.Float();
+ Dimension dimension = getDimension();
+
+ g2d.setStroke(new BasicStroke(16, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL));
+ g2d.scale(dimension.getHeight() / 128, dimension.getHeight() / 128);
+ g2d.translate(40, 40);
+
+ path.setRect(0, 0, 40, 40);
+
+ g2d.setColor(color);
+
+ Color bcolor = new Color(1f, 1f, 1f, 0f);
+
+ g2d.setBackground(bcolor);
+ g2d.fill(path);
+ g2d.clearRect(16, 0, 8, 40);
+ g2d.clearRect(0, 16, 40, 8);
+
+ }
+
+}
Deleted: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconSpacer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconSpacer.java 2010-11-29 14:35:51 UTC (rev 20206)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconSpacer.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -1,35 +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.renderkit.html.iconimages;
-
-import org.richfaces.resource.DynamicUserResource;
-
-import java.awt.Color;
-import java.awt.Graphics2D;
-
-@DynamicUserResource
-public class PanelMenuIconSpacer extends PanelMenuIconBasic {
-
- protected void paintImage(Graphics2D g2d, Color color) {
- }
-
-}
Copied: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconSpacer.java (from rev 20206, trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconSpacer.java)
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconSpacer.java (rev 0)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconSpacer.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -0,0 +1,35 @@
+/**
+ * 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.renderkit.html.iconimages;
+
+import org.richfaces.resource.DynamicUserResource;
+
+import java.awt.Color;
+import java.awt.Graphics2D;
+
+@DynamicUserResource
+public class PanelMenuIconSpacer extends PanelMenuIconBasic {
+
+ protected void paintImage(Graphics2D g2d, Color color) {
+ }
+
+}
Deleted: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangle.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangle.java 2010-11-29 14:35:51 UTC (rev 20206)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangle.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -1,41 +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.renderkit.html.iconimages;
-
-import org.richfaces.resource.DynamicUserResource;
-
-import java.awt.*;
-import java.awt.geom.GeneralPath;
-
-@DynamicUserResource
-public class PanelMenuIconTriangle extends PanelMenuIconTriangleBasic {
-
- void draw(GeneralPath path, Graphics2D g2d) {
- g2d.translate(47, 30);
- path.moveTo(0, 0);
- path.lineTo(33, 33);
- path.lineTo(33, 34);
- path.lineTo(0, 67);
- path.closePath();
-
- }
-}
Copied: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangle.java (from rev 20206, trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangle.java)
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangle.java (rev 0)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangle.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -0,0 +1,41 @@
+/**
+ * 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.renderkit.html.iconimages;
+
+import org.richfaces.resource.DynamicUserResource;
+
+import java.awt.*;
+import java.awt.geom.GeneralPath;
+
+@DynamicUserResource
+public class PanelMenuIconTriangle extends PanelMenuIconTriangleBasic {
+
+ void draw(GeneralPath path, Graphics2D g2d) {
+ g2d.translate(47, 30);
+ path.moveTo(0, 0);
+ path.lineTo(33, 33);
+ path.lineTo(33, 34);
+ path.lineTo(0, 67);
+ path.closePath();
+
+ }
+}
Deleted: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleBasic.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleBasic.java 2010-11-29 14:35:51 UTC (rev 20206)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleBasic.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -1,54 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.renderkit.html.iconimages;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Graphics2D;
-import java.awt.RenderingHints;
-import java.awt.geom.GeneralPath;
-
-/**
- * @author Anton Belevich
- */
-public abstract class PanelMenuIconTriangleBasic extends PanelMenuIconBasic {
-
- protected void paintImage(Graphics2D g2d, Color color) {
-
- g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
- g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
- g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
-
- GeneralPath path = new GeneralPath();
-
- Dimension dimension = getDimension();
- g2d.scale(dimension.getHeight() / 128, dimension.getHeight() / 128);
-
- draw(path, g2d);
-
- g2d.setColor(color);
- g2d.fill(path);
-
- }
-
- abstract void draw(GeneralPath path, Graphics2D g2d);
-
-}
Copied: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleBasic.java (from rev 20206, trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleBasic.java)
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleBasic.java (rev 0)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleBasic.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -0,0 +1,54 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.renderkit.html.iconimages;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.geom.GeneralPath;
+
+/**
+ * @author Anton Belevich
+ */
+public abstract class PanelMenuIconTriangleBasic extends PanelMenuIconBasic {
+
+ protected void paintImage(Graphics2D g2d, Color color) {
+
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+ g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
+
+ GeneralPath path = new GeneralPath();
+
+ Dimension dimension = getDimension();
+ g2d.scale(dimension.getHeight() / 128, dimension.getHeight() / 128);
+
+ draw(path, g2d);
+
+ g2d.setColor(color);
+ g2d.fill(path);
+
+ }
+
+ abstract void draw(GeneralPath path, Graphics2D g2d);
+
+}
Deleted: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleDown.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleDown.java 2010-11-29 14:35:51 UTC (rev 20206)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleDown.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -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.renderkit.html.iconimages;
-
-import org.richfaces.resource.DynamicUserResource;
-
-import java.awt.Graphics2D;
-import java.awt.geom.GeneralPath;
-
-@DynamicUserResource
-public class PanelMenuIconTriangleDown extends PanelMenuIconTriangleBasic {
-
- void draw(GeneralPath path, Graphics2D g2d) {
-
- g2d.translate(31, 54);
-
- path.moveTo(0, 0);
- path.lineTo(33, 33);
- path.lineTo(34, 33);
- path.lineTo(67, 0);
- path.closePath();
-
- }
-
-}
Copied: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleDown.java (from rev 20206, trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleDown.java)
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleDown.java (rev 0)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleDown.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -0,0 +1,44 @@
+/**
+ * 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.renderkit.html.iconimages;
+
+import org.richfaces.resource.DynamicUserResource;
+
+import java.awt.Graphics2D;
+import java.awt.geom.GeneralPath;
+
+@DynamicUserResource
+public class PanelMenuIconTriangleDown extends PanelMenuIconTriangleBasic {
+
+ void draw(GeneralPath path, Graphics2D g2d) {
+
+ g2d.translate(31, 54);
+
+ path.moveTo(0, 0);
+ path.lineTo(33, 33);
+ path.lineTo(34, 33);
+ path.lineTo(67, 0);
+ path.closePath();
+
+ }
+
+}
Deleted: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleLeft.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleLeft.java 2010-11-29 14:35:51 UTC (rev 20206)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleLeft.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -1,41 +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.renderkit.html.iconimages;
-
-import org.richfaces.resource.DynamicUserResource;
-
-import java.awt.Graphics2D;
-import java.awt.geom.GeneralPath;
-
-@DynamicUserResource
-public class PanelMenuIconTriangleLeft extends PanelMenuIconTriangleBasic {
-
- void draw(GeneralPath path, Graphics2D g2d) {
- g2d.translate(47, 30);
- path.moveTo(33, 0);
- path.lineTo(0, 33);
- path.lineTo(0, 34);
- path.lineTo(33, 67);
- path.closePath();
- }
-
-}
Copied: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleLeft.java (from rev 20206, trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleLeft.java)
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleLeft.java (rev 0)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleLeft.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -0,0 +1,41 @@
+/**
+ * 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.renderkit.html.iconimages;
+
+import org.richfaces.resource.DynamicUserResource;
+
+import java.awt.Graphics2D;
+import java.awt.geom.GeneralPath;
+
+@DynamicUserResource
+public class PanelMenuIconTriangleLeft extends PanelMenuIconTriangleBasic {
+
+ void draw(GeneralPath path, Graphics2D g2d) {
+ g2d.translate(47, 30);
+ path.moveTo(33, 0);
+ path.lineTo(0, 33);
+ path.lineTo(0, 34);
+ path.lineTo(33, 67);
+ path.closePath();
+ }
+
+}
Deleted: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleUp.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleUp.java 2010-11-29 14:35:51 UTC (rev 20206)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleUp.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -1,42 +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.renderkit.html.iconimages;
-
-import org.richfaces.resource.DynamicUserResource;
-
-import java.awt.Graphics2D;
-import java.awt.geom.GeneralPath;
-
-@DynamicUserResource
-public class PanelMenuIconTriangleUp extends PanelMenuIconTriangleBasic {
-
- void draw(GeneralPath path, Graphics2D g2d) {
- g2d.translate(31, 47);
-
- path.moveTo(0, 33);
- path.lineTo(33, 0);
- path.lineTo(34, 0);
- path.lineTo(67, 33);
- path.closePath();
- }
-
-}
Copied: branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleUp.java (from rev 20206, trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleUp.java)
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleUp.java (rev 0)
+++ branches/RF-8742-1/ui/output/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleUp.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -0,0 +1,42 @@
+/**
+ * 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.renderkit.html.iconimages;
+
+import org.richfaces.resource.DynamicUserResource;
+
+import java.awt.Graphics2D;
+import java.awt.geom.GeneralPath;
+
+@DynamicUserResource
+public class PanelMenuIconTriangleUp extends PanelMenuIconTriangleBasic {
+
+ void draw(GeneralPath path, Graphics2D g2d) {
+ g2d.translate(31, 47);
+
+ path.moveTo(0, 33);
+ path.lineTo(33, 0);
+ path.lineTo(34, 0);
+ path.lineTo(67, 33);
+ path.closePath();
+ }
+
+}
Modified: branches/RF-8742-1/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml 2010-11-29 18:01:15 UTC (rev 20208)
@@ -769,7 +769,6 @@
<component-class>org.richfaces.component.html.HtmlTab</component-class>
</component>
-<!--
<component>
<component-type>org.richfaces.PanelMenuItem</component-type>
<component-class>org.richfaces.component.html.HtmlPanelMenuItem</component-class>
@@ -949,7 +948,6 @@
<property-class>java.lang.Object</property-class>
</property>
</component>
--->
<render-kit>
<render-kit-id>HTML_BASIC</render-kit-id>
@@ -1021,7 +1019,7 @@
</renderer-extension>
</renderer>
-<!-- <renderer>
+ <renderer>
<component-family>org.richfaces.PanelMenuItem</component-family>
<renderer-type>org.richfaces.PanelMenuItem</renderer-type>
<renderer-class>org.richfaces.renderkit.html.PanelMenuItemRenderer</renderer-class>
@@ -1035,7 +1033,7 @@
<component-family>org.richfaces.PanelMenu</component-family>
<renderer-type>org.richfaces.PanelMenu</renderer-type>
<renderer-class>org.richfaces.renderkit.html.PanelMenuRenderer</renderer-class>
- </renderer>-->
+ </renderer>
<client-behavior-renderer>
<client-behavior-renderer-type>org.richfaces.component.behavior.ToggleControl</client-behavior-renderer-type>
Modified: branches/RF-8742-1/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml 2010-11-29 18:01:15 UTC (rev 20208)
@@ -51,7 +51,6 @@
</component>
</tag>
-<!--
<tag>
<tag-name>panelMenuItem</tag-name>
<component>
@@ -659,7 +658,6 @@
</attribute>
</tag>
--->
<tag>
<tag-name>tooltip</tag-name>
@@ -1710,5 +1708,5 @@
<type>java.lang.String</type>
</attribute>
</tag>
-
+
</facelet-taglib>
Modified: branches/RF-8742-1/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenu.ecss
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenu.ecss 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenu.ecss 2010-11-29 18:01:15 UTC (rev 20208)
@@ -21,52 +21,247 @@
*/
.rf-pm {
- border:1px solid red;
- padding:10px;
}
.rf-pm-itm {
- border:1px solid #ffd700;
+ border-top-width: 1px;
+ border-top-style: solid;
+ border-top-color: '#{richSkin.panelBorderColor}';
+
+ color: '#{richSkin.generalTextColor}';
+ padding: 2px 1px 2px 2px;
+ cursor: pointer;
+ white-space: nowrap;
}
+.rf-pm-itm-gr {
+ width: 100%;
+}
+
+.rf-pm-itm-ico {
+ width: 16px;
+ height: 16px;
+ background-position: right;
+ background-repeat: no-repeat;
+ margin: 0px 3px;
+}
+
+.rf-pm-itm-lbl {
+ display: inline-block;
+ padding: 2px 0px 3px 0px;
+ font-size: '#{richSkin.generalSizeFont}';
+ font-family: '#{richSkin.generalFamilyFont}';
+ white-space: normal !important;
+}
+
+.rf-pm-itm-exp-ico {
+ width: 16px;
+ height: 16px;
+ background-position: right;
+ background-repeat: no-repeat;
+ margin: 0px 3px;
+}
+
.rf-pm-itm-hov {
- background-color:#ffd700;
+ background-color: '#{richSkin.additionalBackgroundColor}';
}
.rf-pm-itm-sel {
- background-color:blue;
- color:#f5f5f5;
+ background-color: '#{richSkin.additionalBackgroundColor}';
+ font-style:italic;
}
.rf-pm-gr {
+ border-top-width: 1px;
+ border-top-style: solid;
+ border-top-color: '#{richSkin.panelBorderColor}';
+ margin-bottom: 3px
}
.rf-pm-gr-hov {
- background-color:green;
- color:white;
+ background: '#{richSkin.additionalBackgroundColor}';
+
+ color: white;
}
.rf-pm-gr-sel {
- background-color:blue;
- color:#f5f5f5;
+ background: '#{richSkin.additionalBackgroundColor}';
+ font-style:italic;
}
.rf-pm-gr-hdr {
- border:1px solid green;
- padding:2px;
+ font-weight: bold;
+ color: '#{richSkin.generalTextColor}';
+
+ padding: 2px 1px 2px 2px;
+ cursor: pointer;
+ white-space: nowrap;
}
.rf-pm-gr-cnt {
- border:1px solid yellow;
- padding:2px;
- margin-left: 10px;
}
+.rf-pm-gr-gr {
+ width: 100%;
+}
+
+.rf-pm-gr-ico {
+ width: 16px;
+ height: 16px;
+ background-position: right;
+ background-repeat: no-repeat;
+ margin: 0px 3px;
+}
+
+.rf-pm-gr-lbl {
+ display: inline-block;
+ padding: 2px 0px 3px 0px;
+ font-size: '#{richSkin.generalSizeFont}';
+ font-family: '#{richSkin.generalFamilyFont}';
+ white-space: normal !important;
+}
+
+.rf-pm-gr-exp-ico {
+ width: 16px;
+ height: 16px;
+ background-position: right;
+ background-repeat: no-repeat;
+ margin: 0px 3px;
+}
+
+.rf-pm-top-itm {
+ color: '#{richSkin.generalTextColor}';
+ padding: 2px 1px 2px 2px;
+ cursor: pointer;
+ white-space: nowrap;
+
+ border-top-width: 1px;
+ border-top-style: solid;
+ border-top-color: '#{richSkin.panelBorderColor}';
+}
+
+.rf-pm-top-itm-gr {
+ width: 100%;
+}
+
+.rf-pm-top-itm-ico {
+ width: 16px;
+ height: 16px;
+ background-position: right;
+ background-repeat: no-repeat;
+ margin: 0px 3px;
+}
+
+.rf-pm-top-itm-lbl {
+ display: inline-block;
+ padding: 2px 0px 3px 0px;
+ font-size: '#{richSkin.generalSizeFont}';
+ font-family: '#{richSkin.generalFamilyFont}';
+ white-space: normal !important;
+}
+
+.rf-pm-top-itm-exp-ico {
+ width: 16px;
+ height: 16px;
+ background-position: right;
+ background-repeat: no-repeat;
+ margin: 0px 3px;
+}
+
+.rf-pm-top-itm-hov {
+ background-color:#ffd700;
+}
+
+.rf-pm-top-itm-sel {
+ background: '#{richSkin.additionalBackgroundColor}';
+ font-style:italic;
+}
+
+.rf-pm-top-gr {
+ border-width: 1px;
+ border-style: solid;
+ border-color: '#{richSkin.panelBorderColor}';
+ margin-bottom: 3px
+}
+
+.rf-pm-top-gr-hov {
+ background-color: green;
+ color: white;
+}
+
+.rf-pm-top-gr-sel {
+ background-color: blue;
+ color: #f5f5f5;
+
+ font-style:italic;
+}
+
+.rf-pm-top-gr-hdr {
+ color: '#{richSkin.headerTextColor}';
+ padding: 2px 1px 2px 2px;
+ cursor: pointer;
+ padding-top: 2px;
+ cursor: pointer;
+ white-space: nowrap;
+
+ background-image: "url(#{resource['org.richfaces.images:pmenu_bg.png']})";
+ background-position: top left;
+ background-repeat: repeat-x;
+ background-color: '#{richSkin.headerBackgroundColor}';
+ font-weight: bold;
+}
+
+.rf-pm-top-gr-cnt {
+}
+
+.rf-pm-top-gr-gr {
+ width: 100%;
+}
+
+.rf-pm-top-gr-ico {
+ width: 16px;
+ height: 16px;
+ background-position: right;
+ background-repeat: no-repeat;
+ margin: 0px 3px;
+}
+
+.rf-pm-top-gr-lbl {
+ display: inline-block;
+ padding: 2px 0px 3px 0px;
+ font-size: '#{richSkin.generalSizeFont}';
+ font-family: '#{richSkin.generalFamilyFont}';
+ white-space: normal !important;
+}
+
+.rf-pm-top-gr-exp-ico {
+ width: 16px;
+ height: 16px;
+ background-position: right;
+ background-repeat: no-repeat;
+ margin: 0px 3px;
+}
+
.rf-pm-colps {
- display : none;
+ display: none;
}
.rf-pm-exp {
- display : block;
+ display: block;
}
+
+
+/* Icons */
+
+.rf-pm-chevron { background-image: "url(#{resource['org.richfaces.images:Chevron.png']})" }
+.rf-pm-chevron-down { background-image: "url(#{resource['org.richfaces.images:ChevronDown.png']})" }
+.rf-pm-chevron-left { background-image: "url(#{resource['org.richfaces.images:ChevronLeft.png']})" }
+.rf-pm-chevron-up { background-image: "url(#{resource['org.richfaces.images:ChevronUp.png']})" }
+.rf-pm-disc { background-image: "url(#{resource['org.richfaces.images:Disc.png']})" }
+.rf-pm-grid { background-image: "url(#{resource['org.richfaces.images:Grid.png']})" }
+.rf-pm-spacer { background-image: "url(#{resource['org.richfaces.images:Spacer.png']})" }
+.rf-pm-triangle { background-image: "url(#{resource['org.richfaces.images:Triangle.png']})" }
+.rf-pm-triangle-down { background-image: "url(#{resource['org.richfaces.images:TriangleDown.png']})" }
+.rf-pm-triangle-left { background-image: "url(#{resource['org.richfaces.images:TriangleLeft.png']})" }
+.rf-pm-triangle-up { background-image: "url(#{resource['org.richfaces.images:TriangleUp.png']})" }
\ No newline at end of file
Modified: branches/RF-8742-1/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/progressBar.ecss
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/progressBar.ecss 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/progressBar.ecss 2010-11-29 18:01:15 UTC (rev 20208)
@@ -1,44 +1,48 @@
-.rf-pb-cnt{
-height : 13px;
-white-space : nowrap;
-width : 200px;
-}
-.rf-pb-upl{
-background-repeat : repeat-x;
-background-image : "url(#{resource['org.richfaces.images:pbAniBg.gif']})";
-background-color : '#{richSkin.selectControlColor}';
-height : 13px;
+.rf-pb-rmng {
+ height: 13px;
+ white-space: nowrap;
+ width: 200px;
+
+ position: relative;
+ border-width: 1px;
+ border-style: solid;
+ border-color: '#{richSkin.panelBorderColor}';
+
+ overflow: hidden;
+ color: '#{richSkin.controlTextColor}';
+
+ font-family: '#{richSkin.generalFamilyFont}';
+ font-size: '#{richSkin.generalSizeFont}';
+ font-weight: bold;
+
+ text-align: center;
+ text-color: '#{richSkin.controlTextColor}';
+
+ background-color: '#{richSkin.controlBackgroundColor}';
+ padding: 0px;
}
-.rf-pb-upl-dig{
-overflow : hidden; position : absolute; top : 0px; left : 0px;
-border-color : '#{richSkin.panelBorderColor}';
+
+.rf-pb-prgs {
+ overflow: hidden;
+ border-color: '#{richSkin.panelBorderColor}';
+ background-repeat: repeat-x;
+ background-color: '#{richSkin.selectControlColor}';
+ height: 100%;
+ padding: 0px;
+ background-image: "url(#{resource['org.richfaces.images:pbAniBg.gif']})";
}
-.rf-pb-shl{
-margin-bottom : 2px; border : 1px solid;
-background-color : '#{richSkin.controlBackgroundColor}';
-border-color : '#{richSkin.panelBorderColor}';
+
+.rf-pb-lbl {
+ position: absolute;
+ top: 0px;
+ left: 0px;
+ padding: 0px;
+ text-align: center;
+ width: 100%;
}
-.rf-pb-shl-dig{
-position : relative; margin-bottom : 2px; border : 1px solid; overflow: hidden;
-border-color : '#{richSkin.panelBorderColor}';
-color : '#{richSkin.controlTextColor}';
-font-family : '#{richSkin.generalFamilyFont}';
-font-size : '#{richSkin.generalSizeFont}';
-}
-.rf-pb-rmnd{
-text-align : center; font-weight : bold; position : relative;
-background-color : '#{richSkin.controlBackgroundColor}';
-text-color : '#{richSkin.controlTextColor}';
-height : 13px;
-width : 200px;
-padding: 0px;
-}
-.rf-pb-cmpltd{
-text-align : center; font-weight : bold; background-repeat : repeat-x;
-background-color : '#{richSkin.selectControlColor}';
-text-color : '#{richSkin.controlBackgroundColor}';
-height : 13px;
-width : 200px;
-padding: 0px;
-background-image : "url(#{resource['org.richfaces.images:pbAniBg.gif']})";
-}
+
+.rf-pb-init, .rf-pb-fin {
+ color: '#{richSkin.generalTextColor}';
+ font-family: '#{richSkin.generalFamilyFont}';
+ font-size: '#{richSkin.generalSizeFont}';
+}
\ No newline at end of file
Modified: branches/RF-8742-1/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/progressBar.js
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/progressBar.js 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/progressBar.js 2010-11-29 18:01:15 UTC (rev 20208)
@@ -1,28 +1,39 @@
-//ProgressBar = {};
-//ProgressBar = Class.create();
(function ($, rf) {
rf.ui = rf.ui || {};
+ var defaultOptions = {
+ interval: 1000,
+ minValue: 0,
+ maxValue: 100
+ };
+
+ var stateSelectors = {
+ initial: '> .rf-pb-init',
+ progress: '> .rf-pb-rmng',
+ finish: '> .rf-pb-fin'
+ };
+
// Constructor definition
rf.ui.ProgressBar = function(componentId, options) {
// call constructor of parent class
$super.constructor.call(this, componentId);
this.id = componentId;
- this.attachToDom(this.id);
+ this.__elt = this.attachToDom(this.id);
this.options = $.extend({}, defaultOptions, options);
- var f = this.getForm();
- this.formId = (f) ? f.id : null;
- this.disabled = false;
- this.state = this.options.state;
- this.value = this.options.value;
+ this.enabled = this.options.enabled;
this.minValue = this.options.minValue;
this.maxValue = this.options.maxValue;
- var component = this;
- this.options.beforedomupdate = function(event) {
- component.onComplete(event.data);
- }
+ this.__setValue(this.options.value);
+ if (this.options.submitFunction) {
+ this.submitFunction = new Function("beforeUpdateHandler", "afterUpdateHandler", "params", "event", this.options.submitFunction);
+ this.__poll();
+ }
+
+ if (this.options.onfinish) {
+ rf.Event.bind(this.__elt, "finish", new Function("event", this.options.onfinish));
+ }
};
// Extend component class and add protected methods from parent class to our container
@@ -31,263 +42,150 @@
// define super class link
var $super = rf.ui.ProgressBar.$super;
- var defaultOptions = {
- mode: "ajax",
- minValue: 0,
- maxValue: 100,
- state : "initialState"
- };
-
- var getForm = function () {
- var parentForm = rf.getDomElement(this.id);
- while (parentForm.tagName && parentForm.tagName.toLowerCase() != 'form') {
- parentForm = parentForm.parentNode;
- }
- return parentForm;
- };
-
- var getValue = function () {
- return this.value;
- };
-
- var getParameter = function (ev, params, paramName) {
- if (!params) {
- params = ev;
- }
- if (params && params[paramName]) {
- return params[paramName];
- }
- return params;
- };
-
- var onComplete = function (data) {
- if (!rf.getDomElement(this.id) || this.disabled) { return; }
- if (data) {
- this.value = data['value'];
- if (this.state == "progressState") {
- if (this.value > this.getMaxValue()) {
- this.options.enabled=false;
- this.forceState("completeState",null);
- return;
+ $.extend(rf.ui.ProgressBar.prototype, (function() {
+ return {
+ name: "ProgressBar",
+
+ __isInitialState: function() {
+ return parseFloat(this.value) <= parseFloat(this.getMinValue());
+ },
+
+ __isProgressState: function() {
+ return !this.__isInitialState() && !this.__isFinishState();
+ },
+
+ __isFinishState: function() {
+ return parseFloat(this.value) > parseFloat(this.getMaxValue());
+ },
+
+ __beforeUpdate: function(event) {
+ if (event.componentData && typeof event.componentData[this.id] != 'undefined') {
+ this.setValue(event.componentData[this.id]);
+ }
+ },
+
+ __afterUpdate: function(event) {
+ this.__poll();
+ },
+
+ __submit: function() {
+ this.submitFunction.call(this, $.proxy(this.__beforeUpdate, this), $.proxy(this.__afterUpdate, this),
+ this.__params || {});
+ },
+
+ __poll: function(immediate) {
+ if (this.enabled) {
+ if (immediate) {
+ this.__submit();
+ } else {
+ this.__pollTimer = setTimeout($.proxy(this.__submit, this), this.options.interval);
+ }
+ }
+ },
+
+ __calculatePercent: function(v) {
+ var min = parseFloat(this.getMinValue());
+ var max = parseFloat(this.getMaxValue());
+ var value = parseFloat(v);
+ if (min < value && value < max) {
+ return (100 * (value - min)) / (max - min);
+ } else if (value <= min) {
+ return 0;
+ } else if (value >= max) {
+ return 100;
+ }
+ },
+
+ __getPropertyOrObject: function(obj, propName) {
+ if ($.isPlainObject(obj) && obj.propName) {
+ return obj.propName;
+ }
+
+ return obj;
+ },
+
+ getValue: function() {
+ return this.value;
+ },
+
+ __showState: function (state) {
+ var stateElt = $(stateSelectors[state], this.__elt);
+ stateElt.show().siblings().hide();
+ },
+
+ __setValue: function(val, initialStateSetup) {
+ this.value = parseFloat(this.__getPropertyOrObject(val, "value"));
+
+ if (this.__isFinishState()) {
+ this.disable();
}
- this.updateComponent(data);
- this.renderLabel(data['markup'], data['context']);
- } else if (this.state == "initialState" && this.value > this.getMinValue()) {
- this.state = "progressState";
- this.forceState("progressState");
- return;
- }
- this.poll();
- }
-
- };
- var poll = function () {
- if(this.options.enabled){
- this.options.parameters = this.options.parameters || {};
- this.options.parameters['percent'] = "percent";
- this.options.parameters[this.id] = this.id;
- var component = this;
- window.setTimeout(function(){
- if(component.options.onsubmit){
- var onsubmit = eval(component.options.onsubmit)
- var result = onsubmit.call(component);
- if (result!=false) {
- result = true;
- }
- if(result){
- rf.ajax(component.options.pollId, null, component.options);
+ },
+
+ __updateVisualState: function() {
+ if (this.__isInitialState()) {
+ this.__showState("initial");
+ } else if (this.__isFinishState()) {
+ rf.Event.callHandler(this.__elt, "finish");
+ this.__showState("finish");
+ } else {
+ this.__showState("progress");
+
+ var p = this.__calculatePercent(this.value);
+ $(".rf-pb-prgs", this.__elt).css('width', p + "%");
}
- }else{
- rf.ajax(component.options.pollId, null, component.options);
- }
+ },
- },this.options.pollinterval);
- }
- };
-
- var updateComponent = function (data) {
- this.setValue(this.value);
- if (!data['enabled']) { this.disable(); }
- this.updateClassName(rf.getDomElement(this.id + ":complete"), data['completeClass']);
- this.updateClassName(rf.getDomElement(this.id + ":remain"), data['remainClass']);
- this.updateClassName(rf.getDomElement(this.id), data['styleClass']);
-
- if (this.options.pollinterval != data['interval']) {
- this.options.pollinterval = data['interval'];
- }
- };
-
- var updateClassName = function (o, newName) {
- if (!newName) return;
- if (o && o.className) {
- if (o.className.indexOf(newName) < 0){
- o.className = o.className + " " + newName;
- }
- }
- };
- var getContext = function () {
- var context = this.context;
- if (!context) { context = {}; }
- context['minValue'] = (this.minValue == 0 ? "0" : this.minValue);
- context['maxValue'] = (this.maxValue == 0 ? "0" : this.maxValue);
- context['value'] = (this.value == 0 ? "0" : this.value);
- if (this.progressVar) {
- context[this.progressVar] = context['value'];
- }
- return context;
- };
+ setValue: function(val) {
+ this.__setValue(val);
+ this.__updateVisualState();
+ },
+
+ getMaxValue: function() {
+ return this.maxValue;
+ },
- var getMode = function () {
- return this.mode;
- };
- var getMaxValue = function () {
- return this.maxValue;
- };
- var getMinValue = function () {
- return this.minValue;
- };
- var isAjaxMode = function () {
- return (this.getMode() == "ajax");
- };
- var calculatePercent = function(v) {
- var min = parseFloat(this.getMinValue());
- var max = parseFloat(this.getMaxValue());
- var value = parseFloat(v);
- if (value > min && value < max) {
- return (100*(value - min))/(max - min);
- } else if (value <= min) {
- return 0;
- } else if (value >= max) {
- return 100;
- }
- };
- var setValue = function (ev, val) {
- val = this.getParameter(ev, val, "value");
- this.value = val;
- if (!this.isAjaxMode()) {
- if (parseFloat(val) <= parseFloat(this.getMinValue())) {
- this.switchState("initialState");
- }else if (parseFloat(val) > parseFloat(this.getMaxValue())) {
- this.switchState("completeState");
- }else {
- this.switchState("progressState");
- }
- }
- if (!this.isAjaxMode() && this.state != "progressState") return;
-
- if (this.markup) {
- this.renderLabel(this.markup, this.getContext());
- }
- var p = this.calculatePercent(val);
- var d = $(rf.getDomElement(this.id + ":upload"));
- if (d != null) d.css('width', p + "%");
-
- };
-
- var renderLabel = function (markup, context) {
- if (!markup || this.state != "progressState") {
- return;
- }
- if (!context) {
- context = this.getContext();
- }
- var html = this.interpolate(markup, context);
- var remain = rf.getDomElement(this.id + ":remain");
- var complete = rf.getDomElement(this.id + ":complete");
- if(remain && complete){
- remain.innerHTML = complete.innerHTML = html;
- }
-
- };
- var interpolate = function (placeholders, context) {
- for(var k in context) {
- var v = context[k];
- var regexp = new RegExp("\\{" + k + "\\}", "g");
- placeholders = placeholders.replace(regexp, v);
- }
- return placeholders;
- };
+ getMinValue: function() {
+ return this.minValue;
+ },
- var enable = function (ev) {
- if (!this.isAjaxMode()) {
- this.switchState("progressState");
- this.setValue(this.getMinValue() + 1);
- }else if (!(this.value > this.getMaxValue())) {
- this.disable();
- this.poll();
+ isAjaxMode: function () {
+ return !!this.submitFunction;
+ },
+
+ disable: function () {
+ this.__params = null;
+ if (this.__pollTimer) {
+ clearTimeout(this.__pollTimer);
+ this.__pollTimer = null;
+ }
+
+ this.enabled = false;
+ },
+
+ enable: function (params) {
+ if (this.isEnabled()) {
+ return;
+ }
+
+ this.__params = params;
+ this.enabled = true;
+
+ if (this.isAjaxMode()) {
+ this.__poll(true);
+ }
+
+ },
+
+ isEnabled: function() {
+ return this.enabled;
+ },
+
+ destroy: function() {
+ this.disable();
+ this.__elt = null;
+ $super.destroy.call(this);
+ }
}
- this.disabled = false;
- };
- var disable = function () {
- this.disabled = true;
- };
- var finish = function () {
- if (!this.isAjaxMode()) {
- this.switchState("completeState");
- }else {
- this.disable();
- this.forceState("complete");
- }
- };
- var hideAll = function () {
- $(rf.getDomElement(this.id + ":progressState")).hide();
- $(rf.getDomElement(this.id + ":completeState")).hide();
- $(rf.getDomElement(this.id + ":initialState")).hide();
- };
- var switchState = function (state) {
- this.state = state;
- this.hideAll();
- $(rf.getDomElement(this.id + ":" + state)).show();
- };
- var renderState = function (state) {
- this.state = state;
- this.hideAll();
- $(rf.getDomElement(this.id + ":" + state)).show();
- };
- var forceState = function (state, oncomplete) {
- var options = {};
- options['parameters'] = options['parameters'] || {};
- options['parameters']['forcePercent'] = state;
- options['parameters'][this.id] = this.id;
- if (oncomplete) {
- options['oncomplete'] = oncomplete;
- }
- rf.ajax(this.formId, null, options);
- };
+ } ()));
- /*
- * Prototype definition
- */
- $.extend(rf.ui.ProgressBar.prototype, (function () {
- return {
- /*
- * public API functions
- */
- name:"ProgressBar",
- getForm: getForm,
- getValue: getValue,
- getParameter: getParameter,
- onComplete: onComplete,
- poll: poll,
- updateComponent: updateComponent,
- updateClassName: updateClassName,
- getContext: getContext,
- getMode: getMode,
- getMaxValue: getMaxValue,
- getMinValue: getMinValue,
- isAjaxMode: isAjaxMode,
- calculatePercent: calculatePercent,
- setValue: setValue,
- enable: enable,
- disable: disable,
- finish: finish,
- hideAll: hideAll,
- interpolate: interpolate,
- renderLabel: renderLabel,
- switchState: switchState,
- renderState: renderState,
- forceState: forceState
-
- };
- })());
})(jQuery, RichFaces);
Modified: branches/RF-8742-1/ui/output/ui/src/main/resources/META-INF/richfaces/resource-mappings.properties
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/main/resources/META-INF/richfaces/resource-mappings.properties 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/ui/output/ui/src/main/resources/META-INF/richfaces/resource-mappings.properties 2010-11-29 18:01:15 UTC (rev 20208)
@@ -7,10 +7,35 @@
org.richfaces.images\:actTabBg.png=org.richfaces.renderkit.html.BaseGradient\
{width=5, height=26, baseColorParam=generalBackgroundColor, gradientColorParam=tabBackgroundColor}
+org.richfaces.images\:pmenu_bg.png=org.richfaces.renderkit.html.BaseGradient\
+ {width=5, height=26, baseColorParam=headerGradientColor, gradientColorParam=headerBackgroundColor}
+
org.richfaces.images\:actLeftTabBg.png=org.richfaces.renderkit.html.BaseGradient\
{width=26, height=5, baseColorParam=tabBackgroundColor, gradientColorParam=generalBackgroundColor, horizontal=true}
org.richfaces.images\:actRightTabBg.png=org.richfaces.renderkit.html.BaseGradient\
{width=26, height=5, baseColorParam=generalBackgroundColor, gradientColorParam=tabBackgroundColor, horizontal=true}
-org.richfaces.images\:pbAniBg.gif=org.richfaces.renderkit.html.ProgressBarAnimatedBackgroundImage
\ No newline at end of file
+org.richfaces.images\:pbAniBg.gif=org.richfaces.renderkit.html.ProgressBarAnimatedBackgroundImage
+
+org.richfaces.images\:Chevron.png=org.richfaces.renderkit.html.iconimages.PanelMenuIconChevron
+
+org.richfaces.images\:ChevronDown.png=org.richfaces.renderkit.html.iconimages.PanelMenuIconChevronDown
+
+org.richfaces.images\:ChevronLeft.png=org.richfaces.renderkit.html.iconimages.PanelMenuIconChevronLeft
+
+org.richfaces.images\:ChevronUp.png=org.richfaces.renderkit.html.iconimages.PanelMenuIconChevronUp
+
+org.richfaces.images\:Disc.png=org.richfaces.renderkit.html.iconimages.PanelMenuIconDisc
+
+org.richfaces.images\:Grid.png=org.richfaces.renderkit.html.iconimages.PanelMenuIconGrid
+
+org.richfaces.images\:Spacer.png=org.richfaces.renderkit.html.iconimages.PanelMenuIconSpacer
+
+org.richfaces.images\:Triangle.png=org.richfaces.renderkit.html.iconimages.PanelMenuIconTriangle
+
+org.richfaces.images\:TriangleDown.png=org.richfaces.renderkit.html.iconimages.PanelMenuIconTriangleDown
+
+org.richfaces.images\:TriangleLeft.png=org.richfaces.renderkit.html.iconimages.PanelMenuIconTriangleLeft
+
+org.richfaces.images\:TriangleUp.png=org.richfaces.renderkit.html.iconimages.PanelMenuIconTriangleUp
\ No newline at end of file
Modified: branches/RF-8742-1/ui/output/ui/src/main/templates/progressBar.template.xml
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/main/templates/progressBar.template.xml 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/ui/output/ui/src/main/templates/progressBar.template.xml 2010-11-29 18:01:15 UTC (rev 20208)
@@ -11,71 +11,38 @@
<cdk:superclass>org.richfaces.renderkit.html.ProgressBarBaseRenderer</cdk:superclass>
<cdk:component-family>org.richfaces.ProgressBarRenderer</cdk:component-family>
<cdk:renderer-type>org.richfaces.ProgressBarRenderer</cdk:renderer-type>
+ <cdk:renders-children>true</cdk:renders-children>
</cc:interface>
<cc:implementation>
- <c:choose>
- <c:when test="#{isAjaxMode(component)}">
- <cdk:object type="java.lang.String" name="state" value="#{getCurrentOrForcedState(facesContext, component)}" />
-
- <c:if test="#{state eq 'initialState'}">
- <div id="#{clientId}" class="#{component.attributes['initialClass']}" style="#{component.attributes['style']}">
- <cdk:call expression="renderInitialFacet(facesContext, component)"/>
- </div>
- </c:if>
- <c:if test="#{state eq 'completeState'}">
- <div id="#{clientId}" class="#{component.attributes['finishClass']}" style="#{component.attributes['style']}">
- <cdk:call expression="renderCompleteFacet(facesContext, component)"/>
- </div>
- </c:if>
- <c:if test="#{state eq 'progressState'}">
- <cdk:object type="java.lang.String" name="shellStyle" value="#{getShellStyle(facesContext, component)}" />
- <div cdk:passThroughWithExclusions="onclick, ondblclick, onmouseup, onmousedown, onmousemove, onmouseover, onmouseout" id="#{clientId}" class="rf-pb-cnt #{shellStyle} #{component.attributes['styleClass']}" style="#{component.attributes['style']}">
- <c:if test="#{!isSimpleMarkup(component)}">
- <div class="rf-pb-rmnd #{component.attributes['remainClass']}" id="#{clientId}:remain" style="#{component.attributes['style']}"/>
- <div class="rf-pb-upl-dig" id="#{clientId}:upload" style="#{component.attributes['style']}; width:#{getWidth(component)}%;">
- <div class="rf-pb-cmpltd #{component.attributes['completeClass']}" id="#{clientId}:complete" style="#{component.attributes['style']}"/>
- </div>
- </c:if>
- <c:if test="#{isSimpleMarkup(component)}">
- <div class="rf-pb-upl #{component.attributes['completeClass']}" id="#{clientId}:upload" style="#{component.attributes['style']}; width:#{getWidth(component)}%;"/>
- </c:if>
- <script type="text/javascript">
- #{getInitialScript(facesContext, component, 'progressState')}
- #{getPollScript(facesContext, component)}
- </script>
-
- </div>
- </c:if>
- </c:when>
- <c:otherwise>
- <div id="#{clientId}" >
- <div id="#{clientId}:initialState" class="#{component.attributes['initialClass']}" style="#{component.attributes['style']} display:none;">
- <cdk:call expression="renderInitialFacet(facesContext, component)"/>
- </div>
- <cdk:object type="java.lang.String" name="shellStyle" value="#{getShellStyle(facesContext, component)}" />
- <div cdk:passThroughWithExclusions="onclick, ondblclick, onmouseup, onmousedown, onmousemove, onmouseover, onmouseout" id="#{clientId}:progressState" class="rf-pb-cnt #{shellStyle} #{component.attributes['styleClass']}" style="#{component.attributes['style']} display:none;">
- <c:if test="#{!isSimpleMarkup(component)}">
- <div class="rf-pb-rmnd #{component.attributes['remainClass']}" id="#{clientId}:remain" style="#{component.attributes['style']}"/>
- <div class="rf-pb-upl-dig" id="#{clientId}:upload" style="#{component.attributes['style']}; width=#{getWidth(component)}%;">
- <div class="rf-pb-cmpltd #{component.attributes['completeClass']}" id="#{clientId}:complete" style="#{component.attributes['style']}"/>
- </div>
- </c:if>
- <c:if test="#{isSimpleMarkup(component)}">
- <div class="rf-pb-upl #{component.attributes['completeClass']}" id="#{clientId}:upload" style="#{component.attributes['style']}; width=#{getWidth(component)}%;"/>
- </c:if>
- </div>
- <div id="#{clientId}:completeState" class="#{component.attributes['finishClass']}" style="#{component.attributes['style']} display:none;">
- <cdk:call expression="renderCompleteFacet(facesContext, component)"/>
- </div>
- <cdk:object type="java.lang.String" name="state" value="#{getCurrentState(facesContext, component)}" />
+
+ <div id="#{clientId}" cdk:passThroughWithExclusions="">
+ <cdk:object name="encoder" value="#{getEncoder(facesContext, component)}" type="ProgressBarStateEncoder" />
+ <cdk:object name="currentState" value="#{getCurrentState(facesContext, component)}" type="ProgressBarState" />
+
+ <cdk:call>
+ encoder.encodeInitialState(facesContext, component, currentState);
+ </cdk:call>
+
+ <cdk:call>
+ encoder.encodeCompleteState(facesContext, component, currentState);
+ </cdk:call>
+
+ <cdk:call>
+ encoder.encodeProgressState(facesContext, component, currentState);
+ </cdk:call>
+
<script type="text/javascript">
- #{getInitialScript(facesContext, component, state)}
- #{getRenderStateScript(facesContext, component, state)}
+ <cdk:scriptObject name="options">
+ <cdk:scriptOption name="submitFunction" value="#{getSubmitFunction(facesContext, component)}" />
+ <cdk:scriptOption name="minValue" value="#{component.attributes['minValue']}" defaultValue="0" />
+ <cdk:scriptOption name="maxValue" value="#{component.attributes['maxValue']}" defaultValue="100" />
+
+ <cdk:scriptOption attributes="interval enabled value onfinish" />
+ </cdk:scriptObject>
+
+ new RichFaces.ui.ProgressBar(#{toScriptArgs(clientId, options)});
</script>
</div>
-
- </c:otherwise>
- </c:choose>
</cc:implementation>
</cdk:root>
\ No newline at end of file
Modified: branches/RF-8742-1/ui/output/ui/src/test/java/org/richfaces/renderkit/html/PanelMenuGroupRendererTest.java
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/test/java/org/richfaces/renderkit/html/PanelMenuGroupRendererTest.java 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/ui/output/ui/src/test/java/org/richfaces/renderkit/html/PanelMenuGroupRendererTest.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -33,7 +33,6 @@
* @author akolonitsky
* @since 2010-10-25
*/
-@Ignore
public class PanelMenuGroupRendererTest extends RendererTestBase {
@Test
@@ -46,6 +45,11 @@
doTest("panelMenuGroup-expanded", "f:panelMenuGroup");
}
+ @Test
+ public void testTopGroup() throws IOException, SAXException {
+ doTest("panelMenuGroup-topGroup", "f:panelMenuGroup");
+ }
+
}
Modified: branches/RF-8742-1/ui/output/ui/src/test/java/org/richfaces/renderkit/html/PanelMenuItemRendererTest.java
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/test/java/org/richfaces/renderkit/html/PanelMenuItemRendererTest.java 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/ui/output/ui/src/test/java/org/richfaces/renderkit/html/PanelMenuItemRendererTest.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -29,11 +29,10 @@
import org.junit.Test;
import org.xml.sax.SAXException;
- /**
+/**
* @author akolonitsky
* @since 2010-10-25
*/
-@Ignore
public class PanelMenuItemRendererTest extends RendererTestBase {
@Test
Modified: branches/RF-8742-1/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-expanded.xmlunit.xml
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-expanded.xmlunit.xml 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-expanded.xmlunit.xml 2010-11-29 18:01:15 UTC (rev 20208)
@@ -1,12 +1,20 @@
<div id="f:panelMenuGroup" class="rf-pm-gr">
<input id="f:panelMenuGroup:expanded" name="f:panelMenuGroup:expanded" type="hidden" value="true"/>
<div id="f:panelMenuGroup:hdr" class="rf-pm-gr-hdr">
- Group Label
+ <table class="rf-pm-gr-gr">
+ <tbody>
+ <tr>
+ <td class="rf-pm-gr-ico rf-pm-grid"></td>
+ <td class="rf-pm-gr-lbl">Group Label</td>
+ <td class="rf-pm-gr-exp-ico rf-pm-triangle-down"></td>
+ </tr>
+ </tbody>
+ </table>
</div>
<div id="f:panelMenuGroup:cnt" class="rf-pm-gr-cnt rf-pm-exp">
+ <script type="text/javascript">
+ // Text
+ </script>
</div>
- <script type="text/javascript">
- // Text
- </script>
-</div>
+</div>
\ No newline at end of file
Copied: branches/RF-8742-1/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-topGroup.xhtml (from rev 20206, trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-topGroup.xhtml)
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-topGroup.xhtml (rev 0)
+++ branches/RF-8742-1/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-topGroup.xhtml 2010-11-29 18:01:15 UTC (rev 20208)
@@ -0,0 +1,49 @@
+<?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.
+-->
+
+
+<!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:fn="http://java.sun.com/jsp/jstl/functions"
+ 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:pn="http://richfaces.org/output"
+ xmlns:rich="http://richfaces.org/rich">
+
+ <h:head>
+ <title>Richfaces PanelMenuGroup Test</title>
+ </h:head>
+
+<h:body>
+ <h:form id="f" style="border:blue solid thin;">
+ <pn:panelMenu>
+ <pn:panelMenuGroup id="panelMenuGroup" expanded="true" label="Group Label">
+ <!-- TODO -->
+ </pn:panelMenuGroup>
+ </pn:panelMenu>
+ </h:form>
+</h:body>
+</html>
+
+
Copied: branches/RF-8742-1/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-topGroup.xmlunit.xml (from rev 20206, trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-topGroup.xmlunit.xml)
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-topGroup.xmlunit.xml (rev 0)
+++ branches/RF-8742-1/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup-topGroup.xmlunit.xml 2010-11-29 18:01:15 UTC (rev 20208)
@@ -0,0 +1,20 @@
+<div id="f:panelMenuGroup" class="rf-pm-top-gr">
+ <input id="f:panelMenuGroup:expanded" name="f:panelMenuGroup:expanded" type="hidden" value="true"/>
+ <div id="f:panelMenuGroup:hdr" class="rf-pm-top-gr-hdr">
+ <table class="rf-pm-top-gr-gr">
+ <tbody>
+ <tr>
+ <td class="rf-pm-top-gr-ico rf-pm-grid"></td>
+ <td class="rf-pm-top-gr-lbl">Group Label</td>
+ <td class="rf-pm-top-gr-exp-ico rf-pm-triangle-down"></td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ <div id="f:panelMenuGroup:cnt" class="rf-pm-top-gr-cnt rf-pm-exp">
+ <script type="text/javascript">
+ // Text
+ </script>
+
+ </div>
+</div>
\ No newline at end of file
Modified: branches/RF-8742-1/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup.xmlunit.xml
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup.xmlunit.xml 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuGroup.xmlunit.xml 2010-11-29 18:01:15 UTC (rev 20208)
@@ -1,12 +1,20 @@
<div id="f:panelMenuGroup" class="rf-pm-gr">
<input id="f:panelMenuGroup:expanded" name="f:panelMenuGroup:expanded" type="hidden" value="false"/>
<div id="f:panelMenuGroup:hdr" class="rf-pm-gr-hdr">
- panelMenuGroup
+ <table class="rf-pm-gr-gr">
+ <tbody>
+ <tr>
+ <td class="rf-pm-gr-ico rf-pm-grid"></td>
+ <td class="rf-pm-gr-lbl">panelMenuGroup</td>
+ <td class="rf-pm-gr-exp-ico rf-pm-triangle-down"></td>
+ </tr>
+ </tbody>
+ </table>
</div>
<div id="f:panelMenuGroup:cnt" class="rf-pm-gr-cnt rf-pm-colps">
+ <script type="text/javascript">
+ // Text
+ </script>
</div>
- <script type="text/javascript">
- // Text
- </script>
</div>
Modified: branches/RF-8742-1/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuItem.xmlunit.xml
===================================================================
--- branches/RF-8742-1/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuItem.xmlunit.xml 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenuItem.xmlunit.xml 2010-11-29 18:01:15 UTC (rev 20208)
@@ -1,5 +1,13 @@
<div id="f:panelMenuItem" class="rf-pm-itm">
- panelMenuItem
+ <table class="rf-pm-itm-gr">
+ <tbody>
+ <tr>
+ <td class="rf-pm-itm-ico rf-pm-grid"></td>
+ <td class="rf-pm-itm-lbl">panelMenuItem</td>
+ <td class="rf-pm-itm-exp-ico rf-pm-triangle-down"></td>
+ </tr>
+ </tbody>
+ </table>
<script type="text/javascript">
// Text
Modified: branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/convert/DateTimeConverterTest.java
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/convert/DateTimeConverterTest.java 2010-11-29 17:34:18 UTC (rev 20207)
+++ branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/convert/DateTimeConverterTest.java 2010-11-29 18:01:15 UTC (rev 20208)
@@ -23,6 +23,7 @@
import javax.faces.convert.DateTimeConverter;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -31,6 +32,7 @@
*
*/
@RunWith(ConverterTestRunner.class)
+@Ignore
public class DateTimeConverterTest extends BaseTest {
public DateTimeConverterTest() {
14 years
JBoss Rich Faces SVN: r20207 - in modules/tests/metamer/trunk: ftest-source/src/main/java/org/richfaces/tests/metamer/ftest and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-11-29 12:34:18 -0500 (Mon, 29 Nov 2010)
New Revision: 20207
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInplaceInput/
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInplaceInput/TestRichInplaceInput.java
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichInplaceInputBean.java
Log:
https://jira.jboss.org/browse/RFPL-757
* valueChangeListener removed from attribute list
* added 39 tests for inplace input
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichInplaceInputBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichInplaceInputBean.java 2010-11-29 14:35:51 UTC (rev 20206)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichInplaceInputBean.java 2010-11-29 17:34:18 UTC (rev 20207)
@@ -63,6 +63,7 @@
// TODO has to be tested in another way
attributes.remove("validator");
+ attributes.remove("valueChangeListener");
}
public Attributes getAttributes() {
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInplaceInput/TestRichInplaceInput.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInplaceInput/TestRichInplaceInput.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInplaceInput/TestRichInplaceInput.java 2010-11-29 17:34:18 UTC (rev 20207)
@@ -0,0 +1,368 @@
+/*******************************************************************************
+ * 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.richInplaceInput;
+
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardNoRequest;
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardXhr;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URL;
+import javax.faces.event.PhaseId;
+import org.jboss.test.selenium.css.CssProperty;
+
+import org.jboss.test.selenium.dom.Event;
+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.EventFiredCondition;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page faces/components/richInplaceInput/simple.xhtml.
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class TestRichInplaceInput extends AbstractMetamerTest {
+
+ private JQueryLocator inplaceInput = pjq("span[id$=inplaceInput]");
+ private JQueryLocator label = pjq("span.rf-ii-lbl");
+ private JQueryLocator input = pjq("input[id$=inplaceInputInput]");
+ private JQueryLocator edit = pjq("span.rf-ii-edit");
+ private JQueryLocator okButton = pjq("input.rf-ii-btn[id$=Okbtn]");
+ private JQueryLocator cancelButton = pjq("input.rf-ii-btn[id$=Cancelbtn]");
+ private JQueryLocator output = pjq("span[id$=output]");
+ private JQueryLocator time = jq("span[id$=requestTime]");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/richInplaceInput/simple.xhtml");
+ }
+
+ @Test
+ public void testInit() {
+ assertTrue(selenium.isElementPresent(inplaceInput), "Inplace input is not on the page.");
+ assertTrue(selenium.isElementPresent(label), "Default label should be present on the page.");
+ assertEquals(selenium.getText(label), "RichFaces 4", "Default label");
+ assertTrue(selenium.isElementPresent(inplaceInput), "Input should be present on the page.");
+ assertFalse(selenium.isElementPresent(okButton), "OK button should not be present on the page.");
+ assertFalse(selenium.isElementPresent(cancelButton), "Cancel button should not be present on the page.");
+ assertEquals(selenium.getValue(input), "RichFaces 4", "Value of inplace input.");
+ }
+
+ @Test
+ public void testClick() {
+ guardNoRequest(selenium).click(inplaceInput);
+ assertFalse(selenium.belongsClass(edit, "rf-ii-none"), "Edit should not contain class rf-is-none when popup is open.");
+ assertTrue(selenium.isDisplayed(input), "Input should be displayed.");
+
+ selenium.type(input, "new value");
+ selenium.fireEvent(input, Event.BLUR);
+ assertTrue(selenium.belongsClass(inplaceInput, "rf-ii-c-s"), "New class should be added to inplace input.");
+ assertTrue(selenium.belongsClass(edit, "rf-ii-none"), "Edit should contain class rf-is-none when popup is closed.");
+
+ assertEquals(selenium.getText(label), "new value", "Label should contain selected value.");
+ assertEquals(selenium.getText(output), "new value", "Output did not change.");
+ }
+
+ @Test
+ public void testDefaultLabel() {
+ selenium.type(pjq("input[type=text][id$=valueInput]"), "");
+ selenium.waitForPageToLoad();
+ assertEquals(selenium.getText(label), "Click here to edit", "Default label should change");
+
+ selenium.type(pjq("input[type=text][id$=defaultLabelInput]"), "");
+ selenium.waitForPageToLoad();
+ assertEquals(selenium.getText(label), "", "Default label should change");
+
+ assertTrue(selenium.isElementPresent(inplaceInput), "Inplace select is not on the page.");
+ assertTrue(selenium.isElementPresent(label), "Default label should be present on the page.");
+ assertTrue(selenium.isElementPresent(input), "Input should be present on the page.");
+ }
+
+ @Test
+ public void testEditClass() {
+ testStyleClass(edit, "editClass");
+ }
+
+ @Test
+ public void testEditEvent() {
+ selenium.type(pjq("input[type=text][id$=editEventInput]"), "mouseup");
+ selenium.waitForPageToLoad();
+
+ selenium.mouseDown(inplaceInput);
+ assertTrue(selenium.belongsClass(edit, "rf-ii-none"), "Inplace input should not be in edit state.");
+ selenium.mouseUp(inplaceInput);
+ assertFalse(selenium.belongsClass(edit, "rf-ii-none"), "Inplace input should be in edit state.");
+ }
+
+ @Test
+ public void testImmediate() {
+ selenium.click(pjq("input[type=radio][name$=immediateInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ String timeValue = selenium.getText(time);
+ selenium.click(inplaceInput);
+ selenium.type(input, "new value");
+ selenium.fireEvent(input, Event.BLUR);
+ waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+
+ assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
+ PhaseId.UPDATE_MODEL_VALUES, PhaseId.INVOKE_APPLICATION, PhaseId.RENDER_RESPONSE);
+ String listenerText = selenium.getText(jq("div#phasesPanel li:eq(2)"));
+ assertEquals(listenerText, "* value changed: RichFaces 4 -> new value", "Value change listener was not invoked.");
+ }
+
+ @Test
+ @IssueTracking("https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=1805")
+ public void testInputWidth() {
+ selenium.type(pjq("input[type=text][id$=inputWidthInput]"), "300px");
+ selenium.waitForPageToLoad();
+
+ String width = selenium.getStyle(input, CssProperty.WIDTH);
+ assertEquals(width, "300px", "Width of input did not change.");
+
+ selenium.type(pjq("input[type=text][id$=inputWidthInput]"), "");
+ selenium.waitForPageToLoad();
+
+ // it cannot handle null because of a bug in Mojarra and Myfaces and
+ // generates style="width: ; " instead of default value
+ assertTrue(selenium.isAttributePresent(input.getAttribute(Attribute.STYLE)), "Input doesn't have attribute style.");
+ width = selenium.getAttribute(input.getAttribute(Attribute.STYLE));
+ assertTrue(!width.contains("width: ;"), "Default width of input was not set (was " + width + ").");
+ }
+
+ @Test
+ public void testNoneClass() {
+ selenium.type(pjq("input[type=text][id$=valueInput]"), "");
+ selenium.waitForPageToLoad();
+
+ testStyleClass(edit, "noneClass");
+ }
+
+ @Test
+ @IssueTracking("https://jira.jboss.org/browse/RF-9868")
+ public void testOnblur() {
+ testFireEvent(Event.BLUR, inplaceInput);
+ }
+
+ @Test
+ public void testOnclick() {
+ testFireEvent(Event.CLICK, inplaceInput);
+ }
+
+ @Test
+ public void testOndblclick() {
+ testFireEvent(Event.DBLCLICK, inplaceInput);
+ }
+
+ @Test
+ @IssueTracking("https://jira.jboss.org/browse/RF-9868")
+ public void testOnfocus() {
+ testFireEvent(Event.FOCUS, inplaceInput);
+ }
+
+ @Test
+ public void testOninputblur() {
+ testFireEvent(Event.BLUR, input, "inputblur");
+ }
+
+ @Test
+ @IssueTracking("https://jira.jboss.org/browse/RF-9571")
+ public void testOninputchange() {
+ selenium.type(pjq("input[type=text][id$=oninputchangeInput]"), "metamerEvents += \"inputchange \"");
+ selenium.waitForPageToLoad();
+
+ String timeValue = selenium.getText(time);
+ selenium.click(inplaceInput);
+ selenium.type(input, "new value");
+ selenium.fireEvent(input, Event.BLUR);
+ waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+
+ waitGui.failWith("Attribute oninputchange does not work correctly").until(
+ new EventFiredCondition(new Event("inputchange")));
+ }
+
+ @Test
+ public void testOninputclick() {
+ testFireEvent(Event.CLICK, input, "inputclick");
+ }
+
+ @Test
+ public void testOninputdblclick() {
+ testFireEvent(Event.DBLCLICK, input, "inputdblclick");
+ }
+
+ @Test
+ public void testOninputfocus() {
+ testFireEvent(Event.FOCUS, input, "inputfocus");
+ }
+
+ @Test
+ public void testOninputkeydown() {
+ testFireEvent(Event.KEYDOWN, input, "inputkeydown");
+ }
+
+ @Test
+ public void testOninputkeypress() {
+ testFireEvent(Event.KEYPRESS, input, "inputkeypress");
+ }
+
+ @Test
+ public void testOninputkeyup() {
+ testFireEvent(Event.KEYUP, input, "inputkeyup");
+ }
+
+ @Test
+ public void testOninputmousedown() {
+ testFireEvent(Event.MOUSEDOWN, input, "inputmousedown");
+ }
+
+ @Test
+ public void testOninputmousemove() {
+ testFireEvent(Event.MOUSEMOVE, input, "inputmousemove");
+ }
+
+ @Test
+ public void testOninputmouseout() {
+ testFireEvent(Event.MOUSEOUT, input, "inputmouseout");
+ }
+
+ @Test
+ public void testOninputmouseover() {
+ testFireEvent(Event.MOUSEOVER, input, "inputmouseover");
+ }
+
+ @Test
+ public void testOninputmouseup() {
+ testFireEvent(Event.MOUSEUP, input, "inputmouseup");
+ }
+
+ @Test
+ public void testOninputselect() {
+ testFireEvent(Event.SELECT, input, "inputselect");
+ }
+
+ @Test
+ public void testOnkeydown() {
+ testFireEvent(Event.KEYDOWN, inplaceInput);
+ }
+
+ @Test
+ public void testOnkeypress() {
+ testFireEvent(Event.KEYPRESS, inplaceInput);
+ }
+
+ @Test
+ public void testOnkeyup() {
+ testFireEvent(Event.KEYUP, inplaceInput);
+ }
+
+ @Test
+ public void testOnmousedown() {
+ testFireEvent(Event.MOUSEDOWN, inplaceInput);
+ }
+
+ @Test
+ public void testOnmousemove() {
+ testFireEvent(Event.MOUSEMOVE, inplaceInput);
+ }
+
+ @Test
+ public void testOnmouseout() {
+ testFireEvent(Event.MOUSEOUT, inplaceInput);
+ }
+
+ @Test
+ public void testOnmouseover() {
+ testFireEvent(Event.MOUSEOVER, inplaceInput);
+ }
+
+ @Test
+ public void testOnmouseup() {
+ testFireEvent(Event.MOUSEUP, inplaceInput);
+ }
+
+ @Test
+ public void testRendered() {
+ selenium.click(pjq("input[type=radio][name$=renderedInput][value=false]"));
+ selenium.waitForPageToLoad();
+
+ assertFalse(selenium.isElementPresent(inplaceInput), "Component should not be rendered when rendered=false.");
+ }
+
+ @Test
+ public void testShowControls() {
+ selenium.click(pjq("input[type=radio][name$=showControlsInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ selenium.click(inplaceInput);
+ assertTrue(selenium.isVisible(okButton), "OK button should be visible.");
+ assertTrue(selenium.isVisible(cancelButton), "Cancel button should be visible.");
+ }
+
+ @Test
+ public void testClickOkButton() {
+ selenium.click(pjq("input[type=radio][name$=showControlsInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ String timeValue = selenium.getText(time);
+ selenium.click(inplaceInput);
+ guardNoRequest(selenium).keyPress(input, "x");
+ guardXhr(selenium).mouseDown(okButton);
+ waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+
+ assertEquals(selenium.getText(label), "RichFaces 4x", "Label");
+ assertEquals(selenium.getValue(input), "RichFaces 4x", "Value of inplace input");
+ assertEquals(selenium.getText(output), "RichFaces 4x", "Output");
+ }
+
+ @Test
+ @IssueTracking("https://jira.jboss.org/browse/RF-9872")
+ public void testClickCancelButton() {
+ selenium.click(pjq("input[type=radio][name$=showControlsInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ selenium.click(inplaceInput);
+ guardNoRequest(selenium).keyPress(input, "x");
+ guardNoRequest(selenium).mouseDown(cancelButton);
+
+ assertEquals(selenium.getText(label), "RichFaces 4", "Label");
+ assertEquals(selenium.getValue(input), "RichFaces 4", "Value of inplace input.");
+ assertEquals(selenium.getText(output), "RichFaces 4", "Output did not change.");
+ }
+
+ @Test
+ public void testValue() {
+ selenium.type(pjq("input[type=text][id$=valueInput]"), "new value");
+ selenium.waitForPageToLoad();
+
+ assertEquals(selenium.getText(label), "new value", "Default label");
+ assertEquals(selenium.getValue(input), "new value", "Value of inplace input.");
+ }
+}
Property changes on: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInplaceInput/TestRichInplaceInput.java
___________________________________________________________________
Name: svn:keywords
+ Revision
14 years
JBoss Rich Faces SVN: r20206 - in trunk/ui/input/ui/src/test: java/org/richfaces/component and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2010-11-29 09:35:51 -0500 (Mon, 29 Nov 2010)
New Revision: 20206
Added:
trunk/ui/input/ui/src/test/java/org/richfaces/component/
trunk/ui/input/ui/src/test/java/org/richfaces/component/CalendarBean.java
trunk/ui/input/ui/src/test/java/org/richfaces/component/CalendarDataModelImpl.java
trunk/ui/input/ui/src/test/java/org/richfaces/component/CalendarDataModelItemImpl.java
trunk/ui/input/ui/src/test/java/org/richfaces/component/CalendarRenderTest.java
trunk/ui/input/ui/src/test/resources/org/richfaces/component/
trunk/ui/input/ui/src/test/resources/org/richfaces/component/calendarContent.xmlunit.xml
trunk/ui/input/ui/src/test/resources/org/richfaces/component/calendarScript.xmlunit.xml
trunk/ui/input/ui/src/test/resources/org/richfaces/component/calendarTest.xhtml
trunk/ui/input/ui/src/test/resources/org/richfaces/component/faces-config.xml
Log:
RF-9171:Calendar: server side tests development (junit)
Added: trunk/ui/input/ui/src/test/java/org/richfaces/component/CalendarBean.java
===================================================================
--- trunk/ui/input/ui/src/test/java/org/richfaces/component/CalendarBean.java (rev 0)
+++ trunk/ui/input/ui/src/test/java/org/richfaces/component/CalendarBean.java 2010-11-29 14:35:51 UTC (rev 20206)
@@ -0,0 +1,100 @@
+package org.richfaces.component;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Locale;
+
+import javax.faces.event.ValueChangeEvent;
+
+public class CalendarBean {
+
+ public static int CURRENT_YEAR = 2010;
+ public static int CURRENT_MONTH = 10;
+ public static int CURRENT_DAY = 16;
+
+ private Locale locale;
+ private boolean popup;
+ private String pattern;
+ private Date selectedDate = null;
+ private boolean showApply = true;
+ private boolean useCustomDayLabels;
+ private String mode;
+
+ public CalendarBean() {
+
+ locale = Locale.US;
+ popup = true;
+ pattern = "d/M/yy HH:mm";
+ mode = "client";
+
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(CURRENT_YEAR, CURRENT_MONTH, CURRENT_DAY, 0, 0, 0);
+ selectedDate = calendar.getTime();
+ }
+
+ public String getMode() {
+ return mode;
+ }
+
+ public void setMode(String mode) {
+ this.mode = mode;
+ }
+
+ public Locale getLocale() {
+ return locale;
+ }
+
+ public void setLocale(Locale locale) {
+ this.locale = locale;
+ }
+
+ public boolean isPopup() {
+ return popup;
+ }
+
+ public void setPopup(boolean popup) {
+ this.popup = popup;
+ }
+
+ public String getPattern() {
+ return pattern;
+ }
+
+ public void setPattern(String pattern) {
+ this.pattern = pattern;
+ }
+
+ public void selectLocale(ValueChangeEvent event) {
+
+ String tLocale = (String) event.getNewValue();
+ if (tLocale != null) {
+ String lang = tLocale.substring(0, 2);
+ String country = tLocale.substring(3);
+ locale = new Locale(lang, country, "");
+ }
+ }
+
+ public boolean isUseCustomDayLabels() {
+ return useCustomDayLabels;
+ }
+
+ public void setUseCustomDayLabels(boolean useCustomDayLabels) {
+ this.useCustomDayLabels = useCustomDayLabels;
+ }
+
+ public Date getSelectedDate() {
+ return selectedDate;
+ }
+
+ public void setSelectedDate(Date selectedDate) {
+ this.selectedDate = selectedDate;
+ }
+
+ public boolean isShowApply() {
+ return showApply;
+ }
+
+ public void setShowApply(boolean showApply) {
+ this.showApply = showApply;
+ }
+}
\ No newline at end of file
Added: trunk/ui/input/ui/src/test/java/org/richfaces/component/CalendarDataModelImpl.java
===================================================================
--- trunk/ui/input/ui/src/test/java/org/richfaces/component/CalendarDataModelImpl.java (rev 0)
+++ trunk/ui/input/ui/src/test/java/org/richfaces/component/CalendarDataModelImpl.java 2010-11-29 14:35:51 UTC (rev 20206)
@@ -0,0 +1,64 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+import java.util.Date;
+
+import javax.faces.bean.ApplicationScoped;
+import javax.faces.bean.ManagedBean;
+
+import org.richfaces.model.CalendarDataModel;
+import org.richfaces.model.CalendarDataModelItem;
+
+/**
+ * @author Nick Belaevski - mailto:nbelaevski@exadel.com
+ * created 30.06.2007
+ *
+ */
+@ManagedBean(name="calendarDataModel")
+@ApplicationScoped
+public class CalendarDataModelImpl implements CalendarDataModel {
+
+ /* (non-Javadoc)
+ * @see org.richfaces.component.CalendarDataModel#getData(java.util.Date[])
+ */
+ public CalendarDataModelItem[] getData(Date[] dateArray) {
+ if (dateArray == null) {
+ return null;
+ }
+
+ CalendarDataModelItem[] items = new CalendarDataModelItem[dateArray.length];
+ for (int i = 0; i < dateArray.length; i++) {
+ items[i] = createDataModelItem(dateArray[i]);
+ }
+
+ return items;
+ }
+
+ protected CalendarDataModelItem createDataModelItem(Date date) {
+ CalendarDataModelItemImpl item = new CalendarDataModelItemImpl();
+
+ item.setEnabled(false);
+
+ return item;
+ }
+}
Added: trunk/ui/input/ui/src/test/java/org/richfaces/component/CalendarDataModelItemImpl.java
===================================================================
--- trunk/ui/input/ui/src/test/java/org/richfaces/component/CalendarDataModelItemImpl.java (rev 0)
+++ trunk/ui/input/ui/src/test/java/org/richfaces/component/CalendarDataModelItemImpl.java 2010-11-29 14:35:51 UTC (rev 20206)
@@ -0,0 +1,58 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+import org.richfaces.model.CalendarDataModelItem;
+
+/**
+ * @author Nick Belaevski - mailto:nbelaevski@exadel.com
+ * created 04.07.2007
+ *
+ */
+public class CalendarDataModelItemImpl implements CalendarDataModelItem {
+
+ private boolean enabled = true;
+ private String styleClass = "";
+
+
+ /* (non-Javadoc)
+ * @see org.richfaces.component.CalendarDataModelItem#isEnabled()
+ */
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ /**
+ * @param enabled the enabled to set
+ */
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ }
+
+ public String getStyleClass() {
+ return styleClass;
+ }
+
+ public void setStyleClass(String styleClass) {
+ this.styleClass = styleClass;
+ }
+}
Added: trunk/ui/input/ui/src/test/java/org/richfaces/component/CalendarRenderTest.java
===================================================================
--- trunk/ui/input/ui/src/test/java/org/richfaces/component/CalendarRenderTest.java (rev 0)
+++ trunk/ui/input/ui/src/test/java/org/richfaces/component/CalendarRenderTest.java 2010-11-29 14:35:51 UTC (rev 20206)
@@ -0,0 +1,91 @@
+package org.richfaces.component;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.net.URISyntaxException;
+import java.util.Calendar;
+import java.util.List;
+import java.util.Locale;
+
+import org.jboss.test.faces.htmlunit.HtmlUnitEnvironment;
+import org.junit.Assert;
+import org.junit.Test;
+import org.richfaces.renderkit.html.RendererTestBase;
+
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlImage;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlTableDataCell;
+
+public class CalendarRenderTest extends RendererTestBase {
+
+ @Override
+ public void setUp() throws URISyntaxException {
+ environment = new HtmlUnitEnvironment();
+ environment.withWebRoot(new File(this.getClass().getResource(".").toURI()));
+ environment.withResource("/WEB-INF/faces-config.xml", "org/richfaces/component/faces-config.xml");
+ environment.start();
+ }
+
+ @Test
+ public void testExistenceCalendarPopup() throws Exception {
+ HtmlPage page = environment.getPage("/calendarTest.jsf");
+ HtmlElement calendarPopupElement = page.getElementById("form:calendarPopup");
+ Assert.assertNotNull("form:calendarPopup element missed.", calendarPopupElement);
+ }
+
+ @Test
+ public void testExistenceCalendarContent() throws Exception {
+ HtmlPage page = environment.getPage("/calendarTest.jsf");
+ HtmlElement calendarContentElement = page.getElementById("form:calendarContent");
+ Assert.assertNotNull("form:calendarContent element missed.", calendarContentElement);
+ }
+
+ @Test
+ public void testRenderCalendarScript() throws Exception {
+ doTest("calendarTest", "calendarScript", "form:calendarScript");
+ }
+
+ @Test
+ public void testRenderCalendarContent() throws Exception {
+ doTest("calendarTest", "calendarContent", "form:calendarContent");
+ }
+
+ @Test
+ public void testCalendarScrolling() throws Exception {
+ HtmlPage page = environment.getPage("/calendarTest.jsf");
+
+ HtmlImage calendarPopupButton = (HtmlImage) page.getElementById("form:calendarPopupButton");
+ assertNotNull(calendarPopupButton);
+ page = (HtmlPage) calendarPopupButton.click();
+ HtmlElement calendarHeaderElement = page.getElementById("form:calendarHeader");
+ assertNotNull("form:calendarHeader element missed.", calendarHeaderElement);
+
+ HtmlTableDataCell nextTD = null;
+ List<?> tds = calendarHeaderElement.getByXPath("table/tbody/tr/td");
+ for (Object td : tds)
+ {
+ HtmlTableDataCell htdc = (HtmlTableDataCell) td;
+ if (">".equals(htdc.asText())) {
+ nextTD = htdc;
+ }
+ }
+ assertNotNull(nextTD);
+ HtmlElement div = nextTD.getChildElements().iterator().next();
+
+ //Before click
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(CalendarBean.CURRENT_YEAR, CalendarBean.CURRENT_MONTH, CalendarBean.CURRENT_DAY);
+ String month = calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.US);
+ assertTrue(calendarHeaderElement.asText().indexOf(month) > -1);
+
+ page = div.click();
+
+ //After click
+ calendar.add(Calendar.MONTH, 1);
+ month = calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.US);
+ assertTrue(calendarHeaderElement.asText().indexOf(month) > -1);
+ }
+}
Added: trunk/ui/input/ui/src/test/resources/org/richfaces/component/calendarContent.xmlunit.xml
===================================================================
--- trunk/ui/input/ui/src/test/resources/org/richfaces/component/calendarContent.xmlunit.xml (rev 0)
+++ trunk/ui/input/ui/src/test/resources/org/richfaces/component/calendarContent.xmlunit.xml 2010-11-29 14:35:51 UTC (rev 20206)
@@ -0,0 +1,108 @@
+<table id="form:calendarContent" border="0" cellpadding="0" cellspacing="0" class="rf-ca-extr rf-ca-popup undefined" style="display:none; position:absolute;z-index: 3;width:200px" onclick="RichFaces.$('form:calendar').skipEventOnCollapse=true;">
+ <tbody>
+ <tr>
+ <td class="rf-ca-hdr" colspan="8" id="form:calendarHeader"/>
+ </tr>
+ <tr id="form:calendarWeekDay">
+ <td class="rf-ca-days">
+ <br/>
+ </td>
+ <td class="rf-ca-days rf-ca-weekends" id="form:calendarWeekDayCell0">
+ Sun
+ </td>
+ <td class="rf-ca-days" id="form:calendarWeekDayCell1">
+ Mon
+ </td>
+ <td class="rf-ca-days" id="form:calendarWeekDayCell2">
+ Tue
+ </td>
+ <td class="rf-ca-days" id="form:calendarWeekDayCell3">
+ Wed
+ </td>
+ <td class="rf-ca-days" id="form:calendarWeekDayCell4">
+ Thu
+ </td>
+ <td class="rf-ca-days" id="form:calendarWeekDayCell5">
+ Fri
+ </td>
+ <td class="rf-ca-days rf-ca-weekends rf-rgh-cell" id="form:calendarWeekDayCell6">
+ Sat
+ </td>
+ </tr>
+ <tr id="form:calendarWeekNum1">
+ <td class="rf-ca-week " id="form:calendarWeekNumCell1">
+ 1
+ </td>
+ <td class="rf-ca-c-size rf-ca-c rf-ca-holly" id="form:calendarDayCell0" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell1" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell2" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell3" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell4" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell5" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c rf-ca-holly rf-rgh-c" id="form:calendarDayCell6" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ </tr>
+ <tr id="form:calendarWeekNum2">
+ <td class="rf-ca-week " id="form:calendarWeekNumCell2">
+ 2
+ </td>
+ <td class="rf-ca-c-size rf-ca-c rf-ca-holly" id="form:calendarDayCell7" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell8" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell9" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell10" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell11" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell12" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c rf-ca-holly rf-rgh-c" id="form:calendarDayCell13" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ </tr>
+ <tr id="form:calendarWeekNum3">
+ <td class="rf-ca-week " id="form:calendarWeekNumCell3">
+ 3
+ </td>
+ <td class="rf-ca-c-size rf-ca-c rf-ca-holly" id="form:calendarDayCell14" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell15" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell16" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell17" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell18" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell19" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c rf-ca-holly rf-rgh-c" id="form:calendarDayCell20" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ </tr>
+ <tr id="form:calendarWeekNum4">
+ <td class="rf-ca-week " id="form:calendarWeekNumCell4">
+ 4
+ </td>
+ <td class="rf-ca-c-size rf-ca-c rf-ca-holly" id="form:calendarDayCell21" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell22" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell23" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell24" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell25" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell26" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c rf-ca-holly rf-rgh-c" id="form:calendarDayCell27" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ </tr>
+ <tr id="form:calendarWeekNum5">
+ <td class="rf-ca-week " id="form:calendarWeekNumCell5">
+ 5
+ </td>
+ <td class="rf-ca-c-size rf-ca-c rf-ca-holly" id="form:calendarDayCell28" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell29" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell30" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell31" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell32" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c" id="form:calendarDayCell33" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-ca-c-size rf-ca-c rf-ca-holly rf-rgh-c" id="form:calendarDayCell34" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ </tr>
+ <tr id="form:calendarWeekNum6">
+ <td class="rf-ca-week rf-btm-c " id="form:calendarWeekNumCell6">
+ 6
+ </td>
+ <td class="rf-btm-c rf-ca-c-size rf-ca-c rf-ca-holly" id="form:calendarDayCell35" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-btm-c rf-ca-c-size rf-ca-c" id="form:calendarDayCell36" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-btm-c rf-ca-c-size rf-ca-c" id="form:calendarDayCell37" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-btm-c rf-ca-c-size rf-ca-c" id="form:calendarDayCell38" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-btm-c rf-ca-c-size rf-ca-c" id="form:calendarDayCell39" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-btm-c rf-ca-c-size rf-ca-c" id="form:calendarDayCell40" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ <td class="rf-btm-c rf-ca-c-size rf-ca-c rf-ca-holly rf-rgh-c" id="form:calendarDayCell41" onclick="RichFaces.$('form:calendar').eventCellOnClick(event, this);" onmouseover="RichFaces.$('form:calendar').eventCellOnMouseOver(event, this);" onmouseout="RichFaces.$('form:calendar').eventCellOnMouseOut(event, this);"/>
+ </tr>
+ <tr>
+ <td class="rf-ca-ftr" colspan="8" id="form:calendarFooter"/>
+ </tr>
+ </tbody>
+</table>
\ No newline at end of file
Added: trunk/ui/input/ui/src/test/resources/org/richfaces/component/calendarScript.xmlunit.xml
===================================================================
--- trunk/ui/input/ui/src/test/resources/org/richfaces/component/calendarScript.xmlunit.xml (rev 0)
+++ trunk/ui/input/ui/src/test/resources/org/richfaces/component/calendarScript.xmlunit.xml 2010-11-29 14:35:51 UTC (rev 20206)
@@ -0,0 +1,7 @@
+ <span id="form:calendarScript" style="display: none;">
+ <script type="text/javascript">
+//<![CDATA[
+RichFaces.ui.Calendar.addLocale("en_US",{"monthLabels":["January","February","March","April","May","June","July","August","September","October","November","December"] ,"minDaysInFirstWeek":1,"monthLabelsShort":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"] ,"firstWeekDay":0,"weekDayLabels":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"] ,"weekDayLabelsShort":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"] } );new RichFaces.ui.Calendar("form:calendar","en_US",{"horizontalOffset":"0","showApplyButton":true,"showFooter":true,"selectedDate":new Date(2010,10,16,0,0,0),"verticalOffset":"0","datePattern":"d\/M\/yy HH:mm","direction":"AA","labels":{} ,"mode":"client","todayControlMode":"select","showWeeksBar":true,"resetTimeOnDateSelect":false,"style":"z\u002Dindex: 3;width:200px","showWeekDaysBar":true,"currentDate":new Date(2010,10,16),"showHeader":true,"popup":true,"enableManualInput":false,"showInput":true,"boundaryDatesMode":"ina!
ctive","disabled":false,"jointPoint":"AA","hidePopupOnScroll":"true"} ,"").load({"startDate":{"month":10,"year":2010} ,"days":[{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"sty!
leClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":fa!
lse,"sty
leClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ,{"enabled":false,"styleClass":""} ] } );
+//]]>
+ </script>
+ </span>
\ No newline at end of file
Added: trunk/ui/input/ui/src/test/resources/org/richfaces/component/calendarTest.xhtml
===================================================================
--- trunk/ui/input/ui/src/test/resources/org/richfaces/component/calendarTest.xhtml (rev 0)
+++ trunk/ui/input/ui/src/test/resources/org/richfaces/component/calendarTest.xhtml 2010-11-29 14:35:51 UTC (rev 20206)
@@ -0,0 +1,29 @@
+<!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:in="http://richfaces.org/input">
+<f:view contentType="text/html" />
+
+<h:head>
+ <title>Richfaces Calendar</title>
+</h:head>
+
+<h:body>
+ <h:form id="form">
+ <in:calendar value="#{calendarBean.selectedDate}" id="calendar"
+ locale="#{calendarBean.locale}" popup="#{calendarBean.popup}"
+ datePattern="#{calendarBean.pattern}"
+ dataModel="#{calendarDataModel}"
+ mode="#{calendarBean.mode}"
+ showHeader="true"
+ currentDate="#{calendarBean.selectedDate}"
+ showApplyButton="#{calendarBean.showApply}" cellWidth="24px"
+ cellHeight="22px" style="width:200px">
+ <f:convertDateTime pattern="#{calendarBean.pattern}"
+ onchange="alert('1')" />
+ </in:calendar>
+ </h:form>
+</h:body>
+</html>
Added: trunk/ui/input/ui/src/test/resources/org/richfaces/component/faces-config.xml
===================================================================
--- trunk/ui/input/ui/src/test/resources/org/richfaces/component/faces-config.xml (rev 0)
+++ trunk/ui/input/ui/src/test/resources/org/richfaces/component/faces-config.xml 2010-11-29 14:35:51 UTC (rev 20206)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<faces-config 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-facesconfig_2_0.xsd"
+ version="2.0">
+
+ <managed-bean>
+ <managed-bean-name>calendarBean</managed-bean-name>
+ <managed-bean-class>org.richfaces.component.CalendarBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>calendarDataModel</managed-bean-name>
+ <managed-bean-class>org.richfaces.component.CalendarDataModelImpl</managed-bean-class>
+ <managed-bean-scope>application</managed-bean-scope>
+ </managed-bean>
+
+</faces-config>
\ No newline at end of file
14 years