Revision: 1159
Author: jhoskens
Date: 2006-05-15 04:36:06 -0700 (Mon, 15 May 2006)
ViewCVS: http://svn.sourceforge.net/spring-rich-c/?rev=1159&view=rev
Log Message:
-----------
Implements ApplicationContextAware and InitializingBean.
BeanId's will now be resolved with the given ApplicationContext in the
afterPropertiesSet() method.
Modified Paths:
--------------
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/form/binding/support/AbstractBinderSelectionStrategy.java
Modified:
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/form/binding/support/AbstractBinderSelectionStrategy.java
===================================================================
---
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/form/binding/support/AbstractBinderSelectionStrategy.java
2006-05-14 20:31:13 UTC (rev 1158)
+++
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/form/binding/support/AbstractBinderSelectionStrategy.java
2006-05-15 11:36:06 UTC (rev 1159)
@@ -21,10 +21,12 @@
import java.util.Map;
import java.util.Properties;
+import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.propertyeditors.ClassEditor;
import org.springframework.binding.form.FormModel;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
import org.springframework.core.enums.LabeledEnum;
-import org.springframework.richclient.application.Application;
import org.springframework.richclient.form.binding.Binder;
import org.springframework.richclient.form.binding.BinderSelectionStrategy;
import org.springframework.richclient.util.ClassUtils;
@@ -37,7 +39,7 @@
* @author Oliver Hutchison
* @author Jim Moore
*/
-public abstract class AbstractBinderSelectionStrategy implements
BinderSelectionStrategy {
+public abstract class AbstractBinderSelectionStrategy implements
BinderSelectionStrategy, ApplicationContextAware, InitializingBean{
private final Class defaultControlType;
@@ -48,6 +50,10 @@
private final Map propertyTypeBinders = new HashMap();
private final Map propertyNameBinders = new HashMap();
+
+ private List bindersForPropertyNames;
+
+ private ApplicationContext applicationContext;
public AbstractBinderSelectionStrategy(Class defaultControlType) {
this.defaultControlType = defaultControlType;
@@ -158,10 +164,7 @@
*/
public void setBindersForPropertyNames(List binders)
{
- for (Iterator i = binders.iterator(); i.hasNext();)
- {
- setBinderForPropertyName((Properties) i.next());
- }
+ bindersForPropertyNames = binders;
}
/**
@@ -224,7 +227,7 @@
else if (binder.containsKey("binderRef"))
{
String binderID = (String) binder.get("binderRef");
- Binder binderBean = (Binder)
Application.instance().getApplicationContext().getBean(binderID);
+ Binder binderBean = (Binder)
getApplicationContext().getBean(binderID);
registerBinderForPropertyName(objectClass, propertyName,
binderBean);
}
else
@@ -317,4 +320,22 @@
return (propertyName.hashCode() * 29) +
parentObjectType.hashCode();
}
}
+
+ public void setApplicationContext(ApplicationContext applicationContext)
+ {
+ this.applicationContext = applicationContext;
+ }
+
+ protected ApplicationContext getApplicationContext()
+ {
+ return applicationContext;
+ }
+
+ public void afterPropertiesSet() throws Exception
+ {
+ for (Iterator i = bindersForPropertyNames.iterator(); i.hasNext();)
+ {
+ setBinderForPropertyName((Properties) i.next());
+ }
+ }
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
spring-rich-c-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spring-rich-c-cvs