Commits

Anonymous committed 6f70441

PropertyEditorFactory support

Comments (0)

Files changed (1)

src/de/matthiasmann/twlscala/PropertySheet.scala

 class PropertySheet extends TWLPropertySheet with ThemeSupport {
     theme = "propertysheet"
     def properties = new PropertyList(getPropertyList)
+    def factories = new {
+        def +=[T] (f:TWLPropertySheet.PropertyEditorFactory[T])(implicit m:Manifest[T]) {
+            registerPropertyEditorFactory(m.erasure.asInstanceOf[Class[T]], f)
+        }
+        def +=[T] (f:(TWLProperty[T])=>TWLPropertySheet.PropertyEditor[T])(implicit m:Manifest[T]) {
+            +=(new TWLPropertySheet.PropertyEditorFactory[T] {
+                    def createEditor(p:TWLProperty[T]) = f(p)
+            })
+        }
+    }
 }
 
 class Property[T](clazz:Class[T], propertyName:String, initialValue:T) extends TWLSimpleProperty(clazz, propertyName, initialValue) {