danger.util
Class ActiveFolder.WeakDelegateList

java.lang.Object
  extended by danger.util.SimpleWeakList
      extended by danger.util.ActiveList.WeakDelegateList
          extended by danger.util.ActiveFolder.WeakDelegateList
All Implemented Interfaces:
ActiveFolder.Delegate, ActiveList.Delegate
Enclosing interface:
ActiveFolder


public static class ActiveFolder.WeakDelegateList
extends ActiveList.WeakDelegateList
implements ActiveFolder.Delegate

List of delegates which are held onto weakly. Instances of this class are used to hold multiple delegates that have been added to a single list instance. All of the on*() methods call that same method with the same arguments on each of the delegates in the list. Note that the SimpleWeakList.add(java.lang.Object) and SimpleWeakList.remove(java.lang.Object) methods are simply the inherited Object-accepting ones, but the guts of this class assume that the only things ever added are appropriate delegates.


Field Summary
protected  boolean mOpen
          used while iterating
protected static int ON_SET_DATA
           
protected static int ON_SET_OPEN
           
protected static int ON_SET_TITLE
           
 
Fields inherited from class danger.util.ActiveList.WeakDelegateList
mIndex, mItem, mItems, mList, mOperation, ON_ITEM_ADDED, ON_ITEM_REMOVED, ON_ITEM_UPDATED, ON_ITEMS_REORDERED, ON_RANGE_ADDED, ON_RANGE_REMOVED
 
Constructor Summary
ActiveFolder.WeakDelegateList()
          Construct an instance with an initial capacity of 4.
ActiveFolder.WeakDelegateList(int initialCapacity)
          Construct an instance.
 
Method Summary
protected  void accept(Object obj)
          Do the operation for a delegate.
 ActiveFolder getFolder()
          Get the folder that this delegate represents, if any.
 void onSetData(ActiveFolder folder, Object data)
          This method is called whenever the arbitrary data object of a folder is changed.
 void onSetOpen(ActiveFolder folder, boolean open)
          This method is called whenever the opened state of a folder is changed.
 void onSetTitle(ActiveFolder folder, String title)
          This method is called whenever the title of a folder is changed.
 
Methods inherited from class danger.util.ActiveList.WeakDelegateList
getDelegate, onItemAdded, onItemRemoved, onItemsReordered, onItemUpdated, onRangeAdded, onRangeRemoved
 
Methods inherited from class danger.util.SimpleWeakList
accept, add, contains, forEachAccept, forEachAccept, get, matchesTarget, remove, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface danger.util.ActiveList.Delegate
onItemAdded, onItemRemoved, onItemsReordered, onItemUpdated, onRangeAdded, onRangeRemoved
 

Field Detail

ON_SET_OPEN

protected static final int ON_SET_OPEN
See Also:
Constant Field Values

ON_SET_TITLE

protected static final int ON_SET_TITLE
See Also:
Constant Field Values

ON_SET_DATA

protected static final int ON_SET_DATA
See Also:
Constant Field Values

mOpen

protected boolean mOpen
used while iterating

Constructor Detail

ActiveFolder.WeakDelegateList

public ActiveFolder.WeakDelegateList(int initialCapacity)
Construct an instance.

Parameters:
initialCapacity - initial capacity of the list; it will expand as needed

ActiveFolder.WeakDelegateList

public ActiveFolder.WeakDelegateList()
Construct an instance with an initial capacity of 4.

Method Detail

getFolder

public ActiveFolder getFolder()
Description copied from interface: ActiveFolder.Delegate
Get the folder that this delegate represents, if any. This method exists so that, when one is holding onto a folder, one can walk up the heritage of a tree of folders via the delegates to reach a top-level folder being viewed / manipulated. Unless you have a particularly good reason not to, this method should almost certainly be implemented as simply return null.

Specified by:
getFolder in interface ActiveFolder.Delegate
Returns:
null-ok; the folder that this delegate represents

onSetOpen

public void onSetOpen(ActiveFolder folder,
                      boolean open)
Description copied from interface: ActiveFolder.Delegate
This method is called whenever the opened state of a folder is changed. For example, StdActiveFolder.setOpen(boolean) is a concrete method that can change the opened state of a folder.

Specified by:
onSetOpen in interface ActiveFolder.Delegate
Parameters:
folder - non-null; the folder which was updated
open - the new opened state

onSetTitle

public void onSetTitle(ActiveFolder folder,
                       String title)
Description copied from interface: ActiveFolder.Delegate
This method is called whenever the title of a folder is changed. For example, StdActiveFolder.setTitle(java.lang.String) is a concrete method that can change the title of a folder.

Specified by:
onSetTitle in interface ActiveFolder.Delegate
Parameters:
folder - non-null; the folder which was updated
title - non-null; the new title

onSetData

public void onSetData(ActiveFolder folder,
                      Object data)
Description copied from interface: ActiveFolder.Delegate
This method is called whenever the arbitrary data object of a folder is changed. For example, StdActiveFolder.setData(java.lang.Object) is a concrete method that can change the data object of a folder.

Specified by:
onSetData in interface ActiveFolder.Delegate
Parameters:
folder - non-null; the folder which was updated
data - null-ok; the new data

accept

protected void accept(Object obj)
Description copied from class: ActiveList.WeakDelegateList
Do the operation for a delegate.

Overrides:
accept in class ActiveList.WeakDelegateList
Parameters:
obj - non-null; the delegate