The seemingly insignificant Chameleon Control

Developers new to Community Server may rightly view it as a rather odd duck, with the Chameleon control model falling into that realm of feathered obfuscation.  Yet a rather seemingly insignificant control I wrote recently might help explain Chameleon, which when boiled down to the thick duck gravy is really quite swanlike.

The control I’m describing is from my CS-based Job Management app.  Certainly not a Community Server control you’ll see every day, as its function is to display all dates that charges are applied to a job for which there is no accompanying job slip printed and signed by the customer.

 

 

A CodeSmith-driven development approach generates our complete set of Chameleon classes in seconds. 

 

After which we jump to the essence of our control, the DataSource property in JobChargeDateList.cs

 

More CodeSmith comes into play here, with a Composite CodeSmith Template generating all of the code we need to retrieve our generic JobChargeDate object via our Action class and SQL Data Provider classes.  Our SQL procedure is ready and waiting, which completes the ensemble, at which point the Chameleon HTML sets the play.

 

<DBVT:JobChargeDateList runat=”server” Tag=”div” CssClass=”SlipChargeDates”>
    <NoneTemplate>
        <CSControl:ResourceControl ID=”ResourceControl1″
        ResourceName=”JobSlip_ChargeDatesNoRecs” runat=”server”
        ResourceFile=”DBVT.xml” />
    </NoneTemplate>
    <ItemTemplate>
        <DBVT:JobChargeDateData Property=”datecharged” runat=”server” />
        (<DBVT:JobChargeDateData Property=”chargetypes” runat=”Server” />)
    </ItemTemplate>
    <SeparatorTemplate>
    ,</SeparatorTemplate>
</DBVT:JobChargeDateList>

 

There’s nothing left but the Quack! Quack!

Article written by

A long time developer, I was an early adopter of Linux in the mid-90's for a few years until I entered corporate environments and worked with Microsoft technologies like ASP, then .NET. In 2008 I released Sueetie, an Online Community Platform built in .NET. In late 2012 I returned to my Linux roots and locked in on Java development. Much of my work is available on GitHub.