sk.baka.ambient.views.gesturelist
Class TrackListClipboardObject

java.lang.Object
  extended by sk.baka.ambient.views.gesturelist.TrackListClipboardObject

public final class TrackListClipboardObject
extends Object

The clipboard object holding a read-only list of arbitrary objects.

Author:
Martin Vysny

Constructor Summary
TrackListClipboardObject(List<? extends TrackMetadataBean> objects, List<? extends GesturesListView> targets)
          Creates new clipboard object.
 
Method Summary
static TrackListClipboardObject fromObject(Object clipboard)
          Retrieves the clipboard object from given object.
static TrackListClipboardObject fromView(View view)
          Retrieves the clipboard object from given view's tag.
 List<TrackMetadataBean> getObjects()
          Retrieves stored tracks.
static boolean isEmpty(Object object)
          Retrieves the clipboard from given object and checks if it is empty.
static boolean isEmpty(View view)
          Retrieves the clipboard from given object and checks if it is empty.
 boolean isTarget(GesturesListView view)
          Checks if given view is one of the possible targets of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TrackListClipboardObject

public TrackListClipboardObject(List<? extends TrackMetadataBean> objects,
                                List<? extends GesturesListView> targets)
Creates new clipboard object.

Parameters:
objects - the object list, must not be null.
targets - possible view targets, must not be null nor empty.
Method Detail

isTarget

public boolean isTarget(GesturesListView view)
Checks if given view is one of the possible targets of this object.

Parameters:
view - the view to check
Returns:
true if the view is an allowed paste target.

getObjects

public List<TrackMetadataBean> getObjects()
Retrieves stored tracks. May return empty collection if the tracklist was already garbage-collected.

Returns:
the tracklist, never null.

fromView

public static TrackListClipboardObject fromView(View view)
Retrieves the clipboard object from given view's tag.

Parameters:
view - the view to retrieve the object from
Returns:
object instance or null if there was invalid type or instance of object stored as the tag value.

fromObject

public static TrackListClipboardObject fromObject(Object clipboard)
Retrieves the clipboard object from given object.

Parameters:
clipboard - the object to retrieve the clipboard from
Returns:
object instance or null if invalid type of clipboard was provided.

isEmpty

public static boolean isEmpty(View view)
Retrieves the clipboard from given object and checks if it is empty.

Parameters:
view - the view to check
Returns:
true if it is empty, false otherwise.

isEmpty

public static boolean isEmpty(Object object)
Retrieves the clipboard from given object and checks if it is empty.

Parameters:
object - the object to check
Returns:
true if it is empty, false otherwise.


Copyright © 2007-2008. All Rights Reserved.