« I'm no Astraphysicist | Main | Who wants to see Non Visual Components anyways. »

February 04, 2008

The label on my Value Object

To define a default label on a value object, just create a getter function named « label » that returns the appropriate field. The label property is the default labelField for most display controls such as the List, ComboBox. You can also create getters on your value objects that concatenate strings together such as first and last name.  Just a little tip from me to you.

Here is a quick example. Enjoy.

public class UserVO

{

public function UserVO()

{

super();

}

public var nick_name : String;

public var first_name : String;

public var last_name : String;

// string together two fields with a getter

// use it as a label

public function get full_name():String

{

return first_name + " " + last_name;

}

// most controls will automatically pick this field up

// for display

public function get label():String

{

return full_name + " (" + this.nick_name + ")";

}

}

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d8341c046453ef00e55028be388834

Listed below are links to weblogs that reference The label on my Value Object:

Comments

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment