From 1d4064d0bbb1f002447785f4a9a5d7ce0ee4b246 Mon Sep 17 00:00:00 2001 From: Sean Clark Hess Date: Sun, 18 Oct 2009 23:11:57 +0200 Subject: [PATCH] removed old code --- .../seanhess/zero/observe/INotification.as | 9 -- .../net/seanhess/zero/observe/IObserver.as | 8 - .../net/seanhess/zero/observe/Notification.as | 35 ----- .../src/net/seanhess/zero/observe/Observer.as | 25 --- .../src/net/seanhess/zero/scan/EventInfo.as | 13 -- .../src/net/seanhess/zero/scan/MethodInfo.as | 12 -- .../net/seanhess/zero/scan/PropertyInfo.as | 21 --- .../src/net/seanhess/zero/scan/SimpleScan.as | 142 ------------------ source/src/net/seanhess/zero/scan/TypeInfo.as | 13 -- .../src/net/seanhess/zero/view/IViewChild.as | 9 -- source/src/net/seanhess/zero/view/View.as | 116 -------------- .../src/net/seanhess/zero/view/ViewModule.as | 62 -------- 12 files changed, 465 deletions(-) delete mode 100644 source/src/net/seanhess/zero/observe/INotification.as delete mode 100644 source/src/net/seanhess/zero/observe/IObserver.as delete mode 100644 source/src/net/seanhess/zero/observe/Notification.as delete mode 100644 source/src/net/seanhess/zero/observe/Observer.as delete mode 100644 source/src/net/seanhess/zero/scan/EventInfo.as delete mode 100644 source/src/net/seanhess/zero/scan/MethodInfo.as delete mode 100644 source/src/net/seanhess/zero/scan/PropertyInfo.as delete mode 100644 source/src/net/seanhess/zero/scan/SimpleScan.as delete mode 100644 source/src/net/seanhess/zero/scan/TypeInfo.as delete mode 100644 source/src/net/seanhess/zero/view/IViewChild.as delete mode 100644 source/src/net/seanhess/zero/view/View.as delete mode 100644 source/src/net/seanhess/zero/view/ViewModule.as diff --git a/source/src/net/seanhess/zero/observe/INotification.as b/source/src/net/seanhess/zero/observe/INotification.as deleted file mode 100644 index 3d559c9..0000000 --- a/source/src/net/seanhess/zero/observe/INotification.as +++ /dev/null @@ -1,9 +0,0 @@ -package net.seanhess.zero.observe -{ - public interface INotification - { - function add(observer:IObserver):void; - function remove(observer:IObserver):void; - function send(data:*=null):void - } -} \ No newline at end of file diff --git a/source/src/net/seanhess/zero/observe/IObserver.as b/source/src/net/seanhess/zero/observe/IObserver.as deleted file mode 100644 index 76c189b..0000000 --- a/source/src/net/seanhess/zero/observe/IObserver.as +++ /dev/null @@ -1,8 +0,0 @@ -package net.seanhess.zero.observe -{ - public interface IObserver - { - function get key():*; - function call(notification:INotification, data:*):void; - } -} \ No newline at end of file diff --git a/source/src/net/seanhess/zero/observe/Notification.as b/source/src/net/seanhess/zero/observe/Notification.as deleted file mode 100644 index 6bf94ec..0000000 --- a/source/src/net/seanhess/zero/observe/Notification.as +++ /dev/null @@ -1,35 +0,0 @@ -package net.seanhess.zero.observe -{ - import flash.utils.Dictionary; - - public class Notification implements INotification - { - public var observers:Dictionary; - public var data:*; - - public function Notification() - { - observers = new Dictionary(true); - } - - public function add(observer:IObserver):void - { - observers[observer.key] = observer; - } - - public function remove(observer:IObserver):void - { - delete observers[observer.key]; - } - - public function send(data:*=null):void - { - if (data != null) this.data = data; - - for each (var observer:IObserver in observers) - { - observer.call(this, data); - } - } - } -} \ No newline at end of file diff --git a/source/src/net/seanhess/zero/observe/Observer.as b/source/src/net/seanhess/zero/observe/Observer.as deleted file mode 100644 index 83a64b5..0000000 --- a/source/src/net/seanhess/zero/observe/Observer.as +++ /dev/null @@ -1,25 +0,0 @@ -package net.seanhess.zero.observe -{ - public class Observer implements IObserver - { - public static const ALWAYS:String = "always"; - public static const ONCE:String = "once"; - - public var callback:Function; - public var params:Array; - public var type:String = ALWAYS; - - public function get key():* - { - return callback as Object; - } - - public function call(notification:INotification, data:*):void - { - callback.apply(null, [data].concat(params)); - - if (type == ONCE) - notification.remove(this); - } - } -} \ No newline at end of file diff --git a/source/src/net/seanhess/zero/scan/EventInfo.as b/source/src/net/seanhess/zero/scan/EventInfo.as deleted file mode 100644 index b25557a..0000000 --- a/source/src/net/seanhess/zero/scan/EventInfo.as +++ /dev/null @@ -1,13 +0,0 @@ -package net.seanhess.zero.scan -{ - public class EventInfo - { - public var name:String; - public var type:String; - - public function toString():String - { - return name; - } - } -} \ No newline at end of file diff --git a/source/src/net/seanhess/zero/scan/MethodInfo.as b/source/src/net/seanhess/zero/scan/MethodInfo.as deleted file mode 100644 index b142096..0000000 --- a/source/src/net/seanhess/zero/scan/MethodInfo.as +++ /dev/null @@ -1,12 +0,0 @@ -package net.seanhess.zero.scan -{ - public class MethodInfo - { - public var name:String; - - public function toString():String - { - return name; - } - } -} \ No newline at end of file diff --git a/source/src/net/seanhess/zero/scan/PropertyInfo.as b/source/src/net/seanhess/zero/scan/PropertyInfo.as deleted file mode 100644 index 0125d7a..0000000 --- a/source/src/net/seanhess/zero/scan/PropertyInfo.as +++ /dev/null @@ -1,21 +0,0 @@ -package net.seanhess.zero.scan -{ - public class PropertyInfo - { - public static const READ:String = "read"; - public static const WRITE:String = "write"; - public static const READ_WRITE:String = "readwrite"; - - public var name:String; - public var type:String; - public var access:String; - public var bindable:Boolean; - public var event:String; // the bindable event type - public var metadata:Object = {}; // just a flat map of metadata flags... no values for now - - public function toString():String - { - return name; - } - } -} \ No newline at end of file diff --git a/source/src/net/seanhess/zero/scan/SimpleScan.as b/source/src/net/seanhess/zero/scan/SimpleScan.as deleted file mode 100644 index f97beef..0000000 --- a/source/src/net/seanhess/zero/scan/SimpleScan.as +++ /dev/null @@ -1,142 +0,0 @@ -package net.seanhess.zero.scan -{ - import flash.utils.Dictionary; - import flash.utils.describeType; - import flash.utils.getQualifiedClassName; - - /** - * Scans the object and caches the data for performance - */ - public class SimpleScan - { - public static var info:Dictionary = new Dictionary(true); - public static var objects:Dictionary = new Dictionary(true); - - public function getMethodName(object:Object, method:Function):String - { - for each (var name:String in getObjectInfo(object).methods); - { - if (object[name] == method) - { - return name; - } - } - - throw new Error("Could not find method on object"); - return null; - } - - public function getObjectInfo(object:Object):TypeInfo - { - var name:String = getClassName(object); - - if (info[name] == null) - { - info[name] = scan(object); - } - - return info[name]; - } - - public function getClassInfo(type:Class):TypeInfo - { - var name:String = getClassName(type); - - if (info[name] == null) - { - info[name] = scan(type); - } - - return info[name]; - } - - public function getClassName(type:Object):String - { - return getQualifiedClassName(type).replace("::","."); - } - - /** - * Can scan objects or classes - */ - protected function scan(type:Object):TypeInfo - { - var data:XML = describeType(type); - - - - var name:String = data.@name.toString(); - - var info:TypeInfo = new TypeInfo(); - info.qualifiedName = name; - info.type = name.replace(/.*::/i, ""); // get rid of the other stuff - info.definitionName = name.replace(/::/i,"."); - - - // handle classes AND objects - if (data.factory.length() > 0) - data = data.factory[0]; - - - var methods:XMLList = data.method.(@declaredBy == info.qualifiedName); - - for each (var method:XML in methods) - { - var methodInfo:MethodInfo = new MethodInfo(); - methodInfo.name = method.@name.toString(); - - info.methods[methodInfo.name] = methodInfo; - } - - - - - - var accessors:XMLList = data.accessor.(@declaredBy == info.qualifiedName); - var variables:XMLList = data.variable; - accessors += variables; - - for each (var accessor:XML in accessors) - { - var property:PropertyInfo = new PropertyInfo(); - property.name = accessor.@name.toString(); - property.type = accessor.@type.toString().replace("::","."); - - if (accessor.localName() == "accessor") - property.access = accessor.@access.toString(); - else - property.access = PropertyInfo.READ_WRITE; - - var bindableList:XMLList = accessor.metadata.(@name == "Bindable"); - - if (bindableList.length() > 0) - { - property.bindable = true; - property.event = bindableList[0].arg[0].@value; - } - - var metalist:XMLList = accessor.metadata; - - for each (var meta:XML in metalist) - property.metadata[meta.@name.toString()] = meta.@name.toString(); - - info.properties[property.name] = property; - } - - - - - var events:XMLList = data.metadata.(@name == "Event"); - - for each (var event:XML in events) - { - var eventInfo:EventInfo = new EventInfo(); - eventInfo.name = event.arg.(@key == "name")[0].@value; - eventInfo.type = event.arg.(@key == "type")[0].@value; - - info.events[eventInfo.name] = eventInfo; - } - - return info; - } - } -} \ No newline at end of file diff --git a/source/src/net/seanhess/zero/scan/TypeInfo.as b/source/src/net/seanhess/zero/scan/TypeInfo.as deleted file mode 100644 index a988005..0000000 --- a/source/src/net/seanhess/zero/scan/TypeInfo.as +++ /dev/null @@ -1,13 +0,0 @@ -package net.seanhess.zero.scan -{ - public class TypeInfo - { - public var type:String; - public var qualifiedName:String; - public var definitionName:String; - - public var methods:Object = {}; // MethodInfo objects - public var events:Object = {}; // EventInfo objects - public var properties:Object = {}; // PropertyInfo objects - } -} \ No newline at end of file diff --git a/source/src/net/seanhess/zero/view/IViewChild.as b/source/src/net/seanhess/zero/view/IViewChild.as deleted file mode 100644 index 5fd2478..0000000 --- a/source/src/net/seanhess/zero/view/IViewChild.as +++ /dev/null @@ -1,9 +0,0 @@ -package net.seanhess.zero.view -{ - import net.seanhess.zero.context.IContextNode; - - public interface IViewChild - { - function set parentContext(value:IContextNode):void; - } -} \ No newline at end of file diff --git a/source/src/net/seanhess/zero/view/View.as b/source/src/net/seanhess/zero/view/View.as deleted file mode 100644 index c362e51..0000000 --- a/source/src/net/seanhess/zero/view/View.as +++ /dev/null @@ -1,116 +0,0 @@ -package net.seanhess.zero.view -{ - import flash.events.Event; - import flash.utils.getQualifiedClassName; - - import mx.events.ModuleEvent; - import mx.modules.ModuleLoader; - - import net.seanhess.zero.context.IContextNode; - - /** - * Handles connecting / disconnecting... - */ - public class View extends ModuleLoader - { - protected var _context:IContextNode; - protected var moduleurl:String; - - protected var loading:Boolean = false; - protected var loaded:Boolean = false; - protected var visibleChanged:Boolean = false; - protected var urlChanged:Boolean = false; - - public function View() - { - addEventListener(ModuleEvent.UNLOAD, onUnload); - addEventListener(ModuleEvent.READY, onReady); - addEventListener(ModuleEvent.ERROR, onError); - } - - protected function onUnload(event:Event):void - { - loading = false; - - if (urlChanged || visibleChanged) - invalidateProperties(); - } - - protected function onReady(event:Event):void - { - if (view) - view.parentContext = _context; - - loading = false; - loaded = true; - - if (urlChanged || visibleChanged) - invalidateProperties(); - } - - protected function onError(event:ModuleEvent):void - { - - } - - public function set context(value:IContextNode):void - { - _context = value; - - if (loaded && view) - view.parentContext = _context; - } - - /** - * Package name of the module. - */ - public function set module(value:String):void - { - moduleurl = value.replace(/(\.|::)/gi, "/") + ".swf"; - urlChanged = true; - invalidateProperties(); - } - - override public function setVisible(value:Boolean, noEvent:Boolean = false):void - { - super.setVisible(value, noEvent); - visibleChanged = true; - invalidateProperties(); - } - - override protected function commitProperties():void - { - super.commitProperties(); - - if ((visibleChanged || urlChanged) && !loading) - { - visibleChanged = false; - urlChanged = false; - - if (visible && !loaded) // if it is visible and not loaded - { - loading = true; - loadModule(moduleurl); - } - - else if(!visible && loaded) // if it is not visible and loaded - { - loading = true; - loaded = false; - unloadModule(); - } - } - } - - - public function get view():IViewChild - { -// if (child && !(child is IViewChild)) -// { -// throw new Error("The module must implement IViewChild"); -// } - - return child as IViewChild; - } - } -} \ No newline at end of file diff --git a/source/src/net/seanhess/zero/view/ViewModule.as b/source/src/net/seanhess/zero/view/ViewModule.as deleted file mode 100644 index 9b73f53..0000000 --- a/source/src/net/seanhess/zero/view/ViewModule.as +++ /dev/null @@ -1,62 +0,0 @@ -package net.seanhess.zero.view -{ - import flash.events.Event; - - import mx.modules.Module; - - import net.seanhess.zero.context.IContextNode; - import net.seanhess.zero.interfaces.IInterfaceContext; - import net.seanhess.zero.interfaces.InterfaceContext; - - /** - * Handles connecting / disconnecting... - */ - public class ViewModule extends Module implements IViewChild - { - protected var _context:IInterfaceContext; - protected var _parent:IContextNode; - - public function ViewModule() - { - addEventListener(Event.REMOVED_FROM_STAGE, onRemoved); - } - - protected function onRemoved(event:Event):void - { - if (_parent) - _parent.unlink(_context); - - _parent = null; - _context = null; - } - - /** - * Sets the PARENT context - */ - public function set parentContext(value:IContextNode):void - { - _parent = value; - - if (value) - { - _context = new InterfaceContext(); - _parent.link(_context); - } - else - { - _context = null; - } - - dispatchEvent(new Event("context")); - } - - /** - * Returns the CHILD context - */ - [Bindable("context")] - public function get context():IInterfaceContext - { - return _context; - } - } -} \ No newline at end of file