sk.baka.ambient.activity.main.cb
Class GroupingManager

java.lang.Object
  extended by sk.baka.ambient.activity.main.cb.GroupingManager
All Implemented Interfaces:
IContentManager

final class GroupingManager
extends Object
implements IContentManager

Handles the first menu, the grouping menu.

Author:
Martin Vysny

Constructor Summary
GroupingManager()
           
 
Method Summary
 boolean canReturnTracks()
          Checks if this manager can provide a list of tracks.
 List<String> getDisplayableContent()
           Returns string representation of items contained in this manager.
 int getIndexOfPreviouslyActivatedItem(IContentManager contentManager)
          When activating an item, the manager should keep track of this item so that it can return its index when going back.
 String getSelectedItemName()
          Returns selected item as a displayable string.
 List<TrackMetadataBean> getTracks(Interval selection)
          Computes a list of tracks.
 IContentManager goBack()
           Returns a content manager which will handle contents after a back operation.
 boolean initialize(boolean isYear, ICollection collection)
           Initialize this manager and fetch the data.
 IContentManager itemActivated(int i)
           User activated given item.
 void uninitialize()
          This manager will not be used for a while.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroupingManager

GroupingManager()
Method Detail

goBack

public IContentManager goBack()
Description copied from interface: IContentManager

Returns a content manager which will handle contents after a back operation.

This method is run in handler's thread.

Specified by:
goBack in interface IContentManager
Returns:
the manager instance, may be null if the back operation is not allowed. Returned manager instance is uninitialized.

initialize

public boolean initialize(boolean isYear,
                          ICollection collection)
Description copied from interface: IContentManager

Initialize this manager and fetch the data. This method will not be invoked in handler's thread. This is the first method invoked on a new manager (or managers retrieved by IContentManager.goBack() and IContentManager.itemActivated(int) methods).

The manager may be initialized multiple times with different values of the isYear. The manager should simply do nothing if its previous contents does not change.

Specified by:
initialize in interface IContentManager
Parameters:
isYear - true if year is displayed, false otherwise.
collection - the collection to poll data from.
Returns:
the manager contains new data and the display component should be invalidated to reflect this new data.

uninitialize

public void uninitialize()
Description copied from interface: IContentManager
This manager will not be used for a while. It should discard all of its internal caches.

Specified by:
uninitialize in interface IContentManager

itemActivated

public IContentManager itemActivated(int i)
Description copied from interface: IContentManager

User activated given item. Return a new manager which will handle new contents.

This method is run in handler's thread.

Specified by:
itemActivated in interface IContentManager
Parameters:
i - the item index.
Returns:
new content manager or null if we cannot move forward. Returned manager instance is uninitialized.

getDisplayableContent

public List<String> getDisplayableContent()
Description copied from interface: IContentManager

Returns string representation of items contained in this manager.

This method is run in handler's thread.

Specified by:
getDisplayableContent in interface IContentManager
Returns:
the displayable list, never null, may be empty.

canReturnTracks

public boolean canReturnTracks()
Description copied from interface: IContentManager
Checks if this manager can provide a list of tracks. This method is run in handler's thread.

Specified by:
canReturnTracks in interface IContentManager
Returns:
true if the manager is able to provide a list of tracks.

getTracks

public List<TrackMetadataBean> getTracks(Interval selection)
Description copied from interface: IContentManager
Computes a list of tracks. Run only if IContentManager.canReturnTracks() returns true. This method is not run in handler's thread.

Specified by:
getTracks in interface IContentManager
Parameters:
selection - the selection
Returns:
list of tracks.

getIndexOfPreviouslyActivatedItem

public int getIndexOfPreviouslyActivatedItem(IContentManager contentManager)
Description copied from interface: IContentManager
When activating an item, the manager should keep track of this item so that it can return its index when going back. This method is run in handler's thread.

Specified by:
getIndexOfPreviouslyActivatedItem in interface IContentManager
Parameters:
contentManager - the other manager on the same level.
Returns:
the item index or -1 if the item could no longer be found.

getSelectedItemName

public String getSelectedItemName()
Description copied from interface: IContentManager
Returns selected item as a displayable string. If no item was selected yet since the last initialization then return a short descriptive name of this content manager.

Specified by:
getSelectedItemName in interface IContentManager
Returns:
the item name or manager name.


Copyright © 2007-2008. All Rights Reserved.