[Chandler-dev] What every parcel writer should know about how to add Items

John Anderson john at osafoundation.org
Thu Apr 27 11:18:23 PDT 2006


I've made it easier for parcels to add Items to collections by 
refactoring NewEvent to become NewItemEvent. I've updated the 
certificate parcel and Chandler's menus that create new Items to take 
advantage of it.

Here's a more detailed description of the new event taken from the code:

NewItemEvent creates a new Item, adds it to a collection (as an 
attribute of the event) and displays it properly.

If the NewItemEvent implements the onNewItem method it will be called to 
create the item. This is handy if you want to use a dialog to get some 
information to create the item. If onNewItem returns None, no Item will 
be created.
     
If you don't implement onNewItem an Item of kindParamter (as an 
attribute of the event) Kind is created. If kindParamter is None, a Kind 
matching the ApplicationBar is created, e.g. if you're in Calendar View 
you'll get a Calendar Item. If you're in All you'll get a Note.

The view in the sidebar is switched to match the kind, e.g. if you 
create a CalendarItem, you'll switch to the calendar view. If there 
isn't a kind specific view, you'll switch to All view. Finally, the Item 
is selected in the SummaryView and displayed in the detail view.

If the collection is None or it's not a UserCollection, the Item will be 
added to the all collection.
   
If you specify a collectionAddEvent (as an attribute of the event) and 
your collection is not in the Sidebar, the collectionAddEvent will be 
used to add thecollection to the sidebar. The collectionAddEvent is 
typically an AddToSidebarEvent .

John



More information about the chandler-dev mailing list