JBoss Rich Faces SVN: r180 - trunk/richfaces/menu-components/src/main/templates/org/richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: a.izobov
Date: 2007-03-28 03:48:42 -0400 (Wed, 28 Mar 2007)
New Revision: 180
Modified:
trunk/richfaces/menu-components/src/main/templates/org/richfaces/htmlMenuGroup.jspx
Log:
script and iframe added
Modified: trunk/richfaces/menu-components/src/main/templates/org/richfaces/htmlMenuGroup.jspx
===================================================================
--- trunk/richfaces/menu-components/src/main/templates/org/richfaces/htmlMenuGroup.jspx 2007-03-27 19:54:16 UTC (rev 179)
+++ trunk/richfaces/menu-components/src/main/templates/org/richfaces/htmlMenuGroup.jspx 2007-03-28 07:48:42 UTC (rev 180)
@@ -15,6 +15,8 @@
<h:scripts>
new org.ajax4jsf.framework.resource.PrototypeScript(),
new org.ajax4jsf.framework.ajax.AjaxScript(),
+ scripts/menu.js,
+ scripts/css-rules.js
</h:scripts>
<f:clientid var="clientId"/>
@@ -54,12 +56,23 @@
<a href="#"><span class="rich-menu-item-label">#{component.attributes['value']}</span></a>
<div class="dr-menu-node rich-menu-item-folder">
- <div id="#{clientId}"
+ <div id="#{clientId}_menu"
class="dr-menu-list-border dr-menu-sublist rich-menu-list-border rich-menu-sublist">
<div class="dr-menu-list-bg rich-menu-list-bg">
<f:call name="renderChildren"/>
</div>
</div>
+ <iframe class="exadel_underneath_iframe"
+ id="#{clientId}_iframe"
+ style="position:absolute;">
+ </iframe>
+ <iframe class="exadel_underneath_iframe"
+ id="#{clientId}_iframe1"
+ style="position:absolute;">
+ </iframe>
+ <script type="text/javascript" id="#{clientId}_script">
+ <f:call name="getScript"/>
+ </script>
</div>
</div>
17 years, 1 month
JBoss Rich Faces SVN: r179 - in trunk: richfaces/suggestionbox/src/main/java/org/richfaces/renderkit/html and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-03-27 15:54:16 -0400 (Tue, 27 Mar 2007)
New Revision: 179
Added:
trunk/richfaces-samples/suggestionbox-sample/src/main/java/org/richfaces/AjaxListener.java
trunk/richfaces/suggestionbox/src/main/java/org/richfaces/component/AjaxSuggestionEvent.java
Modified:
trunk/richfaces-samples/suggestionbox-sample/src/main/webapp/pages/index.jsp
trunk/richfaces/suggestionbox/src/main/java/org/richfaces/component/UISuggestionBox.java
trunk/richfaces/suggestionbox/src/main/java/org/richfaces/renderkit/html/SuggestionBoxRenderer.java
Log:
RF-25 fixed. Changes:
1. UISuggestionBox now implements AjaxSource
2. AjaxSuggestionEvent providing submittedValue and handling for it have been added
3. Ajax listener printing submitted value added to test case
Added: trunk/richfaces/suggestionbox/src/main/java/org/richfaces/component/AjaxSuggestionEvent.java
===================================================================
--- trunk/richfaces/suggestionbox/src/main/java/org/richfaces/component/AjaxSuggestionEvent.java (rev 0)
+++ trunk/richfaces/suggestionbox/src/main/java/org/richfaces/component/AjaxSuggestionEvent.java 2007-03-27 19:54:16 UTC (rev 179)
@@ -0,0 +1,71 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+import javax.faces.component.UIComponent;
+
+import org.ajax4jsf.framework.ajax.AjaxEvent;
+
+public class AjaxSuggestionEvent extends AjaxEvent {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 9212067213575185754L;
+ /**
+ *
+ */
+ private Object _submittedValue;
+
+ /**
+ * @param component
+ * @param submittedValie
+ */
+ public AjaxSuggestionEvent(UIComponent component, Object submittedValue) {
+ super(component);
+ // TODO Auto-generated constructor stub
+ this._submittedValue = submittedValue;
+ }
+
+ /**
+ * @param component
+ */
+ public AjaxSuggestionEvent(UIComponent component) {
+ super(component);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @return Returns the submittedValie.
+ */
+ public Object getSubmittedValue() {
+ return this._submittedValue;
+ }
+
+ /**
+ * @param submittedValie The submittedValie to set.
+ */
+ public void setSubmittedValue(Object submittedValue) {
+ this._submittedValue = submittedValue;
+ }
+
+}
\ No newline at end of file
Modified: trunk/richfaces/suggestionbox/src/main/java/org/richfaces/component/UISuggestionBox.java
===================================================================
--- trunk/richfaces/suggestionbox/src/main/java/org/richfaces/component/UISuggestionBox.java 2007-03-27 19:34:43 UTC (rev 178)
+++ trunk/richfaces/suggestionbox/src/main/java/org/richfaces/component/UISuggestionBox.java 2007-03-27 19:54:16 UTC (rev 179)
@@ -24,6 +24,8 @@
import org.ajax4jsf.framework.ajax.AjaxComponent;
import org.ajax4jsf.framework.ajax.AjaxContext;
import org.ajax4jsf.framework.ajax.AjaxEvent;
+import org.ajax4jsf.framework.ajax.AjaxListener;
+import org.ajax4jsf.framework.ajax.AjaxSource;
import org.ajax4jsf.framework.renderer.AjaxRendererUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -41,7 +43,7 @@
* @author shura (latest modification by $Author: alexsmirnov $)
* @version $Revision: 1.5 $ $Date: 2007/03/01 22:37:50 $
*/
-public abstract class UISuggestionBox extends UIData implements AjaxComponent {
+public abstract class UISuggestionBox extends UIData implements AjaxComponent, AjaxSource {
private static Log log = LogFactory.getLog(UISuggestionBox.class);
@@ -155,5 +157,17 @@
}
}
+ public void addAjaxListener(AjaxListener listener) {
+ addFacesListener(listener);
+ }
+ public AjaxListener[] getAjaxListeners() {
+ return (AjaxListener[]) getFacesListeners(AjaxListener.class);
+ }
+
+ public void removeAjaxListener(AjaxListener listener) {
+ removeFacesListener(listener);
+ }
+
+
}
Modified: trunk/richfaces/suggestionbox/src/main/java/org/richfaces/renderkit/html/SuggestionBoxRenderer.java
===================================================================
--- trunk/richfaces/suggestionbox/src/main/java/org/richfaces/renderkit/html/SuggestionBoxRenderer.java 2007-03-27 19:34:43 UTC (rev 178)
+++ trunk/richfaces/suggestionbox/src/main/java/org/richfaces/renderkit/html/SuggestionBoxRenderer.java 2007-03-27 19:54:16 UTC (rev 179)
@@ -36,6 +36,7 @@
import org.ajax4jsf.framework.skin.SkinFactory;
import org.ajax4jsf.framework.util.javascript.JSFunction;
import org.ajax4jsf.framework.util.javascript.JSFunctionDefinition;
+import org.richfaces.component.AjaxSuggestionEvent;
import org.richfaces.component.SuggestionEvent;
import org.richfaces.component.UISuggestionBox;
@@ -105,7 +106,7 @@
Object elementValue = requestParameterMap.get(paramName);
FacesEvent event = new SuggestionEvent(component, elementValue);
component.queueEvent(event);
- component.queueEvent(new AjaxEvent(component));
+ component.queueEvent(new AjaxSuggestionEvent(component, elementValue));
}
}
Added: trunk/richfaces-samples/suggestionbox-sample/src/main/java/org/richfaces/AjaxListener.java
===================================================================
--- trunk/richfaces-samples/suggestionbox-sample/src/main/java/org/richfaces/AjaxListener.java (rev 0)
+++ trunk/richfaces-samples/suggestionbox-sample/src/main/java/org/richfaces/AjaxListener.java 2007-03-27 19:54:16 UTC (rev 179)
@@ -0,0 +1,28 @@
+/**
+ *
+ */
+package org.richfaces;
+
+import org.ajax4jsf.framework.ajax.AjaxEvent;
+import org.richfaces.component.AjaxSuggestionEvent;
+
+/**
+ * @author Nick Belaevski - nbelaevski(a)exadel.com
+ * created 27.03.2007
+ *
+ */
+public class AjaxListener implements org.ajax4jsf.framework.ajax.AjaxListener {
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.framework.ajax.AjaxListener#processAjax(org.ajax4jsf.framework.ajax.AjaxEvent)
+ */
+ public void processAjax(AjaxEvent event) {
+ System.out.println("AjaxListener.processAjax()");
+ if (event instanceof AjaxSuggestionEvent) {
+ AjaxSuggestionEvent ajaxSuggestionEvent = (AjaxSuggestionEvent) event;
+
+ System.out.println("Submitted value: " + ajaxSuggestionEvent.getSubmittedValue());
+ }
+ }
+
+}
Modified: trunk/richfaces-samples/suggestionbox-sample/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/richfaces-samples/suggestionbox-sample/src/main/webapp/pages/index.jsp 2007-03-27 19:34:43 UTC (rev 178)
+++ trunk/richfaces-samples/suggestionbox-sample/src/main/webapp/pages/index.jsp 2007-03-27 19:54:16 UTC (rev 179)
@@ -48,6 +48,8 @@
height="#{suggestionBox.height}"
shadowDepth="#{suggestionBox.shadowDepth}"
cellpadding="#{suggestionBox.cellpadding}">
+
+ <a4j:ajaxListener type="org.richfaces.AjaxListener"/>
<h:column>
<h:outputText value="#{result.text}"/>
</h:column>
17 years, 1 month
JBoss Rich Faces SVN: r178 - trunk/richfaces/drag-drop/src/main/templates/org/richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-03-27 15:34:43 -0400 (Tue, 27 Mar 2007)
New Revision: 178
Modified:
trunk/richfaces/drag-drop/src/main/templates/org/richfaces/htmlDragIndicator.jspx
Log:
Missind DndScript dependency added
Modified: trunk/richfaces/drag-drop/src/main/templates/org/richfaces/htmlDragIndicator.jspx
===================================================================
--- trunk/richfaces/drag-drop/src/main/templates/org/richfaces/htmlDragIndicator.jspx 2007-03-27 15:23:48 UTC (rev 177)
+++ trunk/richfaces/drag-drop/src/main/templates/org/richfaces/htmlDragIndicator.jspx 2007-03-27 19:34:43 UTC (rev 178)
@@ -14,6 +14,7 @@
<h:scripts>
new org.ajax4jsf.framework.resource.PrototypeScript(),
new org.ajax4jsf.framework.ajax.AjaxScript(),
+ new org.ajax4jsf.dnd.DnDScript(),
/org/richfaces/renderkit/html/scripts/dnd/dnd-common.js,
scripts/drag-indicator.js
</h:scripts>
17 years, 1 month
JBoss Rich Faces SVN: r177 - in trunk/richfaces-samples/dropdownmenu-sample/src/main/webapp: images and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: A.Skokov
Date: 2007-03-27 11:23:48 -0400 (Tue, 27 Mar 2007)
New Revision: 177
Added:
trunk/richfaces-samples/dropdownmenu-sample/src/main/webapp/images/
trunk/richfaces-samples/dropdownmenu-sample/src/main/webapp/images/ico1.gif
trunk/richfaces-samples/dropdownmenu-sample/src/main/webapp/images/ico2.gif
Modified:
trunk/richfaces-samples/dropdownmenu-sample/src/main/webapp/pages/index.jsp
Log:
sample updated
Added: trunk/richfaces-samples/dropdownmenu-sample/src/main/webapp/images/ico1.gif
===================================================================
(Binary files differ)
Property changes on: trunk/richfaces-samples/dropdownmenu-sample/src/main/webapp/images/ico1.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/richfaces-samples/dropdownmenu-sample/src/main/webapp/images/ico2.gif
===================================================================
(Binary files differ)
Property changes on: trunk/richfaces-samples/dropdownmenu-sample/src/main/webapp/images/ico2.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/richfaces-samples/dropdownmenu-sample/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/richfaces-samples/dropdownmenu-sample/src/main/webapp/pages/index.jsp 2007-03-27 15:21:27 UTC (rev 176)
+++ trunk/richfaces-samples/dropdownmenu-sample/src/main/webapp/pages/index.jsp 2007-03-27 15:23:48 UTC (rev 177)
@@ -18,14 +18,19 @@
<ddm:dropDownMenu id="dropDownMenu" popupWidth="#{bean.width}" value="Label">
<mc:menuItem id="menuItem11" value="Active1"/>
- <mc:menuItem id="menuItem12" value="Active1"/>
- <mc:menuItem id="menuItem13" value="Active1"/>
- <mc:menuItem id="menuItem14" value="Active1"/>
+ <mc:menuItem id="menuItem12" value="Active2"/>
+ <mc:menuItem id="menuItem13" value="Active3" icon="/images/ico1.gif"/>
+ <mc:menuItem id="menuItem14" value="Active4"/>
+ <mc:menuItem id="menuItem15" value="Active5">
+ <f:facet name="icon">
+ <h:graphicImage value="/images/ico2.gif" style="vertical-align: middle; margin-right : 10px;"/>
+ </f:facet>
+ </mc:menuItem>
<mc:menuSeparator id="menuSeparator1"/>
- <mc:menuItem id="menuItem15" value="Disable" disabled="true"/>
- <mc:menuItem id="menuItem16" value="Active1"/>
+ <mc:menuItem id="menuItem16" value="Disable6" disabled="true"/>
+ <mc:menuItem id="menuItem17" value="Active7"/>
</ddm:dropDownMenu>
<br/>
@@ -35,6 +40,7 @@
<h:outputText value="Width:"/>
<h:selectOneRadio value="#{bean.width}" onclick="submit()">
<f:selectItem itemLabel="auto" itemValue="auto"/>
+ <f:selectItem itemLabel="100" itemValue="100px"/>
<f:selectItem itemLabel="200" itemValue="200px"/>
<f:selectItem itemLabel="300" itemValue="300px"/>
<f:selectItem itemLabel="400" itemValue="400px"/>
17 years, 1 month
JBoss Rich Faces SVN: r176 - trunk/richfaces/dropdown-menu/design/menu.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-03-27 11:21:27 -0400 (Tue, 27 Mar 2007)
New Revision: 176
Modified:
trunk/richfaces/dropdown-menu/design/menu/menu.html
Log:
New menu design markup
Modified: trunk/richfaces/dropdown-menu/design/menu/menu.html
===================================================================
--- trunk/richfaces/dropdown-menu/design/menu/menu.html 2007-03-27 15:17:44 UTC (rev 175)
+++ trunk/richfaces/dropdown-menu/design/menu/menu.html 2007-03-27 15:21:27 UTC (rev 176)
@@ -32,7 +32,8 @@
position : relative;
}
.menu_item_unselect {
- border : 1px solid transparent;
+ border : 0px solid transparent;
+ padding : 2px 36px 2px 2px;
}
.menu_item_select {
border : 1px solid #4a70ab;
@@ -40,7 +41,8 @@
background : url(menu_item_bg.gif) repeat-x top #a9c5e7;
}
.menu_item_disabled {
- border : 1px solid transparent;
+ padding : 2px 36px 2px 2px;
+ border : 0px solid transparent;
cursor : default; color : #839eca;
}
.menu_ico {
@@ -108,15 +110,15 @@
<div class="menu_list_border menu_list_position">
<div class="menu_list_bg">
- <div class="menu_item menu_item_unselect" onmouseover="this.className='menu_item menu_item_select'" onmouseout="this.className='menu_item menu_item_unselect'"><img width="16" height="16" src="spacer.gif" class="menu_ico"><a href="#">test2gfsdgsdfgsfg0</a></div>
- <div class="menu_item menu_item_unselect" onmouseover="this.className='menu_item menu_item_select'" onmouseout="this.className='menu_item menu_item_unselect'"><img width="16" height="16" src="ico1.gif" class="menu_ico"><a href="#">test2gfsdgsdfgsfg1</a></div>
- <div class="menu_item menu_item_unselect" onmouseover="this.className='menu_item menu_item_select'" onmouseout="this.className='menu_item menu_item_unselect'"><img width="16" height="16" src="ico2.gif" class="menu_ico"><a href="#">test2gfsdgsdfgsfg2</a><div class="menu_node">
+ <div class="menu_item menu_item_unselect" onmouseover="this.className='menu_item menu_item_select'" onmouseout="this.className='menu_item menu_item_unselect'"><img width="16" height="16" src="spacer.gif" class="menu_ico"><a href="#">test2gfsdgsdfgsfg</a></div>
+ <div class="menu_item menu_item_unselect" onmouseover="this.className='menu_item menu_item_select'" onmouseout="this.className='menu_item menu_item_unselect'"><img width="16" height="16" src="ico1.gif" class="menu_ico"><a href="#">test2gfsdgsdfgsfg</a></div>
+ <div class="menu_item menu_item_unselect" onmouseover="this.className='menu_item menu_item_select'" onmouseout="this.className='menu_item menu_item_unselect'"><img width="16" height="16" src="ico2.gif" class="menu_ico"><a href="#">test2gfsdgsdfgsfg</a><div class="menu_node">
<div class="menu_list_border menu_sublist">
<div class="menu_list_bg">
- <div class="menu_item menu_item_unselect" onmouseover="this.className='menu_item menu_item_select'" onmouseout="this.className='menu_item menu_item_unselect'"><img width="16" height="16" src="spacer.gif" class="menu_ico"><a href="#">test2gfsdgsdfgsfg3</a></div>
- <div class="menu_item menu_item_unselect" onmouseover="this.className='menu_item menu_item_select'" onmouseout="this.className='menu_item menu_item_unselect'"><img width="16" height="16" src="ico1.gif" class="menu_ico"><a href="#">test2gfsdgsdfgsfg4</a></div>
- <div class="menu_item menu_item_unselect" onmouseover="this.className='menu_item menu_item_select'" onmouseout="this.className='menu_item menu_item_unselect'"><img width="16" height="16" src="ico2.gif" class="menu_ico"><a href="#">test2gfsdgsdfgsfg5</a><div class="menu_node">
+ <div class="menu_item menu_item_unselect" onmouseover="this.className='menu_item menu_item_select'" onmouseout="this.className='menu_item menu_item_unselect'"><img width="16" height="16" src="spacer.gif" class="menu_ico"><a href="#">test2gfsdgsdfgsfg</a></div>
+ <div class="menu_item menu_item_unselect" onmouseover="this.className='menu_item menu_item_select'" onmouseout="this.className='menu_item menu_item_unselect'"><img width="16" height="16" src="ico1.gif" class="menu_ico"><a href="#">test2gfsdgsdfgsfg</a></div>
+ <div class="menu_item menu_item_unselect" onmouseover="this.className='menu_item menu_item_select'" onmouseout="this.className='menu_item menu_item_unselect'"><img width="16" height="16" src="ico2.gif" class="menu_ico"><a href="#">test2gfsdgsdfgsfg</a><div class="menu_node">
<div class="menu_list_border menu_sublist">
<div class="menu_list_bg">
17 years, 1 month
JBoss Rich Faces SVN: r175 - trunk/richfaces/menu-components/src/main/resources/org/richfaces/renderkit/html/css.
by richfaces-svn-commits@lists.jboss.org
Author: F.antonov
Date: 2007-03-27 11:17:44 -0400 (Tue, 27 Mar 2007)
New Revision: 175
Modified:
trunk/richfaces/menu-components/src/main/resources/org/richfaces/renderkit/html/css/menucomponents.xcss
Log:
MenuItem component development.
Modified: trunk/richfaces/menu-components/src/main/resources/org/richfaces/renderkit/html/css/menucomponents.xcss
===================================================================
--- trunk/richfaces/menu-components/src/main/resources/org/richfaces/renderkit/html/css/menucomponents.xcss 2007-03-27 15:13:35 UTC (rev 174)
+++ trunk/richfaces/menu-components/src/main/resources/org/richfaces/renderkit/html/css/menucomponents.xcss 2007-03-27 15:17:44 UTC (rev 175)
@@ -9,26 +9,35 @@
font-size : 0px;
border-top: 1px solid #bfbfc0;
margin : 2px 0px 2px 24px;
+
}
.dr-menu-item {
padding : 1px 35px 1px 1px;
- white-space : nowrap;
- font-family : arial;
- font-size : 11px;
+ white-space : nowrap;
position : relative;
}
-.dr-menu-item-unselect {
- border : 1px solid transparent;
+.dr-menu-label {
+ font-family : arial;
+ font-size : 11px;
+ text-decoration : none;
}
-.dr-menu-item-select {
+.dr-menu-item-enabled {
+ border : 0px solid transparent;
+ padding : 2px 36px 2px 2px;
+}
+.dr-menu-item-hover {
border : 1px solid #4a70ab;
cursor : pointer;
background : url(menu_item_bg.gif) repeat-x top #a9c5e7;
}
.dr-menu-item-disabled {
border : 1px solid transparent;
- cursor : default; color : #839eca;
+ cursor : default;
+ color : #839eca;
}
+.dr-menu-label-disabled {
+ color : #839eca;
+}
.dr-menu-icon {
vertical-align: middle;
margin-right : 10px;
@@ -80,7 +89,7 @@
</u:style>
</u:selector>
-<u:selector name=".dr-menu-item-select">
+<u:selector name=".dr-menu-item-hover">
<u:style name="background-image">
<f:resource f:key="/org/richfaces/renderkit/html/images/menu_item_bg.gif"/>
</u:style>
17 years, 1 month
JBoss Rich Faces SVN: r174 - in trunk/richfaces/dropdown-menu/src/main: java/org/richfaces/renderkit/html and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: d.bulahov
Date: 2007-03-27 11:13:35 -0400 (Tue, 27 Mar 2007)
New Revision: 174
Added:
trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/
trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/css-rules.js
trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
Modified:
trunk/richfaces/dropdown-menu/src/main/config/component/dropdownmenu.xml
trunk/richfaces/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java
trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/css/dropdownmenu.xcss
trunk/richfaces/dropdown-menu/src/main/templates/org/richfaces/htmlDropDownMenu.jspx
Log:
Modified: trunk/richfaces/dropdown-menu/src/main/config/component/dropdownmenu.xml
===================================================================
--- trunk/richfaces/dropdown-menu/src/main/config/component/dropdownmenu.xml 2007-03-27 14:22:11 UTC (rev 173)
+++ trunk/richfaces/dropdown-menu/src/main/config/component/dropdownmenu.xml 2007-03-27 15:13:35 UTC (rev 174)
@@ -52,6 +52,7 @@
<description>
Delay between event and menu showing.
</description>
+ <defaultvalue><![CDATA[new Integer(300)]]></defaultvalue>
</property>
<property>
@@ -60,6 +61,7 @@
<description>
Delay between losing focus and menu closing.
</description>
+ <defaultvalue><![CDATA[new Integer(300)]]></defaultvalue>
</property>
<property>
Modified: trunk/richfaces/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java
===================================================================
--- trunk/richfaces/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java 2007-03-27 14:22:11 UTC (rev 173)
+++ trunk/richfaces/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java 2007-03-27 15:13:35 UTC (rev 174)
@@ -21,8 +21,17 @@
package org.richfaces.renderkit.html;
+
+
import org.ajax4jsf.framework.renderer.HeaderResourcesRendererBase;
import org.richfaces.component.UIDropDownMenu;
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+import org.richfaces.component.UIMenuItem;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+import javax.faces.context.ResponseWriter;
public class DropDownMenuRendererBase extends HeaderResourcesRendererBase {
@@ -35,4 +44,70 @@
return true;
}
+ public void encodeScript(FacesContext context, UIComponent component) throws IOException {
+ int showdelay = 300;
+ int hideDelay = 300;
+
+
+
+ try {
+ showdelay = Integer.parseInt(component.getAttributes().get("showDelay").toString());
+ hideDelay = Integer.parseInt(component.getAttributes().get("hideDelay").toString());
+ } catch(Exception e) {
+ }
+
+ StringBuffer buffer =
+ new StringBuffer("new Exadel.Menu.Layer('")
+ .append(component.getClientId(context))
+ .append("_menu")
+ .append("',")
+ .append(showdelay + ")");
+ buffer
+ .append(".asDropDown('")
+ .append(component.getClientId(context))
+ .append("','onmouseover')");
+
+ List kids = component.getChildren();
+ for (Iterator iter = kids.iterator(); iter.hasNext();) {
+ UIComponent kid = (UIComponent) iter.next();
+ String itemId = null;
+ if (kid instanceof UIMenuItem) {
+ itemId = kid.getClientId(context);
+ }
+ //else if (kid instanceof UIMenuNode) {
+ // itemId = "ref" + kid.getClientId(context);
+ //}
+
+ //if(itemId != null){
+ // if (kid instanceof UIMenuItem) {
+ // //UIMenuItem styledComponent = (UIMenuItem) kid;
+ // buffer
+ // .append(".addItem('")
+ // .append(itemId)
+ // .append("','")
+ // .append("null")
+ // .append("','")
+ // .append("null")
+ // .append("','")
+ // .append("null")
+ // .append("','")
+ // .append("null")
+ // .append("')");
+ // }
+ //}
+ }
+ ResponseWriter out = context.getResponseWriter();
+ String script =buffer.append(";").toString();
+ out.write(script);
+
+ //return buffer.append(";").toString();
+
+ //new Exadel.Menu.Layer("#{clientId}","300").asDropDown("#{clientId}","onmouseover");
+ }
+
+
+
+
+
+
}
Modified: trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/css/dropdownmenu.xcss
===================================================================
--- trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/css/dropdownmenu.xcss 2007-03-27 14:22:11 UTC (rev 173)
+++ trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/css/dropdownmenu.xcss 2007-03-27 15:13:35 UTC (rev 174)
@@ -43,6 +43,17 @@
.dr-label-text-decor {
font-weight : bold;
}
+.underneath_iframe{
+ position: absolute;
+ z-index: 90;
+ visibility:hidden;
+ left:0px;
+ top:0px;
+ height:1px;
+ width:1px;
+ /*display:none;*/
+}
+
]]>
</f:verbatim>
Added: trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/css-rules.js
===================================================================
--- trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/css-rules.js (rev 0)
+++ trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/css-rules.js 2007-03-27 15:13:35 UTC (rev 174)
@@ -0,0 +1,49 @@
+if(!Exadel) var Exadel = {};
+Exadel.extractRules = function(style){
+ var rules = style.split(";");
+ var rulesHash = {};
+ $A(rules).each(
+ function(rule){
+ if(!rule) return;
+ var i = rule.indexOf(':');
+ if(i > 0){
+ var nam = Exadel.trimString(rule.substr(0, i));
+ val = Exadel.trimString(rule.substr(i + 1));
+ rulesHash[nam] = val;
+ }
+
+ }
+ );
+ return rulesHash;
+}
+Exadel.extractCamelizedRules = function(style){
+ var hash = Exadel.extractRules(style);
+ var newHash = {};
+ for(key in hash){
+ newHash[key.camelize()] = hash[key];
+ }
+ return newHash;
+}
+Exadel.trimString = function(s){
+ return s.replace(/^\s+/, '').replace(/\s+$/, '');
+}
+
+Exadel.replaceStyleHash = function(obj, hash1, hash2){
+ for(key in hash1){
+ obj.style[key] = '';
+ }
+ for(key in hash2){
+ obj.style[key] = hash2[key];
+ }
+}
+
+Exadel.replaceStyle = function(obj, style1, style2){
+ var hash1 = Exadel.extractRules(style1);
+ for(key in hash1){
+ hash1[key] = '';
+ }
+ var hash2 = Exadel.extractRules(style2);
+ Element.setStyle(obj, hash1);
+ Element.setStyle(obj, hash2);
+ return $H(obj.style).inspect();
+}
\ No newline at end of file
Added: trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
===================================================================
--- trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js (rev 0)
+++ trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2007-03-27 15:13:35 UTC (rev 174)
@@ -0,0 +1,938 @@
+/**
+ * Enable log if defined variable 'LOG'
+ */
+if(!LOG){
+ var LOG = {a4j_debug:function(){}};
+}
+
+if(!Exadel) var Exadel = {};
+if(!Exadel.Menu) Exadel.Menu = {};
+
+/**
+ * Fixes IE bug with incorrect layer width when set to auto
+ * @param layer
+ */
+Exadel.Menu.fitLayerToContent = function(layer) {
+ if (!Exadel.Menu.Layers.IE)
+ return;
+
+ var table = layer.childNodes[0];
+ if (table) {
+ var tmpDims = Element.getDimensions(table);
+ layer.style.width = tmpDims.width + "px";
+ //layer.style.height = dims.height + "px";
+ } // if
+}
+
+Exadel.Menu.Layers = {
+ listl: new Array(),
+ father: {},
+ lwidthDetected:false,
+ lwidth:{},
+ back: new Array(),
+ horizontals: {},
+ layers: {},
+ levels: ['','','','','','','','','','',''],
+ detectWidth: function(){
+ this.IE = (navigator.userAgent.indexOf('MSIE') > -1) && (navigator.userAgent.indexOf('Opera') < 0);
+ this.NS = (navigator.userAgent.indexOf('Netscape') > -1);
+ }
+ ,
+
+ menuTopShift : -11,
+ menuRightShift : 11,
+ menuLeftShift : 0,
+ shadowWidth: 0,
+ thresholdY : 0,
+ abscissaStep : 180,
+
+ CornerRadius: 0,
+
+ toBeHidden : new Array(),
+ toBeHiddenLeft : new Array(),
+ toBeHiddenTop : new Array(),
+
+ layersMoved : 0,
+ layerPoppedUp : '',
+ layerTop : new Array(),
+ layerLeft : new Array(),
+ timeoutFlag : 0,
+ useTimeouts : 1,
+ timeoutLength : 500,
+ showTimeOutFlag : 0,
+ showTimeoutLength: 0,
+ queuedId : '',
+
+ LMPopUp:function(menuName, isCurrent) {
+ if (!this.loaded || ( this.isVisible(menuName) && !isCurrent)) {
+ return;
+ }
+ if (menuName == this.father[this.layerPoppedUp]) {
+ this.LMPopUpL(this.layerPoppedUp, false);
+ } else if (this.father[menuName] == this.layerPoppedUp) {
+ this.LMPopUpL(menuName, true);
+ } else {
+ //this.shutdown();
+ foobar = menuName;
+ do {
+ this.LMPopUpL(foobar, true);
+ foobar = this.father[foobar];
+ } while (foobar);
+ }
+ this.layerPoppedUp = menuName;
+ },
+
+ isVisible: function(layer) {
+ return ($(layer).style.visibility == 'visible');
+ },
+
+ /**
+ * @param menuName
+ * @param visibleFlag
+ */
+ LMPopUpL: function(menuName, visibleFlag) {
+ if (!this.loaded) {
+ return;
+ }
+ this.detectWidth();
+ Exadel.Menu.fitLayerToContent($(menuName));
+ this.setVisibility(menuName, visibleFlag);
+ this.ieSelectWorkAround(menuName, visibleFlag);
+ },
+
+ ieSelectWorkAround: function(menuName, on){
+ //alert(navigator.userAgent);
+ if(this.IE || this.NS) {
+ menuName = $(menuName).id;
+ var iframe = $(menuName + "_iframe");
+ var iframe1 = $(menuName + "_iframe1");
+ var nsfix = (this.NS ? 7 : 0);
+ if(on){
+ Position.clone(menuName, iframe);
+ var dim = Element.getDimensions(iframe);
+ iframe.style.top = (iframe.style.pixelTop + Math.round(this.CornerRadius / 2)) + "px";
+ iframe.style.left = (iframe.offsetLeft) + "px";
+ iframe.style.width = (dim.width - this.shadowWidth - nsfix) + "px";
+ iframe.style.visibility = "visible";
+ iframe.style.height = (dim.height - this.CornerRadius - 1 - this.shadowWidth - nsfix) + "px";
+
+ Position.clone(menuName, iframe1);
+ dim = Element.getDimensions(iframe1);
+ iframe1.style.top = (iframe1.style.pixelTop) + "px";
+ iframe1.style.left = (iframe1.offsetLeft + Math.round(this.CornerRadius / 2)) + "px";
+ iframe1.style.width = (dim.width - this.CornerRadius - this.shadowWidth - nsfix - 1) + "px";
+ iframe1.style.visibility = "visible";
+ iframe1.style.height = (dim.height - this.shadowWidth - nsfix) + "px";
+ } else {
+ iframe.style.visibility = "hidden";
+ iframe1.style.visibility = "hidden";
+ }
+ }
+ },
+
+ shutdown: function () {
+ var needToResetLayers = false;
+ for (i=0; i<this.listl.length; i++) {
+ var layerId = this.listl[i];
+ if ($(layerId)) {
+ this.LMPopUpL(layerId, false);
+ } else {
+ needToResetLayers = true;
+ }
+ }
+
+ if (needToResetLayers) {
+ this.resetLayers();
+ }
+
+ this.layerPoppedUp = '';
+ if (this.Konqueror || this.IE5) {
+ this.seeThroughElements(true);
+ }
+ },
+ resetLayers: function() {
+ var newList = new Array();
+ for (i=0; i<this.listl.length; i++) {
+ var layer = this.listl[i];
+ if ($(layer)) {
+ newList.push(layer);
+ }
+ }
+
+ this.listl = newList;
+ }
+ ,
+
+ /**
+ * Set visibility
+ * @param layer the layer to visibility
+ * @param visible the boolean flag, if true to set visible layer from variable, otherwise - hide this layer
+ */
+ setVisibility: function (layer, visible) {
+ var tmpLayer = $(layer);
+
+ if (visible) {
+ tmpLayer.style.visibility = 'visible';
+ } else {
+ if(tmpLayer.getElementsByTagName){
+ var inputs = tmpLayer.getElementsByTagName('INPUT');
+ if(inputs){
+ $A(inputs).each(function(node){node.blur()});
+ } // if
+ } // if
+
+ tmpLayer.style.visibility = 'hidden';
+ } // else
+ },
+
+
+ clearLMTO: function () {
+ if (this.useTimeouts) {
+ clearTimeout(this.timeoutFlag);
+ }
+ },
+
+ setLMTO: function (ratio) {
+ if(!ratio){
+ ratio = 1;
+ }
+ if (this.useTimeouts) {
+ clearTimeout(this.timeoutFlag);
+ this.timeoutFlag = setTimeout('Exadel.Menu.Layers.shutdown()', this.timeoutLength * ratio);
+ }
+ },
+
+ loaded:1,
+
+ clearPopUpTO: function(){
+ clearTimeout(this.showTimeOutFlag);
+ },
+ showMenuLayer: function (layerId, e, delay){
+ this.clearPopUpTO();
+ this.showTimeOutFlag = setTimeout(new Exadel.Menu.DelayedPopUp(layerId, e).show, delay);
+ },
+ showDropDownLayer: function (layerId, parentId, e, delay){
+ this.clearPopUpTO();
+ this.showTimeOutFlag = setTimeout(new Exadel.Menu.DelayedDropDown(layerId, parentId, e).show, delay);
+ },
+ showPopUpLayer: function (layer, e){
+ this.shutdown();
+ this.detectWidth();
+ this.LMPopUp(menuName, false);
+ this.setLMTO(4);
+ }
+};
+
+/**
+ * return true if defined document element or document body, otherwise return false
+ */
+Exadel.Menu.getWindowElement = function() {
+ return (document.documentElement || document.body);
+}
+
+Exadel.Menu.getWindowDimensions = function() {
+ var x,y;
+ if (self.innerHeight) // all except Explorer
+ {
+ x = self.innerWidth;
+ y = self.innerHeight;
+ }
+ else if (document.documentElement && document.documentElement.clientHeight)
+ // Explorer 6 Strict Mode
+ {
+ x = document.documentElement.clientWidth;
+ y = document.documentElement.clientHeight;
+ }
+ else if (document.body) // other Explorers
+ {
+ x = document.body.clientWidth;
+ y = document.body.clientHeight;
+ }
+ return {width:x, height:y};
+}
+
+Exadel.Menu.getWindowScrollOffset = function() {
+ var x,y;
+ if (typeof pageYOffset != "undefined") // all except Explorer
+ {
+ x = window.pageXOffset;
+ y = window.pageYOffset;
+ }
+ else if (document.documentElement && document.documentElement.scrollTop)
+ // Explorer 6 Strict
+ {
+ x = document.documentElement.scrollLeft;
+ y = document.documentElement.scrollTop;
+ }
+ else if (document.body) // all other Explorers
+ {
+ x = document.body.scrollLeft;
+ y = document.body.scrollTop;
+ }
+
+ return {top:y, left: x};
+}
+
+Exadel.Menu.getPageDimensions = function() {
+ var x,y;
+ var test1 = document.body.scrollHeight;
+ var test2 = document.body.offsetHeight;
+ if (test1 > test2) {
+ // all but Explorer Mac
+ x = document.body.scrollWidth;
+ y = document.body.scrollHeight;
+ }
+ else {
+ // Explorer Mac;
+ // would also work in Explorer 6 Strict, Mozilla and Safari
+
+ x = document.body.offsetWidth;
+ y = document.body.offsetHeight;
+ }
+
+ return {width:x, height:y};
+}
+
+
+Exadel.Menu.DelayedContextMenu = function(layer, e) {
+ if (!e) {
+ e = window.event;
+ }
+ this.event = e;
+ this.element = Event.element(e);
+ this.layer = $(layer);
+ this.show = function() {
+ Exadel.Menu.Layers.shutdown();
+ var body = Exadel.Menu.getPageDimensions();
+ var win = Exadel.Menu.getWindowDimensions();
+ var bodyHeight = body.height;
+ var bodyWidth = body.width;
+ var clientX = this.event.clientX;
+ var clientY = this.event.clientY;
+
+ var top = Event.pointerY(this.event);
+ var left = Event.pointerX(this.event);
+ var layerdim = Element.getDimensions(this.layer);
+ var layerLeft = left;
+
+ if (clientX + layerdim.width > win.width) {
+ layerLeft -= (layerdim.width - Exadel.Menu.Layers.shadowWidth - Exadel.Menu.Layers.CornerRadius);
+ }
+
+ if (layerLeft < 0) {
+ layerLeft = 0;
+ }
+
+ /*
+ if (layerLeft + layerdim.width > bodyWidth) {
+ layerLeft = bodyWidth - layerdim.width;
+ }
+
+ if (layerLeft < 0) {
+ layerLeft = 0;
+ }
+ */
+ var layerTop = top;
+ /*if (layertop + layerdim.height > bodyHeight) {
+ layertop = bodyHeight - layerdim.height;
+ }
+
+ if (layertop < 0) {
+ layertop = 0;
+ }
+ */
+ if (clientY + layerdim.height > win.height) {
+ layerTop -= (layerdim.height - Exadel.Menu.Layers.shadowWidth - Exadel.Menu.Layers.CornerRadius);
+ }
+
+ if (layerTop < 0) {
+ layerTop = 0;
+ }
+
+ this.layer.style.left = layerLeft + "px";
+ this.layer.style.top = layerTop + "px";
+
+ Exadel.Menu.Layers.LMPopUp(this.layer.id, false);
+ Exadel.Menu.Layers.clearLMTO();
+ }.bind(this);
+}
+
+
+/**
+ * Calculates for DROPDOWN
+ */
+Exadel.Menu.DelayedDropDown = function(layer, elementId, e) {
+ if (!e) {
+ e = window.event;
+ }
+
+ this.event = e;
+ this.element = $(elementId) || Event.element(e);
+ this.layer = $(layer);
+ Event.stop(e);
+
+
+
+ this.show = function() {
+ Exadel.Menu.Layers.shutdown();
+
+ var winOffset = Exadel.Menu.getWindowScrollOffset();
+ var win = Exadel.Menu.getWindowDimensions();
+ var pageDims = Exadel.Menu.getPageDimensions();
+
+
+ var windowHeight = win.height;
+ var windowWidth = win.width;
+ var screenOffset = Position.cumulativeOffset(this.element);
+ var dim = Element.getDimensions(this.element);
+
+ // parent element
+// var top = screenOffset[1];
+// var left = screenOffset[0];
+ var top = 0;
+ var left = 0;
+
+ var bottom = top + dim.height;
+ var right = left + dim.width;
+
+ var layerdim = Element.getDimensions(this.layer);
+ var layerLeft = Math.max(left,winOffset.left);
+
+ if (layerLeft + layerdim.width - winOffset.left > windowWidth) {
+ layerLeft = right - layerdim.width + Exadel.Menu.Layers.shadowWidth;
+ }
+
+ if (layerLeft + layerdim.width - winOffset.left > windowWidth) {
+// layerLeft = windowWidth - layerdim.width;
+ layerLeft = windowWidth + winOffset.left - layerdim.width;
+ }
+
+ if (layerLeft < 0) {
+ layerLeft = 0;
+ }
+
+
+
+ // calculate top of layer
+ var layerTop = bottom;
+
+ if ( (layerdim.height + 20) < (win.height - (bottom-winOffset.top)) ) {
+ layerTop = bottom;
+ } else {
+ if ( (top-winOffset.top) > (layerdim.height + 20) ) {
+ layerTop = top - layerdim.height;
+ } else {
+ layerTop = windowHeight - 20 - layerdim.height + winOffset.top;
+ } // else
+ } // else
+
+ // fixing negative layerTop
+ if (layerTop < 0) {
+ layerTop = 0;
+ }
+
+ this.layer.style.left = layerLeft + "px";
+ this.layer.style.top = layerTop + "px";
+
+
+ Exadel.Menu.Layers.LMPopUp(this.layer.id, false);
+ Exadel.Menu.Layers.clearLMTO();
+ }.bind(this);
+}
+
+Exadel.Menu.DelayedPopUp = function(layer, e) {
+ if (!e) {
+ e = window.event;
+ }
+
+ this.event = e;
+ this.element = Event.findElement(e, 'td');
+ this.layer = $(layer);
+
+ this.show = function() {
+ if (!Exadel.Menu.Layers.isVisible(this.layer)){
+ this.reposition();
+ Exadel.Menu.Layers.LMPopUp(this.layer, false);
+ }
+ }.bind(this);
+}
+
+Exadel.Menu.DelayedPopUp.prototype.reposition = function() {
+ var body = Exadel.Menu.getPageDimensions();
+ var windowHeight = body.height;
+ var windowWidth = body.width;
+ var scrolls = {top:0, left:0};
+ var screenOffset = Position.cumulativeOffset(this.element);
+ var dim = Element.getDimensions(this.element);
+ var top = screenOffset[1] + scrolls.top;
+ var bottom = top + dim.height;
+ var left = screenOffset[0] + scrolls.left;
+ var right = left + dim.width;
+ var layerdim = Element.getDimensions(this.layer);
+ var layerLeft = right;
+
+ if (layerLeft + layerdim.width >= windowWidth) {
+ layerLeft = left - layerdim.width + Exadel.Menu.Layers.shadowWidth;
+ }
+
+ if (layerLeft < 0) {
+ layerLeft = 0;
+ }
+
+ // search offsetTop (ch-1351)
+ var layerOffset = Position.cumulativeOffset(this.layer);
+ var items = document.getElementsByClassName("exadel_menuItem",this.layer);
+ var nodes = document.getElementsByClassName("exadel_menuNode",this.layer);
+ var firstItem = (items.length>0) ? items[0] : ((nodes.length>0) ? nodes[0] : null);
+ if (firstItem) {
+ if (nodes.length>0 && firstItem.offsetTop>nodes[0].offsetTop) firstItem = nodes[0];
+ var itemOffset = Position.cumulativeOffset(firstItem);
+ layertop = top -(itemOffset[1]-layerOffset[1]);
+ if (layertop + layerdim.height >= windowHeight) {
+ var lastItem = (items.length>0) ? items[items.length-1] : nodes[nodes.length-1];
+ if (nodes.length>0 && lastItem.offsetTop<nodes[nodes.length-1].offsetTop) lastItem = nodes[nodes.length-1];
+ itemOffset = Position.cumulativeOffset(lastItem);
+ layertop = top -(itemOffset[1]-layerOffset[1]);
+ }
+ } else layertop = top - Exadel.Menu.Layers.CornerRadius;
+
+ if (layertop < 0) {
+ layertop = 0;
+ }
+
+ this.layer.style.left = layerLeft + "px";
+ this.layer.style.top = layertop + "px";
+}
+/**
+ * set to true when a dropdown box inside menu receives focus
+ */
+Exadel.Menu.selectOpen = false;
+Exadel.Menu.MouseIn = false;
+
+
+Exadel.Menu.Layer = Class.create();
+Exadel.Menu.Layer.mouseover =
+ function(e){
+ Exadel.Menu.MouseIn=true;
+ Exadel.Menu.Layers.clearLMTO();
+ Event.stop(e);
+ }.bindAsEventListener();
+
+Exadel.Menu.Layer.mouseout =
+ function(e){
+ Exadel.Menu.MouseIn = false;
+ if (!Exadel.Menu.selectOpen) {
+ Exadel.Menu.Layers.setLMTO();
+ }
+ Event.stop(e);
+ }.bindAsEventListener();
+
+Exadel.Menu.Layer.openSelect = function(){
+ Exadel.Menu.selectOpen = true;
+ var ClickInput = Exadel.Menu.Layer.ClickInput.bindAsEventListener(this);
+ Event.observe(Event.element(event), "click", Exadel.Menu.Layer.ClickInput);
+
+}
+Exadel.Menu.Layer.closeSelect = function(){
+ Exadel.Menu.selectOpen = false;
+
+ var ClickInput = Exadel.Menu.Layer.ClickInput.bindAsEventListener(this);
+ Event.stopObserving(Event.element(event), "click", Exadel.Menu.Layer.ClickInput);
+ if (Exadel.Menu.MouseIn == false){
+ Exadel.Menu.Layers.setLMTO();
+ }
+}
+
+Exadel.Menu.Layer.OnKeyPress = function(event){
+
+ if(event.keyCode==13){
+ Exadel.Menu.Layers.setLMTO();
+ }
+}
+
+
+Exadel.Menu.Layer.MouseoverInInput = function(event){
+//alert("event rabotaet "+ event.target);
+var ClickInput = Exadel.Menu.Layer.ClickInput.bindAsEventListener(this);
+Event.observe(Event.element(event), "click", Exadel.Menu.Layer.ClickInput);
+
+
+}
+
+Exadel.Menu.Layer.ClickInput = function(event){
+ //alert("event rabotaet dsds ");
+ Event.stop(event || window.event);
+ return false;
+}
+
+Exadel.Menu.Layer.MouseoutInInput = function(event){
+ var ClickInput = Exadel.Menu.Layer.ClickInput.bindAsEventListener(this);
+ Event.stopObserving(Event.element(event), "click", Exadel.Menu.Layer.ClickInput);
+
+}
+
+
+Exadel.Menu.Layer.prototype = {
+ initialize: function(id,delay){
+ Exadel.Menu.Layers.listl.push(id);
+ this.id = id;
+ this.layer = $(id);
+ this.level = 0;
+ this.delay = delay;
+ Exadel.Menu.fitLayerToContent(this.layer);
+ this.items = new Array();
+ Exadel.Menu.Layers.layers[id] = this;
+ this.bindings = new Array();
+
+ var binding = new Exadel.Menu.Layer.Binding (
+ this.id,
+ "mouseover",
+ Exadel.Menu.Layer.mouseover);
+
+ this.bindings.push(binding);
+ binding.refresh();
+ binding = new Exadel.Menu.Layer.Binding (
+ this.id,
+ "mouseout",
+ Exadel.Menu.Layer.mouseout);
+ this.bindings.push(binding);
+ binding.refresh();
+
+ $A(this.layer.getElementsByTagName("select"))
+ .each(
+ function(select) {
+ Event.observe(select, "focus", Exadel.Menu.Layer.openSelect);
+ Event.observe(select, "blur", Exadel.Menu.Layer.closeSelect);
+
+ var MouseoverInInput = Exadel.Menu.Layer.MouseoverInInput.bindAsEventListener(this);
+ var MouseoutInInput = Exadel.Menu.Layer.MouseoutInInput.bindAsEventListener(this);
+ Event.observe(select, "mouseover", MouseoverInInput);
+ Event.observe(select, "mouseout", MouseoutInInput);
+
+ var OnKeyPress = Exadel.Menu.Layer.OnKeyPress.bindAsEventListener(this);
+ Event.observe(select, "keypress", OnKeyPress);
+
+ }
+ );
+
+ $A(this.layer.getElementsByTagName("input"))
+ .each(
+ function(input) {
+ //alert("add event");
+ Event.observe(input, "focus", Exadel.Menu.Layer.openSelect);
+ Event.observe(input, "blur", Exadel.Menu.Layer.closeSelect);
+
+
+ var MouseoverInInput = Exadel.Menu.Layer.MouseoverInInput.bindAsEventListener(this);
+ var MouseoutInInput = Exadel.Menu.Layer.MouseoutInInput.bindAsEventListener(this);
+ Event.observe(input, "mouseover", MouseoverInInput);
+ Event.observe(input, "mouseout", MouseoutInInput);
+
+ var OnKeyPress = Exadel.Menu.Layer.OnKeyPress.bindAsEventListener(this);
+ Event.observe(input, "keypress", OnKeyPress);
+
+ }
+ );
+
+
+ $A(this.layer.getElementsByTagName("textarea"))
+ .each(
+ function(textarea) {
+ Event.observe(textarea, "focus", Exadel.Menu.Layer.openSelect);
+ Event.observe(textarea, "blur", Exadel.Menu.Layer.closeSelect);
+
+ var MouseoverInInput = Exadel.Menu.Layer.MouseoverInInput.bindAsEventListener(this);
+ var MouseoutInInput = Exadel.Menu.Layer.MouseoutInInput.bindAsEventListener(this);
+ Event.observe(textarea, "mouseover", MouseoverInInput);
+ Event.observe(textarea, "mouseout", MouseoutInInput);
+ }
+ );
+
+
+
+
+
+ if(window.A4J && A4J.AJAX ){
+ var listener = new A4J.AJAX.Listener(this.rebind.bindAsEventListener(this));
+ A4J.AJAX.AddListener(listener);
+ }
+ },
+ rebind:function(){
+ $A(this.bindings)
+ .each(
+ function(binding){
+ binding.refresh();
+ }
+ );
+ },
+ showMe: function(e){
+ this.closeSiblings(e);
+ //LOG.a4j_debug('show me ' + this.id +' ' +this.level);
+ Exadel.Menu.Layers.showMenuLayer(this.id, e, this.delay);
+ Exadel.Menu.Layers.levels[this.level] = this;
+
+
+ },
+ closeSiblings: function(e){
+ //LOG.a4j_debug('closeASiblins ' + this.id +' ' +this.level);
+ if(Exadel.Menu.Layers.levels[this.level] && Exadel.Menu.Layers.levels[this.level].id != this.id){
+ for(var i = this.level; i < Exadel.Menu.Layers.levels.length; i++){
+ if(Exadel.Menu.Layers.levels[i]) {
+ Exadel.Menu.Layers.levels[i].hideMe();
+ //Exadel.Menu.Layers.levels[i] = '';
+ }
+ }
+ }
+ },
+ closeMinors: function(id){
+ //LOG.a4j_debug('closeMinors ' + this.id +' ' +this.level);
+ var item = this.items[id];
+ if(!item.childMenu){
+ //LOG.a4j_debug('hiding menus ' + this.id +' ' +this.level);
+ for(var i = this.level + 1; i < Exadel.Menu.Layers.levels.length; i++){
+ if(Exadel.Menu.Layers.levels[i]) {
+ //LOG.a4j_debug('hide ' +Exadel.Menu.Layers.levels[i]);
+ Exadel.Menu.Layers.levels[i].hideMe();
+ }
+ }
+ }
+
+ },
+ addItem: function(itemId, hoverClass, plainClass, hoverStyle, plainStyle){
+ var dis = this;
+ var item = {};
+ item.hoverClass = hoverClass;// = hoverClass.split(" ");
+ item.plainClass = plainClass;//.split(" ");
+ item.hoverStyle = Exadel.extractCamelizedRules(hoverStyle);
+ item.plainStyle = Exadel.extractCamelizedRules(plainStyle);
+ item.id = itemId;
+ item.obj = $(itemId);
+ item.menu = this;
+ this.items[itemId] = item;
+ var onmouseover =
+ function(e){
+ $(this.id).className = this.hoverClass;
+ if(this.hoverStyle) {
+ Exadel.replaceStyleHash($(this.id), this.plainStyle, this.hoverStyle);
+ }
+ this.menu.closeMinors(this.id);
+ }.bindAsEventListener(item);
+ var onmouseout =
+ function(e){
+ $(this.id).className = this.plainClass;
+ if(this.hoverStyle) {
+ Exadel.replaceStyleHash($(this.id), this.hoverStyle, this.plainStyle);
+ }
+ }.bindAsEventListener(item);
+
+ var binding = new Exadel.Menu.Layer.Binding (
+ item.id,
+ "mouseover",
+ onmouseover);
+
+ this.bindings.push(binding);
+ binding.refresh();
+ binding = new Exadel.Menu.Layer.Binding (
+ item.id,
+ "mouseout",
+ onmouseout);
+ this.bindings.push(binding);
+ binding.refresh();
+ return this;
+ },
+ hideMe: function(e){
+ Exadel.Menu.Layers.clearPopUpTO();
+ Exadel.Menu.Layers.levels[this.level] = null;
+ Exadel.Menu.Layers.LMPopUpL(this.id, false);
+
+ },
+ asDropDown: function(topLevel, onEvt, offEvt){
+// if($(topLevel)){ CH-1518
+ var onmouseover = function(e){
+ if (!e) {
+ e = window.event;
+ }
+ Exadel.Menu.Layers.showDropDownLayer(this.id, topLevel, e,this.delay);
+ }.bindAsEventListener(this);
+
+ if(!onEvt){
+ onEvt = 'onmouseover';
+ }
+ onEvt = this.eventJsToPrototype(onEvt);
+ if(!offEvt){
+ offEvt = 'onmouseout';
+ }
+ offEvt = this.eventJsToPrototype(offEvt);
+
+ var dis = this;
+ var onmouseout =
+ function(e){
+ Exadel.Menu.Layers.setLMTO();
+ Exadel.Menu.Layers.clearPopUpTO();
+ }.bindAsEventListener(this);
+
+// var item = $(topLevel);
+ var binding = new Exadel.Menu.Layer.Binding(topLevel,onEvt, onmouseover);
+ this.bindings.push(binding);
+ binding.refresh();
+ binding = new Exadel.Menu.Layer.Binding (topLevel, offEvt, onmouseout);
+ this.bindings.push(binding);
+ binding.refresh();
+
+ Exadel.Menu.Layers.horizontals[this.id] = topLevel;
+// }
+ return this;
+ },
+ asSubMenu: function(parent, refLayerName, evtName){
+ if(!evtName){
+ evtName = 'onmouseover';
+ }
+ evtName = this.eventJsToPrototype(evtName);
+ this.level = Exadel.Menu.Layers.layers[parent].level + 1;
+ Exadel.Menu.Layers.father[this.id] = parent;
+ if(!refLayerName){
+ refLayerName = 'ref' + parent;
+ }
+ var refLayer = $(refLayerName);
+ this.refItem = Exadel.Menu.Layers.layers[parent].items[refLayerName];
+ this.refItem.childMenu = this;
+ var binding = new Exadel.Menu.Layer.Binding(refLayerName, evtName, this.showMe.bindAsEventListener(this));
+ this.bindings.push(binding);
+ binding.refresh();
+ return this;
+ },
+ asContextMenu: function(parent, evt){
+ var refLayer = $(parent);
+ if(!refLayer) return this;
+ var id = this.id;
+ if(!evt){
+ evt = 'onclick';
+ }
+ var offEvt = 'onmouseout';
+ offEvt = this.eventJsToPrototype(offEvt);
+
+ var dis = this;
+ var onmouseout =
+ function(e){
+ Exadel.Menu.Layers.setLMTO();
+ Exadel.Menu.Layers.clearPopUpTO();
+ }.bindAsEventListener(this);
+ evt = this.eventJsToPrototype(evt);
+ var handler = function(e){new Exadel.Menu.DelayedContextMenu(this.id, e).show();}.bindAsEventListener(this);
+ var binding = new Exadel.Menu.Layer.Binding (parent, evt, handler);
+ this.bindings.push(binding);
+ binding.refresh();
+ binding = new Exadel.Menu.Layer.Binding (parent, offEvt, onmouseout);
+ this.bindings.push(binding);
+ binding.refresh();
+ return this;
+ },
+ eventJsToPrototype: function(evtName){
+ var indexof = evtName.indexOf('on');
+ if(indexof >= 0){
+ evtName = evtName.substr(indexof + 2);
+ }
+ return evtName;
+ }
+
+};
+
+Exadel.Menu.Layer.Binding = Class.create();
+Exadel.Menu.Layer.Binding.prototype = {
+ initialize:function(objectId, eventname, handler){
+ this.objectId = objectId;
+ this.eventname = eventname;
+ this.handler = handler;
+ },
+ refresh:function(){
+ /*LOG.a4j_debug("rebinding " + $H(this).inspect());*/
+ var obj = $(this.objectId);
+ if(obj){
+ Event.stopObserving(obj, this.eventname, this.handler);
+ Event.observe(obj, this.eventname, this.handler);
+ return true;
+ }
+ return false;
+ }
+};
+if(!Exadel.Menu.Item) Exadel.Menu.Item = {};
+
+/**
+ *
+ */
+Exadel.Menu.Item.Onclick = function(evt, item, action, params, target) {
+ var form = Event.findElement(evt, 'form');
+
+ /*if(!form || typeof(form) == 'undefined' || !form.nodeName || form.nodeName.toLowerCase() != 'form'){
+ form = document.createElement('form');
+ form.setAttribute('method', 'post');
+ form.setAttribute('enctype', 'application/x-www-form-urlencoded');
+ form.action = action;
+ document.body.appendChild(form);
+ }*/
+ var objectsCreated = new Array();
+ var oldValues = new Object();
+ Exadel.Menu.Item._createOrInitHiddenInput(item + ":submit", item + ":submit", objectsCreated, oldValues, form);
+
+ if (params) {
+
+ for (var param in params) {
+ var paramName = param;
+ var paramValue = params[paramName];
+ if (typeof(paramValue) != 'function') {
+ if (paramValue) {
+ paramValue = String(paramValue);
+ }
+ Exadel.Menu.Item._createOrInitHiddenInput(paramName, paramValue, objectsCreated, oldValues, form);
+
+ }
+ }
+ }
+
+ var l = objectsCreated.length;
+
+ for (var i = 0; i < l; i++) {
+ var kid = objectsCreated[i];
+ form.appendChild(kid);
+ }
+
+ var targ = form.target;
+
+ if (target) {
+ form.target = target;
+ }
+
+ form.submit();
+
+ form.target = targ;
+
+ for (var j = 0; j < l; j++) {
+ var kid = objectsCreated[j];
+ if (form && kid) {
+ form.removeChild(kid);
+ }
+ }
+
+ for (var key in oldValues) {
+ var value = oldValues[key];
+ if (typeof(value) != 'function') {
+ ($(key) || form[key]).value = value;
+ }
+ }
+ }
+
+Exadel.Menu.Item._createOrInitHiddenInput = function(name, value, list, oldValues, form) {
+ var hiddenObj = $(name) || form[name];
+
+ if (!hiddenObj) {
+ hiddenObj = document.createElement('input');
+ hiddenObj.setAttribute('type', 'hidden');
+ hiddenObj.setAttribute('name', name);
+ hiddenObj.setAttribute('id', name);
+ list.push(hiddenObj);
+ } else {
+ oldValues[name] = hiddenObj.value;
+ }
+ hiddenObj.value = value;
+}
+
Modified: trunk/richfaces/dropdown-menu/src/main/templates/org/richfaces/htmlDropDownMenu.jspx
===================================================================
--- trunk/richfaces/dropdown-menu/src/main/templates/org/richfaces/htmlDropDownMenu.jspx 2007-03-27 14:22:11 UTC (rev 173)
+++ trunk/richfaces/dropdown-menu/src/main/templates/org/richfaces/htmlDropDownMenu.jspx 2007-03-27 15:13:35 UTC (rev 174)
@@ -14,23 +14,40 @@
<h:scripts>
new org.ajax4jsf.framework.resource.PrototypeScript(),
new org.ajax4jsf.framework.ajax.AjaxScript(),
+ scripts/menu.js,
+ scripts/css-rules.js
</h:scripts>
<f:clientid var="clientId"/>
<jsp:scriptlet>
<![CDATA[org.richfaces.component.util.FormUtil.throwEnclFormReqExceptionIfNeed(context,component);]]>
</jsp:scriptlet>
- <div class="dr-menu-label dr-menu-label-unselect rich-menu-label rich-menu-label-unselect #{component.attributes['styleClass']}"
+ <div id="#{clientId}" class="dr-menu-label dr-menu-label-unselect rich-menu-label rich-menu-label-unselect #{component.attributes['styleClass']}"
style="#{component.attributes['style']};"
onmouseover="this.className='dr-menu-label dr-menu-label-select rich-menu-label rich-menu-label-select'"
onmouseout="this.className='dr-menu-label dr-menu-label-unselect rich-menu-label rich-menu-label-unselect'">
<span class="dr-label-text-decor rich-label-text-decor">#{component.attributes['value']}</span>
- <div id="#{clientId}"
- style="width: #{component.attributes['popupWidth']};"
+ <div id="#{clientId}_menu"
+ style="width: #{component.attributes['popupWidth']}; visibility: hidden; z-index:100;"
class="dr-menu-list-border dr-menu-list-position rich-menu-list-border rich-menu-list-position">
<div class="dr-menu-list-bg rich-menu-list-bg">
<f:call name="renderChildren" />
</div>
</div>
- </div>
+
+ <iframe class="underneath_iframe" id="#{clientId}_menu_iframe" style="position:absolute">
+ </iframe>
+ <iframe class="underneath_iframe" id="#{clientId}_menu_iframe1" style="position:absolute">
+ </iframe>
+ <script type="text/javascript">
+ <f:call name="encodeScript" />
+ </script>
+
+ </div>
+
+
+
+
+
+
</f:root>
\ No newline at end of file
17 years, 1 month
JBoss Rich Faces SVN: r173 - trunk/richfaces/menu-components/src/main/templates/org/richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: a.izobov
Date: 2007-03-27 10:22:11 -0400 (Tue, 27 Mar 2007)
New Revision: 173
Modified:
trunk/richfaces/menu-components/src/main/templates/org/richfaces/htmlMenuGroup.jspx
Log:
menuGroup template development
Modified: trunk/richfaces/menu-components/src/main/templates/org/richfaces/htmlMenuGroup.jspx
===================================================================
--- trunk/richfaces/menu-components/src/main/templates/org/richfaces/htmlMenuGroup.jspx 2007-03-27 14:07:08 UTC (rev 172)
+++ trunk/richfaces/menu-components/src/main/templates/org/richfaces/htmlMenuGroup.jspx 2007-03-27 14:22:11 UTC (rev 173)
@@ -18,42 +18,81 @@
</h:scripts>
<f:clientid var="clientId"/>
+ <f:resource name="/org/richfaces/renderkit/html/images/spacer.gif" var="spacer" />
+
<jsp:scriptlet><![CDATA[
boolean disabled = ((Boolean) component.getAttributes().get("disabled")).booleanValue();
if (! disabled) {
]]></jsp:scriptlet>
<div id="#{clientId}"
- class="dr-menu-item dr-menu-item-unselect rich-menu-item rich-menu-item-unselect #{component.attributes['styleClass']}"
+ class="dr-menu-item dr-menu-item-unselect rich-menu-group #{component.attributes['styleClass']}"
style="#{component.attributes['style']}"
- onmouseout="this.className='dr-menu-item dr-menu-item-unselect rich-menu-item rich-menu-item-unselect'"
- onmouseover="this.className='dr-menu-item dr-menu-item-select rich-menu-item rich-menu-item-select'">
- <img class="dr-menu-ico #{component.attributes['iconClass']}"
- width="16" height="16"
- style="#{component.attributes['iconStyle']}"
- src="#{component.attributes['icon']}"/>
- <jsp:scriptlet><![CDATA[} else {]]></jsp:scriptlet>
- <div id="#{clientId}"
- class="dr-menu-item dr-menu-item-disabled rich-menu-item rich-menu-item-disabled #{component.attributes['styleClass']}"
- style="#{component.attributes['style']}">
- <img class="dr-menu-ico #{component.attributes['iconClass']}"
- width="16" height="16"
- style="#{component.attributes['iconStyle']}"
- src="#{component.attributes['iconDisabled']}"/>
- <jsp:scriptlet><![CDATA[}]]></jsp:scriptlet>
+ onmouseout="this.className='dr-menu-item dr-menu-item-unselect rich-menu-group'; #{component.attributes['onmouseout']}"
+ onmouseover="this.className='dr-menu-item dr-menu-item-select rich-menu-group rich-menu-group-selected'; #{component.attributes['onmouseover']}"
+ onmousemove="#{component.attributes['onmousemove']}">
- <a href="#">#{component.attributes['value']}</a>
- <div class="dr-menu-node">
+ <jsp:scriptlet>
+ <![CDATA[if(component.getFacet("icon")!=null && component.getFacet("icon").isRendered()) {]]>
+ </jsp:scriptlet>
+ <u:insertFacet name="icon" />
+ <jsp:scriptlet>
+ <![CDATA[} else if (component.getAttributes().get("icon")!=null) {]]>
+ </jsp:scriptlet>
+ <img class="dr-menu-icon rich-menu-item-icon #{component.attributes['iconClass']}"
+ width="16" height="16"
+ style="#{component.attributes['iconStyle']}"
+ src="#{component.attributes['icon']}"/>
+ <jsp:scriptlet>
+ <![CDATA[} else {]]>
+ </jsp:scriptlet>
+ <img class="dr-menu-icon rich-menu-item-icon #{component.attributes['iconClass']}"
+ width="16" height="16"
+ style="#{component.attributes['iconStyle']}"
+ src="#{spacer}"/>
+ <jsp:scriptlet><![CDATA[}]]></jsp:scriptlet>
+
+ <a href="#"><span class="rich-menu-item-label">#{component.attributes['value']}</span></a>
+
+ <div class="dr-menu-node rich-menu-item-folder">
<div id="#{clientId}"
class="dr-menu-list-border dr-menu-sublist rich-menu-list-border rich-menu-sublist">
<div class="dr-menu-list-bg rich-menu-list-bg">
- <vcp:body><f:call name="renderChildren"/></vcp:body>
+ <f:call name="renderChildren"/>
</div>
</div>
+ </div>
</div>
- <jsp:scriptlet><![CDATA[if (true) {]]></jsp:scriptlet>
- </div>
<jsp:scriptlet><![CDATA[} else {]]></jsp:scriptlet>
+ <div id="#{clientId}"
+ class="dr-menu-item dr-menu-item-disabled rich-menu-group rich-menu-group-disabled #{component.attributes['styleClass']}"
+ style="#{component.attributes['style']}">
+
+ <jsp:scriptlet>
+ <![CDATA[if(component.getFacet("iconDisabled")!=null && component.getFacet("iconDisabled").isRendered()) {]]>
+ </jsp:scriptlet>
+ <u:insertFacet name="iconDisabled" />
+ <jsp:scriptlet>
+ <![CDATA[} else if (component.getAttributes().get("iconDisabled")!=null) {]]>
+ </jsp:scriptlet>
+ <img class="dr-menu-icon rich-menu-item-icon-disabled #{component.attributes['iconClass']}"
+ width="16" height="16"
+ style="#{component.attributes['iconStyle']}"
+ src="#{component.attributes['iconDisabled']}"/>
+ <jsp:scriptlet>
+ <![CDATA[} else {]]>
+ </jsp:scriptlet>
+ <img class="dr-menu-icon rich-menu-item-icon-disabled #{component.attributes['iconClass']}"
+ width="16" height="16"
+ style="#{component.attributes['iconStyle']}"
+ src="#{spacer}"/>
+ <jsp:scriptlet><![CDATA[}]]></jsp:scriptlet>
+
+ <span class="rich-menu-item-label-disabled">#{component.attributes['value']}</span>
+
+ <div class="dr-menu-node rich-menu-item-folder-disabled"/>
</div>
+
<jsp:scriptlet><![CDATA[}]]></jsp:scriptlet>
+
</f:root>
\ No newline at end of file
17 years, 1 month
JBoss Rich Faces SVN: r172 - trunk/richfaces/menu-components/src/main/templates/org/richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: F.antonov
Date: 2007-03-27 10:07:08 -0400 (Tue, 27 Mar 2007)
New Revision: 172
Modified:
trunk/richfaces/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx
Log:
MenuItem component development.
Modified: trunk/richfaces/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx
===================================================================
--- trunk/richfaces/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx 2007-03-27 14:06:33 UTC (rev 171)
+++ trunk/richfaces/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx 2007-03-27 14:07:08 UTC (rev 172)
@@ -29,9 +29,13 @@
<!-- f:call name="encodeAttributeParameters" / -->
<jsp:scriptlet><![CDATA[
- if (null != variables.getVariable("icon")) {
+ UIComponent iconFacet = getIconFacet((org.richfaces.component.UIMenuItem) component);
+ if (null != iconFacet) {
+ renderChild(context, iconFacet);
+ } else {
]]></jsp:scriptlet>
- <img class="dr-menu-icon rich-menu-item-icon #{component.attributes['iconClass']}"
+ <img id="#{clientId}:icon"
+ class="#{iconClass}"
width="16"
height="16"
style="#{component.attributes['iconStyle']}"
@@ -40,9 +44,11 @@
}
]]></jsp:scriptlet>
- <f:verbatim>
+ <a id="#{clientId}:anchor"
+ href="#"
+ class="#{labelClass}">
#{component.attributes['value']}
- </f:verbatim>
- <vcp:body />
+ <f:call name="renderChildren" />
+ </a>
</div>
</f:root>
\ No newline at end of file
17 years, 1 month
JBoss Rich Faces SVN: r171 - trunk/richfaces/menu-components/src/main/java/org/richfaces/renderkit/html.
by richfaces-svn-commits@lists.jboss.org
Author: F.antonov
Date: 2007-03-27 10:06:33 -0400 (Tue, 27 Mar 2007)
New Revision: 171
Modified:
trunk/richfaces/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java
Log:
MenuItem component development.
Modified: trunk/richfaces/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java
===================================================================
--- trunk/richfaces/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java 2007-03-27 10:06:06 UTC (rev 170)
+++ trunk/richfaces/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java 2007-03-27 14:06:33 UTC (rev 171)
@@ -53,40 +53,93 @@
ComponentVariables variables = ComponentsVariableResolver.getVariables(this, menuItem);
String resource = menuItem.isDisabled() ? ViewUtil.getResourceURL(menuItem.getIconDisabled()) : ViewUtil.getResourceURL(menuItem.getIcon());
- if (resource != null) {
- variables.setVariable("icon", resource);
+ if (resource == null) {
+ resource = (String) getResource( "images/spacer.gif" ).getUri(context, menuItem);
}
+ variables.setVariable("icon", resource);
- resource = null;
- String mode = menuItem.getMode();
- if (mode.equalsIgnoreCase(UIMenuItem.MODE_AJAX)) {
- resource = "alert('Ajax submit mode');";
- } else if (mode.equalsIgnoreCase(UIMenuItem.MODE_SERVER)) {
- UIForm form= rendererUtils.getNestingForm(context, menuItem);
- resource = "document.getElementById('" + form.getId() + "').submit();";
- }
- if (resource != null) {
- variables.setVariable("onclick", resource);
- }
-
- if (menuItem.isDisabled()) {
+ if (menuItem.isDisabled()) {
resource = "dr-menu-item dr-menu-item-disabled rich-menu-item rich-menu-item-disabled "
- + (String) menuItem.getAttributes().get("styleClass");
+ + additionalClass(menuItem, "styleClass");
+ variables.setVariable("class", resource);
+
+ resource = "dr-menu-icon dr-menu-icon-disabled rich-menu-item-icon rich-menu-item-icon-disabled "
+ + additionalClass(menuItem, "iconClass");
+ variables.setVariable("iconClass", resource);
+
+ resource = "dr-menu-label dr-menu-label-disabled rich-menu-item-label rich-menu-item-label-disabled";
+ // + (String) menuItem.getAttributes().get("iconClass");
+ variables.setVariable("labelClass", resource);
+
} else {
- resource = "this.className='dr-menu-item dr-menu-item-unselect rich-menu-item rich-menu-item-unselect "
- + (String) menuItem.getAttributes().get("styleClass") + "'; "
- + (String) menuItem.getAttributes().get("onmouseout");
- variables.setVariable("onmouseout", resource);
- resource = "this.className='dr-menu-item dr-menu-item-select rich-menu-item rich-menu-item-select "
- + (String) menuItem.getAttributes().get("styleClass") + "'; "
- + (String) menuItem.getAttributes().get("onmouseover");
- variables.setVariable("onmouseover", resource);
+ StringBuffer scriptValue = new StringBuffer();
+ scriptValue.append("this.className='dr-menu-item dr-menu-item-enabled rich-menu-item rich-menu-item-enabled ")
+ .append(additionalClass(menuItem, "styleClass") + "'; ");
+ if (null == getIconFacet(menuItem)) {
+ scriptValue.append("document.getElementById('" + menuItem.getClientId(context) + ":icon').className='dr-menu-icon rich-menu-item-icon ")
+ .append(additionalClass(menuItem, "iconClass") + "'; ");
+ }
+ scriptValue.append("document.getElementById('" + menuItem.getClientId(context) + ":anchor').className='dr-menu-label rich-menu-item-label'; ")
+ .append(additionalClass(menuItem, "onmouseout"));
+ variables.setVariable("onmouseout", scriptValue);
- resource = "dr-menu-item dr-menu-item-unselect rich-menu-item rich-menu-item-unselect "
- + (String) menuItem.getAttributes().get("styleClass");
+ scriptValue = new StringBuffer();
+ scriptValue.append("this.className='dr-menu-item dr-menu-item-hover rich-menu-item rich-menu-item-hover ")
+ .append(additionalClass(menuItem, "styleClass") + "'; ");
+ if (null == getIconFacet(menuItem)) {
+ scriptValue.append("document.getElementById('" + menuItem.getClientId(context) + ":icon').className='dr-menu-icon dr-menu-icon-selected rich-menu-item-icon rich-menu-item-icon-selected ")
+ .append(additionalClass(menuItem, "iconClass") + "'; ");
+ }
+ scriptValue.append("document.getElementById('" + menuItem.getClientId(context) + ":anchor').className='dr-menu-label dr-menu-label-selected rich-menu-item-label rich-menu-item-label-selected'; ")
+ .append(additionalClass(menuItem, "onmouseout"));
+ variables.setVariable("onmouseover", scriptValue);
+
+ resource = "dr-menu-item dr-menu-item-enabled rich-menu-item rich-menu-item-enabled "
+ + additionalClass(menuItem, "styleClass");
+ variables.setVariable("class", resource);
+
+ resource = "dr-menu-icon rich-menu-item-icon "
+ + additionalClass(menuItem, "iconClass");
+ variables.setVariable("iconClass", resource);
+
+ resource = "dr-menu-label rich-menu-item-label";
+ // + (String) menuItem.getAttributes().get("iconClass");
+ variables.setVariable("labelClass", resource);
+
+ resource = null;
+ String mode = menuItem.getMode();
+ if (mode.equalsIgnoreCase(UIMenuItem.MODE_AJAX)) {
+ resource = "alert('Ajax submit mode');";
+ } else if (mode.equalsIgnoreCase(UIMenuItem.MODE_SERVER)) {
+ UIForm form= rendererUtils.getNestingForm(context, menuItem);
+ resource = "document.getElementById('" + form.getId() + "').submit();";
+ }
+ if (resource != null) {
+ variables.setVariable("onclick", resource);
+ }
+ }
+ }
+
+ private String additionalClass(UIMenuItem menuItem, String className) {
+ Object classObject = menuItem.getAttributes().get(className);
+ if (null != classObject) {
+ return (String) classObject;
}
- variables.setVariable("class", resource);
+ return "";
}
+
+ protected UIComponent getIconFacet(UIMenuItem menuItem) {
+ UIComponent iconFacet = null;
+ if (menuItem.isDisabled()) {
+ iconFacet = menuItem.getFacet("iconDisabled");
+ } else {
+ iconFacet = menuItem.getFacet("icon");
+ }
+ if (null != iconFacet) {
+ return iconFacet;
+ }
+ return null;
+ }
}
17 years, 1 month