Update of /cvsroot/wonder/Wonder/Common/Frameworks/ERExtensions/Sources/er/extensions
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv4431/Sources/er/extensions
Modified Files:
ERXApplication.java
Log Message:
1.5 generic pageWithName
Index: ERXApplication.java
===================================================================
RCS file: /cvsroot/wonder/Wonder/Common/Frameworks/ERExtensions/Sources/er/extensions/ERXApplication.java,v
retrieving revision 1.165
retrieving revision 1.166
diff -C2 -d -r1.165 -r1.166
*** ERXApplication.java 20 Jul 2007 21:16:32 -0000 1.165
--- ERXApplication.java 7 Aug 2007 07:15:50 -0000 1.166
***************
*** 1416,1419 ****
--- 1416,1445 ----
}
+ /**
+ * Returns the component for the given class without having to cast.
+ * For example: MyPage page = ERXApplication.erxApplication().pageWithName(MyPage.class, context);
+ *
+ * @param <T> the type of component to
+ * @param componentClass the component class to lookup
+ * @param context the context
+ * @return the created component
+ */
+ @SuppressWarnings("unchecked")
+ public <T extends WOComponent> T pageWithName(Class<T> componentClass, WOContext context) {
+ return (T) super.pageWithName(componentClass.getName(), context);
+ }
+
+ /**
+ * Calls pageWithName with ERXWOContext.currentContext() for the current thread.
+ *
+ * @param <T> the type of component to
+ * @param componentClass the component class to lookup
+ * @return the created component
+ */
+ @SuppressWarnings("unchecked")
+ public <T extends WOComponent> T pageWithName(Class<T> componentClass) {
+ return (T) super.pageWithName(componentClass.getName(), ERXWOContext.currentContext());
+ }
+
public NSKeyValueCodingAdditions constants() {
return new NSKeyValueCodingAdditions() {
|