Author: nbelaevski
Date: 2011-01-18 19:38:15 -0500 (Tue, 18 Jan 2011)
New Revision: 21065
Added:
trunk/core/api/src/main/java/org/richfaces/util/FastJoiner.java
trunk/core/api/src/test/java/org/richfaces/util/FastJoinerTest.java
Modified:
trunk/core/api/src/main/java/org/richfaces/application/push/TopicKey.java
trunk/core/api/src/main/java/org/richfaces/context/ExtendedVisitContext.java
trunk/core/impl/src/main/java/org/richfaces/renderkit/html/ResourceLibraryRenderer.java
trunk/core/impl/src/main/java/org/richfaces/resource/ExternalStaticResource.java
trunk/core/impl/src/main/java/org/richfaces/resource/ResourceLibraryFactoryImpl.java
trunk/core/impl/src/main/java/org/richfaces/util/Util.java
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeBean.java
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeNodeParser.java
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/components/sh/SyntaxHighlighter.java
trunk/ui/common/ui/src/main/java/org/richfaces/component/UIDataAdaptor.java
trunk/ui/common/ui/src/main/java/org/richfaces/component/util/Strings.java
trunk/ui/common/ui/src/main/java/org/richfaces/renderkit/RendererBase.java
trunk/ui/iteration/api/src/main/java/org/richfaces/component/Row.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/convert/DeclarativeModelKeyConverter.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableBaseRenderer.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/CollapsibleSubTableRenderer.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/CollapsibleSubTableTogglerRendererBase.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ColumnGroupRenderer.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ListRendererBase.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/RowHolder.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeNodeRendererBase.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeRenderingContext.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/behavior/ToggleControl.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemHeaderRenderer.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/AccordionRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelItemRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java
Log:
https://issues.jboss.org/browse/RF-10239
https://issues.jboss.org/browse/RF-10187
Performance optimization:
- getClientId() replaced with getClientId(FacesCoontext)
- Joiner replaced with FastJoiner
Fix:
- Removed redundant 'static' modifier from RendererBase#concatClasses &
RendererBase#concatStyles
Modified: trunk/core/api/src/main/java/org/richfaces/application/push/TopicKey.java
===================================================================
--- trunk/core/api/src/main/java/org/richfaces/application/push/TopicKey.java 2011-01-18
19:20:56 UTC (rev 21064)
+++ trunk/core/api/src/main/java/org/richfaces/application/push/TopicKey.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -24,8 +24,9 @@
import java.io.Serializable;
import java.util.regex.Pattern;
+import org.richfaces.util.FastJoiner;
+
import com.google.common.base.Function;
-import com.google.common.base.Joiner;
/**
* @author Nick Belaevski
@@ -51,7 +52,7 @@
private static final Pattern NAME_PATTERN =
Pattern.compile("[a-zA-Z0-9_]+");
- private static final Joiner AT_JOINER = Joiner.on(SUBCHANNEL_SEPARATOR).skipNulls();
+ private static final FastJoiner AT_JOINER = FastJoiner.on(SUBCHANNEL_SEPARATOR);
private final String topicName;
Modified: trunk/core/api/src/main/java/org/richfaces/context/ExtendedVisitContext.java
===================================================================
---
trunk/core/api/src/main/java/org/richfaces/context/ExtendedVisitContext.java 2011-01-18
19:20:56 UTC (rev 21064)
+++
trunk/core/api/src/main/java/org/richfaces/context/ExtendedVisitContext.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -31,9 +31,8 @@
import javax.faces.context.FacesContext;
import org.richfaces.component.MetaComponentResolver;
+import org.richfaces.util.FastJoiner;
-import com.google.common.base.Joiner;
-
/**
* @author Nick Belaevski
*
@@ -42,7 +41,7 @@
public static final String META_COMPONENT_ID =
"org.richfaces.MetaComponentId";
- private static final Joiner META_COMPONENT_SEPARATOR_JOINER =
Joiner.on(MetaComponentResolver.META_COMPONENT_SEPARATOR_CHAR).skipNulls();
+ private static final FastJoiner META_COMPONENT_SEPARATOR_JOINER =
FastJoiner.on(MetaComponentResolver.META_COMPONENT_SEPARATOR_CHAR);
private final FacesContext facesContext;
Added: trunk/core/api/src/main/java/org/richfaces/util/FastJoiner.java
===================================================================
--- trunk/core/api/src/main/java/org/richfaces/util/FastJoiner.java
(rev 0)
+++ trunk/core/api/src/main/java/org/richfaces/util/FastJoiner.java 2011-01-19 00:38:15
UTC (rev 21065)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2011, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.richfaces.util;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public final class FastJoiner {
+
+ private String separator;
+
+ private FastJoiner(String separator) {
+ super();
+ this.separator = separator;
+ }
+
+ private String maskNullString(String s) {
+ if (s != null) {
+ return s;
+ }
+
+ return "";
+ }
+
+ public String join(String s1, String s2) {
+ if (s1 == null) {
+ return maskNullString(s2);
+ } else if (s2 == null) {
+ return maskNullString(s1);
+ }
+
+ StringBuilder sb = new StringBuilder(s1.length() + separator.length() +
s2.length());
+
+ sb.append(s1);
+ sb.append(separator);
+ sb.append(s2);
+
+ return sb.toString();
+ }
+
+ public String join(String... strings) {
+ StringBuilder sb = new StringBuilder();
+
+ boolean first = true;
+
+ for (String s : strings) {
+ if (s == null) {
+ continue;
+ }
+
+ if (first) {
+ first = false;
+ } else {
+ sb.append(separator);
+ }
+
+ sb.append(s);
+ }
+
+ return sb.toString();
+ }
+
+ public static FastJoiner on(String sep) {
+ return new FastJoiner(sep);
+ }
+
+ public static FastJoiner on(char c) {
+ return new FastJoiner(String.valueOf(c));
+ }
+
+}
Added: trunk/core/api/src/test/java/org/richfaces/util/FastJoinerTest.java
===================================================================
--- trunk/core/api/src/test/java/org/richfaces/util/FastJoinerTest.java
(rev 0)
+++ trunk/core/api/src/test/java/org/richfaces/util/FastJoinerTest.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -0,0 +1,135 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2011, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.richfaces.util;
+
+import static org.junit.Assert.assertEquals;
+import static org.richfaces.util.FastJoiner.on;
+
+import org.junit.Test;
+
+import com.google.common.base.Joiner;
+
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class FastJoinerTest {
+
+ private static final int PERFORMANCE_TEST_STEPS = 100000;
+
+ @Test
+ public void testDotCharJoin() throws Exception {
+ FastJoiner joiner = on('.');
+ assertEquals("", joiner.join(null, null));
+
+ assertEquals("test", joiner.join("test", null));
+ assertEquals("test.", joiner.join("test", ""));
+
+ assertEquals("another test", joiner.join(null, "another
test"));
+ assertEquals(".another test", joiner.join("", "another
test"));
+
+ assertEquals("join.them", joiner.join("join",
"them"));
+ }
+
+ @Test
+ public void testDotCharVarargsJoin() throws Exception {
+ FastJoiner joiner = on('.');
+
+ assertEquals("", joiner.join(null, null, null));
+
+ assertEquals("test", joiner.join("test", null, null));
+ assertEquals("test", joiner.join(null, "test", null));
+ assertEquals("test", joiner.join(null, null, "test"));
+
+ assertEquals("test..abc", joiner.join("test", "",
"abc"));
+ assertEquals("test..abc", joiner.join(null, "test",
"", "abc"));
+
+ assertEquals(".test.abc", joiner.join("", "test",
"abc"));
+ assertEquals(".test.abc", joiner.join(null, "",
"test", "abc"));
+
+ assertEquals("join.them.all", joiner.join("join",
"them", "all"));
+ }
+
+ @Test
+ public void testXYStringJoin() throws Exception {
+ FastJoiner joiner = on("-xy+");
+
+ assertEquals("", joiner.join(null, null));
+
+ assertEquals("test", joiner.join("test", null));
+ assertEquals("test-xy+", joiner.join("test", ""));
+
+ assertEquals("another test", joiner.join(null, "another
test"));
+ assertEquals("-xy+another test", joiner.join("",
"another test"));
+
+ assertEquals("join-xy+them", joiner.join("join",
"them"));
+ }
+
+ @Test
+ public void testEmptyStringJoin() throws Exception {
+ FastJoiner joiner = on("");
+
+ assertEquals("", joiner.join(null, null));
+
+ assertEquals("test", joiner.join("test", null));
+ assertEquals("test", joiner.join("test", ""));
+
+ assertEquals("another test", joiner.join(null, "another
test"));
+ assertEquals("another test", joiner.join("", "another
test"));
+
+ assertEquals("jointhem", joiner.join("join",
"them"));
+ }
+
+ @Test
+ public void testEmptyStringVarargsJoin() throws Exception {
+ FastJoiner joiner = on("");
+
+ assertEquals("", joiner.join(null, null, null));
+
+ assertEquals("test", joiner.join(null, "test", null, null));
+ assertEquals("test", joiner.join("test", null, null));
+ assertEquals("test", joiner.join("test", "",
null));
+ assertEquals("test", joiner.join("", "test",
null));
+ assertEquals("test", joiner.join(null, "", "test",
null));
+
+ assertEquals("jointhemall", joiner.join("join",
"them", "all"));
+ }
+
+ @Test
+ public void testGuavaJoinerPerformance() throws Exception {
+ Joiner joiner = Joiner.on("-separator-").skipNulls();
+
+ for (int i = 0; i < PERFORMANCE_TEST_STEPS; i++) {
+ joiner.join("big:table:id:string", "cell:id");
+ }
+ }
+
+ @Test
+ public void testFastJoinerPerformance() throws Exception {
+ FastJoiner joiner = FastJoiner.on("-separator-");
+
+ for (int i = 0; i < PERFORMANCE_TEST_STEPS; i++) {
+ joiner.join("big:table:id:string", "cell:id");
+ }
+ }
+}
Modified:
trunk/core/impl/src/main/java/org/richfaces/renderkit/html/ResourceLibraryRenderer.java
===================================================================
---
trunk/core/impl/src/main/java/org/richfaces/renderkit/html/ResourceLibraryRenderer.java 2011-01-18
19:20:56 UTC (rev 21064)
+++
trunk/core/impl/src/main/java/org/richfaces/renderkit/html/ResourceLibraryRenderer.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -33,9 +33,8 @@
import org.richfaces.resource.ResourceKey;
import org.richfaces.resource.ResourceLibrary;
import org.richfaces.resource.ResourceLibraryFactory;
+import org.richfaces.util.FastJoiner;
-import com.google.common.base.Joiner;
-
/**
* @author Nick Belaevski
*
@@ -48,7 +47,7 @@
private static final Logger LOGGER = RichfacesLogger.RENDERKIT.getLogger();
- private static final Joiner COLON_JOINER = Joiner.on(':').skipNulls();
+ private static final FastJoiner COLON_JOINER = FastJoiner.on(':');
public ResourceLibraryRenderer() {
super();
Modified:
trunk/core/impl/src/main/java/org/richfaces/resource/ExternalStaticResource.java
===================================================================
---
trunk/core/impl/src/main/java/org/richfaces/resource/ExternalStaticResource.java 2011-01-18
19:20:56 UTC (rev 21064)
+++
trunk/core/impl/src/main/java/org/richfaces/resource/ExternalStaticResource.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -33,9 +33,8 @@
import org.richfaces.application.CoreConfiguration;
import org.richfaces.skin.SkinFactory;
+import org.richfaces.util.FastJoiner;
-import com.google.common.base.Joiner;
-
/**
* @author Nick Belaevski
*
@@ -44,7 +43,7 @@
public static final String STATIC_RESOURCE_LOCATION_VARIABLE =
"resourceLocation";
- private static final Joiner RESOURCE_PATH_JOINER =
Joiner.on('/').skipNulls();
+ private static final FastJoiner RESOURCE_PATH_JOINER = FastJoiner.on('/');
private String location;
Modified:
trunk/core/impl/src/main/java/org/richfaces/resource/ResourceLibraryFactoryImpl.java
===================================================================
---
trunk/core/impl/src/main/java/org/richfaces/resource/ResourceLibraryFactoryImpl.java 2011-01-18
19:20:56 UTC (rev 21064)
+++
trunk/core/impl/src/main/java/org/richfaces/resource/ResourceLibraryFactoryImpl.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -25,10 +25,10 @@
import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
+import org.richfaces.util.FastJoiner;
import org.richfaces.util.PropertiesUtil;
import com.google.common.base.Function;
-import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
import com.google.common.collect.Iterables;
import com.google.common.collect.MapMaker;
@@ -41,7 +41,7 @@
private static final Logger LOGGER = RichfacesLogger.RESOURCE.getLogger();
- private static final Joiner SLASH_JOINER = Joiner.on('/').skipNulls();
+ private static final FastJoiner SLASH_JOINER = FastJoiner.on('/');
private static final Splitter COMA_SPLITTER =
Splitter.on(',').omitEmptyStrings().trimResults();
Modified: trunk/core/impl/src/main/java/org/richfaces/util/Util.java
===================================================================
--- trunk/core/impl/src/main/java/org/richfaces/util/Util.java 2011-01-18 19:20:56 UTC
(rev 21064)
+++ trunk/core/impl/src/main/java/org/richfaces/util/Util.java 2011-01-19 00:38:15 UTC
(rev 21065)
@@ -86,7 +86,6 @@
import org.richfaces.log.RichfacesLogger;
import org.richfaces.resource.StateHolderResource;
-import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
import com.google.common.base.Strings;
@@ -116,7 +115,7 @@
public static final char SEPARATOR_CHAR =
UINamingContainer.getSeparatorChar(FacesContext.getCurrentInstance());
- public static final Joiner SEPARATOR_CHAR_JOINER =
Joiner.on(SEPARATOR_CHAR).skipNulls();
+ public static final FastJoiner SEPARATOR_CHAR_JOINER =
FastJoiner.on(SEPARATOR_CHAR);
public static final Splitter SEPARATOR_CHAR_SPLITTER =
Splitter.on(SEPARATOR_CHAR);
Modified: trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeBean.java
===================================================================
---
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeBean.java 2011-01-18
19:20:56 UTC (rev 21064)
+++
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeBean.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -71,7 +71,7 @@
public void processSelectionChange(TreeSelectionChangeEvent event) throws
AbortProcessingException {
FacesContext facesContext = FacesContext.getCurrentInstance();
- facesContext.addMessage(getTree(event).getBaseClientId(facesContext),
createEventMessage(event, fromExpression));
+ facesContext.addMessage(getTree(event).getClientId(facesContext),
createEventMessage(event, fromExpression));
}
}
@@ -90,7 +90,7 @@
public void processToggle(TreeToggleEvent event) throws AbortProcessingException
{
FacesContext facesContext = FacesContext.getCurrentInstance();
- facesContext.addMessage(getTree(event).getBaseClientId(facesContext),
createEventMessage(event, fromExpression));
+ facesContext.addMessage(getTree(event).getClientId(facesContext),
createEventMessage(event, fromExpression));
}
}
Modified:
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeNodeParser.java
===================================================================
---
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeNodeParser.java 2011-01-18
19:20:56 UTC (rev 21064)
+++
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeNodeParser.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -30,6 +30,7 @@
import javax.swing.tree.TreeNode;
import org.richfaces.model.SwingTreeNodeImpl;
+import org.richfaces.util.FastJoiner;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.InputSource;
@@ -38,7 +39,6 @@
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;
-import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
import com.google.common.io.Closeables;
@@ -48,7 +48,7 @@
*/
public class TreeNodeParser implements ContentHandler {
- private static final Joiner JOINER = Joiner.on("").skipNulls();
+ private static final FastJoiner JOINER = FastJoiner.on("");
private XMLReader reader;
Modified:
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/components/sh/SyntaxHighlighter.java
===================================================================
---
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/components/sh/SyntaxHighlighter.java 2011-01-18
19:20:56 UTC (rev 21064)
+++
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/components/sh/SyntaxHighlighter.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -78,7 +78,7 @@
public void encodeEnd(FacesContext context) throws IOException {
ResponseWriter writer = context.getResponseWriter();
writer.startElement("div", null);
- writer.writeAttribute("id", this.getClientId(), null);
+ writer.writeAttribute("id", this.getClientId(context), null);
writer.writeAttribute("class", this.getStyleClass(), null);
writer.writeAttribute("style", this.getStyle(), null);
writer.startElement("pre", null);
Modified: trunk/ui/common/ui/src/main/java/org/richfaces/component/UIDataAdaptor.java
===================================================================
--- trunk/ui/common/ui/src/main/java/org/richfaces/component/UIDataAdaptor.java 2011-01-18
19:20:56 UTC (rev 21064)
+++ trunk/ui/common/ui/src/main/java/org/richfaces/component/UIDataAdaptor.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -22,6 +22,8 @@
package org.richfaces.component;
+import static
org.richfaces.component.util.Strings.NamingContainerDataHolder.SEPARATOR_CHAR_JOINER;
+
import java.io.IOException;
import java.io.Serializable;
import java.text.MessageFormat;
@@ -61,7 +63,6 @@
import javax.faces.event.PostValidateEvent;
import javax.faces.event.PreRenderComponentEvent;
import javax.faces.event.PreValidateEvent;
-import javax.faces.render.Renderer;
import org.ajax4jsf.component.IterationStateHolder;
import org.ajax4jsf.model.DataComponentState;
@@ -236,7 +237,7 @@
private Object rowKey = null;
- private String clientId;
+ private String containerClientId;
private Object originalVarValue;
@@ -374,7 +375,7 @@
getExtendedDataModel().setRowKey(rowKey);
- this.clientId = null;
+ this.containerClientId = null;
boolean rowSelected = (rowKey != null) && isRowAvailable();
@@ -739,62 +740,47 @@
return Boolean.TRUE.equals(value);
}
+ private String getRowKeyAsString(FacesContext facesContext, Object rowKey) {
+ assert rowKey != null;
+
+ Converter rowKeyConverter = getRowKeyConverter();
+ if (rowKeyConverter == null) {
+ // Create default converter for a row key.
+ rowKeyConverter =
facesContext.getApplication().createConverter(rowKey.getClass());
+
+ // Store converter for a invokeOnComponents call.
+ if (rowKeyConverter != null) {
+ // TODO - review
+ setRowKeyConverter(rowKeyConverter);
+ }
+ }
+
+ if (rowKeyConverter != null) {
+ return rowKeyConverter.getAsString(facesContext, this, rowKey);
+ } else {
+ return rowKey.toString();
+ }
+ }
+
@Override
- public String getClientId(FacesContext facesContext) {
+ public String getContainerClientId(FacesContext facesContext) {
if (facesContext == null) {
throw new NullPointerException("context");
}
- if (null == clientId) {
- StringBuilder id = new StringBuilder(super.getClientId(facesContext));
+ if (null == containerClientId) {
+ containerClientId = super.getContainerClientId(facesContext);
+
Object rowKey = getRowKey();
-
+
if (rowKey != null) {
-
- // Use converter to get String representation ot the row key.
- Converter rowKeyConverter = getRowKeyConverter();
-
- if (null == rowKeyConverter) {
-
- // Create default converter for a row key.
- rowKeyConverter =
facesContext.getApplication().createConverter(rowKey.getClass());
-
- // Store converter for a invokeOnComponents call.
- if (null != rowKeyConverter) {
- // TODO - review
- setRowKeyConverter(rowKeyConverter);
- }
- }
-
- String rowKeyString;
-
- if (null != rowKeyConverter) {
-
- // Temporary set clientId, to avoid infinite calls from converter.
- clientId = id.toString();
- rowKeyString = rowKeyConverter.getAsString(facesContext, this,
rowKey);
- } else {
- rowKeyString = rowKey.toString();
- }
-
-
id.append(UINamingContainer.getSeparatorChar(facesContext)).append(rowKeyString);
- }
-
- Renderer renderer = getRenderer(facesContext);
-
- if (null != renderer) {
- clientId = renderer.convertClientId(facesContext, id.toString());
- } else {
- clientId = id.toString();
- }
+ String rowKeyString = getRowKeyAsString(facesContext, rowKey);
+ containerClientId = SEPARATOR_CHAR_JOINER.join(containerClientId,
rowKeyString);
+ }
}
- return clientId;
+ return containerClientId;
}
-
- public String getBaseClientId(FacesContext context) {
- return super.getClientId(context);
- }
/**
* Save current state of data variable.
@@ -968,7 +954,7 @@
@Override
public void setId(String id) {
super.setId(id);
- this.clientId = null;
+ this.containerClientId = null;
}
/*
Modified: trunk/ui/common/ui/src/main/java/org/richfaces/component/util/Strings.java
===================================================================
--- trunk/ui/common/ui/src/main/java/org/richfaces/component/util/Strings.java 2011-01-18
19:20:56 UTC (rev 21064)
+++ trunk/ui/common/ui/src/main/java/org/richfaces/component/util/Strings.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -25,7 +25,13 @@
import java.util.NoSuchElementException;
+import javax.faces.component.UINamingContainer;
+import javax.faces.context.FacesContext;
+
+import org.richfaces.util.FastJoiner;
+
import com.google.common.base.Joiner;
+import com.google.common.base.Splitter;
/**
@@ -37,6 +43,18 @@
public static final Joiner DOT_JOINER = Joiner.on('.');
+ public static final class NamingContainerDataHolder {
+
+ public static final char SEPARATOR_CHAR =
UINamingContainer.getSeparatorChar(FacesContext.getCurrentInstance());
+
+ public static final FastJoiner SEPARATOR_CHAR_JOINER =
FastJoiner.on(SEPARATOR_CHAR);
+
+ public static final Splitter SEPARATOR_CHAR_SPLITTER =
Splitter.on(SEPARATOR_CHAR);
+
+ private NamingContainerDataHolder() {}
+
+ }
+
private Strings() {
// this is utility class with static methods only.
Modified: trunk/ui/common/ui/src/main/java/org/richfaces/renderkit/RendererBase.java
===================================================================
--- trunk/ui/common/ui/src/main/java/org/richfaces/renderkit/RendererBase.java 2011-01-18
19:20:56 UTC (rev 21064)
+++ trunk/ui/common/ui/src/main/java/org/richfaces/renderkit/RendererBase.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -280,11 +280,11 @@
}
}
- public static String concatClasses(Object... objects) {
+ public String concatClasses(Object... objects) {
return HtmlUtil.concatClasses(objects);
}
- public static String concatStyles(Object... objects) {
+ public String concatStyles(Object... objects) {
return HtmlUtil.concatStyles(objects);
}
}
Modified: trunk/ui/iteration/api/src/main/java/org/richfaces/component/Row.java
===================================================================
--- trunk/ui/iteration/api/src/main/java/org/richfaces/component/Row.java 2011-01-18
19:20:56 UTC (rev 21064)
+++ trunk/ui/iteration/api/src/main/java/org/richfaces/component/Row.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -22,12 +22,13 @@
package org.richfaces.component;
-import org.ajax4jsf.model.DataVisitor;
+import java.util.Iterator;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
-import java.util.Iterator;
+import org.ajax4jsf.model.DataVisitor;
+
/**
* Marker interface for table columns, rendered as entire row.
*
@@ -42,8 +43,6 @@
public void setRowKey(FacesContext context, Object rowKey);
- public String getClientId(FacesContext context);
-
public void walk(FacesContext context, DataVisitor visitor, Object argument);
}
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/convert/DeclarativeModelKeyConverter.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/convert/DeclarativeModelKeyConverter.java 2011-01-18
19:20:56 UTC (rev 21064)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/convert/DeclarativeModelKeyConverter.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -21,21 +21,20 @@
*/
package org.richfaces.convert;
+import static
org.richfaces.component.util.Strings.NamingContainerDataHolder.SEPARATOR_CHAR_JOINER;
+import static
org.richfaces.component.util.Strings.NamingContainerDataHolder.SEPARATOR_CHAR_SPLITTER;
import static org.richfaces.convert.TreeConverterUtil.escape;
import static org.richfaces.convert.TreeConverterUtil.unescape;
import java.util.Iterator;
import javax.faces.component.UIComponent;
-import javax.faces.component.UINamingContainer;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.ConverterException;
import org.richfaces.model.DeclarativeModelKey;
-import com.google.common.base.Joiner;
-import com.google.common.base.Splitter;
import com.google.common.base.Strings;
/**
@@ -44,22 +43,6 @@
*/
public class DeclarativeModelKeyConverter implements Converter {
- private static final class StaticHolder {
-
- static final Joiner JOINER;
-
- static final Splitter SPLITTER;
-
- static {
- char separatorChar =
UINamingContainer.getSeparatorChar(FacesContext.getCurrentInstance());
- JOINER = Joiner.on(separatorChar);
- SPLITTER = Splitter.on(separatorChar);
- }
-
- private StaticHolder() {}
-
- }
-
private Converter delegateConverter;
public DeclarativeModelKeyConverter(Converter delegateConverter) {
@@ -74,7 +57,7 @@
String s = unescape(value);
- Iterator<String> split = StaticHolder.SPLITTER.split(s).iterator();
+ Iterator<String> split = SEPARATOR_CHAR_SPLITTER.split(s).iterator();
String modelId = (String) split.next();
Object modelKey = delegateConverter.getAsObject(context, component,
split.next());
@@ -94,7 +77,7 @@
DeclarativeModelKey declarativeModelKey = (DeclarativeModelKey) value;
String convertedModelKey = delegateConverter.getAsString(context, component,
declarativeModelKey.getModelKey());
- String keyString = StaticHolder.JOINER.join(declarativeModelKey.getModelId(),
convertedModelKey);
+ String keyString = SEPARATOR_CHAR_JOINER.join(declarativeModelKey.getModelId(),
convertedModelKey);
return escape(keyString);
}
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableBaseRenderer.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableBaseRenderer.java 2011-01-18
19:20:56 UTC (rev 21064)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableBaseRenderer.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -42,8 +42,6 @@
public static final String ROW_CLASS_KEY = "rowClass";
- public static final String CELL_ELEMENT_KEY = "cellElement";
-
public static final String BREAK_ROW_BEFORE = "breakRowBefore";
public static final String COLUMN_CLASS = "userColumnClass";
@@ -91,8 +89,7 @@
}
public void encodeColumnStart(ResponseWriter writer, FacesContext context, String
parentId, UIComponent component) throws IOException {
- String element = getCellElement(context, parentId);
- writer.startElement(element, component);
+ writer.startElement(HtmlConstants.TD_ELEM, component);
getUtils().encodeId(context, component);
String cellClass = getCellClass(context, parentId);
cellClass = concatClasses(cellClass,
component.getAttributes().get(COLUMN_CLASS));
@@ -114,7 +111,7 @@
}
public void encodeColumnEnd(ResponseWriter writer, FacesContext context, String
parentId) throws IOException {
- writer.endElement(getCellElement(context, parentId));
+ writer.endElement(HtmlConstants.TD_ELEM);
}
public void encodeFirstRowStart(ResponseWriter writer, FacesContext context, String
parentId, int currentRow, UIComponent component) throws IOException {
@@ -149,8 +146,8 @@
return get(context, id + CELL_CLASS_KEY);
}
- protected String getCellElement(FacesContext context, String id) {
- return get(context, id + CELL_ELEMENT_KEY);
+ protected String getFacetElement(FacesContext context, String id, String facetName)
{
+ return HtmlConstants.TD_ELEM;
}
protected void saveRowStyles(FacesContext context, String id, String firstRowClass,
String rowClass, String cellClass) {
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2011-01-18
19:20:56 UTC (rev 21064)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -133,9 +133,7 @@
encodeTableStructure(writer, context, dataTable);
- setupTableStartElement(context, dataTable);
encodeHeaderFacet(writer, context, dataTable, false);
- setupTableStartElement(context, dataTable, HtmlConstants.TD_ELEM);
encodeFooterFacet(writer, context, dataTable, false);
dataTable.setRowKey(context, key);
dataTable.restoreOrigValue(context);
@@ -146,8 +144,6 @@
int rowCount = dataTableBase.getRowCount();
- put(facesContext, dataTableBase.getClientId(facesContext) + CELL_ELEMENT_KEY,
HtmlConstants.TD_ELEM);
-
Object key = dataTableBase.getRowKey();
dataTableBase.captureOrigValue(facesContext);
dataTableBase.setRowKey(facesContext, null);
@@ -212,7 +208,7 @@
public void encodeTableStart(ResponseWriter writer, FacesContext context,
UIDataTableBase component) throws IOException {
writer.startElement(HtmlConstants.TABLE_ELEMENT, component);
- writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, component.getClientId(),
null);
+ writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, component.getClientId(context),
null);
String styleClass = getTableSkinClass();
encodeStyleClass(writer, context, component, HtmlConstants.STYLE_CLASS_ATTR,
styleClass);
}
@@ -241,7 +237,7 @@
throws IOException {
writer.startElement(HtmlConstants.TBODY_ELEMENT, dataTableBase);
- String clientId = (dataTableBase.getRelativeRowIndex() < 0) ?
dataTableBase.getClientId(facesContext) :
dataTableBase.getRelativeClientId(facesContext);
+ String clientId = (dataTableBase.getRelativeRowIndex() < 0) ?
dataTableBase.getContainerClientId(facesContext) :
dataTableBase.getRelativeClientId(facesContext);
writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, clientId + ":tb",
null);
writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, getTableBodySkinClass(),
null);
@@ -261,9 +257,10 @@
if ((footer != null && footer.isRendered()) || columnFacetPresent) {
boolean partialUpdateEncoded = false;
+ String clientId = dataTable.getClientId(facesContext);
boolean encodeTfoot = containsThead();
if (encodeTfoot) {
- String footerClientId = dataTable.getClientId(facesContext) +
":tf";
+ String footerClientId = clientId + ":tf";
if (encodePartialUpdate) {
partialUpdateEncoded = true;
@@ -276,7 +273,6 @@
}
int columns = getColumnsCount(dataTable);
- String id = dataTable.getClientId(facesContext);
boolean encodePartialUpdateForChildren = (encodePartialUpdate &&
!partialUpdateEncoded);
@@ -291,9 +287,9 @@
cellClass = mergeStyleClasses("columnFooterCellClass",
cellClass, dataTable);
firstClass = mergeStyleClasses("firstColumnFooterClass",
firstClass, dataTable);
- saveRowStyles(facesContext,id, firstClass, rowClass, cellClass);
+ saveRowStyles(facesContext, clientId, firstClass, rowClass, cellClass);
- String targetId = id + ":cf";
+ String targetId = clientId + ":cf";
if (encodePartialUpdateForChildren) {
partialStart(facesContext, targetId);
@@ -321,8 +317,8 @@
cellClass = mergeStyleClasses("footerCellClass", cellClass,
dataTable);
firstClass = mergeStyleClasses("footerFirstClass", firstClass,
dataTable);
// TODO nick - rename method "encodeTableHeaderFacet"
- saveRowStyles(facesContext, id, firstClass, rowClass, cellClass);
- encodeTableFacet(facesContext, writer, id, columns, footer,
UIDataTableBase.FOOTER, rowClass, cellClass,
+ saveRowStyles(facesContext, clientId, firstClass, rowClass, cellClass);
+ encodeTableFacet(facesContext, writer, clientId, columns, footer,
UIDataTableBase.FOOTER, rowClass, cellClass,
encodePartialUpdateForChildren);
}
@@ -359,8 +355,9 @@
if ((header != null && header.isRendered()) || isEncodeHeaders) {
boolean partialUpdateEncoded = false;
+ String clientId = dataTable.getClientId(facesContext);
if (encodeThead) {
- String headerClientId = dataTable.getClientId(facesContext) +
":th";
+ String headerClientId = clientId + ":th";
if (encodePartialUpdate) {
partialUpdateEncoded = true;
@@ -373,7 +370,6 @@
}
int columns = getColumnsCount(dataTable);
- String id = dataTable.getClientId(facesContext);
boolean encodePartialUpdateForChildren = (encodePartialUpdate &&
!partialUpdateEncoded);
@@ -386,9 +382,9 @@
rowClass = mergeStyleClasses("headerClass", rowClass,
dataTable);
cellClass = mergeStyleClasses("headerCellClass", cellClass,
dataTable);
firstClass = mergeStyleClasses("headerFirstClass", firstClass,
dataTable);
- saveRowStyles(facesContext, id, firstClass, rowClass, cellClass);
+ saveRowStyles(facesContext, clientId, firstClass, rowClass, cellClass);
- encodeTableFacet(facesContext, writer, id, columns, header,
UIDataTableBase.HEADER, rowClass, cellClass,
+ encodeTableFacet(facesContext, writer, clientId, columns, header,
UIDataTableBase.HEADER, rowClass, cellClass,
encodePartialUpdateForChildren);
}
@@ -401,9 +397,9 @@
rowClass = mergeStyleClasses("columnHeaderClass", rowClass,
dataTable);
cellClass = mergeStyleClasses("columnHeaderCellClass",
cellClass, dataTable);
firstClass = mergeStyleClasses("columnHeaderFirstClass",
firstClass, dataTable);
- saveRowStyles(facesContext, id, firstClass, rowClass, cellClass);
+ saveRowStyles(facesContext, clientId, firstClass, rowClass, cellClass);
- String targetId = id + ":ch";
+ String targetId = clientId + ":ch";
if (encodePartialUpdateForChildren) {
partialStart(facesContext, targetId);
@@ -436,7 +432,7 @@
protected void encodeColumnFacet(FacesContext context, ResponseWriter writer,
UIDataTableBase dataTableBase, String facetName, int colCount, String cellClass) throws
IOException {
int tColCount = 0;
String id = dataTableBase.getClientId(context);
- String element = getCellElement(context, id);
+ String element = getFacetElement(context, id, facetName);
Iterator<UIComponent> headers = dataTableBase.columns();
@@ -484,7 +480,7 @@
UIComponent footer, String facetName, String rowClass, String cellClass, boolean
encodePartialUpdate) throws IOException {
boolean isColumnGroup = (footer instanceof Row);
- String element = getCellElement(facesContext, id);
+ String element = getFacetElement(facesContext, id, facetName);
boolean partialUpdateEncoded = false;
@@ -574,12 +570,6 @@
public abstract String getNoDataCellClass();
- protected abstract void setupTableStartElement(FacesContext context, UIComponent
component);
-
- protected void setupTableStartElement(FacesContext context, UIComponent component,
String elementName) {
- put(context, component.getClientId(context) + CELL_ELEMENT_KEY, elementName);
- }
-
public void encodeMetaComponent(FacesContext context, UIComponent component, String
metaComponentId)
throws IOException {
@@ -587,13 +577,10 @@
if (UIDataTableBase.HEADER.equals(metaComponentId)) {
- setupTableStartElement(context, component);
encodeHeaderFacet(context.getResponseWriter(), context, table, true);
} else if (UIDataTableBase.FOOTER.equals(metaComponentId)) {
- setupTableStartElement(context, component, HtmlConstants.TD_ELEM);
encodeFooterFacet(context.getResponseWriter(), context, table, true);
} else if(UIDataTableBase.BODY.equals(metaComponentId)) {
- setupTableStartElement(context, component, HtmlConstants.TD_ELEM);
encodeTableRows(context.getResponseWriter(), context, table, true);
} else {
throw new IllegalArgumentException("Unsupported metaComponentIdentifier:
" + metaComponentId);
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/CollapsibleSubTableRenderer.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/CollapsibleSubTableRenderer.java 2011-01-18
19:20:56 UTC (rev 21064)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/CollapsibleSubTableRenderer.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -38,8 +38,8 @@
import org.ajax4jsf.javascript.JSFunction;
import org.richfaces.cdk.annotations.JsfRenderer;
-import org.richfaces.component.AbstractDataTable;
import org.richfaces.component.AbstractCollapsibleSubTable;
+import org.richfaces.component.AbstractDataTable;
import org.richfaces.component.Row;
import org.richfaces.component.UIDataTableBase;
import org.richfaces.event.ToggleEvent;
@@ -72,7 +72,7 @@
public void begin(ResponseWriter writer, FacesContext context, UIComponent
component, Object[] params) throws IOException {
AbstractCollapsibleSubTable subTable =
(AbstractCollapsibleSubTable)component;
writer.startElement(HtmlConstants.TR_ELEMENT, subTable);
- writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE,
subTable.getClientId(context) + HIDDEN_CONTAINER_ID, null);
+ writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE,
subTable.getContainerClientId(context) + HIDDEN_CONTAINER_ID, null);
writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, DISPLAY_NONE, null);
writer.startElement(HtmlConstants.TD_ELEM, subTable);
}
@@ -146,7 +146,7 @@
cellClass = mergeStyleClasses("cellClass", cellClass, subTable);
firstClass = mergeStyleClasses("firstRowClass", firstClass, subTable);
- saveRowStyles(context, subTable.getClientId(context), firstClass, rowClass,
cellClass);
+ saveRowStyles(context, subTable.getContainerClientId(context), firstClass,
rowClass, cellClass);
}
@Override
@@ -169,14 +169,13 @@
AbstractCollapsibleSubTable subTable =
(AbstractCollapsibleSubTable)dataTableBase;
encodeTableBodyStart(writer, facesContext, subTable);
encodeSubTableDomElement(writer, facesContext, subTable);
- setupTableStartElement(facesContext, subTable);
encodeHeaderFacet(writer, facesContext, subTable, false);
}
private void encodeSubTableDomElement(ResponseWriter writer, FacesContext
facesContext, AbstractCollapsibleSubTable subTable) throws IOException{
writer.startElement(HtmlConstants.TR_ELEMENT, subTable);
writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, DISPLAY_NONE, null);
- writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE,
subTable.getClientId(facesContext), null);
+ writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE,
subTable.getContainerClientId(facesContext), null);
writer.startElement(HtmlConstants.TD_ELEM, subTable);
writer.endElement(HtmlConstants.TD_ELEM);
writer.endElement(HtmlConstants.TR_ELEMENT);
@@ -387,7 +386,6 @@
public void encodeMetaComponent(FacesContext facesContext, UIComponent component,
String metaComponentId)
throws IOException {
AbstractCollapsibleSubTable subTable = (AbstractCollapsibleSubTable)component;
- setupTableStartElement(facesContext, subTable);
if(AbstractCollapsibleSubTable.BODY.equals(metaComponentId)) {
ResponseWriter writer = facesContext.getResponseWriter();
@@ -406,10 +404,6 @@
return new CollapsibleSubTableHiddenEncodeStrategy();
}
- protected void setupTableStartElement(FacesContext context, UIComponent component) {
- setupTableStartElement(context, component, HtmlConstants.TD_ELEM);
- }
-
protected UIDataTableBase findParent(AbstractCollapsibleSubTable subTable) {
UIComponent parent = subTable.getParent();
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/CollapsibleSubTableTogglerRendererBase.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/CollapsibleSubTableTogglerRendererBase.java 2011-01-18
19:20:56 UTC (rev 21064)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/CollapsibleSubTableTogglerRendererBase.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -71,6 +71,7 @@
@Override
protected void doDecode(FacesContext context, UIComponent component) {
+ //TODO - review
context.getPartialViewContext().getRenderIds().add(component.getClientId(context));
}
@@ -109,7 +110,7 @@
writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, DISPLAY_NONE, null);
}
- writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, control.getClientId() +
":" + state, null);
+ writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, control.getClientId(context) +
":" + state, null);
writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, styleClass, null);
writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, style, null);
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ColumnGroupRenderer.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ColumnGroupRenderer.java 2011-01-18
19:20:56 UTC (rev 21064)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ColumnGroupRenderer.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -73,7 +73,7 @@
}
RowHolder rowHolder = new RowHolder(context, (AbstractColumnGroup)component);
- rowHolder.setParentClientId(parent.getClientId());
+ rowHolder.setParentClientId(parent.getClientId(context));
return rowHolder;
}
}
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java 2011-01-18
19:20:56 UTC (rev 21064)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -36,8 +36,8 @@
import org.ajax4jsf.javascript.JSFunction;
import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.component.AbstractCollapsibleSubTable;
import org.richfaces.component.AbstractDataTable;
-import org.richfaces.component.AbstractCollapsibleSubTable;
import org.richfaces.component.Row;
import org.richfaces.component.UIDataTableBase;
import org.richfaces.component.util.HtmlUtil;
@@ -60,7 +60,7 @@
AbstractDataTable dataTable = (AbstractDataTable)component;
writer.startElement(HtmlConstants.TBODY_ELEMENT, dataTable);
- writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE,
dataTable.getClientId(context) + HIDDEN_CONTAINER_ID, null);
+ writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE,
dataTable.getContainerClientId(context) + HIDDEN_CONTAINER_ID, null);
writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, "display:
none", null);
writer.startElement(HtmlConstants.TR_ELEMENT, dataTable);
writer.startElement(HtmlConstants.TD_ELEM, dataTable);
@@ -124,7 +124,7 @@
public void encodeBeforeRows(ResponseWriter writer, FacesContext
facesContext,UIDataTableBase dataTableBase, boolean encodeParentTBody, boolean
partialUpdate) throws IOException {
if(encodeParentTBody) {
if(partialUpdate) {
- partialStart(facesContext, dataTableBase.getClientId(facesContext)
+":tb");
+ partialStart(facesContext,
dataTableBase.getContainerClientId(facesContext) +":tb");
}
encodeTableBodyStart(writer, facesContext, dataTableBase);
}
@@ -394,8 +394,9 @@
return "rf-dt-b";
}
- protected void setupTableStartElement(FacesContext context, UIComponent component) {
- setupTableStartElement(context, component, HtmlConstants.TH_ELEM);
+ @Override
+ protected String getFacetElement(FacesContext context, String id, String facetName)
{
+ return facetName.equals(UIDataTableBase.HEADER) ? HtmlConstants.TH_ELEM :
HtmlConstants.TD_ELEM;
}
public EncodeStrategy getHiddenContainerStrategy(UIDataTableBase dataTableBase) {
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2011-01-18
19:20:56 UTC (rev 21064)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -304,6 +304,7 @@
writer.writeAttribute(HtmlConstants.CELLSPACING_ATTRIBUTE, "0",
null);
writer.startElement(HtmlConstants.TBODY_ELEMENT, table);
writer.startElement(HtmlConstants.TR_ELEMENT, table);
+ String clientId = table.getClientId(context);
for (state.startIterate(); state.hasNextPart();) {
Part part = state.nextPart();
PartName partName = part.getName();
@@ -317,15 +318,15 @@
if (PartName.frozen.equals(partName)) {
if ("header".equals(name)) {
writer
- .writeAttribute(HtmlConstants.ID_ATTRIBUTE,
table.getClientId(context) + ":frozenHeader", null);
+ .writeAttribute(HtmlConstants.ID_ATTRIBUTE, clientId +
":frozenHeader", null);
}
} else {
- writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE,
table.getClientId(context) + ":" + name, null);
+ writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, clientId +
":" + name, null);
writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE,
"rf-edt-cnt"
+ ("footer".equals(name) ? "
rf-edt-ftr-cnt" : ""), null);
}
- String tableId = table.getClientId(context) + ":cf" +
name.charAt(0) + partName.getId();
+ String tableId = clientId + ":cf" + name.charAt(0) +
partName.getId();
EncoderVariance encoderVariance = state.getEncoderVariance();
encoderVariance.encodeStartUpdate(context, tableId);
@@ -387,7 +388,8 @@
FacesContext context = state.getContext();
ResponseWriter writer = context.getResponseWriter();
UIDataTableBase table = state.getRow();
- String tableBodyId = table.getClientId(context) + ":b";
+ String clientId = table.getClientId(context);
+ String tableBodyId = clientId + ":b";
EncoderVariance encoderVariance = state.getEncoderVariance();
encoderVariance.encodeStartUpdate(context, tableBodyId);
writer.startElement(HtmlConstants.DIV_ELEM, table);
@@ -419,16 +421,16 @@
writer.startElement(HtmlConstants.DIV_ELEM, table);
PartName partName = state.nextPart().getName();
if (PartName.normal.equals(partName)) {
- writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE,
table.getClientId(context) + ":body", null);
+ writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, clientId +
":body", null);
writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE,
"rf-edt-cnt", null);
}
- String targetId = table.getClientId(context) + ":tbt" +
partName.getId();
+ String targetId = clientId + ":tbt" + partName.getId();
writer.startElement(HtmlConstants.TABLE_ELEMENT, table);
writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, targetId, null);
writer.writeAttribute(HtmlConstants.CELLPADDING_ATTRIBUTE, "0",
null);
writer.writeAttribute(HtmlConstants.CELLSPACING_ATTRIBUTE, "0",
null);
writer.startElement(HtmlConstants.TBODY_ELEMENT, table);
- writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE,
table.getClientId(context) + ":tb"
+ writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, clientId +
":tb"
+ partName.getId(), null);
encodeRows(context, state);
writer.endElement(HtmlConstants.TBODY_ELEMENT);
@@ -508,6 +510,7 @@
table.captureOrigValue(context);
table.setRowKey(context, null);
final RendererState state = createRowHolder(context, table, null);
+ String clientId = table.getClientId(context);
// TODO 1. Encode fixed children
for (state.startIterate(); state.hasNextPart();) {
String partId = state.nextPart().getName().getId();
@@ -516,7 +519,7 @@
public DataVisitResult process(FacesContext context, Object
rowKey, Object argument) {
UIDataTableBase dataTable = state.getRow();
dataTable.setRowKey(context, rowKey);
- ids.add(dataTable.getClientId(context) + ":"
+ ids.add(dataTable.getContainerClientId(context) +
":"
+ state.getPart().getName().getId());
return DataVisitResult.CONTINUE;
}
@@ -526,7 +529,7 @@
UIDataTableBase dataTable = state.getRow();
dataTable.setRowKey(context, rowKey);
HashMap<String, String> attributes = new
HashMap<String, String>(1);
- String id = dataTable.getClientId(context) + ":"
+ String id = dataTable.getContainerClientId(context) +
":"
+ state.getPart().getName().getId();
attributes.put("id", id);
try {
@@ -546,18 +549,18 @@
}
//TODO nick - move this to external JavaScript file
- writer.write("var richTBody =
document.getElementById('" + component.getClientId(context) + ":tb"
+ writer.write("var richTBody =
document.getElementById('" + clientId + ":tb"
+ partId + "');");
writer.write("var richRows = richTBody.rows;");
writer.write("for (var i = 0; i < " + difference
+ "; i++ )
richTBody.appendChild(richTBody.removeChild(richRows[0]));");
writer.endEval();
}
- writer.startUpdate(component.getClientId(context) + ":si");
+ writer.startUpdate(clientId + ":si");
encodeSelectionInput(writer, context, component);
writer.endUpdate();
writer.startEval();
- writer.write("jQuery('#" +
component.getClientId(context).replace(":", "\\\\:")
+ writer.write("jQuery('#" +
ScriptUtils.escapeCSSMetachars(clientId)
+ "').triggerHandler('rich:onajaxcomplete', {first:
" + table.getClientFirst() + "});");
writer.endEval();
table.setRowKey(context, key);
@@ -579,18 +582,19 @@
if (UIDataTableBase.HEADER.equals(metaComponentId)) {
encodeHeader(state);
writer.startEval();
- writer.write("jQuery('#" +
component.getClientId(context).replace(":", "\\\\:")
+ writer.write("jQuery('#" +
ScriptUtils.escapeCSSMetachars(table.getClientId(context))
+ "').triggerHandler('rich:onajaxcomplete',
{reinitializeHeader: true});");
writer.endEval();
} else if (UIDataTableBase.FOOTER.equals(metaComponentId)) {
encodeFooter(state);
} else if (UIDataTableBase.BODY.equals(metaComponentId)) {
encodeBody(state);
- writer.startUpdate(component.getClientId(context) +
":si");
+ String clientId = table.getClientId(context);
+ writer.startUpdate(clientId + ":si");
encodeSelectionInput(writer, context, component);
writer.endUpdate();
writer.startEval();
- writer.write("jQuery('#" +
component.getClientId(context).replace(":", "\\\\:")
+ writer.write("jQuery('#" +
ScriptUtils.escapeCSSMetachars(clientId)
+ "').triggerHandler('rich:onajaxcomplete',
{first: " + table.getClientFirst() + ", rowCount: "
+ getRowCount(component) + ", reinitializeBody:
true});");
writer.endEval();
@@ -640,7 +644,8 @@
protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent
component)
throws IOException {
writer.startElement(HtmlConstants.TABLE_ELEMENT, component);
- writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, component.getClientId(context)
+ ":r", null);
+ String clientId = component.getClientId(context);
+ writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, clientId + ":r",
null);
writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, "rf-edt-rord",
null);
writer.writeAttribute(HtmlConstants.CELLPADDING_ATTRIBUTE, "0", null);
writer.writeAttribute(HtmlConstants.CELLSPACING_ATTRIBUTE, "0", null);
@@ -658,16 +663,16 @@
}
writer.endElement(HtmlConstants.TABLE_ELEMENT);
writer.startElement(HtmlConstants.DIV_ELEM, component);
- writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, component.getClientId(context)
+ ":d", null);
+ writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, clientId + ":d",
null);
writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, "rf-edt-rsz-mkr",
null);
writer.endElement(HtmlConstants.DIV_ELEM);
writer.startElement(HtmlConstants.DIV_ELEM, component);
- writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, component.getClientId(context)
+ ":rm", null);
+ writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, clientId + ":rm",
null);
writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, "rf-edt-rord-mkr",
null);
writer.endElement(HtmlConstants.DIV_ELEM);
writer.startElement(HtmlConstants.INPUT_ELEM, component);
- writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, component.getClientId(context)
+ ":wi", null);
- writer.writeAttribute(HtmlConstants.NAME_ATTRIBUTE,
component.getClientId(context) + ":wi", null);
+ writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, clientId + ":wi",
null);
+ writer.writeAttribute(HtmlConstants.NAME_ATTRIBUTE, clientId + ":wi",
null);
writer.writeAttribute(HtmlConstants.TYPE_ATTR, HtmlConstants.INPUT_TYPE_HIDDEN,
null);
writer.endElement(HtmlConstants.INPUT_ELEM);
encodeSelectionInput(writer, context, component);
@@ -683,7 +688,7 @@
addToScriptHash(options, "onselectionchange",
RenderKitUtils.getAttributeAndBehaviorsValue(context,
component, EVENT_ATTRIBUTES.get("onselectionchange")), null,
ScriptHashVariableWrapper.eventHandler);
StringBuilder builder = new StringBuilder("new
RichFaces.ui.ExtendedDataTable('");
- builder.append(component.getClientId(context)).append("',
").append(getRowCount(component))
+ builder.append(clientId).append("',
").append(getRowCount(component))
.append(", function(event, clientParams)
{").append(ajaxFunction.toScript()).append(";}");
if (!options.isEmpty()) {
builder.append(",").append(ScriptUtils.toScript(options));
@@ -788,7 +793,7 @@
Iterator<UIComponent> columns = null;
Part part = state.getPart();
writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE,
- table.getClientId(facesContext) + ":" + part.getName().getId(),
null);
+ table.getContainerClientId(facesContext) + ":" +
part.getName().getId(), null);
columns = part.getColumns().iterator();
int columnNumber = 0;
while (columns.hasNext()) {
@@ -819,11 +824,12 @@
protected void doDecode(FacesContext context, UIComponent component) {
super.doDecode(context, component);
Map<String, String> map =
context.getExternalContext().getRequestParameterMap();
- updateWidthOfColumns(context, component, map.get(component.getClientId(context) +
":wi"));
- if (map.get(component.getClientId(context)) != null) {
+ String clientId = component.getClientId(context);
+ updateWidthOfColumns(context, component, map.get(clientId + ":wi"));
+ if (map.get(clientId) != null) {
updateColumnsOrder(context, component,
map.get("rich:columnsOrder"));
}
- if (map.get(component.getClientId(context)) != null) {
+ if (map.get(clientId) != null) {
updateClientFirst(context, component,
map.get("rich:clientFirst"));
}
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ListRendererBase.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ListRendererBase.java 2011-01-18
19:20:56 UTC (rev 21064)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ListRendererBase.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -96,7 +96,7 @@
writer.startElement(HtmlConstants.LI_ELEMENT, sequence);
if (rendererUtils.hasExplicitId(sequence)) {
- writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE,
sequence.getClientId(context), null);
+ writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE,
sequence.getContainerClientId(context), null);
}
writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE,
@@ -129,7 +129,7 @@
writer.startElement(HtmlConstants.DT_ELEMENT, sequence);
if (rendererUtils.hasExplicitId(sequence)) {
- writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE,
sequence.getClientId(context) + ".dt", null);
+ writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE,
sequence.getContainerClientId(context) + ".dt", null);
}
writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE,
@@ -142,7 +142,7 @@
writer.startElement(HtmlConstants.DD_ELEMENT, sequence);
if (rendererUtils.hasExplicitId(sequence)) {
- writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE,
sequence.getClientId(context), null);
+ writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE,
sequence.getContainerClientId(context), null);
}
writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE,
@@ -243,7 +243,7 @@
protected String getElementId(FacesContext facesContext, UIComponent component) {
if (rendererUtils.hasExplicitId(component)) {
- return component.getClientId(facesContext);
+ return component.getContainerClientId(facesContext);
}
return null;
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/RowHolder.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/RowHolder.java 2011-01-18
19:20:56 UTC (rev 21064)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/RowHolder.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -22,6 +22,7 @@
package org.richfaces.renderkit;
+import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import org.richfaces.component.Row;
@@ -49,7 +50,7 @@
public RowHolder(FacesContext context, Row row, int processCell, boolean isRowStart)
{
super(context);
this.row = row;
- this.parentClientId = row.getClientId(context);
+ this.parentClientId = ((UIComponent) row).getClientId(context);
}
public boolean isEncodeParentTBody() {
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeNodeRendererBase.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeNodeRendererBase.java 2011-01-18
19:20:56 UTC (rev 21064)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeNodeRendererBase.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -74,7 +74,7 @@
PartialViewContext pvc = context.getPartialViewContext();
if (pvc.isAjaxRequest() && map.get(component.getClientId(context) +
TRIGGER_NODE_AJAX_UPDATE) != null) {
- pvc.getRenderIds().add(treeNode.getClientId(context) +
MetaComponentResolver.META_COMPONENT_SEPARATOR_CHAR +
AbstractTreeNode.SUBTREE_META_COMPONENT_ID);
+ pvc.getRenderIds().add(component.getClientId(context) +
MetaComponentResolver.META_COMPONENT_SEPARATOR_CHAR +
AbstractTreeNode.SUBTREE_META_COMPONENT_ID);
context.getAttributes().put(AJAX_TOGGLED_NODE_ATTRIBUTE,
component.getClientId(context));
context.getAttributes().put(AJAX_TOGGLED_NODE_STATE_ATTRIBUTE,
initialState ? TreeNodeState.expanded : TreeNodeState.collapsed);
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeRenderingContext.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeRenderingContext.java 2011-01-18
19:20:56 UTC (rev 21064)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeRenderingContext.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -148,7 +148,7 @@
super();
this.context = context;
this.tree = tree;
- this.baseClientId = tree.getBaseClientId(context);
+ this.baseClientId = tree.getClientId(context);
}
public static TreeRenderingContext create(FacesContext context, AbstractTree tree) {
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 2011-01-18
19:20:56 UTC (rev 21064)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/component/behavior/ToggleControl.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -29,7 +29,10 @@
import javax.faces.context.FacesContext;
import org.ajax4jsf.component.behavior.ClientBehavior;
-import org.richfaces.cdk.annotations.*;
+import org.richfaces.cdk.annotations.JsfBehavior;
+import org.richfaces.cdk.annotations.JsfBehaviorRenderer;
+import org.richfaces.cdk.annotations.Tag;
+import org.richfaces.cdk.annotations.TagType;
import org.richfaces.component.AbstractTogglePanel;
import org.richfaces.renderkit.util.RendererUtils;
@@ -89,7 +92,7 @@
}
public String getPanelId(ClientBehaviorContext behaviorContext) throws FacesException
{
- return getPanel(behaviorContext.getComponent()).getClientId();
+ return
getPanel(behaviorContext.getComponent()).getClientId(behaviorContext.getFacesContext());
}
public AbstractTogglePanel getPanel(UIComponent comp) throws FacesException {
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemHeaderRenderer.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemHeaderRenderer.java 2011-01-18
19:20:56 UTC (rev 21064)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemHeaderRenderer.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -1,15 +1,18 @@
package org.richfaces.renderkit.html;
-import org.richfaces.component.AbstractAccordionItem;
-import org.richfaces.component.AbstractTogglePanelTitledItem;
-import org.richfaces.renderkit.RendererBase;
+import static org.richfaces.renderkit.HtmlConstants.CLASS_ATTRIBUTE;
+import static org.richfaces.renderkit.HtmlConstants.DIV_ELEM;
+import static org.richfaces.renderkit.HtmlConstants.TD_ELEM;
+import static org.richfaces.renderkit.html.DivPanelRenderer.attributeAsString;
+import java.io.IOException;
+
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import java.io.IOException;
-import static org.richfaces.renderkit.HtmlConstants.*;
-import static org.richfaces.renderkit.html.DivPanelRenderer.attributeAsString;
+import org.richfaces.component.AbstractAccordionItem;
+import org.richfaces.component.AbstractTogglePanelTitledItem;
+import org.richfaces.component.util.HtmlUtil;
class AccordionItemHeaderRenderer extends
TableIconsRendererHelper<AbstractAccordionItem> {
@@ -56,7 +59,7 @@
private static void encodeHeader(ResponseWriter writer, FacesContext context,
AbstractTogglePanelTitledItem component,
AbstractTogglePanelTitledItem.HeaderStates state)
throws IOException {
writer.startElement(DIV_ELEM, component);
- writer.writeAttribute(CLASS_ATTRIBUTE,
RendererBase.concatClasses("rf-ac-itm-lbl-" + state.abbreviation(),
attributeAsString(component, state.headerClass())), null);
+ writer.writeAttribute(CLASS_ATTRIBUTE,
HtmlUtil.concatClasses("rf-ac-itm-lbl-" + state.abbreviation(),
attributeAsString(component, state.headerClass())), null);
writeFacetOrAttr(writer, context, component, "header",
component.getHeaderFacet(state));
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 2011-01-18
19:20:56 UTC (rev 21064)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -22,22 +22,26 @@
package org.richfaces.renderkit.html;
-import org.ajax4jsf.javascript.JSObject;
-import org.richfaces.cdk.annotations.JsfRenderer;
-import org.richfaces.component.AbstractAccordionItem;
-import org.richfaces.component.AbstractTogglePanelTitledItem;
-import org.richfaces.renderkit.RenderKitUtils;
+import static org.richfaces.renderkit.HtmlConstants.CLASS_ATTRIBUTE;
+import static org.richfaces.renderkit.HtmlConstants.DIV_ELEM;
+import static org.richfaces.renderkit.HtmlConstants.ID_ATTRIBUTE;
+import static org.richfaces.renderkit.HtmlConstants.STYLE_ATTRIBUTE;
+import static org.richfaces.renderkit.RenderKitUtils.renderPassThroughAttributes;
+import java.io.IOException;
+import java.util.Map;
+
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import java.io.IOException;
-import java.util.Map;
-import static org.richfaces.renderkit.HtmlConstants.*;
-import static org.richfaces.renderkit.RenderKitUtils.renderPassThroughAttributes;
+import org.ajax4jsf.javascript.JSObject;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.component.AbstractAccordionItem;
+import org.richfaces.component.AbstractTogglePanelTitledItem;
+import org.richfaces.renderkit.RenderKitUtils;
/**
*
@@ -71,9 +75,9 @@
protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent
component) throws IOException {
super.doEncodeBegin(writer, context, component);
- encodeHeader(writer, context, (AbstractAccordionItem) component);
+ encodeHeader(context, (AbstractAccordionItem) component);
- encodeContentBegin(component, writer);
+ encodeContentBegin(context, component);
}
@Override
@@ -88,10 +92,11 @@
super.doEncodeEnd(writer, context, component);
}
- private void encodeContentBegin(UIComponent component, ResponseWriter writer) throws
IOException {
+ private void encodeContentBegin(FacesContext context, UIComponent component) throws
IOException {
+ ResponseWriter writer = context.getResponseWriter();
writer.startElement(DIV_ELEM, component);
writer.writeAttribute(CLASS_ATTRIBUTE, concatClasses("rf-ac-itm-cnt",
attributeAsString(component, "contentClass")), null);
- writer.writeAttribute("id", component.getClientId() +
":content", null);
+ writer.writeAttribute("id", component.getClientId(context) +
":content", null);
AbstractTogglePanelTitledItem item = (AbstractTogglePanelTitledItem) component;
if (!item.isActive() || item.isDisabled()) {
@@ -103,13 +108,14 @@
writer.endElement(DIV_ELEM);
}
- private void encodeHeader(ResponseWriter writer, FacesContext context,
AbstractAccordionItem component) throws IOException {
+ private void encodeHeader(FacesContext context, AbstractAccordionItem component)
throws IOException {
+ ResponseWriter writer = context.getResponseWriter();
writer.startElement(DIV_ELEM, component);
String stateCssClass = "rf-ac-itm-hdr-" + (component.isDisabled() ?
"dis" : (component.isActive() ? "act" : "inact"));
writer.writeAttribute(CLASS_ATTRIBUTE, concatClasses("rf-ac-itm-hdr",
stateCssClass, attributeAsString(component, "headerClass")), null);
- writer.writeAttribute(ID_ATTRIBUTE, component.getClientId() +
":header", null);
+ writer.writeAttribute(ID_ATTRIBUTE, component.getClientId(context) +
":header", null);
renderPassThroughAttributes(context, component, HEADER_ATTRIBUTES);
headerRenderer.encodeHeader(writer, context, component);
@@ -119,7 +125,7 @@
@Override
protected JSObject getScriptObject(FacesContext context, UIComponent component) {
- return new JSObject("RichFaces.ui.AccordionItem",
component.getClientId(),
+ return new JSObject("RichFaces.ui.AccordionItem",
component.getClientId(context),
getScriptObjectOptions(context, component));
}
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java 2011-01-18
19:20:56 UTC (rev 21064)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -22,17 +22,18 @@
package org.richfaces.renderkit.html;
-import org.ajax4jsf.javascript.JSObject;
-import org.richfaces.cdk.annotations.JsfRenderer;
-import org.richfaces.component.AbstractAccordion;
-import org.richfaces.component.util.HtmlUtil;
+import java.util.Map;
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
-import java.util.Map;
+import org.ajax4jsf.javascript.JSObject;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.component.AbstractAccordion;
+import org.richfaces.component.util.HtmlUtil;
+
/**
* @author akolonitsky
*/
@@ -67,7 +68,7 @@
@Override
protected JSObject getScriptObject(FacesContext context, UIComponent component) {
return new JSObject("RichFaces.ui.Accordion",
- component.getClientId(), getScriptObjectOptions(context, component));
+ component.getClientId(context), getScriptObjectOptions(context, component));
}
@Override
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java 2011-01-18
19:20:56 UTC (rev 21064)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -22,21 +22,25 @@
package org.richfaces.renderkit.html;
-import org.ajax4jsf.javascript.JSObject;
-import org.richfaces.cdk.annotations.JsfRenderer;
-import org.richfaces.component.AbstractCollapsiblePanel;
-import org.richfaces.component.AbstractTogglePanel;
+import static org.richfaces.renderkit.HtmlConstants.CLASS_ATTRIBUTE;
+import static org.richfaces.renderkit.HtmlConstants.DIV_ELEM;
+import static org.richfaces.renderkit.HtmlConstants.ID_ATTRIBUTE;
+import static org.richfaces.renderkit.HtmlConstants.STYLE_ATTRIBUTE;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import static org.richfaces.renderkit.HtmlConstants.*;
+import org.ajax4jsf.javascript.JSObject;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.component.AbstractCollapsiblePanel;
+import org.richfaces.component.AbstractTogglePanel;
/**
* @author akolonitsky
@@ -110,7 +114,7 @@
context.getPartialViewContext().getRenderIds().add(clientId);
//TODO nick - this should be done on encode, not on decode
- addOnCompleteParam(context, newValue, panel.getClientId());
+ addOnCompleteParam(context, newValue, panel.getClientId(context));
}
}
@@ -129,7 +133,7 @@
@Override
protected JSObject getScriptObject(FacesContext context, UIComponent component) {
return new JSObject("RichFaces.ui.CollapsiblePanel",
- component.getClientId(), getScriptObjectOptions(context, component));
+ component.getClientId(context), getScriptObjectOptions(context, component));
}
@Override
@@ -179,7 +183,7 @@
break;
case ajax:
- context.getResponseWriter().write(getPlaceHolder(panel.getClientId()
+ ":content"));
+
context.getResponseWriter().write(getPlaceHolder(panel.getClientId(context) +
":content"));
break;
case server:
@@ -202,7 +206,7 @@
break;
case ajax:
- writer.write(getPlaceHolder(panel.getClientId() +
":empty"));
+ writer.write(getPlaceHolder(panel.getClientId(context) +
":empty"));
break;
case server:
@@ -221,7 +225,7 @@
private void encodeContent(ResponseWriter writer, FacesContext context, UIComponent
component, boolean visible) throws IOException {
writer.startElement(DIV_ELEM, component);
- writer.writeAttribute(ID_ATTRIBUTE, component.getClientId() +
":content", null);
+ writer.writeAttribute(ID_ATTRIBUTE, component.getClientId(context) +
":content", null);
writer.writeAttribute(CLASS_ATTRIBUTE, concatClasses("rf-cp-b",
attributeAsString(component, "bodyClass")), null);
writer.writeAttribute(STYLE_ATTRIBUTE,
concatStyles(styleElement("display", visible ? "block" :
"none"),
attributeAsString(component,
"style")), null);
@@ -233,7 +237,7 @@
private void encodeEmptyDiv(ResponseWriter writer, FacesContext context, UIComponent
component, boolean visible) throws IOException {
writer.startElement(DIV_ELEM, component);
- writer.writeAttribute(ID_ATTRIBUTE, component.getClientId() + ":empty",
null);
+ writer.writeAttribute(ID_ATTRIBUTE, component.getClientId(context) +
":empty", null);
writer.writeAttribute(CLASS_ATTRIBUTE, "rf-cp-empty", null);
writer.writeAttribute(STYLE_ATTRIBUTE, styleElement("display", visible
? "block" : "none"), null);
writer.endElement(DIV_ELEM);
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java 2011-01-18
19:20:56 UTC (rev 21064)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -86,7 +86,7 @@
for (AbstractMenuGroup group : groups) {
if (group.isRendered() && !group.isDisabled()) {
Map<String, Object> map = new HashMap<String, Object>();
- map.put("id", group.getClientId());
+ map.put("id", group.getClientId(facesContext));
RenderKitUtils.addToScriptHash(map, "onhide",
group.getOnhide(), null, ScriptHashVariableWrapper.eventHandler);
RenderKitUtils.addToScriptHash(map, "onshow",
group.getOnshow(), null, ScriptHashVariableWrapper.eventHandler);
RenderKitUtils.addToScriptHash(map, "verticalOffset",
group.getVerticalOffset(), "0");
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java 2011-01-18
19:20:56 UTC (rev 21064)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -1,13 +1,9 @@
package org.richfaces.renderkit.html;
-import java.util.HashMap;
-import java.util.Map;
-
import javax.faces.component.UIComponent;
import javax.faces.component.UIForm;
import javax.faces.context.FacesContext;
-import org.ajax4jsf.javascript.JSFunction;
import org.richfaces.component.AbstractDropDownMenu;
import org.richfaces.component.AbstractMenuGroup;
import org.richfaces.component.AbstractMenuItem;
@@ -77,22 +73,6 @@
return null;
}
- private String getServerSubmitFunction(UIComponent component) {
- UIComponent form = getUIForm(component);
- if (component != null && form != null) {
- Map<String, Object> param = new HashMap<String, Object>();
- param.put(component.getClientId(), component.getClientId());
-
- JSFunction submitFunction = new
JSFunction("RichFaces.submitForm");
- submitFunction.addParameter(form.getClientId());
- submitFunction.addParameter(param);
-
- return submitFunction.toScript();
- }
-
- return "";
- }
-
protected String getOnClickFunction(FacesContext facesContext, UIComponent component)
{
AbstractMenuItem menuItem = (AbstractMenuItem) component;
Mode subminMode = resolveSubmitMode(menuItem);
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java 2011-01-18
19:20:56 UTC (rev 21064)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -23,22 +23,30 @@
package org.richfaces.renderkit.html;
-import org.ajax4jsf.javascript.JSObject;
-import org.richfaces.cdk.annotations.JsfRenderer;
-import org.richfaces.component.AbstractPanelMenuGroup;
-import org.richfaces.component.AbstractPanelMenuItem;
+import static org.richfaces.renderkit.HtmlConstants.CLASS_ATTRIBUTE;
+import static org.richfaces.renderkit.HtmlConstants.DIV_ELEM;
+import static org.richfaces.renderkit.HtmlConstants.ID_ATTRIBUTE;
+import static org.richfaces.renderkit.HtmlConstants.INPUT_ELEM;
+import static org.richfaces.renderkit.HtmlConstants.INPUT_TYPE_HIDDEN;
+import static org.richfaces.renderkit.HtmlConstants.NAME_ATTRIBUTE;
+import static org.richfaces.renderkit.HtmlConstants.TYPE_ATTR;
+import static org.richfaces.renderkit.HtmlConstants.VALUE_ATTRIBUTE;
+import static org.richfaces.renderkit.html.TogglePanelRenderer.addEventOption;
+import static org.richfaces.renderkit.html.TogglePanelRenderer.getAjaxOptions;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
-import static org.richfaces.renderkit.HtmlConstants.*;
-import static org.richfaces.renderkit.html.TogglePanelRenderer.addEventOption;
-import static org.richfaces.renderkit.html.TogglePanelRenderer.getAjaxOptions;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import org.ajax4jsf.javascript.JSObject;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.component.AbstractPanelMenuGroup;
+import org.richfaces.component.AbstractPanelMenuItem;
+
/**
* @author akolonitsky
* @since 2010-10-25
@@ -69,7 +77,7 @@
// Don't overwrite the value unless you have to!
//TODO! nick - ":expanded" suffix is not necessary
- String newValue = requestMap.get(component.getClientId() +
":expanded");
+ String newValue = requestMap.get(component.getClientId(context) +
":expanded");
if (newValue != null) {
menuGroup.setSubmittedExpanded(newValue);
}
@@ -143,7 +151,7 @@
@Override
protected JSObject getScriptObject(FacesContext context, UIComponent component) {
return new JSObject("RichFaces.ui.PanelMenuGroup",
- component.getClientId(), getScriptObjectOptions(context, component));
+ component.getClientId(context), getScriptObjectOptions(context, component));
}
@Override
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java 2011-01-18
19:20:56 UTC (rev 21064)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -23,7 +23,10 @@
package org.richfaces.renderkit.html;
-import static org.richfaces.renderkit.HtmlConstants.*;
+import static org.richfaces.renderkit.HtmlConstants.CLASS_ATTRIBUTE;
+import static org.richfaces.renderkit.HtmlConstants.TBODY_ELEMENT;
+import static org.richfaces.renderkit.HtmlConstants.TD_ELEM;
+import static org.richfaces.renderkit.HtmlConstants.TR_ELEMENT;
import static org.richfaces.renderkit.html.TogglePanelRenderer.addEventOption;
import static org.richfaces.renderkit.html.TogglePanelRenderer.getAjaxOptions;
@@ -140,7 +143,7 @@
@Override
protected JSObject getScriptObject(FacesContext context, UIComponent component) {
return new JSObject("RichFaces.ui.PanelMenuItem",
- component.getClientId(), getScriptObjectOptions(context, component));
+ component.getClientId(context), getScriptObjectOptions(context, component));
}
@Override
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java 2011-01-18
19:20:56 UTC (rev 21064)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -23,25 +23,26 @@
package org.richfaces.renderkit.html;
-import org.ajax4jsf.javascript.JSObject;
-import org.richfaces.cdk.annotations.JsfRenderer;
-import org.richfaces.component.AbstractPanelMenu;
-import org.richfaces.component.AbstractPanelMenuItem;
-import org.richfaces.context.ExtendedPartialViewContext;
-import org.richfaces.renderkit.HtmlConstants;
+import static org.richfaces.renderkit.html.TogglePanelRenderer.getAjaxOptions;
+import static org.richfaces.renderkit.html.TogglePanelRenderer.getValueRequestParamName;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.event.ActionEvent;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import static org.richfaces.renderkit.html.TogglePanelRenderer.getAjaxOptions;
-import static org.richfaces.renderkit.html.TogglePanelRenderer.getValueRequestParamName;
+import org.ajax4jsf.javascript.JSObject;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.component.AbstractPanelMenu;
+import org.richfaces.component.AbstractPanelMenuItem;
+import org.richfaces.context.ExtendedPartialViewContext;
+import org.richfaces.renderkit.HtmlConstants;
/**
* @author akolonitsky
@@ -117,7 +118,7 @@
@Override
protected JSObject getScriptObject(FacesContext context, UIComponent component) {
return new JSObject("RichFaces.ui.PanelMenu",
- component.getClientId(), getScriptObjectOptions(context, component));
+ component.getClientId(context), getScriptObjectOptions(context, component));
}
@Override
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-01-18
19:20:56 UTC (rev 21064)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabPanelRenderer.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -22,6 +22,27 @@
package org.richfaces.renderkit.html;
+import static org.richfaces.component.AbstractTogglePanelTitledItem.HeaderStates.active;
+import static
org.richfaces.component.AbstractTogglePanelTitledItem.HeaderStates.disabled;
+import static
org.richfaces.component.AbstractTogglePanelTitledItem.HeaderStates.inactive;
+import static org.richfaces.renderkit.HtmlConstants.CLASS_ATTRIBUTE;
+import static org.richfaces.renderkit.HtmlConstants.DIV_ELEM;
+import static org.richfaces.renderkit.HtmlConstants.ID_ATTRIBUTE;
+import static org.richfaces.renderkit.HtmlConstants.STYLE_ATTRIBUTE;
+import static org.richfaces.renderkit.HtmlConstants.TBODY_ELEMENT;
+import static org.richfaces.renderkit.HtmlConstants.TD_ELEM;
+import static org.richfaces.renderkit.HtmlConstants.TR_ELEMENT;
+import static org.richfaces.renderkit.RenderKitUtils.renderPassThroughAttributes;
+
+import java.io.IOException;
+import java.util.Map;
+
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
import org.ajax4jsf.javascript.JSObject;
import org.richfaces.cdk.annotations.JsfRenderer;
import org.richfaces.component.AbstractTabPanel;
@@ -32,18 +53,6 @@
import org.richfaces.renderkit.HtmlConstants;
import org.richfaces.renderkit.RenderKitUtils;
-import javax.faces.application.ResourceDependencies;
-import javax.faces.application.ResourceDependency;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-import java.io.IOException;
-import java.util.Map;
-
-import static org.richfaces.component.AbstractTogglePanelTitledItem.HeaderStates.*;
-import static org.richfaces.renderkit.HtmlConstants.*;
-import static org.richfaces.renderkit.RenderKitUtils.renderPassThroughAttributes;
-
/**
* @author akolonitsky
* @since 2010-08-24
@@ -141,7 +150,7 @@
writer.startElement(TD_ELEM, tab);
- writer.writeAttribute(ID_ATTRIBUTE, tab.getClientId() + ":header:" +
state.toString(), null);
+ writer.writeAttribute(ID_ATTRIBUTE, tab.getClientId(context) +
":header:" + state.toString(), null);
renderPassThroughAttributes(context, tab, HEADER_ATTRIBUTES);
writer.writeAttribute(CLASS_ATTRIBUTE, concatClasses("rf-tb-hdr
rf-tb-hdr-" + state.abbreviation(),
attributeAsString(tab, "headerClass"), attributeAsString(tab,
state.headerClass())), null);
@@ -202,7 +211,7 @@
@Override
protected JSObject getScriptObject(FacesContext context, UIComponent component) {
return new JSObject("RichFaces.ui.TabPanel",
- component.getClientId(), getScriptObjectOptions(context, component));
+ component.getClientId(context), getScriptObjectOptions(context, component));
}
@Override
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabRenderer.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabRenderer.java 2011-01-18
19:20:56 UTC (rev 21064)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TabRenderer.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -22,21 +22,25 @@
package org.richfaces.renderkit.html;
-import org.ajax4jsf.javascript.JSObject;
-import org.richfaces.cdk.annotations.JsfRenderer;
-import org.richfaces.component.AbstractTogglePanelTitledItem;
-import org.richfaces.component.AbstractTab;
-import org.richfaces.renderkit.HtmlConstants;
+import static org.richfaces.renderkit.HtmlConstants.CLASS_ATTRIBUTE;
+import static org.richfaces.renderkit.HtmlConstants.DIV_ELEM;
+import static org.richfaces.renderkit.HtmlConstants.ID_ATTRIBUTE;
+import static org.richfaces.renderkit.HtmlConstants.STYLE_ATTRIBUTE;
+import java.io.IOException;
+import java.util.Map;
+
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import java.io.IOException;
-import java.util.Map;
-import static org.richfaces.renderkit.HtmlConstants.*;
+import org.ajax4jsf.javascript.JSObject;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.component.AbstractTab;
+import org.richfaces.component.AbstractTogglePanelTitledItem;
+import org.richfaces.renderkit.HtmlConstants;
/**
* @author akolonitsky
@@ -58,7 +62,7 @@
protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent
component) throws IOException {
super.doEncodeBegin(writer, context, component);
- encodeContentBegin(component, writer);
+ encodeContentBegin(context, component, writer);
}
@Override
@@ -86,10 +90,10 @@
writer.endElement(HtmlConstants.SCRIPT_ELEM);
}
- private void encodeContentBegin(UIComponent component, ResponseWriter writer) throws
IOException {
+ private void encodeContentBegin(FacesContext context, UIComponent component,
ResponseWriter writer) throws IOException {
writer.startElement(DIV_ELEM, component);
writer.writeAttribute(CLASS_ATTRIBUTE, concatClasses("rf-tb-cnt",
attributeAsString(component, "contentClass")), null);
- writer.writeAttribute(ID_ATTRIBUTE, component.getClientId() +
":content", null);
+ writer.writeAttribute(ID_ATTRIBUTE, component.getClientId(context) +
":content", null);
AbstractTogglePanelTitledItem item = (AbstractTogglePanelTitledItem) component;
if (!item.isActive() || item.isDisabled()) {
@@ -103,7 +107,7 @@
@Override
protected JSObject getScriptObject(FacesContext context, UIComponent component) {
- return new JSObject("RichFaces.ui.Tab", component.getClientId(),
+ return new JSObject("RichFaces.ui.Tab",
component.getClientId(context),
getScriptObjectOptions(context, component));
}
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelItemRenderer.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelItemRenderer.java 2011-01-18
19:20:56 UTC (rev 21064)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelItemRenderer.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -22,20 +22,21 @@
package org.richfaces.renderkit.html;
-import org.ajax4jsf.javascript.JSObject;
-import org.richfaces.cdk.annotations.JsfRenderer;
-import org.richfaces.component.AbstractTogglePanel;
-import org.richfaces.component.AbstractTogglePanelItem;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
+import org.ajax4jsf.javascript.JSObject;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.component.AbstractTogglePanel;
+import org.richfaces.component.AbstractTogglePanelItem;
+
/**
* @author akolonitsky
* @since -4712-01-01
@@ -60,7 +61,7 @@
@Override
protected JSObject getScriptObject(FacesContext context, UIComponent component) {
- return new JSObject("RichFaces.ui.TogglePanelItem",
component.getClientId(),
+ return new JSObject("RichFaces.ui.TogglePanelItem",
component.getClientId(context),
getScriptObjectOptions(context, component));
}
@@ -70,7 +71,7 @@
Map<String, Object> options = new HashMap<String, Object>();
options.put("name", panelItem.getName());
- options.put("togglePanelId", panelItem.getParent().getClientId());
+ options.put("togglePanelId",
panelItem.getParent().getClientId(context));
options.put("switchMode", panelItem.getSwitchType());
AbstractTogglePanelItem item = (AbstractTogglePanelItem) component;
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-01-18
19:20:56 UTC (rev 21064)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -22,6 +22,16 @@
package org.richfaces.renderkit.html;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
import org.ajax4jsf.javascript.JSFunctionDefinition;
import org.ajax4jsf.javascript.JSObject;
import org.ajax4jsf.javascript.JSReference;
@@ -36,15 +46,6 @@
import org.richfaces.renderkit.util.FormUtil;
import org.richfaces.renderkit.util.HandlersChain;
-import javax.faces.application.ResourceDependencies;
-import javax.faces.application.ResourceDependency;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
/**
* @author akolonitsky
*/
@@ -85,7 +86,7 @@
context.getPartialViewContext().getRenderIds().add(panelItem.getClientId(context));
//TODO nick - this should be done on encode, not on decode
- addOnCompleteParam(context, newValue, panel.getClientId());
+ addOnCompleteParam(context, newValue, panel.getClientId(context));
}
}
}
@@ -139,7 +140,7 @@
@Override
protected JSObject getScriptObject(FacesContext context, UIComponent component) {
return new JSObject("RichFaces.ui.TogglePanel",
- component.getClientId(), getScriptObjectOptions(context, component));
+ component.getClientId(context), getScriptObjectOptions(context, component));
}
@Override
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java 2011-01-18
19:20:56 UTC (rev 21064)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java 2011-01-19
00:38:15 UTC (rev 21065)
@@ -23,6 +23,23 @@
package org.richfaces.renderkit.html;
+import static org.richfaces.renderkit.HtmlConstants.CLASS_ATTRIBUTE;
+import static org.richfaces.renderkit.HtmlConstants.ID_ATTRIBUTE;
+import static org.richfaces.renderkit.RenderKitUtils.renderPassThroughAttributes;
+import static org.richfaces.renderkit.html.TogglePanelRenderer.addEventOption;
+import static org.richfaces.renderkit.html.TogglePanelRenderer.getAjaxOptions;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.PartialResponseWriter;
+import javax.faces.context.ResponseWriter;
+
import org.ajax4jsf.javascript.JSObject;
import org.richfaces.TooltipMode;
import org.richfaces.cdk.annotations.JsfRenderer;
@@ -32,22 +49,6 @@
import org.richfaces.renderkit.MetaComponentRenderer;
import org.richfaces.renderkit.util.RendererUtils;
-import javax.faces.application.ResourceDependencies;
-import javax.faces.application.ResourceDependency;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.PartialResponseWriter;
-import javax.faces.context.ResponseWriter;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-import static org.richfaces.renderkit.HtmlConstants.CLASS_ATTRIBUTE;
-import static org.richfaces.renderkit.HtmlConstants.ID_ATTRIBUTE;
-import static org.richfaces.renderkit.RenderKitUtils.renderPassThroughAttributes;
-import static org.richfaces.renderkit.html.TogglePanelRenderer.addEventOption;
-import static org.richfaces.renderkit.html.TogglePanelRenderer.getAjaxOptions;
-
/**
* @author amarkhel
* @since 2010-10-24
@@ -85,7 +86,7 @@
context.getPartialViewContext().getRenderIds().add(tooltip.getContentClientId(context));
//TODO nick - this should be done on encode, not on decode
- addOnCompleteParam(context, tooltip.getClientId());
+ addOnCompleteParam(context, tooltip.getClientId(context));
}
}
@@ -154,7 +155,7 @@
@Override
protected JSObject getScriptObject(FacesContext context, UIComponent component) {
return new JSObject("RichFaces.ui.Tooltip",
- component.getClientId(), getScriptObjectOptions(context, component));
+ component.getClientId(context), getScriptObjectOptions(context, component));
}
@Override