Object Oriented Apex – Practical Usage

A recent post came to my attention on our Visualforce Developer board.  The developer is taking advantage of code re-use in the form of custom components for his page implementation and wanted to have a way to establish communication between the page controller and the custom component.

As it turns out, this is the exact requirement that I needed to make the Facebook toolkit easy to use.  The answer lies in taking advantage of the ability to extend virtual classes in Apex.  A couple of virtual classes that implement the "wire up" of a page controller and a component controller allow you to simply extend those classes in both types of controllers to make each controller aware of the other. 

The details on this solution are found at Controller Component Communication on the wiki.

I would be interested to see someone extend the "framework" to handle multiple component controllers on a single page.  It's exciting to see what you can do with Apex and Visualforce and I encourage you to think creatively when bulding apps on the platform.  The things you can do just may surprise you!

View the real time demo of the Component Controller Communication Framework.

Published
July 28, 2009
Topics:

Leave your comments...

Object Oriented Apex – Practical Usage