October 25, 2016
Hot Topics:

Painting Web Applications

  • April 20, 2007
  • By Sean Kelly
  • Send Email »
  • More Articles »

Adding Attributes

The DVD class certainly doesn't have much character about it, does it? You'll make it much more interesting by adding attributes to the class that capture the characteristics of a DVD. Just like in the last article, the attributes will include a DVD number (so you can find it on the shelf), a running time (in minutes), a rating (so you can keep your kids from seeing Grindhouse until they're 17, for example), and a selection of genres to which the movie belongs.

To add an attribute, click the Properties section at the bottom of the window and then click the "New Attribute" button, as shown below:

For the first attribute, enter the name dvdNumber and leave the data type as int. Then, click the Tagged Values section and annotate this attribute with the values shown below:

Your DVD class now has a place to store the number of the DVD. Now, return to the Properties section of the dvdNumber attribute and click the "Go Up" button as shown below:

This button navigates you up out of the attribute and back into the DVD class where you can then add more attributes with the "New Attribute" button. Add three more attributes as outlined below:

  1. Add runningTime as an int with the following tagged values:
  2. Tag Value
    widget:labelRunning Time
    widget:descriptionLength of the movie in minutes
  3. Add rating as a String with the following tagged values:
  4. Tag Value
    vocabulary['G', 'PG', 'PG-13', 'R', 'NC-17']
    widget:descriptionMPAA rating assigned to the movie
  5. Add genre as a String with the following tagged values:
  6. Tag Value
    vocabulary['Action/Adventure', 'Comedy', 'Drama', 'Family', 'Romance', 'Spaghetti Western']
    widget:descriptionArtistic style of the movie

You're done with the DVD class! In your UML tool, you should have a single class that looks something like this:

Wait! There's no "title" attribute! Where do you place the name of the movie? As with the last article, the title attribute comes automatically. You don't have to put one in manually. Just about every object in Plone has a title of some sort.

Page 2 of 3

Comment and Contribute


(Maximum characters: 1200). You have characters left.



Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Sitemap | Contact Us

Thanks for your registration, follow us on our social networks to keep up-to-date
Rocket Fuel