quentin.mathe@gmail.com)A template to instantiate the right UI and model for a URL.
Copyright: (C) 2010 Quentin Mathe
- Declared in:
- ETItemTemplate.h
A template that embeds both an item template and an object class template, and can build new items initialized with a represented object for a given URL.
ETItemTemplate allows to support various
strategy to open or create documents or content
units in collaboration with a client object e.g. a
ETDocumentController instance.
Subclassing is possible to implement new
strategies, but in many cases a new template
with a particular UI and model combination should give
you enough flexibility.
The client object invokes -newItemWithURL:options: to get a new instance. -newItemWithURL:options: in turn uses ETDocumentCreation to delegate the model initialization.
Returns a new autoreleased template based on the given item and entity name for the represented object.
@taskunit Initialization
Returns a new autoreleased template based on the given item and represented object class.
Returns a new autoreleased template based on the given item and represented object class.
Returns whether the same document can appear multiple times on screen for the given URL.
By default, returns NO.
Can be overriden in a subclass to implement a web browser for example.
Returns the item to which the represented object should be attached to.
By default, returns -item .
Can be overriden to return a descendant item.
Returns the template entity name for the represented object. Can return Nil. See also -newItemWithURL:options: and -objectClassWithOptions: .
Initializes and returns a new template based on the given item and represented object class (or entity name as an alternative).
You cannot provide both an object class and an entity
name at the same time, at least one argument must be
nil, otherwise an
NSInvalidArgumentException is
raised.
Raises an NSInvalidArgumentException if the item
is nil.
Returns a new retained ETLayoutItem or ETLayoutItemGroup object with the given represented object and options.
The returned item is a copy of
-item
.
The represented object will be attached to a
copy of
-contentItem
.
All arguments can be nil.
Can be overriden in subclasses.
Returns a new retained ETLayoutItem or ETLayoutItemGroup object for the given URL and options.
If -objectClassWithOptions: doesn't return Nil, a represented object is instantiated with -init or -initWithURL:options: if the object class conforms to ETDocumentCreation protocol. If the options includes kETTemplateOptionKeyValuePairKey, the new represented object is wrapped in a ETKeyValuePair object. The option value becomes the pair key.
If the given URL is nil, the user action
is a 'New' and not 'Open'.
All arguments can be nil.
Can be overriden in subclasses.
See also -newItemWithRepresentedObject:options: .
@taskunit Properties
Returns the represented object template class.
Can return Nil.
See also -newItemWithURL:options: and -objectClassWithOptions: .
Returns the represented object template class.
Can return Nil.
See also -newItemWithURL:options: and -objectClassWithOptions: .
@taskunit Template Instantiation