How to make custom UIComponent Accessible? - apache-flex

I added a MXML component in flex and selected the base as UIComponent. I want to make it accessible so that automated testing tools can Access it. I am using TestComplete for automated testing. As TestComplete uses Microsoft Accessibility classes. Now it treat my component as the Graphics.
How Can I do this??

It should work, if the application was correctly prepared for testing with TestComplete. Check the Preparing Flex Applications for Testing with Automation APIs topic to learn more.

You won't have much luck automating Flex using MSAA, because the object hierarchy and information reported by MSAA is very limited. To improve things, you could try compiling your application with accessibility enabled and also creating a custom accessibility implementation for your component. However, I doubt it will make much difference.
Having said that, you should really consider upgrading to the TestComplete 8.20, because this version has proper support for Flex. By "proper" I mean that it identifies all objects inside Flex applications (including custom components), provides extra test objects for automating Flex controls and also lets you automate controls using their native properties. In addition, this version can dynamically load the testing library into Flex applications, so that no changes to the application's source code or build process are required.

Please look at the official documentation about Creating Applications for Testing
Especially the part about instrumenting custom components

Related

Modularity in Flex

I'm working on a pretty big application for Flex/Air. We are using GraniteDS and Tide to interact with the model from our Java EE server.
I've been reading about modularization and Modules in Flex. The application has already been built, and I'm figuring a way out to re-design some classes and parts. From what I've read so far, I understand a Module is a different swf which can be dynamically load. Most of the tutorials/documentation are oriented to Flash "programmers" who are using Flex or Air instead of real developers, so that makes online resources harder to get.
What I can't understand - yet - is how to encapsulate ActionScript classes or MXML views under this module.
I've separated some of the code into libraries. For example, the generated code from Granite is in a "server" library. But I would like to separate parts of the logic with its Moderators, Controllers and Views. Are modules the way to go? Is there a "modules for dummies" or "head first Flex Modules for programmers" like tutorial in order to get a better perspective in order to build my architecture? When to choose libraries and when to choose modules?
I'm using Flex 3.5, and a migration to Flex 4 is way far into the future, so no Flex 4 answers please, thanks!
Modules are the answer for encapsulating UI into different sections that do not depend on each other. Think of them like applications inside of applications.
If you want to encapsulate "code", meaning non-ui actionscript, then you really just want classes and packages of classes. You could also package that code into a swc, which is just a compiled version of that code that you can include in multiple projects (I think this is what you meant by libraries).
You wouldn't want to create a module just to contain non-ui code. You wouldn't want to use modules for separating out the model/view/controller in your application.
If you have part of your application, that for the most part runs completely on its own, with no real dependencies on the rest of the application except for maybe a little bit of information passed in, then it makes sense for modules.
Where we use modules mostly is for an application that has different sections to it where you are only working in one section at a time. There is no need for the other sections to be taking up resources, so we have the different sections in modules and load/unload them as necessary.
Does that help?
Edit in reply to the comment below:
By libraries I meant Flex Library
Projects, where you encapsulate
classses and use the swc. Can you have
these libraries inside a Flex Project?
(I use a separate Library Project for
each new library).
Yes, you can use these swc's (Libraries of code) inside of your flex projects. Just drop the swc in the lib directory in your flex/flash builder project and the code is automatically added to your classpath. Just make sure that everything that the code inside a single swc needs is inside that swc. Don't make a swc rely on another swc to function.

Dojo or flex with Grails?

I plan to build a database management system using Grails as the main framework. On the client side, I'm thinking whether to use dojo or flex to make a nice front end.
Could some experts here enlighten me on the pros and cons of choosing either, or both?
or any other options?
thanks!
I tried using Dojo in a project and even brought a few books. And while Dojo Looks good I found that JQuery and JQuery-UI was a lot lighter and worked faster.
This is just my opinion and it may help you.
From the description of the flex plugin at http://www.grails.org/Flex+Plugin
"This plugin was created as an experiment to prove that it's possible to communicate from Flex to Grails services without any configuration in Flex. There
is no plan to add functionality or whatsoever. It's not sure if the plugin works in production mode as it is only tested in development mode. This plugin
can be seen as an example on how to integrate Flex and Grails with Convention over Configuration in mind."
There is no scaffolding generation for flex, see this bug
Another disadvantage of Flex is its lack of accessibility for screen reader users with the default configuration. There is some work being done to address this but it isn't publically available yet.
I don't have experience with DOJO but according to this link if you use the standard Grails Ajax tags you should be able to switch libraries with out to much trouble and won't be tied to Dojo. For fancy UI stuff such as tabbed interfaces and data tables I've found GrailsUI works well for me. A demo project showing its features can be found at http://code.google.com/p/guidemo/ although you'll have to check the code out to run it.
I am developing an information-management application with Dojo 1.9.2 and Grails 2.3.9 (lots of simle/complex forms, listing screens...etc). The application has a single-page interface as well (a workspace) which was the primary reason for a heavy JavaScript library.
Overall, Dojo is fairly suitable for this kind of workload and I haven't bumped into any show-stoppers yet.
I needed to do a lot of work on integrating the Dojox DataGrid into the application (extending QueryReadStore to fit with Grails better...etc) and a set of custom widget extensions (e.g. a real, working AutoComplete).
After this larger, initial integration work is done, you can expect a fairly smooth ride.

Flex remoting (mx.rpc) classes in an ActionScript only project?

Is it possible (and if so recommended) to use Flex remoting (mx.rpc) classes in an ActionScript only project?
I'm creating an application with login and registration to a PHP backend using AMFphp.
As an option I was wondering if it made sense to take advantage of the mx.rpc flex classes.
Actionscript only projects still use the flex framework, so you're fine. Are you trying to do it with the Flash IDE, or are you using FlexBuilder? If Flex Builder, then it doesn't matter at all.
You can use NetConnection class too.
You can use the entire RPC framework, including remote objects, but you have to manually initialize it by registering a number of class aliases (the Flex framework would do this for you, otherwise).
This great blog post explains the how and why.
If you're not really interested in the details and just want to get going, I wrote a tutorial on how to integrate BlazeDS with RobotLegs, which includes a framework-agnostic example you can use as a turnkey.

Using Flex for an enterprise level application

I'm wondering if anyone has tried to use Flex to power the front end of an enterprise level application at all, and if so, what advantages/disadvantages did you find when doing so. I'm currently looking into a possible project that would have global users requiring enterprise level access and performance, and wondering if it would be prudent to call upon some of my contractors flex experience with this project.
Flex and Flash is a great tool for enterprise level applications.
Our general rule of thumb is to use Flex or Flash when the type of rich interface required cannot be achieved using html/javascript/ajax. In this event the rich UI in flash/flex should be built keeping in mind that its the "Presentation Layer" and apart from basic front-end validation all the work (server side validation and logic) should be done by the underlying application. I would say that flex/flash should be used ot build component parts of an interface, not the whole interface.
The advantages are mainly in achieving a much richer and more stable interface than html/javascript/ajax type interfaces. In my experience the development time may not neccessarily be quicker, but the end result can be much greater!
The disadvantages I have experienced come in the form of finding the right kind of developers and finding developers to take over projects if contractors are used.
I have been using it for exactly that and, like anything, it has it ups and its down. One thing I have found impressive is its support for SOAP based web services. Your requirements here are very vague - but I would say that using Flex has been a positive experience for me.
There are thousands of production Flex enterprise apps out there. If you are looking for help check out these companies:
Gorilla Logic
Cynergy Systems
Universal Mind

Add ons in a compiled language

We are developing a CMS in ASP.NET. We love the idea of add-ons (like in Wordpress, where any developer can add a menu button or a widget) and would like to enable developers to do the same with our system.
However I think that the fact that C# is a compiled language is an obstacle in the way of add-ons.
Am I right? Or is there a way to create add-ons for a ASP.NET application?
The fact that C# is a compiled language isn't a problem at all. In fact the .NET framework should make it relatively easy to load other code (just as Java does, for the same reason). Look into the Managed Extensibility Framework, which is all about loading Add-Ons in managed code.
It's not an obstacle at all. MEF has already been mentioned, you could also use:
System.Addin
Mono.Addins
I'm not sure for ASP.NET specifically, but in the only compiled programming language I know (Objective-C/Cocoa), there's the concept of Bundles that can be loaded dynamically. I'm not sure how that works on the backend, but I'd guess that there is some similar system for C#/ASP.NET.
I don't know how it's done in Wordpress, but there should be many ways. You can allow developers to upload their assemblies with compiled code or you can allow them to upload code in C# or IronPython or anything that supported and compile it dynamically. Maybe you can use WebParts for your task.
Microsoft has created the Managed Extensibility Framework (MEF), specifically for this problem: providing .NET plugins for .NET applications. It is the framework that (future versions of) Visual Studio use for writing managed plugins.
However, please consider using a dynamic scripting language for this! Problems like this are exactly what they are specifically designed for. If you host the Dynamic Language Runtime in your application, it not only means that your users can extend the application in a scripting language, but even in any dynamic language (scripting or otherwise) for which a DLR implementation exists: Ruby, Python, Smalltalk, Scheme, JavaScript, PHP, you name it. Biggest disadvantage: the DLR hasn't been released yet.
In C#, you can create any assemblies, link them as DLL files and then do whatever you want.
The usual case would be to define some kind of Plugin Interface which must be implemented by all the plugins.
Then you can load all plugins from the filesystem (by iterating over the plugin DLLs), find the class inside which implements the interface, instantiate it and work with it.
If you want to provide plugins with unloadability and security, you could create an application domain and load the plugins to that, increasing complexity, but also increasing stability (a bad plugin won't crash your app).
Please ask more specifically if you want a specific answer :-)
It's not too difficult to put hooks in place. You have to define in advance where the add-on features will appear. For example: when drawing a menu you can use reflection to search other dlls (with specific names and locations) for a "BuildMenu" function. You'll be defining the API for this function signature. It may have to return a list of items to be added to the base menu items collection.

Resources