Author: nbelaevski
Date: 2007-11-09 21:07:29 -0500 (Fri, 09 Nov 2007)
New Revision: 3889
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererBase.java
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java
trunk/framework/impl/src/main/java/org/richfaces/component/util/FormUtil.java
trunk/framework/impl/src/main/java/org/richfaces/component/util/HtmlUtil.java
Log:
http://jira.jboss.com/jira/browse/RF-1325
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererBase.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererBase.java 2007-11-09
22:16:36 UTC (rev 3888)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererBase.java 2007-11-10
02:07:29 UTC (rev 3889)
@@ -55,7 +55,7 @@
*/
protected static final String JAVASCRIPT_NAMESPACE = "Exadel";
private static final Log log = LogFactory.getLog(RendererBase.class);
- private static final RendererUtils utils = new RendererUtils();
+ private static final RendererUtils utils = RendererUtils.getInstance();
private SkinFactory skinFactory = null;
private InternetResourceBuilder resourceBuilder = null;
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java 2007-11-09
22:16:36 UTC (rev 3888)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java 2007-11-10
02:07:29 UTC (rev 3889)
@@ -55,7 +55,10 @@
*
*/
public class RendererUtils {
-
+
+ //we'd better use this instance multithreadly quickly
+ private static final RendererUtils instance = new RendererUtils();
+
public static final String DUMMY_FORM_ID = ":_form";
/**
* Substitutions for components properies names and HTML attributes names.
@@ -69,7 +72,21 @@
Arrays.sort(HTML.PASS_THRU_URI);
}
+ //can be created by subclasses;
+ //administratively restricted to be created by package members ;)
+ protected RendererUtils() {
+ super();
+ }
+
/**
+ * Use this method to get singleton instance of RendererUtils
+ * @return singleton instance
+ */
+ public static RendererUtils getInstance() {
+ return instance;
+ }
+
+ /**
* Common HTML elements and attributes names.
*
* @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
@@ -848,5 +865,4 @@
}
return target;
}
-
}
\ No newline at end of file
Modified: trunk/framework/impl/src/main/java/org/richfaces/component/util/FormUtil.java
===================================================================
---
trunk/framework/impl/src/main/java/org/richfaces/component/util/FormUtil.java 2007-11-09
22:16:36 UTC (rev 3888)
+++
trunk/framework/impl/src/main/java/org/richfaces/component/util/FormUtil.java 2007-11-10
02:07:29 UTC (rev 3889)
@@ -36,12 +36,8 @@
*/
public class FormUtil {
- //TODO nick -> nick - howto get rid of this static instance?
- private static RendererUtils rendererUtils = new RendererUtils();
-
public static void throwEnclFormReqExceptionIfNeed(FacesContext context, UIComponent
component) throws EnclosingFormRequiredException {
- //RendererUtils rendererUtils = new RendererUtils();
- UIForm form= rendererUtils.getNestingForm(context, component);
+ UIForm form= RendererUtils.getInstance().getNestingForm(context, component);
//TODO nick -> nick - switchType checking can be harmful here
String switchType = (String) component.getAttributes().get("switchType");
boolean isSwitchTypeClient = switchType == null ? false :
switchType.equalsIgnoreCase("client") ;
Modified: trunk/framework/impl/src/main/java/org/richfaces/component/util/HtmlUtil.java
===================================================================
---
trunk/framework/impl/src/main/java/org/richfaces/component/util/HtmlUtil.java 2007-11-09
22:16:36 UTC (rev 3888)
+++
trunk/framework/impl/src/main/java/org/richfaces/component/util/HtmlUtil.java 2007-11-10
02:07:29 UTC (rev 3889)
@@ -27,6 +27,7 @@
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
+import org.ajax4jsf.renderkit.RendererUtils;
import org.ajax4jsf.util.HtmlDimensions;
/**
@@ -64,7 +65,7 @@
while (matcher.find()) {
// make new id selector here using matcher.group(1)
- UIComponent target = component.findComponent(matcher.group(1));
+ UIComponent target = RendererUtils.getInstance().findComponentFor(context, component,
matcher.group(1));
if (target != null) {
matcher.appendReplacement(sb, "#"