Archive for October, 2009

Xcelsius Custom Component Logger

If you’ve ever had the pleasure (cough) of developing custom Xcelsius (XC) components then you know it’s synonymous with the arcane days of the early 2000s and developing Flash applications — no real debugging tools to speak of and traditional enterprise devs that were trying to get into the Flash game were left playing with a black box at runtime — it was incredibly painful and we were left up to our own innovative devices when it came time to perform runtime debugging.

So now I find myself coming back full circle to these “techniques” when trying to debug Xcelsius custom components, as there’s no real way to actually debug these suckers once you’re out of FlexBuilder and running them in the Xcelsius IDE, and for some reason SAP doesn’t feel the need to help developers be successful when dev’n custom components and provide tools like this, not to mention that the docs are…uhmmm…lacking at best???…but I digress…so without further delay, here’s one of my debugging tools called the Xcelsius Custom Component Logger, which is basically a revamp of the same logger I created to debug Flash apps at runtime waaaaay back…think Flash 5 or 6 when the LocalConnection was introduced into AS…anyone else remember these days?

The LocalConnection (LC) logger  consists of 2 parts:

  1. A SWF with a LC that receives messages — ie, logs statements — and displays them in a simple TextArea.
  2. A Logging Framework that provided basic logging methods you’d expect (debug, info, warn, error, and fatal) with a LC sender that pushed these messages to the receiving SWF

Since the logger leverages the basic Flex logging framework, it should seem pretty familiar — here’s how to get started:

  1. Import the XCLoggerLibrary.swc into your XC Custom Component project.
  2. Add a private static reference of your logger (example below).
  3. Create some log statements in your app…maybe some in your custom property sheet and some in the custom connector/uicomponent that you’re creating.
  4. Fire up the XcelsiusLogger.swf
  5. Open up XC with the Logger still open and you should start to see log statements (assuming you put log stmts in your XC Custom Component) when working in custom component property sheets (since they are just Flex apps); you’ll also see the log statements when previewing your XC app.

Quick Example

<?xml version="1.0" encoding="utf-8"?>
<mx:Application
	xmlns:mx="http://www.adobe.com/2006/mxml"
	creationComplete="this.init()">

	<mx:Script>
		<![CDATA[

			import com.webappsolution.xcelsius.logging.LocalConnectionLog;
			import mx.utils.ObjectUtil;
			import mx.logging.ILogger;

			// NOTE: Must have this line in to create an instance of the logger -- pass it the
			// name of the class it's debugging.
			private static var logger:ILogger = LocalConnectionLog.getLogger(XCLoggerTEST);

			private static const TEST_VALUE:int = 101;

			private function init():void
			{
				// all log levels
				logger.debug("init");
				logger.info("init");
				logger.warn("init");
				logger.error("init");
				logger.fatal("init");

				// testing sptting out a quick var
				logger.debug("init: TEST_VALUE = " + TEST_VALUE);

				// sometimes I spit out the entire contents of an object to see what's in it
				// ...especially when working with the XC API
				var person:Object = {firstName:"Brian", lastName:"Riley", age:31, colors:["red", "blue"]};
				logger.debug("init: person = " + ObjectUtil.toString(person));
			}

			private function onSubmitClick(e:MouseEvent):void
			{
				var firstAndLastName:String = this.firstNameTextInput.text + " " + this.lastNameTextInput.text;
				logger.debug("onSubmitClick: firstAndLastName = " + firstAndLastName);
				this.firstAndLastNameLabel.text = firstAndLastName;
			}
		]]>
	</mx:Script>

	<mx:Form width="100%" defaultButton="{this.submitBtn}">

		<mx:FormItem width="100%" label="First Name" required="true">
			<mx:TextInput id="firstNameTextInput" />
		</mx:FormItem>

		<mx:FormItem width="100%" label="Last Name" required="true">
			<mx:TextInput id="lastNameTextInput" />
		</mx:FormItem>

		<mx:Button id="submitBtn" label="Submit" click="onSubmitClick(event)" />

	</mx:Form>

	<mx:Label id="firstAndLastNameLabel" />

</mx:Application>

I find this tool really helpful when debugging the Custom PropertySheets for XC Components, as you can easily write test harnesses for the actual custom connection and custom UI components and debug in FlexBuilder.

Finally, it’s nothing fancy, but it at least allows you to see what’s going on once you’re in the Xcelsius IDE — I probably could have used one of the LC loggers on OS Flash like LuminicBox.Log, but I decided to just roll my own since I had it lying around on an old hard drive ;-) Oh, and I could’ve made this an AIR app, but leaving it as SWF suits my needs just fine.

Assets

, , ,

2 Comments

Where Can I Find fds.swc?

If you ever need to compile a Flex app that requires classes like:

mx.messaging.channels.RTMPChannel
mx.messaging.channels.SecureRTMPChannel

then you’ll need fds.swc which isn’t shipped with the Flex SDK, but is shipped with LCDS. Download a trial vr of LCDS and grab this file from the web-app:

WEB-INF/flex/libs/fds.swc

…why might you need these classes?…perhaps if you’re building a Bootstrap loader for LCDS apps loading sub-apps and you want to share the messaging classes between the parent and child apps…I had to do this for an Xcelsius application.

Post to Twitter Tweet This Post

, , , ,

No Comments

Axiis Examples with Lots of Comments

We’ve begun using Axiis on a current client’s project. The application is loaded with graphs and charts and when we hand off the project, we needed to provide a framework for the development staff to quickly build and add new graphing components. Some of the charts are simple but there are some more complicated ones we need to build and will be built in the future. The current Flex DataViz components work fine for simple tasks. But, anyone who has had to go beyond the basics understands the pain that you quickly begin to feel.

Fortunately, I caught Tom Gonzalez’s, (BrightPoint Consulting) lecture at MAX this month and was blown away. The things they’re doing with the Axiis framework and Degrafa are off the charts! (pun intended)

I’ll leave the real discovery to you to check out the Axiis site, but, Axiis is a ’specialized framework that implements specific design patterns that can be used to create your own visualizations’. It’s not a pre-built collection of charting components. They’ve developed a great way of abstracting the basic building blocks of doing data visualization.

Axiis is currently in beta release. There are a lot of great examples on their site so check them out. If you’re new to Degrafa, it’s worth your while to do a bit of reading and check out the cool examples they have on their site as well since many of the examples use Degrafa.

Being in beta, the documentation is a work in progress. The examples from the site are great and really cover a lot of space, but I did struggle with some of the concepts at first. So I’ve taken three of the first examples we needed to borrow from and hyper-commented them for clarity.
I’ll continue to add to the collection over time.

Cluster Stack Example

Linear Series Example

Cluster Column Example

Post to Twitter Tweet This Post

, ,

2 Comments