Author: nbelaevski
Date: 2011-04-13 05:48:09 -0400 (Wed, 13 Apr 2011)
New Revision: 22418
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/TogglePanelRenderer.java
Log:
https://issues.jboss.org/browse/RF-10847
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 2011-04-12
16:26:12 UTC (rev 22417)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java 2011-04-13
09:48:09 UTC (rev 22418)
@@ -94,6 +94,18 @@
}
@Override
+ protected boolean isSubmitted(FacesContext context, AbstractTogglePanel panel) {
+ UIComponent item = (UIComponent) panel.getItem(panel.getSubmittedActiveItem());
+
+ if (item == null) {
+ return false;
+ }
+
+ Map<String, String> parameterMap =
context.getExternalContext().getRequestParameterMap();
+ return parameterMap.get(item.getClientId(context)) != null;
+ }
+
+ @Override
protected void doEncodeBegin(ResponseWriter w, FacesContext context, UIComponent
component) throws IOException {
super.doEncodeBegin(w, context, component);
@@ -151,17 +163,17 @@
private void writeTopTabHeader(FacesContext context, ResponseWriter writer,
AbstractTab tab) throws IOException {
boolean isActive = tab.isActive();
boolean isDisabled = tab.isDisabled();
-
+
encodeTabHeader(context, tab, writer, inactive, !isActive &&
!isDisabled);
encodeTabHeader(context, tab, writer, active, isActive && !isDisabled);
encodeTabHeader(context, tab, writer, disabled, isDisabled);
-
+
}
private void encodeTabHeader(FacesContext context, AbstractTab tab, ResponseWriter
writer,
- AbstractTogglePanelTitledItem.HeaderStates state, Boolean
isDisplay) throws IOException {
+ AbstractTogglePanelTitledItem.HeaderStates state, Boolean isDisplay) throws
IOException {
-
+
writer.startElement(TD_ELEM, tab);
writer.writeAttribute(ID_ATTRIBUTE, tab.getClientId(context) +
":header:" + state.toString(), null);
renderPassThroughAttributes(context, tab, HEADER_ATTRIBUTES);
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2011-04-12
16:26:12 UTC (rev 22417)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2011-04-13
09:48:09 UTC (rev 22418)
@@ -73,23 +73,30 @@
protected void doDecode(FacesContext context, UIComponent component) {
AbstractTogglePanel panel = (AbstractTogglePanel) component;
- Map<String, String> requestMap =
+ Map<String, String> requestParameterMap =
context.getExternalContext().getRequestParameterMap();
// Get the new panel value to show
- String newValue = requestMap.get(getValueRequestParamName(context, component));
+ String newValue = requestParameterMap.get(getValueRequestParamName(context,
component));
if (newValue != null) {
panel.setSubmittedActiveItem(newValue);
- }
-
- if (requestMap.get("javax.faces.partial.ajax") != null) {
- PartialViewContext pvc = context.getPartialViewContext();
- pvc.getRenderIds().add(
- component.getClientId(context) +
MetaComponentResolver.META_COMPONENT_SEPARATOR_CHAR
+
+ if (isSubmitted(context, panel)) {
+ PartialViewContext pvc = context.getPartialViewContext();
+
+ pvc.getRenderIds().add(
+ component.getClientId(context) +
MetaComponentResolver.META_COMPONENT_SEPARATOR_CHAR
+ AbstractTogglePanel.ACTIVE_ITEM_META_COMPONENT);
+ }
+
}
}
+ protected boolean isSubmitted(FacesContext context, AbstractTogglePanel panel) {
+ Map<String, String> parameterMap =
context.getExternalContext().getRequestParameterMap();
+ return parameterMap.get(panel.getClientId(context)) != null;
+ }
+
protected static void addOnCompleteParam(FacesContext context, String newValue,
String panelId) {
StringBuilder onComplete = new StringBuilder();
onComplete.append("RichFaces.$('").append(panelId)