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.

Get the latest Salesforce Developer blog posts and podcast episodes via Slack or RSS.

Add to Slack Subscribe to RSS