From c031eb6896cf31a4c1520999e52ff36315d0d2f9 Mon Sep 17 00:00:00 2001 From: shmyga Date: Tue, 7 Jan 2014 18:08:16 +0400 Subject: [PATCH] smile fixes --- haxework/gui/GroupView.hx | 6 ++++++ haxework/gui/IGroupView.hx | 1 + haxework/net/BaseURLLoader.hx | 1 + haxework/provider/Provider.hx | 10 ++++++++++ 4 files changed, 18 insertions(+) diff --git a/haxework/gui/GroupView.hx b/haxework/gui/GroupView.hx index 184b016..9a12b2e 100755 --- a/haxework/gui/GroupView.hx +++ b/haxework/gui/GroupView.hx @@ -64,6 +64,12 @@ class GroupView extends SpriteView implements IGroupView { return view; } + public function removeAllViews():Void { + while (views.length > 0) { + removeView(views[0]); + } + } + public function removeViewById(id:String):IView { if (viewsById.exists(id)) { return removeView(viewsById.get(id)); diff --git a/haxework/gui/IGroupView.hx b/haxework/gui/IGroupView.hx index bd7f7ce..8966af4 100755 --- a/haxework/gui/IGroupView.hx +++ b/haxework/gui/IGroupView.hx @@ -22,6 +22,7 @@ interface IGroupView extends IView { public function addView(view:IView):IView; public function removeView(view:IView):IView; + public function removeAllViews():Void; public function removeViewById(id:String):IView; public function findViewById>(id:String, ?clazz:Class):Null; } \ No newline at end of file diff --git a/haxework/net/BaseURLLoader.hx b/haxework/net/BaseURLLoader.hx index a39282e..74baa9f 100755 --- a/haxework/net/BaseURLLoader.hx +++ b/haxework/net/BaseURLLoader.hx @@ -66,6 +66,7 @@ class BaseURLLoader extends BaseLoader { override private function onError(e:Event):Void { var c:ICallback = callback; var error:String = extrudeError(loader.data); + if (error != null) error = url + ": " + error; dispose(); c.callFail(error != null ? error : e); } diff --git a/haxework/provider/Provider.hx b/haxework/provider/Provider.hx index 92905ca..ad3a71f 100755 --- a/haxework/provider/Provider.hx +++ b/haxework/provider/Provider.hx @@ -28,4 +28,14 @@ class Provider { throw new Error("Factory for\"" + i + "\" not found"); } } + + public static function build(i:Class, ?type:Dynamic):T { + var key:Dynamic = (type == null) ? i : type; + if (factories.exists(key)) { + var instance:T = Type.createInstance(factories.get(key), []); + return instance; + } else { + throw new Error("Factory for\"" + i + "\" not found"); + } + } } \ No newline at end of file