Author: nbelaevski
Date: 2009-09-13 19:43:17 -0400 (Sun, 13 Sep 2009)
New Revision: 15548
Modified:
branches/community/3.3.X/ui/panelbar/src/main/config/component/panelbar.xml
branches/community/3.3.X/ui/panelbar/src/main/java/org/richfaces/renderkit/html/PanelBarRendererBase.java
branches/community/3.3.X/ui/panelbar/src/main/resources/org/richfaces/renderkit/html/scripts/panelbar.js
Log:
https://jira.jboss.org/jira/browse/RF-7763
Modified: branches/community/3.3.X/ui/panelbar/src/main/config/component/panelbar.xml
===================================================================
--- branches/community/3.3.X/ui/panelbar/src/main/config/component/panelbar.xml 2009-09-13
23:28:31 UTC (rev 15547)
+++ branches/community/3.3.X/ui/panelbar/src/main/config/component/panelbar.xml 2009-09-13
23:43:17 UTC (rev 15548)
@@ -98,6 +98,14 @@
</description>
<defaultvalue><![CDATA[""]]></defaultvalue>
</property>
+ <property>
+ <name>onitemchanged</name>
+ <classname>java.lang.String</classname>
+ <description>
+ The client-side script method to be called after a panel bar item has been
changed
+ </description>
+ <defaultvalue><![CDATA[""]]></defaultvalue>
+ </property>
<property>
<name>onmouseover</name>
<classname>java.lang.String</classname>
Modified:
branches/community/3.3.X/ui/panelbar/src/main/java/org/richfaces/renderkit/html/PanelBarRendererBase.java
===================================================================
---
branches/community/3.3.X/ui/panelbar/src/main/java/org/richfaces/renderkit/html/PanelBarRendererBase.java 2009-09-13
23:28:31 UTC (rev 15547)
+++
branches/community/3.3.X/ui/panelbar/src/main/java/org/richfaces/renderkit/html/PanelBarRendererBase.java 2009-09-13
23:43:17 UTC (rev 15548)
@@ -164,28 +164,20 @@
return items;
}
-
+
public void encodeScript(FacesContext context, UIComponent component) throws
IOException{
if(component instanceof UIPanelBar){
UIPanelBar panelBar = (UIPanelBar)component;
- List items = getScriptPanelBarItems(context, panelBar);
+ List<?> items = getScriptPanelBarItems(context, panelBar);
ScriptOptions options = new ScriptOptions(component);
AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
-
- Object changeScript = panelBar.getAttributes().get("onitemchange");
-
- if (changeScript != null && !changeScript.equals("")) {
- JSFunctionDefinition function = new JSFunctionDefinition();
- function.addParameter("event");
- function.addToBody(changeScript);
- options.addOption("onitemchange",function);
- } else {
- options.addOption("onitemchange","");
- }
+
+ addHandlerOption(panelBar, options, "onitemchange");
+ addHandlerOption(panelBar, options, "onitemchanged");
options.addOption("onclick",
panelBar.getAttributes().get("onclick"));
options.addOption("mouseover",
panelBar.getAttributes().get("onmouseover"));
@@ -209,4 +201,18 @@
writer.endElement(HTML.SCRIPT_ELEM);
}
}
+
+ private void addHandlerOption(UIPanelBar component, ScriptOptions options,
+ String handlerName) {
+ Object changeScript = component.getAttributes().get(handlerName);
+
+ if (changeScript != null && !changeScript.equals("")) {
+ JSFunctionDefinition function = new JSFunctionDefinition();
+ function.addParameter("event");
+ function.addToBody(changeScript);
+ options.addOption(handlerName, function);
+ } else {
+ options.addOption(handlerName, "");
+ }
+ }
}
Modified:
branches/community/3.3.X/ui/panelbar/src/main/resources/org/richfaces/renderkit/html/scripts/panelbar.js
===================================================================
---
branches/community/3.3.X/ui/panelbar/src/main/resources/org/richfaces/renderkit/html/scripts/panelbar.js 2009-09-13
23:28:31 UTC (rev 15547)
+++
branches/community/3.3.X/ui/panelbar/src/main/resources/org/richfaces/renderkit/html/scripts/panelbar.js 2009-09-13
23:43:17 UTC (rev 15548)
@@ -25,6 +25,7 @@
this.ch=this.panel.clientHeight;
this.options = options;
this.onitemchange = options.onitemchange;
+ this.onitemchanged = options.onitemchanged;
this.onclick = options.onclick;
this.items = options.items;
@@ -301,6 +302,8 @@
this.slidePanel.panel.style.maxHeight="";
this.slidePanel.panel.style.minHeight="";
+
+ this.slidePanel.invokeEvent("onchangeditem", event, leaveElement,
enterElement, this.slidePanel.panel, this.slidePanel.onitemchanged);
},
headerOnSelectStart: function() {