Copyright ©1995 by NeXT Computer, Inc. All Rights Reserved.
| DBFormatter |
| Inherits From: | Object | |
| Declared In: | dbkit/DBFormatter.h |
| Class Description |
| DBFormatter is an abstract superclass; each of its subclasses provides a mechanism that formats and displays data in a DBTableView. The Database Kit provides three DBFormatter subclasses: |
| DBImageFormatter scales, aligns, and displays images. | ||
| DBTextFormatter displays uneditable text. | ||
| DBEditableFormatter displays editable text. |
| The central method in a DBFormatter is drawFieldAt::inside:inView:withAttributes::usePositions::. This method defines the way in which a DBFormatter formats and displays data. It's invoked automatically by the DBTableView when it wants to display a value. The default implementation of this method does nothing; each subclass must implement it in a meaningful way. |
| Instance Variables |
| id value; |
| value | The value to be formatted |
| Method Types |
| Getting and displaying a value |
| usePositions:: |
| Batching format requests |
| Instance Methods |
| beginBatching: |
| Tells the DBFormatter that a formatting session is about to begin. You never invoke this method directly; it's invoked automatically by the DBTableView just before it sends the first in a series of drawFieldAt::... messages. The end of the formatting session is signalled by the endBatching message and it's restarted through resetBatching:.
The default implementation of beginBatching: does nothing. You can reimplement this method in a subclass to perform pre-formatting initialization. The return value is ignored. The argument to this method (and to resetBatching:) is currently unused (it's always nil). |
| drawFieldAt::inside:inView:withAttributes::usePositions:: |
| :(unsigned int)column inside:(NXRect *)frame inView:view withAttributes:(id <DBTableVectors>)rowAttrs :(id <DBTableVectors>)columnAttrs usePositions:(BOOL)useRow :(BOOL)useColumn |
| Retrieves a value from the data source, formats it, and displays it. The DBFormatter implementation of this actually does nothing and returns self; it's up to the subclasses to implement this method in meaningful ways.
Typically, an implementation follows these steps: |
| 5. | The value is retrieved. This is done by forwarding the method's arguments to getValueAt::..., thus: |
[self getValueAt:row :column
withAttributes:rowAttrs :columnAttrs
usePositions:useRow :useColumn];
| 6. | The value that's set by getValueAt::... (keep in mind that the method sets the value instance variable) is formatted for display. | |
| 7. | The formatted value is displayed inside frame, which is given in view's coordinate system. Note well that the focus will be locked on view before this message is sent--you don't have to lock focus yourself. |
| endBatching |
| Notifies the DBFormatter that a formatting session is over. See the beginBatching: method for more information.
See also: |
| getValueAt::withAttributes::usePositions:: |
| :(unsigned int) column withAttributes:(id <DBTableVectors>) rowAttrs :(id <DBTableVectors>) columnAttrs usePositions:(BOOL) useRowPos :(BOOL) useColumnPos |
| Retrieves a value from the data source, places it in the DBFormatter's value instance variable, and then returns the variable. You never invoke this method from your application; however, if you create a subclass of DBFormatter, you'll need to invoke it from the implementation of drawFieldAt::..., as explained in the description of that method. You shouldn't need to reimplement this method in a subclass. |
| resetBatching: |
| Tells the DBFormatter to restart a formatting session. See the beginBatching: method for more information.
See also: |