Thomas, I hate to keep picking on you, but where's the JIRA issue for this? We'll also want to update the commit log message to point to that issue (Martin and Wendy talked about how to do that in the last couple of weeks when Martin forgot to add a JIRA issue).
On 9/20/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Author: tomsp Date: Wed Sep 20 04:50:22 2006 New Revision: 448171 URL: http://svn.apache.org/viewvc?view=rev&rev=448171 Log: new attribute "activePanelTabVar" for HtmlPanelTabbedPane Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tabbedpane/HtmlPanelTabbedPane.java myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tabbedpane/HtmlPanelTabbedPaneTag.java myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tabbedpane/HtmlTabbedPaneRenderer.java myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/tabbedpane/HtmlPanelTabbedPane.xml myfaces/tomahawk/trunk/core/src/main/tld/tomahawk-entities/tomahawk_panel_tabbed_pane_attributes.xml Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tabbedpane/HtmlPanelTabbedPane.java URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tabbedpane/HtmlPanelTabbedPane.java?view=diff&rev=448171&r1=448170&r2=448171 ============================================================================== --- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tabbedpane/HtmlPanelTabbedPane.java (original) +++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tabbedpane/HtmlPanelTabbedPane.java Wed Sep 20 04:50:22 2006 @@ -161,6 +161,7 @@ private String _inactiveSubStyleClass = null; private String _tabContentStyleClass = null; private Boolean _serverSideTabSwitch = null; + private String _activePanelTabVar; public HtmlPanelTabbedPane() { @@ -172,6 +173,17 @@ return COMPONENT_FAMILY; } + public String getActiveTabVar() { + if (_activePanelTabVar != null) return _activePanelTabVar; + ValueBinding vb = getValueBinding("activeTabVar"); + return vb != null ? _ComponentUtils.getStringValue(getFacesContext(), vb) : null; + } + + public void setActiveTabVar(String activeTabVar) { + _activePanelTabVar = activeTabVar; + } + + public void setSelectedIndex(int selectedIndex) { _selectedIndex = new Integer(selectedIndex); @@ -284,7 +296,7 @@ public Object saveState(FacesContext context) { - Object values[] = new Object[11]; + Object values[] = new Object[12]; values[0] = super.saveState(context); values[1] = _selectedIndex; values[2] = _bgcolor; @@ -296,6 +308,7 @@ values[8] = _tabContentStyleClass; values[9] = _disabledTabStyleClass; values[10] = _serverSideTabSwitch; + values[11] = _activePanelTabVar; return ((Object) (values)); } @@ -313,6 +326,7 @@ _tabContentStyleClass = (String)values[8]; _disabledTabStyleClass = (String)values[9]; _serverSideTabSwitch = (Boolean) values[10]; + _activePanelTabVar = (String) values[11]; } //------------------ GENERATED CODE END --------------------------------------- } Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tabbedpane/HtmlPanelTabbedPaneTag.java URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tabbedpane/HtmlPanelTabbedPaneTag.java?view=diff&rev=448171&r1=448170&r2=448171 ============================================================================== --- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tabbedpane/HtmlPanelTabbedPaneTag.java (original) +++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tabbedpane/HtmlPanelTabbedPaneTag.java Wed Sep 20 04:50:22 2006 @@ -63,6 +63,7 @@ private String _inactiveSubStyleClass; private String _tabContentStyleClass; private String _serverSideTabSwitch; + private String _activePanelTabVar; // User Role support --> already handled by HtmlPanelGroupTag @@ -91,6 +92,7 @@ setStringProperty(component, "inactiveSubStyleClass", _inactiveSubStyleClass); setStringProperty(component, "tabContentStyleClass", _tabContentStyleClass); setBooleanProperty(component, "serverSideTabSwitch", _serverSideTabSwitch); + setStringProperty(component, "activePanelTabVar", _activePanelTabVar); } @@ -116,6 +118,7 @@ _inactiveSubStyleClass = null; _tabContentStyleClass = null; _serverSideTabSwitch = null; + _activePanelTabVar = null; } public void setServerSideTabSwitch(String serverSideTabSwitch) @@ -222,4 +225,7 @@ _disabledTabStyleClass = disabledTabStyleClass; } + public void setActivePanelTabVar(String activePanelTabVar) { + _activePanelTabVar = activePanelTabVar; + } } Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tabbedpane/HtmlTabbedPaneRenderer.java URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tabbedpane/HtmlTabbedPaneRenderer.java?view=diff&rev=448171&r1=448170&r2=448171 ============================================================================== --- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tabbedpane/HtmlTabbedPaneRenderer.java (original) +++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tabbedpane/HtmlTabbedPaneRenderer.java Wed Sep 20 04:50:22 2006 @@ -220,7 +220,7 @@ String tabContentStyleClass = tabbedPane.getTabContentStyleClass(); writer.writeAttribute(HTML.CLASS_ATTR, TAB_PANE_CLASS+(tabContentStyleClass==null ? "" : " "+tabContentStyleClass), null); - writeTabsContents(writer, facesContext, tabbedPane, selectedIndex); + writeTabsContents(writer, facesContext, tabbedPane, selectedIndex); writer.endElement(HTML.TD_ELEM); writer.endElement(HTML.TR_ELEM); @@ -514,28 +514,38 @@ protected void writeTabsContents(ResponseWriter writer, FacesContext facesContext, HtmlPanelTabbedPane tabbedPane, int selectedIndex) throws IOException { - HtmlRendererUtils.writePrettyLineSeparator(facesContext); + HtmlRendererUtils.writePrettyLineSeparator(facesContext); + + int tabIdx = 0; + List children = tabbedPane.getChildren(); + for (int i = 0, len = children.size(); i < len; i++) { + UIComponent child = getUIComponent((UIComponent) children.get(i)); + if (child instanceof HtmlPanelTab) { + String activeTabVar = tabbedPane.getActiveTabVar(); + if (activeTabVar != null) { + Map requestMap = facesContext.getExternalContext().getRequestMap(); + requestMap.put(activeTabVar, Boolean.valueOf(tabIdx == selectedIndex)); + } - int tabIdx = 0; - List children = tabbedPane.getChildren(); - for (int i = 0, len = children.size(); i < len; i++) { - UIComponent child = getUIComponent((UIComponent) children.get(i)); - if (child instanceof HtmlPanelTab) { - HtmlPanelTab tab = (HtmlPanelTab)child; - writer.startElement(HTML.DIV_ELEM, tabbedPane); - writer.writeAttribute(HTML.ID_ATTR, tab.getClientId(facesContext), null); - // the inactive tabs are hidden with a div-tag - if (tabIdx != selectedIndex) { - writer.writeAttribute(HTML.STYLE_ATTR, "display:none", null); - } - RendererUtils.renderChild(facesContext, child); - writer.endElement(HTML.DIV_ELEM); - - tabIdx++; - } else { - RendererUtils.renderChild(facesContext, child); - } - } + HtmlPanelTab tab = (HtmlPanelTab)child; + writer.startElement(HTML.DIV_ELEM, tabbedPane); + writer.writeAttribute(HTML.ID_ATTR, tab.getClientId(facesContext), null); + // the inactive tabs are hidden with a div-tag + if (tabIdx != selectedIndex) { + writer.writeAttribute(HTML.STYLE_ATTR, "display:none", null); + } + RendererUtils.renderChild(facesContext, child); + writer.endElement(HTML.DIV_ELEM); + + tabIdx++; + if (activeTabVar != null) { + Map requestMap = facesContext.getExternalContext().getRequestMap(); + requestMap.remove(tabbedPane.getActiveTabVar()); + } + } else { + RendererUtils.renderChild(facesContext, child); + } + } } private UIComponent getUIComponent(UIComponent uiComponent) Modified: myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/tabbedpane/HtmlPanelTabbedPane.xml URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/tabbedpane/HtmlPanelTabbedPane.xml?view=diff&rev=448171&r1=448170&r2=448171 ============================================================================== --- myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/tabbedpane/HtmlPanelTabbedPane.xml (original) +++ myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/tabbedpane/HtmlPanelTabbedPane.xml Wed Sep 20 04:50:22 2006 @@ -45,4 +45,8 @@ <name>tabContentStyleClass</name> <type>java.lang.String</type> </field> + <field> + <name>activePanelTabVar</name> + <type>java.lang.String</type> + </field> </component> Modified: myfaces/tomahawk/trunk/core/src/main/tld/tomahawk-entities/tomahawk_panel_tabbed_pane_attributes.xml URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/tld/tomahawk-entities/tomahawk_panel_tabbed_pane_attributes.xml?view=diff&rev=448171&r1=448170&r2=448171 ============================================================================== --- myfaces/tomahawk/trunk/core/src/main/tld/tomahawk-entities/tomahawk_panel_tabbed_pane_attributes.xml (original) +++ myfaces/tomahawk/trunk/core/src/main/tld/tomahawk-entities/tomahawk_panel_tabbed_pane_attributes.xml Wed Sep 20 04:50:22 2006 @@ -62,3 +62,12 @@ Toggle client-side/server-side tab switches. </description> </attribute> + <attribute> + <name>_activePanelTabVar</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + <description> + Boolean Variable that is set in request scope when rendering a panelTab. True means that the currently rendered + panelTab is active. + </description> + </attribute>
