Author: abelevich
Date: 2007-10-15 14:11:13 -0400 (Mon, 15 Oct 2007)
New Revision: 3382
Modified:
trunk/ui/tabPanel/src/main/java/org/richfaces/component/UITabPanel.java
Log:
RF-258
Modified: trunk/ui/tabPanel/src/main/java/org/richfaces/component/UITabPanel.java
===================================================================
--- trunk/ui/tabPanel/src/main/java/org/richfaces/component/UITabPanel.java 2007-10-15
17:11:22 UTC (rev 3381)
+++ trunk/ui/tabPanel/src/main/java/org/richfaces/component/UITabPanel.java 2007-10-15
18:11:13 UTC (rev 3382)
@@ -33,14 +33,13 @@
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.Predicate;
import org.apache.commons.collections.iterators.FilterIterator;
-import org.richfaces.event.SwitchablePanelSwitchEvent;
/**
* JSF component class
*/
public abstract class UITabPanel extends UISwitchablePanel {
public static final String COMPONENT_TYPE = "org.richfaces.TabPanel";
-
+
public boolean getRendersChildren() {
return true;
}
@@ -60,6 +59,21 @@
});
}
+ public boolean isImmediate() {
+
+ if(!super.isImmediate()){
+ UITab tab = getTabWithName(getValue());
+ if(tab != null){
+ if(tab.isImmediate()){
+ return true;
+ }
+ }
+ return false;
+ }else{
+ return super.isImmediate();
+ }
+ }
+
public Object convertSwitchValue(UIComponent component, Object object) {
if (object != null) {
return object;
@@ -132,11 +146,11 @@
Object[] state = new Object[2];
state[0] = super.saveState(context);
state[1] = renderedValue;
-
+
return state;
}
- public UITab getTabWithName(Object tabName){
+ private UITab getTabWithName(Object tabName){
List children = getChildren();
for (Iterator iterator = children.iterator(); iterator.hasNext();) {
@@ -223,37 +237,17 @@
public void queueEvent(FacesEvent event) {
- FacesEvent processedEvent = event;
+ if(event instanceof ActionEvent && this.equals(event.getComponent())){
+
+ if(isImmediate()){
+ event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
+ }else{
+ event.setPhaseId(PhaseId.INVOKE_APPLICATION);
+ }
+
+ }
- if (event instanceof SwitchablePanelSwitchEvent &&
this.equals(event.getComponent())) {
- SwitchablePanelSwitchEvent switchEvent = (SwitchablePanelSwitchEvent) event;
- UIComponent component = switchEvent.getEventSource();
- UITab savedTab = getTabWithName(getValue());
- if(savedTab != null){
- if((component instanceof UITab) && ((UITab)savedTab).isImmediate() ||
isImmediate()){
- setImmediate(true);
- }else{
- setImmediate(false);
- }
- }
- }
- // redefine phaseId of ActionEvent RF-843
- if(event instanceof ActionEvent ){
- UIComponent component = event.getComponent();
- UITab savedTab = getTabWithName(getValue());
- if(savedTab != null){
- if((component instanceof UITab) && ((UITab)savedTab).isImmediate() ||
isImmediate()){
- setImmediate(true);
- processedEvent.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
- }else{
- setImmediate(false);
- processedEvent.setPhaseId(PhaseId.INVOKE_APPLICATION);
- }
- }
- }
-
- super.queueEvent(processedEvent);
+ super.queueEvent(event);
}
-
-
+
}