Permalink
Browse files

removed EVERYTHING and updated Cafe Townsend

  • Loading branch information...
1 parent 73248a5 commit bdbf9afdedd94df0816f39600842d3d11782715c @seanhess committed May 15, 2009
@@ -8,9 +8,9 @@ package cafe.model
public class Employee
{
public var emp_id : uint;
- public var firstname : String;
- public var lastname : String;
- public var email : String;
+ public var firstname : String = "";
+ public var lastname : String = "";
+ public var email : String = "";
public var startdate : Date;
}
}
View
Binary file not shown.
View
@@ -1,9 +1,7 @@
<?xml version="1.0"?>
<componentPackage>
- <component class="net.seanhess.glue.core.IGlueAction"/>
<component class="net.seanhess.glue.tags.Inject"/>
<component class="net.seanhess.glue.tags.Glue"/>
<component class="net.seanhess.glue.tags.GlueMap"/>
<component class="net.seanhess.glue.tags.Route"/>
- <component class="net.seanhess.glue.utils.Respond"/>
</componentPackage>
@@ -1,20 +0,0 @@
-package net.seanhess.glue.core
-{
- import net.seanhess.bifff.core.Executor;
- import net.seanhess.bifff.core.Scope;
-
- public class GlueExecutor extends Executor
- {
- override public function executeBehaviors(target:*, behaviors:Array, scope:Scope):void
- {
- for each (var behavior:* in behaviors)
- {
- if (behavior is IGlueAction)
- {
- setBehaviorParent(behavior, scope);
- (behavior as IGlueAction).applyAction(target);
- }
- }
- }
- }
-}
@@ -1,7 +0,0 @@
-package net.seanhess.glue.core
-{
- public interface IGlueAction
- {
- function applyAction(target:*):void;
- }
-}
@@ -1,104 +1,8 @@
package net.seanhess.glue.tags
{
- import flash.events.Event;
- import flash.utils.getQualifiedClassName;
-
- import mx.core.UIComponent;
-
- import net.seanhess.bifff.core.Node;
import net.seanhess.bifff.core.Selector;
- import net.seanhess.bifff.utils.Invalidator;
- import net.seanhess.glue.core.IGlueAction;
-
- [DefaultProperty("stuff")]
+
public class Glue extends Selector
{
- public static const INITIALIZED:String = "initialized";
- public static const INSTANCE_CHANGE:String = "currentInstanceChange";
-
- private var _target:*;
- private var _targetClass:String;
- private var invalidator:Invalidator = new Invalidator(commit);
- public var viewID:String
-
- public var currentInstance:*;
-
- /**
- * If you set the view, Glue will replace the instance in the map
- * with the current one. It also sets "match" to grab that view
- * when it finds it, unless it is already set
- */
- public function set view(value:UIComponent):void
- {
- viewID = value.id;
- this.match = this.match || value.className;
- }
-
- /**
- * You can set to a view class or a non-view class. This acts very
- * differently depending on which one it is. If it is a view class
- * (determined by whether it has properties similar to UIComponent)
- * then it will set the match values appropriately and wait for it
- * to show up in the behavior map
- */
- public function set target(value:*):void
- {
- if (value.hasOwnProperty("id") && value.hasOwnProperty("className")) // dynamic UIComponent...
- view = value;
-
- else
- {
- _target = value;
- var name:String = getQualifiedClassName(value);
- _targetClass = name;
- invalidator.invalidate("target");
- nodes = [new Node(Node.NONE)];
- }
- }
-
- public function get target():*
- {
- return _target;
- }
-
- public function setCurrentInstance(view:*):void
- {
- if (viewID)
- {
- currentInstance = view;
- dispatchEvent(new Event(INSTANCE_CHANGE));
- }
- }
-
- override public function matches(target:*, root:*=null):Boolean
- {
- var matches:Boolean = super.matches(target, root);
-
- if (matches)
- setCurrentInstance(target);
-
- return matches;
- }
-
- /**
- * Dispatch an initialized event, saying all our properties are set
- */
- protected function commit():void
- {
- if (_target && actions && invalidator.invalid("target"))
- dispatchEvent(new Event(INITIALIZED));
- }
-
- [ArrayElementType("Object")]
- public function set stuff(value:Array):void
- {
- if (value.length > 0 && !(value[0] is IGlueAction))
- {
- target = value.shift();
- }
-
- actions = value;
- invalidator.invalidate("target");
- }
}
}
@@ -5,56 +5,12 @@ package net.seanhess.glue.tags
import net.seanhess.bifff.core.BehaviorMap;
import net.seanhess.bifff.core.ISelector;
import net.seanhess.bifff.utils.Debug;
- import net.seanhess.glue.core.GlueExecutor;
- /**
- * So, how do I know when to actually execute? (Timer .... )
- */
public class GlueMap extends BehaviorMap
{
public function get view():*
{
return scope.target;
}
-
- override protected function initializeSelector(selector:ISelector):void
- {
- super.initializeSelector(selector);
-
- if (selector is Glue)
- {
- var glue:Glue = selector as Glue;
- glue.addEventListener(Glue.INITIALIZED, onGlueInitialized, false, 0, true);
- glue.addEventListener(Glue.INSTANCE_CHANGE, onGlueInstanceChanged, false, 0, true);
- }
- }
-
- private function onGlueInitialized(event:Event):void
- {
- var glue:Glue = event.target as Glue;
- matchedSelector(glue.target, glue);
- }
-
- private function onGlueInstanceChanged(event:Event):void
- {
- var glue:Glue = event.target as Glue;
- setCurrentInstance(glue.viewID, glue.currentInstance);
- }
-
- public function setCurrentInstance(viewID:String, view:*):void
- {
- if (this.hasOwnProperty(viewID))
- this[viewID] = view;
-
- else
- throw new Error("Could not set current view instance: " + viewID + " to " + view + " on " + this);
- }
-
- override protected function commit():void
- {
- super.commit();
- this.executor = new GlueExecutor();
- Debug.instance.log("[ √ ] Project on " + target);
- }
}
}
@@ -1,16 +1,11 @@
package net.seanhess.glue.tags
{
import net.seanhess.bifff.behaviors.Inject;
- import net.seanhess.glue.core.IGlueAction;
/**
* See online docs
*/
- dynamic public class Inject extends net.seanhess.bifff.behaviors.Inject implements IGlueAction
+ dynamic public class Inject extends net.seanhess.bifff.behaviors.Inject
{
- public function applyAction(target:*):void
- {
- this.target = target;
- }
}
}
@@ -4,34 +4,8 @@ package net.seanhess.glue.tags
import flash.events.IEventDispatcher;
import net.seanhess.bifff.behaviors.Listen;
- import net.seanhess.glue.core.IGlueAction;
- public class Route extends Listen implements IGlueAction
+ public class Route extends Listen
{
-// public var from:IEventDispatcher;
-
- public function applyAction(target:*):void
- {
- this.target = target;
- }
-
-// override protected function getDispatcher(target:*):IEventDispatcher
-// {
-// var dispatcher:IEventDispatcher;
-//
-// if (from)
-// dispatcher = from;
-//
-// else
-// dispatcher = super.getDispatcher(target);
-//
-// return dispatcher;
-// }
-
-// override protected function eventFiring(target:*, event:Event):void
-// {
-// super.eventFiring(target, event);
-// (parent.selector as Glue).setCurrentInstance(target);
-// }
}
}
@@ -1,92 +0,0 @@
-package net.seanhess.glue.utils
-{
- import flash.events.Event;
- import flash.events.IEventDispatcher;
- import flash.utils.Dictionary;
-
- import mx.rpc.events.FaultEvent;
- import mx.rpc.events.ResultEvent;
-
- public class Respond // not getting garbage collected in flex 4
- {
- public var service:IEventDispatcher;
- public var data:*;
- public var handlers:Dictionary;
- public var autoClean:Boolean = true;
- public var uid:String = Math.random().toString();
- public var cleaned:Boolean = false;
-
- public function Respond(service:IEventDispatcher, data:*=null, autoClean:Boolean = true)
- {
- this.service = service;
- this.data = data;
- this.autoClean = autoClean;
- handlers = new Dictionary(true);
- }
-
- public function listen(type:String, handler:Function):void
- {
- service.addEventListener(type, this.callback);
- handlers[type] = handler;
- }
-
- public function result(handler:Function):void
- {
- listen(ResultEvent.RESULT, handler);
- }
-
- public function fault(handler:Function):void
- {
- listen(FaultEvent.FAULT, handler);
- }
-
- protected function callback(event:Event):void
- {
- if (cleaned) return;
-
- var handler:Function = handlers[event.type];
-
- try
- {
- handler(event, this);
- }
-
- catch (mainError:ArgumentError)
- {
- try
- {
- handler(event);
- }
- catch (subError:ArgumentError)
- {
- throw new Error("Could not determine how to call handler for event " + event.type);
- }
- }
-
- if (autoClean)
- clean();
-
- else
- remove(event.type);
- }
-
- public function clean():void
- {
- for (var type:String in handlers)
- remove(type);
-
- service = null;
- data = null;
- handlers = null;
-
- cleaned = true;
- }
-
- public function remove(type:String):void
- {
- delete handlers[type];
- service.removeEventListener(type, this.callback);
- }
-
- }
-}

0 comments on commit bdbf9af

Please sign in to comment.