Author: nbelaevski
Date: 2007-03-22 11:08:02 -0400 (Thu, 22 Mar 2007)
New Revision: 117
Modified:
trunk/richfaces/common/src/main/java/org/richfaces/component/UISwitchablePanel.java
trunk/richfaces/common/src/main/java/org/richfaces/event/SwitchablePanelSwitchEvent.java
Log:
RF-30 fixed. Changes applied to UISwitchablePanel & SwitchablePanelSwitchEvent
Modified:
trunk/richfaces/common/src/main/java/org/richfaces/component/UISwitchablePanel.java
===================================================================
---
trunk/richfaces/common/src/main/java/org/richfaces/component/UISwitchablePanel.java 2007-03-22
14:40:52 UTC (rev 116)
+++
trunk/richfaces/common/src/main/java/org/richfaces/component/UISwitchablePanel.java 2007-03-22
15:08:02 UTC (rev 117)
@@ -98,36 +98,38 @@
}
public void broadcast(FacesEvent facesEvent) throws AbortProcessingException {
- if (facesEvent instanceof SwitchablePanelSwitchEvent && isRendered()) {
- FacesContext facesContext = FacesContext.getCurrentInstance();
-
- SwitchablePanelSwitchEvent switchEvent = (SwitchablePanelSwitchEvent) facesEvent;
- Object newValue = convertSwitchValue((UIComponent) switchEvent.getSource(),
- switchEvent.getValue());
-
- Object oldValue = getValue();
- if (oldValue == null && newValue != null ||
- oldValue != null && !oldValue.equals(newValue)) {
-
- queueEvent(new ValueChangeEvent(this, oldValue, newValue));
+ if (facesEvent instanceof SwitchablePanelSwitchEvent) {
+ if (isRendered()) {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+
+ SwitchablePanelSwitchEvent switchEvent = (SwitchablePanelSwitchEvent) facesEvent;
+ Object newValue = convertSwitchValue(switchEvent.getEventSource(),
+ switchEvent.getValue());
+
+ Object oldValue = getValue();
+ if (oldValue == null && newValue != null ||
+ oldValue != null && !oldValue.equals(newValue)) {
+
+ queueEvent(new ValueChangeEvent(this, oldValue, newValue));
+ }
+
+ ValueBinding valueBinding = getValueBinding("value");
+ if (valueBinding != null) {
+ valueBinding.setValue(facesContext, newValue);
+ setValue(null);
+ } else {
+ setValue(newValue);
+ }
+
+ if (AjaxRendererUtils.isAjaxRequest(facesContext) &&
this.getSwitchType().equals(AJAX_METHOD)) {
+ AjaxRendererUtils.addRegionByName(facesContext,
+ this,
+ this.getId());
+ }
}
-
- ValueBinding valueBinding = getValueBinding("value");
- if (valueBinding != null) {
- valueBinding.setValue(facesContext, newValue);
- setValue(null);
- } else {
- setValue(newValue);
- }
-
- if (AjaxRendererUtils.isAjaxRequest(facesContext) &&
this.getSwitchType().equals(AJAX_METHOD)) {
- AjaxRendererUtils.addRegionByName(facesContext,
- this,
- this.getId());
- }
+ } else /* component should throw IllegalArgumentException for unknown events - RF-30 */
{
+ super.broadcast(facesEvent);
}
-
- super.broadcast(facesEvent);
}
public void updateModel(FacesContext context) {
Modified:
trunk/richfaces/common/src/main/java/org/richfaces/event/SwitchablePanelSwitchEvent.java
===================================================================
---
trunk/richfaces/common/src/main/java/org/richfaces/event/SwitchablePanelSwitchEvent.java 2007-03-22
14:40:52 UTC (rev 116)
+++
trunk/richfaces/common/src/main/java/org/richfaces/event/SwitchablePanelSwitchEvent.java 2007-03-22
15:08:02 UTC (rev 117)
@@ -49,23 +49,14 @@
*/
private static final long serialVersionUID = 8579050007143915239L;
- public UIComponent getComponent() {
- return (UIComponent) super.getSource();
- }
-
- public Object getSource() {
- if (eventSource != null) {
- return eventSource;
- }
-
- //fix for MyFaces - they use getSource() in queueEvent()
- return super.getSource();
- }
-
public Object getValue() {
return value;
}
+ public UIComponent getEventSource() {
+ return eventSource;
+ }
+
public boolean isAppropriateListener(FacesListener listener) {
return false;
}
Show replies by date