Author: sergeyhalipov
Date: 2007-11-30 09:31:50 -0500 (Fri, 30 Nov 2007)
New Revision: 4389
Modified:
branches/3.1.x/ui/dropdown-menu/src/main/config/component/dropdownmenu.xml
branches/3.1.x/ui/dropdown-menu/src/main/java/org/richfaces/component/UIDropDownMenu.java
branches/3.1.x/ui/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java
branches/3.1.x/ui/dropdown-menu/src/main/templates/org/richfaces/htmlDropDownMenu.jspx
branches/3.1.x/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/css/dropdownmenu.xcss
trunk/ui/dropdown-menu/src/main/templates/org/richfaces/htmlDropDownMenu.jspx
trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/css/dropdownmenu.xcss
Log:
http://jira.jboss.com/jira/browse/RF-1290
Modified: branches/3.1.x/ui/dropdown-menu/src/main/config/component/dropdownmenu.xml
===================================================================
--- branches/3.1.x/ui/dropdown-menu/src/main/config/component/dropdownmenu.xml 2007-11-30
13:12:07 UTC (rev 4388)
+++ branches/3.1.x/ui/dropdown-menu/src/main/config/component/dropdownmenu.xml 2007-11-30
14:31:50 UTC (rev 4389)
@@ -29,8 +29,16 @@
<superclass>com.sun.facelets.tag.jsf.ComponentHandler</superclass>
</taghandler>
- &ui_component_attributes;
+ &ui_component_attributes;
+ <property>
+ <name>disabled</name>
+ <classname>boolean</classname>
+ <description>
+ Attribute 'disabled' provides possibility to make the whole menu
disabled if its value equals to "true".
+ </description>
+ <defaultvalue>false</defaultvalue>
+ </property>
<property>
<name>event</name>
<classname>java.lang.String</classname>
Modified:
branches/3.1.x/ui/dropdown-menu/src/main/java/org/richfaces/component/UIDropDownMenu.java
===================================================================
---
branches/3.1.x/ui/dropdown-menu/src/main/java/org/richfaces/component/UIDropDownMenu.java 2007-11-30
13:12:07 UTC (rev 4388)
+++
branches/3.1.x/ui/dropdown-menu/src/main/java/org/richfaces/component/UIDropDownMenu.java 2007-11-30
14:31:50 UTC (rev 4389)
@@ -38,5 +38,9 @@
public abstract void setSubmitMode(String submitMode);
public abstract String getSubmitMode();
+
+ public abstract boolean isDisabled();
+
+ public abstract void setDisabled(boolean disabled);
}
Modified:
branches/3.1.x/ui/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java
===================================================================
---
branches/3.1.x/ui/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java 2007-11-30
13:12:07 UTC (rev 4388)
+++
branches/3.1.x/ui/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java 2007-11-30
14:31:50 UTC (rev 4389)
@@ -21,6 +21,8 @@
package org.richfaces.renderkit.html;
+import java.io.IOException;
+
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -97,4 +99,10 @@
return buffer.toString();
}
+ public void encodeChildren(FacesContext context, UIComponent component)
+ throws IOException {
+ if (!((org.richfaces.component.UIDropDownMenu)component).isDisabled())
+ super.encodeChildren(context, component);
+ }
+
}
Modified:
branches/3.1.x/ui/dropdown-menu/src/main/templates/org/richfaces/htmlDropDownMenu.jspx
===================================================================
---
branches/3.1.x/ui/dropdown-menu/src/main/templates/org/richfaces/htmlDropDownMenu.jspx 2007-11-30
13:12:07 UTC (rev 4388)
+++
branches/3.1.x/ui/dropdown-menu/src/main/templates/org/richfaces/htmlDropDownMenu.jspx 2007-11-30
14:31:50 UTC (rev 4389)
@@ -1,53 +1,64 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<f:root
-
xmlns:f="http://ajax4jsf.org/cdk/template"
- xmlns:c="
http://java.sun.com/jsf/core"
- xmlns:ui="
http://ajax4jsf.org/cdk/ui"
- xmlns:u="
http://ajax4jsf.org/cdk/u"
- xmlns:x="
http://ajax4jsf.org/cdk/x"
- baseclass="org.richfaces.renderkit.html.DropDownMenuRendererBase"
- class="org.richfaces.renderkit.html.DropDownMenuRenderer"
- component="org.richfaces.component.UIDropDownMenu"
- >
- <h:styles>css/dropdownmenu.xcss</h:styles>
-
- <h:scripts>
- new org.ajax4jsf.javascript.PrototypeScript(),
- new org.ajax4jsf.javascript.AjaxScript(),
- scripts/menu.js
- </h:scripts>
-
- <f:clientid var="clientId"/>
- <jsp:scriptlet>
- <![CDATA[if
(!((org.richfaces.component.UIDropDownMenu)component).getSubmitMode().equalsIgnoreCase("none"))
org.richfaces.component.util.FormUtil.throwEnclFormReqExceptionIfNeed(context,component);]]>
- </jsp:scriptlet>
- <div id="#{clientId}"
- style="#{component.attributes['style']};"
- class="#{component.attributes['styleClass']} dr-menu-label
dr-menu-label-unselect rich-ddmenu-label rich-ddmenu-label-unselect"
- onmouseover="this.className='dr-menu-label dr-menu-label-select
rich-ddmenu-label rich-ddmenu-label-select' ;
#{component.attributes['onmouseover']}"
- onmouseout="this.className='dr-menu-label dr-menu-label-unselect
rich-ddmenu-label rich-ddmenu-label-unselect';
#{component.attributes['onmouseout']}"
- onmousemove="#{component.attributes['onmousemove']}">
-
- <jsp:scriptlet>
- <![CDATA[if(component.getFacet("label")!=null &&
component.getFacet("label").isRendered()) {]]>
- </jsp:scriptlet>
- <span class="dr-label-text-decor rich-label-text-decor">
- <u:insertFacet name="label" />
- </span>
- <jsp:scriptlet>
+<?xml version="1.0" encoding="UTF-8"?>
+<f:root
xmlns:f="http://ajax4jsf.org/cdk/template"
+ xmlns:c="
http://java.sun.com/jsf/core"
+ xmlns:ui="
http://ajax4jsf.org/cdk/ui"
+ xmlns:u="
http://ajax4jsf.org/cdk/u"
+ xmlns:x="
http://ajax4jsf.org/cdk/x"
+ baseclass="org.richfaces.renderkit.html.DropDownMenuRendererBase"
+ class="org.richfaces.renderkit.html.DropDownMenuRenderer"
+ component="org.richfaces.component.UIDropDownMenu">
+ <h:styles>css/dropdownmenu.xcss</h:styles>
+
+ <f:clientid var="clientId" />
+ <jsp:scriptlet>
+ <![CDATA[ org.richfaces.component.UIDropDownMenu menu =
(org.richfaces.component.UIDropDownMenu) component;
+ if (!menu.getSubmitMode().equalsIgnoreCase("none"))
+
org.richfaces.component.util.FormUtil.throwEnclFormReqExceptionIfNeed(context,component);
+
+ if (!menu.isDisabled()) {]]>
+ </jsp:scriptlet>
+ <div id="#{clientId}" style=""
+ class="#{component.attributes['styleClass']} dr-menu-label
dr-menu-label-unselect rich-ddmenu-label rich-ddmenu-label-unselect"
+ onmouseover="this.className='dr-menu-label dr-menu-label-select
rich-ddmenu-label rich-ddmenu-label-select' ;
#{component.attributes['onmouseover']}"
+ onmouseout="this.className='dr-menu-label dr-menu-label-unselect
rich-ddmenu-label rich-ddmenu-label-unselect';
#{component.attributes['onmouseout']}"
+ onmousemove="#{component.attributes['onmousemove']}">
+ <jsp:scriptlet>
+ <![CDATA[ } else { ]]>
+ </jsp:scriptlet>
+ <div id="#{clientId}" style=""
+ class="dr-menu-label dr-menu-label-unselect dr-ddmenu-label-disabled
rich-ddmenu-label-disabled rich-ddmenu-label-unselect
#{component.attributes['styleClass']}"
+ onmouseover="#{component.attributes['onmouseover']}"
+ onmouseout="#{component.attributes['onmouseout']}"
+ onmousemove="#{component.attributes['onmousemove']}">
+ <jsp:scriptlet>
+ <![CDATA[ } if (menu.isDisabled() &&
+ (component.getFacet("labelDisabled")!=null &&
component.getFacet("labelDisabled").isRendered())) {]]>
+ </jsp:scriptlet> <span class="dr-label-text-decor
rich-label-text-decor"> <u:insertFacet
+ name="labelDisabled" /> </span> <jsp:scriptlet>
+ <![CDATA[} else if(component.getFacet("label")!=null &&
component.getFacet("label").isRendered()) {]]>
+ </jsp:scriptlet> <span class="dr-label-text-decor
rich-label-text-decor"> <u:insertFacet
+ name="label" /> </span> <jsp:scriptlet>
<![CDATA[} else {]]>
- </jsp:scriptlet>
- <span class="dr-label-text-decor
rich-label-text-decor">#{component.attributes['value']}</span>
- <jsp:scriptlet>
+ </jsp:scriptlet> <span class="dr-label-text-decor
rich-label-text-decor">#{component.attributes['value']}</span>
+ <jsp:scriptlet>
<![CDATA[}]]>
- </jsp:scriptlet>
-
- <div style="margin: 0px; padding: 0px; border: 0px; position: relative;
z-index:100;">
- <vcp:body>
- <f:call name="renderChildren" />
- </vcp:body>
- </div>
-
- </div>
-
+ </jsp:scriptlet>
+
+ <div
+ style="margin: 0px; padding: 0px; border: 0px; position: relative; z-index:
100;">
+ <vcp:body>
+ <f:call name="renderChildren" />
+ </vcp:body></div>
+
+ <jsp:scriptlet>
+ <![CDATA[if (!((org.richfaces.component.UIDropDownMenu) component).isDisabled())
{]]>
+ </jsp:scriptlet>
+ </div>
+ <jsp:scriptlet>
+ <![CDATA[} else {]]>
+ </jsp:scriptlet>
+ </div>
+ <jsp:scriptlet>
+ <![CDATA[}]]>
+ </jsp:scriptlet>
</f:root>
\ No newline at end of file
Modified:
branches/3.1.x/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/css/dropdownmenu.xcss
===================================================================
---
branches/3.1.x/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/css/dropdownmenu.xcss 2007-11-30
13:12:07 UTC (rev 4388)
+++
branches/3.1.x/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/css/dropdownmenu.xcss 2007-11-30
14:31:50 UTC (rev 4389)
@@ -89,4 +89,8 @@
<u:style name="color" skin="generalTextColor" />
</u:selector>
+<u:selector name=".dr-ddmenu-label-disabled" >
+ <u:style name="color" skin="tabDisabledTextColor"/>
+</u:selector>
+
</f:template>
Modified: trunk/ui/dropdown-menu/src/main/templates/org/richfaces/htmlDropDownMenu.jspx
===================================================================
---
trunk/ui/dropdown-menu/src/main/templates/org/richfaces/htmlDropDownMenu.jspx 2007-11-30
13:12:07 UTC (rev 4388)
+++
trunk/ui/dropdown-menu/src/main/templates/org/richfaces/htmlDropDownMenu.jspx 2007-11-30
14:31:50 UTC (rev 4389)
@@ -1,77 +1,64 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<f:root
-
xmlns:f="http://ajax4jsf.org/cdk/template"
- xmlns:c="
http://java.sun.com/jsf/core"
- xmlns:ui="
http://ajax4jsf.org/cdk/ui"
- xmlns:u="
http://ajax4jsf.org/cdk/u"
- xmlns:x="
http://ajax4jsf.org/cdk/x"
- baseclass="org.richfaces.renderkit.html.DropDownMenuRendererBase"
- class="org.richfaces.renderkit.html.DropDownMenuRenderer"
- component="org.richfaces.component.UIDropDownMenu"
- >
- <h:styles>css/dropdownmenu.xcss</h:styles>
-
- <f:clientid var="clientId"/>
- <jsp:scriptlet>
- <![CDATA[if
(!((org.richfaces.component.UIDropDownMenu)component).getSubmitMode().equalsIgnoreCase("none"))
org.richfaces.component.util.FormUtil.throwEnclFormReqExceptionIfNeed(context,component);]]>
+<?xml version="1.0" encoding="UTF-8"?>
+<f:root
xmlns:f="http://ajax4jsf.org/cdk/template"
+ xmlns:c="
http://java.sun.com/jsf/core"
+ xmlns:ui="
http://ajax4jsf.org/cdk/ui"
+ xmlns:u="
http://ajax4jsf.org/cdk/u"
+ xmlns:x="
http://ajax4jsf.org/cdk/x"
+ baseclass="org.richfaces.renderkit.html.DropDownMenuRendererBase"
+ class="org.richfaces.renderkit.html.DropDownMenuRenderer"
+ component="org.richfaces.component.UIDropDownMenu">
+ <h:styles>css/dropdownmenu.xcss</h:styles>
+
+ <f:clientid var="clientId" />
+ <jsp:scriptlet>
+ <![CDATA[ org.richfaces.component.UIDropDownMenu menu =
(org.richfaces.component.UIDropDownMenu) component;
+ if (!menu.getSubmitMode().equalsIgnoreCase("none"))
+
org.richfaces.component.util.FormUtil.throwEnclFormReqExceptionIfNeed(context,component);
+
+ if (!menu.isDisabled()) {]]>
</jsp:scriptlet>
- <jsp:scriptlet>
- <![CDATA[if (!((org.richfaces.component.UIDropDownMenu)component).isDisabled())
{]]>
- </jsp:scriptlet>
- <div id="#{clientId}"
- style="#{component.attributes['style']};"
- class="#{component.attributes['styleClass']} dr-menu-label
dr-menu-label-unselect rich-ddmenu-label rich-ddmenu-label-unselect"
- onmouseover="this.className='dr-menu-label dr-menu-label-select
rich-ddmenu-label rich-ddmenu-label-select' ;
#{component.attributes['onmouseover']}"
- onmouseout="this.className='dr-menu-label dr-menu-label-unselect
rich-ddmenu-label rich-ddmenu-label-unselect';
#{component.attributes['onmouseout']}"
- onmousemove="#{component.attributes['onmousemove']}">
+ <div id="#{clientId}" style=""
+ class="#{component.attributes['styleClass']} dr-menu-label
dr-menu-label-unselect rich-ddmenu-label rich-ddmenu-label-unselect"
+ onmouseover="this.className='dr-menu-label dr-menu-label-select
rich-ddmenu-label rich-ddmenu-label-select' ;
#{component.attributes['onmouseover']}"
+ onmouseout="this.className='dr-menu-label dr-menu-label-unselect
rich-ddmenu-label rich-ddmenu-label-unselect';
#{component.attributes['onmouseout']}"
+ onmousemove="#{component.attributes['onmousemove']}">
<jsp:scriptlet>
- <![CDATA[} else {]]>
+ <![CDATA[ } else { ]]>
</jsp:scriptlet>
- <div id="#{clientId}"
- style="#{component.attributes['style']};"
- class="#{component.attributes['styleClass']} dr-menu-label
dr-menu-label-unselect rich-ddmenu-label-disabled rich-ddmenu-label-unselect"
- onmouseover="#{component.attributes['onmouseover']}"
- onmouseout="#{component.attributes['onmouseout']}"
- onmousemove="#{component.attributes['onmousemove']}">
- <jsp:scriptlet>
- <![CDATA[}]]>
- </jsp:scriptlet>
- <jsp:scriptlet>
- <![CDATA[if (((org.richfaces.component.UIDropDownMenu)component).isDisabled()
&&
- (component.getFacet("labelDisabled")!=null &&
component.getFacet("labelDisabled").isRendered())) {]]>
- </jsp:scriptlet>
- <span class="dr-label-text-decor rich-label-text-decor">
- <u:insertFacet name="labelDisabled" />
- </span>
- <jsp:scriptlet>
+ <div id="#{clientId}" style=""
+ class="dr-menu-label dr-menu-label-unselect dr-ddmenu-label-disabled
rich-ddmenu-label-disabled rich-ddmenu-label-unselect
#{component.attributes['styleClass']}"
+ onmouseover="#{component.attributes['onmouseover']}"
+ onmouseout="#{component.attributes['onmouseout']}"
+ onmousemove="#{component.attributes['onmousemove']}">
+ <jsp:scriptlet>
+ <![CDATA[ } if (menu.isDisabled() &&
+ (component.getFacet("labelDisabled")!=null &&
component.getFacet("labelDisabled").isRendered())) {]]>
+ </jsp:scriptlet> <span class="dr-label-text-decor
rich-label-text-decor"> <u:insertFacet
+ name="labelDisabled" /> </span> <jsp:scriptlet>
<![CDATA[} else if(component.getFacet("label")!=null &&
component.getFacet("label").isRendered()) {]]>
- </jsp:scriptlet>
- <span class="dr-label-text-decor rich-label-text-decor">
- <u:insertFacet name="label" />
- </span>
- <jsp:scriptlet>
+ </jsp:scriptlet> <span class="dr-label-text-decor
rich-label-text-decor"> <u:insertFacet
+ name="label" /> </span> <jsp:scriptlet>
<![CDATA[} else {]]>
- </jsp:scriptlet>
- <span class="dr-label-text-decor
rich-label-text-decor">#{component.attributes['value']}</span>
- <jsp:scriptlet>
+ </jsp:scriptlet> <span class="dr-label-text-decor
rich-label-text-decor">#{component.attributes['value']}</span>
+ <jsp:scriptlet>
<![CDATA[}]]>
- </jsp:scriptlet>
-
- <div style="margin: 0px; padding: 0px; border: 0px; position: relative;
z-index:100;">
- <vcp:body>
- <f:call name="renderChildren" />
- </vcp:body>
- </div>
-
- <jsp:scriptlet>
- <![CDATA[if (!((org.richfaces.component.UIDropDownMenu)component).isDisabled())
{]]>
+ </jsp:scriptlet>
+
+ <div
+ style="margin: 0px; padding: 0px; border: 0px; position: relative; z-index:
100;">
+ <vcp:body>
+ <f:call name="renderChildren" />
+ </vcp:body></div>
+
+ <jsp:scriptlet>
+ <![CDATA[if (!((org.richfaces.component.UIDropDownMenu) component).isDisabled())
{]]>
</jsp:scriptlet>
- </div>
+ </div>
<jsp:scriptlet>
<![CDATA[} else {]]>
</jsp:scriptlet>
- </div>
+ </div>
<jsp:scriptlet>
<![CDATA[}]]>
- </jsp:scriptlet>
+ </jsp:scriptlet>
</f:root>
\ No newline at end of file
Modified:
trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/css/dropdownmenu.xcss
===================================================================
---
trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/css/dropdownmenu.xcss 2007-11-30
13:12:07 UTC (rev 4388)
+++
trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/css/dropdownmenu.xcss 2007-11-30
14:31:50 UTC (rev 4389)
@@ -89,4 +89,8 @@
<u:style name="color" skin="generalTextColor" />
</u:selector>
+<u:selector name=".dr-ddmenu-label-disabled" >
+ <u:style name="color" skin="tabDisabledTextColor"/>
+</u:selector>
+
</f:template>