Author: abelevich
Date: 2007-10-18 08:22:17 -0400 (Thu, 18 Oct 2007)
New Revision: 3438
Modified:
trunk/ui/tabPanel/src/main/java/org/richfaces/component/UITabPanel.java
Log:
RF-1128, also add right behavior for tabPanel with immediate tabs
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-18
08:35:34 UTC (rev 3437)
+++ trunk/ui/tabPanel/src/main/java/org/richfaces/component/UITabPanel.java 2007-10-18
12:22:17 UTC (rev 3438)
@@ -33,14 +33,19 @@
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 static final String COMPONENT_TYPE = "org.richfaces.TabPanel";
- public boolean getRendersChildren() {
+ private transient boolean processedTabImmediate;
+
+
+ public boolean getRendersChildren() {
return true;
}
@@ -62,17 +67,16 @@
public boolean isImmediate() {
if(!super.isImmediate()){
- UITab tab = getTabWithName(getValue());
- if(tab != null){
- if(tab.isImmediate()){
- return true;
- }
+ if(processedTabImmediate){
+ return true;
}
return false;
- }else{
+ }else{
return super.isImmediate();
- }
+ }
+
}
+
public Object convertSwitchValue(UIComponent component, Object object) {
if (object != null) {
@@ -150,18 +154,6 @@
return state;
}
- private UITab getTabWithName(Object tabName){
-
- List children = getChildren();
- for (Iterator iterator = children.iterator(); iterator.hasNext();) {
- UIComponent childComponent = (UIComponent) iterator.next();
- if(childComponent instanceof UITab &&
((UITab)childComponent).getName().equals(tabName)){
- return (UITab)childComponent;
- }
- }
- return null;
- }
-
public void restoreState(FacesContext context, Object state) {
Object[] states = (Object[]) state;
super.restoreState(context, states[0]);
@@ -233,10 +225,33 @@
public abstract void setHeaderClass(String value);
+ private UITab processedTab(UIComponent component, Object object){
+ if (object != null) {
+ return getTabWithName(object);
+ }
+ return (UITab)component;
+ }
+ private UITab getTabWithName(Object tabName){
+ List children = getChildren();
+ for (Iterator iterator = children.iterator(); iterator.hasNext();) {
+ UIComponent childComponent = (UIComponent) iterator.next();
+ if(childComponent instanceof UITab &&
((UITab)childComponent).getName().equals(tabName)){
+ return (UITab)childComponent;
+ }
+ }
+ return null;
+ }
+
public void queueEvent(FacesEvent event) {
+ if(event instanceof SwitchablePanelSwitchEvent &&
this.equals(event.getComponent())){
+ SwitchablePanelSwitchEvent switchEvent = (SwitchablePanelSwitchEvent)event;
+ UITab tab = processedTab(switchEvent.getEventSource(),switchEvent.getValue());
+ processedTabImmediate = tab.isImmediate();
+ }
+
if(event instanceof ActionEvent && event.getComponent()instanceof UITab){
if(isImmediate()){
Show replies by date