CatNiP prefinal
Sähköinen nuottikirja, HY-TKTKL-OHTUPROJ KESÄ11
PlaylistsDelegateDataSource Class Reference

Delegate and datasource for CatNipViewController's tableviews' when LIBRARYTYPE == PLAYLISTS. More...

#import <PlaylistsDelegateDataSource.h>

Collaboration diagram for PlaylistsDelegateDataSource:

List of all members.

Public Member Functions

(void) - changeLibraryTypeToPlaylists
 sets master's tableviews' delegates and datasources to this and reloads their data.
(UIView *) - createAccessoryViewForPlaylist:
 Create a view to act as a place for playlist function buttons.
(UITableViewCell *) - createTableCellLeft:
 Creates cell for libraryTableViewLeft.
(UITableViewCell *) - createTableCellRight:
 Creates cell for libraryTableViewRight.
(void) - didSelectRowAtLeftTable:
 Shows libraryTableViewRight if hidden and reloads it's data.
(void) - didSelectRowAtRightTable:
 libraryTableViewRight's implementation of tableView: indexPath.
(id) - init [implementation]
 Initializer for PlaylistDelegateDataSource.
(id) - initWithMaster:
 Initializer for PlaylistDelegateDataSource.
(NSInteger) - numberOfSectionsInTableView:
 UITableViewDataSource protocol function's implementation.
(void) - playlistActivateClicked:
 Target method for playlist edit clicks.
(void) - setPlaylistViewContents:
 A helper method that sets the currently selected playlist according to the row parameter in the given NSIndexPath.
(BOOL) - tableView:canEditRowAtIndexPath:
 UITableViewDataSource function's implementation.
(BOOL) - tableView:canMoveRowAtIndexPath:
 UITableViewDataSource function's implementation.
(UITableViewCell *) - tableView:cellForRowAtIndexPath:
 Mandatory UITableViewDataSource protocol's function implementation.
(void) - tableView:commitEditingStyle:forRowAtIndexPath:
 Deletes either whole playlist or removes one score from playlist depending on tableView.
(void) - tableView:didSelectRowAtIndexPath:
 UITableViewDelegate protocol function's implementation.
(UITableViewCellEditingStyle) - tableView:editingStyleForRowAtIndexPath:
 UITableViewDelegate protocol function's implementation.
(CGFloat) - tableView:heightForFooterInSection:
 UITableViewDelegate protocol function's implementation.
(CGFloat) - tableView:heightForHeaderInSection:
 UITableViewDelegate protocol function's implementation.
(CGFloat) - tableView:heightForRowAtIndexPath:
 UITableViewDelegate protocol function's implementation.
(void) - tableView:moveRowAtIndexPath:toIndexPath:
 UITableViewDataSource function's implementation.
(NSInteger) - tableView:numberOfRowsInSection:
 UITableViewDataSource protocol function's implementation.
(NSString *) - tableView:titleForDeleteConfirmationButtonForRowAtIndexPath:
 UITableViewDelegate protocol function's implementation.
(UIView *) - tableView:viewForFooterInSection:
 UITableViewDelegate protocol function's implementation.
(UIView *) - tableView:viewForHeaderInSection:
 UITableViewDelegate protocol function's implementation.
(BOOL) - textField:shouldChangeCharactersInRange:replacementString: [implementation]
 UITextFieldDelegate method implementation.
(void) - textFieldDidEndEditing: [implementation]
 UITextFieldDelegate method implementation.
(BOOL) - textFieldShouldReturn: [implementation]
 UITextFieldDelegate method implementation.

Protected Attributes

CatNiPViewControllermaster

Properties

PlaylistcurrentPlaylist
IBOutlet CatNiPViewControllermaster
ValueTextFieldplaylistName
NSMutableArray * playlists

Detailed Description

Delegate and datasource for CatNipViewController's tableviews' when LIBRARYTYPE == PLAYLISTS.

Uses local data (playlists, currentPlaylist) as datasources.

API up to date 28.6.2011

Definition at line 16 of file PlaylistsDelegateDataSource.h.


Member Function Documentation

- (void) changeLibraryTypeToPlaylists

sets master's tableviews' delegates and datasources to this and reloads their data.

Definition at line 524 of file PlaylistsDelegateDataSource.m.

- (UIView *) createAccessoryViewForPlaylist: (NSIndexPath *)  indexPath

Create a view to act as a place for playlist function buttons.

Creates an accessory view for UITableViewCells displaying playlists stored on the device.

An accessory view shows any extra functionality buttons present next to the playlist name.

Parameters:
indexPathThe index path of the cell for which the accessory view will be generated
Returns:
An UIView object that can be set as the accessory view for the cell

Definition at line 548 of file PlaylistsDelegateDataSource.m.

Here is the caller graph for this function:

- (UITableViewCell *) createTableCellLeft: (NSIndexPath *)  indexPath

Creates cell for libraryTableViewLeft.

Creates standard cell for application and assigns cell.textLabel.text = [[playlists objectAtIndex:(indexPath.row -1)] name].

Parameters:
createTableCellLeftUITableView which cells are generated in this function
Returns:
UITableViewCell for given parametres

Definition at line 110 of file PlaylistsDelegateDataSource.m.

References createAccessoryViewForPlaylist:.

Here is the call graph for this function:

Here is the caller graph for this function:

- (UITableViewCell *) createTableCellRight: (NSIndexPath *)  indexPath

Creates cell for libraryTableViewRight.

Creates standard cell for application and sets it's showsReorderContor to NO if cell is "Add new score" otherwise sets it to YES;

Parameters:
createTableCellRightUITableView which cells are generated in this function
Returns:
UITableViewCell for given parametres

Definition at line 149 of file PlaylistsDelegateDataSource.m.

References LocalScoreData::composition, currentPlaylist, and ScoreData::description.

Here is the caller graph for this function:

- (void) didSelectRowAtLeftTable: (NSIndexPath *)  indexPath

Shows libraryTableViewRight if hidden and reloads it's data.

Parameters:
didSelectRowAtLeftTablelocating the new selected row

Definition at line 344 of file PlaylistsDelegateDataSource.m.

References Playlist::name, LocalDataHandler::savePlaylistsToDefaultFile:, and setPlaylistViewContents:.

Here is the call graph for this function:

Here is the caller graph for this function:

- (void) didSelectRowAtRightTable: (NSIndexPath *)  indexPath

libraryTableViewRight's implementation of tableView: indexPath.

Using gesture recognizer initialized in viewDidLoad instead to prevent popping ScorePopoverController in new UIPopoverController with every search in libraryTableViewRight.

Parameters:
didSelectRowAtRightTablelocating the new selected row in tableView

Definition at line 377 of file PlaylistsDelegateDataSource.m.

References currentPlaylist, and Playlist::scorelist.

Here is the caller graph for this function:

- (id) init [implementation]

Initializer for PlaylistDelegateDataSource.

Definition at line 20 of file PlaylistsDelegateDataSource.m.

Here is the caller graph for this function:

- (id) initWithMaster: (CatNiPViewController *)  m

Initializer for PlaylistDelegateDataSource.

Parameters:
mThe CatNiPViewController that controls the UIView showing the library tables.

Definition at line 32 of file PlaylistsDelegateDataSource.m.

References init.

Here is the call graph for this function:

- (NSInteger) numberOfSectionsInTableView: (UITableView *)  tableView

UITableViewDataSource protocol function's implementation.

Check frameworks API for details.

Parameters:
numberOfSectionsInTableView
Returns:
value 1 cause each tableView has one section

Definition at line 57 of file PlaylistsDelegateDataSource.m.

- (void) playlistActivateClicked: (id)  button

Target method for playlist edit clicks.

Sends a message to the master object (ie. the CatNiPViewController displaying the library table) to open the right tableview if necessary and then displays the contents of the playlist in that tableview.

Parameters:
buttonThe ValueButton that generated the click event

Definition at line 568 of file PlaylistsDelegateDataSource.m.

References setPlaylistViewContents:.

Here is the call graph for this function:

- (void) setPlaylistViewContents: (NSIndexPath *)  indexPath

A helper method that sets the currently selected playlist according to the row parameter in the given NSIndexPath.

Parameters:
indexPathThe index path to the playlist that will be displayed

Definition at line 580 of file PlaylistsDelegateDataSource.m.

Here is the caller graph for this function:

- (BOOL) tableView: (UITableView *)  tableView
canEditRowAtIndexPath: (NSIndexPath *)  indexPath 

UITableViewDataSource function's implementation.

Everything is editable if LIBRARYTYPE == PLAYLISTS

Check frameworks API for details.

Parameters:
tableViewlibraryTableViewRight or libraryTableViewLeft
canEditRowAtIndexPathindexPath to cell in tableView
Returns:
YES

Definition at line 236 of file PlaylistsDelegateDataSource.m.

- (BOOL) tableView: (UITableView *)  tableView
canMoveRowAtIndexPath: (NSIndexPath *)  indexPath 

UITableViewDataSource function's implementation.

Playlists are kept in order with sorting thus libraryTableViewLeft's cells are not movable. libraryTableViewRight's cells except "Add new score" can be moved around each other.

Check frameworks API for details.

Parameters:
tableViewlibraryTableViewRight
canMoveRowAtIndexPathindexPath to cell in tableView
Returns:
YES if tableView == libraryTableViewRight. Otherwise returns NO.

Definition at line 216 of file PlaylistsDelegateDataSource.m.

References CatNiPViewController::libraryTableViewRight, and master.

- (UITableViewCell *) tableView: (UITableView *)  tableView
cellForRowAtIndexPath: (NSIndexPath *)  indexPath 

Mandatory UITableViewDataSource protocol's function implementation.

Calls createTableCellLeft or createTableCellRight to create a cell to return

Check frameworks API for details.

Parameters:
tableViewlibraryTableViewLeft or libraryTableViewRight
cellForRowAtIndexPathindexPath for cell to be created in tableView
Returns:
UITableViewCell for given parametres

Definition at line 95 of file PlaylistsDelegateDataSource.m.

References createTableCellLeft:, createTableCellRight:, CatNiPViewController::libraryTableViewLeft, CatNiPViewController::libraryTableViewRight, and master.

Here is the call graph for this function:

- (void) tableView: (UITableView *)  tableView
commitEditingStyle: (UITableViewCellEditingStyle)  editingStyle
forRowAtIndexPath: (NSIndexPath *)  indexPath 

Deletes either whole playlist or removes one score from playlist depending on tableView.

Does not deletes LocalScoreData(s) or pdf(s) on either case.

Check frameworks API for details.

no cells with this editing style

Definition at line 246 of file PlaylistsDelegateDataSource.m.

References currentPlaylist, CatNiPViewController::libraryTableViewLeft, CatNiPViewController::libraryTableViewRight, master, and LocalDataHandler::savePlaylistsToDefaultFile:.

Here is the call graph for this function:

- (void) tableView: (UITableView *)  tableView
didSelectRowAtIndexPath: (NSIndexPath *)  indexPath 

UITableViewDelegate protocol function's implementation.

Calls spesified tableView's handler to determine behaviour. Check framework's API for details.

Check frameworks API for details.

Parameters:
tableViewobject informing the delegate about the new row selection.
didSelectRowAtIndexPathlocating the new selected row in tableView

Definition at line 333 of file PlaylistsDelegateDataSource.m.

References didSelectRowAtLeftTable:, didSelectRowAtRightTable:, CatNiPViewController::libraryTableViewLeft, CatNiPViewController::libraryTableViewRight, and master.

Here is the call graph for this function:

- (UITableViewCellEditingStyle) tableView: (UITableView *)  tableView
editingStyleForRowAtIndexPath: (NSIndexPath *)  indexPath 

UITableViewDelegate protocol function's implementation.

Check frameworks API for details.

Returns:
editing style for cell in tableView. All cells except first row in libraryTableViewLeft are deletable in libraryTableViewLeft and libraryTableViewRight.

Definition at line 487 of file PlaylistsDelegateDataSource.m.

References CatNiPViewController::libraryTableViewLeft, CatNiPViewController::libraryTableViewRight, and master.

- (CGFloat) tableView: (UITableView *)  tableView
heightForFooterInSection: (NSInteger)  section 

UITableViewDelegate protocol function's implementation.

Add some padding in the footer of libraryTableViewLeft and libraryTableViewRight so that last elements will show for user even if the keyboard is visible.

Check frameworks API for details.

Parameters:
tableViewlibraryTableViewLeft or libraryTableViewRight
heightForFooterInSectionCurrently only one section (0) in tableViews
Returns:
Footer's height as CGFloat type, currently 0.

Definition at line 406 of file PlaylistsDelegateDataSource.m.

- (CGFloat) tableView: (UITableView *)  tableView
heightForHeaderInSection: (NSInteger)  section 

UITableViewDelegate protocol function's implementation.

All headers have height of 40.

Check frameworks API for details.

Parameters:
tableView
heightForHeaderInSection
Returns:
40

Definition at line 437 of file PlaylistsDelegateDataSource.m.

- (CGFloat) tableView: (UITableView *)  tableView
heightForRowAtIndexPath: (NSIndexPath *)  indexPath 

UITableViewDelegate protocol function's implementation.

Calculate table's row height dynamically based on cell.textLabel.text length. Height is calculated with following formula: (([cell.textLabel.text length] / 34) * 17) + 50

Check frameworks API for details.

Parameters:
tableViewfor which the height is calculated
heightForRowAtIndexPaththe row for which the height is calculated
Returns:
row's height in CGFloat type

Definition at line 306 of file PlaylistsDelegateDataSource.m.

References LocalScoreData::composition, ScoreData::description, CatNiPViewController::libraryTableViewLeft, CatNiPViewController::libraryTableViewRight, and master.

- (void) tableView: (UITableView *)  tableView
moveRowAtIndexPath: (NSIndexPath *)  fromIndexPath
toIndexPath: (NSIndexPath *)  toIndexPath 

UITableViewDataSource function's implementation.

Playlists are kept in order with sorting thus libraryTableViewLeft's cells are not movable. libraryTableViewRight's cells except "Add new score" can be moved around each other.

Check frameworks API for details.

Parameters:
tableView,:libraryTableViewLeft or libraryTableViewRight
moveRowAtIndexPathindexPath from which the cell is moved
toIndexPathindexPath where the cell is moved

Definition at line 172 of file PlaylistsDelegateDataSource.m.

References CatNiPViewController::currentPlaylist, currentPlaylist, CatNiPViewController::libraryTableViewLeft, CatNiPViewController::libraryTableViewRight, master, LocalDataHandler::savePlaylistsToDefaultFile:, and Playlist::scorelist.

Here is the call graph for this function:

- (NSInteger) tableView: (UITableView *)  tableView
numberOfRowsInSection: (NSInteger)  section 

UITableViewDataSource protocol function's implementation.

Check frameworks API for details.

Parameters:
tableView
numberOfRowsInSection
Returns:
playlists or scores depending on which libraryTableView is chosen

Definition at line 70 of file PlaylistsDelegateDataSource.m.

References currentPlaylist, CatNiPViewController::libraryTableViewLeft, CatNiPViewController::libraryTableViewRight, and master.

- (NSString *) tableView: (UITableView *)  tableView
titleForDeleteConfirmationButtonForRowAtIndexPath: (NSIndexPath *)  indexPath 

UITableViewDelegate protocol function's implementation.

Check frameworks API for details.

Returns:
"Delete" if tableView == libraryTableViewLeft, "Remove" if tableView == libraryTableViewRight.

Definition at line 510 of file PlaylistsDelegateDataSource.m.

References CatNiPViewController::libraryTableViewLeft, CatNiPViewController::libraryTableViewRight, and master.

- (UIView *) tableView: (UITableView *)  tableView
viewForFooterInSection: (NSInteger)  section 

UITableViewDelegate protocol function's implementation.

Add some padding in the footer of libraryTableViewLeft and libraryTableViewRight so that last elements will show for user even if the keyboard is visible.

Parameters:
tableView
viewForFooterInSectionCurrently only one section (0) in tableViews
Returns:
footer's view.

Definition at line 420 of file PlaylistsDelegateDataSource.m.

- (UIView *) tableView: (UITableView *)  tableView
viewForHeaderInSection: (NSInteger)  section 

UITableViewDelegate protocol function's implementation.

Check frameworks API for details.

Parameters:
tableViewlibraryTableViewLeft or libraryTableViewRight
viewForHeaderInSection0
Returns:
Header view for section in tableView

Definition at line 451 of file PlaylistsDelegateDataSource.m.

References currentPlaylist, ValueTextField::fieldValue, CatNiPViewController::libraryTableViewLeft, CatNiPViewController::libraryTableViewRight, master, and playlistName.

- (BOOL) textField: (UITextField *)  textField
shouldChangeCharactersInRange: (NSRange)  range
replacementString: (NSString *)  string 
[implementation]

UITextFieldDelegate method implementation.

Allows editing of the textfield containing the playlist name. See Cocoa Touch framework API documentation for more.

Definition at line 592 of file PlaylistsDelegateDataSource.m.

- (void) textFieldDidEndEditing: (UITextField *)  textField [implementation]

UITextFieldDelegate method implementation.

Handles setting the new name for a playlist. See Cocoa Touch framework API documentation for more.

Definition at line 600 of file PlaylistsDelegateDataSource.m.

References ValueTextField::fieldValue, Playlist::name, and LocalDataHandler::savePlaylistsToDefaultFile:.

Here is the call graph for this function:

- (BOOL) textFieldShouldReturn: (UITextField *)  textField [implementation]

UITextFieldDelegate method implementation.

Handles enter presses in the text field. See Cocoa Touch framework API documentation for more.

Definition at line 615 of file PlaylistsDelegateDataSource.m.


Member Data Documentation

- (CatNiPViewController*) master [protected]

Definition at line 22 of file PlaylistsDelegateDataSource.h.


Property Documentation

- (Playlist *) currentPlaylist [read, write, retain]

Definition at line 20 of file PlaylistsDelegateDataSource.h.

- (IBOutlet CatNiPViewController*) master [read, write, retain]

Definition at line 26 of file PlaylistsDelegateDataSource.h.

- (ValueTextField *) playlistName [read, write, retain]

Definition at line 21 of file PlaylistsDelegateDataSource.h.

- (NSMutableArray *) playlists [read, write, retain]

Definition at line 19 of file PlaylistsDelegateDataSource.h.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Enumerations Enumerator Properties Defines