├── .gitignore ├── .gitmodules ├── .rvmrc ├── Boiler ├── .gitignore ├── Boiler.iml ├── LICENSE └── src │ └── main │ └── boiler │ └── base │ ├── Configurations.as │ ├── Lifetime.as │ ├── configuration │ ├── Configuration.as │ └── ConfigurationBase.as │ └── errors │ └── TeardownAlreadyRunError.as ├── BoilerReflection ├── BoilerReflection.iml └── src │ ├── main │ └── boiler │ │ └── reflection │ │ ├── ClassByInstanceCache.as │ │ ├── Reflection.as │ │ ├── ReflectionBase.as │ │ ├── Reflector.as │ │ └── helpers │ │ ├── EventClassHelper.as │ │ └── EventClassNotSimpleError.as │ └── test │ └── boiler │ ├── fixtures │ └── boiler │ │ └── reflection │ │ ├── EmptyClass.as │ │ └── EmptyClassWithMetadata.as │ └── reflection │ └── ReflectionCase.as ├── Boiler_rash.ipr ├── Boiler_rash.iws ├── FlickrGallerySample ├── FlickrGallerySample.iml ├── libs │ ├── assets │ │ └── flowerSpin.swf │ ├── com │ │ ├── adobe │ │ │ ├── crypto │ │ │ │ ├── HMAC.as │ │ │ │ ├── MD5.as │ │ │ │ ├── MD5Stream.as │ │ │ │ ├── SHA1.as │ │ │ │ ├── SHA224.as │ │ │ │ ├── SHA256.as │ │ │ │ └── WSSEUsernameToken.as │ │ │ ├── net │ │ │ │ ├── DynamicURLLoader.as │ │ │ │ ├── IURIResolver.as │ │ │ │ ├── MimeTypeMap.as │ │ │ │ ├── URI.as │ │ │ │ ├── URIEncodingBitmap.as │ │ │ │ └── proxies │ │ │ │ │ └── RFC2817Socket.as │ │ │ ├── utils │ │ │ │ ├── ArrayUtil.as │ │ │ │ ├── DateUtil.as │ │ │ │ ├── DictionaryUtil.as │ │ │ │ ├── IntUtil.as │ │ │ │ ├── NumberFormatter.as │ │ │ │ ├── StringUtil.as │ │ │ │ └── XMLUtil.as │ │ │ └── webapis │ │ │ │ ├── ServiceBase.as │ │ │ │ ├── URLLoaderBase.as │ │ │ │ ├── events │ │ │ │ └── ServiceEvent.as │ │ │ │ └── flickr │ │ │ │ ├── AuthPerm.as │ │ │ │ ├── AuthResult.as │ │ │ │ ├── Blog.as │ │ │ │ ├── Category.as │ │ │ │ ├── ContentType.as │ │ │ │ ├── FlickrError.as │ │ │ │ ├── FlickrService.as │ │ │ │ ├── Group.as │ │ │ │ ├── License.as │ │ │ │ ├── NameValuePair.as │ │ │ │ ├── PagedGroupList.as │ │ │ │ ├── PagedPhotoList.as │ │ │ │ ├── Permission.as │ │ │ │ ├── Photo.as │ │ │ │ ├── PhotoContext.as │ │ │ │ ├── PhotoCount.as │ │ │ │ ├── PhotoExif.as │ │ │ │ ├── PhotoNote.as │ │ │ │ ├── PhotoPool.as │ │ │ │ ├── PhotoSet.as │ │ │ │ ├── PhotoSize.as │ │ │ │ ├── PhotoTag.as │ │ │ │ ├── PhotoUrl.as │ │ │ │ ├── SafetyLevel.as │ │ │ │ ├── UploadTicket.as │ │ │ │ ├── User.as │ │ │ │ ├── authorization │ │ │ │ ├── AuthorizationView.mxml │ │ │ │ ├── AuthorizationViewClass.as │ │ │ │ ├── FlickrAuthorizationSettings.as │ │ │ │ └── events │ │ │ │ │ └── AuthorizationEvent.as │ │ │ │ ├── events │ │ │ │ └── FlickrResultEvent.as │ │ │ │ ├── flickrservice_internal.as │ │ │ │ └── methodgroups │ │ │ │ ├── Auth.as │ │ │ │ ├── Blogs.as │ │ │ │ ├── Contacts.as │ │ │ │ ├── Favorites.as │ │ │ │ ├── Groups.as │ │ │ │ ├── Interestingness.as │ │ │ │ ├── Licenses.as │ │ │ │ ├── MethodGroupHelper.as │ │ │ │ ├── Notes.as │ │ │ │ ├── People.as │ │ │ │ ├── PhotoSets.as │ │ │ │ ├── Photos.as │ │ │ │ ├── Pools.as │ │ │ │ ├── Tags.as │ │ │ │ ├── Test.as │ │ │ │ ├── Transform.as │ │ │ │ ├── Upload.as │ │ │ │ ├── Urls.as │ │ │ │ └── helpers │ │ │ │ └── PhotoSearchParams.as │ │ └── joelhooks │ │ │ └── display │ │ │ ├── ImageSwap.mxml │ │ │ └── SmoothImage.as │ └── gs │ │ └── TweenLite.as └── src │ └── main │ ├── BoilerFlickrGallery.mxml │ ├── assets │ ├── RobotLegsLogoSmallWeb.png │ └── gallery │ │ ├── gallery.xml │ │ └── images │ │ ├── 3354402351_cf6797c126.jpg │ │ ├── 3354402351_cf6797c126_s.jpg │ │ ├── 3355136923_3cbe01c482.jpg │ │ ├── 3355136923_3cbe01c482_s.jpg │ │ ├── 3355221976_f13d8e95dc.jpg │ │ ├── 3355221976_f13d8e95dc_s.jpg │ │ ├── 3355226494_07dab9ba54.jpg │ │ ├── 3355226494_07dab9ba54_s.jpg │ │ ├── 3355957414_bfc397beb4.jpg │ │ ├── 3355957414_bfc397beb4_s.jpg │ │ ├── 3453670271_3cd0f7458b.jpg │ │ ├── 3453670271_3cd0f7458b_s.jpg │ │ ├── 3735191063_6b55d6010d.jpg │ │ ├── 3735191063_6b55d6010d_s.jpg │ │ ├── 3792349339_00000ffb7a.jpg │ │ ├── 3792349339_00000ffb7a_s.jpg │ │ ├── 3793129323_9defc51d63.jpg │ │ ├── 3793129323_9defc51d63_s.jpg │ │ ├── 3793975106_96ed4211d2.jpg │ │ ├── 3793975106_96ed4211d2_s.jpg │ │ ├── 3793984180_22a64b96d5.jpg │ │ ├── 3793984180_22a64b96d5_s.jpg │ │ ├── 3857050268_1e7037cb0e.jpg │ │ └── 3857050268_1e7037cb0e_s.jpg │ └── org │ └── robotlegs │ └── demos │ └── imagegallery │ ├── configuration │ └── FlickrGalleryConfiguration.as │ ├── controller │ ├── GalleryController.as │ ├── LoadGalleryEvent.as │ ├── SearchGalleryEvent.as │ ├── SelectImageEvent.as │ └── SelectedImageController.as │ ├── models │ ├── GalleryModel.as │ └── vo │ │ ├── Gallery.as │ │ └── GalleryImage.as │ ├── remote │ └── services │ │ ├── FlickrImageService.as │ │ ├── GalleryLoadedEvent.as │ │ ├── IGalleryImageService.as │ │ └── XMLImageService.as │ └── views │ ├── components │ ├── GalleryHeader.mxml │ ├── GalleryLabel.mxml │ ├── GallerySearch.mxml │ ├── GalleryView.mxml │ └── renderers │ │ └── GalleryImageThumbnailItemRenderer.mxml │ └── mediators │ ├── GalleryLabelMediator.as │ ├── GallerySearchMediator.as │ └── GalleryViewMediator.as ├── Gemfile ├── Gemfile.lock ├── GoogleMapsSample ├── libs │ └── map_flex_1_20.swc └── src │ ├── BoilerGoogleMapsSample.mxml │ └── boiler │ └── demos │ └── googlemaps │ ├── configuration │ └── GoogleMapsSampleConfiguration.as │ ├── controller │ ├── MarkersController.as │ └── events │ │ ├── MarkersListRetrievedEvent.as │ │ └── RetrieveMarkersListEvent.as │ ├── model │ ├── MarkersListModel.as │ ├── constants │ │ └── ApplicationConstants.as │ └── vos │ │ └── MarkerVO.as │ ├── service │ ├── EmbeddedXMLMarkersDataRetrieverService.as │ ├── IMarkersDataRetrieverService.as │ └── parsers │ │ ├── IMarkersDataParser.as │ │ └── XMLMarkersDataParser.as │ └── view │ ├── components │ └── GoogleMapsView.mxml │ └── mediators │ └── GoogleMapsMediator.as ├── HookableSuspenders ├── HookableSuspenders.iml ├── LICENSE └── src │ └── main │ └── hookableSuspenders │ ├── HookableInjector.as │ ├── InstanceHandlerCollection.as │ ├── MappingHandlerCollection.as │ ├── errors │ ├── NotAMappingHandlerError.as │ └── NotAnInstanceHandlerError.as │ └── handlers │ ├── instance │ ├── AfterInstanceHandler.as │ └── BeforeInstanceHandler.as │ └── mapping │ ├── AfterMapClassHandler.as │ ├── AfterMapSingletonHandler.as │ ├── AfterMapValueHandler.as │ ├── BeforeMapClassHandler.as │ ├── BeforeMapSingletonHandler.as │ └── BeforeMapValueHandler.as ├── LICENSE ├── README.markdown ├── Steam ├── README.textile ├── Steam.iml └── src │ ├── main │ └── boiler │ │ └── steam │ │ ├── SteamConfiguration.as │ │ ├── configuration │ │ ├── ControllerConfiguration.as │ │ ├── DispatcherConfiguration.as │ │ ├── MediatorConfiguration.as │ │ ├── NotifierConfiguration.as │ │ ├── ReflectionConfiguration.as │ │ └── StageObserverConfiguration.as │ │ ├── controller │ │ ├── ControllerDetector.as │ │ ├── ControllerExtension.as │ │ ├── ControllerMethodMapper.as │ │ ├── DefaultControllerDetector.as │ │ └── DefaultControllerMethodMapper.as │ │ ├── dispatcher │ │ ├── Dispatcher.as │ │ ├── EventBasedDispatcher.as │ │ └── EventBasedNotifierConnector.as │ │ ├── mediator │ │ ├── DefaultMediatorDetector.as │ │ ├── MediatorDetector.as │ │ ├── MediatorExtension.as │ │ ├── MediatorSugar.as │ │ ├── ViewInstanceHandler.as │ │ └── map │ │ │ ├── MediatorFactory.as │ │ │ ├── MediatorMap.as │ │ │ └── MediatorMapImpl.as │ │ ├── notifier │ │ └── NotifierExtension.as │ │ └── stageObserver │ │ ├── StageObserver.as │ │ ├── StageObserverHandler.as │ │ └── StageObserverImpl.as │ └── test │ ├── boiler │ └── steam │ │ └── controller │ │ └── DefaultControllerDetectorCase.as │ └── fixtures │ └── boiler │ └── steam │ └── detector │ ├── ByClassNameController.as │ ├── ControllerByMetadata.as │ ├── controller │ ├── ControllerByNamespace.as │ └── subNamespace │ │ └── ControllerByParentNamespace.as │ └── notController │ └── NotAControllerAtAll.as ├── StopwatchSampleApp ├── StopwatchSampleApp.iml └── src │ └── main │ ├── StopwatchSampleApp.mxml │ ├── StopwatchSampleAppInitializer.as │ ├── configuration │ └── StopwatchConfiguration.as │ ├── controller │ ├── StopwatchController.as │ └── ToggleStartStopEvent.as │ ├── model │ ├── StopwatchStateUpdatedEvent.as │ └── StopwatchTimeModel.as │ └── view │ ├── ElapsedTime.mxml │ ├── ElapsedTimeMediator.as │ ├── StartStopButton.mxml │ └── StartStopButtonMediator.as ├── buildfile ├── test-libs ├── flexunit-4.0.0.swc ├── flexunit-cilistener-4.0.0.swc ├── flexunit-uilistener-4.0.0.swc └── hamcrest-1.0.2.swc ├── todo.markdown └── vendor ├── .gitignore └── SwiftSuspenders.iml /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | out 3 | .DS_Store 4 | .bundle 5 | .rvmrc 6 | **/target/* 7 | Boiler/reports/* 8 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "vendor/SwiftSuspenders"] 2 | path = vendor/SwiftSuspenders 3 | url = https://github.com/tschneidereit/SwiftSuspenders.git 4 | -------------------------------------------------------------------------------- /.rvmrc: -------------------------------------------------------------------------------- 1 | rvm 1.9.2 -------------------------------------------------------------------------------- /Boiler/.gitignore: -------------------------------------------------------------------------------- 1 | target -------------------------------------------------------------------------------- /Boiler/Boiler.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Boiler/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 Rasheed Abdul-Aziz 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /Boiler/src/main/boiler/base/Configurations.as: -------------------------------------------------------------------------------- 1 | package boiler.base { 2 | import boiler.base.configuration.Configuration; 3 | import boiler.base.errors.TeardownAlreadyRunError; 4 | 5 | internal class Configurations { 6 | 7 | private var lifetime:Lifetime; 8 | private var configurations:Array; 9 | private var teardownConfigurations:Array; 10 | 11 | public function Configurations(lifetime:Lifetime) { 12 | this.lifetime = lifetime; 13 | configurations = []; 14 | teardownConfigurations = []; 15 | } 16 | 17 | /** 18 | * @todo I'm not sure this unfolds the teardowns correctly. Might need to store a tree instead. 19 | * @param configuration 20 | */ 21 | public function run(configuration:*):void { 22 | var configurationInstance:Configuration = ensureInstance(configuration); 23 | 24 | configurations.push(configurationInstance); 25 | startConfiguration(configurationInstance); 26 | teardownConfigurations.push(configurations.pop()); 27 | 28 | } 29 | 30 | private function startConfiguration(configurationInstance:Configuration):void { 31 | lifetime.injectInto(configurationInstance); 32 | configurationInstance.startup(); 33 | } 34 | 35 | private function ensureInstance(configuration:*):Configuration { 36 | if (configuration is Configuration) 37 | return configuration; 38 | 39 | return Configuration(new configuration()); 40 | } 41 | 42 | public function teardown():void { 43 | if (teardownConfigurations == null) 44 | throw new TeardownAlreadyRunError(); 45 | 46 | while (teardownConfigurations.length > 0) { 47 | teardownNextConfiguration(); 48 | } 49 | 50 | teardownConfigurations = null; 51 | } 52 | 53 | private function teardownNextConfiguration():void { 54 | var handler:Configuration = teardownConfigurations.shift(); 55 | handler.teardown(); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Boiler/src/main/boiler/base/Lifetime.as: -------------------------------------------------------------------------------- 1 | package boiler.base { 2 | import hookableSuspenders.HookableInjector; 3 | 4 | /** 5 | * Lifetime is a SwistSuspenders/HookableSuspenders Injector with setup/teardown configuration support 6 | * built in. 7 | * 8 | * It embodies the concept of the boiler::base framework, which is that a simple extensible 9 | * architecture can be built out of a DIContainer that supports pre-post hooks and a simple configuration 10 | * scheme. 11 | * 12 | * By design, you cannot add methods to Lifetime 13 | * 14 | * To extend the framework, use Configurations and let the end user (app developer) choose to include them. 15 | * 16 | * In avoiding methods, you leave other frameworks and consumers the opportunity to add extensions of their own 17 | * without running into multiple-inheritence issues. For more details, see the Boiler documentation and website. 18 | */ 19 | public final class Lifetime extends HookableInjector { 20 | private var configurations:Configurations; 21 | private var _initialConfiguration:*; 22 | 23 | public function Lifetime(xmlConfig:XML = null) { 24 | super(xmlConfig); 25 | mapValue(Lifetime, this); 26 | configurations = new Configurations(this); 27 | 28 | } 29 | 30 | /** 31 | * This method is for the application developer to call when they want to clean up their app/module. 32 | * 33 | * You should use this, it can give all active members of the system a chance to release handlers and garbage 34 | * collect. 35 | * 36 | * Do not use it for 'shutdown' procedures such as closing connections/streams etc. You should set up a framework 37 | * level solution such as a shutdown command, which when finished (possibly asynchronously) invokes this method. 38 | * 39 | * This method can only ever be called once per instance of lifetime. 40 | * 41 | * Framework developers should not call this method 42 | */ 43 | public function die():void { 44 | configurations.teardown(); 45 | } 46 | 47 | public function runConfiguration(configuration:*):Lifetime { 48 | configurations.run(configuration); 49 | return this; 50 | } 51 | 52 | /** 53 | * Just to make Flex dev's life a little easier. 54 | * @param value 55 | */ 56 | public function set initialConfiguration(value:*):void { 57 | if (_initialConfiguration == value) 58 | return; 59 | 60 | if (value == null) 61 | return; 62 | 63 | _initialConfiguration = value; 64 | configurations.run(_initialConfiguration); 65 | } 66 | 67 | public function get initialConfiguration():* { 68 | return _initialConfiguration; 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Boiler/src/main/boiler/base/configuration/Configuration.as: -------------------------------------------------------------------------------- 1 | package boiler.base.configuration { 2 | 3 | /** 4 | * A configuration handler is a chunk of startup and teardown code which is responsible for configuring an extension 5 | * to the system. These extensions can be framework extensions, or application extenstions. Boiler does not 6 | * discriminate. 7 | * 8 | * Configurations remain in memory until the lifetime is destroyed. 9 | * 10 | * Configurations are instanciated with SwiftSuspenders, so you can use [Inject] and [PostConstruct] in these 11 | * classes. 12 | */ 13 | public interface Configuration { 14 | 15 | /** 16 | * Configure your extension here by mapping injections, preparing any singletons and hooking into the 17 | * HopokableSuspenders before and after hooks. 18 | * You can also add further configurations to the lifetime here, giving framework developers the opportunity to 19 | * add hooks after the application developer's hooks have been added. 20 | */ 21 | function startup():void; 22 | 23 | /** 24 | * Do your cleanup here. This method is called on the same Configuration instance as it's startup, which 25 | * lets you keep state from start to finish if it's needed. 26 | */ 27 | function teardown():void; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Boiler/src/main/boiler/base/configuration/ConfigurationBase.as: -------------------------------------------------------------------------------- 1 | package boiler.base.configuration { 2 | import boiler.base.*; 3 | 4 | /** 5 | * @inherit 6 | * 7 | * ConfigurationBase adds a local #liftime instance to make life a little simpler. 8 | */ 9 | public class ConfigurationBase implements Configuration { 10 | 11 | [Inject] 12 | public var lifetime:Lifetime; 13 | 14 | /** 15 | * @inherit 16 | */ 17 | public function startup():void { 18 | } 19 | 20 | /** 21 | * @inherit 22 | */ 23 | public function teardown():void { 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Boiler/src/main/boiler/base/errors/TeardownAlreadyRunError.as: -------------------------------------------------------------------------------- 1 | package boiler.base.errors { 2 | public class TeardownAlreadyRunError extends Error { 3 | 4 | public function TeardownAlreadyRunError() { 5 | super("If you can only live once, logically, you can only die once") 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /BoilerReflection/BoilerReflection.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /BoilerReflection/src/main/boiler/reflection/ClassByInstanceCache.as: -------------------------------------------------------------------------------- 1 | package boiler.reflection { 2 | import flash.utils.Dictionary; 3 | import flash.utils.getDefinitionByName; 4 | import flash.utils.getQualifiedClassName; 5 | 6 | public class ClassByInstanceCache { 7 | 8 | private var cache:Dictionary = new Dictionary(); 9 | 10 | public function getClassByInstance(instance:Object):Class { 11 | return cache[instance] ||= getDefinitionByName(getQualifiedClassName(instance)); 12 | } 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /BoilerReflection/src/main/boiler/reflection/Reflection.as: -------------------------------------------------------------------------------- 1 | package boiler.reflection { 2 | public interface Reflection { 3 | function reflect(type:Class):Reflection; 4 | 5 | function source():Class; 6 | 7 | function type():XML; 8 | 9 | function fqn():String; 10 | 11 | function instance():XML; 12 | 13 | function hasAnyNamespace(anyNamespaceCalled:String):Boolean; 14 | 15 | function hasLeafNamespace(leafNamespaceCalled:String):Boolean; 16 | 17 | function classConstants():XMLList; 18 | 19 | function classMetadata():XMLList; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /BoilerReflection/src/main/boiler/reflection/ReflectionBase.as: -------------------------------------------------------------------------------- 1 | package boiler.reflection { 2 | import boiler.reflection.*; 3 | import flash.utils.describeType; 4 | 5 | import mx.utils.StringUtil; 6 | 7 | public class ReflectionBase implements Reflection { 8 | private var _source:Class; 9 | private var _type:XML; 10 | private var _instance:XML; 11 | private var _fqn:String; 12 | 13 | public function reflect(type:Class):Reflection { 14 | // todo this is clearly not the way to deal with types needing instances. Time to procure some help with the reflector.. 15 | // todo I like the look of the code in Fussy that does this. 16 | 17 | _source = type; 18 | 19 | _type = describeType(type); 20 | 21 | try { 22 | if (isClass()) 23 | _instance = describeType(new type()); 24 | } catch (error:Error) { 25 | trace(StringUtil.substitute( 26 | "Warning, could not read class metadata of {0} with error:\n{1}", 27 | fqn(), 28 | error.message 29 | )); 30 | } 31 | 32 | return this; 33 | } 34 | 35 | private function isClass():Boolean { 36 | return ! isInterface(); 37 | } 38 | 39 | private function isInterface():Boolean { 40 | return (_type.factory.extendsClass.length() == 0) && (_type.factory.type != "Object") 41 | 42 | } 43 | 44 | public function source():Class { 45 | return _source; 46 | } 47 | 48 | public function type():XML { 49 | return _type; 50 | } 51 | 52 | public function fqn():String { 53 | return _fqn ||= _type.@name.replace(/::/, "."); 54 | } 55 | 56 | public function instance():XML { 57 | return _instance; 58 | 59 | } 60 | 61 | // Helpers 62 | 63 | public function hasAnyNamespace(anyNamespaceCalled:String):Boolean { 64 | return (fqn().search("\\.*" + anyNamespaceCalled + "[:.]") >= 0); 65 | } 66 | 67 | public function hasLeafNamespace(leafNamespaceCalled:String):Boolean { 68 | return (fqn().search("\\.*" + leafNamespaceCalled + ":") >= 0); 69 | } 70 | 71 | public function classConstants():XMLList { 72 | 73 | return type().constant; 74 | } 75 | 76 | public function classMetadata():XMLList { 77 | return instance().metadata; 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /BoilerReflection/src/main/boiler/reflection/Reflector.as: -------------------------------------------------------------------------------- 1 | package boiler.reflection { 2 | import flash.utils.Dictionary; 3 | 4 | public class Reflector { 5 | 6 | private var reflections:Dictionary = new Dictionary(false); 7 | 8 | public function getReflection(type:Class):Reflection { 9 | return reflections[type] || addReflection(type); 10 | } 11 | 12 | private function addReflection(type:Class):Reflection { 13 | var reflection:Reflection = new ReflectionBase(); 14 | reflections[type] = reflection.reflect(type); 15 | return reflection; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /BoilerReflection/src/main/boiler/reflection/helpers/EventClassHelper.as: -------------------------------------------------------------------------------- 1 | package boiler.reflection.helpers { 2 | import boiler.reflection.helpers.*; 3 | import boiler.reflection.Reflection; 4 | import boiler.reflection.Reflector; 5 | 6 | public class EventClassHelper { 7 | 8 | [Inject] 9 | public var reflector:Reflector; 10 | 11 | /** 12 | * Finds the 'type' of a simple event. A simple event is one with only once Constant definition. 13 | * @param eventClass 14 | * @return 15 | */ 16 | public function findSimpleEventType(eventClass:Class):String { 17 | var reflection:Reflection = reflector.getReflection(eventClass); 18 | 19 | const classConstants:XMLList = reflection.classConstants(); 20 | 21 | if (classConstants.length() != 1) 22 | throw new EventClassNotSimpleError(reflection.fqn()); 23 | 24 | var soleConstantName:String = classConstants[0].@name; 25 | return eventClass[soleConstantName]; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /BoilerReflection/src/main/boiler/reflection/helpers/EventClassNotSimpleError.as: -------------------------------------------------------------------------------- 1 | package boiler.reflection.helpers { 2 | import mx.utils.StringUtil; 3 | 4 | public class EventClassNotSimpleError extends Error { 5 | public function EventClassNotSimpleError(className:String) { 6 | super( 7 | StringUtil.substitute( 8 | "Events registered for dispatch must be 'Simple'. {0} is not simple. " + 9 | "It must have only one class constant", 10 | className 11 | ), 12 | 7825354238912 13 | ); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /BoilerReflection/src/test/boiler/fixtures/boiler/reflection/EmptyClass.as: -------------------------------------------------------------------------------- 1 | package boiler.fixtures.boiler.reflection { 2 | public class EmptyClass { 3 | public function EmptyClass() { 4 | } 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /BoilerReflection/src/test/boiler/fixtures/boiler/reflection/EmptyClassWithMetadata.as: -------------------------------------------------------------------------------- 1 | package boiler.fixtures.boiler.reflection { 2 | 3 | /** 4 | * An empty class with class metadata 5 | */ 6 | [Controller] 7 | public class EmptyClassWithMetadata { 8 | 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /BoilerReflection/src/test/boiler/reflection/ReflectionCase.as: -------------------------------------------------------------------------------- 1 | package boiler.reflection { 2 | import boiler.fixtures.boiler.reflection.EmptyClass; 3 | import boiler.fixtures.boiler.reflection.EmptyClassWithMetadata; 4 | 5 | import org.flexunit.asserts.assertFalse; 6 | import org.flexunit.asserts.assertNotNull; 7 | import org.hamcrest.assertThat; 8 | import org.hamcrest.number.greaterThan; 9 | 10 | public class ReflectionCase { 11 | 12 | private var reflection:Reflection; 13 | 14 | [Before] 15 | public function setup():void { 16 | reflection = new ReflectionBase(); 17 | } 18 | 19 | [After] 20 | public function teardown():void { 21 | reflection = null; 22 | } 23 | 24 | [Test( 25 | given="An empty class with class metadata", 26 | it="Has class instance xml" 27 | )] 28 | public function ItHasClassInstanceXML():void { 29 | withAnEmptyClassWithMetadata(); 30 | 31 | assertNotNull(reflection.instance()); 32 | } 33 | 34 | [Test( 35 | given="An empty class with class metadata", 36 | it="Has class Metadata" 37 | )] 38 | public function ItHasClassMetadata():void { 39 | withAnEmptyClassWithMetadata(); 40 | 41 | assertThat(reflection.classMetadata().length(), greaterThan(0)); 42 | } 43 | 44 | [Test( 45 | given="An empty class with a namespace", 46 | it="Can find the leaf namespace" 47 | )] 48 | public function ItCanFindTheLeafNamespace():void { 49 | withAnEmptyClass(); 50 | assertThat(reflection.hasLeafNamespace("reflection")); 51 | } 52 | 53 | [Test( 54 | given="An empty class with a namespace", 55 | it="Does not find a non-existant leaf namespace" 56 | )] 57 | public function ItDoesNotFindANonExistantLeafNamespace():void { 58 | withAnEmptyClass(); 59 | assertFalse(reflection.hasLeafNamespace("notanamespace")); 60 | } 61 | 62 | [Test( 63 | given="An empty class with a namespace", 64 | it="Can find a non-leaf namespace" 65 | )] 66 | public function ItCanFindANonLeafNamespace():void { 67 | withAnEmptyClass(); 68 | assertThat(reflection.hasAnyNamespace("fixtures")); 69 | 70 | } 71 | 72 | [Test( 73 | given="An empty class with a namespace", 74 | it="Does not find a non-existant non-leaf namespace" 75 | )] 76 | public function ItDoesNotFindANonExistantNonLeafNamespace():void { 77 | withAnEmptyClass(); 78 | assertFalse(reflection.hasAnyNamespace("notanamespace")); 79 | 80 | } 81 | 82 | //*********** Givens ***********// 83 | 84 | private function withAnEmptyClassWithMetadata():void { 85 | reflection.reflect(EmptyClassWithMetadata); 86 | } 87 | 88 | private function withAnEmptyClass():void { 89 | reflection.reflect(EmptyClass); 90 | } 91 | 92 | } 93 | } 94 | 95 | 96 | -------------------------------------------------------------------------------- /FlickrGallerySample/FlickrGallerySample.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /FlickrGallerySample/libs/assets/flowerSpin.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/squeedee/Boiler/3f243a4c8738ea91bd60d8ed087b7344e046d733/FlickrGallerySample/libs/assets/flowerSpin.swf -------------------------------------------------------------------------------- /FlickrGallerySample/libs/com/adobe/net/DynamicURLLoader.as: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008, Adobe Systems Incorporated 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are 7 | met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, 10 | this list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | 16 | * Neither the name of Adobe Systems Incorporated nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | package com.adobe.net 34 | { 35 | import flash.net.URLLoader; 36 | 37 | /** 38 | * Class that provides a dynamic implimentation of the URLLoader class. 39 | * 40 | * This class provides no API implimentations. However, since the class is 41 | * declared as dynamic, it can be used in place of URLLoader, and allow 42 | * you to dynamically attach properties to it (which URLLoader does not allow). 43 | * 44 | * @langversion ActionScript 3.0 45 | * @playerversion Flash 9.0 46 | * @tiptext 47 | */ 48 | public dynamic class DynamicURLLoader extends URLLoader 49 | { 50 | public function DynamicURLLoader() 51 | { 52 | super(); 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /FlickrGallerySample/libs/com/adobe/net/IURIResolver.as: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008, Adobe Systems Incorporated 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are 7 | met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, 10 | this list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | 16 | * Neither the name of Adobe Systems Incorporated nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | package com.adobe.net 34 | { 35 | /** 36 | * The URI class cannot know about DNS aliases, virtual hosts, or 37 | * symbolic links that may be involved. The application can provide 38 | * an implementation of this interface to resolve the URI before the 39 | * URI class makes any comparisons. For example, a web host has 40 | * two aliases: 41 | * 42 | *

43 | * http://www.site.com/ 44 | * http://www.site.net/ 45 | *

46 | * 47 | *

The application can provide an implementation that automatically 48 | * resolves site.net to site.com before URI compares two URI objects. 49 | * Only the application can know and understand the context in which 50 | * the URI's are being used.

51 | * 52 | *

Use the URI.resolver accessor to assign a custom resolver to 53 | * the URI class. Any resolver specified is global to all instances 54 | * of URI.

55 | * 56 | *

URI will call this before performing URI comparisons in the 57 | * URI.getRelation() and URI.getCommonParent() functions. 58 | * 59 | * @see URI.getRelation 60 | * @see URI.getCommonParent 61 | * 62 | * @langversion ActionScript 3.0 63 | * @playerversion Flash 9.0 64 | */ 65 | public interface IURIResolver 66 | { 67 | /** 68 | * Implement this method to provide custom URI resolution for 69 | * your application. 70 | * 71 | * @langversion ActionScript 3.0 72 | * @playerversion Flash 9.0 73 | */ 74 | function resolve(uri:URI) : URI; 75 | } 76 | } -------------------------------------------------------------------------------- /FlickrGallerySample/libs/com/adobe/utils/DictionaryUtil.as: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008, Adobe Systems Incorporated 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are 7 | met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, 10 | this list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | 16 | * Neither the name of Adobe Systems Incorporated nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | package com.adobe.utils 34 | { 35 | import flash.utils.Dictionary; 36 | 37 | public class DictionaryUtil 38 | { 39 | 40 | /** 41 | * Returns an Array of all keys within the specified dictionary. 42 | * 43 | * @param d The Dictionary instance whose keys will be returned. 44 | * 45 | * @return Array of keys contained within the Dictionary 46 | * 47 | * @langversion ActionScript 3.0 48 | * @playerversion Flash 9.0 49 | * @tiptext 50 | */ 51 | public static function getKeys(d:Dictionary):Array 52 | { 53 | var a:Array = new Array(); 54 | 55 | for (var key:Object in d) 56 | { 57 | a.push(key); 58 | } 59 | 60 | return a; 61 | } 62 | 63 | /** 64 | * Returns an Array of all values within the specified dictionary. 65 | * 66 | * @param d The Dictionary instance whose values will be returned. 67 | * 68 | * @return Array of values contained within the Dictionary 69 | * 70 | * @langversion ActionScript 3.0 71 | * @playerversion Flash 9.0 72 | * @tiptext 73 | */ 74 | public static function getValues(d:Dictionary):Array 75 | { 76 | var a:Array = new Array(); 77 | 78 | for each (var value:Object in d) 79 | { 80 | a.push(value); 81 | } 82 | 83 | return a; 84 | } 85 | 86 | } 87 | } -------------------------------------------------------------------------------- /FlickrGallerySample/libs/com/adobe/utils/IntUtil.as: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008, Adobe Systems Incorporated 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are 7 | met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, 10 | this list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | 16 | * Neither the name of Adobe Systems Incorporated nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | package com.adobe.utils { 33 | 34 | import flash.utils.Endian; 35 | 36 | /** 37 | * Contains reusable methods for operations pertaining 38 | * to int values. 39 | */ 40 | public class IntUtil { 41 | 42 | /** 43 | * Rotates x left n bits 44 | * 45 | * @langversion ActionScript 3.0 46 | * @playerversion Flash 9.0 47 | * @tiptext 48 | */ 49 | public static function rol ( x:int, n:int ):int { 50 | return ( x << n ) | ( x >>> ( 32 - n ) ); 51 | } 52 | 53 | /** 54 | * Rotates x right n bits 55 | * 56 | * @langversion ActionScript 3.0 57 | * @playerversion Flash 9.0 58 | * @tiptext 59 | */ 60 | public static function ror ( x:int, n:int ):uint { 61 | var nn:int = 32 - n; 62 | return ( x << nn ) | ( x >>> ( 32 - nn ) ); 63 | } 64 | 65 | /** String for quick lookup of a hex character based on index */ 66 | private static var hexChars:String = "0123456789abcdef"; 67 | 68 | /** 69 | * Outputs the hex value of a int, allowing the developer to specify 70 | * the endinaness in the process. Hex output is lowercase. 71 | * 72 | * @param n The int value to output as hex 73 | * @param bigEndian Flag to output the int as big or little endian 74 | * @return A string of length 8 corresponding to the 75 | * hex representation of n ( minus the leading "0x" ) 76 | * @langversion ActionScript 3.0 77 | * @playerversion Flash 9.0 78 | * @tiptext 79 | */ 80 | public static function toHex( n:int, bigEndian:Boolean = false ):String { 81 | var s:String = ""; 82 | 83 | if ( bigEndian ) { 84 | for ( var i:int = 0; i < 4; i++ ) { 85 | s += hexChars.charAt( ( n >> ( ( 3 - i ) * 8 + 4 ) ) & 0xF ) 86 | + hexChars.charAt( ( n >> ( ( 3 - i ) * 8 ) ) & 0xF ); 87 | } 88 | } else { 89 | for ( var x:int = 0; x < 4; x++ ) { 90 | s += hexChars.charAt( ( n >> ( x * 8 + 4 ) ) & 0xF ) 91 | + hexChars.charAt( ( n >> ( x * 8 ) ) & 0xF ); 92 | } 93 | } 94 | 95 | return s; 96 | } 97 | } 98 | 99 | } -------------------------------------------------------------------------------- /FlickrGallerySample/libs/com/adobe/utils/NumberFormatter.as: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008, Adobe Systems Incorporated 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are 7 | met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, 10 | this list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | 16 | * Neither the name of Adobe Systems Incorporated nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | package com.adobe.utils 34 | { 35 | 36 | /** 37 | * Class that contains static utility methods for formatting Numbers 38 | * 39 | * @langversion ActionScript 3.0 40 | * @playerversion Flash 9.0 41 | * @tiptext 42 | * 43 | * @see #mx.formatters.NumberFormatter 44 | */ 45 | public class NumberFormatter 46 | { 47 | 48 | /** 49 | * Formats a number to include a leading zero if it is a single digit 50 | * between -1 and 10. 51 | * 52 | * @param n The number that will be formatted 53 | * 54 | * @return A string with single digits between -1 and 10 padded with a 55 | * leading zero. 56 | * 57 | * @langversion ActionScript 3.0 58 | * @playerversion Flash 9.0 59 | * @tiptext 60 | */ 61 | public static function addLeadingZero(n:Number):String 62 | { 63 | var out:String = String(n); 64 | 65 | if(n < 10 && n > -1) 66 | { 67 | out = "0" + out; 68 | } 69 | 70 | return out; 71 | } 72 | 73 | } 74 | } -------------------------------------------------------------------------------- /FlickrGallerySample/libs/com/adobe/webapis/ServiceBase.as: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008, Adobe Systems Incorporated 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are 7 | met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, 10 | this list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | 16 | * Neither the name of Adobe Systems Incorporated nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | 34 | package com.adobe.webapis 35 | { 36 | import flash.events.EventDispatcher; 37 | 38 | /** 39 | * Base class for remote service classes. 40 | */ 41 | public class ServiceBase extends EventDispatcher 42 | { 43 | public function ServiceBase() 44 | { 45 | } 46 | 47 | } 48 | } -------------------------------------------------------------------------------- /FlickrGallerySample/libs/com/adobe/webapis/events/ServiceEvent.as: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008, Adobe Systems Incorporated 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are 7 | met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, 10 | this list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | 16 | * Neither the name of Adobe Systems Incorporated nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | 34 | package com.adobe.webapis.events 35 | { 36 | 37 | import flash.events.Event; 38 | 39 | /** 40 | * Event class that contains data loaded from remote services. 41 | * 42 | * @author Mike Chambers 43 | */ 44 | public class ServiceEvent extends Event 45 | { 46 | private var _data:Object = new Object();; 47 | 48 | /** 49 | * Constructor for ServiceEvent class. 50 | * 51 | * @param type The type of event that the instance represents. 52 | */ 53 | public function ServiceEvent(type:String, bubbles:Boolean = false, 54 | cancelable:Boolean=false) 55 | { 56 | super(type, bubbles, cancelable); 57 | } 58 | 59 | /** 60 | * This object contains data loaded in response 61 | * to remote service calls, and properties associated with that call. 62 | */ 63 | public function get data():Object 64 | { 65 | return _data; 66 | } 67 | 68 | public function set data(d:Object):void 69 | { 70 | _data = d; 71 | } 72 | 73 | 74 | } 75 | } -------------------------------------------------------------------------------- /FlickrGallerySample/libs/com/adobe/webapis/flickr/AuthPerm.as: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008, Adobe Systems Incorporated 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | * Neither the name of Adobe Systems Incorporated nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | package com.adobe.webapis.flickr { 31 | 32 | /** 33 | * A class containing static members to be used for authentication 34 | * permission when authenticating against flickr.com, describing 35 | * the permission the application has on the logged in user's account. 36 | */ 37 | public class AuthPerm { 38 | 39 | /** Permission to read private information */ 40 | public static const READ:String = "read"; 41 | 42 | /** Permission to add, edit and delete photo metadata (includes READ) */ 43 | public static const WRITE:String = "write"; 44 | 45 | /** Permission to delete photos (includes WRITE and READ) */ 46 | public static const DELETE:String = "delete"; 47 | 48 | /** No permission to do anything ( not authenticated ) */ 49 | public static const NONE:String = "none"; 50 | 51 | } 52 | 53 | } -------------------------------------------------------------------------------- /FlickrGallerySample/libs/com/adobe/webapis/flickr/AuthResult.as: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008, Adobe Systems Incorporated 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | * Neither the name of Adobe Systems Incorporated nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | package com.adobe.webapis.flickr { 31 | 32 | /** 33 | * AuthResult is a ValueObject for the Flickr API. 34 | */ 35 | public class AuthResult { 36 | 37 | private var _token:String; 38 | private var _perms:String; 39 | private var _user:User; 40 | 41 | /** 42 | * Construct a new AuthResult instance 43 | * 44 | * @langversion ActionScript 3.0 45 | * @playerversion Flash 8.5 46 | * @tiptext 47 | */ 48 | public function AuthResult() { 49 | // Assume no permission 50 | perms = AuthPerm.NONE; 51 | } 52 | 53 | /** 54 | * The token for the logged in user 55 | * 56 | * @langversion ActionScript 3.0 57 | * @playerversion Flash 8.5 58 | * @tiptext 59 | */ 60 | public function get token():String { 61 | return _token; 62 | } 63 | 64 | public function set token( value:String ):void { 65 | _token = value; 66 | } 67 | 68 | /** 69 | * The permission the application has for the logged in 70 | * user's account 71 | * 72 | * @see com.adobe.webapis.flickr.AuthPerm 73 | * @langversion ActionScript 3.0 74 | * @playerversion Flash 8.5 75 | * @tiptext 76 | */ 77 | public function get perms():String { 78 | return _perms; 79 | } 80 | 81 | public function set perms( value:String ):void { 82 | _perms = value; 83 | } 84 | 85 | /** 86 | * The User that is logged in 87 | * 88 | * @langversion ActionScript 3.0 89 | * @playerversion Flash 8.5 90 | * @tiptext 91 | */ 92 | public function get user():User { 93 | return _user; 94 | } 95 | 96 | public function set user( value:User ):void { 97 | _user = value; 98 | } 99 | 100 | } 101 | 102 | } -------------------------------------------------------------------------------- /FlickrGallerySample/libs/com/adobe/webapis/flickr/Blog.as: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008, Adobe Systems Incorporated 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | * Neither the name of Adobe Systems Incorporated nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | package com.adobe.webapis.flickr { 31 | 32 | /** 33 | * Blog is a ValueObject for the Flickr API. 34 | */ 35 | public class Blog { 36 | 37 | private var _id:String; 38 | private var _name:String; 39 | private var _needsPassword:Boolean; 40 | private var _url:String; 41 | 42 | /** 43 | * Construct a new Blog instance 44 | * 45 | * @langversion ActionScript 3.0 46 | * @playerversion Flash 8.5 47 | * @tiptext 48 | */ 49 | public function Blog() { 50 | // do nothing 51 | } 52 | 53 | /** 54 | * The id of the blog 55 | * 56 | * @langversion ActionScript 3.0 57 | * @playerversion Flash 8.5 58 | * @tiptext 59 | */ 60 | public function get id():String { 61 | return _id; 62 | } 63 | 64 | public function set id( value:String ):void { 65 | _id = value; 66 | } 67 | 68 | /** 69 | * The name of the blog 70 | * 71 | * @langversion ActionScript 3.0 72 | * @playerversion Flash 8.5 73 | * @tiptext 74 | */ 75 | public function get name():String { 76 | return _name; 77 | } 78 | 79 | public function set name( value:String ):void { 80 | _name = value; 81 | } 82 | 83 | /** 84 | * Flag for if the blog requires a password 85 | * 86 | * @langversion ActionScript 3.0 87 | * @playerversion Flash 8.5 88 | * @tiptext 89 | */ 90 | public function get needsPassword():Boolean { 91 | return _needsPassword; 92 | } 93 | 94 | public function set needsPassword( value:Boolean ):void { 95 | _needsPassword = value; 96 | } 97 | 98 | /** 99 | * The URL of the blog 100 | * 101 | * @langversion ActionScript 3.0 102 | * @playerversion Flash 8.5 103 | * @tiptext 104 | */ 105 | public function get url():String { 106 | return _url; 107 | } 108 | 109 | public function set url( value:String ):void { 110 | _url = value; 111 | } 112 | 113 | } 114 | } -------------------------------------------------------------------------------- /FlickrGallerySample/libs/com/adobe/webapis/flickr/ContentType.as: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008, Adobe Systems Incorporated 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | * Neither the name of Adobe Systems Incorporated nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | package com.adobe.webapis.flickr { 31 | 32 | /** 33 | * Constants for the type of a photo for uploading. 34 | */ 35 | public class ContentType { 36 | 37 | public static const DEFAULT:int = 0; 38 | 39 | public static const PHOTO:int = 1; 40 | 41 | public static const SCREENSHOT:int = 2; 42 | 43 | public static const OTHER:int = 3; 44 | 45 | } 46 | 47 | } -------------------------------------------------------------------------------- /FlickrGallerySample/libs/com/adobe/webapis/flickr/License.as: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008, Adobe Systems Incorporated 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | * Neither the name of Adobe Systems Incorporated nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | package com.adobe.webapis.flickr { 31 | 32 | /** 33 | * License is a ValueObject for the Flickr API. 34 | * 35 | * There are also static constants to map license 36 | * numbers to name values and make code more readable. 37 | */ 38 | public class License { 39 | 40 | public static const ALL_RIGHTS_RESERVED:int = 0; 41 | 42 | public static const ATTRIBUTION:int = 4; 43 | 44 | public static const ATTRIBUTION_NODERIVS:int = 6; 45 | 46 | public static const ATTRIBUTION_NONCOMMERCIAL_NODERIVS:int = 3; 47 | 48 | public static const ATTRIBUTION_NONCOMMERCIAL:int = 2; 49 | 50 | public static const ATTRIBUTION_NONCOMMERCIAL_SHAREALIKE:int = 1; 51 | 52 | public static const ATTRIBUTION_SHAREALIKE:int = 5; 53 | 54 | private var _id:int; 55 | private var _name:String; 56 | private var _url:String; 57 | 58 | /** 59 | * Construct a new License instance 60 | * 61 | * @langversion ActionScript 3.0 62 | * @playerversion Flash 8.5 63 | * @tiptext 64 | */ 65 | public function License() { 66 | // do nothing 67 | } 68 | 69 | /** 70 | * The id of the license 71 | * 72 | * @langversion ActionScript 3.0 73 | * @playerversion Flash 8.5 74 | * @tiptext 75 | */ 76 | public function get id():int { 77 | return _id; 78 | } 79 | 80 | public function set id( value:int ):void { 81 | _id = value; 82 | } 83 | 84 | /** 85 | * The name of the license 86 | * 87 | * @langversion ActionScript 3.0 88 | * @playerversion Flash 8.5 89 | * @tiptext 90 | */ 91 | public function get name():String { 92 | return _name; 93 | } 94 | 95 | public function set name( value:String ):void { 96 | _name = value; 97 | } 98 | 99 | /** 100 | * The url of the license 101 | * 102 | * @langversion ActionScript 3.0 103 | * @playerversion Flash 8.5 104 | * @tiptext 105 | */ 106 | public function get url():String { 107 | return _url; 108 | } 109 | 110 | public function set url( value:String ):void { 111 | _url = value; 112 | } 113 | 114 | } 115 | 116 | } -------------------------------------------------------------------------------- /FlickrGallerySample/libs/com/adobe/webapis/flickr/NameValuePair.as: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008, Adobe Systems Incorporated 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | * Neither the name of Adobe Systems Incorporated nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | package com.adobe.webapis.flickr { 31 | 32 | /** 33 | * NameValuePair is an object containing a key/value 34 | * combination. 35 | */ 36 | public class NameValuePair { 37 | 38 | private var _name:String; 39 | private var _value:String; 40 | 41 | /** 42 | * Construct a new name value pair 43 | * 44 | * @langversion ActionScript 3.0 45 | * @playerversion Flash 8.5 46 | * @tiptext 47 | */ 48 | public function NameValuePair( name:String = "", value:String = "" ) { 49 | _name = name; 50 | _value = value; 51 | } 52 | 53 | /** 54 | * Returns the name 55 | * 56 | * @langversion ActionScript 3.0 57 | * @playerversion Flash 8.5 58 | * @tiptext 59 | */ 60 | public function get name():String { 61 | return _name; 62 | } 63 | 64 | /** 65 | * Sets the name 66 | * 67 | * @langversion ActionScript 3.0 68 | * @playerversion Flash 8.5 69 | * @tiptext 70 | */ 71 | public function set name( value:String ):void { 72 | _name = value; 73 | } 74 | 75 | /** 76 | * Returns the value 77 | * 78 | * @langversion ActionScript 3.0 79 | * @playerversion Flash 8.5 80 | * @tiptext 81 | */ 82 | public function get value():String { 83 | return _value; 84 | } 85 | 86 | /** 87 | * Sets the value 88 | * 89 | * @langversion ActionScript 3.0 90 | * @playerversion Flash 8.5 91 | * @tiptext 92 | */ 93 | public function set value( v:String ):void { 94 | _value = v; 95 | } 96 | } 97 | 98 | } -------------------------------------------------------------------------------- /FlickrGallerySample/libs/com/adobe/webapis/flickr/Permission.as: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008, Adobe Systems Incorporated 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | * Neither the name of Adobe Systems Incorporated nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | package com.adobe.webapis.flickr { 31 | 32 | /** 33 | * Constants for setting permission of a photo - who can comment 34 | * and add meta data to the photo and it's notes. 35 | */ 36 | public class Permission { 37 | 38 | public static const ONLY_OWNER:int = 0; 39 | 40 | public static const FRIENDS_AND_FAMILY:int = 1; 41 | 42 | public static const CONTACTS:int = 2; 43 | 44 | public static const EVERYBODY:int = 3; 45 | 46 | } 47 | 48 | } -------------------------------------------------------------------------------- /FlickrGallerySample/libs/com/adobe/webapis/flickr/PhotoContext.as: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008, Adobe Systems Incorporated 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | * Neither the name of Adobe Systems Incorporated nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | package com.adobe.webapis.flickr { 31 | 32 | /** 33 | * PhotoContext is a ValueObject for the Flickr API. 34 | */ 35 | public class PhotoContext { 36 | 37 | private var _sets:Array; 38 | private var _pools:Array; 39 | 40 | /** 41 | * Construct a new PhotoContext instance 42 | * 43 | * @langversion ActionScript 3.0 44 | * @playerversion Flash 8.5 45 | * @tiptext 46 | */ 47 | public function PhotoContext() { 48 | _sets = new Array(); 49 | _pools = new Array(); 50 | } 51 | 52 | /** 53 | * The sets of the photo 54 | * 55 | * @langversion ActionScript 3.0 56 | * @playerversion Flash 8.5 57 | * @tiptext 58 | */ 59 | public function get sets():Array { 60 | return _sets; 61 | } 62 | 63 | public function set sets( value:Array ):void { 64 | _sets = value; 65 | } 66 | 67 | /** 68 | * The pools of the photo 69 | * 70 | * @langversion ActionScript 3.0 71 | * @playerversion Flash 8.5 72 | * @tiptext 73 | */ 74 | public function get pools():Array { 75 | return _pools; 76 | } 77 | 78 | public function set pools( value:Array ):void { 79 | _pools = value; 80 | } 81 | 82 | } 83 | } -------------------------------------------------------------------------------- /FlickrGallerySample/libs/com/adobe/webapis/flickr/PhotoCount.as: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008, Adobe Systems Incorporated 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | * Neither the name of Adobe Systems Incorporated nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | package com.adobe.webapis.flickr { 31 | 32 | /** 33 | * PhotoCount is a ValueObject for the Flickr API. 34 | */ 35 | public class PhotoCount { 36 | 37 | private var _count:int; 38 | private var _fromDate:Date; 39 | private var _toDate:Date; 40 | 41 | /** 42 | * Construct a new PhotoCount instance 43 | * 44 | * @langversion ActionScript 3.0 45 | * @playerversion Flash 8.5 46 | * @tiptext 47 | */ 48 | public function PhotoCount() { 49 | // do nothing 50 | } 51 | 52 | /** 53 | * The count value 54 | * 55 | * @langversion ActionScript 3.0 56 | * @playerversion Flash 8.5 57 | * @tiptext 58 | */ 59 | public function get count():int { 60 | return _count; 61 | } 62 | 63 | public function set count( value:int ):void { 64 | _count = value; 65 | } 66 | 67 | /** 68 | * The from date value 69 | * 70 | * @langversion ActionScript 3.0 71 | * @playerversion Flash 8.5 72 | * @tiptext 73 | */ 74 | public function get fromDate():Date { 75 | return _fromDate; 76 | } 77 | 78 | public function set fromDate( value:Date ):void { 79 | _fromDate = value; 80 | } 81 | 82 | /** 83 | * The to date value 84 | * 85 | * @langversion ActionScript 3.0 86 | * @playerversion Flash 8.5 87 | * @tiptext 88 | */ 89 | public function get toDate():Date { 90 | return _toDate; 91 | } 92 | 93 | public function set toDate( value:Date ):void { 94 | _toDate = value; 95 | } 96 | 97 | } 98 | } -------------------------------------------------------------------------------- /FlickrGallerySample/libs/com/adobe/webapis/flickr/PhotoPool.as: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008, Adobe Systems Incorporated 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | * Neither the name of Adobe Systems Incorporated nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | package com.adobe.webapis.flickr { 31 | 32 | /** 33 | * PhotoPool is a ValueObject for the Flickr API. 34 | */ 35 | public class PhotoPool { 36 | 37 | private var _id:String; 38 | private var _title:String; 39 | 40 | /** 41 | * Construct a new PhotoPool instance 42 | * 43 | * @langversion ActionScript 3.0 44 | * @playerversion Flash 8.5 45 | * @tiptext 46 | */ 47 | public function PhotoPool() { 48 | // do nothing 49 | } 50 | 51 | /** 52 | * The id of the photo pool 53 | * 54 | * @langversion ActionScript 3.0 55 | * @playerversion Flash 8.5 56 | * @tiptext 57 | */ 58 | public function get id():String { 59 | return _id; 60 | } 61 | 62 | public function set id( value:String ):void { 63 | _id = value; 64 | } 65 | 66 | /** 67 | * The title of the photo pool 68 | * 69 | * @langversion ActionScript 3.0 70 | * @playerversion Flash 8.5 71 | * @tiptext 72 | */ 73 | public function get title():String { 74 | return _title; 75 | } 76 | 77 | public function set title( value:String ):void { 78 | _title = value; 79 | } 80 | 81 | } 82 | } -------------------------------------------------------------------------------- /FlickrGallerySample/libs/com/adobe/webapis/flickr/PhotoUrl.as: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008, Adobe Systems Incorporated 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | * Neither the name of Adobe Systems Incorporated nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | package com.adobe.webapis.flickr { 31 | 32 | /** 33 | * PhotoUrl is a ValueObject for the Flickr API. 34 | */ 35 | public class PhotoUrl { 36 | 37 | private var _type:String; 38 | private var _url:String; 39 | 40 | /** 41 | * Construct a new PhotoUrl instance 42 | * 43 | * @langversion ActionScript 3.0 44 | * @playerversion Flash 8.5 45 | * @tiptext 46 | */ 47 | public function PhotoUrl() { 48 | // do nothing 49 | } 50 | 51 | /** 52 | * The type of the photo url 53 | * 54 | * @langversion ActionScript 3.0 55 | * @playerversion Flash 8.5 56 | * @tiptext 57 | */ 58 | public function get type():String { 59 | return _type; 60 | } 61 | 62 | public function set type( value:String ):void { 63 | _type = value; 64 | } 65 | 66 | /** 67 | * The url of the photo 68 | * 69 | * @langversion ActionScript 3.0 70 | * @playerversion Flash 8.5 71 | * @tiptext 72 | */ 73 | public function get url():String { 74 | return _url; 75 | } 76 | 77 | public function set url( value:String ):void { 78 | _url = value; 79 | } 80 | } 81 | } -------------------------------------------------------------------------------- /FlickrGallerySample/libs/com/adobe/webapis/flickr/SafetyLevel.as: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008, Adobe Systems Incorporated 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | * Neither the name of Adobe Systems Incorporated nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | package com.adobe.webapis.flickr { 31 | 32 | /** 33 | * Constants for the safety level of a photo for uploading. 34 | */ 35 | public class SafetyLevel { 36 | 37 | public static const DEFAULT:int = 0; 38 | 39 | public static const SAFE:int = 1; 40 | 41 | public static const MODERATE:int = 2; 42 | 43 | public static const RESTRICTED:int = 3; 44 | 45 | } 46 | 47 | } -------------------------------------------------------------------------------- /FlickrGallerySample/libs/com/adobe/webapis/flickr/authorization/FlickrAuthorizationSettings.as: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008, Adobe Systems Incorporated 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | * Neither the name of Adobe Systems Incorporated nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | package com.adobe.webapis.flickr.authorization 31 | { 32 | public class FlickrAuthorizationSettings 33 | { 34 | //Flickr API Key for application 35 | public var flickrAPIKey:String = ""; 36 | 37 | //Flickr API Secret for application 38 | public var flickrAPISecret:String = ""; 39 | 40 | //Flickr Authorization token to all the application to access users 41 | //account 42 | public var authToken:String; 43 | 44 | //The Flickr account name that the application has permission to access 45 | public var accountName:String; 46 | 47 | public function FlickrAuthorizationSettings() 48 | { 49 | } 50 | 51 | } 52 | } -------------------------------------------------------------------------------- /FlickrGallerySample/libs/com/adobe/webapis/flickr/authorization/events/AuthorizationEvent.as: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008, Adobe Systems Incorporated 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | * Neither the name of Adobe Systems Incorporated nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | 31 | package com.adobe.webapis.flickr.authorization.events 32 | { 33 | import com.adobe.webapis.flickr.User; 34 | 35 | import flash.events.Event; 36 | 37 | //Event class for Authorization related events. 38 | public class AuthorizationEvent extends Event 39 | { 40 | //Broadcast when the Authorization Panel requests that the Settings 41 | //pabel be displayed. 42 | public static const AUTHORIZATION_COMPLETE:String = "onAuthorizationComplete"; 43 | 44 | public var authToken:String; 45 | public var user:User; 46 | 47 | public function AuthorizationEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false) 48 | { 49 | super(type, bubbles, cancelable); 50 | } 51 | 52 | } 53 | } -------------------------------------------------------------------------------- /FlickrGallerySample/libs/com/adobe/webapis/flickr/flickrservice_internal.as: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008, Adobe Systems Incorporated 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | * Neither the name of Adobe Systems Incorporated nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | package com.adobe.webapis.flickr { 31 | 32 | /** 33 | * Because of the directory structure (having a methodgroups package 34 | * where the classes in there are really "Friends" of the FlickrService 35 | * class), we can't use the "internal" modifier to hide methods from 36 | * the public API. Thus, in order to provide the helper classes in the 37 | * methodGroup package access to this class, we create a special 38 | * namespace to use as a method modifier. 39 | */ 40 | public namespace flickrservice_internal = "http://www.macromedia.com/webapis/flickr/internal"; 41 | 42 | } -------------------------------------------------------------------------------- /FlickrGallerySample/libs/com/adobe/webapis/flickr/methodgroups/helpers/PhotoSearchParams.as: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008, Adobe Systems Incorporated 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | * Neither the name of Adobe Systems Incorporated nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | package com.adobe.webapis.flickr.methodgroups.helpers 31 | { 32 | public class PhotoSearchParams 33 | { 34 | public var user_id:String = ""; 35 | public var tags:String = ""; 36 | public var tag_mode:String = "any"; 37 | public var text:String = ""; 38 | public var min_upload_date:Date = null; 39 | public var max_upload_date:Date = null; 40 | public var min_taken_date:Date = null; 41 | public var max_taken_date:Date = null; 42 | public var license:Number = -1; 43 | public var sort:String = "date-posted-desc"; 44 | public var privacy_filter:int = -1; 45 | public var bbox:String = ""; 46 | public var accuracy:int = -1; 47 | public var safe_search:int = -1; 48 | public var content_type:int = -1; 49 | public var machine_tags:String = ""; 50 | public var machine_tag_mode:String = ""; 51 | public var group_id:String = ""; 52 | public var contacts:String = ""; 53 | public var woe_id:String = ""; 54 | public var place_id:String = ""; 55 | public var media:String = ""; 56 | public var has_geo:Boolean = false;//true; false or all 57 | public var lat:String = ""; 58 | public var lon:String = ""; 59 | public var radius:Number = -1; 60 | public var radius_units:Number = -1; 61 | public var extras:String = ""; 62 | public var per_page:Number = 100; 63 | public var page:Number = 1; 64 | } 65 | } -------------------------------------------------------------------------------- /FlickrGallerySample/libs/com/joelhooks/display/ImageSwap.mxml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 15 | [Event(name="imageLoaded", type="flash.events.Event")] 16 | 17 | 18 | 1) 92 | { 93 | this.imageContainer.removeChildAt(0) 94 | this.loadedImages.shift(); 95 | } 96 | this.changingImages = false; 97 | } 98 | 99 | private function removePreload():void 100 | { 101 | TweenLite.to(preload, .25, {alpha:0}); 102 | this.dispatchEvent(new Event('imageLoaded')); 103 | this.changingImages = false; 104 | } 105 | 106 | ]]> 107 | 108 | 109 | 110 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /FlickrGallerySample/libs/com/joelhooks/display/SmoothImage.as: -------------------------------------------------------------------------------- 1 | /* 2 | Inversion of Control/Dependency Injection Using Parsley 3 | Image Gallery 4 | 5 | Any portion of this demonstration may be reused for any purpose where not 6 | licensed by another party restricting such use. Please leave the credits intact. 7 | 8 | Joel Hooks 9 | http://joelhooks.com 10 | joelhooks@gmail.com 11 | */ 12 | package com.joelhooks.display 13 | { 14 | import flash.display.Bitmap; 15 | 16 | import mx.controls.Image; 17 | 18 | public class SmoothImage extends Image 19 | { 20 | override protected function updateDisplayList (unscaledWidth : Number, unscaledHeight : Number) : void 21 | { 22 | super.updateDisplayList (unscaledWidth, unscaledHeight); 23 | // checks if the image is a bitmap 24 | if (content is Bitmap) 25 | { 26 | var bitmap : Bitmap = content as Bitmap; 27 | 28 | if (bitmap != null && bitmap.smoothing == false) 29 | { 30 | bitmap.smoothing = true; 31 | } 32 | } 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/BoilerFlickrGallery.mxml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 22 | 23 | 24 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/assets/RobotLegsLogoSmallWeb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/squeedee/Boiler/3f243a4c8738ea91bd60d8ed087b7344e046d733/FlickrGallerySample/src/main/assets/RobotLegsLogoSmallWeb.png -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/assets/gallery/gallery.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/assets/gallery/images/3354402351_cf6797c126.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/squeedee/Boiler/3f243a4c8738ea91bd60d8ed087b7344e046d733/FlickrGallerySample/src/main/assets/gallery/images/3354402351_cf6797c126.jpg -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/assets/gallery/images/3354402351_cf6797c126_s.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/squeedee/Boiler/3f243a4c8738ea91bd60d8ed087b7344e046d733/FlickrGallerySample/src/main/assets/gallery/images/3354402351_cf6797c126_s.jpg -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/assets/gallery/images/3355136923_3cbe01c482.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/squeedee/Boiler/3f243a4c8738ea91bd60d8ed087b7344e046d733/FlickrGallerySample/src/main/assets/gallery/images/3355136923_3cbe01c482.jpg -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/assets/gallery/images/3355136923_3cbe01c482_s.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/squeedee/Boiler/3f243a4c8738ea91bd60d8ed087b7344e046d733/FlickrGallerySample/src/main/assets/gallery/images/3355136923_3cbe01c482_s.jpg -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/assets/gallery/images/3355221976_f13d8e95dc.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/squeedee/Boiler/3f243a4c8738ea91bd60d8ed087b7344e046d733/FlickrGallerySample/src/main/assets/gallery/images/3355221976_f13d8e95dc.jpg -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/assets/gallery/images/3355221976_f13d8e95dc_s.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/squeedee/Boiler/3f243a4c8738ea91bd60d8ed087b7344e046d733/FlickrGallerySample/src/main/assets/gallery/images/3355221976_f13d8e95dc_s.jpg -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/assets/gallery/images/3355226494_07dab9ba54.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/squeedee/Boiler/3f243a4c8738ea91bd60d8ed087b7344e046d733/FlickrGallerySample/src/main/assets/gallery/images/3355226494_07dab9ba54.jpg -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/assets/gallery/images/3355226494_07dab9ba54_s.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/squeedee/Boiler/3f243a4c8738ea91bd60d8ed087b7344e046d733/FlickrGallerySample/src/main/assets/gallery/images/3355226494_07dab9ba54_s.jpg -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/assets/gallery/images/3355957414_bfc397beb4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/squeedee/Boiler/3f243a4c8738ea91bd60d8ed087b7344e046d733/FlickrGallerySample/src/main/assets/gallery/images/3355957414_bfc397beb4.jpg -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/assets/gallery/images/3355957414_bfc397beb4_s.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/squeedee/Boiler/3f243a4c8738ea91bd60d8ed087b7344e046d733/FlickrGallerySample/src/main/assets/gallery/images/3355957414_bfc397beb4_s.jpg -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/assets/gallery/images/3453670271_3cd0f7458b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/squeedee/Boiler/3f243a4c8738ea91bd60d8ed087b7344e046d733/FlickrGallerySample/src/main/assets/gallery/images/3453670271_3cd0f7458b.jpg -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/assets/gallery/images/3453670271_3cd0f7458b_s.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/squeedee/Boiler/3f243a4c8738ea91bd60d8ed087b7344e046d733/FlickrGallerySample/src/main/assets/gallery/images/3453670271_3cd0f7458b_s.jpg -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/assets/gallery/images/3735191063_6b55d6010d.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/squeedee/Boiler/3f243a4c8738ea91bd60d8ed087b7344e046d733/FlickrGallerySample/src/main/assets/gallery/images/3735191063_6b55d6010d.jpg -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/assets/gallery/images/3735191063_6b55d6010d_s.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/squeedee/Boiler/3f243a4c8738ea91bd60d8ed087b7344e046d733/FlickrGallerySample/src/main/assets/gallery/images/3735191063_6b55d6010d_s.jpg -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/assets/gallery/images/3792349339_00000ffb7a.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/squeedee/Boiler/3f243a4c8738ea91bd60d8ed087b7344e046d733/FlickrGallerySample/src/main/assets/gallery/images/3792349339_00000ffb7a.jpg -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/assets/gallery/images/3792349339_00000ffb7a_s.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/squeedee/Boiler/3f243a4c8738ea91bd60d8ed087b7344e046d733/FlickrGallerySample/src/main/assets/gallery/images/3792349339_00000ffb7a_s.jpg -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/assets/gallery/images/3793129323_9defc51d63.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/squeedee/Boiler/3f243a4c8738ea91bd60d8ed087b7344e046d733/FlickrGallerySample/src/main/assets/gallery/images/3793129323_9defc51d63.jpg -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/assets/gallery/images/3793129323_9defc51d63_s.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/squeedee/Boiler/3f243a4c8738ea91bd60d8ed087b7344e046d733/FlickrGallerySample/src/main/assets/gallery/images/3793129323_9defc51d63_s.jpg -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/assets/gallery/images/3793975106_96ed4211d2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/squeedee/Boiler/3f243a4c8738ea91bd60d8ed087b7344e046d733/FlickrGallerySample/src/main/assets/gallery/images/3793975106_96ed4211d2.jpg -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/assets/gallery/images/3793975106_96ed4211d2_s.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/squeedee/Boiler/3f243a4c8738ea91bd60d8ed087b7344e046d733/FlickrGallerySample/src/main/assets/gallery/images/3793975106_96ed4211d2_s.jpg -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/assets/gallery/images/3793984180_22a64b96d5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/squeedee/Boiler/3f243a4c8738ea91bd60d8ed087b7344e046d733/FlickrGallerySample/src/main/assets/gallery/images/3793984180_22a64b96d5.jpg -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/assets/gallery/images/3793984180_22a64b96d5_s.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/squeedee/Boiler/3f243a4c8738ea91bd60d8ed087b7344e046d733/FlickrGallerySample/src/main/assets/gallery/images/3793984180_22a64b96d5_s.jpg -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/assets/gallery/images/3857050268_1e7037cb0e.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/squeedee/Boiler/3f243a4c8738ea91bd60d8ed087b7344e046d733/FlickrGallerySample/src/main/assets/gallery/images/3857050268_1e7037cb0e.jpg -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/assets/gallery/images/3857050268_1e7037cb0e_s.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/squeedee/Boiler/3f243a4c8738ea91bd60d8ed087b7344e046d733/FlickrGallerySample/src/main/assets/gallery/images/3857050268_1e7037cb0e_s.jpg -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/org/robotlegs/demos/imagegallery/configuration/FlickrGalleryConfiguration.as: -------------------------------------------------------------------------------- 1 | package org.robotlegs.demos.imagegallery.configuration { 2 | import boiler.base.configuration.ConfigurationBase; 3 | import boiler.steam.SteamConfiguration; 4 | 5 | import flash.display.DisplayObject; 6 | 7 | import org.robotlegs.demos.imagegallery.controller.GalleryController; 8 | import org.robotlegs.demos.imagegallery.controller.SelectedImageController; 9 | import org.robotlegs.demos.imagegallery.models.GalleryModel; 10 | import org.robotlegs.demos.imagegallery.remote.services.FlickrImageService; 11 | import org.robotlegs.demos.imagegallery.remote.services.IGalleryImageService; 12 | import org.robotlegs.demos.imagegallery.views.mediators.GalleryLabelMediator; 13 | import org.robotlegs.demos.imagegallery.views.mediators.GallerySearchMediator; 14 | import org.robotlegs.demos.imagegallery.views.mediators.GalleryViewMediator; 15 | 16 | public class FlickrGalleryConfiguration extends ConfigurationBase { 17 | private var _root:DisplayObject; 18 | 19 | 20 | override public function startup():void { 21 | 22 | // steam mediator pre-requisites 23 | lifetime.mapValue(DisplayObject, _root); 24 | 25 | // introduce steam 26 | lifetime.runConfiguration(SteamConfiguration); 27 | 28 | // controllers 29 | lifetime.mapClass(GalleryController, GalleryController); 30 | lifetime.mapClass(SelectedImageController, SelectedImageController); 31 | 32 | // models 33 | lifetime.mapSingleton(GalleryModel); 34 | 35 | // services 36 | lifetime.mapSingletonOf(IGalleryImageService, FlickrImageService); 37 | //lifetime.mapSingletonOf( IGalleryImageService, XMLImageService ); 38 | 39 | // mediators 40 | lifetime.mapClass(GalleryViewMediator, GalleryViewMediator); 41 | lifetime.mapClass(GallerySearchMediator, GallerySearchMediator); 42 | lifetime.mapClass(GalleryLabelMediator, GalleryLabelMediator); 43 | } 44 | 45 | override public function teardown():void { 46 | // mediators 47 | lifetime.unmap(GalleryLabelMediator); 48 | lifetime.unmap(GallerySearchMediator); 49 | lifetime.unmap(GalleryViewMediator); 50 | 51 | // services 52 | lifetime.unmap(IGalleryImageService); 53 | 54 | // models 55 | lifetime.unmap(GalleryModel); 56 | 57 | // Controllers 58 | lifetime.unmap(GalleryController); 59 | lifetime.unmap(SelectedImageController); 60 | 61 | // Steam mediator pre-requisites 62 | lifetime.unmap(DisplayObject); 63 | 64 | } 65 | 66 | public function get root():DisplayObject { 67 | return _root; 68 | } 69 | 70 | public function set root(value:DisplayObject):void { 71 | trace("A Set Root"); 72 | _root = value; 73 | } 74 | 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/org/robotlegs/demos/imagegallery/controller/GalleryController.as: -------------------------------------------------------------------------------- 1 | package org.robotlegs.demos.imagegallery.controller { 2 | import org.robotlegs.demos.imagegallery.models.GalleryModel; 3 | import org.robotlegs.demos.imagegallery.remote.services.GalleryLoadedEvent; 4 | import org.robotlegs.demos.imagegallery.remote.services.IGalleryImageService; 5 | 6 | public class GalleryController { 7 | [Inject] 8 | public var service:IGalleryImageService; 9 | 10 | [Inject] 11 | public var galleryModel:GalleryModel; 12 | 13 | public function load(event:LoadGalleryEvent):void { 14 | service.loadGallery(); 15 | } 16 | 17 | public function update(event:GalleryLoadedEvent):void { 18 | this.galleryModel.gallery = event.gallery; 19 | } 20 | 21 | public function search(event:SearchGalleryEvent):void { 22 | service.search(event.term); 23 | } 24 | 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/org/robotlegs/demos/imagegallery/controller/LoadGalleryEvent.as: -------------------------------------------------------------------------------- 1 | package org.robotlegs.demos.imagegallery.controller { 2 | 3 | import flash.events.Event; 4 | 5 | public class LoadGalleryEvent extends Event { 6 | 7 | public static const LOAD:String = "loadGallery"; 8 | 9 | public function LoadGalleryEvent() { 10 | super(LOAD); 11 | } 12 | 13 | override public function clone():Event { 14 | return new LoadGalleryEvent(); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/org/robotlegs/demos/imagegallery/controller/SearchGalleryEvent.as: -------------------------------------------------------------------------------- 1 | package org.robotlegs.demos.imagegallery.controller { 2 | 3 | import flash.events.Event; 4 | 5 | public class SearchGalleryEvent extends Event { 6 | 7 | public static const SEARCH:String = "searchGallery"; 8 | private var _term:String; 9 | 10 | public function SearchGalleryEvent(term:String = null) { 11 | super(SEARCH); 12 | _term = term; 13 | } 14 | 15 | public function get term():String { 16 | return _term; 17 | } 18 | 19 | override public function clone():Event { 20 | return new SearchGalleryEvent(term); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/org/robotlegs/demos/imagegallery/controller/SelectImageEvent.as: -------------------------------------------------------------------------------- 1 | package org.robotlegs.demos.imagegallery.controller { 2 | 3 | import flash.events.Event; 4 | 5 | import org.robotlegs.demos.imagegallery.models.vo.GalleryImage; 6 | 7 | public class SelectImageEvent extends Event { 8 | 9 | public static const SELECT:String = "selectImage"; 10 | private var _image:GalleryImage; 11 | 12 | public function SelectImageEvent(image:GalleryImage = null) { 13 | super(SELECT); 14 | _image = image; 15 | } 16 | 17 | public function get image():GalleryImage { 18 | return _image; 19 | } 20 | 21 | override public function clone():Event { 22 | return new SelectImageEvent(image); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/org/robotlegs/demos/imagegallery/controller/SelectedImageController.as: -------------------------------------------------------------------------------- 1 | package org.robotlegs.demos.imagegallery.controller { 2 | import org.robotlegs.demos.imagegallery.models.GalleryModel; 3 | 4 | public class SelectedImageController { 5 | 6 | [Inject] 7 | public var galleryModel:GalleryModel; 8 | 9 | public function select(event:SelectImageEvent):void { 10 | if (event.image) 11 | galleryModel.setSelectedImage(event.image); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/org/robotlegs/demos/imagegallery/models/GalleryModel.as: -------------------------------------------------------------------------------- 1 | /* 2 | Inversion of Control/Dependency Injection Using Robotlegs 3 | Image Gallery 4 | 5 | Any portion of this demonstration may be reused for any purpose where not 6 | licensed by another party restricting such use. Please leave the credits intact. 7 | 8 | Joel Hooks 9 | http://joelhooks.com 10 | joelhooks@gmail.com 11 | */ 12 | package org.robotlegs.demos.imagegallery.models { 13 | import org.robotlegs.demos.imagegallery.models.vo.Gallery; 14 | import org.robotlegs.demos.imagegallery.models.vo.GalleryImage; 15 | 16 | public class GalleryModel { 17 | private var _gallery:Gallery; 18 | 19 | public function get gallery():Gallery { 20 | return this._gallery; 21 | } 22 | 23 | public function set gallery(v:Gallery):void { 24 | this._gallery = v; 25 | } 26 | 27 | public function setSelectedImage(selectedImage:GalleryImage):void { 28 | selectedImage.selected = true; 29 | for each(var image:GalleryImage in this._gallery.photos) { 30 | if (image != selectedImage) 31 | image.selected = false; 32 | } 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/org/robotlegs/demos/imagegallery/models/vo/Gallery.as: -------------------------------------------------------------------------------- 1 | /* 2 | Inversion of Control/Dependency Injection Using Robotlegs 3 | Image Gallery 4 | 5 | Any portion of this demonstration may be reused for any purpose where not 6 | licensed by another party restricting such use. Please leave the credits intact. 7 | 8 | Joel Hooks 9 | http://joelhooks.com 10 | joelhooks@gmail.com 11 | */ 12 | package org.robotlegs.demos.imagegallery.models.vo { 13 | import mx.collections.ArrayCollection; 14 | 15 | [Bindable] 16 | public class Gallery { 17 | public var photos:ArrayCollection = new ArrayCollection() 18 | } 19 | } -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/org/robotlegs/demos/imagegallery/models/vo/GalleryImage.as: -------------------------------------------------------------------------------- 1 | /* 2 | Inversion of Control/Dependency Injection Using Robotlegs 3 | Image Gallery 4 | 5 | Any portion of this demonstration may be reused for any purpose where not 6 | licensed by another party restricting such use. Please leave the credits intact. 7 | 8 | Joel Hooks 9 | http://joelhooks.com 10 | joelhooks@gmail.com 11 | */ 12 | package org.robotlegs.demos.imagegallery.models.vo { 13 | [Bindable] 14 | public class GalleryImage { 15 | protected var _URL:String; 16 | protected var _thumbURL:String; 17 | protected var _selected:Boolean; 18 | 19 | public function get selected():Boolean { 20 | return _selected; 21 | } 22 | 23 | public function set selected(v:Boolean):void { 24 | _selected = v; 25 | } 26 | 27 | public function get thumbURL():String { 28 | return _thumbURL; 29 | } 30 | 31 | public function set thumbURL(v:String):void { 32 | _thumbURL = v; 33 | } 34 | 35 | public function get URL():String { 36 | return _URL; 37 | } 38 | 39 | public function set URL(v:String):void { 40 | _URL = v; 41 | } 42 | 43 | } 44 | } -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/org/robotlegs/demos/imagegallery/remote/services/FlickrImageService.as: -------------------------------------------------------------------------------- 1 | /* 2 | Inversion of Control/Dependency Injection Using Robotlegs 3 | Image Gallery 4 | 5 | Any portion of this demonstration may be reused for any purpose where not 6 | licensed by another party restricting such use. Please leave the credits intact. 7 | 8 | Joel Hooks 9 | http://joelhooks.com 10 | joelhooks@gmail.com 11 | */ 12 | package org.robotlegs.demos.imagegallery.remote.services { 13 | import com.adobe.webapis.flickr.FlickrService; 14 | import com.adobe.webapis.flickr.Photo; 15 | import com.adobe.webapis.flickr.events.FlickrResultEvent; 16 | import com.adobe.webapis.flickr.methodgroups.Photos; 17 | import com.adobe.webapis.flickr.methodgroups.helpers.PhotoSearchParams; 18 | 19 | import flash.events.IEventDispatcher; 20 | 21 | import org.robotlegs.demos.imagegallery.models.vo.Gallery; 22 | import org.robotlegs.demos.imagegallery.models.vo.GalleryImage; 23 | 24 | public class FlickrImageService implements IGalleryImageService { 25 | private var service:FlickrService; 26 | private var photos:Photos; 27 | 28 | [Inject] 29 | public var notifier:IEventDispatcher; 30 | 31 | protected static const FLICKR_API_KEY:String = "516ab798392cb79523691e6dd79005c2"; 32 | 33 | public function FlickrImageService() { 34 | this.service = new FlickrService(FLICKR_API_KEY); 35 | } 36 | 37 | public function get searchAvailable():Boolean { 38 | return true; 39 | } 40 | 41 | public function loadGallery():void { 42 | service.addEventListener(FlickrResultEvent.INTERESTINGNESS_GET_LIST, handleSearchResult); 43 | service.interestingness.getList(null, "", 20) 44 | } 45 | 46 | public function search(searchTerm:String):void { 47 | if (!this.photos) 48 | this.photos = new Photos(this.service); 49 | service.addEventListener(FlickrResultEvent.PHOTOS_SEARCH, handleSearchResult); 50 | var p:PhotoSearchParams = new PhotoSearchParams() 51 | p.text = searchTerm; 52 | p.per_page = 20; 53 | p.content_type = 1; 54 | p.media = "photo" 55 | p.sort = "date-posted-desc"; 56 | this.photos.searchWithParamHelper(p); 57 | } 58 | 59 | protected function handleSearchResult(event:FlickrResultEvent):void { 60 | this.processFlickrPhotoResults(event.data.photos.photos); 61 | } 62 | 63 | protected function processFlickrPhotoResults(results:Array):void { 64 | var gallery:Gallery = new Gallery(); 65 | 66 | for each(var flickrPhoto:Photo in results) { 67 | var photo:GalleryImage = new GalleryImage() 68 | var baseURL:String = 'http://farm' + flickrPhoto.farmId + '.static.flickr.com/' + flickrPhoto.server + '/' + flickrPhoto.id + '_' + flickrPhoto.secret; 69 | photo.thumbURL = baseURL + '_s.jpg'; 70 | photo.URL = baseURL + '.jpg'; 71 | gallery.photos.addItem(photo); 72 | } 73 | 74 | notifier.dispatchEvent(new GalleryLoadedEvent(gallery)); 75 | } 76 | 77 | } 78 | } -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/org/robotlegs/demos/imagegallery/remote/services/GalleryLoadedEvent.as: -------------------------------------------------------------------------------- 1 | package org.robotlegs.demos.imagegallery.remote.services { 2 | import flash.events.Event; 3 | 4 | import org.robotlegs.demos.imagegallery.models.vo.Gallery; 5 | 6 | public class GalleryLoadedEvent extends Event { 7 | public static const LOADED:String = "galleryLoaded"; 8 | private var _gallery:Gallery; 9 | 10 | public function GalleryLoadedEvent(gallery:Gallery) { 11 | super(LOADED); 12 | 13 | _gallery = gallery; 14 | 15 | } 16 | 17 | override public function clone():Event { 18 | return new GalleryLoadedEvent(gallery); 19 | } 20 | 21 | public function get gallery():Gallery { 22 | return _gallery; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/org/robotlegs/demos/imagegallery/remote/services/IGalleryImageService.as: -------------------------------------------------------------------------------- 1 | /* 2 | Inversion of Control/Dependency Injection Using Robotlegs 3 | Image Gallery 4 | 5 | Any portion of this demonstration may be reused for any purpose where not 6 | licensed by another party restricting such use. Please leave the credits intact. 7 | 8 | Joel Hooks 9 | http://joelhooks.com 10 | joelhooks@gmail.com 11 | */ 12 | package org.robotlegs.demos.imagegallery.remote.services 13 | { 14 | public interface IGalleryImageService 15 | { 16 | function loadGallery():void; 17 | function search(searchTerm:String):void; 18 | function get searchAvailable():Boolean; 19 | } 20 | } -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/org/robotlegs/demos/imagegallery/remote/services/XMLImageService.as: -------------------------------------------------------------------------------- 1 | package org.robotlegs.demos.imagegallery.remote.services { 2 | import mx.rpc.AsyncToken; 3 | import mx.rpc.Responder; 4 | import mx.rpc.http.HTTPService; 5 | 6 | import org.robotlegs.demos.imagegallery.models.vo.Gallery; 7 | import org.robotlegs.demos.imagegallery.models.vo.GalleryImage; 8 | 9 | public class XMLImageService implements IGalleryImageService { 10 | protected static const BASE_URL:String = "assets/gallery/"; 11 | 12 | public function XMLImageService() { 13 | super(); 14 | } 15 | 16 | public function get searchAvailable():Boolean { 17 | return false; 18 | } 19 | 20 | public function loadGallery():void { 21 | var service:HTTPService = new HTTPService(); 22 | var responder:Responder = new Responder(handleServiceResult, handleServiceFault); 23 | var token:AsyncToken; 24 | service.resultFormat = "e4x"; 25 | service.url = BASE_URL + "gallery.xml"; 26 | token = service.send(); 27 | token.addResponder(responder); 28 | } 29 | 30 | public function search(searchTerm:String):void { 31 | trace("search is not available"); 32 | } 33 | 34 | protected function handleServiceResult(event:Object):void { 35 | var gallery:Gallery = new Gallery(); 36 | 37 | for each(var image:XML in event.result.image) { 38 | var photo:GalleryImage = new GalleryImage() 39 | photo.thumbURL = BASE_URL + "images/" + image.@name + '_s.jpg'; 40 | photo.URL = BASE_URL + "images/" + image.@name + '.jpg'; 41 | gallery.photos.addItem(photo); 42 | } 43 | 44 | //dispatchEvent(new GalleryEvent(GalleryEvent.GALLERY_LOADED, gallery)); 45 | } 46 | 47 | protected function handleServiceFault(event:Object):void { 48 | trace(event); 49 | 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/org/robotlegs/demos/imagegallery/views/components/GalleryHeader.mxml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 23 | RobotlegsBoiler: Image Gallery Demo 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/org/robotlegs/demos/imagegallery/views/components/GalleryLabel.mxml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 15 | 16 | 17 | 18 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/org/robotlegs/demos/imagegallery/views/components/GallerySearch.mxml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 15 | 16 | 17 | 18 | 27 | 28 | 29 | 30 | 31 | 33 | 34 | -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/org/robotlegs/demos/imagegallery/views/components/GalleryView.mxml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 91 | 93 | 94 | -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/org/robotlegs/demos/imagegallery/views/components/renderers/GalleryImageThumbnailItemRenderer.mxml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 21 | 22 | 23 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/org/robotlegs/demos/imagegallery/views/mediators/GalleryLabelMediator.as: -------------------------------------------------------------------------------- 1 | /* 2 | Inversion of Control/Dependency Injection Using Robotlegs 3 | Image Gallery 4 | 5 | Any portion of this demonstration may be reused for any purpose where not 6 | licensed by another party restricting such use. Please leave the credits intact. 7 | 8 | Joel Hooks 9 | http://joelhooks.com 10 | joelhooks@gmail.com 11 | */ 12 | package org.robotlegs.demos.imagegallery.views.mediators { 13 | import flash.events.IEventDispatcher; 14 | 15 | import org.robotlegs.demos.imagegallery.controller.SearchGalleryEvent; 16 | 17 | import org.robotlegs.demos.imagegallery.remote.services.IGalleryImageService; 18 | import org.robotlegs.demos.imagegallery.views.components.GalleryLabel; 19 | 20 | public class GalleryLabelMediator { 21 | 22 | [Inject] 23 | public var service:IGalleryImageService; 24 | 25 | [Inject] 26 | public var notifier:IEventDispatcher; 27 | 28 | private var view:GalleryLabel; 29 | 30 | public function register(view:GalleryLabel):void { 31 | 32 | this.view = view; 33 | 34 | view.text = "interestingness"; 35 | 36 | notifier.addEventListener(SearchGalleryEvent.SEARCH, handleSearch); 37 | 38 | view.visible = view.includeInLayout = service.searchAvailable; 39 | } 40 | 41 | public function deregister():void { 42 | view.removeEventListener(SearchGalleryEvent.SEARCH, handleSearch); 43 | } 44 | 45 | protected function handleSearch(event:SearchGalleryEvent):void { 46 | this.view.text = event.term; 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/org/robotlegs/demos/imagegallery/views/mediators/GallerySearchMediator.as: -------------------------------------------------------------------------------- 1 | /* 2 | Inversion of Control/Dependency Injection Using Robotlegs 3 | Image Gallery 4 | 5 | Any portion of this demonstration may be reused for any purpose where not 6 | licensed by another party restricting such use. Please leave the credits intact. 7 | 8 | Joel Hooks 9 | http://joelhooks.com 10 | joelhooks@gmail.com 11 | */ 12 | package org.robotlegs.demos.imagegallery.views.mediators { 13 | import flash.events.IEventDispatcher; 14 | 15 | import org.robotlegs.demos.imagegallery.controller.SearchGalleryEvent; 16 | import org.robotlegs.demos.imagegallery.remote.services.IGalleryImageService; 17 | import org.robotlegs.demos.imagegallery.views.components.GallerySearch; 18 | 19 | public class GallerySearchMediator { 20 | 21 | [Inject] 22 | public var service:IGalleryImageService; 23 | 24 | [Inject] 25 | public var notifier:IEventDispatcher; 26 | 27 | private var view:GallerySearch; 28 | 29 | public function register(view:GallerySearch):void { 30 | this.view = view; 31 | 32 | view.addEventListener(SearchGalleryEvent.SEARCH, handleSearch); 33 | 34 | view.visible = view.includeInLayout = service.searchAvailable; 35 | } 36 | 37 | public function deregister():void { 38 | view.removeEventListener(SearchGalleryEvent.SEARCH, handleSearch); 39 | } 40 | 41 | protected function handleSearch(event:SearchGalleryEvent):void { 42 | notifier.dispatchEvent(event); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /FlickrGallerySample/src/main/org/robotlegs/demos/imagegallery/views/mediators/GalleryViewMediator.as: -------------------------------------------------------------------------------- 1 | /* 2 | Inversion of Control/Dependency Injection Using Robotlegs 3 | Image Gallery 4 | 5 | Any portion of this demonstration may be reused for any purpose where not 6 | licensed by another party restricting such use. Please leave the credits intact. 7 | 8 | Joel Hooks 9 | http://joelhooks.com 10 | joelhooks@gmail.com 11 | */ 12 | package org.robotlegs.demos.imagegallery.views.mediators { 13 | import flash.events.IEventDispatcher; 14 | 15 | import org.robotlegs.demos.imagegallery.controller.LoadGalleryEvent; 16 | 17 | import org.robotlegs.demos.imagegallery.controller.SearchGalleryEvent; 18 | 19 | import org.robotlegs.demos.imagegallery.controller.SelectImageEvent; 20 | 21 | import org.robotlegs.demos.imagegallery.models.vo.GalleryImage; 22 | import org.robotlegs.demos.imagegallery.remote.services.GalleryLoadedEvent; 23 | import org.robotlegs.demos.imagegallery.views.components.GalleryView; 24 | 25 | public class GalleryViewMediator { 26 | 27 | [Inject] 28 | public var notifier:IEventDispatcher; 29 | 30 | private var view:GalleryView; 31 | 32 | public function register(view:GalleryView):void { 33 | 34 | this.view = view; 35 | 36 | view.addEventListener(SelectImageEvent.SELECT,onImageSelected); 37 | 38 | notifier.addEventListener(GalleryLoadedEvent.LOADED, onGalleryLoaded); 39 | notifier.addEventListener(SearchGalleryEvent.SEARCH, onSearch); 40 | 41 | notifier.dispatchEvent(new LoadGalleryEvent()); 42 | } 43 | 44 | public function deregister():void { 45 | view.removeEventListener(SelectImageEvent.SELECT,onImageSelected); 46 | notifier.removeEventListener(GalleryLoadedEvent.LOADED, onGalleryLoaded); 47 | notifier.removeEventListener(SearchGalleryEvent.SEARCH, onSearch); 48 | } 49 | 50 | protected function selectImage(image:GalleryImage):void { 51 | view.imageSource = image.URL; 52 | notifier.dispatchEvent(new SelectImageEvent(image)); 53 | } 54 | 55 | protected function onGalleryLoaded(event:GalleryLoadedEvent):void { 56 | view.dataProvider = event.gallery.photos; 57 | selectImage(event.gallery.photos[0] as GalleryImage); 58 | } 59 | 60 | protected function onImageSelected(event:SelectImageEvent):void { 61 | this.selectImage(event.image); 62 | } 63 | 64 | protected function onSearch(event:SearchGalleryEvent):void { 65 | view.setThumbScrollPosition(0); 66 | } 67 | } 68 | } -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source :rubygems 2 | 3 | gem 'rjb', :platforms => [:ruby] 4 | gem 'buildr-as3' 5 | 6 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: http://rubygems.org/ 3 | specs: 4 | atoulme-Antwrap (0.7.1) 5 | rjb (>= 1.0.3) 6 | builder (2.1.2) 7 | buildr (1.4.6) 8 | atoulme-Antwrap (= 0.7.1) 9 | builder (= 2.1.2) 10 | diff-lcs (= 1.1.2) 11 | highline (= 1.5.1) 12 | hoe (= 2.3.3) 13 | json_pure (= 1.4.3) 14 | minitar (= 0.5.3) 15 | net-sftp (= 2.0.4) 16 | net-ssh (= 2.0.23) 17 | rake (= 0.8.7) 18 | rjb (= 1.3.3) 19 | rspec (= 2.1.0) 20 | rspec-core (= 2.1.0) 21 | rspec-expectations (= 2.1.0) 22 | rspec-mocks (= 2.1.0) 23 | rubyforge (= 2.0.3) 24 | rubyzip (= 0.9.4) 25 | xml-simple (= 1.0.12) 26 | buildr-as3 (0.2.19) 27 | buildr (>= 1.4.5) 28 | diff-lcs (1.1.2) 29 | highline (1.5.1) 30 | hoe (2.3.3) 31 | rake (>= 0.8.7) 32 | rubyforge (>= 1.0.4) 33 | json_pure (1.4.3) 34 | minitar (0.5.3) 35 | net-sftp (2.0.4) 36 | net-ssh (>= 2.0.9) 37 | net-ssh (2.0.23) 38 | rake (0.8.7) 39 | rjb (1.3.3) 40 | rspec (2.1.0) 41 | rspec-core (~> 2.1.0) 42 | rspec-expectations (~> 2.1.0) 43 | rspec-mocks (~> 2.1.0) 44 | rspec-core (2.1.0) 45 | rspec-expectations (2.1.0) 46 | diff-lcs (~> 1.1.2) 47 | rspec-mocks (2.1.0) 48 | rubyforge (2.0.3) 49 | json_pure (>= 1.1.7) 50 | rubyzip (0.9.4) 51 | xml-simple (1.0.12) 52 | 53 | PLATFORMS 54 | ruby 55 | 56 | DEPENDENCIES 57 | buildr-as3 58 | rjb 59 | -------------------------------------------------------------------------------- /GoogleMapsSample/libs/map_flex_1_20.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/squeedee/Boiler/3f243a4c8738ea91bd60d8ed087b7344e046d733/GoogleMapsSample/libs/map_flex_1_20.swc -------------------------------------------------------------------------------- /GoogleMapsSample/src/BoilerGoogleMapsSample.mxml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /GoogleMapsSample/src/boiler/demos/googlemaps/configuration/GoogleMapsSampleConfiguration.as: -------------------------------------------------------------------------------- 1 | package boiler.demos.googlemaps.configuration 2 | { 3 | import boiler.base.configuration.ConfigurationBase; 4 | import boiler.demos.googlemaps.controller.MarkersController; 5 | import boiler.demos.googlemaps.model.MarkersListModel; 6 | import boiler.demos.googlemaps.model.constants.ApplicationConstants; 7 | import boiler.demos.googlemaps.service.EmbeddedXMLMarkersDataRetrieverService; 8 | import boiler.demos.googlemaps.service.IMarkersDataRetrieverService; 9 | import boiler.demos.googlemaps.service.parsers.IMarkersDataParser; 10 | import boiler.demos.googlemaps.service.parsers.XMLMarkersDataParser; 11 | import boiler.demos.googlemaps.view.mediators.GoogleMapsMediator; 12 | import boiler.steam.SteamConfiguration; 13 | 14 | import flash.display.DisplayObject; 15 | 16 | public class GoogleMapsSampleConfiguration extends ConfigurationBase 17 | { 18 | public function GoogleMapsSampleConfiguration() 19 | { 20 | trace( this, 'constructor' ); 21 | super(); 22 | } 23 | 24 | private var _root : DisplayObject; 25 | public function set root( value : DisplayObject ) : void{ 26 | _root = value; 27 | } 28 | public function get root() : DisplayObject{ 29 | return _root 30 | } 31 | 32 | override public function startup():void 33 | { 34 | trace( this, 'startup' ); 35 | this.lifetime.mapValue( DisplayObject, root ); 36 | this.lifetime.runConfiguration( boiler.steam.SteamConfiguration ); 37 | 38 | this.lifetime.mapValue( String, ApplicationConstants.GMAPS_API_KEY, 'gmapsAPIKey' ); 39 | 40 | //controller 41 | this.lifetime.mapClass( MarkersController, MarkersController ); 42 | 43 | //service 44 | this.lifetime.mapSingletonOf( IMarkersDataParser, XMLMarkersDataParser ); 45 | this.lifetime.mapSingletonOf( IMarkersDataRetrieverService, EmbeddedXMLMarkersDataRetrieverService ); 46 | 47 | //model 48 | this.lifetime.mapSingleton( MarkersListModel ); 49 | 50 | //view 51 | this.lifetime.mapClass( GoogleMapsMediator, GoogleMapsMediator ); 52 | 53 | } 54 | 55 | override public function teardown():void 56 | { 57 | // TODO Auto Generated method stub 58 | super.teardown(); 59 | } 60 | 61 | 62 | 63 | } 64 | } -------------------------------------------------------------------------------- /GoogleMapsSample/src/boiler/demos/googlemaps/controller/MarkersController.as: -------------------------------------------------------------------------------- 1 | package boiler.demos.googlemaps.controller 2 | { 3 | import boiler.demos.googlemaps.model.vos.MarkerVO; 4 | import boiler.demos.googlemaps.model.MarkersListModel; 5 | import boiler.demos.googlemaps.service.IMarkersDataRetrieverService; 6 | 7 | import flash.events.IEventDispatcher; 8 | 9 | import mx.rpc.Responder; 10 | import boiler.demos.googlemaps.controller.events.MarkersListRetrievedEvent; 11 | import boiler.demos.googlemaps.controller.events.RetrieveMarkersListEvent; 12 | 13 | public class MarkersController 14 | { 15 | public function MarkersController() 16 | { 17 | trace( this, 'constructor' ); 18 | } 19 | 20 | [Inject] 21 | public var dispatcher : IEventDispatcher; 22 | 23 | [Inject] 24 | public var service : IMarkersDataRetrieverService; 25 | 26 | [Inject] 27 | public var markersModel : MarkersListModel; 28 | 29 | public function retrieveMarkersList( event : RetrieveMarkersListEvent ) : void{ 30 | trace( this, 'retrieveMarkersList' ); 31 | if( markersModel.isSet ){ 32 | serveMarkersList(); 33 | }else{ 34 | var responder : Responder = new Responder( handle_retrieveMarkersListSuccess, handle_retrieveMarkersListFailure ); 35 | service.retrieveMarkersData(responder); 36 | } 37 | } 38 | 39 | private function storeMarkersList( markersList : Vector. ):void 40 | { 41 | markersModel.markersList = markersList; 42 | } 43 | 44 | private function serveMarkersList():void 45 | { 46 | dispatcher.dispatchEvent( new MarkersListRetrievedEvent( markersModel.markersList ) ); 47 | } 48 | 49 | private function handle_retrieveMarkersListFailure():void 50 | { 51 | // TODO Auto Generated method stub 52 | 53 | } 54 | 55 | private function handle_retrieveMarkersListSuccess( markersList : Vector. ):void 56 | { 57 | storeMarkersList( markersList ); 58 | serveMarkersList(); 59 | } 60 | 61 | 62 | 63 | } 64 | } -------------------------------------------------------------------------------- /GoogleMapsSample/src/boiler/demos/googlemaps/controller/events/MarkersListRetrievedEvent.as: -------------------------------------------------------------------------------- 1 | package boiler.demos.googlemaps.controller.events 2 | { 3 | import boiler.demos.googlemaps.model.vos.MarkerVO; 4 | 5 | import flash.events.Event; 6 | 7 | public class MarkersListRetrievedEvent extends Event 8 | { 9 | static public const MARKERS_DATA_RETRIEVED : String = 'boiler.demos.googlemaps.service::MarkersListRetrievedEvent#MARKERS_DATA_RETRIEVED'; 10 | 11 | public function MarkersListRetrievedEvent( markersList : Vector. ) 12 | { 13 | _markersList = markersList; 14 | super(MARKERS_DATA_RETRIEVED); 15 | } 16 | 17 | private var _markersList : Vector. 18 | 19 | public function get markersList():Vector.{ 20 | return _markersList; 21 | } 22 | 23 | } 24 | } -------------------------------------------------------------------------------- /GoogleMapsSample/src/boiler/demos/googlemaps/controller/events/RetrieveMarkersListEvent.as: -------------------------------------------------------------------------------- 1 | package boiler.demos.googlemaps.controller.events 2 | { 3 | import boiler.demos.googlemaps.model.vos.MarkerVO; 4 | 5 | import flash.events.Event; 6 | 7 | public class RetrieveMarkersListEvent extends Event 8 | { 9 | 10 | static public const RETRIEVE_MARKERS_LIST : String = 'boiler.demos.googlemaps.view::RetrieveMarkersListEvent#RETRIEVE_MARKERS_LIST'; 11 | 12 | public function RetrieveMarkersListEvent() 13 | { 14 | super(RETRIEVE_MARKERS_LIST); 15 | } 16 | 17 | override public function clone():Event 18 | { 19 | return new RetrieveMarkersListEvent(); 20 | } 21 | 22 | 23 | 24 | } 25 | } -------------------------------------------------------------------------------- /GoogleMapsSample/src/boiler/demos/googlemaps/model/MarkersListModel.as: -------------------------------------------------------------------------------- 1 | package boiler.demos.googlemaps.model 2 | { 3 | import boiler.demos.googlemaps.model.vos.MarkerVO; 4 | 5 | public class MarkersListModel 6 | { 7 | public function MarkersListModel() 8 | { 9 | trace( this, 'constructor' ); 10 | } 11 | 12 | private var _markersList : Vector.; 13 | 14 | public function get markersList():Vector.{ 15 | return _markersList; 16 | } 17 | 18 | public function set markersList(value:Vector.):void{ 19 | _markersList = value; 20 | _isSet = true; 21 | } 22 | 23 | private var _isSet : Boolean = false; 24 | 25 | public function get isSet():Boolean{ 26 | return _isSet; 27 | } 28 | 29 | 30 | } 31 | } -------------------------------------------------------------------------------- /GoogleMapsSample/src/boiler/demos/googlemaps/model/constants/ApplicationConstants.as: -------------------------------------------------------------------------------- 1 | package boiler.demos.googlemaps.model.constants 2 | { 3 | public class ApplicationConstants 4 | { 5 | static public const GMAPS_API_KEY : String = "ABQIAAAAO-cCleAenkHS3l5YIe2rfxSt3J1WxB__3gt1bNGcz4st1p409RRCt9eMECH2W2XImEESSkQKpJMumg"; 6 | 7 | static public const MARKERS_XML : XML = 8 | 9 | 10 | ; 11 | 12 | public function ApplicationConstants() 13 | { 14 | throw new Error( this, 'static class, no instantiation allowed' ); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /GoogleMapsSample/src/boiler/demos/googlemaps/model/vos/MarkerVO.as: -------------------------------------------------------------------------------- 1 | package boiler.demos.googlemaps.model.vos 2 | { 3 | public class MarkerVO 4 | { 5 | public function MarkerVO() 6 | { 7 | } 8 | 9 | private var _headline : String; 10 | 11 | public function get headline():String{ 12 | return _headline; 13 | } 14 | 15 | public function set headline(value:String):void{ 16 | _headline = value; 17 | } 18 | 19 | private var _fotoURL : String 20 | 21 | public function get fotoURL():String{ 22 | return _fotoURL; 23 | } 24 | 25 | public function set fotoURL(value:String):void{ 26 | _fotoURL = value; 27 | } 28 | 29 | private var _body : String; 30 | 31 | public function get body():String{ 32 | return _body; 33 | } 34 | 35 | public function set body(value:String):void{ 36 | _body = value; 37 | } 38 | 39 | private var _lat : Number 40 | 41 | public function get lat():Number{ 42 | return _lat; 43 | } 44 | 45 | public function set lat(value:Number):void{ 46 | _lat = value; 47 | } 48 | 49 | private var _lng : Number; 50 | 51 | public function get lng():Number{ 52 | return _lng; 53 | } 54 | 55 | public function set lng(value:Number):void{ 56 | _lng = value; 57 | } 58 | 59 | private var _city : String 60 | 61 | public function get city():String{ 62 | return _city; 63 | } 64 | 65 | public function set city(value:String):void{ 66 | _city = value; 67 | } 68 | 69 | private var _address : String 70 | 71 | public function get address():String{ 72 | return _address; 73 | } 74 | 75 | public function set address(value:String):void{ 76 | _address = value; 77 | } 78 | 79 | } 80 | } -------------------------------------------------------------------------------- /GoogleMapsSample/src/boiler/demos/googlemaps/service/EmbeddedXMLMarkersDataRetrieverService.as: -------------------------------------------------------------------------------- 1 | package boiler.demos.googlemaps.service 2 | { 3 | import boiler.demos.googlemaps.model.constants.ApplicationConstants; 4 | import boiler.demos.googlemaps.model.vos.MarkerVO; 5 | 6 | import mx.rpc.Responder; 7 | import boiler.demos.googlemaps.service.parsers.IMarkersDataParser; 8 | 9 | public class EmbeddedXMLMarkersDataRetrieverService implements IMarkersDataRetrieverService 10 | { 11 | public function EmbeddedXMLMarkersDataRetrieverService() 12 | { 13 | trace( this, 'constructor' ); 14 | } 15 | 16 | [Inject] 17 | public var parser : IMarkersDataParser; 18 | 19 | public function retrieveMarkersData( responder : Responder ):void 20 | { 21 | trace( this, 'retrieveMarkersData' ); 22 | var rawData : String = ApplicationConstants.MARKERS_XML.toXMLString(); 23 | var output : Vector. = parser.parseMarkersData( rawData ); 24 | responder.result( output ); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /GoogleMapsSample/src/boiler/demos/googlemaps/service/IMarkersDataRetrieverService.as: -------------------------------------------------------------------------------- 1 | package boiler.demos.googlemaps.service 2 | { 3 | import mx.rpc.Responder; 4 | 5 | public interface IMarkersDataRetrieverService 6 | { 7 | function retrieveMarkersData( responder : Responder ) : void; 8 | } 9 | } -------------------------------------------------------------------------------- /GoogleMapsSample/src/boiler/demos/googlemaps/service/parsers/IMarkersDataParser.as: -------------------------------------------------------------------------------- 1 | package boiler.demos.googlemaps.service.parsers 2 | { 3 | import boiler.demos.googlemaps.model.vos.MarkerVO; 4 | 5 | public interface IMarkersDataParser 6 | { 7 | function parseMarkersData( rawData : String ) : Vector.; 8 | } 9 | } -------------------------------------------------------------------------------- /GoogleMapsSample/src/boiler/demos/googlemaps/service/parsers/XMLMarkersDataParser.as: -------------------------------------------------------------------------------- 1 | package boiler.demos.googlemaps.service.parsers 2 | { 3 | import boiler.demos.googlemaps.model.vos.MarkerVO; 4 | 5 | public class XMLMarkersDataParser implements IMarkersDataParser 6 | { 7 | public function XMLMarkersDataParser() 8 | { 9 | trace( this, 'constructor' ); 10 | } 11 | 12 | public function parseMarkersData(rawData:String):Vector. 13 | { 14 | trace( this, 'parseMarkersData' ); 15 | 16 | var rawXML : XML = new XML( rawData ); 17 | 18 | var markersXML : XMLList = rawXML.marker; 19 | var markersList : Vector. = new Vector.(); 20 | var i : int; 21 | var n : int = markersXML.length(); 22 | for( i = 0; i < n; i++ ){ 23 | var marker : MarkerVO = new MarkerVO(); 24 | var markerXML : XML = markersXML[ i ]; 25 | marker.body = markerXML.@body; 26 | marker.fotoURL = markerXML.@foto; 27 | marker.headline = markerXML.@headline; 28 | marker.address = markerXML.@adres; 29 | marker.city = markerXML.@stad; 30 | marker.lat = markerXML.@lat; 31 | marker.lng = markerXML.@lng; 32 | markersList.push( marker ); 33 | } 34 | return markersList; 35 | 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /GoogleMapsSample/src/boiler/demos/googlemaps/view/components/GoogleMapsView.mxml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | ; 35 | 36 | public function get markersList():Vector.{ 37 | return _markersList; 38 | } 39 | 40 | public function set markersList(value:Vector.):void{ 41 | _markersList = value; 42 | 43 | createMarkers(); 44 | } 45 | 46 | 47 | protected function init(event:FlexEvent):void 48 | { 49 | var mapOptions:MapOptions = new MapOptions( { 50 | center:new LatLng(51.3644935, 7.1779126), 51 | zoom:7, 52 | dragging:false, 53 | doubleClickMode:MapAction.ACTION_NOTHING 54 | } ); 55 | gMap.setInitOptions( mapOptions ); 56 | gMap.addControl( new ZoomControl() ); 57 | gMap.addControl( new MapTypeControl() ); 58 | gMap.addControl( new PositionControl() ); 59 | } 60 | 61 | private function createMarkers():void 62 | { 63 | var i :int; 64 | var n : int = markersList.length; 65 | for( i = 0; i < n; i++ ){ 66 | var markerData : MarkerVO = markersList[ i ]; 67 | var markerIcon : Marker = new Marker( new LatLng( markerData.lat, markerData.lng ) ); 68 | gMap.addOverlay( markerIcon ); 69 | } 70 | } 71 | 72 | ]]> 73 | 74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /GoogleMapsSample/src/boiler/demos/googlemaps/view/mediators/GoogleMapsMediator.as: -------------------------------------------------------------------------------- 1 | package boiler.demos.googlemaps.view.mediators 2 | { 3 | import boiler.demos.googlemaps.controller.events.MarkersListRetrievedEvent; 4 | import boiler.demos.googlemaps.controller.events.RetrieveMarkersListEvent; 5 | import boiler.demos.googlemaps.view.components.GoogleMapsView; 6 | 7 | import com.google.maps.MapEvent; 8 | 9 | import flash.events.Event; 10 | import flash.events.IEventDispatcher; 11 | 12 | public class GoogleMapsMediator 13 | { 14 | public function GoogleMapsMediator() 15 | { 16 | trace( this, 'constructor' ); 17 | } 18 | 19 | [Inject] 20 | public var dispatcher : IEventDispatcher; 21 | 22 | [Inject(name='gmapsAPIKey')] 23 | public var gmapsAPIKey : String; 24 | 25 | private var _view : GoogleMapsView; 26 | 27 | public function register( view : GoogleMapsView ) :void{ 28 | trace( this, 'register' ); 29 | 30 | _view = view; 31 | _view.gmapsAPIKey = gmapsAPIKey; 32 | 33 | _view.addEventListener( MapEvent.MAP_READY, handle_MapReadyEvent ); 34 | 35 | } 36 | 37 | protected function handle_MapReadyEvent(event:MapEvent):void 38 | { 39 | dispatcher.addEventListener( MarkersListRetrievedEvent.MARKERS_DATA_RETRIEVED, handle_MarkersDataRetrievedEvent ); 40 | dispatcher.dispatchEvent( new RetrieveMarkersListEvent() ); 41 | } 42 | 43 | private function handle_MarkersDataRetrievedEvent( event : MarkersListRetrievedEvent ):void 44 | { 45 | trace( this, 'handle_MarkersDataRetrievedEvent' ); 46 | _view.markersList = event.markersList; 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /HookableSuspenders/HookableSuspenders.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /HookableSuspenders/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 Rasheed Abdul-Aziz 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /HookableSuspenders/src/main/hookableSuspenders/InstanceHandlerCollection.as: -------------------------------------------------------------------------------- 1 | package hookableSuspenders { 2 | import hookableSuspenders.errors.NotAnInstanceHandlerError; 3 | import hookableSuspenders.handlers.instance.AfterInstanceHandler; 4 | import hookableSuspenders.handlers.instance.BeforeInstanceHandler; 5 | 6 | public class InstanceHandlerCollection { 7 | 8 | private var beforeHandlers:Array = []; 9 | private var afterHandlers:Array = []; 10 | 11 | private var injector:HookableInjector; 12 | 13 | public function InstanceHandlerCollection(injector:HookableInjector) { 14 | this.injector = injector; 15 | } 16 | 17 | public function add(handlerType:Class):InstanceHandlerCollection { 18 | var handler:* = instanceClass(handlerType); 19 | 20 | var added:Boolean; 21 | added = addBeforeHandler(handler); 22 | added ||= addAfterHandler(handler); 23 | 24 | if (!added) 25 | throw new NotAnInstanceHandlerError(handlerType); 26 | 27 | return this; 28 | } 29 | 30 | private function addAfterHandler(handler:*):Boolean { 31 | if (!(handler is AfterInstanceHandler)) 32 | return false; 33 | 34 | afterHandlers.push(handler); 35 | return true; 36 | } 37 | 38 | private function addBeforeHandler(handler:*):Boolean { 39 | if (! (handler is BeforeInstanceHandler)) 40 | return false; 41 | 42 | beforeHandlers.push(handler); 43 | return true; 44 | } 45 | 46 | 47 | internal function callAfterHandlers(instance:*):void { 48 | for each (var handler:AfterInstanceHandler in afterHandlers) { 49 | handler.afterInstanced(instance); 50 | } 51 | } 52 | 53 | internal function callBeforeHandlers(type:Class):void { 54 | for each (var handler:BeforeInstanceHandler in beforeHandlers) { 55 | handler.beforeInstanced(type); 56 | } 57 | } 58 | 59 | private function instanceClass(handlerType:Class):* { 60 | if (!injector.hasMapping(handlerType)) 61 | injector.mapSingleton(handlerType); 62 | return injector.getInstance(handlerType); 63 | } 64 | 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /HookableSuspenders/src/main/hookableSuspenders/errors/NotAMappingHandlerError.as: -------------------------------------------------------------------------------- 1 | package hookableSuspenders.errors { 2 | import flash.utils.describeType; 3 | 4 | import mx.utils.StringUtil; 5 | 6 | public class NotAMappingHandlerError extends Error { 7 | public function NotAMappingHandlerError(handlerType:Class) { 8 | 9 | super( 10 | StringUtil.substitute( 11 | "{0} is not an InstanceHandler class.", 12 | describeType(handlerType).@name 13 | ), 14 | 47393649936 15 | ); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /HookableSuspenders/src/main/hookableSuspenders/errors/NotAnInstanceHandlerError.as: -------------------------------------------------------------------------------- 1 | package hookableSuspenders.errors { 2 | import flash.utils.describeType; 3 | 4 | import mx.utils.StringUtil; 5 | 6 | public class NotAnInstanceHandlerError extends Error { 7 | 8 | public function NotAnInstanceHandlerError(handlerType:Class) { 9 | 10 | super( 11 | StringUtil.substitute( 12 | "{0} is not an InstanceHandler class.", 13 | describeType(handlerType).@name 14 | ), 15 | 894578189463 16 | ); 17 | } 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /HookableSuspenders/src/main/hookableSuspenders/handlers/instance/AfterInstanceHandler.as: -------------------------------------------------------------------------------- 1 | package hookableSuspenders.handlers.instance { 2 | public interface AfterInstanceHandler { 3 | function afterInstanced(instance:*):void; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /HookableSuspenders/src/main/hookableSuspenders/handlers/instance/BeforeInstanceHandler.as: -------------------------------------------------------------------------------- 1 | package hookableSuspenders.handlers.instance { 2 | public interface BeforeInstanceHandler { 3 | function beforeInstanced(type:Class):void; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /HookableSuspenders/src/main/hookableSuspenders/handlers/mapping/AfterMapClassHandler.as: -------------------------------------------------------------------------------- 1 | package hookableSuspenders.handlers.mapping { 2 | import org.swiftsuspenders.InjectionConfig; 3 | 4 | public interface AfterMapClassHandler { 5 | function afterMapClass(newConfig:InjectionConfig):void; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /HookableSuspenders/src/main/hookableSuspenders/handlers/mapping/AfterMapSingletonHandler.as: -------------------------------------------------------------------------------- 1 | package hookableSuspenders.handlers.mapping { 2 | import org.swiftsuspenders.InjectionConfig; 3 | 4 | public interface AfterMapSingletonHandler { 5 | function afterMapSingleton(newConfig:InjectionConfig):void; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /HookableSuspenders/src/main/hookableSuspenders/handlers/mapping/AfterMapValueHandler.as: -------------------------------------------------------------------------------- 1 | package hookableSuspenders.handlers.mapping { 2 | import org.swiftsuspenders.InjectionConfig; 3 | 4 | public interface AfterMapValueHandler { 5 | function afterMapValue(newConfig:InjectionConfig):void; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /HookableSuspenders/src/main/hookableSuspenders/handlers/mapping/BeforeMapClassHandler.as: -------------------------------------------------------------------------------- 1 | package hookableSuspenders.handlers.mapping { 2 | import org.swiftsuspenders.InjectionConfig; 3 | 4 | public interface BeforeMapClassHandler { 5 | function beforeMapClass(existingConfig:InjectionConfig, instanciateClass:Class):void; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /HookableSuspenders/src/main/hookableSuspenders/handlers/mapping/BeforeMapSingletonHandler.as: -------------------------------------------------------------------------------- 1 | package hookableSuspenders.handlers.mapping { 2 | import org.swiftsuspenders.InjectionConfig; 3 | 4 | public interface BeforeMapSingletonHandler { 5 | function beforeMapSingleton(existingConfig:InjectionConfig, useSingletonOf:Class):void; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /HookableSuspenders/src/main/hookableSuspenders/handlers/mapping/BeforeMapValueHandler.as: -------------------------------------------------------------------------------- 1 | package hookableSuspenders.handlers.mapping { 2 | import org.swiftsuspenders.InjectionConfig; 3 | 4 | public interface BeforeMapValueHandler { 5 | function beforeMapValue(existingConfig:InjectionConfig, useValue:Object):void; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 Rasheed Abdul-Aziz 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.markdown: -------------------------------------------------------------------------------- 1 | Boiler is a complete IoC microarchitecture. It takes automated DI (from SwiftSuspenders) and tacks on inversion of control for configuration and initialisation. 2 | 3 | Boiler begs you to avoid writing a framework that lets people extend framework classes. 4 | 5 | Steam is a reference framework emerging from Boiler 6 | You probably want to start by looking at Steam or the FlickrGallerySample 7 | 8 | [Steam Docs](http://github.com/squeedee/Boiler/blob/master/Steam/README.textile) 9 | 10 | ## Boiler is about convention 11 | 12 | * Add a DI mapping of a class, it's namespace and/or structure will do the rest (Like Rails) 13 | * Add Metadata only when you can't depend on convention 14 | * Change the conventions by injecting different 'detectors' 15 | 16 | ## Boiler is about extensibility 17 | 18 | * Does not add methods to the injector (called lifetime) other than the configuration support. 19 | * Sugar is added by injection or detection. You never base an actor on a superclass from the framework. 20 | * Configure the order that 'detectors' are run in. 21 | * Define the kinds of mapping and injections that 'detectors' run on. 22 | 23 | Here's a poem: 24 | 25 | Invert Control. 26 | 27 | If you're writing a framework, and you don't want it to force people into a hole. 28 | Invert Control. 29 | 30 | When you think it's finished but something nags you about a classes role 31 | Invert Control 32 | 33 | When having to extend framework classes is not your goal... 34 | 35 | I N V E R T C O N T R O L 36 | 37 | # Architecture 38 | 39 | ## Absolute guiding principles 40 | 41 | * To be easily extensible 42 | * Very little boilerplate (but only lose it by injecting helpers!) 43 | * strict/strong typed 44 | * Does not stop you from leaning on your tools (I use Intellij's refactoring heavily) 45 | * Metadata never defines type (that includes 'names'). If metadata needs to attach to type, it should annotate strong typed, first class language constructs such as var and function. 46 | 47 | ## Still very incomplete 48 | 49 | Lots of WIP, so don't be suprised at: 50 | 51 | * The lack of tests (Im not a TDDer, that might turn you off to begin with) 52 | * Sanity.. I'm not sane. 53 | 54 | [Current todo list](http://github.com/squeedee/Boiler/blob/master/todo.markdown) 55 | 56 | ## Shoulders of giants. 57 | 58 | All of this is possible because of the amazing work of: 59 | 60 | * Robotlegs and the team. 61 | * SwiftSuspenders and Till. 62 | * Ruby On Rails and the team. 63 | * Ruby and the team. 64 | -------------------------------------------------------------------------------- /Steam/README.textile: -------------------------------------------------------------------------------- 1 | h1. Steam Basics 2 | 3 | Steam is a reference implementation. It's full of opinion and workflow. Like Rails, Steam doesn't much care for your opinion. 4 | Steam makes it easy to get going quickly. Steam makes writing apps simple and straightforward, but expects you to 5 | adhere to best practices to get the most out of it. Steam does care about solid OO practices. 6 | 7 | h2. Events 8 | 9 | At the outset it's worth noting that Steam uses 'SimpleEvents' only. 10 | 11 | A SimpleEvent is defined as an event that: 12 | 13 | * Takes no 'type' parameter in the constructor 14 | * Has a single Constant, which is always the type of the event (as set within the constructor) 15 | * Always supports the clone method properly. 16 | 17 | h4. Example SimpleEvent 18 | 19 |


20 |   public class ToggleStartStopEvent extends Event {
21 | 
22 |     public static const TOGGLE:String = "ToggleStartStop";
23 | 
24 |     public function ToggleStartStopEvent() {
25 |       super(TOGGLE);
26 |     }
27 | 
28 |     override public function clone():Event {
29 |       return new ToggleStartStopEvent();
30 |     }
31 |   }
32 | 
33 | 34 | h2. Notifier 35 | 36 | Steam offers a notification bus (publish/subscribe) 37 | It is a singleton injection of IEventDispatcher. 38 | 39 | If you want access to the notifier, simply add: 40 | 41 |

42 |     [Inject]
43 |     public var notifier:IEventDispatcher
44 | 
45 | 46 | This of course means that you cannot map IEventDispatchers in steam. If you need to use other EventDispatchers, implement a marker interface instead. 47 | 48 | h2. Controller 49 | 50 | Place controllers in a 'controller' namespace and Steam will do the rest. 51 | 52 | To have methods called, a controller class must define public methods with a single flash.events.Event parameter. 53 | 54 | h4. Example 55 | 56 |

57 |   package main.controller {
58 |     import main.model.StopwatchState;
59 | 
60 |     public class StopwatchController {
61 |       [Inject]
62 |       public var state:StopwatchState;
63 | 
64 |       public function toggle(event:ToggleStartStopEvent):void {
65 |         state.toggle();
66 |       }
67 | 
68 |       public function stop(event:StopStopwatchEvent):void {
69 |         state.stop();
70 |       }
71 | 
72 |     }
73 |   }
74 | 
75 | 76 | *Note:* If you're a fan of 'commands' you can implement them by using controllers with one public method. 77 | 78 | h2. Mediator 79 | 80 | Gotta doc this. Look at the FlickrGallery for some examples. -------------------------------------------------------------------------------- /Steam/Steam.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Steam/src/main/boiler/steam/SteamConfiguration.as: -------------------------------------------------------------------------------- 1 | package boiler.steam { 2 | import boiler.base.configuration.ConfigurationBase; 3 | import boiler.steam.configuration.ControllerConfiguration; 4 | import boiler.steam.configuration.DispatcherConfiguration; 5 | import boiler.steam.configuration.MediatorConfiguration; 6 | import boiler.steam.configuration.NotifierConfiguration; 7 | import boiler.steam.configuration.ReflectionConfiguration; 8 | import boiler.steam.configuration.StageObserverConfiguration; 9 | 10 | public class SteamConfiguration extends ConfigurationBase { 11 | 12 | override public function startup():void { 13 | lifetime 14 | .runConfiguration(ReflectionConfiguration) 15 | .runConfiguration(NotifierConfiguration) 16 | .runConfiguration(DispatcherConfiguration) 17 | .runConfiguration(ControllerConfiguration) 18 | .runConfiguration(StageObserverConfiguration) 19 | .runConfiguration(MediatorConfiguration); 20 | } 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Steam/src/main/boiler/steam/configuration/ControllerConfiguration.as: -------------------------------------------------------------------------------- 1 | package boiler.steam.configuration { 2 | import boiler.base.configuration.ConfigurationBase; 3 | import boiler.steam.controller.ControllerDetector; 4 | import boiler.steam.controller.ControllerExtension; 5 | import boiler.steam.controller.ControllerMethodMapper; 6 | import boiler.steam.controller.DefaultControllerDetector; 7 | import boiler.steam.controller.DefaultControllerMethodMapper; 8 | 9 | public class ControllerConfiguration extends ConfigurationBase { 10 | 11 | override public function startup():void { 12 | lifetime.mapSingletonOf(ControllerDetector, DefaultControllerDetector); 13 | lifetime.mapSingletonOf(ControllerMethodMapper, DefaultControllerMethodMapper); 14 | lifetime.mappingHandlers.add(ControllerExtension); 15 | } 16 | 17 | override public function teardown():void { 18 | 19 | lifetime.mappingHandlers.remove(ControllerExtension); 20 | lifetime.unmap(ControllerMethodMapper); 21 | lifetime.unmap(ControllerDetector); 22 | 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Steam/src/main/boiler/steam/configuration/DispatcherConfiguration.as: -------------------------------------------------------------------------------- 1 | package boiler.steam.configuration { 2 | import boiler.base.configuration.ConfigurationBase; 3 | import boiler.steam.dispatcher.Dispatcher; 4 | import boiler.steam.dispatcher.EventBasedDispatcher; 5 | import boiler.steam.dispatcher.EventBasedNotifierConnector; 6 | 7 | public class DispatcherConfiguration extends ConfigurationBase { 8 | 9 | override public function startup():void { 10 | lifetime.mapSingletonOf(Dispatcher, EventBasedDispatcher); 11 | lifetime.mapClass(EventBasedNotifierConnector, EventBasedNotifierConnector); 12 | } 13 | 14 | override public function teardown():void { 15 | Dispatcher(lifetime.getInstance(Dispatcher)).destruct(); 16 | lifetime.unmap(EventBasedNotifierConnector); 17 | lifetime.unmap(Dispatcher); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Steam/src/main/boiler/steam/configuration/MediatorConfiguration.as: -------------------------------------------------------------------------------- 1 | package boiler.steam.configuration { 2 | import boiler.base.configuration.ConfigurationBase; 3 | import boiler.steam.mediator.DefaultMediatorDetector; 4 | import boiler.steam.mediator.MediatorDetector; 5 | import boiler.steam.mediator.MediatorExtension; 6 | import boiler.steam.mediator.ViewInstanceHandler; 7 | import boiler.steam.mediator.map.MediatorMap; 8 | import boiler.steam.mediator.map.MediatorMapImpl; 9 | 10 | public class MediatorConfiguration extends ConfigurationBase { 11 | 12 | override public function startup():void { 13 | lifetime.mapSingletonOf(MediatorDetector, DefaultMediatorDetector); 14 | lifetime.mapSingleton(ViewInstanceHandler); 15 | lifetime.mapSingletonOf(MediatorMap, MediatorMapImpl); 16 | lifetime.mappingHandlers.add(MediatorExtension); 17 | 18 | } 19 | 20 | override public function teardown():void { 21 | 22 | lifetime.mappingHandlers.remove(MediatorExtension); 23 | lifetime.unmap(MediatorDetector); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Steam/src/main/boiler/steam/configuration/NotifierConfiguration.as: -------------------------------------------------------------------------------- 1 | package boiler.steam.configuration { 2 | import boiler.base.configuration.ConfigurationBase; 3 | 4 | import flash.events.EventDispatcher; 5 | import flash.events.IEventDispatcher; 6 | 7 | public class NotifierConfiguration extends ConfigurationBase { 8 | override public function startup():void { 9 | 10 | lifetime.mapValue(IEventDispatcher, new EventDispatcher()); 11 | } 12 | 13 | override public function teardown():void { 14 | lifetime.unmap(IEventDispatcher); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Steam/src/main/boiler/steam/configuration/ReflectionConfiguration.as: -------------------------------------------------------------------------------- 1 | package boiler.steam.configuration { 2 | import boiler.base.configuration.ConfigurationBase; 3 | import boiler.reflection.ClassByInstanceCache; 4 | import boiler.reflection.Reflection; 5 | import boiler.reflection.ReflectionBase; 6 | import boiler.reflection.Reflector; 7 | import boiler.reflection.helpers.EventClassHelper; 8 | 9 | public class ReflectionConfiguration extends ConfigurationBase { 10 | 11 | override public function startup():void { 12 | lifetime.mapClass(Reflection, ReflectionBase); 13 | lifetime.mapSingleton(Reflector); 14 | lifetime.mapSingleton(EventClassHelper); 15 | lifetime.mapSingleton(ClassByInstanceCache); 16 | } 17 | 18 | override public function teardown():void { 19 | lifetime.unmap(ClassByInstanceCache); 20 | lifetime.unmap(EventClassHelper); 21 | lifetime.unmap(Reflector); 22 | lifetime.unmap(Reflection); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Steam/src/main/boiler/steam/configuration/StageObserverConfiguration.as: -------------------------------------------------------------------------------- 1 | package boiler.steam.configuration { 2 | import boiler.base.configuration.ConfigurationBase; 3 | import boiler.steam.stageObserver.StageObserver; 4 | import boiler.steam.stageObserver.StageObserverImpl; 5 | 6 | public class StageObserverConfiguration extends ConfigurationBase { 7 | 8 | override public function startup():void { 9 | lifetime.mapSingletonOf(StageObserver, StageObserverImpl) 10 | } 11 | 12 | override public function teardown():void { 13 | lifetime.unmap(StageObserver); 14 | } 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Steam/src/main/boiler/steam/controller/ControllerDetector.as: -------------------------------------------------------------------------------- 1 | package boiler.steam.controller { 2 | public interface ControllerDetector { 3 | function isController(type:Class):Boolean; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Steam/src/main/boiler/steam/controller/ControllerExtension.as: -------------------------------------------------------------------------------- 1 | package boiler.steam.controller { 2 | import hookableSuspenders.handlers.mapping.AfterMapClassHandler; 3 | import hookableSuspenders.handlers.mapping.AfterMapSingletonHandler; 4 | 5 | import org.swiftsuspenders.InjectionConfig; 6 | 7 | public class ControllerExtension implements AfterMapSingletonHandler, AfterMapClassHandler { 8 | 9 | [Inject] 10 | public var controllerDetector:ControllerDetector; 11 | 12 | [Inject] 13 | public var methodMapper:ControllerMethodMapper; 14 | 15 | public function afterMapSingleton(newConfig:InjectionConfig):void { 16 | handleMapping(newConfig.request) 17 | } 18 | 19 | public function afterMapClass(newConfig:InjectionConfig):void { 20 | handleMapping(newConfig.request) 21 | } 22 | 23 | private function handleMapping(type:Class):void { 24 | if (! controllerDetector.isController(type)) 25 | return; 26 | 27 | methodMapper.mapController(type); 28 | } 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Steam/src/main/boiler/steam/controller/ControllerMethodMapper.as: -------------------------------------------------------------------------------- 1 | package boiler.steam.controller { 2 | public interface ControllerMethodMapper { 3 | function mapController(type:Class):void; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Steam/src/main/boiler/steam/controller/DefaultControllerDetector.as: -------------------------------------------------------------------------------- 1 | package boiler.steam.controller { 2 | import boiler.reflection.Reflection; 3 | import boiler.reflection.Reflector; 4 | 5 | public class DefaultControllerDetector implements ControllerDetector { 6 | 7 | private static const CONTROLLER_NAMESPACE:String = "controller"; 8 | 9 | [Inject] 10 | public var reflector:Reflector; 11 | 12 | public function isController(type:Class):Boolean { 13 | 14 | var reflection:Reflection = reflector.getReflection(type); 15 | 16 | return (reflection.instance() && hasControllerMetadata(reflection)) || 17 | hasControllerClassName(reflection) || 18 | reflection.hasLeafNamespace(CONTROLLER_NAMESPACE) || 19 | reflection.hasAnyNamespace(CONTROLLER_NAMESPACE); 20 | } 21 | 22 | private function hasControllerMetadata(reflection:Reflection):Boolean { 23 | return reflection.classMetadata().(@name == "Controller").length() > 0; 24 | } 25 | 26 | private function hasControllerClassName(reflection:Reflection):Boolean { 27 | return reflection.fqn().search(/Controller$/) > 0; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Steam/src/main/boiler/steam/controller/DefaultControllerMethodMapper.as: -------------------------------------------------------------------------------- 1 | package boiler.steam.controller { 2 | import boiler.reflection.Reflection; 3 | import boiler.reflection.Reflector; 4 | import boiler.steam.dispatcher.Dispatcher; 5 | 6 | import flash.utils.getDefinitionByName; 7 | 8 | public class DefaultControllerMethodMapper implements ControllerMethodMapper { 9 | [Inject] 10 | public var reflector:Reflector; 11 | 12 | [Inject] 13 | public var dispatcher:Dispatcher; 14 | 15 | public function mapController(type:Class):void { 16 | var reflection:Reflection = reflector.getReflection(type); 17 | 18 | for each (var method:XML in reflection.type().factory.method) { 19 | registerMethod(method, type); 20 | } 21 | } 22 | 23 | private function registerMethod(method:XML, type:Class):void { 24 | if (! hasCorrectParameterLength(method)) 25 | return; 26 | 27 | dispatcher.registerSignalClass(getSignalParameterClass(method), type, method.@name); 28 | } 29 | 30 | private function getSignalParameterClass(method:XML):* { 31 | return getDefinitionByName(method.parameter[0].@type); 32 | } 33 | 34 | private function hasCorrectParameterLength(method:XML):Boolean { 35 | return method.parameter.length() == 1; 36 | } 37 | 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Steam/src/main/boiler/steam/dispatcher/Dispatcher.as: -------------------------------------------------------------------------------- 1 | package boiler.steam.dispatcher { 2 | public interface Dispatcher { 3 | 4 | // @todo we could use more fluency: listenFor(MyBigEvent).usingInstanceOf(MyController).call("doMyBigThing") 5 | 6 | function registerSignalClass(signalClass:Class, targetControllerClass:Class, methodName:String):void; 7 | 8 | function destruct():void; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Steam/src/main/boiler/steam/dispatcher/EventBasedDispatcher.as: -------------------------------------------------------------------------------- 1 | package boiler.steam.dispatcher { 2 | import boiler.base.Lifetime; 3 | import boiler.reflection.ClassByInstanceCache; 4 | import boiler.reflection.helpers.EventClassHelper; 5 | 6 | import flash.events.Event; 7 | import flash.utils.Dictionary; 8 | 9 | public class EventBasedDispatcher implements Dispatcher { 10 | 11 | [Inject] 12 | public var lifetime:Lifetime; 13 | 14 | [Inject] 15 | public var classCache:ClassByInstanceCache; 16 | 17 | [Inject] 18 | public var connector:EventBasedNotifierConnector; 19 | 20 | [Inject] 21 | public var eventClassReflection:EventClassHelper; 22 | 23 | private var executionMap:Dictionary = new Dictionary(); 24 | 25 | [PostConstruct] 26 | public function setup():void { 27 | connector.setHandler(handleSignal); 28 | } 29 | 30 | public function registerSignalClass(signalClass:Class, targetControllerClass:Class, methodName:String):void { 31 | connector.connect(eventClassReflection.findSimpleEventType(signalClass)); 32 | createExecutor(signalClass, targetControllerClass, methodName); 33 | } 34 | 35 | private function createExecutor(signalClass:Class, targetControllerClass:Class, methodName:String):void { 36 | executionMap[signalClass] = function(event:Event):void { 37 | var controller:* = lifetime.getInstance(targetControllerClass); 38 | controller[methodName].call(null, event); 39 | } 40 | } 41 | 42 | private function handleSignal(event:Event):void { 43 | executionMap[classCache.getClassByInstance(event)].call(null, event); 44 | } 45 | 46 | public function destruct():void { 47 | connector.disconnectAll(); 48 | executionMap = null; 49 | } 50 | 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Steam/src/main/boiler/steam/dispatcher/EventBasedNotifierConnector.as: -------------------------------------------------------------------------------- 1 | package boiler.steam.dispatcher { 2 | import flash.events.IEventDispatcher; 3 | import flash.utils.Dictionary; 4 | 5 | // @todo the name, it sucks.. whats the responsibility here? MapperMappingStore? HookUpAndBeAbleToSplitUp? gah 6 | public class EventBasedNotifierConnector { 7 | 8 | [Inject] 9 | public var notifier:IEventDispatcher; 10 | 11 | private var listeners:Dictionary = new Dictionary(); 12 | private var _handler:Function; 13 | 14 | public function setHandler(handler:Function):EventBasedNotifierConnector { 15 | _handler = handler; 16 | return this; 17 | 18 | } 19 | 20 | public function connect(eventType:String):void { 21 | if (listeners[eventType]) 22 | return; 23 | 24 | notifier.addEventListener(eventType, _handler); 25 | listeners[eventType] = true; 26 | } 27 | 28 | public function disconnectAll():void { 29 | 30 | for (var eventType:String in listeners) { 31 | notifier.removeEventListener(eventType, _handler); 32 | } 33 | listeners = null; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Steam/src/main/boiler/steam/mediator/DefaultMediatorDetector.as: -------------------------------------------------------------------------------- 1 | package boiler.steam.mediator { 2 | import boiler.base.Lifetime; 3 | import boiler.reflection.ClassByInstanceCache; 4 | import boiler.reflection.Reflection; 5 | import boiler.reflection.Reflector; 6 | import boiler.steam.mediator.map.MediatorFactory; 7 | 8 | import flash.utils.getDefinitionByName; 9 | 10 | public class DefaultMediatorDetector implements MediatorDetector { 11 | private static const MEDIATOR_NAMESPACE:String = "mediator"; 12 | private static const VIEW_NAMESPACE:String = "view"; 13 | private static const VIEW_REGISTER_METHOD_NAME:String = "register"; 14 | private static const VIEW_DEREGISTER_METHOD_NAME:String = "deregister"; 15 | 16 | private var reflection:Reflection; 17 | 18 | [Inject] 19 | public var lifetime:Lifetime; 20 | 21 | [Inject] 22 | public var reflector:Reflector; 23 | 24 | [Inject] 25 | public var instanceCache:ClassByInstanceCache; 26 | 27 | public function getConfigurationFor(type:Class):MediatorFactory { 28 | reflection = reflector.getReflection(type); 29 | 30 | if (!isMediatorInName()) 31 | return null; 32 | 33 | var viewType:Class = extractViewType(); 34 | 35 | if (viewType == null) 36 | return null; 37 | 38 | var deregisterMethodName:String = getDeregisterMethodName(); 39 | 40 | return new MediatorFactory( 41 | lifetime, 42 | type, 43 | viewType, 44 | VIEW_REGISTER_METHOD_NAME, 45 | deregisterMethodName 46 | ); 47 | } 48 | 49 | private function getDeregisterMethodName():String { 50 | var descriptionList:XMLList = reflection.type().factory.method.(@name == VIEW_DEREGISTER_METHOD_NAME); 51 | 52 | if (descriptionList.length() == 0) 53 | return null; 54 | 55 | return VIEW_DEREGISTER_METHOD_NAME; 56 | 57 | } 58 | 59 | private function extractViewType():Class { 60 | var method:XML = getRegisterMethodDescription(); 61 | 62 | if (method == null) 63 | return null; 64 | 65 | return Class(getDefinitionByName(method.parameter[0].@type.replace(/::/, "."))); 66 | } 67 | 68 | private function isMediatorInName():Boolean { 69 | 70 | return hasMediatorMetadata() || 71 | hasMediatorClassName() || 72 | reflection.hasLeafNamespace(MEDIATOR_NAMESPACE) || 73 | reflection.hasLeafNamespace(VIEW_NAMESPACE) || 74 | reflection.hasAnyNamespace(MEDIATOR_NAMESPACE) || 75 | reflection.hasAnyNamespace(VIEW_NAMESPACE) 76 | } 77 | 78 | private function getRegisterMethodDescription():XML { 79 | 80 | var descriptionList:XMLList = reflection.type().factory.method.(@name == VIEW_REGISTER_METHOD_NAME); 81 | 82 | if (descriptionList.length() == 0) 83 | return null; 84 | 85 | return descriptionList[0]; 86 | 87 | } 88 | 89 | private function hasMediatorMetadata():Boolean { 90 | if (!reflection.instance()) 91 | return false; 92 | 93 | return reflection.classMetadata().(@name == "Mediator").length() > 0; 94 | } 95 | 96 | private function hasMediatorClassName():Boolean { 97 | return reflection.fqn().search(/Mediator$/) > 0; 98 | } 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /Steam/src/main/boiler/steam/mediator/MediatorDetector.as: -------------------------------------------------------------------------------- 1 | package boiler.steam.mediator { 2 | import boiler.steam.mediator.map.MediatorFactory; 3 | 4 | public interface MediatorDetector { 5 | function getConfigurationFor(mediatorType:Class):MediatorFactory; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Steam/src/main/boiler/steam/mediator/MediatorExtension.as: -------------------------------------------------------------------------------- 1 | package boiler.steam.mediator { 2 | import boiler.base.Lifetime; 3 | import boiler.steam.mediator.map.MediatorFactory; 4 | import boiler.steam.mediator.map.MediatorMap; 5 | import boiler.steam.stageObserver.StageObserver; 6 | 7 | import flash.display.DisplayObject; 8 | 9 | import hookableSuspenders.handlers.mapping.AfterMapClassHandler; 10 | 11 | import org.swiftsuspenders.InjectionConfig; 12 | 13 | public class MediatorExtension implements AfterMapClassHandler { 14 | 15 | [Inject] 16 | public var detector:MediatorDetector; 17 | 18 | [Inject] 19 | public var lifetime:Lifetime; 20 | 21 | [Inject] 22 | public var observer:StageObserver; 23 | 24 | [Inject] 25 | public var instanceHandler:ViewInstanceHandler; 26 | 27 | [Inject] 28 | public var mediatorMap:MediatorMap; 29 | 30 | [PostConstruct] 31 | public function setup():void { 32 | configureObserver(); 33 | configureInstanceHandler(); 34 | } 35 | 36 | public function afterMapClass(newConfig:InjectionConfig):void { 37 | handleMapping(newConfig.request) 38 | } 39 | 40 | public function handleMapping(type:Class):void { 41 | var config:MediatorFactory = detector.getConfigurationFor(type); 42 | 43 | if (config == null) 44 | return; 45 | 46 | mediatorMap.mapFactory(config); 47 | } 48 | 49 | private function configureObserver():void { 50 | if (!lifetime.hasMapping(DisplayObject)) 51 | return; 52 | 53 | const displayRoot:DisplayObject = lifetime.getInstance(DisplayObject); 54 | 55 | observer.setDisplayRoot(displayRoot).setHandler(instanceHandler); 56 | 57 | } 58 | 59 | private function configureInstanceHandler():void { 60 | instanceHandler.setMediatorMap(mediatorMap); 61 | } 62 | 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Steam/src/main/boiler/steam/mediator/MediatorSugar.as: -------------------------------------------------------------------------------- 1 | package boiler.steam.mediator { 2 | import flash.display.DisplayObject; 3 | 4 | public interface MediatorSugar { 5 | function register(view:DisplayObject):MediatorSugar; 6 | 7 | function deregister():MediatorSugar; 8 | 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Steam/src/main/boiler/steam/mediator/ViewInstanceHandler.as: -------------------------------------------------------------------------------- 1 | package boiler.steam.mediator { 2 | import boiler.steam.mediator.map.MediatorFactory; 3 | import boiler.steam.mediator.map.MediatorMap; 4 | import boiler.steam.stageObserver.StageObserverHandler; 5 | 6 | import flash.display.DisplayObject; 7 | import flash.utils.Dictionary; 8 | 9 | public class ViewInstanceHandler implements StageObserverHandler { 10 | 11 | private var _mediatorMap:MediatorMap; 12 | 13 | private var removes:Dictionary = new Dictionary(); 14 | 15 | public function setMediatorMap(mediatorMap:MediatorMap):void { 16 | _mediatorMap = mediatorMap; 17 | } 18 | 19 | public function onAddedToStage(view:DisplayObject):void { 20 | const factories:Array = getFactories(view); 21 | const removeMethods:Array = removes[view] = []; 22 | 23 | var mediator:*; 24 | 25 | for each (var mediatorFactory:MediatorFactory in factories) { 26 | mediator = mediatorFactory.registerMediator(view); 27 | removeMethods.push(function():void { 28 | mediatorFactory.deregisterMediator(mediator) 29 | }); 30 | } 31 | } 32 | 33 | private function getFactories(view:DisplayObject):Array { 34 | return _mediatorMap.getMediatorFactories(view); 35 | } 36 | 37 | public function onRemovedFromStage(view:DisplayObject):void { 38 | var removeMethods:Array = removes[view]; 39 | 40 | for each (var closure:Function in removeMethods) { 41 | closure(); 42 | } 43 | } 44 | 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Steam/src/main/boiler/steam/mediator/map/MediatorFactory.as: -------------------------------------------------------------------------------- 1 | package boiler.steam.mediator.map { 2 | import boiler.base.Lifetime; 3 | 4 | import flash.display.DisplayObject; 5 | 6 | public class MediatorFactory { 7 | private var _mediatorType:Class; 8 | private var _viewType:Class; 9 | private var _registerMethodName:String; 10 | private var _deregisterMethodName:String; 11 | private var _lifetime:Lifetime; 12 | 13 | public function MediatorFactory(lifetime:Lifetime, mediatorType:Class, viewType:Class, registerMethodName:String, deregisterMethodName:String = null) { 14 | _lifetime = lifetime; 15 | _mediatorType = mediatorType; 16 | _viewType = viewType; 17 | _registerMethodName = registerMethodName; 18 | _deregisterMethodName = deregisterMethodName; 19 | } 20 | 21 | private function hasDeregister():Boolean { 22 | return _deregisterMethodName != null; 23 | } 24 | 25 | public function registerMediator(view:DisplayObject):* { 26 | const mediator:* = _lifetime.getInstance(_mediatorType); 27 | mediator[_registerMethodName].call(null, view); 28 | return mediator; 29 | 30 | } 31 | 32 | public function deregisterMediator(mediator:*):void { 33 | if (!hasDeregister()) 34 | return; 35 | 36 | mediator[_deregisterMethodName].call(); 37 | } 38 | 39 | public function get viewType():Class { 40 | return _viewType; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Steam/src/main/boiler/steam/mediator/map/MediatorMap.as: -------------------------------------------------------------------------------- 1 | package boiler.steam.mediator.map { 2 | import flash.display.DisplayObject; 3 | 4 | public interface MediatorMap { 5 | function mapFactory(config:MediatorFactory):MediatorMap; 6 | 7 | function getMediatorFactoriesByClass(viewType:Class):Array; 8 | 9 | function getMediatorFactories(viewInstance:DisplayObject):Array; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Steam/src/main/boiler/steam/mediator/map/MediatorMapImpl.as: -------------------------------------------------------------------------------- 1 | package boiler.steam.mediator.map { 2 | import boiler.reflection.ClassByInstanceCache; 3 | 4 | import flash.display.DisplayObject; 5 | import flash.utils.Dictionary; 6 | 7 | public class MediatorMapImpl implements MediatorMap { 8 | 9 | [Inject] 10 | public var instanceCache:ClassByInstanceCache; 11 | private var factories:Dictionary = new Dictionary(); 12 | 13 | public function mapFactory(config:MediatorFactory):MediatorMap { 14 | getMediatorFactoriesByClass(config.viewType).push(config); 15 | return this; 16 | } 17 | 18 | public function getMediatorFactoriesByClass(viewType:Class):Array { 19 | return factories[viewType] ||= []; 20 | } 21 | 22 | public function getMediatorFactories(viewInstance:DisplayObject):Array { 23 | const viewType:Class = instanceCache.getClassByInstance(viewInstance); 24 | return getMediatorFactoriesByClass(viewType); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Steam/src/main/boiler/steam/notifier/NotifierExtension.as: -------------------------------------------------------------------------------- 1 | package boiler.steam.notifier { 2 | import boiler.base.Lifetime; 3 | import boiler.steam.mediator.*; 4 | import boiler.steam.mediator.map.MediatorFactory; 5 | import boiler.steam.mediator.map.MediatorMap; 6 | import boiler.steam.stageObserver.StageObserver; 7 | 8 | import flash.display.DisplayObject; 9 | 10 | import hookableSuspenders.handlers.instance.BeforeInstanceHandler; 11 | import hookableSuspenders.handlers.mapping.AfterMapClassHandler; 12 | 13 | import org.swiftsuspenders.InjectionConfig; 14 | 15 | public class NotifierExtension implements AfterMapClassHandler, BeforeInstanceHandler { 16 | 17 | [Inject] 18 | public var detector:MediatorDetector; 19 | 20 | [Inject] 21 | public var lifetime:Lifetime; 22 | 23 | [Inject] 24 | public var observer:StageObserver; 25 | 26 | [Inject] 27 | public var instanceHandler:ViewInstanceHandler; 28 | 29 | [Inject] 30 | public var mediatorMap:MediatorMap; 31 | 32 | [PostConstruct] 33 | public function setup():void { 34 | configureObserver(); 35 | configureInstanceHandler(); 36 | } 37 | 38 | public function afterMapClass(newConfig:InjectionConfig):void { 39 | handleMapping(newConfig.request) 40 | } 41 | 42 | public function handleMapping(type:Class):void { 43 | var config:MediatorFactory = detector.getConfigurationFor(type); 44 | 45 | if (config == null) 46 | return; 47 | 48 | mediatorMap.mapFactory(config); 49 | } 50 | 51 | private function configureObserver():void { 52 | if (!lifetime.hasMapping(DisplayObject)) 53 | return; 54 | 55 | const displayRoot:DisplayObject = lifetime.getInstance(DisplayObject); 56 | 57 | observer.setDisplayRoot(displayRoot).setHandler(instanceHandler); 58 | 59 | } 60 | 61 | private function configureInstanceHandler():void { 62 | instanceHandler.setMediatorMap(mediatorMap); 63 | } 64 | 65 | public function beforeInstanced(type:Class):void { 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Steam/src/main/boiler/steam/stageObserver/StageObserver.as: -------------------------------------------------------------------------------- 1 | package boiler.steam.stageObserver { 2 | import flash.display.DisplayObject; 3 | 4 | public interface StageObserver { 5 | function setDisplayRoot(root:DisplayObject):StageObserver; 6 | 7 | function setHandler(handlerType:StageObserverHandler):StageObserver; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Steam/src/main/boiler/steam/stageObserver/StageObserverHandler.as: -------------------------------------------------------------------------------- 1 | package boiler.steam.stageObserver { 2 | import flash.display.DisplayObject; 3 | 4 | public interface StageObserverHandler { 5 | function onAddedToStage(displayObject:DisplayObject):void; 6 | 7 | function onRemovedFromStage(displayObject:DisplayObject):void; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Steam/src/main/boiler/steam/stageObserver/StageObserverImpl.as: -------------------------------------------------------------------------------- 1 | package boiler.steam.stageObserver { 2 | import flash.display.DisplayObject; 3 | import flash.events.Event; 4 | 5 | public class StageObserverImpl implements StageObserver { 6 | 7 | private var root:DisplayObject; 8 | private var handler:StageObserverHandler; 9 | 10 | public function setDisplayRoot(root:DisplayObject):StageObserver { 11 | if (!isSameRoot(root)) 12 | removeListeners(); 13 | 14 | this.root = root; 15 | 16 | if (hasRoot()) 17 | return this; 18 | 19 | addListeners(); 20 | 21 | return this; 22 | } 23 | 24 | public function setHandler(handlerType:StageObserverHandler):StageObserver { 25 | handler = handlerType; 26 | return this; 27 | } 28 | 29 | private function isSameRoot(root:DisplayObject):Boolean { 30 | return this.root == root; 31 | } 32 | 33 | private function hasRoot():Boolean { 34 | return this.root == null; 35 | } 36 | 37 | private function removeListeners():void { 38 | if (root == null) 39 | return; 40 | 41 | root.removeEventListener(Event.ADDED_TO_STAGE, handleAdd, true); 42 | root.removeEventListener(Event.REMOVED_FROM_STAGE, handleRemove, true); 43 | } 44 | 45 | private function addListeners():void { 46 | if (root == null) 47 | return; 48 | 49 | root.addEventListener(Event.ADDED_TO_STAGE, handleAdd, true); 50 | root.addEventListener(Event.REMOVED_FROM_STAGE, handleRemove, true); 51 | } 52 | 53 | private function handleAdd(event:Event):void { 54 | // todo, flex debounce 55 | handler.onAddedToStage(DisplayObject(event.target)); 56 | } 57 | 58 | private function handleRemove(event:Event):void { 59 | handler.onRemovedFromStage(DisplayObject(event.target)); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Steam/src/test/boiler/steam/controller/DefaultControllerDetectorCase.as: -------------------------------------------------------------------------------- 1 | package boiler.steam.controller { 2 | import boiler.base.Lifetime; 3 | import boiler.reflection.Reflection; 4 | import boiler.reflection.ReflectionBase; 5 | import boiler.reflection.Reflector; 6 | 7 | import fixtures.boiler.steam.detector.ByClassNameController; 8 | import fixtures.boiler.steam.detector.ControllerByMetadata; 9 | import fixtures.boiler.steam.detector.controller.ControllerByNamespace; 10 | import fixtures.boiler.steam.detector.controller.subNamespace.ControllerByParentNamespace; 11 | import fixtures.boiler.steam.detector.notController.NotAControllerAtAll; 12 | 13 | import org.flexunit.asserts.assertFalse; 14 | import org.hamcrest.assertThat; 15 | 16 | public class DefaultControllerDetectorCase { 17 | private var detector:DefaultControllerDetector; 18 | private var classUnderTest:Class; 19 | 20 | [Before] 21 | public function setup():void { 22 | var lifetime:Lifetime = new Lifetime(); 23 | lifetime.mapClass(Reflection, ReflectionBase); 24 | lifetime.mapSingleton(Reflector); 25 | detector = new DefaultControllerDetector(); 26 | lifetime.injectInto(detector); 27 | } 28 | 29 | [After] 30 | public function teardown():void { 31 | detector = null; 32 | classUnderTest = null; 33 | } 34 | 35 | [Test( 36 | given="A class with a non leaf namespace 'controller'", 37 | it="It detects a class with a non-leaf namespace 'controller'" 38 | )] 39 | public function ItDetectsAClassWIthANonLeafNamespaceController():void { 40 | withControllerByParentNamespace(); 41 | assertThat(detector.isController(classUnderTest)); 42 | } 43 | 44 | [Test( 45 | given="A class with a leaf namespace 'controller'", 46 | it="It detects a class with a leaf namespace 'controller'" 47 | )] 48 | public function ItDetectsAClassWIthALeafNamespaceController():void { 49 | withControllerByNamespace(); 50 | assertThat(detector.isController(classUnderTest)); 51 | } 52 | 53 | [Test( 54 | given="A class with name that ends in 'Controller'", 55 | it="It detects a class with a name ending in 'Controller'" 56 | )] 57 | public function ItDetectsAClassWithANameEndingInController():void { 58 | withControllerByName(); 59 | assertThat(detector.isController(classUnderTest)); 60 | } 61 | 62 | [Test( 63 | given="A class marked with controller metadata", 64 | it="It detects a class with '[Controller]' metadata" 65 | )] 66 | public function ItDetectsAClassWithControllerMetadata():void { 67 | withControllerByMetadata(); 68 | assertThat(detector.isController(classUnderTest)); 69 | } 70 | 71 | [Test( 72 | given="A class that is not a controller", 73 | it="It does not detect a class that is not a controller" 74 | )] 75 | public function ItDoesNotDetectAClassWithNoControllerNamespace():void { 76 | withNotAControllerAtAll(); 77 | assertFalse(detector.isController(classUnderTest)); 78 | } 79 | 80 | //************** GIVENS ***************// 81 | 82 | private function withControllerByMetadata():void { 83 | classUnderTest = ControllerByMetadata; 84 | } 85 | 86 | private function withControllerByName():void { 87 | classUnderTest = ByClassNameController; 88 | } 89 | 90 | private function withControllerByNamespace():void { 91 | classUnderTest = ControllerByNamespace; 92 | } 93 | 94 | private function withNotAControllerAtAll():void { 95 | classUnderTest = NotAControllerAtAll; 96 | } 97 | 98 | private function withControllerByParentNamespace():void { 99 | classUnderTest = ControllerByParentNamespace; 100 | } 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /Steam/src/test/fixtures/boiler/steam/detector/ByClassNameController.as: -------------------------------------------------------------------------------- 1 | package fixtures.boiler.steam.detector { 2 | import flash.events.Event; 3 | 4 | /** 5 | * A class that would be detected as a controller because of it's class name ending in Controller 6 | */ 7 | public class ByClassNameController { 8 | 9 | public function anAction(event:Event):void { 10 | 11 | } 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Steam/src/test/fixtures/boiler/steam/detector/ControllerByMetadata.as: -------------------------------------------------------------------------------- 1 | package fixtures.boiler.steam.detector { 2 | import flash.events.Event; 3 | 4 | [Controller] 5 | public class ControllerByMetadata { 6 | 7 | public function anAction(event:Event):void { 8 | 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Steam/src/test/fixtures/boiler/steam/detector/controller/ControllerByNamespace.as: -------------------------------------------------------------------------------- 1 | package fixtures.boiler.steam.detector.controller { 2 | import flash.events.Event; 3 | 4 | /** 5 | * A Class that detects as a controller because of it's namespace 6 | */ 7 | public class ControllerByNamespace { 8 | public function anAction(event:Event):void { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Steam/src/test/fixtures/boiler/steam/detector/controller/subNamespace/ControllerByParentNamespace.as: -------------------------------------------------------------------------------- 1 | package fixtures.boiler.steam.detector.controller.subNamespace { 2 | import flash.events.Event; 3 | 4 | /** 5 | * A Class that detects as a controller because of a parent namespace 6 | */ 7 | public class ControllerByParentNamespace { 8 | public function anAction(event:Event):void { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Steam/src/test/fixtures/boiler/steam/detector/notController/NotAControllerAtAll.as: -------------------------------------------------------------------------------- 1 | package fixtures.boiler.steam.detector.notController { 2 | import flash.events.Event; 3 | 4 | /** 5 | * A class that has a method that looks like a controller method, 6 | * however the class does not match any criteria for being a controller. 7 | * Even tho, its namepace and class name mention the word 'controller' 8 | */ 9 | public class NotAControllerAtAll { 10 | 11 | public function looksLikeAControllerMethod(event:Event):void { 12 | 13 | } 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /StopwatchSampleApp/StopwatchSampleApp.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /StopwatchSampleApp/src/main/StopwatchSampleApp.mxml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /StopwatchSampleApp/src/main/StopwatchSampleAppInitializer.as: -------------------------------------------------------------------------------- 1 | package main { 2 | import boiler.base.Initializer; 3 | import boiler.base.Lifetime; 4 | 5 | import flash.display.DisplayObject; 6 | 7 | import main.configuration.StopwatchConfiguration; 8 | 9 | public class StopwatchSampleAppInitializer implements Initializer { 10 | 11 | private var root:DisplayObject; 12 | 13 | public function StopwatchSampleAppInitializer(root:DisplayObject) { 14 | this.root = root; 15 | } 16 | 17 | public function run(lifetime:Lifetime):void { 18 | lifetime.runConfiguration(StopwatchConfiguration); 19 | lifetime.mapValue(DisplayObject, root); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /StopwatchSampleApp/src/main/configuration/StopwatchConfiguration.as: -------------------------------------------------------------------------------- 1 | package main.configuration { 2 | import boiler.base.configuration.ConfigurationBase; 3 | 4 | import main.controller.StopwatchController; 5 | import main.model.StopwatchTimeModel; 6 | import main.view.ElapsedTimeMediator; 7 | import main.view.StartStopButtonMediator; 8 | 9 | public class StopwatchConfiguration extends ConfigurationBase { 10 | 11 | override public function startup():void { 12 | 13 | // models 14 | lifetime.mapSingleton(StopwatchTimeModel); 15 | 16 | // controllers 17 | lifetime.mapSingleton(StopwatchController); 18 | 19 | // mediators 20 | lifetime.mapClass(StartStopButtonMediator, StartStopButtonMediator); 21 | lifetime.mapClass(ElapsedTimeMediator,ElapsedTimeMediator); 22 | } 23 | 24 | override public function teardown():void { 25 | // mediators 26 | lifetime.unmap(ElapsedTimeMediator); 27 | lifetime.unmap(StartStopButtonMediator); 28 | 29 | // controllers 30 | lifetime.unmap(StopwatchController); 31 | 32 | // models 33 | lifetime.unmap(StopwatchTimeModel); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /StopwatchSampleApp/src/main/controller/StopwatchController.as: -------------------------------------------------------------------------------- 1 | package main.controller { 2 | import main.model.StopwatchTimeModel; 3 | 4 | public class StopwatchController { 5 | [Inject] 6 | public var state:StopwatchTimeModel; 7 | 8 | public function toggle(event:ToggleStartStopEvent):void { 9 | state.toggleStopStart(); 10 | } 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /StopwatchSampleApp/src/main/controller/ToggleStartStopEvent.as: -------------------------------------------------------------------------------- 1 | package main.controller { 2 | 3 | import flash.events.Event; 4 | 5 | public class ToggleStartStopEvent extends Event { 6 | 7 | public static const TOGGLE:String = "ToggleStartStop"; 8 | 9 | public function ToggleStartStopEvent() { 10 | super(TOGGLE); 11 | } 12 | 13 | override public function clone():Event { 14 | return new ToggleStartStopEvent(); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /StopwatchSampleApp/src/main/model/StopwatchStateUpdatedEvent.as: -------------------------------------------------------------------------------- 1 | package main.model { 2 | 3 | import flash.events.Event; 4 | 5 | public class StopwatchStateUpdatedEvent extends Event { 6 | 7 | public static const UPDATED:String = "StopwatchStateUpdated"; 8 | 9 | public function StopwatchStateUpdatedEvent() { 10 | super(UPDATED); 11 | } 12 | 13 | override public function clone():Event { 14 | return new StopwatchStateUpdatedEvent(); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /StopwatchSampleApp/src/main/model/StopwatchTimeModel.as: -------------------------------------------------------------------------------- 1 | package main.model { 2 | import flash.events.IEventDispatcher; 3 | import flash.utils.getTimer; 4 | 5 | public class StopwatchTimeModel { 6 | 7 | private var startTime:int = -1; 8 | private var pauseTime:int = -1; 9 | 10 | [Inject] 11 | public var notifier:IEventDispatcher; 12 | 13 | public function getElapsedTime():int { 14 | if (isPaused()) 15 | return pauseTime; 16 | 17 | if (! isRunning()) 18 | return 0; 19 | 20 | return getCurrentRunTime(); 21 | } 22 | 23 | public function restart():void { 24 | if (isPaused()) { 25 | unPause(); 26 | } else { 27 | startTime = getElapsedTime(); 28 | } 29 | 30 | notifier.dispatchEvent(new StopwatchStateUpdatedEvent()); 31 | } 32 | 33 | public function reset():void { 34 | startTime = -1; 35 | pauseTime = -1; 36 | notifier.dispatchEvent(new StopwatchStateUpdatedEvent()); 37 | } 38 | 39 | public function stop():void { 40 | pauseTime = getCurrentRunTime(); 41 | startTime = -1; 42 | notifier.dispatchEvent(new StopwatchStateUpdatedEvent()); 43 | } 44 | 45 | public function isPaused():Boolean { 46 | return pauseTime >= 0 ; 47 | } 48 | 49 | public function isRunning():Boolean { 50 | return startTime >= 0; 51 | } 52 | 53 | public function toggleStopStart():void { 54 | if (isPaused()) { 55 | restart(); 56 | return; 57 | } 58 | 59 | stop(); 60 | } 61 | 62 | private function unPause():void { 63 | startTime = getTimer() - pauseTime; 64 | pauseTime = -1; 65 | } 66 | 67 | private function getCurrentRunTime():int { 68 | return getTimer() - startTime; 69 | } 70 | 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /StopwatchSampleApp/src/main/view/ElapsedTime.mxml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 14 | 15 | -------------------------------------------------------------------------------- /StopwatchSampleApp/src/main/view/ElapsedTimeMediator.as: -------------------------------------------------------------------------------- 1 | package main.view { 2 | import flash.events.IEventDispatcher; 3 | 4 | import main.model.StopwatchStateUpdatedEvent; 5 | import main.model.StopwatchTimeModel; 6 | 7 | public class ElapsedTimeMediator { 8 | 9 | private var view:ElapsedTime; 10 | 11 | [Inject] 12 | public var notifier:IEventDispatcher; 13 | 14 | [Inject] 15 | public var currentTime:StopwatchTimeModel; 16 | 17 | public function register(view:ElapsedTime):void { 18 | this.view = view; 19 | 20 | notifier.addEventListener(StopwatchStateUpdatedEvent.UPDATED, handleStateChange); 21 | 22 | updateFromModel(); 23 | } 24 | 25 | public function deregister():void { 26 | notifier.removeEventListener(StopwatchStateUpdatedEvent.UPDATED, handleStateChange); 27 | } 28 | 29 | private function handleStateChange(event:StopwatchStateUpdatedEvent):void { 30 | updateFromModel(); 31 | } 32 | 33 | private function updateFromModel():void { 34 | view.setTime(currentTime.getElapsedTime()); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /StopwatchSampleApp/src/main/view/StartStopButton.mxml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /StopwatchSampleApp/src/main/view/StartStopButtonMediator.as: -------------------------------------------------------------------------------- 1 | package main.view { 2 | import flash.events.IEventDispatcher; 3 | import flash.events.MouseEvent; 4 | 5 | import main.controller.ToggleStartStopEvent; 6 | import main.model.StopwatchStateUpdatedEvent; 7 | import main.model.StopwatchTimeModel; 8 | 9 | public class StartStopButtonMediator { 10 | 11 | [Inject] 12 | public var state:StopwatchTimeModel; 13 | 14 | [Inject] 15 | public var notifier:IEventDispatcher; 16 | 17 | private var view:StartStopButton; 18 | 19 | public function register(view:StartStopButton):void { 20 | this.view = view; 21 | addListeners(); 22 | updateFromModel(); 23 | } 24 | 25 | public function deregister():void { 26 | removeListeners(); 27 | } 28 | 29 | private function addListeners():void { 30 | view.addEventListener(MouseEvent.CLICK, handleClick); 31 | notifier.addEventListener(StopwatchStateUpdatedEvent.UPDATED, updateFromModel); 32 | } 33 | 34 | private function removeListeners():void { 35 | view.removeEventListener(MouseEvent.CLICK, handleClick); 36 | notifier.removeEventListener(StopwatchStateUpdatedEvent.UPDATED, updateFromModel) 37 | } 38 | 39 | private function updateFromModel(event:StopwatchStateUpdatedEvent = null):void { 40 | view.label = state.isRunning() ? "Stop" : "Start" ; 41 | } 42 | 43 | private function handleClick(event:MouseEvent):void { 44 | notifier.dispatchEvent(new ToggleStartStopEvent()) 45 | } 46 | 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /buildfile: -------------------------------------------------------------------------------- 1 | require 'buildr/as3' 2 | 3 | # Don't see the point in language subdirs on this project 4 | boiler_layout = Layout.new 5 | boiler_layout[:source, :main, :as3] = 'src/main' 6 | boiler_layout[:source, :test, :as3] = 'src/SkipyDeDooDah' 7 | 8 | vendor_layout = Layout.new 9 | vendor_layout[:source, :main, :as3] = 'src' 10 | 11 | # We need these maven repositories to download the flexunit4 and junit files 12 | repositories.remote << 13 | "http://artifacts.devboy.org" << 14 | "http://repo2.maven.org/maven2" 15 | 16 | desc "Robotlegs inspired, responsibility-oriented-configuration framework and MVCS reference implementation." 17 | define "BoilerProject", :layout => boiler_layout do 18 | 19 | # Do i need to build against 4 for 4 and 4.5 for 4.5? I guess I probably do. I wonder how I instruct buildr to do that 20 | DEFAULT_SDK = FlexSDK.new("4.5.1.21328") 21 | DEFAULT_SDK.default_options << 22 | "-keep-as3-metadata+=Inject" << 23 | "-keep-as3-metadata+=PostConstruct" << 24 | "-keep-as3-metadata+=Controller" << 25 | "-keep-as3-metadata+=Mediator" 26 | 27 | compile.options[:flexsdk] = DEFAULT_SDK 28 | 29 | # put this into a VERSION file so i can write a bumping task.. or does buildr let me write rake-like tasks? 30 | project.version = "0.0.1" 31 | 32 | define "vendor", :layout => vendor_layout do 33 | define "SwiftSuspenders" do 34 | compile.using :compc 35 | package :swc 36 | end 37 | end 38 | 39 | define "HookableSuspenders" do 40 | # todo configure tests 41 | compile.with projects("vendor:SwiftSuspenders") 42 | compile.using :compc 43 | package :swc 44 | doc.options[:flexsdk] = DEFAULT_SDK 45 | end 46 | 47 | define "Boiler" do 48 | # todo configure tests 49 | compile.with projects("HookableSuspenders") 50 | compile.using :compc 51 | 52 | # no more doc options yet.... bummer. 53 | doc.options[:flexsdk] = DEFAULT_SDK 54 | 55 | package :swc 56 | end 57 | 58 | define "FlickrGallerySample" do 59 | compile.with projects("Boiler") 60 | compile.using :mxmlc 61 | compile.from _("libs") 62 | compile.options[:main] = _(:source, :main, :as3) + "/BoilerFlickrGallery.mxml" 63 | package :swf 64 | end 65 | 66 | end -------------------------------------------------------------------------------- /test-libs/flexunit-4.0.0.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/squeedee/Boiler/3f243a4c8738ea91bd60d8ed087b7344e046d733/test-libs/flexunit-4.0.0.swc -------------------------------------------------------------------------------- /test-libs/flexunit-cilistener-4.0.0.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/squeedee/Boiler/3f243a4c8738ea91bd60d8ed087b7344e046d733/test-libs/flexunit-cilistener-4.0.0.swc -------------------------------------------------------------------------------- /test-libs/flexunit-uilistener-4.0.0.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/squeedee/Boiler/3f243a4c8738ea91bd60d8ed087b7344e046d733/test-libs/flexunit-uilistener-4.0.0.swc -------------------------------------------------------------------------------- /test-libs/hamcrest-1.0.2.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/squeedee/Boiler/3f243a4c8738ea91bd60d8ed087b7344e046d733/test-libs/hamcrest-1.0.2.swc -------------------------------------------------------------------------------- /todo.markdown: -------------------------------------------------------------------------------- 1 | ## Quick Task List 2 | * reflection needs a cache clear 3 | * steal robotlegs flex hack 4 | * break out modules more effectively 5 | * collaboration guidelines 6 | * Introductory article in the blog. 7 | * unmapping handlers in hookable 8 | * unmapping support in mediation. 9 | 10 | ## Next major 11 | * Smoke - the mobile framework 12 | * CI Server and test builds 13 | * Modular Extension for Steam. 14 | * demonstrate extension by sugaring 15 | * demonstrate extension by replacing 'commands' -------------------------------------------------------------------------------- /vendor/.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | -------------------------------------------------------------------------------- /vendor/SwiftSuspenders.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | --------------------------------------------------------------------------------