Author: Alex.Kolonitsky
Date: 2010-10-04 06:44:32 -0400 (Mon, 04 Oct 2010)
New Revision: 19422
Modified:
trunk/examples/output-demo/src/main/webapp/examples/tabPanel.xhtml
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelTitledItem.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/behavior/ToggleControl.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlAccordionItem.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem.js
Log:
RF-9401 Tab panel: classes for tab are not set
RF-9352 Collapsible panel: facet headerCollapsed doesn't work
RFPL-674 Accordion: class attribute is not set for headers and content
Modified: trunk/examples/output-demo/src/main/webapp/examples/tabPanel.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/examples/tabPanel.xhtml 2010-10-04 08:10:44
UTC (rev 19421)
+++ trunk/examples/output-demo/src/main/webapp/examples/tabPanel.xhtml 2010-10-04 10:44:32
UTC (rev 19422)
@@ -15,8 +15,8 @@
<p>Page</p>
<h:form id="f">
- <pn:tabPanel id="panel" switchType="ajax"
tabHeaderClassActive="myClass_01">
- <pn:tab header="tab1 header"
headerClassActive="myClass_02">
+ <pn:tabPanel id="panel" switchType="ajax"
tabHeaderClassDisabled="myClass_01">
+ <pn:tab header="tab1 header"
headerClassDisabled="myClass_02">
Content will be here. Content will be here. Content will be here.
Content will be here. Content will be here. Content will be here. Content will be here.
Content will be here. Content will be here. Content will be here. Content will be here.
Content will be here. Content will be here. Content will be here.
</pn:tab>
<pn:tab header="tab2 header">
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelTitledItem.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelTitledItem.java 2010-10-04
08:10:44 UTC (rev 19421)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelTitledItem.java 2010-10-04
10:44:32 UTC (rev 19422)
@@ -41,7 +41,7 @@
public enum HeaderStates {
active("act"),
inactive("inact"),
- disable("dis");
+ disabled("dis");
private final String abbreviation;
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/component/behavior/ToggleControl.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/component/behavior/ToggleControl.java 2010-10-04
08:10:44 UTC (rev 19421)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/component/behavior/ToggleControl.java 2010-10-04
10:44:32 UTC (rev 19422)
@@ -25,6 +25,7 @@
import javax.faces.FacesException;
import javax.faces.component.UIComponent;
import javax.faces.component.behavior.ClientBehaviorContext;
+import javax.faces.context.FacesContext;
import org.ajax4jsf.component.behavior.ClientBehavior;
import org.richfaces.component.AbstractTogglePanel;
@@ -97,17 +98,26 @@
+ comp.getClientId(getFacesContext()) + ") has not been
found.");
}
} else {
- UIComponent control = comp;
- while (control != null) {
- if (control instanceof AbstractTogglePanel) {
- return (AbstractTogglePanel) control;
- }
+ return getEnclosedPanel(comp);
+ }
+ }
- control = control.getParent();
+ public static AbstractTogglePanel getEnclosedPanel(UIComponent comp) {
+ if (comp == null) {
+ return null;
+ }
+
+ UIComponent control = comp;
+ while (control != null) {
+ if (control instanceof AbstractTogglePanel) {
+ return (AbstractTogglePanel) control;
}
- throw new FacesException("Parent panel for control (id="
- + comp.getClientId(getFacesContext()) + ") has not been
found.");
+
+ control = control.getParent();
}
+
+ throw new FacesException("Parent panel for control (id="
+ + comp.getClientId(FacesContext.getCurrentInstance()) + ") has not
been found.");
}
@Override
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlAccordionItem.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlAccordionItem.java 2010-10-04
08:10:44 UTC (rev 19421)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlAccordionItem.java 2010-10-04
10:44:32 UTC (rev 19422)
@@ -23,6 +23,8 @@
package org.richfaces.component.html;
import org.richfaces.component.UITogglePanelTitledItem;
+import org.richfaces.component.behavior.ToggleControl;
+
import javax.faces.component.behavior.ClientBehaviorHolder;
import java.util.Arrays;
@@ -94,8 +96,12 @@
return COMPONENT_FAMILY;
}
+ public HtmlAccordion getAccordion() {
+ return (HtmlAccordion) ToggleControl.getEnclosedPanel(this);
+ }
+
public String getHeaderClassActive() {
- return (String) getStateHelper().eval(PropertyKeys.headerClassActive);
+ return (String) getStateHelper().eval(PropertyKeys.headerClassActive,
getAccordion().getItemHeaderClassActive());
}
public void setHeaderClassActive(String headerClassActive) {
@@ -103,7 +109,7 @@
}
public String getHeaderClassDisabled() {
- return (String) getStateHelper().eval(PropertyKeys.headerClassDisabled);
+ return (String) getStateHelper().eval(PropertyKeys.headerClassDisabled,
getAccordion().getItemHeaderClassDisabled());
}
public void setHeaderClassDisabled(String headerClassDisabled) {
@@ -111,7 +117,7 @@
}
public String getHeaderClassInactive() {
- return (String) getStateHelper().eval(PropertyKeys.headerClassInactive);
+ return (String) getStateHelper().eval(PropertyKeys.headerClassInactive,
getAccordion().getItemHeaderClassInactive());
}
public void setHeaderClassInactive(String headerClassInactive) {
@@ -119,7 +125,7 @@
}
public String getHeaderClass() {
- return (String) getStateHelper().eval(PropertyKeys.headerClass);
+ return (String) getStateHelper().eval(PropertyKeys.headerClass,
getAccordion().getItemHeaderClass());
}
public void setHeaderClass(String headerClass) {
@@ -135,7 +141,7 @@
}
public String getContentClass() {
- return (String) getStateHelper().eval(PropertyKeys.contentClass);
+ return (String) getStateHelper().eval(PropertyKeys.contentClass,
getAccordion().getItemContentClass());
}
public void setContentClass(String contentClass) {
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java 2010-10-04
08:10:44 UTC (rev 19421)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java 2010-10-04
10:44:32 UTC (rev 19422)
@@ -137,7 +137,7 @@
boolean isDisabled = titledItem.isDisabled();
encodeHeader(context, titledItem, writer, HeaderStates.inactive, !isActive
&& !isDisabled);
encodeHeader(context, titledItem, writer, HeaderStates.active, isActive
&& !isDisabled);
- encodeHeader(context, titledItem, writer, HeaderStates.disable, isDisabled);
+ encodeHeader(context, titledItem, writer, HeaderStates.disabled, isDisabled);
writer.endElement("div");
}
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java 2010-10-04
08:10:44 UTC (rev 19421)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java 2010-10-04
10:44:32 UTC (rev 19422)
@@ -23,7 +23,7 @@
package org.richfaces.renderkit.html;
import static org.richfaces.component.AbstractTogglePanelTitledItem.HeaderStates.active;
-import static
org.richfaces.component.AbstractTogglePanelTitledItem.HeaderStates.disable;
+import static
org.richfaces.component.AbstractTogglePanelTitledItem.HeaderStates.disabled;
import static
org.richfaces.component.AbstractTogglePanelTitledItem.HeaderStates.inactive;
import static org.richfaces.component.html.HtmlAccordion.PropertyKeys.height;
import static org.richfaces.component.util.HtmlUtil.concatClasses;
@@ -136,7 +136,7 @@
encodeTabHeader(context, tab, writer, inactive, !isActive &&
!isDisabled);
encodeTabHeader(context, tab, writer, active, isActive && !isDisabled);
- encodeTabHeader(context, tab, writer, disable, isDisabled);
+ encodeTabHeader(context, tab, writer, disabled, isDisabled);
}
Modified:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem.js
===================================================================
---
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem.js 2010-10-04
08:10:44 UTC (rev 19421)
+++
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem.js 2010-10-04
10:44:32 UTC (rev 19422)
@@ -45,7 +45,7 @@
},
__state : function () {
- return this.getName() === "true" ? "expanded" :
"collapsed";
+ return this.getName() === "true" ? "exp" :
"colps";
},
__header : function (state) {