JBoss Rich Faces SVN: r20464 - trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2010-12-08 10:42:52 -0500 (Wed, 08 Dec 2010)
New Revision: 20464
Modified:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.js
Log:
RF-9887 : Popup panel: scrollable area too big
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.js 2010-12-08 14:11:26 UTC (rev 20463)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.js 2010-12-08 15:42:52 UTC (rev 20464)
@@ -309,7 +309,7 @@
}
$(richfaces.getDomElement(eContentElt)).css('height', options.height + (/px/.test(options.height) ? '' : 'px'));
this.shadowDiv.css('height', options.height + (/px/.test(options.height) ? '' : 'px'));
- var headerHeight = $(richfaces.getDomElement(this.div +"_header"))[0] ? $(richfaces.getDomElement(this.div +"_header"))[0].clientHeight : 0;
+ var headerHeight = $(richfaces.getDomElement(this.markerId +"_header"))[0] ? $(richfaces.getDomElement(this.markerId +"_header"))[0].clientHeight : 0;
this.scrollerDiv.css('height', options.height - headerHeight + (/px/.test(options.height) ? '' : 'px'));
14 years, 1 month
JBoss Rich Faces SVN: r20463 - trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-12-08 09:11:26 -0500 (Wed, 08 Dec 2010)
New Revision: 20463
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java
Log:
RF-9550 TabPanel should not be JDK 6 dependent.
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java 2010-12-08 13:49:46 UTC (rev 20462)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java 2010-12-08 14:11:26 UTC (rev 20463)
@@ -90,7 +90,7 @@
@Override
protected Map<String, Object> getScriptObjectOptions(FacesContext context, UIComponent component) {
Map<String, Object> options = super.getScriptObjectOptions(context, component);
- options.put("isKeepHeight", !attributeAsString(component, height).isEmpty());
+ options.put("isKeepHeight", attributeAsString(component, height).length() > 0);
options.remove("items");
return options;
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java 2010-12-08 13:49:46 UTC (rev 20462)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java 2010-12-08 14:11:26 UTC (rev 20463)
@@ -137,7 +137,7 @@
header.encodeAll(context);
} else {
String headerText = (String) component.getAttributes().get("header");
- if (headerText != null && !headerText.isEmpty()) {
+ if (headerText != null && headerText.length() > 0) {
responseWriter.writeText(headerText, null);
}
}
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java 2010-12-08 13:49:46 UTC (rev 20462)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java 2010-12-08 14:11:26 UTC (rev 20463)
@@ -58,7 +58,7 @@
protected static String attributeAsStyle(UIComponent comp, Enum attr) {
String value = attributeAsString(comp, attr.toString());
- if (value.isEmpty()) {
+ if (value.length() == 0) {
return "";
}
14 years, 1 month
JBoss Rich Faces SVN: r20462 - in modules/tests/metamer/trunk/application/src/main: resources/org/richfaces/tests/metamer/bean and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-12-08 08:49:46 -0500 (Wed, 08 Dec 2010)
New Revision: 20462
Added:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichToolbarGroupBean.java
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichToolbarGroupBean.properties
modules/tests/metamer/trunk/application/src/main/webapp/components/richToolbarGroup/
modules/tests/metamer/trunk/application/src/main/webapp/components/richToolbarGroup/list.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richToolbarGroup/simple.xhtml
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichToolbarBean.properties
Log:
https://jira.jboss.org/browse/RFPL-955
* added sample for rich:toolbarGroup
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java 2010-12-08 13:48:46 UTC (rev 20461)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java 2010-12-08 13:49:46 UTC (rev 20462)
@@ -147,6 +147,7 @@
components.put("richTogglePanel", "Rich Toggle Panel");
components.put("richTogglePanelItem", "Rich Toggle Panel Item");
components.put("richToolbar", "Rich Toolbar");
+ components.put("richToolbarGroup", "Rich Toolbar Group");
components.put("richTooltip", "Rich Tooltip");
components.put("richTree", "Rich Tree");
}
Added: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichToolbarGroupBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichToolbarGroupBean.java (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichToolbarGroupBean.java 2010-12-08 13:49:46 UTC (rev 20462)
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.bean;
+
+import java.io.Serializable;
+import javax.annotation.PostConstruct;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ViewScoped;
+import org.richfaces.component.UIToolbarGroup;
+import org.richfaces.tests.metamer.Attributes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Managed bean for rich:toolbar.
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+@ManagedBean(name = "richToolbarGroupBean")
+@ViewScoped
+public class RichToolbarGroupBean implements Serializable {
+
+ private static final long serialVersionUID = -1L;
+ private static Logger logger;
+ private Attributes attributes;
+
+ /**
+ * Initializes the managed bean.
+ */
+ @PostConstruct
+ public void init() {
+ logger = LoggerFactory.getLogger(getClass());
+ logger.debug("initializing bean " + getClass().getName());
+
+ attributes = Attributes.getUIComponentAttributes(UIToolbarGroup.class, getClass(), false);
+
+ attributes.setAttribute("rendered", true);
+ }
+
+ public Attributes getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(Attributes attributes) {
+ this.attributes = attributes;
+ }
+}
Property changes on: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichToolbarGroupBean.java
___________________________________________________________________
Name: svn:keywords
+ Revision
Modified: modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichToolbarBean.properties
===================================================================
--- modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichToolbarBean.properties 2010-12-08 13:48:46 UTC (rev 20461)
+++ modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichToolbarBean.properties 2010-12-08 13:49:46 UTC (rev 20462)
@@ -3,4 +3,5 @@
attr.itemSeparator.square=square
attr.itemSeparator.disc=disc
attr.itemSeparator.grid=grid
+attr.itemSeparator.non-existing=non-existing
attr.itemSeparator.null=
Added: modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichToolbarGroupBean.properties
===================================================================
--- modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichToolbarGroupBean.properties (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichToolbarGroupBean.properties 2010-12-08 13:49:46 UTC (rev 20462)
@@ -0,0 +1,8 @@
+attr.itemSeparator.none=none
+attr.itemSeparator.line=line
+attr.itemSeparator.square=square
+attr.itemSeparator.disc=disc
+attr.itemSeparator.grid=grid
+attr.itemSeparator.non-existing=non-existing
+attr.itemSeparator.null=
+
Added: modules/tests/metamer/trunk/application/src/main/webapp/components/richToolbarGroup/list.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richToolbarGroup/list.xhtml (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richToolbarGroup/list.xhtml 2010-12-08 13:49:46 UTC (rev 20462)
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:metamer="http://java.sun.com/jsf/composite/metamer">
+
+ <!--
+JBoss, Home of Professional Open Source
+Copyright 2010, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ -->
+
+ <ui:composition template="/templates/list.xhtml">
+
+ <ui:define name="pageTitle">Rich Toolbar Group</ui:define>
+
+ <ui:define name="links">
+
+ <metamer:testPageLink id="simple" outcome="simple" value="Simple">
+ Simple page containing a toolbar with several <b>rich:toolbarGroup</b>s and inputs for all group's attributes.
+ </metamer:testPageLink>
+
+ </ui:define>
+
+ </ui:composition>
+
+</html>
Added: modules/tests/metamer/trunk/application/src/main/webapp/components/richToolbarGroup/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richToolbarGroup/simple.xhtml (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richToolbarGroup/simple.xhtml 2010-12-08 13:49:46 UTC (rev 20462)
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:metamer="http://java.sun.com/jsf/composite/metamer"
+ xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j">
+
+ <!--
+JBoss, Home of Professional Open Source
+Copyright 2010, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ -->
+
+ <ui:composition template="/templates/template.xhtml">
+ <ui:define name="head">
+ <f:metadata>
+ <f:viewParam name="templates" value="#{templateBean.templates}">
+ <f:converter converterId="templatesListConverter" />
+ </f:viewParam>
+ </f:metadata>
+ <style type="text/css">
+ .pic {
+ margin-right: 2px;
+ margin-top: 2px;
+ }
+
+ .barsearch {
+ height: 14px;
+ width: 100px;
+ }
+ </style>
+ </ui:define>
+
+ <ui:define name="outOfTemplateBefore">
+ </ui:define>
+
+ <ui:define name="component">
+
+ <rich:toolbar id="toolbar" height="28">
+
+ <rich:toolbarGroup id="group1"
+ itemClass="#{richToolbarGroupBean.attributes['itemClass'].value}"
+ itemSeparator="#{richToolbarGroupBean.attributes['itemSeparator'].value}"
+ itemStyle="#{richToolbarGroupBean.attributes['itemStyle'].value}"
+ location="#{richToolbarGroupBean.attributes['location'].value}"
+ onitemclick="#{richToolbarGroupBean.attributes['onitemclick'].value}"
+ onitemdblclick="#{richToolbarGroupBean.attributes['onitemdblclick'].value}"
+ onitemkeydown="#{richToolbarGroupBean.attributes['onitemkeydown'].value}"
+ onitemkeypress="#{richToolbarGroupBean.attributes['onitemkeypress'].value}"
+ onitemkeyup="#{richToolbarGroupBean.attributes['onitemkeyup'].value}"
+ onitemmousedown="#{richToolbarGroupBean.attributes['onitemmousedown'].value}"
+ onitemmousemove="#{richToolbarGroupBean.attributes['onitemmousemove'].value}"
+ onitemmouseout="#{richToolbarGroupBean.attributes['onitemmouseout'].value}"
+ onitemmouseover="#{richToolbarGroupBean.attributes['onitemmouseover'].value}"
+ onitemmouseup="#{richToolbarGroupBean.attributes['onitemmouseup'].value}"
+ rendered="#{richToolbarGroupBean.attributes['rendered'].value}"
+ style="#{richToolbarGroupBean.attributes['style'].value}"
+ styleClass="#{richToolbarGroupBean.attributes['styleClass'].value}"
+ >
+ <h:graphicImage library="images/icons" name="create_doc.gif" styleClass="pic" />
+ <h:graphicImage library="images/icons" name="create_folder.gif" styleClass="pic" />
+ <h:graphicImage library="images/icons" name="copy.gif" styleClass="pic" />
+ <h:graphicImage library="images/icons" name="save.gif" styleClass="pic" />
+ <h:graphicImage library="images/icons" name="save_as.gif" styleClass="pic" />
+ <h:graphicImage library="images/icons" name="save_all.gif" styleClass="pic" />
+ </rich:toolbarGroup>
+
+ <rich:toolbarGroup id="group2" location="right">
+ <h:inputText id="input" styleClass="barsearch" />
+ <h:commandButton id="button" onclick="return false;" value="Search" />
+ </rich:toolbarGroup>
+
+ </rich:toolbar>
+
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ <metamer:attributes value="#{richToolbarGroupBean.attributes}" id="attributes" render="log"/>
+ </ui:define>
+
+ </ui:composition>
+</html>
\ No newline at end of file
14 years, 1 month
JBoss Rich Faces SVN: r20461 - modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-12-08 08:48:46 -0500 (Wed, 08 Dec 2010)
New Revision: 20461
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichToolbarBean.java
Log:
* scope of bean changed to view
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichToolbarBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichToolbarBean.java 2010-12-08 13:43:58 UTC (rev 20460)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichToolbarBean.java 2010-12-08 13:48:46 UTC (rev 20461)
@@ -22,12 +22,10 @@
package org.richfaces.tests.metamer.bean;
import java.io.Serializable;
-
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
-import javax.faces.bean.SessionScoped;
+import javax.faces.bean.ViewScoped;
import org.richfaces.component.UIToolbar;
-
import org.richfaces.tests.metamer.Attributes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -39,7 +37,7 @@
* @version $Revision$
*/
@ManagedBean(name = "richToolbarBean")
-@SessionScoped
+@ViewScoped
public class RichToolbarBean implements Serializable {
private static final long serialVersionUID = -1L;
@@ -54,7 +52,7 @@
logger = LoggerFactory.getLogger(getClass());
logger.debug("initializing bean " + getClass().getName());
- attributes = Attributes.getUIComponentAttributes(UIToolbar.class, getClass());
+ attributes = Attributes.getUIComponentAttributes(UIToolbar.class, getClass(), false);
attributes.setAttribute("height", 28);
attributes.setAttribute("rendered", true);
14 years, 1 month
JBoss Rich Faces SVN: r20460 - in trunk/examples/richfaces-showcase/src/main: java/org/richfaces/demo/fileupload and 6 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2010-12-08 08:43:58 -0500 (Wed, 08 Dec 2010)
New Revision: 20460
Added:
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/fileupload/
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/fileupload/FileUploadBean.java
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/fileupload/UplocadedImage.java
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/fileUpload/
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/fileUpload/imgUpload.xhtml
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/fileUpload/samples/
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/fileUpload/samples/imgUpload-sample.xhtml
Modified:
trunk/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/data/common/navigation.xml
trunk/examples/richfaces-showcase/src/main/webapp-gae/WEB-INF/web.xml
trunk/examples/richfaces-showcase/src/main/webapp/WEB-INF/web.xml
Log:
https://jira.jboss.org/browse/RF-9502
Added: trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/fileupload/FileUploadBean.java
===================================================================
--- trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/fileupload/FileUploadBean.java (rev 0)
+++ trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/fileupload/FileUploadBean.java 2010-12-08 13:43:58 UTC (rev 20460)
@@ -0,0 +1,91 @@
+package org.richfaces.demo.fileupload;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Serializable;
+import java.util.ArrayList;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.SessionScoped;
+
+import org.richfaces.event.UploadEvent;
+import org.richfaces.model.UploadItem;
+
+/**
+ * @author Ilya Shaikovsky
+ *
+ */
+@ManagedBean
+@SessionScoped
+public class FileUploadBean implements Serializable {
+
+ private ArrayList<UplocadedImage> files = new ArrayList<UplocadedImage>();
+ private int uploadsAvailable = 5;
+ private boolean autoUpload = false;
+ private boolean useFlash = false;
+
+ public int getSize() {
+ if (getFiles().size() > 0) {
+ return getFiles().size();
+ } else {
+ return 0;
+ }
+ }
+
+ public void paint(OutputStream stream, Object object) throws IOException {
+ stream.write(getFiles().get((Integer) object).getData());
+ }
+
+ public void listener(UploadEvent event) throws Exception {
+ UploadItem item = event.getUploadItem();
+ UplocadedImage file = new UplocadedImage();
+ file.setLength(item.getData().length);
+ file.setName(item.getFileName());
+ file.setData(item.getData());
+ files.add(file);
+ uploadsAvailable--;
+ }
+
+ public String clearUploadData() {
+ files.clear();
+ setUploadsAvailable(5);
+ return null;
+ }
+
+ public long getTimeStamp() {
+ return System.currentTimeMillis();
+ }
+
+ public ArrayList<UplocadedImage> getFiles() {
+ return files;
+ }
+
+ public void setFiles(ArrayList<UplocadedImage> files) {
+ this.files = files;
+ }
+
+ public int getUploadsAvailable() {
+ return uploadsAvailable;
+ }
+
+ public void setUploadsAvailable(int uploadsAvailable) {
+ this.uploadsAvailable = uploadsAvailable;
+ }
+
+ public boolean isAutoUpload() {
+ return autoUpload;
+ }
+
+ public void setAutoUpload(boolean autoUpload) {
+ this.autoUpload = autoUpload;
+ }
+
+ public boolean isUseFlash() {
+ return useFlash;
+ }
+
+ public void setUseFlash(boolean useFlash) {
+ this.useFlash = useFlash;
+ }
+
+}
Added: trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/fileupload/UplocadedImage.java
===================================================================
--- trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/fileupload/UplocadedImage.java (rev 0)
+++ trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/fileupload/UplocadedImage.java 2010-12-08 13:43:58 UTC (rev 20460)
@@ -0,0 +1,52 @@
+package org.richfaces.demo.fileupload;
+
+public class UplocadedImage {
+
+ private String name;
+ private String mime;
+ private long length;
+ private byte[] data;
+
+ public byte[] getData() {
+ return data;
+ }
+
+ public void setData(byte[] data) {
+ this.data = data;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ name = name;
+ int extDot = name.lastIndexOf('.');
+ if (extDot > 0) {
+ String extension = name.substring(extDot + 1);
+ if ("bmp".equals(extension)) {
+ mime = "image/bmp";
+ } else if ("jpg".equals(extension)) {
+ mime = "image/jpeg";
+ } else if ("gif".equals(extension)) {
+ mime = "image/gif";
+ } else if ("png".equals(extension)) {
+ mime = "image/png";
+ } else {
+ mime = "image/unknown";
+ }
+ }
+ }
+
+ public long getLength() {
+ return length;
+ }
+
+ public void setLength(long length) {
+ this.length = length;
+ }
+
+ public String getMime() {
+ return mime;
+ }
+}
Modified: trunk/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/data/common/navigation.xml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/data/common/navigation.xml 2010-12-08 13:24:39 UTC (rev 20459)
+++ trunk/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/data/common/navigation.xml 2010-12-08 13:43:58 UTC (rev 20460)
@@ -536,6 +536,16 @@
</sample>
</samples>
</demo>
+ <demo new="true">
+ <id>fileUpload</id>
+ <name>rich:fileUpload</name>
+ <samples>
+ <sample>
+ <id>imgUpload</id>
+ <name>Upload images</name>
+ </sample>
+ </samples>
+ </demo>
</demos>
</group>
<group>
Modified: trunk/examples/richfaces-showcase/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/webapp/WEB-INF/web.xml 2010-12-08 13:24:39 UTC (rev 20459)
+++ trunk/examples/richfaces-showcase/src/main/webapp/WEB-INF/web.xml 2010-12-08 13:43:58 UTC (rev 20460)
@@ -1,58 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="richfaces-showcase" version="2.5"
- 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-app_2_5.xsd">
- <display-name>richfaces-showcase</display-name>
- <context-param>
- <param-name>javax.faces.FACELETS_LIBRARIES</param-name>
- <param-value>/WEB-INF/app-tags.taglib.xml</param-value>
- </context-param>
- <context-param>
- <param-name>org.richfaces.enableControlSkinning</param-name>
- <param-value>true</param-value>
- </context-param>
- <context-param>
- <param-name>org.richfaces.enableControlSkinningClasses</param-name>
- <param-value>false</param-value>
- </context-param>
- <context-param>
- <param-name>org.richfaces.skin</param-name>
- <param-value>#{skinBean.skin}</param-value>
- </context-param>
- <context-param>
- <param-name>javax.faces.PROJECT_STAGE</param-name>
- <param-value>Development</param-value>
- </context-param>
- <context-param>
- <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
- <param-value>server</param-value>
- </context-param>
- <servlet>
- <servlet-name>Faces Servlet</servlet-name>
- <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
- <load-on-startup>1</load-on-startup>
- </servlet>
- <servlet-mapping>
- <servlet-name>Faces Servlet</servlet-name>
- <url-pattern>*.jsf</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>Faces Servlet</servlet-name>
- <url-pattern>/faces/*</url-pattern>
- </servlet-mapping>
- <mime-mapping>
- <extension>ecss</extension>
- <mime-type>text/css</mime-type>
- </mime-mapping>
- <welcome-file-list>
- <welcome-file>index.html</welcome-file>
- <welcome-file>index.htm</welcome-file>
- <welcome-file>index.jsp</welcome-file>
- <welcome-file>default.html</welcome-file>
- <welcome-file>default.htm</welcome-file>
- <welcome-file>default.jsp</welcome-file>
- </welcome-file-list>
- <login-config>
- <auth-method>BASIC</auth-method>
- </login-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-app_2_5.xsd">
+ <display-name>richfaces-showcase</display-name>
+ <context-param>
+ <param-name>javax.faces.FACELETS_LIBRARIES</param-name>
+ <param-value>/WEB-INF/app-tags.taglib.xml</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.richfaces.skin</param-name>
+ <param-value>#{skinBean.skin}</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.richfaces.fileUpload.maxRequestSize</param-name>
+ <param-value>100000</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.richfaces.fileUpload.createTempFiles</param-name>
+ <param-value>false</param-value>
+ </context-param>
+ <context-param>
+ <param-name>javax.faces.PROJECT_STAGE</param-name>
+ <param-value>Development</param-value>
+ </context-param>
+ <context-param>
+ <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+ <param-value>server</param-value>
+ </context-param>
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>/faces/*</url-pattern>
+ </servlet-mapping>
+ <mime-mapping>
+ <extension>ecss</extension>
+ <mime-type>text/css</mime-type>
+ </mime-mapping>
+ <welcome-file-list>
+ <welcome-file>index.html</welcome-file>
+ <welcome-file>index.htm</welcome-file>
+ <welcome-file>index.jsp</welcome-file>
+ <welcome-file>default.html</welcome-file>
+ <welcome-file>default.htm</welcome-file>
+ <welcome-file>default.jsp</welcome-file>
+ </welcome-file-list>
+ <login-config>
+ <auth-method>BASIC</auth-method>
+ </login-config>
</web-app>
Added: trunk/examples/richfaces-showcase/src/main/webapp/richfaces/fileUpload/imgUpload.xhtml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/webapp/richfaces/fileUpload/imgUpload.xhtml (rev 0)
+++ trunk/examples/richfaces-showcase/src/main/webapp/richfaces/fileUpload/imgUpload.xhtml 2010-12-08 13:43:58 UTC (rev 20460)
@@ -0,0 +1,38 @@
+<!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">
+
+<ui:composition>
+ <p><b>rich:fileUpload</b> is a component which provides files
+ upload functionality and extends functionality of standard <b>input</b>
+ with <b>type="file"</b>.</p>
+ <p>The next example shows you File Upload which allows you to
+ upload files to the server. Files number allowed to upload is managed
+ with <b>maxFilesQuantity</b> attribute. Every uploaded file should be
+ managed with <b>fileUploadListener</b> which is called after every
+ single file upload is finished.</p>
+ <fieldset><legend><b>Sample limitations</b></legend>This
+ example allows to download <b>up to 5 files</b>. The file extension is
+ limited to <b>GIF, JPG, BMP, PNG</b> and the maximum size of each file
+ must not exceed 100kB</fieldset>
+ <ui:include src="#{demoNavigator.sampleIncludeURI}" />
+ <ui:include src="/templates/includes/source-view.xhtml">
+ <ui:param name="src" value="#{demoNavigator.sampleIncludeURI}" />
+ <ui:param name="sourceType" value="xhtml" />
+ <ui:param name="openLabel" value="View Source" />
+ <ui:param name="hideLabel" value="Hide Source" />
+ </ui:include>
+ <p><b>FileUpload requires two context-parameter's to be set in
+ web.xml:</b></p>
+ <ul>
+ <li><b>createTempFiles</b> boolean attribute which defines whether the
+ uploaded files are stored in temporary files or available in listener
+ just as byte[] data (false for this example).</li>
+ <li><b>maxRequestSize</b> attribute defines max size in bytes of the
+ uploaded files (<u>1000000 for this example</u>).</li>
+ </ul>
+</ui:composition>
+
+</html>
\ No newline at end of file
Added: trunk/examples/richfaces-showcase/src/main/webapp/richfaces/fileUpload/samples/imgUpload-sample.xhtml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/webapp/richfaces/fileUpload/samples/imgUpload-sample.xhtml (rev 0)
+++ trunk/examples/richfaces-showcase/src/main/webapp/richfaces/fileUpload/samples/imgUpload-sample.xhtml 2010-12-08 13:43:58 UTC (rev 20460)
@@ -0,0 +1,63 @@
+<!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:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich">
+
+<ui:composition>
+
+ <style>
+.top {
+ vertical-align: top;
+}
+
+.info {
+ height: 202px;
+ overflow: auto;
+}
+</style>
+ <h:form>
+ <h:panelGrid columns="2" columnClasses="top,top">
+ <rich:fileUpload fileUploadListener="#{fileUploadBean.listener}"
+ maxFilesQuantity="#{fileUploadBean.uploadsAvailable}" id="upload"
+ acceptedTypes="jpg, gif, png, bmp">
+ <a4j:ajax event="uploadcomplete" execute="@none" render="info" />
+ </rich:fileUpload>
+ <h:panelGroup id="info">
+ <rich:panel bodyClass="info">
+ <f:facet name="header">
+ <h:outputText value="Uploaded Files Info" />
+ </f:facet>
+ <h:outputText value="No files currently uploaded"
+ rendered="#{fileUploadBean.size==0}" />
+ <rich:dataGrid columns="1" value="#{fileUploadBean.files}"
+ var="file" rowKeyVar="row">
+ <rich:panel bodyClass="rich-laguna-panel-no-header">
+ <h:panelGrid columns="2">
+ <a4j:mediaOutput element="img" mimeType="#{file.mime}"
+ createContent="#{fileUploadBean.paint}" value="#{row}"
+ style="width:100px; height:100px;" cacheable="false">
+ <f:param value="#{fileUploadBean.timeStamp}" name="time" />
+ </a4j:mediaOutput>
+ <h:panelGrid columns="2">
+ <h:outputText value="File Name:" />
+ <h:outputText value="#{file.name}" />
+ <h:outputText value="File Length(bytes):" />
+ <h:outputText value="#{file.length}" />
+ </h:panelGrid>
+ </h:panelGrid>
+ </rich:panel>
+ </rich:dataGrid>
+ </rich:panel>
+ <br />
+ <a4j:commandButton action="#{fileUploadBean.clearUploadData}"
+ render="info, upload" value="Clear Uploaded Data"
+ rendered="#{fileUploadBean.size>0}" />
+ </h:panelGroup>
+ </h:panelGrid>
+ </h:form>
+</ui:composition>
+
+</html>
\ No newline at end of file
Modified: trunk/examples/richfaces-showcase/src/main/webapp-gae/WEB-INF/web.xml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/webapp-gae/WEB-INF/web.xml 2010-12-08 13:24:39 UTC (rev 20459)
+++ trunk/examples/richfaces-showcase/src/main/webapp-gae/WEB-INF/web.xml 2010-12-08 13:43:58 UTC (rev 20460)
@@ -24,6 +24,14 @@
<param-name>org.richfaces.enableControlSkinningClasses</param-name>
<param-value>false</param-value>
</context-param>
+ <context-param>
+ <param-name>org.richfaces.fileUpload.maxRequestSize</param-name>
+ <param-value>100000</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.richfaces.fileUpload.createTempFiles</param-name>
+ <param-value>false</param-value>
+ </context-param>
<context-param>
<param-name>org.richfaces.skin</param-name>
<param-value>#{skinBean.skin}</param-value>
14 years, 1 month
JBoss Rich Faces SVN: r20459 - trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2010-12-08 08:24:39 -0500 (Wed, 08 Dec 2010)
New Revision: 20459
Modified:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.js
Log:
RF-9905 popupPanel: popupPanel.js: this.id should contains component id but not an object
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.js 2010-12-08 12:55:29 UTC (rev 20458)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.js 2010-12-08 13:24:39 UTC (rev 20459)
@@ -56,7 +56,6 @@
this.attachToDom(this.markerId);
this.options = $.extend(this.options, defaultOptions, options || {});
- this.id = $(richfaces.getDomElement(id)); // Should be component Id string // NOT AN OBJECT
this.minWidth = this.getMinimumSize(this.options.minWidth);
this.minHeight = this.getMinimumSize(this.options.minHeight);
this.maxWidth = this.options.maxWidth;
@@ -174,8 +173,6 @@
this.markerId = null;
this.options = null;
- this.id = null;
-
this.div = null;
this.cdiv = null;
this.contentDiv = null;
@@ -412,7 +409,7 @@
!root.disabled && root.type!="hidden") {
callback.call(this, root);
} else {
- if (root != this.id) {
+ if (root != this.div) {
var child = root.firstChild;
while (child) {
if (!child.style || child.style.display != 'none') {
@@ -487,7 +484,7 @@
this.currentMinHeight = undefined;
this.currentMinWidth = undefined;
- this.id.hide();
+ this.div.hide();
if (this.parent) {
if (this.domReattached) {
14 years, 1 month
JBoss Rich Faces SVN: r20458 - in trunk/ui/output/ui/src/test: java/org/richfaces/renderkit/html and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2010-12-08 07:55:29 -0500 (Wed, 08 Dec 2010)
New Revision: 20458
Added:
trunk/ui/output/ui/src/test/java/org/richfaces/component/DropDownMenuBean.java
trunk/ui/output/ui/src/test/java/org/richfaces/component/UIDropDownMenuTest.java
trunk/ui/output/ui/src/test/java/org/richfaces/component/UIMenuGroupTest.java
trunk/ui/output/ui/src/test/java/org/richfaces/component/UIMenuItemTest.java
trunk/ui/output/ui/src/test/java/org/richfaces/component/UIMenuSeparatorTest.java
trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/DrowDownMenuRendererTest.java
trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/MenuItemRendererTest.java
trunk/ui/output/ui/src/test/resources/org/richfaces/component/
trunk/ui/output/ui/src/test/resources/org/richfaces/component/faces-config.xml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/dropDownMenu_ajaxMode.xhtml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/dropDownMenu_ajaxMode.xmlunit.xml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/dropDownMenu_serverMode.xhtml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/dropDownMenu_serverMode.xmlunit.xml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/menuItem_ajaxMode.xhtml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/menuItem_ajaxMode.xmlunit.xml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/menuItem_clientMode.xhtml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/menuItem_clientMode.xmlunit.xml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/menuItem_serverMode.xhtml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/menuItem_serverMode.xmlunit.xml
Log:
RF-9788 Dropdown menu component: unit tests for server-side code.
Added: trunk/ui/output/ui/src/test/java/org/richfaces/component/DropDownMenuBean.java
===================================================================
--- trunk/ui/output/ui/src/test/java/org/richfaces/component/DropDownMenuBean.java (rev 0)
+++ trunk/ui/output/ui/src/test/java/org/richfaces/component/DropDownMenuBean.java 2010-12-08 12:55:29 UTC (rev 20458)
@@ -0,0 +1,22 @@
+package org.richfaces.component;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.SessionScoped;
+
+@ManagedBean
+@SessionScoped
+public class DropDownMenuBean {
+ private static String _current = "none";
+
+ public void doAction() {
+ _current = "action";
+ }
+
+ public static String getCurrent() {
+ return _current;
+ }
+
+ public static void setCurrent(String current) {
+ _current = current;
+ }
+}
Added: trunk/ui/output/ui/src/test/java/org/richfaces/component/UIDropDownMenuTest.java
===================================================================
--- trunk/ui/output/ui/src/test/java/org/richfaces/component/UIDropDownMenuTest.java (rev 0)
+++ trunk/ui/output/ui/src/test/java/org/richfaces/component/UIDropDownMenuTest.java 2010-12-08 12:55:29 UTC (rev 20458)
@@ -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.component;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class UIDropDownMenuTest {
+ private UIDropDownMenu dropDownMenu;
+
+ @Before
+ public void setUp () {
+ dropDownMenu = new UIDropDownMenu();
+ }
+
+ @Test
+ public void testSomething() {
+ Assert.assertNotNull(dropDownMenu);
+ }
+}
Added: trunk/ui/output/ui/src/test/java/org/richfaces/component/UIMenuGroupTest.java
===================================================================
--- trunk/ui/output/ui/src/test/java/org/richfaces/component/UIMenuGroupTest.java (rev 0)
+++ trunk/ui/output/ui/src/test/java/org/richfaces/component/UIMenuGroupTest.java 2010-12-08 12:55:29 UTC (rev 20458)
@@ -0,0 +1,40 @@
+/*
+ * 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.component;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class UIMenuGroupTest {
+ private UIMenuGroup menuGroup;
+
+ @Before
+ public void setUp () {
+ menuGroup = new UIMenuGroup();
+ }
+
+ @Test
+ public void testSomething() {
+ Assert.assertNotNull(menuGroup);
+ }
+}
Added: trunk/ui/output/ui/src/test/java/org/richfaces/component/UIMenuItemTest.java
===================================================================
--- trunk/ui/output/ui/src/test/java/org/richfaces/component/UIMenuItemTest.java (rev 0)
+++ trunk/ui/output/ui/src/test/java/org/richfaces/component/UIMenuItemTest.java 2010-12-08 12:55:29 UTC (rev 20458)
@@ -0,0 +1,40 @@
+/*
+ * 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.component;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class UIMenuItemTest {
+ private UIMenuItem menuItem;
+
+ @Before
+ public void setUp () {
+ menuItem = new UIMenuItem();
+ }
+
+ @Test
+ public void testSomething() {
+ Assert.assertNotNull(menuItem);
+ }
+}
Added: trunk/ui/output/ui/src/test/java/org/richfaces/component/UIMenuSeparatorTest.java
===================================================================
--- trunk/ui/output/ui/src/test/java/org/richfaces/component/UIMenuSeparatorTest.java (rev 0)
+++ trunk/ui/output/ui/src/test/java/org/richfaces/component/UIMenuSeparatorTest.java 2010-12-08 12:55:29 UTC (rev 20458)
@@ -0,0 +1,40 @@
+/*
+ * 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.component;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class UIMenuSeparatorTest {
+ private UIMenuSeparator menuSeparator;
+
+ @Before
+ public void setUp () {
+ menuSeparator = new UIMenuSeparator();
+ }
+
+ @Test
+ public void testSomething() {
+ Assert.assertNotNull(menuSeparator);
+ }
+}
Added: trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/DrowDownMenuRendererTest.java
===================================================================
--- trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/DrowDownMenuRendererTest.java (rev 0)
+++ trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/DrowDownMenuRendererTest.java 2010-12-08 12:55:29 UTC (rev 20458)
@@ -0,0 +1,85 @@
+/*
+ * 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.renderkit.html;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+
+import org.jboss.test.faces.htmlunit.HtmlUnitEnvironment;
+import org.junit.Test;
+import org.richfaces.component.DropDownMenuBean;
+import org.xml.sax.SAXException;
+
+import com.gargoylesoftware.htmlunit.html.HtmlDivision;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+public class DrowDownMenuRendererTest 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 testDoEncodeServerMode() throws IOException, SAXException {
+ doTest("dropDownMenu_serverMode", "form:ddmenu");
+ }
+
+ @Test
+ public void testDoEncodeAjaxMode() throws IOException, SAXException {
+ doTest("dropDownMenu_ajaxMode", "form:ddmenu");
+ }
+
+ @Test
+ public void testServerClick() throws IOException, SAXException {
+ HtmlPage page = environment.getPage("/dropDownMenu_serverMode.jsf");
+ HtmlDivision item = (HtmlDivision) page.getElementById("form:saveAll");
+ assertNotNull(item);
+ DropDownMenuBean.setCurrent("none");
+ item.click();
+
+ item = (HtmlDivision) page.getElementById("form:saveAll");
+ assertNotNull(item);
+ assertEquals("action", DropDownMenuBean.getCurrent());
+ }
+
+ @Test
+ public void testAjaxClick() throws IOException, SAXException {
+ HtmlPage page = environment.getPage("/dropDownMenu_ajaxMode.jsf");
+
+ HtmlDivision item = (HtmlDivision) page.getElementById("form:saveAll");
+ assertNotNull(item);
+ DropDownMenuBean.setCurrent("none");
+ item.click();
+
+ item = (HtmlDivision) page.getElementById("form:saveAll");
+ assertNotNull(item);
+ assertEquals("action", DropDownMenuBean.getCurrent());
+ }
+}
Added: trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/MenuItemRendererTest.java
===================================================================
--- trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/MenuItemRendererTest.java (rev 0)
+++ trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/MenuItemRendererTest.java 2010-12-08 12:55:29 UTC (rev 20458)
@@ -0,0 +1,103 @@
+/*
+ * 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.renderkit.html;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+
+import org.jboss.test.faces.htmlunit.HtmlUnitEnvironment;
+import org.junit.Test;
+import org.richfaces.component.DropDownMenuBean;
+import org.xml.sax.SAXException;
+
+import com.gargoylesoftware.htmlunit.html.HtmlDivision;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+public class MenuItemRendererTest 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 testDoEncodeServerMode() throws IOException, SAXException {
+ doTest("menuItem_serverMode", "form:menuItem");
+ }
+
+ @Test
+ public void testServerClick() throws IOException, SAXException {
+ HtmlPage page = environment.getPage("/menuItem_serverMode.jsf");
+
+ HtmlDivision item = (HtmlDivision) page.getElementById("form:menuItem");
+ assertNotNull(item);
+ DropDownMenuBean.setCurrent("none");
+ item.click();
+
+ item = (HtmlDivision) page.getElementById("form:menuItem");
+ assertNotNull(item);
+ assertEquals("action", DropDownMenuBean.getCurrent());
+ }
+
+ @Test
+ public void testDoEncodeAjaxMode() throws IOException, SAXException {
+ doTest("menuItem_ajaxMode", "form:menuItem");
+ }
+
+ @Test
+ public void testAjaxClick() throws IOException, SAXException {
+ HtmlPage page = environment.getPage("/menuItem_ajaxMode.jsf");
+ HtmlDivision item = (HtmlDivision) page.getElementById("form:menuItem");
+ assertNotNull(item);
+ DropDownMenuBean.setCurrent("none");
+ item.click();
+
+ item = (HtmlDivision) page.getElementById("form:menuItem");
+ assertNotNull(item);
+ assertEquals("action", DropDownMenuBean.getCurrent());
+ }
+
+ @Test
+ public void testDoEncodeClientMode() throws IOException, SAXException {
+ doTest("menuItem_clientMode", "form:menuItem");
+ }
+
+ @Test
+ public void testClientClick() throws IOException, SAXException {
+ HtmlPage page = environment.getPage("/menuItem_clientMode.jsf");
+ HtmlDivision item = (HtmlDivision) page.getElementById("form:menuItem");
+ assertNotNull(item);
+ DropDownMenuBean.setCurrent("none");
+ item.click();
+
+ item = (HtmlDivision) page.getElementById("form:menuItem");
+ assertNotNull(item);
+ assertEquals("none", DropDownMenuBean.getCurrent());
+ }
+}
Added: trunk/ui/output/ui/src/test/resources/org/richfaces/component/faces-config.xml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/component/faces-config.xml (rev 0)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/component/faces-config.xml 2010-12-08 12:55:29 UTC (rev 20458)
@@ -0,0 +1,14 @@
+<?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>ddmBean</managed-bean-name>
+ <managed-bean-class>org.richfaces.component.DropDownMenuBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+
+</faces-config>
\ No newline at end of file
Added: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/dropDownMenu_ajaxMode.xhtml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/dropDownMenu_ajaxMode.xhtml (rev 0)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/dropDownMenu_ajaxMode.xhtml 2010-12-08 12:55:29 UTC (rev 20458)
@@ -0,0 +1,62 @@
+<?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 MenuItem Test</title>
+ </h:head>
+
+<h:body>
+ <h:form id="form">
+ <pn:dropDownMenu id="ddmenu" mode="ajax">
+ <f:facet name="label">
+ <h:panelGroup>
+ <h:graphicImage value="/images/ddmenu/copy.gif" styleClass="pic"/>
+ <h:outputText value="File"/>
+ </h:panelGroup>
+ </f:facet>
+ <pn:menuItem label="Open" id="open"/>
+ <pn:menuGroup label="Save As..." id="group">
+ <pn:menuItem label="Save" id="save">
+ <f:facet name="icon">
+ <h:graphicImage value="/images/ddmenu/save.gif" />
+ </f:facet>
+ </pn:menuItem>
+ <pn:menuSeparator id="menuSeparator1" />
+ <pn:menuItem id="saveAll" label="SaveAll" action="#{ddmBean.doAction}"/>
+ </pn:menuGroup>
+ </pn:dropDownMenu>
+ </h:form>
+</h:body>
+</html>
+
+
Added: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/dropDownMenu_ajaxMode.xmlunit.xml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/dropDownMenu_ajaxMode.xmlunit.xml (rev 0)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/dropDownMenu_ajaxMode.xmlunit.xml 2010-12-08 12:55:29 UTC (rev 20458)
@@ -0,0 +1,60 @@
+ <div class="rf-ddm-lbl rf-ddm-lbl-unsel " id="form:ddmenu">
+ <div class="rf-ddm-lbl-dec">
+ <img src="/images/ddmenu/copy.gif" class="pic"/>
+ File
+ </div>
+ <div class="rf-ddm-pos">
+ <div class="rf-ddm-lst" id="form:ddmenu_list" style="display:none;min-width:250px;">
+ <div class="rf-ddm-lst-bg">
+ <div class="rf-ddm-itm rf-ddm-itm-unsel " id="form:open" onclick="RichFaces.ajax("form:open",event,{"incId":"1"} );return false;" onmouseout="this.className='rf-ddm-itm rf-ddm-itm-unsel '" onmouseover="this.className='rf-ddm-itm rf-ddm-itm-sel '">
+ <span class="rf-ddm-itm-ic ">
+ <div class="rf-ddm-emptyIcon">
+ </div>
+ </span>
+ <span class="rf-ddm-itm-lbl ">
+ Open
+ </span>
+ </div>
+ <div class="rf-ddm-itm rf-ddm-itm-unsel " id="form:group" onmouseout="this.className='rf-ddm-itm rf-ddm-itm-unsel'" onmouseover="this.className='rf-ddm-itm rf-ddm-itm-sel '">
+ <span class="rf-ddm-itm-ic ">
+ <div class="rf-ddm-emptyIcon">
+ </div>
+ </span>
+ <span class="rf-ddm-itm-lbl ">
+ Save As...
+ </span>
+ <div class="rf-ddm-nd">
+ <div class="rf-ddm-lst rf-ddm-sublst" id="form:group_list" style="display:none;min-width:250px;">
+ <div class="rf-ddm-lst-bg">
+ <div class="rf-ddm-itm rf-ddm-itm-unsel " id="form:save" onclick="RichFaces.ajax("form:save",event,{"incId":"1"} );return false;" onmouseout="this.className='rf-ddm-itm rf-ddm-itm-unsel '" onmouseover="this.className='rf-ddm-itm rf-ddm-itm-sel '">
+ <span class="rf-ddm-itm-ic ">
+ <img src="/images/ddmenu/save.gif"/>
+ </span>
+ <span class="rf-ddm-itm-lbl ">
+ Save
+ </span>
+ </div>
+ <div class="rf-ddm-sep">
+ </div>
+ <div class="rf-ddm-itm rf-ddm-itm-unsel " id="form:saveAll" onclick="RichFaces.ajax("form:saveAll",event,{"incId":"1"} );return false;" onmouseout="this.className='rf-ddm-itm rf-ddm-itm-unsel '" onmouseover="this.className='rf-ddm-itm rf-ddm-itm-sel '">
+ <span class="rf-ddm-itm-ic ">
+ <div class="rf-ddm-emptyIcon">
+ </div>
+ </span>
+ <span class="rf-ddm-itm-lbl ">
+ SaveAll
+ </span>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <script type="text/javascript">
+//<![CDATA[
+new RichFaces.ui.Menu("form:ddmenu",{"mode":"ajax"} ).initiateGroups([{"id":"form:group","horizontalOffset":"0","verticalOffset":"0","direction":"auto"} ] );
+//]]>
+ </script>
+ </div>
\ No newline at end of file
Added: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/dropDownMenu_serverMode.xhtml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/dropDownMenu_serverMode.xhtml (rev 0)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/dropDownMenu_serverMode.xhtml 2010-12-08 12:55:29 UTC (rev 20458)
@@ -0,0 +1,62 @@
+<?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 MenuItem Test</title>
+ </h:head>
+
+<h:body>
+ <h:form id="form">
+ <pn:dropDownMenu id="ddmenu">
+ <f:facet name="label">
+ <h:panelGroup>
+ <h:graphicImage value="/images/ddmenu/copy.gif" styleClass="pic"/>
+ <h:outputText value="File"/>
+ </h:panelGroup>
+ </f:facet>
+ <pn:menuItem label="Open" id="open"/>
+ <pn:menuGroup label="Save As..." id="group">
+ <pn:menuItem label="Save" id="save">
+ <f:facet name="icon">
+ <h:graphicImage value="/images/ddmenu/save.gif" />
+ </f:facet>
+ </pn:menuItem>
+ <pn:menuSeparator id="menuSeparator1" />
+ <pn:menuItem id="saveAll" label="SaveAll" action="#{ddmBean.doAction}"/>
+ </pn:menuGroup>
+ </pn:dropDownMenu>
+ </h:form>
+</h:body>
+</html>
+
+
Added: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/dropDownMenu_serverMode.xmlunit.xml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/dropDownMenu_serverMode.xmlunit.xml (rev 0)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/dropDownMenu_serverMode.xmlunit.xml 2010-12-08 12:55:29 UTC (rev 20458)
@@ -0,0 +1,60 @@
+ <div class="rf-ddm-lbl rf-ddm-lbl-unsel " id="form:ddmenu">
+ <div class="rf-ddm-lbl-dec">
+ <img src="/images/ddmenu/copy.gif" class="pic"/>
+ File
+ </div>
+ <div class="rf-ddm-pos">
+ <div class="rf-ddm-lst" id="form:ddmenu_list" style="display:none;min-width:250px;">
+ <div class="rf-ddm-lst-bg">
+ <div class="rf-ddm-itm rf-ddm-itm-unsel " id="form:open" onclick="RichFaces.submitForm("form",{"form:open":"form:open"} )" onmouseout="this.className='rf-ddm-itm rf-ddm-itm-unsel '" onmouseover="this.className='rf-ddm-itm rf-ddm-itm-sel '">
+ <span class="rf-ddm-itm-ic ">
+ <div class="rf-ddm-emptyIcon">
+ </div>
+ </span>
+ <span class="rf-ddm-itm-lbl ">
+ Open
+ </span>
+ </div>
+ <div class="rf-ddm-itm rf-ddm-itm-unsel " id="form:group" onmouseout="this.className='rf-ddm-itm rf-ddm-itm-unsel'" onmouseover="this.className='rf-ddm-itm rf-ddm-itm-sel '">
+ <span class="rf-ddm-itm-ic ">
+ <div class="rf-ddm-emptyIcon">
+ </div>
+ </span>
+ <span class="rf-ddm-itm-lbl ">
+ Save As...
+ </span>
+ <div class="rf-ddm-nd">
+ <div class="rf-ddm-lst rf-ddm-sublst" id="form:group_list" style="display:none;min-width:250px;">
+ <div class="rf-ddm-lst-bg">
+ <div class="rf-ddm-itm rf-ddm-itm-unsel " id="form:save" onclick="RichFaces.submitForm("form",{"form:save":"form:save"} )" onmouseout="this.className='rf-ddm-itm rf-ddm-itm-unsel '" onmouseover="this.className='rf-ddm-itm rf-ddm-itm-sel '">
+ <span class="rf-ddm-itm-ic ">
+ <img src="/images/ddmenu/save.gif"/>
+ </span>
+ <span class="rf-ddm-itm-lbl ">
+ Save
+ </span>
+ </div>
+ <div class="rf-ddm-sep">
+ </div>
+ <div class="rf-ddm-itm rf-ddm-itm-unsel " id="form:saveAll" onclick="RichFaces.submitForm("form",{"form:saveAll":"form:saveAll"} )" onmouseout="this.className='rf-ddm-itm rf-ddm-itm-unsel '" onmouseover="this.className='rf-ddm-itm rf-ddm-itm-sel '">
+ <span class="rf-ddm-itm-ic ">
+ <div class="rf-ddm-emptyIcon">
+ </div>
+ </span>
+ <span class="rf-ddm-itm-lbl ">
+ SaveAll
+ </span>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <script type="text/javascript">
+//<![CDATA[
+new RichFaces.ui.Menu("form:ddmenu").initiateGroups([{"id":"form:group","horizontalOffset":"0","verticalOffset":"0","direction":"auto"} ] );
+//]]>
+ </script>
+ </div>
\ No newline at end of file
Added: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/menuItem_ajaxMode.xhtml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/menuItem_ajaxMode.xhtml (rev 0)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/menuItem_ajaxMode.xhtml 2010-12-08 12:55:29 UTC (rev 20458)
@@ -0,0 +1,45 @@
+<?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 MenuItem Test</title>
+ </h:head>
+
+<h:body>
+ <h:form id="form">
+ <pn:menuItem id="menuItem" label="Test" action="#{ddmBean.doAction}" mode="ajax"/>
+ </h:form>
+</h:body>
+</html>
+
+
Added: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/menuItem_ajaxMode.xmlunit.xml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/menuItem_ajaxMode.xmlunit.xml (rev 0)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/menuItem_ajaxMode.xmlunit.xml 2010-12-08 12:55:29 UTC (rev 20458)
@@ -0,0 +1,12 @@
+ <div class="rf-ddm-itm rf-ddm-itm-unsel " id="form:menuItem"
+ onclick="RichFaces.ajax("form:menuItem",event,{"incId":"1"} );return false;"
+ onmouseout="this.className='rf-ddm-itm rf-ddm-itm-unsel '"
+ onmouseover="this.className='rf-ddm-itm rf-ddm-itm-sel '">
+ <span class="rf-ddm-itm-ic ">
+ <div class="rf-ddm-emptyIcon">
+ </div>
+ </span>
+ <span class="rf-ddm-itm-lbl ">
+ Test
+ </span>
+ </div>
\ No newline at end of file
Added: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/menuItem_clientMode.xhtml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/menuItem_clientMode.xhtml (rev 0)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/menuItem_clientMode.xhtml 2010-12-08 12:55:29 UTC (rev 20458)
@@ -0,0 +1,45 @@
+<?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 MenuItem Test</title>
+ </h:head>
+
+<h:body>
+ <h:form id="form">
+ <pn:menuItem id="menuItem" label="Test" action="#{ddmBean.doAction}" mode="client"/>
+ </h:form>
+</h:body>
+</html>
+
+
Added: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/menuItem_clientMode.xmlunit.xml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/menuItem_clientMode.xmlunit.xml (rev 0)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/menuItem_clientMode.xmlunit.xml 2010-12-08 12:55:29 UTC (rev 20458)
@@ -0,0 +1,11 @@
+ <div class="rf-ddm-itm rf-ddm-itm-unsel " id="form:menuItem"
+ onmouseout="this.className='rf-ddm-itm rf-ddm-itm-unsel '"
+ onmouseover="this.className='rf-ddm-itm rf-ddm-itm-sel '">
+ <span class="rf-ddm-itm-ic ">
+ <div class="rf-ddm-emptyIcon">
+ </div>
+ </span>
+ <span class="rf-ddm-itm-lbl ">
+ Test
+ </span>
+ </div>
\ No newline at end of file
Added: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/menuItem_serverMode.xhtml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/menuItem_serverMode.xhtml (rev 0)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/menuItem_serverMode.xhtml 2010-12-08 12:55:29 UTC (rev 20458)
@@ -0,0 +1,45 @@
+<?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 MenuItem Test</title>
+ </h:head>
+
+<h:body>
+ <h:form id="form">
+ <pn:menuItem id="menuItem" label="Test" action="#{ddmBean.doAction}" mode="server"/>
+ </h:form>
+</h:body>
+</html>
+
+
Added: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/menuItem_serverMode.xmlunit.xml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/menuItem_serverMode.xmlunit.xml (rev 0)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/menuItem_serverMode.xmlunit.xml 2010-12-08 12:55:29 UTC (rev 20458)
@@ -0,0 +1,12 @@
+ <div class="rf-ddm-itm rf-ddm-itm-unsel " id="form:menuItem"
+ onclick="RichFaces.submitForm("form",{"form:menuItem":"form:menuItem"} )"
+ onmouseout="this.className='rf-ddm-itm rf-ddm-itm-unsel '"
+ onmouseover="this.className='rf-ddm-itm rf-ddm-itm-sel '">
+ <span class="rf-ddm-itm-ic ">
+ <div class="rf-ddm-emptyIcon">
+ </div>
+ </span>
+ <span class="rf-ddm-itm-lbl ">
+ Test
+ </span>
+ </div>
\ No newline at end of file
14 years, 1 month
JBoss Rich Faces SVN: r20457 - in trunk/ui/output/ui/src/main: resources/META-INF/resources/org.richfaces and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-12-08 07:31:27 -0500 (Wed, 08 Dec 2010)
New Revision: 20457
Added:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/accordion.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/accordionItem.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanelItem.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenu.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuGroup.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuItem.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tab.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tabPanel.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/togglePanel.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/togglePanelItem.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tooltip.js
Removed:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem_.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Accordion_.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem_.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel_.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenuGroup_.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenuItem_.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenu_.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TabPanel_.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tab_.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem_.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel_.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tooltip_.js
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelItemRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java
Log:
RF-9608 - Rename JavaScript resources to lower case
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java 2010-12-08 12:27:08 UTC (rev 20456)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java 2010-12-08 12:31:27 UTC (rev 20457)
@@ -62,8 +62,8 @@
@ResourceDependency(name = "richfaces.js"),
@ResourceDependency(name = "richfaces-event.js"),
@ResourceDependency(name = "richfaces-base-component.js"),
- @ResourceDependency(library = "org.richfaces", name = "TogglePanelItem_.js"),
- @ResourceDependency(library = "org.richfaces", name = "AccordionItem_.js")
+ @ResourceDependency(library = "org.richfaces", name = "togglePanelItem.js"),
+ @ResourceDependency(library = "org.richfaces", name = "accordionItem.js")
})
public class AccordionItemRenderer extends TogglePanelItemRenderer {
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java 2010-12-08 12:27:08 UTC (rev 20456)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java 2010-12-08 12:31:27 UTC (rev 20457)
@@ -46,8 +46,8 @@
@ResourceDependency(name = "richfaces.js"),
@ResourceDependency(name = "richfaces-base-component.js"),
@ResourceDependency(library = "org.richfaces", name = "accordion.ecss"),
- @ResourceDependency(library = "org.richfaces", name = "TogglePanel_.js"),
- @ResourceDependency(library = "org.richfaces", name = "Accordion_.js") })
+ @ResourceDependency(library = "org.richfaces", name = "togglePanel.js"),
+ @ResourceDependency(library = "org.richfaces", name = "accordion.js") })
public class AccordionRenderer extends TogglePanelRenderer {
@Override
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java 2010-12-08 12:27:08 UTC (rev 20456)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java 2010-12-08 12:31:27 UTC (rev 20457)
@@ -49,10 +49,10 @@
@ResourceDependency(name = "richfaces.js"),
@ResourceDependency(name = "richfaces-event.js"),
@ResourceDependency(name = "richfaces-base-component.js"),
- @ResourceDependency(library = "org.richfaces", name = "TogglePanel_.js"),
- @ResourceDependency(library = "org.richfaces", name = "TogglePanelItem_.js"),
- @ResourceDependency(library = "org.richfaces", name = "CollapsiblePanel_.js"),
- @ResourceDependency(library = "org.richfaces", name = "CollapsiblePanelItem_.js"),
+ @ResourceDependency(library = "org.richfaces", name = "togglePanel.js"),
+ @ResourceDependency(library = "org.richfaces", name = "togglePanelItem.js"),
+ @ResourceDependency(library = "org.richfaces", name = "collapsiblePanel.js"),
+ @ResourceDependency(library = "org.richfaces", name = "collapsiblePanelItem.js"),
@ResourceDependency(library = "org.richfaces", name = "collapsiblePanel.ecss") })
public class CollapsiblePanelRenderer extends TogglePanelRenderer {
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java 2010-12-08 12:27:08 UTC (rev 20456)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java 2010-12-08 12:31:27 UTC (rev 20457)
@@ -53,9 +53,9 @@
@ResourceDependency(name = "richfaces.js"),
@ResourceDependency(name = "richfaces-event.js"),
@ResourceDependency(name = "richfaces-base-component.js"),
- @ResourceDependency(library = "org.richfaces", name = "PanelMenu_.js"),
- @ResourceDependency(library = "org.richfaces", name = "PanelMenuItem_.js"),
- @ResourceDependency(library = "org.richfaces", name = "PanelMenuGroup_.js"),
+ @ResourceDependency(library = "org.richfaces", name = "panelMenu.js"),
+ @ResourceDependency(library = "org.richfaces", name = "panelMenuItem.js"),
+ @ResourceDependency(library = "org.richfaces", name = "panelMenuGroup.js"),
@ResourceDependency(library = "org.richfaces", name = "panelMenu.ecss") })
public class PanelMenuRenderer extends DivPanelRenderer {
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java 2010-12-08 12:27:08 UTC (rev 20456)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java 2010-12-08 12:31:27 UTC (rev 20457)
@@ -58,8 +58,8 @@
@ResourceDependency(name = "richfaces-event.js"),
@ResourceDependency(name = "richfaces-base-component.js"),
@ResourceDependency(library = "org.richfaces", name = "tabPanel.ecss"),
- @ResourceDependency(library = "org.richfaces", name = "TogglePanel_.js"),
- @ResourceDependency(library = "org.richfaces", name = "TabPanel_.js")
+ @ResourceDependency(library = "org.richfaces", name = "togglePanel.js"),
+ @ResourceDependency(library = "org.richfaces", name = "tabPanel.js")
})
public class TabPanelRenderer extends TogglePanelRenderer {
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabRenderer.java 2010-12-08 12:27:08 UTC (rev 20456)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabRenderer.java 2010-12-08 12:31:27 UTC (rev 20457)
@@ -45,8 +45,8 @@
@ResourceDependency(name = "richfaces.js"),
@ResourceDependency(name = "richfaces-event.js"),
@ResourceDependency(name = "richfaces-base-component.js"),
- @ResourceDependency(library = "org.richfaces", name = "TogglePanelItem_.js"),
- @ResourceDependency(library = "org.richfaces", name = "Tab_.js")
+ @ResourceDependency(library = "org.richfaces", name = "togglePanelItem.js"),
+ @ResourceDependency(library = "org.richfaces", name = "tab.js")
})
public class TabRenderer extends TogglePanelItemRenderer {
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelItemRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelItemRenderer.java 2010-12-08 12:27:08 UTC (rev 20456)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelItemRenderer.java 2010-12-08 12:31:27 UTC (rev 20457)
@@ -46,7 +46,7 @@
@ResourceDependency(name = "richfaces.js"),
@ResourceDependency(name = "richfaces-event.js"),
@ResourceDependency(name = "richfaces-base-component.js"),
- @ResourceDependency(library = "org.richfaces", name = "TogglePanelItem_.js") })
+ @ResourceDependency(library = "org.richfaces", name = "togglePanelItem.js") })
public class TogglePanelItemRenderer extends DivPanelRenderer {
private static final String LEAVE = "leave";
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2010-12-08 12:27:08 UTC (rev 20456)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2010-12-08 12:31:27 UTC (rev 20457)
@@ -57,7 +57,7 @@
@ResourceDependency(name = "richfaces.js"),
@ResourceDependency(name = "richfaces-event.js"),
@ResourceDependency(name = "richfaces-base-component.js"),
- @ResourceDependency(library = "org.richfaces", name = "TogglePanel_.js") })
+ @ResourceDependency(library = "org.richfaces", name = "togglePanel.js") })
public class TogglePanelRenderer extends DivPanelRenderer {
public static final String VALUE_POSTFIX = "-value";
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java 2010-12-08 12:27:08 UTC (rev 20456)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java 2010-12-08 12:31:27 UTC (rev 20457)
@@ -58,7 +58,7 @@
@ResourceDependency(name = "richfaces-event.js"),
@ResourceDependency(name = "richfaces-base-component.js"),
@ResourceDependency(library = "org.richfaces", name = "popup.js"),
- @ResourceDependency(library = "org.richfaces", name = "Tooltip_.js"),
+ @ResourceDependency(library = "org.richfaces", name = "tooltip.js"),
@ResourceDependency(library = "org.richfaces", name = "tooltip.ecss") })
public class TooltipRenderer extends DivPanelRenderer implements MetaComponentRenderer {
Deleted: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem_.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem_.js 2010-12-08 12:27:08 UTC (rev 20456)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem_.js 2010-12-08 12:31:27 UTC (rev 20457)
@@ -1,158 +0,0 @@
-/*
- * 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.
- */
-
-(function ($, rf) {
-
- rf.ui = rf.ui || {};
-
- rf.ui.AccordionItem = rf.ui.TogglePanelItem.extendClass({
- // class name
- name:"AccordionItem",
-
- /**
- * @class AccordionItem
- * @name AccordionItem
- *
- * @constructor
- * @param {String} componentId - component id
- * @param {Hash} options - params
- * */
- init : function (componentId, options) {
- $super.constructor.call(this, componentId, options);
- this.index = options["index"];
- this.getTogglePanel().getItems()[this.index] = this;
-
- if (!this.disabled) {
- rf.Event.bindById(this.id + ":header", "click", this.__onHeaderClick, this);
- }
-
- if (this.isSelected()) {
- var item = this;
- $(document).ready(function () {
- item.__fitToHeight(item.getTogglePanel());
- });
- }
- },
-
- /***************************** Public Methods ****************************************************************/
-
- __onHeaderClick : function (comp) {
- this.getTogglePanel().switchToItem(this.getName());
- },
-
- /**
- * @param state {string} = inactive | active | disabled
- * in that case looking header by css class appropriate to this state
- *
- * @return {jQuery Object}
- * */
- __header : function (state) {
- var res = $(rf.getDomElement(this.id + ":header"));
- if (state) {
- return res.find(".rf-ac-itm-hdr-" + state);
- }
-
- return res;
- },
-
- /**
- * @return {jQuery Object}
- * */
- __content : function () {
- if (!this.__content_) {
- this.__content_ = $(rf.getDomElement(this.id + ":content"));
- }
- return this.__content_;
- },
-
- /**
- * @private
- *
- * used in TogglePanel
- * */
- __enter : function () {
- var parentPanel = this.getTogglePanel();
- if (parentPanel.isKeepHeight) {
- this.__content().hide(); // TODO ?
- this.__fitToHeight(parentPanel);
- }
-
- this.__content().show();
- this.__header("inact").hide();
- this.__header("act").show();
-
- return this.__fireEnter();
- },
-
- __fitToHeight : function (parentPanel) {
- var h = parentPanel.getInnerHeight();
-
- var items = parentPanel.getItems();
- for (var i in items) {
- h -= items[i].__header().outerHeight();
- }
-
- this.__content().height(h - 20); // 20 it is padding top and bottom
- },
-
- getHeight : function (recalculate) {
- if (recalculate || !this.__height) {
- this.__height = $(rf.getDomElement(this.id)).outerHeight(true)
- }
-
- return this.__height;
- },
-
- /**
- * @private
- *
- * used in TogglePanel
- * */
- __leave : function () {
- var continueProcess = this.__fireLeave();
- if (!continueProcess) {
- return false;
- }
-
- this.__content().hide();
- this.__header("act").hide();
- this.__header("inact").show();
-
- return true;
- },
-
- /***************************** Private Methods ********************************************************/
-
-
- destroy: function () {
- var parent = this.getTogglePanel();
- delete parent.getItems()[this.index];
-
- rf.Event.unbindById(this.id, "."+this.namespace);
-
- $super.destroy.call(this);
- }
- });
-
- // define super class link
- var $super = rf.ui.AccordionItem.$super;
-})(jQuery, RichFaces);
Deleted: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Accordion_.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Accordion_.js 2010-12-08 12:27:08 UTC (rev 20456)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Accordion_.js 2010-12-08 12:31:27 UTC (rev 20457)
@@ -1,75 +0,0 @@
-/*
- * 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.
- */
-
-(function ($, rf) {
-
- rf.ui = rf.ui || {};
-
- rf.ui.Accordion = rf.ui.TogglePanel.extendClass({
- // class name
- name:"Accordion",
-
- /**
- * @class Accordion
- * @name Accordion
- *
- * @constructor
- * @param {String} componentId - component id
- * @param {Hash} options - params
- * */
- init : function (componentId, options) {
- $super.constructor.call(this, componentId, options);
- this.items = [];
-
- this.isKeepHeight = options["isKeepHeight"] || false
- },
-
- /***************************** Public Methods ****************************************************************/
-
- getHeight : function (recalculate) {
- if (recalculate || !this.__height) {
- this.__height = $(rf.getDomElement(this.id)).outerHeight(true)
- }
-
- return this.__height;
- },
-
- getInnerHeight : function (recalculate) {
- if (recalculate || !this.__innerHeight) {
- this.__innerHeight = $(rf.getDomElement(this.id)).innerHeight(true)
- }
-
- return this.__innerHeight;
- },
-
- /***************************** Private Methods ********************************************************/
-
-
- destroy: function () {
- rf.Event.unbindById(this.id, "." + this.namespace);
- $super.destroy.call(this);
- }
- });
-
- // define super class link
- var $super = rf.ui.Accordion.$super;
-})(jQuery, RichFaces);
Deleted: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem_.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem_.js 2010-12-08 12:27:08 UTC (rev 20456)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem_.js 2010-12-08 12:31:27 UTC (rev 20457)
@@ -1,60 +0,0 @@
-/*
- * 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.
- */
-
-(function ($, rf) {
-
- rf.ui = rf.ui || {};
-
- rf.ui.CollapsiblePanelItem = rf.ui.TogglePanelItem.extendClass({
-
- init : function (componentId, options) {
- rf.ui.TogglePanelItem.call(this, componentId, options);
- },
-
- __enter : function () {
- rf.getDomElement(this.id).style.display = "block";
- this.__header(this.__state()).show();
-
- return true;
- },
-
- __leave : function () {
- rf.getDomElement(this.id).style.display = "none";
- this.__header(this.__state()).hide();
-
- return true;
- },
-
- __state : function () {
- return this.getName() === "true" ? "exp" : "colps";
- },
-
- __header : function (state) {
- var res = $(rf.getDomElement(this.togglePanelId + ":header"));
- if (state) {
- return res.find(".rf-cp-hdr-" + state);
- }
-
- return res;
- }
- });
-})(jQuery, RichFaces);
Deleted: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel_.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel_.js 2010-12-08 12:27:08 UTC (rev 20456)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel_.js 2010-12-08 12:31:27 UTC (rev 20457)
@@ -1,82 +0,0 @@
-/*
- * 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.
- */
-
-(function ($, rf) {
-
- rf.ui = rf.ui || {};
-
- rf.ui.CollapsiblePanel = rf.ui.TogglePanel.extendClass({
-
- name:"CollapsiblePanel",
-
- /**
- * @class CollapsiblePanel
- * @name CollapsiblePanel
- *
- * @constructor
- * @param {String} componentId - component id
- * @param {Hash} options - params
- * */
- init : function (componentId, options) {
- rf.ui.TogglePanel.call(this, componentId, options);
- this.switchMode = options.switchMode;
-
- this.__addUserEventHandler("beforeswitch");
- this.__addUserEventHandler("switch");
-
- this.items = [
- new RichFaces.ui.CollapsiblePanelItem(
- this.id + ":content", {"index":0, "togglePanelId":this.id, "switchMode":this.switchMode, "name":"true"}),
-
- new RichFaces.ui.CollapsiblePanelItem(
- this.id + ":empty", {"index":1, "togglePanelId":this.id, "switchMode":this.switchMode, "name":"false"})
- ];
- this.options.cycledSwitching = true;
-
- rf.Event.bindById(this.id + ":header", "click", this.__onHeaderClick, this)
- },
-
- switchPanel : function (to) {
- this.switchToItem(to || "@next");
- },
-
- /***************************** Private Methods ********************************************************/
-
- __onHeaderClick : function () {
- this.switchToItem("@next");
- },
-
- __fireItemChange : function (oldItem, newItem) {
- return new rf.Event.fireById(this.id, "switch", {
- id: this.id,
- isExpanded : newItem.getName()
- });
- },
-
- __fireBeforeItemChange : function (oldItem, newItem) {
- return rf.Event.fireById(this.id, "beforeswitch", {
- id: this.id,
- isExpanded : newItem.getName()
- });
- }
- });
-})(jQuery, RichFaces);
Deleted: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenuGroup_.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenuGroup_.js 2010-12-08 12:27:08 UTC (rev 20456)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenuGroup_.js 2010-12-08 12:31:27 UTC (rev 20457)
@@ -1,365 +0,0 @@
-/*
- * 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.
- */
-
-
-(function ($, rf) {
-
- rf.ui = rf.ui || {};
-
- var __DEFAULT_OPTIONS = {
- expanded : false,
- expandSingle : true,
- bubbleSelection : true,
- stylePrefix : "rf-pm-gr",
-
- // TODO we should use selectionType = {none, selectable, unselectable}
- selectable : false,
- unselectable : false // unselectable can be only selectable item => if selectable == false than unselectable = false
- };
-
- var EXPAND_ITEM = {
-
- /**
- *
- * @return {void}
- * */
- exec : function (group, expand) {
- var mode = group.mode;
- if (mode == "server") {
- return this.execServer(group);
- } else if (mode == "ajax") {
- return this.execAjax(group);
- } else if (mode == "client" || mode == "none") {
- return this.execClient(group, expand);
- } else {
- rf.log.error("EXPAND_ITEM.exec : unknown mode (" + mode + ")");
- }
- },
-
- /**
- * @protected
- *
- * @return {Boolean} false
- * */
- execServer : function (group) {
- group.__changeState();
- rf.submitForm(this.__getParentForm(group));
-
- return false;
- },
-
- /**
- * @protected
- *
- * @return {Boolean} false
- * */
- execAjax : function (group) {
- var oldState = group.__changeState();
- rf.ajax(group.id, null, $.extend({}, group.options["ajax"], {}));
- group.__restoreState(oldState);
-
- return true;
- },
-
- /**
- * @protected
- *
- * @param {PanelMenuGroup} group
- * @param {Boolean} expand
- * @return {undefined}
- * - false - if process has been terminated
- * - true - in other cases
- * */
- execClient : function (group, expand) {
- if (expand) {
- group.expand();
- } else {
- group.collapse();
- }
-
- return group.__fireSwitch();
- },
-
- /**
- * @private
- * */
- __getParentForm : function (item) {
- return $($(rf.getDomElement(item.id)).parents("form")[0]);
- }
- };
-
- rf.ui.PanelMenuGroup = rf.ui.PanelMenuItem.extendClass({
- // class name
- name:"PanelMenuGroup",
-
- /**
- * @class PanelMenuGroup
- * @name PanelMenuGroup
- *
- * @constructor
- * @param {String} componentId - component id
- * @param {Hash} options - params
- * */
- init : function (componentId, options) {
- $super.constructor.call(this, componentId);
- this.options = $.extend(this.options, __DEFAULT_OPTIONS, options || {});
-
- if (!this.options.disabled) {
- var menuGroup = this;
-
- if (!this.options.selectable) {
- this.__header().bind("click", function () {
- return menuGroup.switchExpantion();
- });
- }
-
- if (this.options.selectable || this.options.bubbleSelection) {
- this.__content().bind("select", function (event) {
- if (menuGroup.options.selectable && menuGroup.__isMyEvent(event)) {
- menuGroup.expand();
- }
-
- if (menuGroup.options.bubbleSelection && !menuGroup.__isMyEvent(event)) {
- menuGroup.__select();
- if (!menuGroup.expanded()) {
- menuGroup.expand();
- }
- }
- });
-
- this.__content().bind("unselect", function (event) {
- if (menuGroup.options.selectable && menuGroup.__isMyEvent(event)) {
- menuGroup.collapse();
- }
-
- if (menuGroup.options.bubbleSelection && !menuGroup.__isMyEvent(event)) {
- menuGroup.__unselect();
- }
- });
- }
-
- if (menuGroup.options.expandSingle) {
- menuGroup.__group().bind("expand", function (event) {
- if (menuGroup.__isMyEvent(event)) {
- return;
- }
-
- menuGroup.__childGroups().each (function (index, group) {
- var rfGroup = rf.$(group);
- if (!rfGroup.__isMyEvent(event)) {
- rfGroup.collapse();
- }
- });
-
- event.stopPropagation();
- });
- }
-
- this.__addUserEventHandler("collapse");
- this.__addUserEventHandler("expand");
- }
- },
-
- /***************************** Public Methods ****************************************************************/
- expanded : function () {
- // TODO check invariant in dev mode
- // return this.__content().hasClass("rf-pm-exp")
- return this.__getExpandValue();
- },
-
- expand : function () {
- this.__expand();
-
- return this.__fireExpand();
- },
-
- __expand : function () {
- this.__content().removeClass("rf-pm-colps").addClass("rf-pm-exp");
- var header = this.__header();
- header.find(".rf-pm-ico-colps").hide();
- header.find(".rf-pm-ico-exp").show();
-
- this.__setExpandValue(true);
- },
-
- collapsed : function () {
- // TODO check invariant in dev mode
- // return this.__content().hasClass("rf-pm-colps")
- return !this.__getExpandValue();
- },
-
- collapse : function () {
- this.__collapse();
-
- this.__childGroups().each (function(index, group) {
- rf.$(group.id).__collapse();
- });
-
- this.__fireCollapse();
- },
-
- __collapse : function () {
- this.__content().addClass("rf-pm-colps").removeClass("rf-pm-exp");
- var header = this.__header();
- header.find(".rf-pm-ico-exp").hide();
- header.find(".rf-pm-ico-colps").show();
-
- this.__setExpandValue(false);
- },
-
- /**
- * @methodOf
- * @name PanelMenuGroup#switch
- *
- * TODO ...
- *
- * @param {boolean} expand
- * @return {void} TODO ...
- */
- switchExpantion : function () { // TODO rename
- var continueProcess = this.__fireBeforeSwitch();
- if (!continueProcess) {
- return false;
- }
-
- EXPAND_ITEM.exec(this, !this.expanded());
- },
-
- /**
- * please, remove this method when client side ajax events will be added
- *
- * */
- onCompleteHandler : function () {
- EXPAND_ITEM.execClient(this, this.expanded());
- },
-
- __switch : function (expand) {
- if (expand) {
- this.expand();
- } else {
- this.collapse();
- }
- },
-
- /***************************** Private Methods ****************************************************************/
- __childGroups : function () {
- return this.__content().children(".rf-pm-gr")
- },
-
- __group : function () {
- return $(rf.getDomElement(this.id))
- },
-
- __header : function () {
- return $(rf.getDomElement(this.id + ":hdr"))
- },
-
- __content : function () {
- return $(rf.getDomElement(this.id + ":cnt"))
- },
-
- __expandValueInput : function () {
- return document.getElementById(this.id + ":expanded");
- },
-
- __getExpandValue : function () {
- return this.__expandValueInput().value == "true";
- },
-
- /**
- * @methodOf
- * @name PanelMenuGroup#__setExpandValue
- *
- * @param {boolean} value - is group expanded?
- * @return {boolean} preview value
- */
- __setExpandValue : function (value) {
- var input = this.__expandValueInput();
- var oldValue = input.value;
-
- input.value = value;
-
- return oldValue;
- },
-
- __changeState : function () {
- var state = {};
- 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
- }
-
- return state;
- },
-
- __restoreState : function (state) {
- if (!state) {
- return;
- }
-
- if (state["expanded"]) {
- this.__setExpandValue(state["expanded"]);
- }
-
- if (state["itemName"]) {
- this.__rfPanelMenu().selectedItem(state["itemName"]);
- }
- },
-
- __fireSwitch : function () {
- return new rf.Event.fireById(this.id, "switch", {
- id: this.id
- });
- },
-
- __isMyEvent: function (event) {
- return this.id == event.target.id;
- },
-
- __fireBeforeSwitch : function () {
- return rf.Event.fireById(this.id, "beforeswitch", {
- id: this.id
- });
- },
-
- __fireCollapse : function () {
- return new rf.Event.fireById(this.id, "collapse", {
- id: this.id
- });
- },
-
- __fireExpand : function () {
- return new rf.Event.fireById(this.id, "expand", {
- id: this.id
- });
- },
-
- destroy: function () {
- rf.Event.unbindById(this.id, "."+this.namespace);
-
- $super.destroy.call(this);
- }
- });
-
- // define super class link
- var $super = rf.ui.PanelMenuGroup.$super;
-})(jQuery, RichFaces);
Deleted: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenuItem_.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenuItem_.js 2010-12-08 12:27:08 UTC (rev 20456)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenuItem_.js 2010-12-08 12:31:27 UTC (rev 20457)
@@ -1,321 +0,0 @@
-/*
- * 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.
- */
-
-
-(function ($, rf) {
-
- rf.ui = rf.ui || {};
-
- var __DEFAULT_OPTIONS = {
- disabled : false,
- selectable: true,
- mode: "client",
- unselectable: false,
- highlight: true,
- stylePrefix: "rf-pm-itm",
- itemStep: 20
- };
-
- var SELECT_ITEM = {
-
- /**
- *
- * @return {void}
- * */
- exec : function (item) {
- var mode = item.mode;
- if (mode == "server") {
- return this.execServer(item);
- } else if (mode == "ajax") {
- return this.execAjax(item);
- } else if (mode == "client" || mode == "none") {
- return this.execClient(item);
- } else {
- rf.log.error("SELECT_ITEM.exec : unknown mode (" + mode + ")");
- }
- },
-
- /**
- * @protected
- *
- * @return {Boolean} false
- * */
- execServer : function (item) {
- item.__changeState();
- rf.submitForm(this.__getParentForm(item));
-
- return false;
- },
-
- /**
- * @protected
- *
- * @return {Boolean} false
- * */
- execAjax : function (item) {
- var oldItem = item.__changeState();
- rf.ajax(item.__panelMenu().id, null, $.extend({}, item.options["ajax"], {}));
- item.__restoreState(oldItem);
-
- return true;
- },
-
- /**
- * @protected
- *
- * @return {undefined}
- * - false - if process has been terminated
- * - true - in other cases
- * */
- execClient : function (item) {
- var panelMenu = item.__rfPanelMenu();
- if (panelMenu.selectedItem()) {
- panelMenu.getItems()[panelMenu.selectedItem()].unselect();
- }
- panelMenu.selectedItem(item.itemName);
-
- item.__select();
-
- return item.__fireSelect();
- },
-
- /**
- * @private
- * */
- __getParentForm : function (item) {
- return $($(rf.getDomElement(item.id)).parents("form")[0]);
- }
- };
-
- rf.ui.PanelMenuItem = rf.BaseComponent.extendClass({
- // class name
- name:"PanelMenuItem",
-
- /**
- * @class PanelMenuItem
- * @name PanelMenuItem
- *
- * @constructor
- * @param {String} componentId - component id
- * @param {Hash} options - params
- * */
- init : function (componentId, options) {
- $super.constructor.call(this, componentId);
- this.attachToDom();
-
- this.options = $.extend(this.options, __DEFAULT_OPTIONS, options || {});
-
- this.mode = this.options.mode
- this.itemName = this.options.name
- this.__rfPanelMenu().getItems()[this.itemName] = this;
-
- // todo move it
- this.selectionClass = this.options.stylePrefix + "-sel";
- this.hoverClass = this.options.stylePrefix + "-hov";
-
- if (!this.options.disabled) {
- var item = this;
- if (this.options.highlight) {
- this.__item().bind("mouseenter", function() {
- item.highlight(true);
- });
- this.__item().bind("mouseleave", function() {
- item.highlight(false);
- });
- }
-
- if (this.options.selectable) {
- this.__header().bind("click", function() {
- if (item.__rfPanelMenu().selectedItem() == item.id) {
- if (item.options.unselectable) {
- return item.unselect();
- }
-
- // we shouldn't select one item several times
- } else {
- return item.select();
- }
- });
- }
- }
-
- item = this;
- $(this.__panelMenu()).ready(function () {
- item.__renderNestingLevel();
- });
-
- this.__addUserEventHandler("select");
- },
-
- /***************************** Public Methods ****************************************************************/
- highlight : function (highlight) {
- if (highlight && !this.selected()) {
- this.__header().addClass(this.hoverClass);
- } else {
- this.__header().removeClass(this.hoverClass);
- }
- },
-
- selected : function () {
- return this.__header().hasClass(this.selectionClass);
- },
-
- /**
- * @methodOf
- * @name PanelMenuItem#select
- *
- * TODO ...
- *
- * @return {void} TODO ...
- */
- select: function () {
- var continueProcess = this.__fireBeforeSelect();
- if (!continueProcess) {
- return false;
- }
-
- return SELECT_ITEM.exec(this)
- },
-
- /**
- * please, remove this method when client side ajax events will be added
- *
- * */
- onCompleteHandler : function () {
- SELECT_ITEM.execClient(this);
- },
-
- unselect: function () {
- var panelMenu = this.__rfPanelMenu();
- if (panelMenu.selectedItem() == this.itemName) {
- panelMenu.selectedItem(null);
- } else {
- rf.warn("You try unselect item (name=" + this.itemName + ") that isn't seleted")
- }
-
- this.__unselect();
-
- return this.__fireUnselect();
- },
-
- /***************************** 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];
- },
-
- __rfPanelMenu : function () {
- return rf.$(this.__item().parents(".rf-pm")[0]);
- },
-
- __changeState : function () {
- return this.__rfPanelMenu().selectedItem(this.itemName);
- },
-
- __restoreState : function (state) {
- if (state) {
- this.__rfPanelMenu().selectedItem(state);
- }
- },
-
- __item : function () {
- return $(rf.getDomElement(this.id));
- },
-
- __header : function () {
- return this.__item();
- },
-
- __select: function () {
- this.__header().addClass(this.selectionClass);
- },
-
- __unselect: function () {
- this.__header().removeClass(this.selectionClass);
- },
-
- __fireBeforeSelect : function () {
- return new rf.Event.fireById(this.id, "beforeselect", {
- id: this.id
- });
- },
-
- __fireSelect : function () {
- return new rf.Event.fireById(this.id, "select", {
- id: this.id
- });
- },
-
- __fireUnselect : function () {
- return new rf.Event.fireById(this.id, "unselect", {
- id: this.id
- });
- },
-
- /**
- * @private
- * */
- __addUserEventHandler : function (name) {
- var handler = this.options["on" + name];
- if (handler) {
- rf.Event.bindById(this.id, name, handler);
- }
- },
-
- destroy: function () {
- delete this.__rfPanelMenu().getItems()[this.itemName];
- $super.destroy.call(this);
- }
- });
-
- // define super class link
- var $super = rf.ui.PanelMenuItem.$super;
-})(jQuery, RichFaces);
Deleted: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenu_.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenu_.js 2010-12-08 12:27:08 UTC (rev 20456)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenu_.js 2010-12-08 12:31:27 UTC (rev 20457)
@@ -1,211 +0,0 @@
-/*
- * 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.
- */
-
-
-(function ($, rf) {
-
- rf.ui = rf.ui || {};
-
- var __DEFAULT_OPTIONS = {
- expandSingle : true
- };
-
- rf.ui.PanelMenu = rf.BaseComponent.extendClass({
- // class name
- name:"PanelMenu",
-
- /**
- * @class PanelMenu
- * @name PanelMenu
- *
- * @constructor
- * @param {String} componentId - component id
- * @param {Hash} options - params
- * */
- init : function (componentId, options) {
- $super.constructor.call(this, componentId);
- this.items = [];
- this.attachToDom();
-
- this.options = $.extend(this.options, __DEFAULT_OPTIONS, options || {});
- this.activeItem = this.__getValueInput().value;
- this.nestingLevel = 0;
-
- var menuGroup = this;
- if (menuGroup.options.expandSingle) {
- menuGroup.__panelMenu().bind("expand", function (event) {
- menuGroup.__childGroups().each (function (index, group) {
- if (event.target.id != group.id) {
- rf.$(group.id).collapse();
- }
- });
-
- event.stopPropagation();
- });
- }
-
- if (menuGroup.activeItem) {
- this.__panelMenu().ready(function () {
- var item = menuGroup.items[menuGroup.activeItem];
- item.__select();
- item.__fireSelect();
- })
- }
-
- this.__addUserEventHandler("collapse");
- this.__addUserEventHandler("expand");
- },
-
- getItems: function () {
- return this.items;
- },
-
- getItem: function (name) {
- return this.items[name];
- },
-
- /***************************** Public Methods ****************************************************************/
- /**
- * @methodOf
- * @name PanelMenu#selectItem
- *
- * TODO ...
- *
- * @param {String} name
- * @return {void} TODO ...
- */
- selectItem: function (name) {
- // TODO implement
- },
-
- /**
- * @methodOf
- * @name PanelMenu#selectedItem
- *
- * TODO ...
- *
- * @return {String} TODO ...
- */
- selectedItem: function (id) {
- if (id != undefined) {
- var valueInput = this.__getValueInput();
- var prevActiveItem = valueInput.value;
-
- this.activeItem = id;
- valueInput.value = id;
-
- return prevActiveItem;
- } else {
- return this.activeItem;
- }
- },
-
- __getValueInput : function() {
- return document.getElementById(this.id + "-value");
- },
-
- selectItem: function (itemName) {
- // TODO
- },
-
- /**
- * @methodOf
- * @name PanelMenu#expandAll
- *
- * TODO ...
- *
- * @return {void} TODO ...
- */
- expandAll: function () {
- // TODO implement
- },
-
- /**
- * @methodOf
- * @name PanelMenu#collapseAll
- *
- * TODO ...
- *
- * @return {void} TODO ...
- */
- collapseAll: function () {
- // TODO implement
- },
-
- /**
- * @methodOf
- * @name PanelMenu#expandGroup
- *
- * TODO ...
- *
- * @param {String} groupName
- * @return {void} TODO ...
- */
- expandGroup: function (groupName) {
- // TODO implement
- },
-
- /**
- * @methodOf
- * @name PanelMenu#collapseGroup
- *
- * TODO ...
- *
- * @param {String} groupName
- * @return {void} TODO ...
- */
- collapseGroup: function (groupName) {
- // TODO implement
- },
-
-
- /***************************** Private Methods ****************************************************************/
-
-
- __panelMenu : function () {
- return $(rf.getDomElement(this.id));
- },
-
- __childGroups : function () {
- return this.__panelMenu().children(".rf-pm-top-gr")
- },
-
- /**
- * @private
- * */
- __addUserEventHandler : function (name) {
- var handler = this.options["on" + name];
- if (handler) {
- rf.Event.bindById(this.id, name, handler);
- }
- },
-
- destroy: function () {
- rf.Event.unbindById(this.id, "."+this.namespace);
- $super.destroy.call(this);
- }
- });
-
- // define super class link
- var $super = rf.ui.PanelMenu.$super;
-
-})(jQuery, RichFaces);
Deleted: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TabPanel_.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TabPanel_.js 2010-12-08 12:27:08 UTC (rev 20456)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TabPanel_.js 2010-12-08 12:31:27 UTC (rev 20457)
@@ -1,46 +0,0 @@
-/*
- * 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.
- */
-
-(function ($, rf) {
-
- rf.ui = rf.ui || {};
-
- rf.ui.TabPanel = rf.ui.TogglePanel.extendClass({
- // class name
- name:"TabPanel",
-
- /**
- * @class TabPanel
- * @name TabPanel
- *
- * @constructor
- * @param {String} componentId - component id
- * @param {Hash} options - params
- * */
- init : function (componentId, options) {
- rf.ui.TogglePanel.call(this, componentId, options);
- this.items = [];
-
- this.isKeepHeight = options["isKeepHeight"] || false
- }
- });
-})(jQuery, RichFaces);
Deleted: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tab_.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tab_.js 2010-12-08 12:27:08 UTC (rev 20456)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tab_.js 2010-12-08 12:31:27 UTC (rev 20457)
@@ -1,139 +0,0 @@
-/*
- * 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.
- */
-
-(function ($, rf) {
-
- rf.ui = rf.ui || {};
-
- rf.ui.Tab = rf.ui.TogglePanelItem.extendClass({
- // class name
- name:"Tab",
-
- /**
- * @class AccordionItem
- * @name AccordionItem
- *
- * @constructor
- * @param {String} componentId - component id
- * @param {Hash} options - params
- * */
- init : function (componentId, options) {
- $super.constructor.call(this, componentId, options);
- this.index = options["index"];
- this.getTogglePanel().getItems()[this.index] = this;
-
- //TODO - optimize this
- rf.Event.bindById(this.id + ":header:active", "click", this.__onHeaderClick, this);
- rf.Event.bindById(this.id + ":header:inactive", "click", this.__onHeaderClick, this)
- },
-
- /***************************** Public Methods ****************************************************************/
-
- __onHeaderClick : function (comp) {
- this.getTogglePanel().switchToItem(this.getName());
- },
-
- /**
- * @param state {string} = inactive | active | disabled
- * in that case looking header by css class appropriate to this state
- *
- * @return {jQuery Object}
- * */
- __header : function (state) {
- var res = $(rf.getDomElement(this.id + ":header"));
- if (state) {
- return $(rf.getDomElement(this.id + ":header:" + state));
- }
-
- return res;
- },
-
- /**
- * @return {jQuery Object}
- * */
- __content : function () {
- if (!this.__content_) {
- this.__content_ = $(rf.getDomElement(this.id + ":content"));
- }
- return this.__content_;
- },
-
- /**
- * @private
- *
- * used in TogglePanel
- * */
- __enter : function () {
-
- this.__content().show();
- this.__header("inactive").hide();
- this.__header("active").show();
-
- return this.__fireEnter();
- },
-
- getHeight : function (recalculate) {
- if (recalculate || !this.__height) {
- this.__height = $(rf.getDomElement(this.id)).outerHeight(true)
- }
-
- return this.__height;
- },
-
- /**
- * @private
- *
- * used in TogglePanel
- * */
- __leave : function () {
- var continueProcess = this.__fireLeave();
- if (!continueProcess) {
- return false;
- }
-
- this.__content().hide();
- this.__header("active").hide();
- this.__header("inactive").show();
-
- return true;
- },
-
- /***************************** Private Methods ********************************************************/
-
-
- destroy: function () {
- var parent = this.getTogglePanel();
- delete parent.getItems()[this.index];
-
- rf.Event.unbindById(this.id);
-
- //TODO - optimize
- rf.Event.unbindById(this.id + ":header:active");
- rf.Event.unbindById(this.id + ":header:inactive");
-
- $super.destroy.call(this);
- }
- });
-
- // define super class link
- var $super = rf.ui.Tab.$super;
-})(jQuery, RichFaces);
Deleted: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem_.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem_.js 2010-12-08 12:27:08 UTC (rev 20456)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem_.js 2010-12-08 12:31:27 UTC (rev 20457)
@@ -1,120 +0,0 @@
-/*
- * 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.
- */
-
-(function ($, rf) {
-
- rf.ui = rf.ui || {};
-
- rf.ui.TogglePanelItem = rf.BaseComponent.extendClass({
-
- // class name
- name:"TogglePanelItem",
-
- init : function (componentId, options) {
- // call constructor of parent class
- $super.constructor.call(this, componentId);
- this.attachToDom();
-
- this.options = $.extend(this.options, options || {});
- this.name = this.options.name;
- this.togglePanelId = this.options.togglePanelId;
- this.switchMode = this.options.switchMode;
- this.disabled = this.options.disabled || false;
- },
-
- /***************************** Public Methods *****************************************************************/
- /**
- * @methodOf TogglePanelItem
- * @name TogglePanelItem#getName
- *
- * @return {String} panel item name
- */
- getName: function () {
- return this.options.name;
- },
-
- /**
- * @methodOf
- * @name TogglePanelItem#getTogglePanel
- *
- * @return {TogglePanel} parent TogglePanel
- * */
- getTogglePanel : function () {
- return rf.$(this.togglePanelId);
- },
-
- /**
- * @methodOf
- * @name TogglePanelItem#isSelected
- *
- * @return {Boolean} true if this panel item is selected in the parent toggle panel
- * */
- isSelected : function () {
- return this.getName() == this.getTogglePanel().getSelectItem();
- },
-
-
- /***************************** Private Methods ****************************************************************/
-
- /**
- * @private
- *
- * used in TogglePanel
- * */
- __enter : function () {
- rf.getDomElement(this.id).style.display = "block";
-
- return this.__fireEnter();
- },
-
- /**
- * @private
- *
- * used in TogglePanel
- * */
- __leave : function () {
- var continueProcess = this.__fireLeave();
- if (!continueProcess) {
- return false;
- }
-
- rf.getDomElement(this.id).style.display = "none";
- return true;
- },
-
- __fireLeave : function () {
- return rf.Event.fireById(this.id, "__leave");
- },
-
- __fireEnter : function () {
- return rf.Event.fireById(this.id, "__enter");
- },
-
- // class stuff
- destroy: function () {
- $super.destroy.call(this);
- }
- });
-
- // define super class link
- var $super = rf.ui.TogglePanelItem.$super;
-})(jQuery, RichFaces);
Deleted: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel_.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel_.js 2010-12-08 12:27:08 UTC (rev 20456)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel_.js 2010-12-08 12:31:27 UTC (rev 20457)
@@ -1,433 +0,0 @@
-/*
- * 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.
- */
-
-(function ($, rf) {
-
- rf.ui = rf.ui || {};
-
- /* SIMPLE INNER CLASS for handle switch operation*/
- function SwitchItems(comp) {
- this.comp = comp;
- }
-
- SwitchItems.prototype = {
-
- /**
- * @param {TogglePanelItem} oldPanel
- * @param {TogglePanelItem} newPanel
- *
- * @return {void}
- * */
- exec : function (oldPanel, newPanel) {
- if (newPanel.switchMode == "server") {
- return this.execServer(oldPanel, newPanel);
- } else if (newPanel.switchMode == "ajax") {
- return this.execAjax(oldPanel, newPanel);
- } else if (newPanel.switchMode == "client") {
- return this.execClient(oldPanel, newPanel);
- } else {
- rf.log.error("SwitchItems.exec : unknown switchMode (" + this.comp.switchMode + ")");
- }
- },
-
- /**
- * @protected
- * @param {TogglePanelItem} oldPanel
- * @param {TogglePanelItem} newPanel
- *
- * @return {Boolean} false
- * */
- execServer : function (oldPanel, newPanel) {
- if (oldPanel) {
- var continueProcess = oldPanel.__leave();
- if (!continueProcess) {
- return false;
- }
- }
-
- this.__setActiveItem(newPanel.getName());
-
- rf.submitForm(this.__getParentForm());
-
- return false;
- },
-
- /**
- * @protected
- * @param {TogglePanelItem} oldPanel
- * @param {TogglePanelItem} newPanel
- *
- * @return {Boolean} false
- * */
- execAjax : function (oldPanel, newPanel) {
- var options = $.extend({}, this.comp.options["ajax"], {}/*this.getParameters(newPanel)*/);
-
- this.__setActiveItem(newPanel.getName());
- rf.ajax(this.comp.id, null, options);
-
- if (oldPanel) {
- this.__setActiveItem(oldPanel.getName());
- }
-
- return false;
- },
-
- /**
- * @protected
- * @param {TogglePanelItem} oldPanel
- * @param {TogglePanelItem} newPanel
- *
- * @return {undefined}
- * - false - if process has been terminated
- * - true - in other cases
- * */
- execClient : function (oldPanel, newPanel) {
- if (oldPanel) {
- var continueProcess = oldPanel.__leave();
- if (!continueProcess) {
- return false;
- }
- }
-
- this.__setActiveItem(newPanel.getName());
-
- newPanel.__enter();
- this.comp.__fireItemChange(oldPanel, newPanel);
-
- return true;
- },
-
- /**
- * @private
- * */
- __getParentForm : function () {
- return $(rf.getDomElement(this.comp.id)).parents('form:first');
- },
-
- /**
- * @private
- * */
- __setActiveItem : function (name) {
- rf.getDomElement(this.__getValueInputId()).value = name;
- this.comp.activeItem = name;
- },
-
- /**
- * @private
- * */
- __getValueInputId: function () {
- return this.comp.id + "-value"
- }
- };
-
- /**
- * @class TogglePanel
- * @name TogglePanel
- *
- * @constructor
- * @param {String} componentId - component id
- * @param {Hash} options - params
- * */
- rf.ui.TogglePanel = rf.BaseComponent.extendClass({
-
- // class name
- name:"TogglePanel",
-
- init : function (componentId, options) {
- $super.constructor.call(this, componentId);
- this.attachToDom();
-
- this.options = $.extend(this.options, options || {});
- this.activeItem = this.options.activeItem;
- this.items = this.options.items;
-
- this.__addUserEventHandler("itemchange");
- this.__addUserEventHandler("beforeitemchange");
- },
-
- /***************************** Public Methods ****************************************************************/
-
- /**
- * @methodOf
- *
- * @name TogglePanel#getSelectItem
- *
- * @return {String} name of current selected panel item
- */
- getSelectItem: function () {
- return this.activeItem;
- },
-
- /**
- * @methodOf
- * @name TogglePanel#switchToItem
- *
- * @param {String} name - panel item name to switch
- * we can use meta names @first, @prev, @next and @last
- * @return {Boolean} - false if something wrong and true if all is ok
- */
- switchToItem: function (name) {
- var newPanel = this.getNextItem(name);
- if (newPanel == null) {
- rf.log.warn("TogglePanel.switchToItems(" + name + "): item with name '" + name + "' not found");
- return false;
- }
-
- var oldPanel = this.__getItemByName(this.getSelectItem());
-
- var continueProcess = this.__fireBeforeItemChange(oldPanel, newPanel);
- if (!continueProcess) {
- rf.log.warn("TogglePanel.switchToItems(" + name + "): switch has been canceled by beforeItemChange event");
- return false
- }
-
- return new SwitchItems(this).exec(oldPanel, newPanel);
- },
-
- /**
- * @methodOf
- * @name TogglePanel#getNextItem
- *
- * @param {String} name of TogglePanelItem or meta name (@first | @prev | @next | @last)
- * @return {TogglePanelItem} null if item not found
- */
- getNextItem : function (name) {
- if (name) {
- var newItemIndex = this.__ITEMS_META_NAMES[name];
- if (newItemIndex) {
- return this.__getItem(newItemIndex(this));
- } else {
- return this.__getItemByName(name);
- }
- } else {
- return this.__getItemByName(this.nextItem());
- }
- },
-
- /**
- * please, remove this method when client side ajax events will be added
- *
- * */
- onCompleteHandler : function (newItemName) {
- var oldItem = this.__getItemByName(this.activeItem);
- var newItem = this.__getItemByName(newItemName);
-
- // Don't do like this and remove it ASAP
- new SwitchItems(this).execClient(oldItem, newItem);
- },
-
- /**
- * @methodOf
- * @name TogglePanel#getItems
- *
- * @return {TogglePanelItem[]} all defined panel items
- */
- getItems : function () {
- return this.items;
- },
-
- /**
- * @methodOf
- * @name TogglePanel#getItemsNames
- *
- * @return {String[]} names of all defined items
- */
- getItemsNames: function () {
- var res = [];
- for (var item in this.items) {
- res.push(this.items[item].getName());
- }
-
- return res;
- },
-
- /**
- * @methodOf
- * @name TogglePanel#nextItem
- *
- * @param {String} [itemName = activeItem]
- * @return {String} name of next panel item
- */
- nextItem: function (itemName) {
- var itemIndex = this.__getItemIndex(itemName || this.activeItem);
- if (itemIndex == -1) {
- return null;
- }
-
- return this.__getItemName(itemIndex + 1);
- },
-
- /**
- * @methodOf
- * @name TogglePanel#firstItem
- *
- * @return {String} name of first panel item
- */
- firstItem: function () {
- return this.__getItemName(0);
- },
-
- /**
- * @methodOf
- * @name TogglePanel#lastItem
- *
- * @return {String} name of last panel item
- */
- lastItem: function () {
- return this.__getItemName(this.items.length - 1);
- },
-
- /**
- * @methodOf
- * @name TogglePanel#prevItem
- *
- * @param {String} itemName
- * @return {String} name of prev panel item
- * null if it is first item
- */
- prevItem: function (itemName) {
- var itemIndex = this.__getItemIndex(itemName || this.activeItem);
- if (!this.options.cycledSwitching && itemIndex < 1) {
- return null;
- }
-
- return this.__getItemName(itemIndex - 1);
- },
-
- /////////////////////////////////////////////////////////////////////////////////
- //// Private
- /////////////////////////////////////////////////////////////////////////////////
-
- /********************* Methods *************************/
-
- __ITEMS_META_NAMES : (function () {
- function goFrom (comp, ind, step) {
- var res = ind;
- while ((!comp.items[res] || comp.items[res].disabled) && res < comp.items.length && res > 0) {
- res += step;
- }
- return res;
- }
-
-
- return {
- "@first" : function (comp) {
- return goFrom(comp, 0, 1);
- },
-
- "@prev" : function (comp) {
- return goFrom(comp, parseInt(comp.__getItemIndex(comp.activeItem)) - 1 , -1);
- },
-
- "@next" : function (comp) {
- return goFrom(comp, parseInt(comp.__getItemIndex(comp.activeItem)) + 1 , 1);
- },
-
- "@last" : function (comp) {
- return goFrom(comp, comp.items.length - 1, -1);
- }
- }
- })(),
-
- /**
- * @private
- * */
- __getItemIndex : function (itemName) {
- for (var i in this.items) {
- if (!this.items[i].disabled && this.items[i].getName() === itemName) {
- return parseInt(i);
- }
- }
-
- rf.log.info("TogglePanel.getItemIndex: item with name '" + itemName + "' not found");
- return -1;
- },
-
- /**
- * @private
- * */
- __addUserEventHandler : function (name) {
- var handler = this.options["on" + name];
- if (handler) {
- rf.Event.bindById(this.id, name, handler);
- }
- },
-
- /**
- * @private
- * @param {Number} index - array index
- *
- * @return {TogglePanelItem}
- * null - if item not found
- * */
- __getItem : function (index) {
- if (this.options.cycledSwitching) {
- var size = this.items.length;
- return this.items[(size + index) % size]
- } else if (index >= 0 && index < this.items.length) {
- return this.items[index]
- } else {
- return null;
- }
- },
-
- __getItemByName : function (name) {
- return this.__getItem(this.__getItemIndex(name));
- },
-
- __getItemName : function (index) {
- var item = this.__getItem(index);
- if (item == null) {
- return null;
- }
-
- return item.getName();
- },
-
- /**
- * Fire Concealable Event
- * */
-
- __fireItemChange : function (oldItem, newItem) {
- return new rf.Event.fireById(this.id, "itemchange", {
- id: this.id,
- oldItem : oldItem,
- newItem : newItem
- });
- },
-
- __fireBeforeItemChange : function (oldItem, newItem) {
- return rf.Event.fireById(this.id, "beforeitemchange", {
- id: this.id,
- oldItem : oldItem,
- newItem : newItem
- });
- },
-
- destroy: function () {
- $super.destroy.call(this);
- }
- });
-
- // define super class link
- var $super = rf.ui.TogglePanel.$super;
-})(jQuery, RichFaces);
Deleted: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tooltip_.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tooltip_.js 2010-12-08 12:27:08 UTC (rev 20456)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tooltip_.js 2010-12-08 12:31:27 UTC (rev 20457)
@@ -1,295 +0,0 @@
-/*
- * 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.
- */
-
-
-(function ($, rf) {
-
- rf.ui = rf.ui || {};
-
- rf.ui.TooltipDirection = {
- topRight : "topRight",
- topLeft : "topLeft",
- bottomRight : "bottomRight",
- bottomLeft : "bottomLeft",
- auto : "auto",
-
- DEFAULT: "bottomRight"
- };
- var TooltipDirection = rf.ui.TooltipDirection;
-
- rf.ui.TooltipMode = {
- client : "client",
- ajax : "ajax",
-
- DEFAULT: "client"
- };
- var TooltipMode = rf.ui.TooltipMode;
-
- var DEFAULT_OPTIONS = {
- direction : TooltipDirection.DEFAULT,
- attached : true,
- offset : [],
- mode : TooltipMode.DEFAULT,
- disabled : false,
- hideDelay : 0,
- hideEvent : "mouseleave",
- showDelay : 0,
- showEvent : "mouseenter",
- followMouse : true
- };
-
- var SHOW_ACTION = {
-
- /**
- *
- * @return {void}
- * */
- exec : function (tooltip, event) {
- var mode = tooltip.mode;
- if (mode == TooltipMode.ajax) {
- return this.execAjax(tooltip, event);
- } else if (mode == TooltipMode.client) {
- return this.execClient(tooltip, event);
- } else {
- rf.log.error("SHOW_ACTION.exec : unknown mode (" + mode + ")");
- }
- },
-
- /**
- * @protected
- *
- * @return {Boolean} false
- * */
- execAjax : function (tooltip, event) {
- tooltip.__loading().show();
- tooltip.__content().hide();
- tooltip.__show(event);
-
- rf.ajax(tooltip.id, null, $.extend({}, tooltip.options["ajax"], {}));
-
- return true;
- },
-
- /**
- * @protected
- *
- * @return {undefined}
- * - false - if process has been terminated
- * - true - in other cases
- * */
- execClient : function (tooltip, event) {
- tooltip.__show(event);
-
- return tooltip.__fireShow();
- }
- };
-
- rf.ui.Tooltip = rf.BaseComponent.extendClass({
- // class name
- name:"Tooltip",
-
- /**
- * @class Tooltip
- * @name Tooltip
- *
- * @constructor
- * @param {String} componentId - component id
- * @param {Hash} options - params
- * */
- init : function (componentId, options) {
- $super.constructor.call(this, componentId);
- this.options = $.extend(this.options, DEFAULT_OPTIONS, options || {});
- this.attachToDom();
-
- this.mode = this.options.mode;
- this.target = this.options.target;
-
- this.__addUserEventHandler("hide");
- this.__addUserEventHandler("show");
- this.__addUserEventHandler("beforehide");
- this.__addUserEventHandler("beforeshow");
-
- this.popup = new RichFaces.ui.Popup(this.id, {
- attachTo: this.target,
- attachToBody: false,
- positionType: "TOOLTIP",
- positionOffset: [200,200]
- });
-
- var tooltip = this;
- function mouseMoveHandler(event) {
- tooltip.popup.show(event);
- }
-
- $(document.getElementById(this.target)).bind(this.options.showEvent, function (event) {
- tooltip.show(event);
-
- if (tooltip.options.followMouse) {
- $(document.getElementById(tooltip.target)).bind("mousemove", mouseMoveHandler);
- }
- });
-
- $(document.getElementById(tooltip.target)).bind(this.options.hideEvent, function (event) {
- tooltip.hide();
-
- if (tooltip.options.followMouse) {
- $(document.getElementById(tooltip.target)).unbind("mousemove", mouseMoveHandler);
- }
- });
-
- },
-
- /***************************** Public Methods ****************************************************************/
- /**
- * @methodOf
- * @name PanelMenuItem#hide
- *
- * TODO ...
- *
- * @return {void} TODO ...
- */
- hide: function () {
- var continueProcess = this.__fireBeforeHide();
- if (!continueProcess) {
- return false;
- }
-
- this.__hide();
-
- return this.__fireHide()
- },
-
- /**
- * @private
- * @return {void} TODO ...
- */
- __hide: function () {
- var tooltip = this;
- this.__delay(this.options.hideDelay, function () {
- tooltip.popup.hide();
- });
- },
-
- /**
- * @methodOf
- * @name PanelMenuItem#show
- *
- * TODO ...
- *
- * @return {void} TODO ...
- */
- show: function (event) {
- var continueProcess = this.__fireBeforeShow();
- if (!continueProcess) {
- return false;
- }
-
- SHOW_ACTION.exec(this, event);
- },
-
- onCompleteHandler : function () {
- this.__content().show();
- this.__loading().hide();
-
- return this.__fireShow();
- },
-
- /**
- * @private
- * @return {void} TODO ...
- */
- __show: function (event) {
- var tooltip = this;
- this.__delay(this.options.showDelay, function () {
- tooltip.popup.show(event);
- });
- },
-
- /***************************** Private Methods ****************************************************************/
- __delay : function (delay, action) {
- if (delay > 0) {
- var hidingTimerHandle = window.setTimeout(function() {
- action();
-
- if (hidingTimerHandle) {
- window.clearTimeout(hidingTimerHandle);
- hidingTimerHandle = undefined;
- }
- }, delay);
- } else {
- action();
- }
- },
-
- __detectAncestorNode: function(leaf, element) {
- // Return true if "element" is "leaf" or one of its parents
- var node = leaf;
- while (node != null && node != element) {
- node = node.parentNode;
- }
- return (node != null);
- },
-
- __loading : function () {
- return $(document.getElementById(this.id + ":loading"));
- },
-
- __content : function () {
- return $(document.getElementById(this.id + "@content"));
- },
-
- __fireHide : function () {
- return rf.Event.fireById(this.id, "hide", { id: this.id });
- },
-
- __fireShow : function () {
- return rf.Event.fireById(this.id, "show", { id: this.id });
- },
-
- __fireBeforeHide : function () {
- return rf.Event.fireById(this.id, "beforehide", { id: this.id });
- },
-
- __fireBeforeShow : function () {
- return rf.Event.fireById(this.id, "beforeshow", { id: this.id });
- },
-
-
-
- /**
- * @private
- * */
- __addUserEventHandler : function (name) {
- var handler = this.options["on" + name];
- if (handler) {
- rf.Event.bindById(this.id, name, handler);
- }
- },
-
- destroy: function () {
- $super.destroy.call(this);
- }
- });
-
- // define super class link
- var $super = rf.ui.Tooltip.$super;
-})(jQuery, RichFaces);
Copied: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/accordion.js (from rev 20456, trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Accordion_.js)
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/accordion.js (rev 0)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/accordion.js 2010-12-08 12:31:27 UTC (rev 20457)
@@ -0,0 +1,75 @@
+/*
+ * 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.
+ */
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.Accordion = rf.ui.TogglePanel.extendClass({
+ // class name
+ name:"Accordion",
+
+ /**
+ * @class Accordion
+ * @name Accordion
+ *
+ * @constructor
+ * @param {String} componentId - component id
+ * @param {Hash} options - params
+ * */
+ init : function (componentId, options) {
+ $super.constructor.call(this, componentId, options);
+ this.items = [];
+
+ this.isKeepHeight = options["isKeepHeight"] || false
+ },
+
+ /***************************** Public Methods ****************************************************************/
+
+ getHeight : function (recalculate) {
+ if (recalculate || !this.__height) {
+ this.__height = $(rf.getDomElement(this.id)).outerHeight(true)
+ }
+
+ return this.__height;
+ },
+
+ getInnerHeight : function (recalculate) {
+ if (recalculate || !this.__innerHeight) {
+ this.__innerHeight = $(rf.getDomElement(this.id)).innerHeight(true)
+ }
+
+ return this.__innerHeight;
+ },
+
+ /***************************** Private Methods ********************************************************/
+
+
+ destroy: function () {
+ rf.Event.unbindById(this.id, "." + this.namespace);
+ $super.destroy.call(this);
+ }
+ });
+
+ // define super class link
+ var $super = rf.ui.Accordion.$super;
+})(jQuery, RichFaces);
Copied: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/accordionItem.js (from rev 20456, trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem_.js)
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/accordionItem.js (rev 0)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/accordionItem.js 2010-12-08 12:31:27 UTC (rev 20457)
@@ -0,0 +1,158 @@
+/*
+ * 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.
+ */
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.AccordionItem = rf.ui.TogglePanelItem.extendClass({
+ // class name
+ name:"AccordionItem",
+
+ /**
+ * @class AccordionItem
+ * @name AccordionItem
+ *
+ * @constructor
+ * @param {String} componentId - component id
+ * @param {Hash} options - params
+ * */
+ init : function (componentId, options) {
+ $super.constructor.call(this, componentId, options);
+ this.index = options["index"];
+ this.getTogglePanel().getItems()[this.index] = this;
+
+ if (!this.disabled) {
+ rf.Event.bindById(this.id + ":header", "click", this.__onHeaderClick, this);
+ }
+
+ if (this.isSelected()) {
+ var item = this;
+ $(document).ready(function () {
+ item.__fitToHeight(item.getTogglePanel());
+ });
+ }
+ },
+
+ /***************************** Public Methods ****************************************************************/
+
+ __onHeaderClick : function (comp) {
+ this.getTogglePanel().switchToItem(this.getName());
+ },
+
+ /**
+ * @param state {string} = inactive | active | disabled
+ * in that case looking header by css class appropriate to this state
+ *
+ * @return {jQuery Object}
+ * */
+ __header : function (state) {
+ var res = $(rf.getDomElement(this.id + ":header"));
+ if (state) {
+ return res.find(".rf-ac-itm-hdr-" + state);
+ }
+
+ return res;
+ },
+
+ /**
+ * @return {jQuery Object}
+ * */
+ __content : function () {
+ if (!this.__content_) {
+ this.__content_ = $(rf.getDomElement(this.id + ":content"));
+ }
+ return this.__content_;
+ },
+
+ /**
+ * @private
+ *
+ * used in TogglePanel
+ * */
+ __enter : function () {
+ var parentPanel = this.getTogglePanel();
+ if (parentPanel.isKeepHeight) {
+ this.__content().hide(); // TODO ?
+ this.__fitToHeight(parentPanel);
+ }
+
+ this.__content().show();
+ this.__header("inact").hide();
+ this.__header("act").show();
+
+ return this.__fireEnter();
+ },
+
+ __fitToHeight : function (parentPanel) {
+ var h = parentPanel.getInnerHeight();
+
+ var items = parentPanel.getItems();
+ for (var i in items) {
+ h -= items[i].__header().outerHeight();
+ }
+
+ this.__content().height(h - 20); // 20 it is padding top and bottom
+ },
+
+ getHeight : function (recalculate) {
+ if (recalculate || !this.__height) {
+ this.__height = $(rf.getDomElement(this.id)).outerHeight(true)
+ }
+
+ return this.__height;
+ },
+
+ /**
+ * @private
+ *
+ * used in TogglePanel
+ * */
+ __leave : function () {
+ var continueProcess = this.__fireLeave();
+ if (!continueProcess) {
+ return false;
+ }
+
+ this.__content().hide();
+ this.__header("act").hide();
+ this.__header("inact").show();
+
+ return true;
+ },
+
+ /***************************** Private Methods ********************************************************/
+
+
+ destroy: function () {
+ var parent = this.getTogglePanel();
+ delete parent.getItems()[this.index];
+
+ rf.Event.unbindById(this.id, "."+this.namespace);
+
+ $super.destroy.call(this);
+ }
+ });
+
+ // define super class link
+ var $super = rf.ui.AccordionItem.$super;
+})(jQuery, RichFaces);
Copied: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.js (from rev 20456, trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel_.js)
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.js (rev 0)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.js 2010-12-08 12:31:27 UTC (rev 20457)
@@ -0,0 +1,82 @@
+/*
+ * 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.
+ */
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.CollapsiblePanel = rf.ui.TogglePanel.extendClass({
+
+ name:"CollapsiblePanel",
+
+ /**
+ * @class CollapsiblePanel
+ * @name CollapsiblePanel
+ *
+ * @constructor
+ * @param {String} componentId - component id
+ * @param {Hash} options - params
+ * */
+ init : function (componentId, options) {
+ rf.ui.TogglePanel.call(this, componentId, options);
+ this.switchMode = options.switchMode;
+
+ this.__addUserEventHandler("beforeswitch");
+ this.__addUserEventHandler("switch");
+
+ this.items = [
+ new RichFaces.ui.CollapsiblePanelItem(
+ this.id + ":content", {"index":0, "togglePanelId":this.id, "switchMode":this.switchMode, "name":"true"}),
+
+ new RichFaces.ui.CollapsiblePanelItem(
+ this.id + ":empty", {"index":1, "togglePanelId":this.id, "switchMode":this.switchMode, "name":"false"})
+ ];
+ this.options.cycledSwitching = true;
+
+ rf.Event.bindById(this.id + ":header", "click", this.__onHeaderClick, this)
+ },
+
+ switchPanel : function (to) {
+ this.switchToItem(to || "@next");
+ },
+
+ /***************************** Private Methods ********************************************************/
+
+ __onHeaderClick : function () {
+ this.switchToItem("@next");
+ },
+
+ __fireItemChange : function (oldItem, newItem) {
+ return new rf.Event.fireById(this.id, "switch", {
+ id: this.id,
+ isExpanded : newItem.getName()
+ });
+ },
+
+ __fireBeforeItemChange : function (oldItem, newItem) {
+ return rf.Event.fireById(this.id, "beforeswitch", {
+ id: this.id,
+ isExpanded : newItem.getName()
+ });
+ }
+ });
+})(jQuery, RichFaces);
Copied: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanelItem.js (from rev 20456, trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem_.js)
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanelItem.js (rev 0)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanelItem.js 2010-12-08 12:31:27 UTC (rev 20457)
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.CollapsiblePanelItem = rf.ui.TogglePanelItem.extendClass({
+
+ init : function (componentId, options) {
+ rf.ui.TogglePanelItem.call(this, componentId, options);
+ },
+
+ __enter : function () {
+ rf.getDomElement(this.id).style.display = "block";
+ this.__header(this.__state()).show();
+
+ return true;
+ },
+
+ __leave : function () {
+ rf.getDomElement(this.id).style.display = "none";
+ this.__header(this.__state()).hide();
+
+ return true;
+ },
+
+ __state : function () {
+ return this.getName() === "true" ? "exp" : "colps";
+ },
+
+ __header : function (state) {
+ var res = $(rf.getDomElement(this.togglePanelId + ":header"));
+ if (state) {
+ return res.find(".rf-cp-hdr-" + state);
+ }
+
+ return res;
+ }
+ });
+})(jQuery, RichFaces);
Copied: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenu.js (from rev 20456, trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenu_.js)
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenu.js (rev 0)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenu.js 2010-12-08 12:31:27 UTC (rev 20457)
@@ -0,0 +1,211 @@
+/*
+ * 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.
+ */
+
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ var __DEFAULT_OPTIONS = {
+ expandSingle : true
+ };
+
+ rf.ui.PanelMenu = rf.BaseComponent.extendClass({
+ // class name
+ name:"PanelMenu",
+
+ /**
+ * @class PanelMenu
+ * @name PanelMenu
+ *
+ * @constructor
+ * @param {String} componentId - component id
+ * @param {Hash} options - params
+ * */
+ init : function (componentId, options) {
+ $super.constructor.call(this, componentId);
+ this.items = [];
+ this.attachToDom();
+
+ this.options = $.extend(this.options, __DEFAULT_OPTIONS, options || {});
+ this.activeItem = this.__getValueInput().value;
+ this.nestingLevel = 0;
+
+ var menuGroup = this;
+ if (menuGroup.options.expandSingle) {
+ menuGroup.__panelMenu().bind("expand", function (event) {
+ menuGroup.__childGroups().each (function (index, group) {
+ if (event.target.id != group.id) {
+ rf.$(group.id).collapse();
+ }
+ });
+
+ event.stopPropagation();
+ });
+ }
+
+ if (menuGroup.activeItem) {
+ this.__panelMenu().ready(function () {
+ var item = menuGroup.items[menuGroup.activeItem];
+ item.__select();
+ item.__fireSelect();
+ })
+ }
+
+ this.__addUserEventHandler("collapse");
+ this.__addUserEventHandler("expand");
+ },
+
+ getItems: function () {
+ return this.items;
+ },
+
+ getItem: function (name) {
+ return this.items[name];
+ },
+
+ /***************************** Public Methods ****************************************************************/
+ /**
+ * @methodOf
+ * @name PanelMenu#selectItem
+ *
+ * TODO ...
+ *
+ * @param {String} name
+ * @return {void} TODO ...
+ */
+ selectItem: function (name) {
+ // TODO implement
+ },
+
+ /**
+ * @methodOf
+ * @name PanelMenu#selectedItem
+ *
+ * TODO ...
+ *
+ * @return {String} TODO ...
+ */
+ selectedItem: function (id) {
+ if (id != undefined) {
+ var valueInput = this.__getValueInput();
+ var prevActiveItem = valueInput.value;
+
+ this.activeItem = id;
+ valueInput.value = id;
+
+ return prevActiveItem;
+ } else {
+ return this.activeItem;
+ }
+ },
+
+ __getValueInput : function() {
+ return document.getElementById(this.id + "-value");
+ },
+
+ selectItem: function (itemName) {
+ // TODO
+ },
+
+ /**
+ * @methodOf
+ * @name PanelMenu#expandAll
+ *
+ * TODO ...
+ *
+ * @return {void} TODO ...
+ */
+ expandAll: function () {
+ // TODO implement
+ },
+
+ /**
+ * @methodOf
+ * @name PanelMenu#collapseAll
+ *
+ * TODO ...
+ *
+ * @return {void} TODO ...
+ */
+ collapseAll: function () {
+ // TODO implement
+ },
+
+ /**
+ * @methodOf
+ * @name PanelMenu#expandGroup
+ *
+ * TODO ...
+ *
+ * @param {String} groupName
+ * @return {void} TODO ...
+ */
+ expandGroup: function (groupName) {
+ // TODO implement
+ },
+
+ /**
+ * @methodOf
+ * @name PanelMenu#collapseGroup
+ *
+ * TODO ...
+ *
+ * @param {String} groupName
+ * @return {void} TODO ...
+ */
+ collapseGroup: function (groupName) {
+ // TODO implement
+ },
+
+
+ /***************************** Private Methods ****************************************************************/
+
+
+ __panelMenu : function () {
+ return $(rf.getDomElement(this.id));
+ },
+
+ __childGroups : function () {
+ return this.__panelMenu().children(".rf-pm-top-gr")
+ },
+
+ /**
+ * @private
+ * */
+ __addUserEventHandler : function (name) {
+ var handler = this.options["on" + name];
+ if (handler) {
+ rf.Event.bindById(this.id, name, handler);
+ }
+ },
+
+ destroy: function () {
+ rf.Event.unbindById(this.id, "."+this.namespace);
+ $super.destroy.call(this);
+ }
+ });
+
+ // define super class link
+ var $super = rf.ui.PanelMenu.$super;
+
+})(jQuery, RichFaces);
Copied: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuGroup.js (from rev 20456, trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenuGroup_.js)
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuGroup.js (rev 0)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuGroup.js 2010-12-08 12:31:27 UTC (rev 20457)
@@ -0,0 +1,365 @@
+/*
+ * 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.
+ */
+
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ var __DEFAULT_OPTIONS = {
+ expanded : false,
+ expandSingle : true,
+ bubbleSelection : true,
+ stylePrefix : "rf-pm-gr",
+
+ // TODO we should use selectionType = {none, selectable, unselectable}
+ selectable : false,
+ unselectable : false // unselectable can be only selectable item => if selectable == false than unselectable = false
+ };
+
+ var EXPAND_ITEM = {
+
+ /**
+ *
+ * @return {void}
+ * */
+ exec : function (group, expand) {
+ var mode = group.mode;
+ if (mode == "server") {
+ return this.execServer(group);
+ } else if (mode == "ajax") {
+ return this.execAjax(group);
+ } else if (mode == "client" || mode == "none") {
+ return this.execClient(group, expand);
+ } else {
+ rf.log.error("EXPAND_ITEM.exec : unknown mode (" + mode + ")");
+ }
+ },
+
+ /**
+ * @protected
+ *
+ * @return {Boolean} false
+ * */
+ execServer : function (group) {
+ group.__changeState();
+ rf.submitForm(this.__getParentForm(group));
+
+ return false;
+ },
+
+ /**
+ * @protected
+ *
+ * @return {Boolean} false
+ * */
+ execAjax : function (group) {
+ var oldState = group.__changeState();
+ rf.ajax(group.id, null, $.extend({}, group.options["ajax"], {}));
+ group.__restoreState(oldState);
+
+ return true;
+ },
+
+ /**
+ * @protected
+ *
+ * @param {PanelMenuGroup} group
+ * @param {Boolean} expand
+ * @return {undefined}
+ * - false - if process has been terminated
+ * - true - in other cases
+ * */
+ execClient : function (group, expand) {
+ if (expand) {
+ group.expand();
+ } else {
+ group.collapse();
+ }
+
+ return group.__fireSwitch();
+ },
+
+ /**
+ * @private
+ * */
+ __getParentForm : function (item) {
+ return $($(rf.getDomElement(item.id)).parents("form")[0]);
+ }
+ };
+
+ rf.ui.PanelMenuGroup = rf.ui.PanelMenuItem.extendClass({
+ // class name
+ name:"PanelMenuGroup",
+
+ /**
+ * @class PanelMenuGroup
+ * @name PanelMenuGroup
+ *
+ * @constructor
+ * @param {String} componentId - component id
+ * @param {Hash} options - params
+ * */
+ init : function (componentId, options) {
+ $super.constructor.call(this, componentId);
+ this.options = $.extend(this.options, __DEFAULT_OPTIONS, options || {});
+
+ if (!this.options.disabled) {
+ var menuGroup = this;
+
+ if (!this.options.selectable) {
+ this.__header().bind("click", function () {
+ return menuGroup.switchExpantion();
+ });
+ }
+
+ if (this.options.selectable || this.options.bubbleSelection) {
+ this.__content().bind("select", function (event) {
+ if (menuGroup.options.selectable && menuGroup.__isMyEvent(event)) {
+ menuGroup.expand();
+ }
+
+ if (menuGroup.options.bubbleSelection && !menuGroup.__isMyEvent(event)) {
+ menuGroup.__select();
+ if (!menuGroup.expanded()) {
+ menuGroup.expand();
+ }
+ }
+ });
+
+ this.__content().bind("unselect", function (event) {
+ if (menuGroup.options.selectable && menuGroup.__isMyEvent(event)) {
+ menuGroup.collapse();
+ }
+
+ if (menuGroup.options.bubbleSelection && !menuGroup.__isMyEvent(event)) {
+ menuGroup.__unselect();
+ }
+ });
+ }
+
+ if (menuGroup.options.expandSingle) {
+ menuGroup.__group().bind("expand", function (event) {
+ if (menuGroup.__isMyEvent(event)) {
+ return;
+ }
+
+ menuGroup.__childGroups().each (function (index, group) {
+ var rfGroup = rf.$(group);
+ if (!rfGroup.__isMyEvent(event)) {
+ rfGroup.collapse();
+ }
+ });
+
+ event.stopPropagation();
+ });
+ }
+
+ this.__addUserEventHandler("collapse");
+ this.__addUserEventHandler("expand");
+ }
+ },
+
+ /***************************** Public Methods ****************************************************************/
+ expanded : function () {
+ // TODO check invariant in dev mode
+ // return this.__content().hasClass("rf-pm-exp")
+ return this.__getExpandValue();
+ },
+
+ expand : function () {
+ this.__expand();
+
+ return this.__fireExpand();
+ },
+
+ __expand : function () {
+ this.__content().removeClass("rf-pm-colps").addClass("rf-pm-exp");
+ var header = this.__header();
+ header.find(".rf-pm-ico-colps").hide();
+ header.find(".rf-pm-ico-exp").show();
+
+ this.__setExpandValue(true);
+ },
+
+ collapsed : function () {
+ // TODO check invariant in dev mode
+ // return this.__content().hasClass("rf-pm-colps")
+ return !this.__getExpandValue();
+ },
+
+ collapse : function () {
+ this.__collapse();
+
+ this.__childGroups().each (function(index, group) {
+ rf.$(group.id).__collapse();
+ });
+
+ this.__fireCollapse();
+ },
+
+ __collapse : function () {
+ this.__content().addClass("rf-pm-colps").removeClass("rf-pm-exp");
+ var header = this.__header();
+ header.find(".rf-pm-ico-exp").hide();
+ header.find(".rf-pm-ico-colps").show();
+
+ this.__setExpandValue(false);
+ },
+
+ /**
+ * @methodOf
+ * @name PanelMenuGroup#switch
+ *
+ * TODO ...
+ *
+ * @param {boolean} expand
+ * @return {void} TODO ...
+ */
+ switchExpantion : function () { // TODO rename
+ var continueProcess = this.__fireBeforeSwitch();
+ if (!continueProcess) {
+ return false;
+ }
+
+ EXPAND_ITEM.exec(this, !this.expanded());
+ },
+
+ /**
+ * please, remove this method when client side ajax events will be added
+ *
+ * */
+ onCompleteHandler : function () {
+ EXPAND_ITEM.execClient(this, this.expanded());
+ },
+
+ __switch : function (expand) {
+ if (expand) {
+ this.expand();
+ } else {
+ this.collapse();
+ }
+ },
+
+ /***************************** Private Methods ****************************************************************/
+ __childGroups : function () {
+ return this.__content().children(".rf-pm-gr")
+ },
+
+ __group : function () {
+ return $(rf.getDomElement(this.id))
+ },
+
+ __header : function () {
+ return $(rf.getDomElement(this.id + ":hdr"))
+ },
+
+ __content : function () {
+ return $(rf.getDomElement(this.id + ":cnt"))
+ },
+
+ __expandValueInput : function () {
+ return document.getElementById(this.id + ":expanded");
+ },
+
+ __getExpandValue : function () {
+ return this.__expandValueInput().value == "true";
+ },
+
+ /**
+ * @methodOf
+ * @name PanelMenuGroup#__setExpandValue
+ *
+ * @param {boolean} value - is group expanded?
+ * @return {boolean} preview value
+ */
+ __setExpandValue : function (value) {
+ var input = this.__expandValueInput();
+ var oldValue = input.value;
+
+ input.value = value;
+
+ return oldValue;
+ },
+
+ __changeState : function () {
+ var state = {};
+ 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
+ }
+
+ return state;
+ },
+
+ __restoreState : function (state) {
+ if (!state) {
+ return;
+ }
+
+ if (state["expanded"]) {
+ this.__setExpandValue(state["expanded"]);
+ }
+
+ if (state["itemName"]) {
+ this.__rfPanelMenu().selectedItem(state["itemName"]);
+ }
+ },
+
+ __fireSwitch : function () {
+ return new rf.Event.fireById(this.id, "switch", {
+ id: this.id
+ });
+ },
+
+ __isMyEvent: function (event) {
+ return this.id == event.target.id;
+ },
+
+ __fireBeforeSwitch : function () {
+ return rf.Event.fireById(this.id, "beforeswitch", {
+ id: this.id
+ });
+ },
+
+ __fireCollapse : function () {
+ return new rf.Event.fireById(this.id, "collapse", {
+ id: this.id
+ });
+ },
+
+ __fireExpand : function () {
+ return new rf.Event.fireById(this.id, "expand", {
+ id: this.id
+ });
+ },
+
+ destroy: function () {
+ rf.Event.unbindById(this.id, "."+this.namespace);
+
+ $super.destroy.call(this);
+ }
+ });
+
+ // define super class link
+ var $super = rf.ui.PanelMenuGroup.$super;
+})(jQuery, RichFaces);
Copied: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuItem.js (from rev 20456, trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenuItem_.js)
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuItem.js (rev 0)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuItem.js 2010-12-08 12:31:27 UTC (rev 20457)
@@ -0,0 +1,321 @@
+/*
+ * 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.
+ */
+
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ var __DEFAULT_OPTIONS = {
+ disabled : false,
+ selectable: true,
+ mode: "client",
+ unselectable: false,
+ highlight: true,
+ stylePrefix: "rf-pm-itm",
+ itemStep: 20
+ };
+
+ var SELECT_ITEM = {
+
+ /**
+ *
+ * @return {void}
+ * */
+ exec : function (item) {
+ var mode = item.mode;
+ if (mode == "server") {
+ return this.execServer(item);
+ } else if (mode == "ajax") {
+ return this.execAjax(item);
+ } else if (mode == "client" || mode == "none") {
+ return this.execClient(item);
+ } else {
+ rf.log.error("SELECT_ITEM.exec : unknown mode (" + mode + ")");
+ }
+ },
+
+ /**
+ * @protected
+ *
+ * @return {Boolean} false
+ * */
+ execServer : function (item) {
+ item.__changeState();
+ rf.submitForm(this.__getParentForm(item));
+
+ return false;
+ },
+
+ /**
+ * @protected
+ *
+ * @return {Boolean} false
+ * */
+ execAjax : function (item) {
+ var oldItem = item.__changeState();
+ rf.ajax(item.__panelMenu().id, null, $.extend({}, item.options["ajax"], {}));
+ item.__restoreState(oldItem);
+
+ return true;
+ },
+
+ /**
+ * @protected
+ *
+ * @return {undefined}
+ * - false - if process has been terminated
+ * - true - in other cases
+ * */
+ execClient : function (item) {
+ var panelMenu = item.__rfPanelMenu();
+ if (panelMenu.selectedItem()) {
+ panelMenu.getItems()[panelMenu.selectedItem()].unselect();
+ }
+ panelMenu.selectedItem(item.itemName);
+
+ item.__select();
+
+ return item.__fireSelect();
+ },
+
+ /**
+ * @private
+ * */
+ __getParentForm : function (item) {
+ return $($(rf.getDomElement(item.id)).parents("form")[0]);
+ }
+ };
+
+ rf.ui.PanelMenuItem = rf.BaseComponent.extendClass({
+ // class name
+ name:"PanelMenuItem",
+
+ /**
+ * @class PanelMenuItem
+ * @name PanelMenuItem
+ *
+ * @constructor
+ * @param {String} componentId - component id
+ * @param {Hash} options - params
+ * */
+ init : function (componentId, options) {
+ $super.constructor.call(this, componentId);
+ this.attachToDom();
+
+ this.options = $.extend(this.options, __DEFAULT_OPTIONS, options || {});
+
+ this.mode = this.options.mode
+ this.itemName = this.options.name
+ this.__rfPanelMenu().getItems()[this.itemName] = this;
+
+ // todo move it
+ this.selectionClass = this.options.stylePrefix + "-sel";
+ this.hoverClass = this.options.stylePrefix + "-hov";
+
+ if (!this.options.disabled) {
+ var item = this;
+ if (this.options.highlight) {
+ this.__item().bind("mouseenter", function() {
+ item.highlight(true);
+ });
+ this.__item().bind("mouseleave", function() {
+ item.highlight(false);
+ });
+ }
+
+ if (this.options.selectable) {
+ this.__header().bind("click", function() {
+ if (item.__rfPanelMenu().selectedItem() == item.id) {
+ if (item.options.unselectable) {
+ return item.unselect();
+ }
+
+ // we shouldn't select one item several times
+ } else {
+ return item.select();
+ }
+ });
+ }
+ }
+
+ item = this;
+ $(this.__panelMenu()).ready(function () {
+ item.__renderNestingLevel();
+ });
+
+ this.__addUserEventHandler("select");
+ },
+
+ /***************************** Public Methods ****************************************************************/
+ highlight : function (highlight) {
+ if (highlight && !this.selected()) {
+ this.__header().addClass(this.hoverClass);
+ } else {
+ this.__header().removeClass(this.hoverClass);
+ }
+ },
+
+ selected : function () {
+ return this.__header().hasClass(this.selectionClass);
+ },
+
+ /**
+ * @methodOf
+ * @name PanelMenuItem#select
+ *
+ * TODO ...
+ *
+ * @return {void} TODO ...
+ */
+ select: function () {
+ var continueProcess = this.__fireBeforeSelect();
+ if (!continueProcess) {
+ return false;
+ }
+
+ return SELECT_ITEM.exec(this)
+ },
+
+ /**
+ * please, remove this method when client side ajax events will be added
+ *
+ * */
+ onCompleteHandler : function () {
+ SELECT_ITEM.execClient(this);
+ },
+
+ unselect: function () {
+ var panelMenu = this.__rfPanelMenu();
+ if (panelMenu.selectedItem() == this.itemName) {
+ panelMenu.selectedItem(null);
+ } else {
+ rf.warn("You try unselect item (name=" + this.itemName + ") that isn't seleted")
+ }
+
+ this.__unselect();
+
+ return this.__fireUnselect();
+ },
+
+ /***************************** 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];
+ },
+
+ __rfPanelMenu : function () {
+ return rf.$(this.__item().parents(".rf-pm")[0]);
+ },
+
+ __changeState : function () {
+ return this.__rfPanelMenu().selectedItem(this.itemName);
+ },
+
+ __restoreState : function (state) {
+ if (state) {
+ this.__rfPanelMenu().selectedItem(state);
+ }
+ },
+
+ __item : function () {
+ return $(rf.getDomElement(this.id));
+ },
+
+ __header : function () {
+ return this.__item();
+ },
+
+ __select: function () {
+ this.__header().addClass(this.selectionClass);
+ },
+
+ __unselect: function () {
+ this.__header().removeClass(this.selectionClass);
+ },
+
+ __fireBeforeSelect : function () {
+ return new rf.Event.fireById(this.id, "beforeselect", {
+ id: this.id
+ });
+ },
+
+ __fireSelect : function () {
+ return new rf.Event.fireById(this.id, "select", {
+ id: this.id
+ });
+ },
+
+ __fireUnselect : function () {
+ return new rf.Event.fireById(this.id, "unselect", {
+ id: this.id
+ });
+ },
+
+ /**
+ * @private
+ * */
+ __addUserEventHandler : function (name) {
+ var handler = this.options["on" + name];
+ if (handler) {
+ rf.Event.bindById(this.id, name, handler);
+ }
+ },
+
+ destroy: function () {
+ delete this.__rfPanelMenu().getItems()[this.itemName];
+ $super.destroy.call(this);
+ }
+ });
+
+ // define super class link
+ var $super = rf.ui.PanelMenuItem.$super;
+})(jQuery, RichFaces);
Copied: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tab.js (from rev 20456, trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tab_.js)
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tab.js (rev 0)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tab.js 2010-12-08 12:31:27 UTC (rev 20457)
@@ -0,0 +1,139 @@
+/*
+ * 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.
+ */
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.Tab = rf.ui.TogglePanelItem.extendClass({
+ // class name
+ name:"Tab",
+
+ /**
+ * @class AccordionItem
+ * @name AccordionItem
+ *
+ * @constructor
+ * @param {String} componentId - component id
+ * @param {Hash} options - params
+ * */
+ init : function (componentId, options) {
+ $super.constructor.call(this, componentId, options);
+ this.index = options["index"];
+ this.getTogglePanel().getItems()[this.index] = this;
+
+ //TODO - optimize this
+ rf.Event.bindById(this.id + ":header:active", "click", this.__onHeaderClick, this);
+ rf.Event.bindById(this.id + ":header:inactive", "click", this.__onHeaderClick, this)
+ },
+
+ /***************************** Public Methods ****************************************************************/
+
+ __onHeaderClick : function (comp) {
+ this.getTogglePanel().switchToItem(this.getName());
+ },
+
+ /**
+ * @param state {string} = inactive | active | disabled
+ * in that case looking header by css class appropriate to this state
+ *
+ * @return {jQuery Object}
+ * */
+ __header : function (state) {
+ var res = $(rf.getDomElement(this.id + ":header"));
+ if (state) {
+ return $(rf.getDomElement(this.id + ":header:" + state));
+ }
+
+ return res;
+ },
+
+ /**
+ * @return {jQuery Object}
+ * */
+ __content : function () {
+ if (!this.__content_) {
+ this.__content_ = $(rf.getDomElement(this.id + ":content"));
+ }
+ return this.__content_;
+ },
+
+ /**
+ * @private
+ *
+ * used in TogglePanel
+ * */
+ __enter : function () {
+
+ this.__content().show();
+ this.__header("inactive").hide();
+ this.__header("active").show();
+
+ return this.__fireEnter();
+ },
+
+ getHeight : function (recalculate) {
+ if (recalculate || !this.__height) {
+ this.__height = $(rf.getDomElement(this.id)).outerHeight(true)
+ }
+
+ return this.__height;
+ },
+
+ /**
+ * @private
+ *
+ * used in TogglePanel
+ * */
+ __leave : function () {
+ var continueProcess = this.__fireLeave();
+ if (!continueProcess) {
+ return false;
+ }
+
+ this.__content().hide();
+ this.__header("active").hide();
+ this.__header("inactive").show();
+
+ return true;
+ },
+
+ /***************************** Private Methods ********************************************************/
+
+
+ destroy: function () {
+ var parent = this.getTogglePanel();
+ delete parent.getItems()[this.index];
+
+ rf.Event.unbindById(this.id);
+
+ //TODO - optimize
+ rf.Event.unbindById(this.id + ":header:active");
+ rf.Event.unbindById(this.id + ":header:inactive");
+
+ $super.destroy.call(this);
+ }
+ });
+
+ // define super class link
+ var $super = rf.ui.Tab.$super;
+})(jQuery, RichFaces);
Copied: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tabPanel.js (from rev 20456, trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TabPanel_.js)
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tabPanel.js (rev 0)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tabPanel.js 2010-12-08 12:31:27 UTC (rev 20457)
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.TabPanel = rf.ui.TogglePanel.extendClass({
+ // class name
+ name:"TabPanel",
+
+ /**
+ * @class TabPanel
+ * @name TabPanel
+ *
+ * @constructor
+ * @param {String} componentId - component id
+ * @param {Hash} options - params
+ * */
+ init : function (componentId, options) {
+ rf.ui.TogglePanel.call(this, componentId, options);
+ this.items = [];
+
+ this.isKeepHeight = options["isKeepHeight"] || false
+ }
+ });
+})(jQuery, RichFaces);
Copied: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/togglePanel.js (from rev 20456, trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel_.js)
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/togglePanel.js (rev 0)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/togglePanel.js 2010-12-08 12:31:27 UTC (rev 20457)
@@ -0,0 +1,433 @@
+/*
+ * 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.
+ */
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ /* SIMPLE INNER CLASS for handle switch operation*/
+ function SwitchItems(comp) {
+ this.comp = comp;
+ }
+
+ SwitchItems.prototype = {
+
+ /**
+ * @param {TogglePanelItem} oldPanel
+ * @param {TogglePanelItem} newPanel
+ *
+ * @return {void}
+ * */
+ exec : function (oldPanel, newPanel) {
+ if (newPanel.switchMode == "server") {
+ return this.execServer(oldPanel, newPanel);
+ } else if (newPanel.switchMode == "ajax") {
+ return this.execAjax(oldPanel, newPanel);
+ } else if (newPanel.switchMode == "client") {
+ return this.execClient(oldPanel, newPanel);
+ } else {
+ rf.log.error("SwitchItems.exec : unknown switchMode (" + this.comp.switchMode + ")");
+ }
+ },
+
+ /**
+ * @protected
+ * @param {TogglePanelItem} oldPanel
+ * @param {TogglePanelItem} newPanel
+ *
+ * @return {Boolean} false
+ * */
+ execServer : function (oldPanel, newPanel) {
+ if (oldPanel) {
+ var continueProcess = oldPanel.__leave();
+ if (!continueProcess) {
+ return false;
+ }
+ }
+
+ this.__setActiveItem(newPanel.getName());
+
+ rf.submitForm(this.__getParentForm());
+
+ return false;
+ },
+
+ /**
+ * @protected
+ * @param {TogglePanelItem} oldPanel
+ * @param {TogglePanelItem} newPanel
+ *
+ * @return {Boolean} false
+ * */
+ execAjax : function (oldPanel, newPanel) {
+ var options = $.extend({}, this.comp.options["ajax"], {}/*this.getParameters(newPanel)*/);
+
+ this.__setActiveItem(newPanel.getName());
+ rf.ajax(this.comp.id, null, options);
+
+ if (oldPanel) {
+ this.__setActiveItem(oldPanel.getName());
+ }
+
+ return false;
+ },
+
+ /**
+ * @protected
+ * @param {TogglePanelItem} oldPanel
+ * @param {TogglePanelItem} newPanel
+ *
+ * @return {undefined}
+ * - false - if process has been terminated
+ * - true - in other cases
+ * */
+ execClient : function (oldPanel, newPanel) {
+ if (oldPanel) {
+ var continueProcess = oldPanel.__leave();
+ if (!continueProcess) {
+ return false;
+ }
+ }
+
+ this.__setActiveItem(newPanel.getName());
+
+ newPanel.__enter();
+ this.comp.__fireItemChange(oldPanel, newPanel);
+
+ return true;
+ },
+
+ /**
+ * @private
+ * */
+ __getParentForm : function () {
+ return $(rf.getDomElement(this.comp.id)).parents('form:first');
+ },
+
+ /**
+ * @private
+ * */
+ __setActiveItem : function (name) {
+ rf.getDomElement(this.__getValueInputId()).value = name;
+ this.comp.activeItem = name;
+ },
+
+ /**
+ * @private
+ * */
+ __getValueInputId: function () {
+ return this.comp.id + "-value"
+ }
+ };
+
+ /**
+ * @class TogglePanel
+ * @name TogglePanel
+ *
+ * @constructor
+ * @param {String} componentId - component id
+ * @param {Hash} options - params
+ * */
+ rf.ui.TogglePanel = rf.BaseComponent.extendClass({
+
+ // class name
+ name:"TogglePanel",
+
+ init : function (componentId, options) {
+ $super.constructor.call(this, componentId);
+ this.attachToDom();
+
+ this.options = $.extend(this.options, options || {});
+ this.activeItem = this.options.activeItem;
+ this.items = this.options.items;
+
+ this.__addUserEventHandler("itemchange");
+ this.__addUserEventHandler("beforeitemchange");
+ },
+
+ /***************************** Public Methods ****************************************************************/
+
+ /**
+ * @methodOf
+ *
+ * @name TogglePanel#getSelectItem
+ *
+ * @return {String} name of current selected panel item
+ */
+ getSelectItem: function () {
+ return this.activeItem;
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanel#switchToItem
+ *
+ * @param {String} name - panel item name to switch
+ * we can use meta names @first, @prev, @next and @last
+ * @return {Boolean} - false if something wrong and true if all is ok
+ */
+ switchToItem: function (name) {
+ var newPanel = this.getNextItem(name);
+ if (newPanel == null) {
+ rf.log.warn("TogglePanel.switchToItems(" + name + "): item with name '" + name + "' not found");
+ return false;
+ }
+
+ var oldPanel = this.__getItemByName(this.getSelectItem());
+
+ var continueProcess = this.__fireBeforeItemChange(oldPanel, newPanel);
+ if (!continueProcess) {
+ rf.log.warn("TogglePanel.switchToItems(" + name + "): switch has been canceled by beforeItemChange event");
+ return false
+ }
+
+ return new SwitchItems(this).exec(oldPanel, newPanel);
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanel#getNextItem
+ *
+ * @param {String} name of TogglePanelItem or meta name (@first | @prev | @next | @last)
+ * @return {TogglePanelItem} null if item not found
+ */
+ getNextItem : function (name) {
+ if (name) {
+ var newItemIndex = this.__ITEMS_META_NAMES[name];
+ if (newItemIndex) {
+ return this.__getItem(newItemIndex(this));
+ } else {
+ return this.__getItemByName(name);
+ }
+ } else {
+ return this.__getItemByName(this.nextItem());
+ }
+ },
+
+ /**
+ * please, remove this method when client side ajax events will be added
+ *
+ * */
+ onCompleteHandler : function (newItemName) {
+ var oldItem = this.__getItemByName(this.activeItem);
+ var newItem = this.__getItemByName(newItemName);
+
+ // Don't do like this and remove it ASAP
+ new SwitchItems(this).execClient(oldItem, newItem);
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanel#getItems
+ *
+ * @return {TogglePanelItem[]} all defined panel items
+ */
+ getItems : function () {
+ return this.items;
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanel#getItemsNames
+ *
+ * @return {String[]} names of all defined items
+ */
+ getItemsNames: function () {
+ var res = [];
+ for (var item in this.items) {
+ res.push(this.items[item].getName());
+ }
+
+ return res;
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanel#nextItem
+ *
+ * @param {String} [itemName = activeItem]
+ * @return {String} name of next panel item
+ */
+ nextItem: function (itemName) {
+ var itemIndex = this.__getItemIndex(itemName || this.activeItem);
+ if (itemIndex == -1) {
+ return null;
+ }
+
+ return this.__getItemName(itemIndex + 1);
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanel#firstItem
+ *
+ * @return {String} name of first panel item
+ */
+ firstItem: function () {
+ return this.__getItemName(0);
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanel#lastItem
+ *
+ * @return {String} name of last panel item
+ */
+ lastItem: function () {
+ return this.__getItemName(this.items.length - 1);
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanel#prevItem
+ *
+ * @param {String} itemName
+ * @return {String} name of prev panel item
+ * null if it is first item
+ */
+ prevItem: function (itemName) {
+ var itemIndex = this.__getItemIndex(itemName || this.activeItem);
+ if (!this.options.cycledSwitching && itemIndex < 1) {
+ return null;
+ }
+
+ return this.__getItemName(itemIndex - 1);
+ },
+
+ /////////////////////////////////////////////////////////////////////////////////
+ //// Private
+ /////////////////////////////////////////////////////////////////////////////////
+
+ /********************* Methods *************************/
+
+ __ITEMS_META_NAMES : (function () {
+ function goFrom (comp, ind, step) {
+ var res = ind;
+ while ((!comp.items[res] || comp.items[res].disabled) && res < comp.items.length && res > 0) {
+ res += step;
+ }
+ return res;
+ }
+
+
+ return {
+ "@first" : function (comp) {
+ return goFrom(comp, 0, 1);
+ },
+
+ "@prev" : function (comp) {
+ return goFrom(comp, parseInt(comp.__getItemIndex(comp.activeItem)) - 1 , -1);
+ },
+
+ "@next" : function (comp) {
+ return goFrom(comp, parseInt(comp.__getItemIndex(comp.activeItem)) + 1 , 1);
+ },
+
+ "@last" : function (comp) {
+ return goFrom(comp, comp.items.length - 1, -1);
+ }
+ }
+ })(),
+
+ /**
+ * @private
+ * */
+ __getItemIndex : function (itemName) {
+ for (var i in this.items) {
+ if (!this.items[i].disabled && this.items[i].getName() === itemName) {
+ return parseInt(i);
+ }
+ }
+
+ rf.log.info("TogglePanel.getItemIndex: item with name '" + itemName + "' not found");
+ return -1;
+ },
+
+ /**
+ * @private
+ * */
+ __addUserEventHandler : function (name) {
+ var handler = this.options["on" + name];
+ if (handler) {
+ rf.Event.bindById(this.id, name, handler);
+ }
+ },
+
+ /**
+ * @private
+ * @param {Number} index - array index
+ *
+ * @return {TogglePanelItem}
+ * null - if item not found
+ * */
+ __getItem : function (index) {
+ if (this.options.cycledSwitching) {
+ var size = this.items.length;
+ return this.items[(size + index) % size]
+ } else if (index >= 0 && index < this.items.length) {
+ return this.items[index]
+ } else {
+ return null;
+ }
+ },
+
+ __getItemByName : function (name) {
+ return this.__getItem(this.__getItemIndex(name));
+ },
+
+ __getItemName : function (index) {
+ var item = this.__getItem(index);
+ if (item == null) {
+ return null;
+ }
+
+ return item.getName();
+ },
+
+ /**
+ * Fire Concealable Event
+ * */
+
+ __fireItemChange : function (oldItem, newItem) {
+ return new rf.Event.fireById(this.id, "itemchange", {
+ id: this.id,
+ oldItem : oldItem,
+ newItem : newItem
+ });
+ },
+
+ __fireBeforeItemChange : function (oldItem, newItem) {
+ return rf.Event.fireById(this.id, "beforeitemchange", {
+ id: this.id,
+ oldItem : oldItem,
+ newItem : newItem
+ });
+ },
+
+ destroy: function () {
+ $super.destroy.call(this);
+ }
+ });
+
+ // define super class link
+ var $super = rf.ui.TogglePanel.$super;
+})(jQuery, RichFaces);
Copied: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/togglePanelItem.js (from rev 20456, trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem_.js)
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/togglePanelItem.js (rev 0)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/togglePanelItem.js 2010-12-08 12:31:27 UTC (rev 20457)
@@ -0,0 +1,120 @@
+/*
+ * 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.
+ */
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.TogglePanelItem = rf.BaseComponent.extendClass({
+
+ // class name
+ name:"TogglePanelItem",
+
+ init : function (componentId, options) {
+ // call constructor of parent class
+ $super.constructor.call(this, componentId);
+ this.attachToDom();
+
+ this.options = $.extend(this.options, options || {});
+ this.name = this.options.name;
+ this.togglePanelId = this.options.togglePanelId;
+ this.switchMode = this.options.switchMode;
+ this.disabled = this.options.disabled || false;
+ },
+
+ /***************************** Public Methods *****************************************************************/
+ /**
+ * @methodOf TogglePanelItem
+ * @name TogglePanelItem#getName
+ *
+ * @return {String} panel item name
+ */
+ getName: function () {
+ return this.options.name;
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanelItem#getTogglePanel
+ *
+ * @return {TogglePanel} parent TogglePanel
+ * */
+ getTogglePanel : function () {
+ return rf.$(this.togglePanelId);
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanelItem#isSelected
+ *
+ * @return {Boolean} true if this panel item is selected in the parent toggle panel
+ * */
+ isSelected : function () {
+ return this.getName() == this.getTogglePanel().getSelectItem();
+ },
+
+
+ /***************************** Private Methods ****************************************************************/
+
+ /**
+ * @private
+ *
+ * used in TogglePanel
+ * */
+ __enter : function () {
+ rf.getDomElement(this.id).style.display = "block";
+
+ return this.__fireEnter();
+ },
+
+ /**
+ * @private
+ *
+ * used in TogglePanel
+ * */
+ __leave : function () {
+ var continueProcess = this.__fireLeave();
+ if (!continueProcess) {
+ return false;
+ }
+
+ rf.getDomElement(this.id).style.display = "none";
+ return true;
+ },
+
+ __fireLeave : function () {
+ return rf.Event.fireById(this.id, "__leave");
+ },
+
+ __fireEnter : function () {
+ return rf.Event.fireById(this.id, "__enter");
+ },
+
+ // class stuff
+ destroy: function () {
+ $super.destroy.call(this);
+ }
+ });
+
+ // define super class link
+ var $super = rf.ui.TogglePanelItem.$super;
+})(jQuery, RichFaces);
Copied: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tooltip.js (from rev 20456, trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tooltip_.js)
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tooltip.js (rev 0)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tooltip.js 2010-12-08 12:31:27 UTC (rev 20457)
@@ -0,0 +1,295 @@
+/*
+ * 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.
+ */
+
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.TooltipDirection = {
+ topRight : "topRight",
+ topLeft : "topLeft",
+ bottomRight : "bottomRight",
+ bottomLeft : "bottomLeft",
+ auto : "auto",
+
+ DEFAULT: "bottomRight"
+ };
+ var TooltipDirection = rf.ui.TooltipDirection;
+
+ rf.ui.TooltipMode = {
+ client : "client",
+ ajax : "ajax",
+
+ DEFAULT: "client"
+ };
+ var TooltipMode = rf.ui.TooltipMode;
+
+ var DEFAULT_OPTIONS = {
+ direction : TooltipDirection.DEFAULT,
+ attached : true,
+ offset : [],
+ mode : TooltipMode.DEFAULT,
+ disabled : false,
+ hideDelay : 0,
+ hideEvent : "mouseleave",
+ showDelay : 0,
+ showEvent : "mouseenter",
+ followMouse : true
+ };
+
+ var SHOW_ACTION = {
+
+ /**
+ *
+ * @return {void}
+ * */
+ exec : function (tooltip, event) {
+ var mode = tooltip.mode;
+ if (mode == TooltipMode.ajax) {
+ return this.execAjax(tooltip, event);
+ } else if (mode == TooltipMode.client) {
+ return this.execClient(tooltip, event);
+ } else {
+ rf.log.error("SHOW_ACTION.exec : unknown mode (" + mode + ")");
+ }
+ },
+
+ /**
+ * @protected
+ *
+ * @return {Boolean} false
+ * */
+ execAjax : function (tooltip, event) {
+ tooltip.__loading().show();
+ tooltip.__content().hide();
+ tooltip.__show(event);
+
+ rf.ajax(tooltip.id, null, $.extend({}, tooltip.options["ajax"], {}));
+
+ return true;
+ },
+
+ /**
+ * @protected
+ *
+ * @return {undefined}
+ * - false - if process has been terminated
+ * - true - in other cases
+ * */
+ execClient : function (tooltip, event) {
+ tooltip.__show(event);
+
+ return tooltip.__fireShow();
+ }
+ };
+
+ rf.ui.Tooltip = rf.BaseComponent.extendClass({
+ // class name
+ name:"Tooltip",
+
+ /**
+ * @class Tooltip
+ * @name Tooltip
+ *
+ * @constructor
+ * @param {String} componentId - component id
+ * @param {Hash} options - params
+ * */
+ init : function (componentId, options) {
+ $super.constructor.call(this, componentId);
+ this.options = $.extend(this.options, DEFAULT_OPTIONS, options || {});
+ this.attachToDom();
+
+ this.mode = this.options.mode;
+ this.target = this.options.target;
+
+ this.__addUserEventHandler("hide");
+ this.__addUserEventHandler("show");
+ this.__addUserEventHandler("beforehide");
+ this.__addUserEventHandler("beforeshow");
+
+ this.popup = new RichFaces.ui.Popup(this.id, {
+ attachTo: this.target,
+ attachToBody: false,
+ positionType: "TOOLTIP",
+ positionOffset: [200,200]
+ });
+
+ var tooltip = this;
+ function mouseMoveHandler(event) {
+ tooltip.popup.show(event);
+ }
+
+ $(document.getElementById(this.target)).bind(this.options.showEvent, function (event) {
+ tooltip.show(event);
+
+ if (tooltip.options.followMouse) {
+ $(document.getElementById(tooltip.target)).bind("mousemove", mouseMoveHandler);
+ }
+ });
+
+ $(document.getElementById(tooltip.target)).bind(this.options.hideEvent, function (event) {
+ tooltip.hide();
+
+ if (tooltip.options.followMouse) {
+ $(document.getElementById(tooltip.target)).unbind("mousemove", mouseMoveHandler);
+ }
+ });
+
+ },
+
+ /***************************** Public Methods ****************************************************************/
+ /**
+ * @methodOf
+ * @name PanelMenuItem#hide
+ *
+ * TODO ...
+ *
+ * @return {void} TODO ...
+ */
+ hide: function () {
+ var continueProcess = this.__fireBeforeHide();
+ if (!continueProcess) {
+ return false;
+ }
+
+ this.__hide();
+
+ return this.__fireHide()
+ },
+
+ /**
+ * @private
+ * @return {void} TODO ...
+ */
+ __hide: function () {
+ var tooltip = this;
+ this.__delay(this.options.hideDelay, function () {
+ tooltip.popup.hide();
+ });
+ },
+
+ /**
+ * @methodOf
+ * @name PanelMenuItem#show
+ *
+ * TODO ...
+ *
+ * @return {void} TODO ...
+ */
+ show: function (event) {
+ var continueProcess = this.__fireBeforeShow();
+ if (!continueProcess) {
+ return false;
+ }
+
+ SHOW_ACTION.exec(this, event);
+ },
+
+ onCompleteHandler : function () {
+ this.__content().show();
+ this.__loading().hide();
+
+ return this.__fireShow();
+ },
+
+ /**
+ * @private
+ * @return {void} TODO ...
+ */
+ __show: function (event) {
+ var tooltip = this;
+ this.__delay(this.options.showDelay, function () {
+ tooltip.popup.show(event);
+ });
+ },
+
+ /***************************** Private Methods ****************************************************************/
+ __delay : function (delay, action) {
+ if (delay > 0) {
+ var hidingTimerHandle = window.setTimeout(function() {
+ action();
+
+ if (hidingTimerHandle) {
+ window.clearTimeout(hidingTimerHandle);
+ hidingTimerHandle = undefined;
+ }
+ }, delay);
+ } else {
+ action();
+ }
+ },
+
+ __detectAncestorNode: function(leaf, element) {
+ // Return true if "element" is "leaf" or one of its parents
+ var node = leaf;
+ while (node != null && node != element) {
+ node = node.parentNode;
+ }
+ return (node != null);
+ },
+
+ __loading : function () {
+ return $(document.getElementById(this.id + ":loading"));
+ },
+
+ __content : function () {
+ return $(document.getElementById(this.id + "@content"));
+ },
+
+ __fireHide : function () {
+ return rf.Event.fireById(this.id, "hide", { id: this.id });
+ },
+
+ __fireShow : function () {
+ return rf.Event.fireById(this.id, "show", { id: this.id });
+ },
+
+ __fireBeforeHide : function () {
+ return rf.Event.fireById(this.id, "beforehide", { id: this.id });
+ },
+
+ __fireBeforeShow : function () {
+ return rf.Event.fireById(this.id, "beforeshow", { id: this.id });
+ },
+
+
+
+ /**
+ * @private
+ * */
+ __addUserEventHandler : function (name) {
+ var handler = this.options["on" + name];
+ if (handler) {
+ rf.Event.bindById(this.id, name, handler);
+ }
+ },
+
+ destroy: function () {
+ $super.destroy.call(this);
+ }
+ });
+
+ // define super class link
+ var $super = rf.ui.Tooltip.$super;
+})(jQuery, RichFaces);
14 years, 1 month
JBoss Rich Faces SVN: r20456 - in trunk/ui/output/ui/src/main: resources/META-INF/resources/org.richfaces and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-12-08 07:27:08 -0500 (Wed, 08 Dec 2010)
New Revision: 20456
Added:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem_.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Accordion_.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem_.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel_.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenuGroup_.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenuItem_.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenu_.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TabPanel_.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tab_.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem_.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel_.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tooltip_.js
Removed:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Accordion.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenu.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenuGroup.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenuItem.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tab.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TabPanel.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tooltip.js
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelItemRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java
Log:
RF-9608 - Rename JavaScript resources to lower case
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java 2010-12-08 12:24:06 UTC (rev 20455)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java 2010-12-08 12:27:08 UTC (rev 20456)
@@ -22,7 +22,6 @@
package org.richfaces.renderkit.html;
-import static org.richfaces.component.util.HtmlUtil.concatClasses;
import static org.richfaces.renderkit.RenderKitUtils.renderPassThroughAttributes;
import java.io.IOException;
@@ -63,8 +62,8 @@
@ResourceDependency(name = "richfaces.js"),
@ResourceDependency(name = "richfaces-event.js"),
@ResourceDependency(name = "richfaces-base-component.js"),
- @ResourceDependency(library = "org.richfaces", name = "TogglePanelItem.js"),
- @ResourceDependency(library = "org.richfaces", name = "AccordionItem.js")
+ @ResourceDependency(library = "org.richfaces", name = "TogglePanelItem_.js"),
+ @ResourceDependency(library = "org.richfaces", name = "AccordionItem_.js")
})
public class AccordionItemRenderer extends TogglePanelItemRenderer {
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java 2010-12-08 12:24:06 UTC (rev 20455)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java 2010-12-08 12:27:08 UTC (rev 20456)
@@ -46,8 +46,8 @@
@ResourceDependency(name = "richfaces.js"),
@ResourceDependency(name = "richfaces-base-component.js"),
@ResourceDependency(library = "org.richfaces", name = "accordion.ecss"),
- @ResourceDependency(library = "org.richfaces", name = "TogglePanel.js"),
- @ResourceDependency(library = "org.richfaces", name = "Accordion.js") })
+ @ResourceDependency(library = "org.richfaces", name = "TogglePanel_.js"),
+ @ResourceDependency(library = "org.richfaces", name = "Accordion_.js") })
public class AccordionRenderer extends TogglePanelRenderer {
@Override
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java 2010-12-08 12:24:06 UTC (rev 20455)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java 2010-12-08 12:27:08 UTC (rev 20456)
@@ -38,8 +38,6 @@
import java.util.Map;
import static org.richfaces.component.AbstractCollapsiblePanel.States.*;
-import static org.richfaces.component.util.HtmlUtil.concatClasses;
-import static org.richfaces.component.util.HtmlUtil.concatStyles;
/**
* @author akolonitsky
@@ -51,10 +49,10 @@
@ResourceDependency(name = "richfaces.js"),
@ResourceDependency(name = "richfaces-event.js"),
@ResourceDependency(name = "richfaces-base-component.js"),
- @ResourceDependency(library = "org.richfaces", name = "TogglePanel.js"),
- @ResourceDependency(library = "org.richfaces", name = "TogglePanelItem.js"),
- @ResourceDependency(library = "org.richfaces", name = "CollapsiblePanel.js"),
- @ResourceDependency(library = "org.richfaces", name = "CollapsiblePanelItem.js"),
+ @ResourceDependency(library = "org.richfaces", name = "TogglePanel_.js"),
+ @ResourceDependency(library = "org.richfaces", name = "TogglePanelItem_.js"),
+ @ResourceDependency(library = "org.richfaces", name = "CollapsiblePanel_.js"),
+ @ResourceDependency(library = "org.richfaces", name = "CollapsiblePanelItem_.js"),
@ResourceDependency(library = "org.richfaces", name = "collapsiblePanel.ecss") })
public class CollapsiblePanelRenderer extends TogglePanelRenderer {
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java 2010-12-08 12:24:06 UTC (rev 20455)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java 2010-12-08 12:27:08 UTC (rev 20456)
@@ -40,7 +40,6 @@
import java.util.HashMap;
import java.util.Map;
-import static org.richfaces.component.util.HtmlUtil.concatClasses;
import static org.richfaces.renderkit.html.TogglePanelRenderer.getAjaxOptions;
import static org.richfaces.renderkit.html.TogglePanelRenderer.getValueRequestParamName;
@@ -54,9 +53,9 @@
@ResourceDependency(name = "richfaces.js"),
@ResourceDependency(name = "richfaces-event.js"),
@ResourceDependency(name = "richfaces-base-component.js"),
- @ResourceDependency(library = "org.richfaces", name = "PanelMenu.js"),
- @ResourceDependency(library = "org.richfaces", name = "PanelMenuItem.js"),
- @ResourceDependency(library = "org.richfaces", name = "PanelMenuGroup.js"),
+ @ResourceDependency(library = "org.richfaces", name = "PanelMenu_.js"),
+ @ResourceDependency(library = "org.richfaces", name = "PanelMenuItem_.js"),
+ @ResourceDependency(library = "org.richfaces", name = "PanelMenuGroup_.js"),
@ResourceDependency(library = "org.richfaces", name = "panelMenu.ecss") })
public class PanelMenuRenderer extends DivPanelRenderer {
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java 2010-12-08 12:24:06 UTC (rev 20455)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java 2010-12-08 12:27:08 UTC (rev 20456)
@@ -26,8 +26,6 @@
import static org.richfaces.component.AbstractTogglePanelTitledItem.HeaderStates.disabled;
import static org.richfaces.component.AbstractTogglePanelTitledItem.HeaderStates.inactive;
import static org.richfaces.component.html.HtmlAccordion.PropertyKeys.height;
-import static org.richfaces.component.util.HtmlUtil.concatClasses;
-import static org.richfaces.component.util.HtmlUtil.concatStyles;
import static org.richfaces.renderkit.RenderKitUtils.renderPassThroughAttributes;
import java.io.IOException;
@@ -60,8 +58,8 @@
@ResourceDependency(name = "richfaces-event.js"),
@ResourceDependency(name = "richfaces-base-component.js"),
@ResourceDependency(library = "org.richfaces", name = "tabPanel.ecss"),
- @ResourceDependency(library = "org.richfaces", name = "TogglePanel.js"),
- @ResourceDependency(library = "org.richfaces", name = "TabPanel.js")
+ @ResourceDependency(library = "org.richfaces", name = "TogglePanel_.js"),
+ @ResourceDependency(library = "org.richfaces", name = "TabPanel_.js")
})
public class TabPanelRenderer extends TogglePanelRenderer {
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabRenderer.java 2010-12-08 12:24:06 UTC (rev 20455)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabRenderer.java 2010-12-08 12:27:08 UTC (rev 20456)
@@ -22,8 +22,6 @@
package org.richfaces.renderkit.html;
-import static org.richfaces.component.util.HtmlUtil.concatClasses;
-
import java.io.IOException;
import java.util.Map;
@@ -47,8 +45,8 @@
@ResourceDependency(name = "richfaces.js"),
@ResourceDependency(name = "richfaces-event.js"),
@ResourceDependency(name = "richfaces-base-component.js"),
- @ResourceDependency(library = "org.richfaces", name = "TogglePanelItem.js"),
- @ResourceDependency(library = "org.richfaces", name = "Tab.js")
+ @ResourceDependency(library = "org.richfaces", name = "TogglePanelItem_.js"),
+ @ResourceDependency(library = "org.richfaces", name = "Tab_.js")
})
public class TabRenderer extends TogglePanelItemRenderer {
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelItemRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelItemRenderer.java 2010-12-08 12:24:06 UTC (rev 20455)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelItemRenderer.java 2010-12-08 12:27:08 UTC (rev 20456)
@@ -46,7 +46,7 @@
@ResourceDependency(name = "richfaces.js"),
@ResourceDependency(name = "richfaces-event.js"),
@ResourceDependency(name = "richfaces-base-component.js"),
- @ResourceDependency(library = "org.richfaces", name = "TogglePanelItem.js") })
+ @ResourceDependency(library = "org.richfaces", name = "TogglePanelItem_.js") })
public class TogglePanelItemRenderer extends DivPanelRenderer {
private static final String LEAVE = "leave";
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2010-12-08 12:24:06 UTC (rev 20455)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2010-12-08 12:27:08 UTC (rev 20456)
@@ -57,7 +57,7 @@
@ResourceDependency(name = "richfaces.js"),
@ResourceDependency(name = "richfaces-event.js"),
@ResourceDependency(name = "richfaces-base-component.js"),
- @ResourceDependency(library = "org.richfaces", name = "TogglePanel.js") })
+ @ResourceDependency(library = "org.richfaces", name = "TogglePanel_.js") })
public class TogglePanelRenderer extends DivPanelRenderer {
public static final String VALUE_POSTFIX = "-value";
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java 2010-12-08 12:24:06 UTC (rev 20455)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java 2010-12-08 12:27:08 UTC (rev 20456)
@@ -58,7 +58,7 @@
@ResourceDependency(name = "richfaces-event.js"),
@ResourceDependency(name = "richfaces-base-component.js"),
@ResourceDependency(library = "org.richfaces", name = "popup.js"),
- @ResourceDependency(library = "org.richfaces", name = "Tooltip.js"),
+ @ResourceDependency(library = "org.richfaces", name = "Tooltip_.js"),
@ResourceDependency(library = "org.richfaces", name = "tooltip.ecss") })
public class TooltipRenderer extends DivPanelRenderer implements MetaComponentRenderer {
Deleted: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Accordion.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Accordion.js 2010-12-08 12:24:06 UTC (rev 20455)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Accordion.js 2010-12-08 12:27:08 UTC (rev 20456)
@@ -1,75 +0,0 @@
-/*
- * 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.
- */
-
-(function ($, rf) {
-
- rf.ui = rf.ui || {};
-
- rf.ui.Accordion = rf.ui.TogglePanel.extendClass({
- // class name
- name:"Accordion",
-
- /**
- * @class Accordion
- * @name Accordion
- *
- * @constructor
- * @param {String} componentId - component id
- * @param {Hash} options - params
- * */
- init : function (componentId, options) {
- $super.constructor.call(this, componentId, options);
- this.items = [];
-
- this.isKeepHeight = options["isKeepHeight"] || false
- },
-
- /***************************** Public Methods ****************************************************************/
-
- getHeight : function (recalculate) {
- if (recalculate || !this.__height) {
- this.__height = $(rf.getDomElement(this.id)).outerHeight(true)
- }
-
- return this.__height;
- },
-
- getInnerHeight : function (recalculate) {
- if (recalculate || !this.__innerHeight) {
- this.__innerHeight = $(rf.getDomElement(this.id)).innerHeight(true)
- }
-
- return this.__innerHeight;
- },
-
- /***************************** Private Methods ********************************************************/
-
-
- destroy: function () {
- rf.Event.unbindById(this.id, "." + this.namespace);
- $super.destroy.call(this);
- }
- });
-
- // define super class link
- var $super = rf.ui.Accordion.$super;
-})(jQuery, RichFaces);
Deleted: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js 2010-12-08 12:24:06 UTC (rev 20455)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js 2010-12-08 12:27:08 UTC (rev 20456)
@@ -1,158 +0,0 @@
-/*
- * 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.
- */
-
-(function ($, rf) {
-
- rf.ui = rf.ui || {};
-
- rf.ui.AccordionItem = rf.ui.TogglePanelItem.extendClass({
- // class name
- name:"AccordionItem",
-
- /**
- * @class AccordionItem
- * @name AccordionItem
- *
- * @constructor
- * @param {String} componentId - component id
- * @param {Hash} options - params
- * */
- init : function (componentId, options) {
- $super.constructor.call(this, componentId, options);
- this.index = options["index"];
- this.getTogglePanel().getItems()[this.index] = this;
-
- if (!this.disabled) {
- rf.Event.bindById(this.id + ":header", "click", this.__onHeaderClick, this);
- }
-
- if (this.isSelected()) {
- var item = this;
- $(document).ready(function () {
- item.__fitToHeight(item.getTogglePanel());
- });
- }
- },
-
- /***************************** Public Methods ****************************************************************/
-
- __onHeaderClick : function (comp) {
- this.getTogglePanel().switchToItem(this.getName());
- },
-
- /**
- * @param state {string} = inactive | active | disabled
- * in that case looking header by css class appropriate to this state
- *
- * @return {jQuery Object}
- * */
- __header : function (state) {
- var res = $(rf.getDomElement(this.id + ":header"));
- if (state) {
- return res.find(".rf-ac-itm-hdr-" + state);
- }
-
- return res;
- },
-
- /**
- * @return {jQuery Object}
- * */
- __content : function () {
- if (!this.__content_) {
- this.__content_ = $(rf.getDomElement(this.id + ":content"));
- }
- return this.__content_;
- },
-
- /**
- * @private
- *
- * used in TogglePanel
- * */
- __enter : function () {
- var parentPanel = this.getTogglePanel();
- if (parentPanel.isKeepHeight) {
- this.__content().hide(); // TODO ?
- this.__fitToHeight(parentPanel);
- }
-
- this.__content().show();
- this.__header("inact").hide();
- this.__header("act").show();
-
- return this.__fireEnter();
- },
-
- __fitToHeight : function (parentPanel) {
- var h = parentPanel.getInnerHeight();
-
- var items = parentPanel.getItems();
- for (var i in items) {
- h -= items[i].__header().outerHeight();
- }
-
- this.__content().height(h - 20); // 20 it is padding top and bottom
- },
-
- getHeight : function (recalculate) {
- if (recalculate || !this.__height) {
- this.__height = $(rf.getDomElement(this.id)).outerHeight(true)
- }
-
- return this.__height;
- },
-
- /**
- * @private
- *
- * used in TogglePanel
- * */
- __leave : function () {
- var continueProcess = this.__fireLeave();
- if (!continueProcess) {
- return false;
- }
-
- this.__content().hide();
- this.__header("act").hide();
- this.__header("inact").show();
-
- return true;
- },
-
- /***************************** Private Methods ********************************************************/
-
-
- destroy: function () {
- var parent = this.getTogglePanel();
- delete parent.getItems()[this.index];
-
- rf.Event.unbindById(this.id, "."+this.namespace);
-
- $super.destroy.call(this);
- }
- });
-
- // define super class link
- var $super = rf.ui.AccordionItem.$super;
-})(jQuery, RichFaces);
Copied: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem_.js (from rev 20398, trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js)
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem_.js (rev 0)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem_.js 2010-12-08 12:27:08 UTC (rev 20456)
@@ -0,0 +1,158 @@
+/*
+ * 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.
+ */
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.AccordionItem = rf.ui.TogglePanelItem.extendClass({
+ // class name
+ name:"AccordionItem",
+
+ /**
+ * @class AccordionItem
+ * @name AccordionItem
+ *
+ * @constructor
+ * @param {String} componentId - component id
+ * @param {Hash} options - params
+ * */
+ init : function (componentId, options) {
+ $super.constructor.call(this, componentId, options);
+ this.index = options["index"];
+ this.getTogglePanel().getItems()[this.index] = this;
+
+ if (!this.disabled) {
+ rf.Event.bindById(this.id + ":header", "click", this.__onHeaderClick, this);
+ }
+
+ if (this.isSelected()) {
+ var item = this;
+ $(document).ready(function () {
+ item.__fitToHeight(item.getTogglePanel());
+ });
+ }
+ },
+
+ /***************************** Public Methods ****************************************************************/
+
+ __onHeaderClick : function (comp) {
+ this.getTogglePanel().switchToItem(this.getName());
+ },
+
+ /**
+ * @param state {string} = inactive | active | disabled
+ * in that case looking header by css class appropriate to this state
+ *
+ * @return {jQuery Object}
+ * */
+ __header : function (state) {
+ var res = $(rf.getDomElement(this.id + ":header"));
+ if (state) {
+ return res.find(".rf-ac-itm-hdr-" + state);
+ }
+
+ return res;
+ },
+
+ /**
+ * @return {jQuery Object}
+ * */
+ __content : function () {
+ if (!this.__content_) {
+ this.__content_ = $(rf.getDomElement(this.id + ":content"));
+ }
+ return this.__content_;
+ },
+
+ /**
+ * @private
+ *
+ * used in TogglePanel
+ * */
+ __enter : function () {
+ var parentPanel = this.getTogglePanel();
+ if (parentPanel.isKeepHeight) {
+ this.__content().hide(); // TODO ?
+ this.__fitToHeight(parentPanel);
+ }
+
+ this.__content().show();
+ this.__header("inact").hide();
+ this.__header("act").show();
+
+ return this.__fireEnter();
+ },
+
+ __fitToHeight : function (parentPanel) {
+ var h = parentPanel.getInnerHeight();
+
+ var items = parentPanel.getItems();
+ for (var i in items) {
+ h -= items[i].__header().outerHeight();
+ }
+
+ this.__content().height(h - 20); // 20 it is padding top and bottom
+ },
+
+ getHeight : function (recalculate) {
+ if (recalculate || !this.__height) {
+ this.__height = $(rf.getDomElement(this.id)).outerHeight(true)
+ }
+
+ return this.__height;
+ },
+
+ /**
+ * @private
+ *
+ * used in TogglePanel
+ * */
+ __leave : function () {
+ var continueProcess = this.__fireLeave();
+ if (!continueProcess) {
+ return false;
+ }
+
+ this.__content().hide();
+ this.__header("act").hide();
+ this.__header("inact").show();
+
+ return true;
+ },
+
+ /***************************** Private Methods ********************************************************/
+
+
+ destroy: function () {
+ var parent = this.getTogglePanel();
+ delete parent.getItems()[this.index];
+
+ rf.Event.unbindById(this.id, "."+this.namespace);
+
+ $super.destroy.call(this);
+ }
+ });
+
+ // define super class link
+ var $super = rf.ui.AccordionItem.$super;
+})(jQuery, RichFaces);
Copied: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Accordion_.js (from rev 20398, trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Accordion.js)
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Accordion_.js (rev 0)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Accordion_.js 2010-12-08 12:27:08 UTC (rev 20456)
@@ -0,0 +1,75 @@
+/*
+ * 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.
+ */
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.Accordion = rf.ui.TogglePanel.extendClass({
+ // class name
+ name:"Accordion",
+
+ /**
+ * @class Accordion
+ * @name Accordion
+ *
+ * @constructor
+ * @param {String} componentId - component id
+ * @param {Hash} options - params
+ * */
+ init : function (componentId, options) {
+ $super.constructor.call(this, componentId, options);
+ this.items = [];
+
+ this.isKeepHeight = options["isKeepHeight"] || false
+ },
+
+ /***************************** Public Methods ****************************************************************/
+
+ getHeight : function (recalculate) {
+ if (recalculate || !this.__height) {
+ this.__height = $(rf.getDomElement(this.id)).outerHeight(true)
+ }
+
+ return this.__height;
+ },
+
+ getInnerHeight : function (recalculate) {
+ if (recalculate || !this.__innerHeight) {
+ this.__innerHeight = $(rf.getDomElement(this.id)).innerHeight(true)
+ }
+
+ return this.__innerHeight;
+ },
+
+ /***************************** Private Methods ********************************************************/
+
+
+ destroy: function () {
+ rf.Event.unbindById(this.id, "." + this.namespace);
+ $super.destroy.call(this);
+ }
+ });
+
+ // define super class link
+ var $super = rf.ui.Accordion.$super;
+})(jQuery, RichFaces);
Deleted: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js 2010-12-08 12:24:06 UTC (rev 20455)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js 2010-12-08 12:27:08 UTC (rev 20456)
@@ -1,82 +0,0 @@
-/*
- * 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.
- */
-
-(function ($, rf) {
-
- rf.ui = rf.ui || {};
-
- rf.ui.CollapsiblePanel = rf.ui.TogglePanel.extendClass({
-
- name:"CollapsiblePanel",
-
- /**
- * @class CollapsiblePanel
- * @name CollapsiblePanel
- *
- * @constructor
- * @param {String} componentId - component id
- * @param {Hash} options - params
- * */
- init : function (componentId, options) {
- rf.ui.TogglePanel.call(this, componentId, options);
- this.switchMode = options.switchMode;
-
- this.__addUserEventHandler("beforeswitch");
- this.__addUserEventHandler("switch");
-
- this.items = [
- new RichFaces.ui.CollapsiblePanelItem(
- this.id + ":content", {"index":0, "togglePanelId":this.id, "switchMode":this.switchMode, "name":"true"}),
-
- new RichFaces.ui.CollapsiblePanelItem(
- this.id + ":empty", {"index":1, "togglePanelId":this.id, "switchMode":this.switchMode, "name":"false"})
- ];
- this.options.cycledSwitching = true;
-
- rf.Event.bindById(this.id + ":header", "click", this.__onHeaderClick, this)
- },
-
- switchPanel : function (to) {
- this.switchToItem(to || "@next");
- },
-
- /***************************** Private Methods ********************************************************/
-
- __onHeaderClick : function () {
- this.switchToItem("@next");
- },
-
- __fireItemChange : function (oldItem, newItem) {
- return new rf.Event.fireById(this.id, "switch", {
- id: this.id,
- isExpanded : newItem.getName()
- });
- },
-
- __fireBeforeItemChange : function (oldItem, newItem) {
- return rf.Event.fireById(this.id, "beforeswitch", {
- id: this.id,
- isExpanded : newItem.getName()
- });
- }
- });
-})(jQuery, RichFaces);
Deleted: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem.js 2010-12-08 12:24:06 UTC (rev 20455)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem.js 2010-12-08 12:27:08 UTC (rev 20456)
@@ -1,60 +0,0 @@
-/*
- * 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.
- */
-
-(function ($, rf) {
-
- rf.ui = rf.ui || {};
-
- rf.ui.CollapsiblePanelItem = rf.ui.TogglePanelItem.extendClass({
-
- init : function (componentId, options) {
- rf.ui.TogglePanelItem.call(this, componentId, options);
- },
-
- __enter : function () {
- rf.getDomElement(this.id).style.display = "block";
- this.__header(this.__state()).show();
-
- return true;
- },
-
- __leave : function () {
- rf.getDomElement(this.id).style.display = "none";
- this.__header(this.__state()).hide();
-
- return true;
- },
-
- __state : function () {
- return this.getName() === "true" ? "exp" : "colps";
- },
-
- __header : function (state) {
- var res = $(rf.getDomElement(this.togglePanelId + ":header"));
- if (state) {
- return res.find(".rf-cp-hdr-" + state);
- }
-
- return res;
- }
- });
-})(jQuery, RichFaces);
Copied: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem_.js (from rev 20398, trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem.js)
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem_.js (rev 0)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem_.js 2010-12-08 12:27:08 UTC (rev 20456)
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.CollapsiblePanelItem = rf.ui.TogglePanelItem.extendClass({
+
+ init : function (componentId, options) {
+ rf.ui.TogglePanelItem.call(this, componentId, options);
+ },
+
+ __enter : function () {
+ rf.getDomElement(this.id).style.display = "block";
+ this.__header(this.__state()).show();
+
+ return true;
+ },
+
+ __leave : function () {
+ rf.getDomElement(this.id).style.display = "none";
+ this.__header(this.__state()).hide();
+
+ return true;
+ },
+
+ __state : function () {
+ return this.getName() === "true" ? "exp" : "colps";
+ },
+
+ __header : function (state) {
+ var res = $(rf.getDomElement(this.togglePanelId + ":header"));
+ if (state) {
+ return res.find(".rf-cp-hdr-" + state);
+ }
+
+ return res;
+ }
+ });
+})(jQuery, RichFaces);
Copied: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel_.js (from rev 20398, trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js)
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel_.js (rev 0)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel_.js 2010-12-08 12:27:08 UTC (rev 20456)
@@ -0,0 +1,82 @@
+/*
+ * 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.
+ */
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.CollapsiblePanel = rf.ui.TogglePanel.extendClass({
+
+ name:"CollapsiblePanel",
+
+ /**
+ * @class CollapsiblePanel
+ * @name CollapsiblePanel
+ *
+ * @constructor
+ * @param {String} componentId - component id
+ * @param {Hash} options - params
+ * */
+ init : function (componentId, options) {
+ rf.ui.TogglePanel.call(this, componentId, options);
+ this.switchMode = options.switchMode;
+
+ this.__addUserEventHandler("beforeswitch");
+ this.__addUserEventHandler("switch");
+
+ this.items = [
+ new RichFaces.ui.CollapsiblePanelItem(
+ this.id + ":content", {"index":0, "togglePanelId":this.id, "switchMode":this.switchMode, "name":"true"}),
+
+ new RichFaces.ui.CollapsiblePanelItem(
+ this.id + ":empty", {"index":1, "togglePanelId":this.id, "switchMode":this.switchMode, "name":"false"})
+ ];
+ this.options.cycledSwitching = true;
+
+ rf.Event.bindById(this.id + ":header", "click", this.__onHeaderClick, this)
+ },
+
+ switchPanel : function (to) {
+ this.switchToItem(to || "@next");
+ },
+
+ /***************************** Private Methods ********************************************************/
+
+ __onHeaderClick : function () {
+ this.switchToItem("@next");
+ },
+
+ __fireItemChange : function (oldItem, newItem) {
+ return new rf.Event.fireById(this.id, "switch", {
+ id: this.id,
+ isExpanded : newItem.getName()
+ });
+ },
+
+ __fireBeforeItemChange : function (oldItem, newItem) {
+ return rf.Event.fireById(this.id, "beforeswitch", {
+ id: this.id,
+ isExpanded : newItem.getName()
+ });
+ }
+ });
+})(jQuery, RichFaces);
Deleted: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenu.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenu.js 2010-12-08 12:24:06 UTC (rev 20455)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenu.js 2010-12-08 12:27:08 UTC (rev 20456)
@@ -1,211 +0,0 @@
-/*
- * 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.
- */
-
-
-(function ($, rf) {
-
- rf.ui = rf.ui || {};
-
- var __DEFAULT_OPTIONS = {
- expandSingle : true
- };
-
- rf.ui.PanelMenu = rf.BaseComponent.extendClass({
- // class name
- name:"PanelMenu",
-
- /**
- * @class PanelMenu
- * @name PanelMenu
- *
- * @constructor
- * @param {String} componentId - component id
- * @param {Hash} options - params
- * */
- init : function (componentId, options) {
- $super.constructor.call(this, componentId);
- this.items = [];
- this.attachToDom();
-
- this.options = $.extend(this.options, __DEFAULT_OPTIONS, options || {});
- this.activeItem = this.__getValueInput().value;
- this.nestingLevel = 0;
-
- var menuGroup = this;
- if (menuGroup.options.expandSingle) {
- menuGroup.__panelMenu().bind("expand", function (event) {
- menuGroup.__childGroups().each (function (index, group) {
- if (event.target.id != group.id) {
- rf.$(group.id).collapse();
- }
- });
-
- event.stopPropagation();
- });
- }
-
- if (menuGroup.activeItem) {
- this.__panelMenu().ready(function () {
- var item = menuGroup.items[menuGroup.activeItem];
- item.__select();
- item.__fireSelect();
- })
- }
-
- this.__addUserEventHandler("collapse");
- this.__addUserEventHandler("expand");
- },
-
- getItems: function () {
- return this.items;
- },
-
- getItem: function (name) {
- return this.items[name];
- },
-
- /***************************** Public Methods ****************************************************************/
- /**
- * @methodOf
- * @name PanelMenu#selectItem
- *
- * TODO ...
- *
- * @param {String} name
- * @return {void} TODO ...
- */
- selectItem: function (name) {
- // TODO implement
- },
-
- /**
- * @methodOf
- * @name PanelMenu#selectedItem
- *
- * TODO ...
- *
- * @return {String} TODO ...
- */
- selectedItem: function (id) {
- if (id != undefined) {
- var valueInput = this.__getValueInput();
- var prevActiveItem = valueInput.value;
-
- this.activeItem = id;
- valueInput.value = id;
-
- return prevActiveItem;
- } else {
- return this.activeItem;
- }
- },
-
- __getValueInput : function() {
- return document.getElementById(this.id + "-value");
- },
-
- selectItem: function (itemName) {
- // TODO
- },
-
- /**
- * @methodOf
- * @name PanelMenu#expandAll
- *
- * TODO ...
- *
- * @return {void} TODO ...
- */
- expandAll: function () {
- // TODO implement
- },
-
- /**
- * @methodOf
- * @name PanelMenu#collapseAll
- *
- * TODO ...
- *
- * @return {void} TODO ...
- */
- collapseAll: function () {
- // TODO implement
- },
-
- /**
- * @methodOf
- * @name PanelMenu#expandGroup
- *
- * TODO ...
- *
- * @param {String} groupName
- * @return {void} TODO ...
- */
- expandGroup: function (groupName) {
- // TODO implement
- },
-
- /**
- * @methodOf
- * @name PanelMenu#collapseGroup
- *
- * TODO ...
- *
- * @param {String} groupName
- * @return {void} TODO ...
- */
- collapseGroup: function (groupName) {
- // TODO implement
- },
-
-
- /***************************** Private Methods ****************************************************************/
-
-
- __panelMenu : function () {
- return $(rf.getDomElement(this.id));
- },
-
- __childGroups : function () {
- return this.__panelMenu().children(".rf-pm-top-gr")
- },
-
- /**
- * @private
- * */
- __addUserEventHandler : function (name) {
- var handler = this.options["on" + name];
- if (handler) {
- rf.Event.bindById(this.id, name, handler);
- }
- },
-
- destroy: function () {
- rf.Event.unbindById(this.id, "."+this.namespace);
- $super.destroy.call(this);
- }
- });
-
- // define super class link
- var $super = rf.ui.PanelMenu.$super;
-
-})(jQuery, RichFaces);
Deleted: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenuGroup.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenuGroup.js 2010-12-08 12:24:06 UTC (rev 20455)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenuGroup.js 2010-12-08 12:27:08 UTC (rev 20456)
@@ -1,365 +0,0 @@
-/*
- * 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.
- */
-
-
-(function ($, rf) {
-
- rf.ui = rf.ui || {};
-
- var __DEFAULT_OPTIONS = {
- expanded : false,
- expandSingle : true,
- bubbleSelection : true,
- stylePrefix : "rf-pm-gr",
-
- // TODO we should use selectionType = {none, selectable, unselectable}
- selectable : false,
- unselectable : false // unselectable can be only selectable item => if selectable == false than unselectable = false
- };
-
- var EXPAND_ITEM = {
-
- /**
- *
- * @return {void}
- * */
- exec : function (group, expand) {
- var mode = group.mode;
- if (mode == "server") {
- return this.execServer(group);
- } else if (mode == "ajax") {
- return this.execAjax(group);
- } else if (mode == "client" || mode == "none") {
- return this.execClient(group, expand);
- } else {
- rf.log.error("EXPAND_ITEM.exec : unknown mode (" + mode + ")");
- }
- },
-
- /**
- * @protected
- *
- * @return {Boolean} false
- * */
- execServer : function (group) {
- group.__changeState();
- rf.submitForm(this.__getParentForm(group));
-
- return false;
- },
-
- /**
- * @protected
- *
- * @return {Boolean} false
- * */
- execAjax : function (group) {
- var oldState = group.__changeState();
- rf.ajax(group.id, null, $.extend({}, group.options["ajax"], {}));
- group.__restoreState(oldState);
-
- return true;
- },
-
- /**
- * @protected
- *
- * @param {PanelMenuGroup} group
- * @param {Boolean} expand
- * @return {undefined}
- * - false - if process has been terminated
- * - true - in other cases
- * */
- execClient : function (group, expand) {
- if (expand) {
- group.expand();
- } else {
- group.collapse();
- }
-
- return group.__fireSwitch();
- },
-
- /**
- * @private
- * */
- __getParentForm : function (item) {
- return $($(rf.getDomElement(item.id)).parents("form")[0]);
- }
- };
-
- rf.ui.PanelMenuGroup = rf.ui.PanelMenuItem.extendClass({
- // class name
- name:"PanelMenuGroup",
-
- /**
- * @class PanelMenuGroup
- * @name PanelMenuGroup
- *
- * @constructor
- * @param {String} componentId - component id
- * @param {Hash} options - params
- * */
- init : function (componentId, options) {
- $super.constructor.call(this, componentId);
- this.options = $.extend(this.options, __DEFAULT_OPTIONS, options || {});
-
- if (!this.options.disabled) {
- var menuGroup = this;
-
- if (!this.options.selectable) {
- this.__header().bind("click", function () {
- return menuGroup.switchExpantion();
- });
- }
-
- if (this.options.selectable || this.options.bubbleSelection) {
- this.__content().bind("select", function (event) {
- if (menuGroup.options.selectable && menuGroup.__isMyEvent(event)) {
- menuGroup.expand();
- }
-
- if (menuGroup.options.bubbleSelection && !menuGroup.__isMyEvent(event)) {
- menuGroup.__select();
- if (!menuGroup.expanded()) {
- menuGroup.expand();
- }
- }
- });
-
- this.__content().bind("unselect", function (event) {
- if (menuGroup.options.selectable && menuGroup.__isMyEvent(event)) {
- menuGroup.collapse();
- }
-
- if (menuGroup.options.bubbleSelection && !menuGroup.__isMyEvent(event)) {
- menuGroup.__unselect();
- }
- });
- }
-
- if (menuGroup.options.expandSingle) {
- menuGroup.__group().bind("expand", function (event) {
- if (menuGroup.__isMyEvent(event)) {
- return;
- }
-
- menuGroup.__childGroups().each (function (index, group) {
- var rfGroup = rf.$(group);
- if (!rfGroup.__isMyEvent(event)) {
- rfGroup.collapse();
- }
- });
-
- event.stopPropagation();
- });
- }
-
- this.__addUserEventHandler("collapse");
- this.__addUserEventHandler("expand");
- }
- },
-
- /***************************** Public Methods ****************************************************************/
- expanded : function () {
- // TODO check invariant in dev mode
- // return this.__content().hasClass("rf-pm-exp")
- return this.__getExpandValue();
- },
-
- expand : function () {
- this.__expand();
-
- return this.__fireExpand();
- },
-
- __expand : function () {
- this.__content().removeClass("rf-pm-colps").addClass("rf-pm-exp");
- var header = this.__header();
- header.find(".rf-pm-ico-colps").hide();
- header.find(".rf-pm-ico-exp").show();
-
- this.__setExpandValue(true);
- },
-
- collapsed : function () {
- // TODO check invariant in dev mode
- // return this.__content().hasClass("rf-pm-colps")
- return !this.__getExpandValue();
- },
-
- collapse : function () {
- this.__collapse();
-
- this.__childGroups().each (function(index, group) {
- rf.$(group.id).__collapse();
- });
-
- this.__fireCollapse();
- },
-
- __collapse : function () {
- this.__content().addClass("rf-pm-colps").removeClass("rf-pm-exp");
- var header = this.__header();
- header.find(".rf-pm-ico-exp").hide();
- header.find(".rf-pm-ico-colps").show();
-
- this.__setExpandValue(false);
- },
-
- /**
- * @methodOf
- * @name PanelMenuGroup#switch
- *
- * TODO ...
- *
- * @param {boolean} expand
- * @return {void} TODO ...
- */
- switchExpantion : function () { // TODO rename
- var continueProcess = this.__fireBeforeSwitch();
- if (!continueProcess) {
- return false;
- }
-
- EXPAND_ITEM.exec(this, !this.expanded());
- },
-
- /**
- * please, remove this method when client side ajax events will be added
- *
- * */
- onCompleteHandler : function () {
- EXPAND_ITEM.execClient(this, this.expanded());
- },
-
- __switch : function (expand) {
- if (expand) {
- this.expand();
- } else {
- this.collapse();
- }
- },
-
- /***************************** Private Methods ****************************************************************/
- __childGroups : function () {
- return this.__content().children(".rf-pm-gr")
- },
-
- __group : function () {
- return $(rf.getDomElement(this.id))
- },
-
- __header : function () {
- return $(rf.getDomElement(this.id + ":hdr"))
- },
-
- __content : function () {
- return $(rf.getDomElement(this.id + ":cnt"))
- },
-
- __expandValueInput : function () {
- return document.getElementById(this.id + ":expanded");
- },
-
- __getExpandValue : function () {
- return this.__expandValueInput().value == "true";
- },
-
- /**
- * @methodOf
- * @name PanelMenuGroup#__setExpandValue
- *
- * @param {boolean} value - is group expanded?
- * @return {boolean} preview value
- */
- __setExpandValue : function (value) {
- var input = this.__expandValueInput();
- var oldValue = input.value;
-
- input.value = value;
-
- return oldValue;
- },
-
- __changeState : function () {
- var state = {};
- 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
- }
-
- return state;
- },
-
- __restoreState : function (state) {
- if (!state) {
- return;
- }
-
- if (state["expanded"]) {
- this.__setExpandValue(state["expanded"]);
- }
-
- if (state["itemName"]) {
- this.__rfPanelMenu().selectedItem(state["itemName"]);
- }
- },
-
- __fireSwitch : function () {
- return new rf.Event.fireById(this.id, "switch", {
- id: this.id
- });
- },
-
- __isMyEvent: function (event) {
- return this.id == event.target.id;
- },
-
- __fireBeforeSwitch : function () {
- return rf.Event.fireById(this.id, "beforeswitch", {
- id: this.id
- });
- },
-
- __fireCollapse : function () {
- return new rf.Event.fireById(this.id, "collapse", {
- id: this.id
- });
- },
-
- __fireExpand : function () {
- return new rf.Event.fireById(this.id, "expand", {
- id: this.id
- });
- },
-
- destroy: function () {
- rf.Event.unbindById(this.id, "."+this.namespace);
-
- $super.destroy.call(this);
- }
- });
-
- // define super class link
- var $super = rf.ui.PanelMenuGroup.$super;
-})(jQuery, RichFaces);
Copied: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenuGroup_.js (from rev 20398, trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenuGroup.js)
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenuGroup_.js (rev 0)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenuGroup_.js 2010-12-08 12:27:08 UTC (rev 20456)
@@ -0,0 +1,365 @@
+/*
+ * 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.
+ */
+
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ var __DEFAULT_OPTIONS = {
+ expanded : false,
+ expandSingle : true,
+ bubbleSelection : true,
+ stylePrefix : "rf-pm-gr",
+
+ // TODO we should use selectionType = {none, selectable, unselectable}
+ selectable : false,
+ unselectable : false // unselectable can be only selectable item => if selectable == false than unselectable = false
+ };
+
+ var EXPAND_ITEM = {
+
+ /**
+ *
+ * @return {void}
+ * */
+ exec : function (group, expand) {
+ var mode = group.mode;
+ if (mode == "server") {
+ return this.execServer(group);
+ } else if (mode == "ajax") {
+ return this.execAjax(group);
+ } else if (mode == "client" || mode == "none") {
+ return this.execClient(group, expand);
+ } else {
+ rf.log.error("EXPAND_ITEM.exec : unknown mode (" + mode + ")");
+ }
+ },
+
+ /**
+ * @protected
+ *
+ * @return {Boolean} false
+ * */
+ execServer : function (group) {
+ group.__changeState();
+ rf.submitForm(this.__getParentForm(group));
+
+ return false;
+ },
+
+ /**
+ * @protected
+ *
+ * @return {Boolean} false
+ * */
+ execAjax : function (group) {
+ var oldState = group.__changeState();
+ rf.ajax(group.id, null, $.extend({}, group.options["ajax"], {}));
+ group.__restoreState(oldState);
+
+ return true;
+ },
+
+ /**
+ * @protected
+ *
+ * @param {PanelMenuGroup} group
+ * @param {Boolean} expand
+ * @return {undefined}
+ * - false - if process has been terminated
+ * - true - in other cases
+ * */
+ execClient : function (group, expand) {
+ if (expand) {
+ group.expand();
+ } else {
+ group.collapse();
+ }
+
+ return group.__fireSwitch();
+ },
+
+ /**
+ * @private
+ * */
+ __getParentForm : function (item) {
+ return $($(rf.getDomElement(item.id)).parents("form")[0]);
+ }
+ };
+
+ rf.ui.PanelMenuGroup = rf.ui.PanelMenuItem.extendClass({
+ // class name
+ name:"PanelMenuGroup",
+
+ /**
+ * @class PanelMenuGroup
+ * @name PanelMenuGroup
+ *
+ * @constructor
+ * @param {String} componentId - component id
+ * @param {Hash} options - params
+ * */
+ init : function (componentId, options) {
+ $super.constructor.call(this, componentId);
+ this.options = $.extend(this.options, __DEFAULT_OPTIONS, options || {});
+
+ if (!this.options.disabled) {
+ var menuGroup = this;
+
+ if (!this.options.selectable) {
+ this.__header().bind("click", function () {
+ return menuGroup.switchExpantion();
+ });
+ }
+
+ if (this.options.selectable || this.options.bubbleSelection) {
+ this.__content().bind("select", function (event) {
+ if (menuGroup.options.selectable && menuGroup.__isMyEvent(event)) {
+ menuGroup.expand();
+ }
+
+ if (menuGroup.options.bubbleSelection && !menuGroup.__isMyEvent(event)) {
+ menuGroup.__select();
+ if (!menuGroup.expanded()) {
+ menuGroup.expand();
+ }
+ }
+ });
+
+ this.__content().bind("unselect", function (event) {
+ if (menuGroup.options.selectable && menuGroup.__isMyEvent(event)) {
+ menuGroup.collapse();
+ }
+
+ if (menuGroup.options.bubbleSelection && !menuGroup.__isMyEvent(event)) {
+ menuGroup.__unselect();
+ }
+ });
+ }
+
+ if (menuGroup.options.expandSingle) {
+ menuGroup.__group().bind("expand", function (event) {
+ if (menuGroup.__isMyEvent(event)) {
+ return;
+ }
+
+ menuGroup.__childGroups().each (function (index, group) {
+ var rfGroup = rf.$(group);
+ if (!rfGroup.__isMyEvent(event)) {
+ rfGroup.collapse();
+ }
+ });
+
+ event.stopPropagation();
+ });
+ }
+
+ this.__addUserEventHandler("collapse");
+ this.__addUserEventHandler("expand");
+ }
+ },
+
+ /***************************** Public Methods ****************************************************************/
+ expanded : function () {
+ // TODO check invariant in dev mode
+ // return this.__content().hasClass("rf-pm-exp")
+ return this.__getExpandValue();
+ },
+
+ expand : function () {
+ this.__expand();
+
+ return this.__fireExpand();
+ },
+
+ __expand : function () {
+ this.__content().removeClass("rf-pm-colps").addClass("rf-pm-exp");
+ var header = this.__header();
+ header.find(".rf-pm-ico-colps").hide();
+ header.find(".rf-pm-ico-exp").show();
+
+ this.__setExpandValue(true);
+ },
+
+ collapsed : function () {
+ // TODO check invariant in dev mode
+ // return this.__content().hasClass("rf-pm-colps")
+ return !this.__getExpandValue();
+ },
+
+ collapse : function () {
+ this.__collapse();
+
+ this.__childGroups().each (function(index, group) {
+ rf.$(group.id).__collapse();
+ });
+
+ this.__fireCollapse();
+ },
+
+ __collapse : function () {
+ this.__content().addClass("rf-pm-colps").removeClass("rf-pm-exp");
+ var header = this.__header();
+ header.find(".rf-pm-ico-exp").hide();
+ header.find(".rf-pm-ico-colps").show();
+
+ this.__setExpandValue(false);
+ },
+
+ /**
+ * @methodOf
+ * @name PanelMenuGroup#switch
+ *
+ * TODO ...
+ *
+ * @param {boolean} expand
+ * @return {void} TODO ...
+ */
+ switchExpantion : function () { // TODO rename
+ var continueProcess = this.__fireBeforeSwitch();
+ if (!continueProcess) {
+ return false;
+ }
+
+ EXPAND_ITEM.exec(this, !this.expanded());
+ },
+
+ /**
+ * please, remove this method when client side ajax events will be added
+ *
+ * */
+ onCompleteHandler : function () {
+ EXPAND_ITEM.execClient(this, this.expanded());
+ },
+
+ __switch : function (expand) {
+ if (expand) {
+ this.expand();
+ } else {
+ this.collapse();
+ }
+ },
+
+ /***************************** Private Methods ****************************************************************/
+ __childGroups : function () {
+ return this.__content().children(".rf-pm-gr")
+ },
+
+ __group : function () {
+ return $(rf.getDomElement(this.id))
+ },
+
+ __header : function () {
+ return $(rf.getDomElement(this.id + ":hdr"))
+ },
+
+ __content : function () {
+ return $(rf.getDomElement(this.id + ":cnt"))
+ },
+
+ __expandValueInput : function () {
+ return document.getElementById(this.id + ":expanded");
+ },
+
+ __getExpandValue : function () {
+ return this.__expandValueInput().value == "true";
+ },
+
+ /**
+ * @methodOf
+ * @name PanelMenuGroup#__setExpandValue
+ *
+ * @param {boolean} value - is group expanded?
+ * @return {boolean} preview value
+ */
+ __setExpandValue : function (value) {
+ var input = this.__expandValueInput();
+ var oldValue = input.value;
+
+ input.value = value;
+
+ return oldValue;
+ },
+
+ __changeState : function () {
+ var state = {};
+ 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
+ }
+
+ return state;
+ },
+
+ __restoreState : function (state) {
+ if (!state) {
+ return;
+ }
+
+ if (state["expanded"]) {
+ this.__setExpandValue(state["expanded"]);
+ }
+
+ if (state["itemName"]) {
+ this.__rfPanelMenu().selectedItem(state["itemName"]);
+ }
+ },
+
+ __fireSwitch : function () {
+ return new rf.Event.fireById(this.id, "switch", {
+ id: this.id
+ });
+ },
+
+ __isMyEvent: function (event) {
+ return this.id == event.target.id;
+ },
+
+ __fireBeforeSwitch : function () {
+ return rf.Event.fireById(this.id, "beforeswitch", {
+ id: this.id
+ });
+ },
+
+ __fireCollapse : function () {
+ return new rf.Event.fireById(this.id, "collapse", {
+ id: this.id
+ });
+ },
+
+ __fireExpand : function () {
+ return new rf.Event.fireById(this.id, "expand", {
+ id: this.id
+ });
+ },
+
+ destroy: function () {
+ rf.Event.unbindById(this.id, "."+this.namespace);
+
+ $super.destroy.call(this);
+ }
+ });
+
+ // define super class link
+ var $super = rf.ui.PanelMenuGroup.$super;
+})(jQuery, RichFaces);
Deleted: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenuItem.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenuItem.js 2010-12-08 12:24:06 UTC (rev 20455)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenuItem.js 2010-12-08 12:27:08 UTC (rev 20456)
@@ -1,321 +0,0 @@
-/*
- * 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.
- */
-
-
-(function ($, rf) {
-
- rf.ui = rf.ui || {};
-
- var __DEFAULT_OPTIONS = {
- disabled : false,
- selectable: true,
- mode: "client",
- unselectable: false,
- highlight: true,
- stylePrefix: "rf-pm-itm",
- itemStep: 20
- };
-
- var SELECT_ITEM = {
-
- /**
- *
- * @return {void}
- * */
- exec : function (item) {
- var mode = item.mode;
- if (mode == "server") {
- return this.execServer(item);
- } else if (mode == "ajax") {
- return this.execAjax(item);
- } else if (mode == "client" || mode == "none") {
- return this.execClient(item);
- } else {
- rf.log.error("SELECT_ITEM.exec : unknown mode (" + mode + ")");
- }
- },
-
- /**
- * @protected
- *
- * @return {Boolean} false
- * */
- execServer : function (item) {
- item.__changeState();
- rf.submitForm(this.__getParentForm(item));
-
- return false;
- },
-
- /**
- * @protected
- *
- * @return {Boolean} false
- * */
- execAjax : function (item) {
- var oldItem = item.__changeState();
- rf.ajax(item.__panelMenu().id, null, $.extend({}, item.options["ajax"], {}));
- item.__restoreState(oldItem);
-
- return true;
- },
-
- /**
- * @protected
- *
- * @return {undefined}
- * - false - if process has been terminated
- * - true - in other cases
- * */
- execClient : function (item) {
- var panelMenu = item.__rfPanelMenu();
- if (panelMenu.selectedItem()) {
- panelMenu.getItems()[panelMenu.selectedItem()].unselect();
- }
- panelMenu.selectedItem(item.itemName);
-
- item.__select();
-
- return item.__fireSelect();
- },
-
- /**
- * @private
- * */
- __getParentForm : function (item) {
- return $($(rf.getDomElement(item.id)).parents("form")[0]);
- }
- };
-
- rf.ui.PanelMenuItem = rf.BaseComponent.extendClass({
- // class name
- name:"PanelMenuItem",
-
- /**
- * @class PanelMenuItem
- * @name PanelMenuItem
- *
- * @constructor
- * @param {String} componentId - component id
- * @param {Hash} options - params
- * */
- init : function (componentId, options) {
- $super.constructor.call(this, componentId);
- this.attachToDom();
-
- this.options = $.extend(this.options, __DEFAULT_OPTIONS, options || {});
-
- this.mode = this.options.mode
- this.itemName = this.options.name
- this.__rfPanelMenu().getItems()[this.itemName] = this;
-
- // todo move it
- this.selectionClass = this.options.stylePrefix + "-sel";
- this.hoverClass = this.options.stylePrefix + "-hov";
-
- if (!this.options.disabled) {
- var item = this;
- if (this.options.highlight) {
- this.__item().bind("mouseenter", function() {
- item.highlight(true);
- });
- this.__item().bind("mouseleave", function() {
- item.highlight(false);
- });
- }
-
- if (this.options.selectable) {
- this.__header().bind("click", function() {
- if (item.__rfPanelMenu().selectedItem() == item.id) {
- if (item.options.unselectable) {
- return item.unselect();
- }
-
- // we shouldn't select one item several times
- } else {
- return item.select();
- }
- });
- }
- }
-
- item = this;
- $(this.__panelMenu()).ready(function () {
- item.__renderNestingLevel();
- });
-
- this.__addUserEventHandler("select");
- },
-
- /***************************** Public Methods ****************************************************************/
- highlight : function (highlight) {
- if (highlight && !this.selected()) {
- this.__header().addClass(this.hoverClass);
- } else {
- this.__header().removeClass(this.hoverClass);
- }
- },
-
- selected : function () {
- return this.__header().hasClass(this.selectionClass);
- },
-
- /**
- * @methodOf
- * @name PanelMenuItem#select
- *
- * TODO ...
- *
- * @return {void} TODO ...
- */
- select: function () {
- var continueProcess = this.__fireBeforeSelect();
- if (!continueProcess) {
- return false;
- }
-
- return SELECT_ITEM.exec(this)
- },
-
- /**
- * please, remove this method when client side ajax events will be added
- *
- * */
- onCompleteHandler : function () {
- SELECT_ITEM.execClient(this);
- },
-
- unselect: function () {
- var panelMenu = this.__rfPanelMenu();
- if (panelMenu.selectedItem() == this.itemName) {
- panelMenu.selectedItem(null);
- } else {
- rf.warn("You try unselect item (name=" + this.itemName + ") that isn't seleted")
- }
-
- this.__unselect();
-
- return this.__fireUnselect();
- },
-
- /***************************** 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];
- },
-
- __rfPanelMenu : function () {
- return rf.$(this.__item().parents(".rf-pm")[0]);
- },
-
- __changeState : function () {
- return this.__rfPanelMenu().selectedItem(this.itemName);
- },
-
- __restoreState : function (state) {
- if (state) {
- this.__rfPanelMenu().selectedItem(state);
- }
- },
-
- __item : function () {
- return $(rf.getDomElement(this.id));
- },
-
- __header : function () {
- return this.__item();
- },
-
- __select: function () {
- this.__header().addClass(this.selectionClass);
- },
-
- __unselect: function () {
- this.__header().removeClass(this.selectionClass);
- },
-
- __fireBeforeSelect : function () {
- return new rf.Event.fireById(this.id, "beforeselect", {
- id: this.id
- });
- },
-
- __fireSelect : function () {
- return new rf.Event.fireById(this.id, "select", {
- id: this.id
- });
- },
-
- __fireUnselect : function () {
- return new rf.Event.fireById(this.id, "unselect", {
- id: this.id
- });
- },
-
- /**
- * @private
- * */
- __addUserEventHandler : function (name) {
- var handler = this.options["on" + name];
- if (handler) {
- rf.Event.bindById(this.id, name, handler);
- }
- },
-
- destroy: function () {
- delete this.__rfPanelMenu().getItems()[this.itemName];
- $super.destroy.call(this);
- }
- });
-
- // define super class link
- var $super = rf.ui.PanelMenuItem.$super;
-})(jQuery, RichFaces);
Copied: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenuItem_.js (from rev 20398, trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenuItem.js)
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenuItem_.js (rev 0)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenuItem_.js 2010-12-08 12:27:08 UTC (rev 20456)
@@ -0,0 +1,321 @@
+/*
+ * 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.
+ */
+
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ var __DEFAULT_OPTIONS = {
+ disabled : false,
+ selectable: true,
+ mode: "client",
+ unselectable: false,
+ highlight: true,
+ stylePrefix: "rf-pm-itm",
+ itemStep: 20
+ };
+
+ var SELECT_ITEM = {
+
+ /**
+ *
+ * @return {void}
+ * */
+ exec : function (item) {
+ var mode = item.mode;
+ if (mode == "server") {
+ return this.execServer(item);
+ } else if (mode == "ajax") {
+ return this.execAjax(item);
+ } else if (mode == "client" || mode == "none") {
+ return this.execClient(item);
+ } else {
+ rf.log.error("SELECT_ITEM.exec : unknown mode (" + mode + ")");
+ }
+ },
+
+ /**
+ * @protected
+ *
+ * @return {Boolean} false
+ * */
+ execServer : function (item) {
+ item.__changeState();
+ rf.submitForm(this.__getParentForm(item));
+
+ return false;
+ },
+
+ /**
+ * @protected
+ *
+ * @return {Boolean} false
+ * */
+ execAjax : function (item) {
+ var oldItem = item.__changeState();
+ rf.ajax(item.__panelMenu().id, null, $.extend({}, item.options["ajax"], {}));
+ item.__restoreState(oldItem);
+
+ return true;
+ },
+
+ /**
+ * @protected
+ *
+ * @return {undefined}
+ * - false - if process has been terminated
+ * - true - in other cases
+ * */
+ execClient : function (item) {
+ var panelMenu = item.__rfPanelMenu();
+ if (panelMenu.selectedItem()) {
+ panelMenu.getItems()[panelMenu.selectedItem()].unselect();
+ }
+ panelMenu.selectedItem(item.itemName);
+
+ item.__select();
+
+ return item.__fireSelect();
+ },
+
+ /**
+ * @private
+ * */
+ __getParentForm : function (item) {
+ return $($(rf.getDomElement(item.id)).parents("form")[0]);
+ }
+ };
+
+ rf.ui.PanelMenuItem = rf.BaseComponent.extendClass({
+ // class name
+ name:"PanelMenuItem",
+
+ /**
+ * @class PanelMenuItem
+ * @name PanelMenuItem
+ *
+ * @constructor
+ * @param {String} componentId - component id
+ * @param {Hash} options - params
+ * */
+ init : function (componentId, options) {
+ $super.constructor.call(this, componentId);
+ this.attachToDom();
+
+ this.options = $.extend(this.options, __DEFAULT_OPTIONS, options || {});
+
+ this.mode = this.options.mode
+ this.itemName = this.options.name
+ this.__rfPanelMenu().getItems()[this.itemName] = this;
+
+ // todo move it
+ this.selectionClass = this.options.stylePrefix + "-sel";
+ this.hoverClass = this.options.stylePrefix + "-hov";
+
+ if (!this.options.disabled) {
+ var item = this;
+ if (this.options.highlight) {
+ this.__item().bind("mouseenter", function() {
+ item.highlight(true);
+ });
+ this.__item().bind("mouseleave", function() {
+ item.highlight(false);
+ });
+ }
+
+ if (this.options.selectable) {
+ this.__header().bind("click", function() {
+ if (item.__rfPanelMenu().selectedItem() == item.id) {
+ if (item.options.unselectable) {
+ return item.unselect();
+ }
+
+ // we shouldn't select one item several times
+ } else {
+ return item.select();
+ }
+ });
+ }
+ }
+
+ item = this;
+ $(this.__panelMenu()).ready(function () {
+ item.__renderNestingLevel();
+ });
+
+ this.__addUserEventHandler("select");
+ },
+
+ /***************************** Public Methods ****************************************************************/
+ highlight : function (highlight) {
+ if (highlight && !this.selected()) {
+ this.__header().addClass(this.hoverClass);
+ } else {
+ this.__header().removeClass(this.hoverClass);
+ }
+ },
+
+ selected : function () {
+ return this.__header().hasClass(this.selectionClass);
+ },
+
+ /**
+ * @methodOf
+ * @name PanelMenuItem#select
+ *
+ * TODO ...
+ *
+ * @return {void} TODO ...
+ */
+ select: function () {
+ var continueProcess = this.__fireBeforeSelect();
+ if (!continueProcess) {
+ return false;
+ }
+
+ return SELECT_ITEM.exec(this)
+ },
+
+ /**
+ * please, remove this method when client side ajax events will be added
+ *
+ * */
+ onCompleteHandler : function () {
+ SELECT_ITEM.execClient(this);
+ },
+
+ unselect: function () {
+ var panelMenu = this.__rfPanelMenu();
+ if (panelMenu.selectedItem() == this.itemName) {
+ panelMenu.selectedItem(null);
+ } else {
+ rf.warn("You try unselect item (name=" + this.itemName + ") that isn't seleted")
+ }
+
+ this.__unselect();
+
+ return this.__fireUnselect();
+ },
+
+ /***************************** 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];
+ },
+
+ __rfPanelMenu : function () {
+ return rf.$(this.__item().parents(".rf-pm")[0]);
+ },
+
+ __changeState : function () {
+ return this.__rfPanelMenu().selectedItem(this.itemName);
+ },
+
+ __restoreState : function (state) {
+ if (state) {
+ this.__rfPanelMenu().selectedItem(state);
+ }
+ },
+
+ __item : function () {
+ return $(rf.getDomElement(this.id));
+ },
+
+ __header : function () {
+ return this.__item();
+ },
+
+ __select: function () {
+ this.__header().addClass(this.selectionClass);
+ },
+
+ __unselect: function () {
+ this.__header().removeClass(this.selectionClass);
+ },
+
+ __fireBeforeSelect : function () {
+ return new rf.Event.fireById(this.id, "beforeselect", {
+ id: this.id
+ });
+ },
+
+ __fireSelect : function () {
+ return new rf.Event.fireById(this.id, "select", {
+ id: this.id
+ });
+ },
+
+ __fireUnselect : function () {
+ return new rf.Event.fireById(this.id, "unselect", {
+ id: this.id
+ });
+ },
+
+ /**
+ * @private
+ * */
+ __addUserEventHandler : function (name) {
+ var handler = this.options["on" + name];
+ if (handler) {
+ rf.Event.bindById(this.id, name, handler);
+ }
+ },
+
+ destroy: function () {
+ delete this.__rfPanelMenu().getItems()[this.itemName];
+ $super.destroy.call(this);
+ }
+ });
+
+ // define super class link
+ var $super = rf.ui.PanelMenuItem.$super;
+})(jQuery, RichFaces);
Copied: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenu_.js (from rev 20398, trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenu.js)
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenu_.js (rev 0)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenu_.js 2010-12-08 12:27:08 UTC (rev 20456)
@@ -0,0 +1,211 @@
+/*
+ * 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.
+ */
+
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ var __DEFAULT_OPTIONS = {
+ expandSingle : true
+ };
+
+ rf.ui.PanelMenu = rf.BaseComponent.extendClass({
+ // class name
+ name:"PanelMenu",
+
+ /**
+ * @class PanelMenu
+ * @name PanelMenu
+ *
+ * @constructor
+ * @param {String} componentId - component id
+ * @param {Hash} options - params
+ * */
+ init : function (componentId, options) {
+ $super.constructor.call(this, componentId);
+ this.items = [];
+ this.attachToDom();
+
+ this.options = $.extend(this.options, __DEFAULT_OPTIONS, options || {});
+ this.activeItem = this.__getValueInput().value;
+ this.nestingLevel = 0;
+
+ var menuGroup = this;
+ if (menuGroup.options.expandSingle) {
+ menuGroup.__panelMenu().bind("expand", function (event) {
+ menuGroup.__childGroups().each (function (index, group) {
+ if (event.target.id != group.id) {
+ rf.$(group.id).collapse();
+ }
+ });
+
+ event.stopPropagation();
+ });
+ }
+
+ if (menuGroup.activeItem) {
+ this.__panelMenu().ready(function () {
+ var item = menuGroup.items[menuGroup.activeItem];
+ item.__select();
+ item.__fireSelect();
+ })
+ }
+
+ this.__addUserEventHandler("collapse");
+ this.__addUserEventHandler("expand");
+ },
+
+ getItems: function () {
+ return this.items;
+ },
+
+ getItem: function (name) {
+ return this.items[name];
+ },
+
+ /***************************** Public Methods ****************************************************************/
+ /**
+ * @methodOf
+ * @name PanelMenu#selectItem
+ *
+ * TODO ...
+ *
+ * @param {String} name
+ * @return {void} TODO ...
+ */
+ selectItem: function (name) {
+ // TODO implement
+ },
+
+ /**
+ * @methodOf
+ * @name PanelMenu#selectedItem
+ *
+ * TODO ...
+ *
+ * @return {String} TODO ...
+ */
+ selectedItem: function (id) {
+ if (id != undefined) {
+ var valueInput = this.__getValueInput();
+ var prevActiveItem = valueInput.value;
+
+ this.activeItem = id;
+ valueInput.value = id;
+
+ return prevActiveItem;
+ } else {
+ return this.activeItem;
+ }
+ },
+
+ __getValueInput : function() {
+ return document.getElementById(this.id + "-value");
+ },
+
+ selectItem: function (itemName) {
+ // TODO
+ },
+
+ /**
+ * @methodOf
+ * @name PanelMenu#expandAll
+ *
+ * TODO ...
+ *
+ * @return {void} TODO ...
+ */
+ expandAll: function () {
+ // TODO implement
+ },
+
+ /**
+ * @methodOf
+ * @name PanelMenu#collapseAll
+ *
+ * TODO ...
+ *
+ * @return {void} TODO ...
+ */
+ collapseAll: function () {
+ // TODO implement
+ },
+
+ /**
+ * @methodOf
+ * @name PanelMenu#expandGroup
+ *
+ * TODO ...
+ *
+ * @param {String} groupName
+ * @return {void} TODO ...
+ */
+ expandGroup: function (groupName) {
+ // TODO implement
+ },
+
+ /**
+ * @methodOf
+ * @name PanelMenu#collapseGroup
+ *
+ * TODO ...
+ *
+ * @param {String} groupName
+ * @return {void} TODO ...
+ */
+ collapseGroup: function (groupName) {
+ // TODO implement
+ },
+
+
+ /***************************** Private Methods ****************************************************************/
+
+
+ __panelMenu : function () {
+ return $(rf.getDomElement(this.id));
+ },
+
+ __childGroups : function () {
+ return this.__panelMenu().children(".rf-pm-top-gr")
+ },
+
+ /**
+ * @private
+ * */
+ __addUserEventHandler : function (name) {
+ var handler = this.options["on" + name];
+ if (handler) {
+ rf.Event.bindById(this.id, name, handler);
+ }
+ },
+
+ destroy: function () {
+ rf.Event.unbindById(this.id, "."+this.namespace);
+ $super.destroy.call(this);
+ }
+ });
+
+ // define super class link
+ var $super = rf.ui.PanelMenu.$super;
+
+})(jQuery, RichFaces);
Deleted: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tab.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tab.js 2010-12-08 12:24:06 UTC (rev 20455)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tab.js 2010-12-08 12:27:08 UTC (rev 20456)
@@ -1,139 +0,0 @@
-/*
- * 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.
- */
-
-(function ($, rf) {
-
- rf.ui = rf.ui || {};
-
- rf.ui.Tab = rf.ui.TogglePanelItem.extendClass({
- // class name
- name:"Tab",
-
- /**
- * @class AccordionItem
- * @name AccordionItem
- *
- * @constructor
- * @param {String} componentId - component id
- * @param {Hash} options - params
- * */
- init : function (componentId, options) {
- $super.constructor.call(this, componentId, options);
- this.index = options["index"];
- this.getTogglePanel().getItems()[this.index] = this;
-
- //TODO - optimize this
- rf.Event.bindById(this.id + ":header:active", "click", this.__onHeaderClick, this);
- rf.Event.bindById(this.id + ":header:inactive", "click", this.__onHeaderClick, this)
- },
-
- /***************************** Public Methods ****************************************************************/
-
- __onHeaderClick : function (comp) {
- this.getTogglePanel().switchToItem(this.getName());
- },
-
- /**
- * @param state {string} = inactive | active | disabled
- * in that case looking header by css class appropriate to this state
- *
- * @return {jQuery Object}
- * */
- __header : function (state) {
- var res = $(rf.getDomElement(this.id + ":header"));
- if (state) {
- return $(rf.getDomElement(this.id + ":header:" + state));
- }
-
- return res;
- },
-
- /**
- * @return {jQuery Object}
- * */
- __content : function () {
- if (!this.__content_) {
- this.__content_ = $(rf.getDomElement(this.id + ":content"));
- }
- return this.__content_;
- },
-
- /**
- * @private
- *
- * used in TogglePanel
- * */
- __enter : function () {
-
- this.__content().show();
- this.__header("inactive").hide();
- this.__header("active").show();
-
- return this.__fireEnter();
- },
-
- getHeight : function (recalculate) {
- if (recalculate || !this.__height) {
- this.__height = $(rf.getDomElement(this.id)).outerHeight(true)
- }
-
- return this.__height;
- },
-
- /**
- * @private
- *
- * used in TogglePanel
- * */
- __leave : function () {
- var continueProcess = this.__fireLeave();
- if (!continueProcess) {
- return false;
- }
-
- this.__content().hide();
- this.__header("active").hide();
- this.__header("inactive").show();
-
- return true;
- },
-
- /***************************** Private Methods ********************************************************/
-
-
- destroy: function () {
- var parent = this.getTogglePanel();
- delete parent.getItems()[this.index];
-
- rf.Event.unbindById(this.id);
-
- //TODO - optimize
- rf.Event.unbindById(this.id + ":header:active");
- rf.Event.unbindById(this.id + ":header:inactive");
-
- $super.destroy.call(this);
- }
- });
-
- // define super class link
- var $super = rf.ui.Tab.$super;
-})(jQuery, RichFaces);
Deleted: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TabPanel.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TabPanel.js 2010-12-08 12:24:06 UTC (rev 20455)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TabPanel.js 2010-12-08 12:27:08 UTC (rev 20456)
@@ -1,46 +0,0 @@
-/*
- * 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.
- */
-
-(function ($, rf) {
-
- rf.ui = rf.ui || {};
-
- rf.ui.TabPanel = rf.ui.TogglePanel.extendClass({
- // class name
- name:"TabPanel",
-
- /**
- * @class TabPanel
- * @name TabPanel
- *
- * @constructor
- * @param {String} componentId - component id
- * @param {Hash} options - params
- * */
- init : function (componentId, options) {
- rf.ui.TogglePanel.call(this, componentId, options);
- this.items = [];
-
- this.isKeepHeight = options["isKeepHeight"] || false
- }
- });
-})(jQuery, RichFaces);
Copied: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TabPanel_.js (from rev 20398, trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TabPanel.js)
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TabPanel_.js (rev 0)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TabPanel_.js 2010-12-08 12:27:08 UTC (rev 20456)
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.TabPanel = rf.ui.TogglePanel.extendClass({
+ // class name
+ name:"TabPanel",
+
+ /**
+ * @class TabPanel
+ * @name TabPanel
+ *
+ * @constructor
+ * @param {String} componentId - component id
+ * @param {Hash} options - params
+ * */
+ init : function (componentId, options) {
+ rf.ui.TogglePanel.call(this, componentId, options);
+ this.items = [];
+
+ this.isKeepHeight = options["isKeepHeight"] || false
+ }
+ });
+})(jQuery, RichFaces);
Copied: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tab_.js (from rev 20398, trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tab.js)
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tab_.js (rev 0)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tab_.js 2010-12-08 12:27:08 UTC (rev 20456)
@@ -0,0 +1,139 @@
+/*
+ * 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.
+ */
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.Tab = rf.ui.TogglePanelItem.extendClass({
+ // class name
+ name:"Tab",
+
+ /**
+ * @class AccordionItem
+ * @name AccordionItem
+ *
+ * @constructor
+ * @param {String} componentId - component id
+ * @param {Hash} options - params
+ * */
+ init : function (componentId, options) {
+ $super.constructor.call(this, componentId, options);
+ this.index = options["index"];
+ this.getTogglePanel().getItems()[this.index] = this;
+
+ //TODO - optimize this
+ rf.Event.bindById(this.id + ":header:active", "click", this.__onHeaderClick, this);
+ rf.Event.bindById(this.id + ":header:inactive", "click", this.__onHeaderClick, this)
+ },
+
+ /***************************** Public Methods ****************************************************************/
+
+ __onHeaderClick : function (comp) {
+ this.getTogglePanel().switchToItem(this.getName());
+ },
+
+ /**
+ * @param state {string} = inactive | active | disabled
+ * in that case looking header by css class appropriate to this state
+ *
+ * @return {jQuery Object}
+ * */
+ __header : function (state) {
+ var res = $(rf.getDomElement(this.id + ":header"));
+ if (state) {
+ return $(rf.getDomElement(this.id + ":header:" + state));
+ }
+
+ return res;
+ },
+
+ /**
+ * @return {jQuery Object}
+ * */
+ __content : function () {
+ if (!this.__content_) {
+ this.__content_ = $(rf.getDomElement(this.id + ":content"));
+ }
+ return this.__content_;
+ },
+
+ /**
+ * @private
+ *
+ * used in TogglePanel
+ * */
+ __enter : function () {
+
+ this.__content().show();
+ this.__header("inactive").hide();
+ this.__header("active").show();
+
+ return this.__fireEnter();
+ },
+
+ getHeight : function (recalculate) {
+ if (recalculate || !this.__height) {
+ this.__height = $(rf.getDomElement(this.id)).outerHeight(true)
+ }
+
+ return this.__height;
+ },
+
+ /**
+ * @private
+ *
+ * used in TogglePanel
+ * */
+ __leave : function () {
+ var continueProcess = this.__fireLeave();
+ if (!continueProcess) {
+ return false;
+ }
+
+ this.__content().hide();
+ this.__header("active").hide();
+ this.__header("inactive").show();
+
+ return true;
+ },
+
+ /***************************** Private Methods ********************************************************/
+
+
+ destroy: function () {
+ var parent = this.getTogglePanel();
+ delete parent.getItems()[this.index];
+
+ rf.Event.unbindById(this.id);
+
+ //TODO - optimize
+ rf.Event.unbindById(this.id + ":header:active");
+ rf.Event.unbindById(this.id + ":header:inactive");
+
+ $super.destroy.call(this);
+ }
+ });
+
+ // define super class link
+ var $super = rf.ui.Tab.$super;
+})(jQuery, RichFaces);
Deleted: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js 2010-12-08 12:24:06 UTC (rev 20455)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js 2010-12-08 12:27:08 UTC (rev 20456)
@@ -1,433 +0,0 @@
-/*
- * 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.
- */
-
-(function ($, rf) {
-
- rf.ui = rf.ui || {};
-
- /* SIMPLE INNER CLASS for handle switch operation*/
- function SwitchItems(comp) {
- this.comp = comp;
- }
-
- SwitchItems.prototype = {
-
- /**
- * @param {TogglePanelItem} oldPanel
- * @param {TogglePanelItem} newPanel
- *
- * @return {void}
- * */
- exec : function (oldPanel, newPanel) {
- if (newPanel.switchMode == "server") {
- return this.execServer(oldPanel, newPanel);
- } else if (newPanel.switchMode == "ajax") {
- return this.execAjax(oldPanel, newPanel);
- } else if (newPanel.switchMode == "client") {
- return this.execClient(oldPanel, newPanel);
- } else {
- rf.log.error("SwitchItems.exec : unknown switchMode (" + this.comp.switchMode + ")");
- }
- },
-
- /**
- * @protected
- * @param {TogglePanelItem} oldPanel
- * @param {TogglePanelItem} newPanel
- *
- * @return {Boolean} false
- * */
- execServer : function (oldPanel, newPanel) {
- if (oldPanel) {
- var continueProcess = oldPanel.__leave();
- if (!continueProcess) {
- return false;
- }
- }
-
- this.__setActiveItem(newPanel.getName());
-
- rf.submitForm(this.__getParentForm());
-
- return false;
- },
-
- /**
- * @protected
- * @param {TogglePanelItem} oldPanel
- * @param {TogglePanelItem} newPanel
- *
- * @return {Boolean} false
- * */
- execAjax : function (oldPanel, newPanel) {
- var options = $.extend({}, this.comp.options["ajax"], {}/*this.getParameters(newPanel)*/);
-
- this.__setActiveItem(newPanel.getName());
- rf.ajax(this.comp.id, null, options);
-
- if (oldPanel) {
- this.__setActiveItem(oldPanel.getName());
- }
-
- return false;
- },
-
- /**
- * @protected
- * @param {TogglePanelItem} oldPanel
- * @param {TogglePanelItem} newPanel
- *
- * @return {undefined}
- * - false - if process has been terminated
- * - true - in other cases
- * */
- execClient : function (oldPanel, newPanel) {
- if (oldPanel) {
- var continueProcess = oldPanel.__leave();
- if (!continueProcess) {
- return false;
- }
- }
-
- this.__setActiveItem(newPanel.getName());
-
- newPanel.__enter();
- this.comp.__fireItemChange(oldPanel, newPanel);
-
- return true;
- },
-
- /**
- * @private
- * */
- __getParentForm : function () {
- return $(rf.getDomElement(this.comp.id)).parents('form:first');
- },
-
- /**
- * @private
- * */
- __setActiveItem : function (name) {
- rf.getDomElement(this.__getValueInputId()).value = name;
- this.comp.activeItem = name;
- },
-
- /**
- * @private
- * */
- __getValueInputId: function () {
- return this.comp.id + "-value"
- }
- };
-
- /**
- * @class TogglePanel
- * @name TogglePanel
- *
- * @constructor
- * @param {String} componentId - component id
- * @param {Hash} options - params
- * */
- rf.ui.TogglePanel = rf.BaseComponent.extendClass({
-
- // class name
- name:"TogglePanel",
-
- init : function (componentId, options) {
- $super.constructor.call(this, componentId);
- this.attachToDom();
-
- this.options = $.extend(this.options, options || {});
- this.activeItem = this.options.activeItem;
- this.items = this.options.items;
-
- this.__addUserEventHandler("itemchange");
- this.__addUserEventHandler("beforeitemchange");
- },
-
- /***************************** Public Methods ****************************************************************/
-
- /**
- * @methodOf
- *
- * @name TogglePanel#getSelectItem
- *
- * @return {String} name of current selected panel item
- */
- getSelectItem: function () {
- return this.activeItem;
- },
-
- /**
- * @methodOf
- * @name TogglePanel#switchToItem
- *
- * @param {String} name - panel item name to switch
- * we can use meta names @first, @prev, @next and @last
- * @return {Boolean} - false if something wrong and true if all is ok
- */
- switchToItem: function (name) {
- var newPanel = this.getNextItem(name);
- if (newPanel == null) {
- rf.log.warn("TogglePanel.switchToItems(" + name + "): item with name '" + name + "' not found");
- return false;
- }
-
- var oldPanel = this.__getItemByName(this.getSelectItem());
-
- var continueProcess = this.__fireBeforeItemChange(oldPanel, newPanel);
- if (!continueProcess) {
- rf.log.warn("TogglePanel.switchToItems(" + name + "): switch has been canceled by beforeItemChange event");
- return false
- }
-
- return new SwitchItems(this).exec(oldPanel, newPanel);
- },
-
- /**
- * @methodOf
- * @name TogglePanel#getNextItem
- *
- * @param {String} name of TogglePanelItem or meta name (@first | @prev | @next | @last)
- * @return {TogglePanelItem} null if item not found
- */
- getNextItem : function (name) {
- if (name) {
- var newItemIndex = this.__ITEMS_META_NAMES[name];
- if (newItemIndex) {
- return this.__getItem(newItemIndex(this));
- } else {
- return this.__getItemByName(name);
- }
- } else {
- return this.__getItemByName(this.nextItem());
- }
- },
-
- /**
- * please, remove this method when client side ajax events will be added
- *
- * */
- onCompleteHandler : function (newItemName) {
- var oldItem = this.__getItemByName(this.activeItem);
- var newItem = this.__getItemByName(newItemName);
-
- // Don't do like this and remove it ASAP
- new SwitchItems(this).execClient(oldItem, newItem);
- },
-
- /**
- * @methodOf
- * @name TogglePanel#getItems
- *
- * @return {TogglePanelItem[]} all defined panel items
- */
- getItems : function () {
- return this.items;
- },
-
- /**
- * @methodOf
- * @name TogglePanel#getItemsNames
- *
- * @return {String[]} names of all defined items
- */
- getItemsNames: function () {
- var res = [];
- for (var item in this.items) {
- res.push(this.items[item].getName());
- }
-
- return res;
- },
-
- /**
- * @methodOf
- * @name TogglePanel#nextItem
- *
- * @param {String} [itemName = activeItem]
- * @return {String} name of next panel item
- */
- nextItem: function (itemName) {
- var itemIndex = this.__getItemIndex(itemName || this.activeItem);
- if (itemIndex == -1) {
- return null;
- }
-
- return this.__getItemName(itemIndex + 1);
- },
-
- /**
- * @methodOf
- * @name TogglePanel#firstItem
- *
- * @return {String} name of first panel item
- */
- firstItem: function () {
- return this.__getItemName(0);
- },
-
- /**
- * @methodOf
- * @name TogglePanel#lastItem
- *
- * @return {String} name of last panel item
- */
- lastItem: function () {
- return this.__getItemName(this.items.length - 1);
- },
-
- /**
- * @methodOf
- * @name TogglePanel#prevItem
- *
- * @param {String} itemName
- * @return {String} name of prev panel item
- * null if it is first item
- */
- prevItem: function (itemName) {
- var itemIndex = this.__getItemIndex(itemName || this.activeItem);
- if (!this.options.cycledSwitching && itemIndex < 1) {
- return null;
- }
-
- return this.__getItemName(itemIndex - 1);
- },
-
- /////////////////////////////////////////////////////////////////////////////////
- //// Private
- /////////////////////////////////////////////////////////////////////////////////
-
- /********************* Methods *************************/
-
- __ITEMS_META_NAMES : (function () {
- function goFrom (comp, ind, step) {
- var res = ind;
- while ((!comp.items[res] || comp.items[res].disabled) && res < comp.items.length && res > 0) {
- res += step;
- }
- return res;
- }
-
-
- return {
- "@first" : function (comp) {
- return goFrom(comp, 0, 1);
- },
-
- "@prev" : function (comp) {
- return goFrom(comp, parseInt(comp.__getItemIndex(comp.activeItem)) - 1 , -1);
- },
-
- "@next" : function (comp) {
- return goFrom(comp, parseInt(comp.__getItemIndex(comp.activeItem)) + 1 , 1);
- },
-
- "@last" : function (comp) {
- return goFrom(comp, comp.items.length - 1, -1);
- }
- }
- })(),
-
- /**
- * @private
- * */
- __getItemIndex : function (itemName) {
- for (var i in this.items) {
- if (!this.items[i].disabled && this.items[i].getName() === itemName) {
- return parseInt(i);
- }
- }
-
- rf.log.info("TogglePanel.getItemIndex: item with name '" + itemName + "' not found");
- return -1;
- },
-
- /**
- * @private
- * */
- __addUserEventHandler : function (name) {
- var handler = this.options["on" + name];
- if (handler) {
- rf.Event.bindById(this.id, name, handler);
- }
- },
-
- /**
- * @private
- * @param {Number} index - array index
- *
- * @return {TogglePanelItem}
- * null - if item not found
- * */
- __getItem : function (index) {
- if (this.options.cycledSwitching) {
- var size = this.items.length;
- return this.items[(size + index) % size]
- } else if (index >= 0 && index < this.items.length) {
- return this.items[index]
- } else {
- return null;
- }
- },
-
- __getItemByName : function (name) {
- return this.__getItem(this.__getItemIndex(name));
- },
-
- __getItemName : function (index) {
- var item = this.__getItem(index);
- if (item == null) {
- return null;
- }
-
- return item.getName();
- },
-
- /**
- * Fire Concealable Event
- * */
-
- __fireItemChange : function (oldItem, newItem) {
- return new rf.Event.fireById(this.id, "itemchange", {
- id: this.id,
- oldItem : oldItem,
- newItem : newItem
- });
- },
-
- __fireBeforeItemChange : function (oldItem, newItem) {
- return rf.Event.fireById(this.id, "beforeitemchange", {
- id: this.id,
- oldItem : oldItem,
- newItem : newItem
- });
- },
-
- destroy: function () {
- $super.destroy.call(this);
- }
- });
-
- // define super class link
- var $super = rf.ui.TogglePanel.$super;
-})(jQuery, RichFaces);
Deleted: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js 2010-12-08 12:24:06 UTC (rev 20455)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js 2010-12-08 12:27:08 UTC (rev 20456)
@@ -1,120 +0,0 @@
-/*
- * 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.
- */
-
-(function ($, rf) {
-
- rf.ui = rf.ui || {};
-
- rf.ui.TogglePanelItem = rf.BaseComponent.extendClass({
-
- // class name
- name:"TogglePanelItem",
-
- init : function (componentId, options) {
- // call constructor of parent class
- $super.constructor.call(this, componentId);
- this.attachToDom();
-
- this.options = $.extend(this.options, options || {});
- this.name = this.options.name;
- this.togglePanelId = this.options.togglePanelId;
- this.switchMode = this.options.switchMode;
- this.disabled = this.options.disabled || false;
- },
-
- /***************************** Public Methods *****************************************************************/
- /**
- * @methodOf TogglePanelItem
- * @name TogglePanelItem#getName
- *
- * @return {String} panel item name
- */
- getName: function () {
- return this.options.name;
- },
-
- /**
- * @methodOf
- * @name TogglePanelItem#getTogglePanel
- *
- * @return {TogglePanel} parent TogglePanel
- * */
- getTogglePanel : function () {
- return rf.$(this.togglePanelId);
- },
-
- /**
- * @methodOf
- * @name TogglePanelItem#isSelected
- *
- * @return {Boolean} true if this panel item is selected in the parent toggle panel
- * */
- isSelected : function () {
- return this.getName() == this.getTogglePanel().getSelectItem();
- },
-
-
- /***************************** Private Methods ****************************************************************/
-
- /**
- * @private
- *
- * used in TogglePanel
- * */
- __enter : function () {
- rf.getDomElement(this.id).style.display = "block";
-
- return this.__fireEnter();
- },
-
- /**
- * @private
- *
- * used in TogglePanel
- * */
- __leave : function () {
- var continueProcess = this.__fireLeave();
- if (!continueProcess) {
- return false;
- }
-
- rf.getDomElement(this.id).style.display = "none";
- return true;
- },
-
- __fireLeave : function () {
- return rf.Event.fireById(this.id, "__leave");
- },
-
- __fireEnter : function () {
- return rf.Event.fireById(this.id, "__enter");
- },
-
- // class stuff
- destroy: function () {
- $super.destroy.call(this);
- }
- });
-
- // define super class link
- var $super = rf.ui.TogglePanelItem.$super;
-})(jQuery, RichFaces);
Copied: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem_.js (from rev 20398, trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js)
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem_.js (rev 0)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem_.js 2010-12-08 12:27:08 UTC (rev 20456)
@@ -0,0 +1,120 @@
+/*
+ * 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.
+ */
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.TogglePanelItem = rf.BaseComponent.extendClass({
+
+ // class name
+ name:"TogglePanelItem",
+
+ init : function (componentId, options) {
+ // call constructor of parent class
+ $super.constructor.call(this, componentId);
+ this.attachToDom();
+
+ this.options = $.extend(this.options, options || {});
+ this.name = this.options.name;
+ this.togglePanelId = this.options.togglePanelId;
+ this.switchMode = this.options.switchMode;
+ this.disabled = this.options.disabled || false;
+ },
+
+ /***************************** Public Methods *****************************************************************/
+ /**
+ * @methodOf TogglePanelItem
+ * @name TogglePanelItem#getName
+ *
+ * @return {String} panel item name
+ */
+ getName: function () {
+ return this.options.name;
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanelItem#getTogglePanel
+ *
+ * @return {TogglePanel} parent TogglePanel
+ * */
+ getTogglePanel : function () {
+ return rf.$(this.togglePanelId);
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanelItem#isSelected
+ *
+ * @return {Boolean} true if this panel item is selected in the parent toggle panel
+ * */
+ isSelected : function () {
+ return this.getName() == this.getTogglePanel().getSelectItem();
+ },
+
+
+ /***************************** Private Methods ****************************************************************/
+
+ /**
+ * @private
+ *
+ * used in TogglePanel
+ * */
+ __enter : function () {
+ rf.getDomElement(this.id).style.display = "block";
+
+ return this.__fireEnter();
+ },
+
+ /**
+ * @private
+ *
+ * used in TogglePanel
+ * */
+ __leave : function () {
+ var continueProcess = this.__fireLeave();
+ if (!continueProcess) {
+ return false;
+ }
+
+ rf.getDomElement(this.id).style.display = "none";
+ return true;
+ },
+
+ __fireLeave : function () {
+ return rf.Event.fireById(this.id, "__leave");
+ },
+
+ __fireEnter : function () {
+ return rf.Event.fireById(this.id, "__enter");
+ },
+
+ // class stuff
+ destroy: function () {
+ $super.destroy.call(this);
+ }
+ });
+
+ // define super class link
+ var $super = rf.ui.TogglePanelItem.$super;
+})(jQuery, RichFaces);
Copied: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel_.js (from rev 20398, trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js)
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel_.js (rev 0)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel_.js 2010-12-08 12:27:08 UTC (rev 20456)
@@ -0,0 +1,433 @@
+/*
+ * 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.
+ */
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ /* SIMPLE INNER CLASS for handle switch operation*/
+ function SwitchItems(comp) {
+ this.comp = comp;
+ }
+
+ SwitchItems.prototype = {
+
+ /**
+ * @param {TogglePanelItem} oldPanel
+ * @param {TogglePanelItem} newPanel
+ *
+ * @return {void}
+ * */
+ exec : function (oldPanel, newPanel) {
+ if (newPanel.switchMode == "server") {
+ return this.execServer(oldPanel, newPanel);
+ } else if (newPanel.switchMode == "ajax") {
+ return this.execAjax(oldPanel, newPanel);
+ } else if (newPanel.switchMode == "client") {
+ return this.execClient(oldPanel, newPanel);
+ } else {
+ rf.log.error("SwitchItems.exec : unknown switchMode (" + this.comp.switchMode + ")");
+ }
+ },
+
+ /**
+ * @protected
+ * @param {TogglePanelItem} oldPanel
+ * @param {TogglePanelItem} newPanel
+ *
+ * @return {Boolean} false
+ * */
+ execServer : function (oldPanel, newPanel) {
+ if (oldPanel) {
+ var continueProcess = oldPanel.__leave();
+ if (!continueProcess) {
+ return false;
+ }
+ }
+
+ this.__setActiveItem(newPanel.getName());
+
+ rf.submitForm(this.__getParentForm());
+
+ return false;
+ },
+
+ /**
+ * @protected
+ * @param {TogglePanelItem} oldPanel
+ * @param {TogglePanelItem} newPanel
+ *
+ * @return {Boolean} false
+ * */
+ execAjax : function (oldPanel, newPanel) {
+ var options = $.extend({}, this.comp.options["ajax"], {}/*this.getParameters(newPanel)*/);
+
+ this.__setActiveItem(newPanel.getName());
+ rf.ajax(this.comp.id, null, options);
+
+ if (oldPanel) {
+ this.__setActiveItem(oldPanel.getName());
+ }
+
+ return false;
+ },
+
+ /**
+ * @protected
+ * @param {TogglePanelItem} oldPanel
+ * @param {TogglePanelItem} newPanel
+ *
+ * @return {undefined}
+ * - false - if process has been terminated
+ * - true - in other cases
+ * */
+ execClient : function (oldPanel, newPanel) {
+ if (oldPanel) {
+ var continueProcess = oldPanel.__leave();
+ if (!continueProcess) {
+ return false;
+ }
+ }
+
+ this.__setActiveItem(newPanel.getName());
+
+ newPanel.__enter();
+ this.comp.__fireItemChange(oldPanel, newPanel);
+
+ return true;
+ },
+
+ /**
+ * @private
+ * */
+ __getParentForm : function () {
+ return $(rf.getDomElement(this.comp.id)).parents('form:first');
+ },
+
+ /**
+ * @private
+ * */
+ __setActiveItem : function (name) {
+ rf.getDomElement(this.__getValueInputId()).value = name;
+ this.comp.activeItem = name;
+ },
+
+ /**
+ * @private
+ * */
+ __getValueInputId: function () {
+ return this.comp.id + "-value"
+ }
+ };
+
+ /**
+ * @class TogglePanel
+ * @name TogglePanel
+ *
+ * @constructor
+ * @param {String} componentId - component id
+ * @param {Hash} options - params
+ * */
+ rf.ui.TogglePanel = rf.BaseComponent.extendClass({
+
+ // class name
+ name:"TogglePanel",
+
+ init : function (componentId, options) {
+ $super.constructor.call(this, componentId);
+ this.attachToDom();
+
+ this.options = $.extend(this.options, options || {});
+ this.activeItem = this.options.activeItem;
+ this.items = this.options.items;
+
+ this.__addUserEventHandler("itemchange");
+ this.__addUserEventHandler("beforeitemchange");
+ },
+
+ /***************************** Public Methods ****************************************************************/
+
+ /**
+ * @methodOf
+ *
+ * @name TogglePanel#getSelectItem
+ *
+ * @return {String} name of current selected panel item
+ */
+ getSelectItem: function () {
+ return this.activeItem;
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanel#switchToItem
+ *
+ * @param {String} name - panel item name to switch
+ * we can use meta names @first, @prev, @next and @last
+ * @return {Boolean} - false if something wrong and true if all is ok
+ */
+ switchToItem: function (name) {
+ var newPanel = this.getNextItem(name);
+ if (newPanel == null) {
+ rf.log.warn("TogglePanel.switchToItems(" + name + "): item with name '" + name + "' not found");
+ return false;
+ }
+
+ var oldPanel = this.__getItemByName(this.getSelectItem());
+
+ var continueProcess = this.__fireBeforeItemChange(oldPanel, newPanel);
+ if (!continueProcess) {
+ rf.log.warn("TogglePanel.switchToItems(" + name + "): switch has been canceled by beforeItemChange event");
+ return false
+ }
+
+ return new SwitchItems(this).exec(oldPanel, newPanel);
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanel#getNextItem
+ *
+ * @param {String} name of TogglePanelItem or meta name (@first | @prev | @next | @last)
+ * @return {TogglePanelItem} null if item not found
+ */
+ getNextItem : function (name) {
+ if (name) {
+ var newItemIndex = this.__ITEMS_META_NAMES[name];
+ if (newItemIndex) {
+ return this.__getItem(newItemIndex(this));
+ } else {
+ return this.__getItemByName(name);
+ }
+ } else {
+ return this.__getItemByName(this.nextItem());
+ }
+ },
+
+ /**
+ * please, remove this method when client side ajax events will be added
+ *
+ * */
+ onCompleteHandler : function (newItemName) {
+ var oldItem = this.__getItemByName(this.activeItem);
+ var newItem = this.__getItemByName(newItemName);
+
+ // Don't do like this and remove it ASAP
+ new SwitchItems(this).execClient(oldItem, newItem);
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanel#getItems
+ *
+ * @return {TogglePanelItem[]} all defined panel items
+ */
+ getItems : function () {
+ return this.items;
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanel#getItemsNames
+ *
+ * @return {String[]} names of all defined items
+ */
+ getItemsNames: function () {
+ var res = [];
+ for (var item in this.items) {
+ res.push(this.items[item].getName());
+ }
+
+ return res;
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanel#nextItem
+ *
+ * @param {String} [itemName = activeItem]
+ * @return {String} name of next panel item
+ */
+ nextItem: function (itemName) {
+ var itemIndex = this.__getItemIndex(itemName || this.activeItem);
+ if (itemIndex == -1) {
+ return null;
+ }
+
+ return this.__getItemName(itemIndex + 1);
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanel#firstItem
+ *
+ * @return {String} name of first panel item
+ */
+ firstItem: function () {
+ return this.__getItemName(0);
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanel#lastItem
+ *
+ * @return {String} name of last panel item
+ */
+ lastItem: function () {
+ return this.__getItemName(this.items.length - 1);
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanel#prevItem
+ *
+ * @param {String} itemName
+ * @return {String} name of prev panel item
+ * null if it is first item
+ */
+ prevItem: function (itemName) {
+ var itemIndex = this.__getItemIndex(itemName || this.activeItem);
+ if (!this.options.cycledSwitching && itemIndex < 1) {
+ return null;
+ }
+
+ return this.__getItemName(itemIndex - 1);
+ },
+
+ /////////////////////////////////////////////////////////////////////////////////
+ //// Private
+ /////////////////////////////////////////////////////////////////////////////////
+
+ /********************* Methods *************************/
+
+ __ITEMS_META_NAMES : (function () {
+ function goFrom (comp, ind, step) {
+ var res = ind;
+ while ((!comp.items[res] || comp.items[res].disabled) && res < comp.items.length && res > 0) {
+ res += step;
+ }
+ return res;
+ }
+
+
+ return {
+ "@first" : function (comp) {
+ return goFrom(comp, 0, 1);
+ },
+
+ "@prev" : function (comp) {
+ return goFrom(comp, parseInt(comp.__getItemIndex(comp.activeItem)) - 1 , -1);
+ },
+
+ "@next" : function (comp) {
+ return goFrom(comp, parseInt(comp.__getItemIndex(comp.activeItem)) + 1 , 1);
+ },
+
+ "@last" : function (comp) {
+ return goFrom(comp, comp.items.length - 1, -1);
+ }
+ }
+ })(),
+
+ /**
+ * @private
+ * */
+ __getItemIndex : function (itemName) {
+ for (var i in this.items) {
+ if (!this.items[i].disabled && this.items[i].getName() === itemName) {
+ return parseInt(i);
+ }
+ }
+
+ rf.log.info("TogglePanel.getItemIndex: item with name '" + itemName + "' not found");
+ return -1;
+ },
+
+ /**
+ * @private
+ * */
+ __addUserEventHandler : function (name) {
+ var handler = this.options["on" + name];
+ if (handler) {
+ rf.Event.bindById(this.id, name, handler);
+ }
+ },
+
+ /**
+ * @private
+ * @param {Number} index - array index
+ *
+ * @return {TogglePanelItem}
+ * null - if item not found
+ * */
+ __getItem : function (index) {
+ if (this.options.cycledSwitching) {
+ var size = this.items.length;
+ return this.items[(size + index) % size]
+ } else if (index >= 0 && index < this.items.length) {
+ return this.items[index]
+ } else {
+ return null;
+ }
+ },
+
+ __getItemByName : function (name) {
+ return this.__getItem(this.__getItemIndex(name));
+ },
+
+ __getItemName : function (index) {
+ var item = this.__getItem(index);
+ if (item == null) {
+ return null;
+ }
+
+ return item.getName();
+ },
+
+ /**
+ * Fire Concealable Event
+ * */
+
+ __fireItemChange : function (oldItem, newItem) {
+ return new rf.Event.fireById(this.id, "itemchange", {
+ id: this.id,
+ oldItem : oldItem,
+ newItem : newItem
+ });
+ },
+
+ __fireBeforeItemChange : function (oldItem, newItem) {
+ return rf.Event.fireById(this.id, "beforeitemchange", {
+ id: this.id,
+ oldItem : oldItem,
+ newItem : newItem
+ });
+ },
+
+ destroy: function () {
+ $super.destroy.call(this);
+ }
+ });
+
+ // define super class link
+ var $super = rf.ui.TogglePanel.$super;
+})(jQuery, RichFaces);
Deleted: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tooltip.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tooltip.js 2010-12-08 12:24:06 UTC (rev 20455)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tooltip.js 2010-12-08 12:27:08 UTC (rev 20456)
@@ -1,295 +0,0 @@
-/*
- * 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.
- */
-
-
-(function ($, rf) {
-
- rf.ui = rf.ui || {};
-
- rf.ui.TooltipDirection = {
- topRight : "topRight",
- topLeft : "topLeft",
- bottomRight : "bottomRight",
- bottomLeft : "bottomLeft",
- auto : "auto",
-
- DEFAULT: "bottomRight"
- };
- var TooltipDirection = rf.ui.TooltipDirection;
-
- rf.ui.TooltipMode = {
- client : "client",
- ajax : "ajax",
-
- DEFAULT: "client"
- };
- var TooltipMode = rf.ui.TooltipMode;
-
- var DEFAULT_OPTIONS = {
- direction : TooltipDirection.DEFAULT,
- attached : true,
- offset : [],
- mode : TooltipMode.DEFAULT,
- disabled : false,
- hideDelay : 0,
- hideEvent : "mouseleave",
- showDelay : 0,
- showEvent : "mouseenter",
- followMouse : true
- };
-
- var SHOW_ACTION = {
-
- /**
- *
- * @return {void}
- * */
- exec : function (tooltip, event) {
- var mode = tooltip.mode;
- if (mode == TooltipMode.ajax) {
- return this.execAjax(tooltip, event);
- } else if (mode == TooltipMode.client) {
- return this.execClient(tooltip, event);
- } else {
- rf.log.error("SHOW_ACTION.exec : unknown mode (" + mode + ")");
- }
- },
-
- /**
- * @protected
- *
- * @return {Boolean} false
- * */
- execAjax : function (tooltip, event) {
- tooltip.__loading().show();
- tooltip.__content().hide();
- tooltip.__show(event);
-
- rf.ajax(tooltip.id, null, $.extend({}, tooltip.options["ajax"], {}));
-
- return true;
- },
-
- /**
- * @protected
- *
- * @return {undefined}
- * - false - if process has been terminated
- * - true - in other cases
- * */
- execClient : function (tooltip, event) {
- tooltip.__show(event);
-
- return tooltip.__fireShow();
- }
- };
-
- rf.ui.Tooltip = rf.BaseComponent.extendClass({
- // class name
- name:"Tooltip",
-
- /**
- * @class Tooltip
- * @name Tooltip
- *
- * @constructor
- * @param {String} componentId - component id
- * @param {Hash} options - params
- * */
- init : function (componentId, options) {
- $super.constructor.call(this, componentId);
- this.options = $.extend(this.options, DEFAULT_OPTIONS, options || {});
- this.attachToDom();
-
- this.mode = this.options.mode;
- this.target = this.options.target;
-
- this.__addUserEventHandler("hide");
- this.__addUserEventHandler("show");
- this.__addUserEventHandler("beforehide");
- this.__addUserEventHandler("beforeshow");
-
- this.popup = new RichFaces.ui.Popup(this.id, {
- attachTo: this.target,
- attachToBody: false,
- positionType: "TOOLTIP",
- positionOffset: [200,200]
- });
-
- var tooltip = this;
- function mouseMoveHandler(event) {
- tooltip.popup.show(event);
- }
-
- $(document.getElementById(this.target)).bind(this.options.showEvent, function (event) {
- tooltip.show(event);
-
- if (tooltip.options.followMouse) {
- $(document.getElementById(tooltip.target)).bind("mousemove", mouseMoveHandler);
- }
- });
-
- $(document.getElementById(tooltip.target)).bind(this.options.hideEvent, function (event) {
- tooltip.hide();
-
- if (tooltip.options.followMouse) {
- $(document.getElementById(tooltip.target)).unbind("mousemove", mouseMoveHandler);
- }
- });
-
- },
-
- /***************************** Public Methods ****************************************************************/
- /**
- * @methodOf
- * @name PanelMenuItem#hide
- *
- * TODO ...
- *
- * @return {void} TODO ...
- */
- hide: function () {
- var continueProcess = this.__fireBeforeHide();
- if (!continueProcess) {
- return false;
- }
-
- this.__hide();
-
- return this.__fireHide()
- },
-
- /**
- * @private
- * @return {void} TODO ...
- */
- __hide: function () {
- var tooltip = this;
- this.__delay(this.options.hideDelay, function () {
- tooltip.popup.hide();
- });
- },
-
- /**
- * @methodOf
- * @name PanelMenuItem#show
- *
- * TODO ...
- *
- * @return {void} TODO ...
- */
- show: function (event) {
- var continueProcess = this.__fireBeforeShow();
- if (!continueProcess) {
- return false;
- }
-
- SHOW_ACTION.exec(this, event);
- },
-
- onCompleteHandler : function () {
- this.__content().show();
- this.__loading().hide();
-
- return this.__fireShow();
- },
-
- /**
- * @private
- * @return {void} TODO ...
- */
- __show: function (event) {
- var tooltip = this;
- this.__delay(this.options.showDelay, function () {
- tooltip.popup.show(event);
- });
- },
-
- /***************************** Private Methods ****************************************************************/
- __delay : function (delay, action) {
- if (delay > 0) {
- var hidingTimerHandle = window.setTimeout(function() {
- action();
-
- if (hidingTimerHandle) {
- window.clearTimeout(hidingTimerHandle);
- hidingTimerHandle = undefined;
- }
- }, delay);
- } else {
- action();
- }
- },
-
- __detectAncestorNode: function(leaf, element) {
- // Return true if "element" is "leaf" or one of its parents
- var node = leaf;
- while (node != null && node != element) {
- node = node.parentNode;
- }
- return (node != null);
- },
-
- __loading : function () {
- return $(document.getElementById(this.id + ":loading"));
- },
-
- __content : function () {
- return $(document.getElementById(this.id + "@content"));
- },
-
- __fireHide : function () {
- return rf.Event.fireById(this.id, "hide", { id: this.id });
- },
-
- __fireShow : function () {
- return rf.Event.fireById(this.id, "show", { id: this.id });
- },
-
- __fireBeforeHide : function () {
- return rf.Event.fireById(this.id, "beforehide", { id: this.id });
- },
-
- __fireBeforeShow : function () {
- return rf.Event.fireById(this.id, "beforeshow", { id: this.id });
- },
-
-
-
- /**
- * @private
- * */
- __addUserEventHandler : function (name) {
- var handler = this.options["on" + name];
- if (handler) {
- rf.Event.bindById(this.id, name, handler);
- }
- },
-
- destroy: function () {
- $super.destroy.call(this);
- }
- });
-
- // define super class link
- var $super = rf.ui.Tooltip.$super;
-})(jQuery, RichFaces);
Copied: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tooltip_.js (from rev 20398, trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tooltip.js)
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tooltip_.js (rev 0)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tooltip_.js 2010-12-08 12:27:08 UTC (rev 20456)
@@ -0,0 +1,295 @@
+/*
+ * 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.
+ */
+
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.TooltipDirection = {
+ topRight : "topRight",
+ topLeft : "topLeft",
+ bottomRight : "bottomRight",
+ bottomLeft : "bottomLeft",
+ auto : "auto",
+
+ DEFAULT: "bottomRight"
+ };
+ var TooltipDirection = rf.ui.TooltipDirection;
+
+ rf.ui.TooltipMode = {
+ client : "client",
+ ajax : "ajax",
+
+ DEFAULT: "client"
+ };
+ var TooltipMode = rf.ui.TooltipMode;
+
+ var DEFAULT_OPTIONS = {
+ direction : TooltipDirection.DEFAULT,
+ attached : true,
+ offset : [],
+ mode : TooltipMode.DEFAULT,
+ disabled : false,
+ hideDelay : 0,
+ hideEvent : "mouseleave",
+ showDelay : 0,
+ showEvent : "mouseenter",
+ followMouse : true
+ };
+
+ var SHOW_ACTION = {
+
+ /**
+ *
+ * @return {void}
+ * */
+ exec : function (tooltip, event) {
+ var mode = tooltip.mode;
+ if (mode == TooltipMode.ajax) {
+ return this.execAjax(tooltip, event);
+ } else if (mode == TooltipMode.client) {
+ return this.execClient(tooltip, event);
+ } else {
+ rf.log.error("SHOW_ACTION.exec : unknown mode (" + mode + ")");
+ }
+ },
+
+ /**
+ * @protected
+ *
+ * @return {Boolean} false
+ * */
+ execAjax : function (tooltip, event) {
+ tooltip.__loading().show();
+ tooltip.__content().hide();
+ tooltip.__show(event);
+
+ rf.ajax(tooltip.id, null, $.extend({}, tooltip.options["ajax"], {}));
+
+ return true;
+ },
+
+ /**
+ * @protected
+ *
+ * @return {undefined}
+ * - false - if process has been terminated
+ * - true - in other cases
+ * */
+ execClient : function (tooltip, event) {
+ tooltip.__show(event);
+
+ return tooltip.__fireShow();
+ }
+ };
+
+ rf.ui.Tooltip = rf.BaseComponent.extendClass({
+ // class name
+ name:"Tooltip",
+
+ /**
+ * @class Tooltip
+ * @name Tooltip
+ *
+ * @constructor
+ * @param {String} componentId - component id
+ * @param {Hash} options - params
+ * */
+ init : function (componentId, options) {
+ $super.constructor.call(this, componentId);
+ this.options = $.extend(this.options, DEFAULT_OPTIONS, options || {});
+ this.attachToDom();
+
+ this.mode = this.options.mode;
+ this.target = this.options.target;
+
+ this.__addUserEventHandler("hide");
+ this.__addUserEventHandler("show");
+ this.__addUserEventHandler("beforehide");
+ this.__addUserEventHandler("beforeshow");
+
+ this.popup = new RichFaces.ui.Popup(this.id, {
+ attachTo: this.target,
+ attachToBody: false,
+ positionType: "TOOLTIP",
+ positionOffset: [200,200]
+ });
+
+ var tooltip = this;
+ function mouseMoveHandler(event) {
+ tooltip.popup.show(event);
+ }
+
+ $(document.getElementById(this.target)).bind(this.options.showEvent, function (event) {
+ tooltip.show(event);
+
+ if (tooltip.options.followMouse) {
+ $(document.getElementById(tooltip.target)).bind("mousemove", mouseMoveHandler);
+ }
+ });
+
+ $(document.getElementById(tooltip.target)).bind(this.options.hideEvent, function (event) {
+ tooltip.hide();
+
+ if (tooltip.options.followMouse) {
+ $(document.getElementById(tooltip.target)).unbind("mousemove", mouseMoveHandler);
+ }
+ });
+
+ },
+
+ /***************************** Public Methods ****************************************************************/
+ /**
+ * @methodOf
+ * @name PanelMenuItem#hide
+ *
+ * TODO ...
+ *
+ * @return {void} TODO ...
+ */
+ hide: function () {
+ var continueProcess = this.__fireBeforeHide();
+ if (!continueProcess) {
+ return false;
+ }
+
+ this.__hide();
+
+ return this.__fireHide()
+ },
+
+ /**
+ * @private
+ * @return {void} TODO ...
+ */
+ __hide: function () {
+ var tooltip = this;
+ this.__delay(this.options.hideDelay, function () {
+ tooltip.popup.hide();
+ });
+ },
+
+ /**
+ * @methodOf
+ * @name PanelMenuItem#show
+ *
+ * TODO ...
+ *
+ * @return {void} TODO ...
+ */
+ show: function (event) {
+ var continueProcess = this.__fireBeforeShow();
+ if (!continueProcess) {
+ return false;
+ }
+
+ SHOW_ACTION.exec(this, event);
+ },
+
+ onCompleteHandler : function () {
+ this.__content().show();
+ this.__loading().hide();
+
+ return this.__fireShow();
+ },
+
+ /**
+ * @private
+ * @return {void} TODO ...
+ */
+ __show: function (event) {
+ var tooltip = this;
+ this.__delay(this.options.showDelay, function () {
+ tooltip.popup.show(event);
+ });
+ },
+
+ /***************************** Private Methods ****************************************************************/
+ __delay : function (delay, action) {
+ if (delay > 0) {
+ var hidingTimerHandle = window.setTimeout(function() {
+ action();
+
+ if (hidingTimerHandle) {
+ window.clearTimeout(hidingTimerHandle);
+ hidingTimerHandle = undefined;
+ }
+ }, delay);
+ } else {
+ action();
+ }
+ },
+
+ __detectAncestorNode: function(leaf, element) {
+ // Return true if "element" is "leaf" or one of its parents
+ var node = leaf;
+ while (node != null && node != element) {
+ node = node.parentNode;
+ }
+ return (node != null);
+ },
+
+ __loading : function () {
+ return $(document.getElementById(this.id + ":loading"));
+ },
+
+ __content : function () {
+ return $(document.getElementById(this.id + "@content"));
+ },
+
+ __fireHide : function () {
+ return rf.Event.fireById(this.id, "hide", { id: this.id });
+ },
+
+ __fireShow : function () {
+ return rf.Event.fireById(this.id, "show", { id: this.id });
+ },
+
+ __fireBeforeHide : function () {
+ return rf.Event.fireById(this.id, "beforehide", { id: this.id });
+ },
+
+ __fireBeforeShow : function () {
+ return rf.Event.fireById(this.id, "beforeshow", { id: this.id });
+ },
+
+
+
+ /**
+ * @private
+ * */
+ __addUserEventHandler : function (name) {
+ var handler = this.options["on" + name];
+ if (handler) {
+ rf.Event.bindById(this.id, name, handler);
+ }
+ },
+
+ destroy: function () {
+ $super.destroy.call(this);
+ }
+ });
+
+ // define super class link
+ var $super = rf.ui.Tooltip.$super;
+})(jQuery, RichFaces);
14 years, 1 month
JBoss Rich Faces SVN: r20455 - in modules/tests/metamer/trunk/application/src/main/webapp: resources/metamer and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-12-08 07:24:06 -0500 (Wed, 08 Dec 2010)
New Revision: 20455
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richToolbar/simple.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/resources/metamer/attributes.xhtml
Log:
* added IDs to toolbar sample
* added ID to panel in attributes composite component
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richToolbar/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richToolbar/simple.xhtml 2010-12-08 12:19:29 UTC (rev 20454)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richToolbar/simple.xhtml 2010-12-08 12:24:06 UTC (rev 20455)
@@ -85,8 +85,8 @@
</rich:toolbarGroup>
<rich:toolbarGroup location="right">
- <h:inputText styleClass="barsearch" />
- <h:commandButton onclick="return false;" value="Search" />
+ <h:inputText id="input" styleClass="barsearch" />
+ <h:commandButton id="button" onclick="return false;" value="Search" />
</rich:toolbarGroup>
</rich:toolbar>
Modified: modules/tests/metamer/trunk/application/src/main/webapp/resources/metamer/attributes.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/resources/metamer/attributes.xhtml 2010-12-08 12:19:29 UTC (rev 20454)
+++ modules/tests/metamer/trunk/application/src/main/webapp/resources/metamer/attributes.xhtml 2010-12-08 12:24:06 UTC (rev 20455)
@@ -16,44 +16,44 @@
<composite:implementation>
<h:outputStylesheet library="metamer/css" name="attributes.ecss" target="head" />
-
+
<a4j:jsFunction id="submitAjaxFunction" name="submitAjax" execute="#{cc.attrs.execute}" render="#{cc.attrs.render}" />
- <a4j:outputPanel ajaxRendered="true">
- <h:panelGrid id="#{cc.attrs.id}" columns="#{cc.attrs.columns * 2}" styleClass="attributes"
- columnClasses="attributes-first-column, attributes-second-column, attributes-first-column, attributes-second-column">
- <c:forEach items="#{cc.attrs.value}" var="entry">
- <h:panelGroup layout="block">
- <h:outputLabel id="#{entry.key}Label" value="#{entry.key}" style="margin-right: 5px;" for="#{entry.key}Input"/>
- <h:graphicImage value="/resources/images/help.png" title="#{entry.value.help}"
- rendered="#{entry.value.help != null}" height="18px;"
- style="vertical-align: middle;" styleClass="attribute-help" >
- </h:graphicImage>
- </h:panelGroup>
-
- <c:choose>
- <c:when test="#{entry.value.bool}">
- <h:selectOneRadio id="#{entry.key}Input" value="#{entry.value.value}" onchange="#{cc.attrs.type == 'server' ? 'submit()' : 'submitAjax()'}">
- <f:selectItem itemValue="null" itemLabel="null"/>
- <f:selectItem itemValue="true" itemLabel="true"/>
- <f:selectItem itemValue="false" itemLabel="false"/>
- </h:selectOneRadio>
- </c:when>
-
- <c:when test="#{entry.value.selectOptions != null}">
- <h:selectOneRadio id="#{entry.key}Input" value="#{entry.value.value}" onchange="#{cc.attrs.type == 'server' ? 'submit()' : 'submitAjax()'}"
- layout="pageDirection">
- <f:selectItems value="#{entry.value.selectOptions}" />
- </h:selectOneRadio>
- </c:when>
-
- <c:otherwise>
- <h:inputText id="#{entry.key}Input" value="#{entry.value.value}" style="width: 200px;" onchange="#{cc.attrs.type == 'server' ? 'submit()' : 'submitAjax()'}" />
- </c:otherwise>
- </c:choose>
-
- </c:forEach>
- </h:panelGrid>
+ <a4j:outputPanel id="panel" ajaxRendered="true">
+ <h:panelGrid id="#{cc.attrs.id}" columns="#{cc.attrs.columns * 2}" styleClass="attributes"
+ columnClasses="attributes-first-column, attributes-second-column, attributes-first-column, attributes-second-column">
+ <c:forEach items="#{cc.attrs.value}" var="entry">
+ <h:panelGroup layout="block">
+ <h:outputLabel id="#{entry.key}Label" value="#{entry.key}" style="margin-right: 5px;" for="#{entry.key}Input"/>
+ <h:graphicImage value="/resources/images/help.png" title="#{entry.value.help}"
+ rendered="#{entry.value.help != null}" height="18px;"
+ style="vertical-align: middle;" styleClass="attribute-help" >
+ </h:graphicImage>
+ </h:panelGroup>
+
+ <c:choose>
+ <c:when test="#{entry.value.bool}">
+ <h:selectOneRadio id="#{entry.key}Input" value="#{entry.value.value}" onchange="#{cc.attrs.type == 'server' ? 'submit()' : 'submitAjax()'}">
+ <f:selectItem itemValue="null" itemLabel="null"/>
+ <f:selectItem itemValue="true" itemLabel="true"/>
+ <f:selectItem itemValue="false" itemLabel="false"/>
+ </h:selectOneRadio>
+ </c:when>
+
+ <c:when test="#{entry.value.selectOptions != null}">
+ <h:selectOneRadio id="#{entry.key}Input" value="#{entry.value.value}" onchange="#{cc.attrs.type == 'server' ? 'submit()' : 'submitAjax()'}"
+ layout="pageDirection">
+ <f:selectItems value="#{entry.value.selectOptions}" />
+ </h:selectOneRadio>
+ </c:when>
+
+ <c:otherwise>
+ <h:inputText id="#{entry.key}Input" value="#{entry.value.value}" style="width: 200px;" onchange="#{cc.attrs.type == 'server' ? 'submit()' : 'submitAjax()'}" />
+ </c:otherwise>
+ </c:choose>
+
+ </c:forEach>
+ </h:panelGrid>
</a4j:outputPanel>
</composite:implementation>
</h:body>
14 years, 1 month