org.oddjob.beanbus.mega
Class CollectionWrapper<E>

java.lang.Object
  extended by org.oddjob.beanbus.mega.CollectionWrapper<E>
All Implemented Interfaces:
Iterable<E>, Collection<E>, org.apache.commons.beanutils.DynaBean, ArooaLifeAware, ArooaSessionAware, BusPart, Describeable, ComponentWrapper, Iconic, LogEnabled

public class CollectionWrapper<E>
extends Object
implements ComponentWrapper, ArooaSessionAware, org.apache.commons.beanutils.DynaBean, BusPart, LogEnabled, Describeable, Iconic, ArooaLifeAware, Collection<E>

Wraps a Collection object so that it can be added to an MegaBeanBus.

Author:
Rob Gordon.

Field Summary
static String ACTIVE
           
static ImageIcon activeIcon
           
static String INACTIVE
           
static ImageIcon inactiveIcon
           
 
Constructor Summary
CollectionWrapper(Collection<E> collection, Object proxy)
          Constructor.
 
Method Summary
 boolean add(E e)
           
 boolean addAll(Collection<? extends E> c)
           
 void addIconListener(IconListener listener)
          Add an icon listener.
 void clear()
           
 BusConductor conductorForService(BusConductor busConductor)
          A Bodge method to allow a Bus Conductor to be adpator for logging.
 void configured()
          The configuration for the bean has been fully configured.
 boolean contains(Object o)
           
 boolean contains(String name, String key)
           
 boolean containsAll(Collection<?> c)
           
 Map<String,String> describe()
          Provides the properties.
 void destroy()
          The configuration for the bean is about to be destroyed.
 boolean equals(Object other)
           
 Object get(String name)
           
 Object get(String name, int index)
           
 Object get(String name, String key)
           
protected  org.apache.commons.beanutils.DynaBean getDynaBean()
           
 org.apache.commons.beanutils.DynaClass getDynaClass()
           
protected  Object getProxy()
           
protected  Object getWrapped()
           
 ImageIcon iconForId(String iconId)
          Return an icon tip for a given id.
 void initialised()
          The configuration for the bean has been initialised.
 boolean isEmpty()
           
 Iterator<E> iterator()
           
protected  org.apache.log4j.Logger logger()
           
 String loggerName()
          Provide the logger name.
 void prepare(BusConductor busConductor)
          Prepare this part of a bus.
 boolean remove(Object o)
           
 void remove(String name, String key)
           
 boolean removeAll(Collection<?> c)
           
 void removeIconListener(IconListener listener)
          Remove an icon listener.
 boolean retainAll(Collection<?> c)
           
 void set(String name, int index, Object value)
           
 void set(String name, Object value)
           
 void set(String name, String key, Object value)
           
 void setArooaSession(ArooaSession session)
           
 int size()
           
 Object[] toArray()
           
<T> T[]
toArray(T[] a)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
hashCode
 

Field Detail

INACTIVE

public static final String INACTIVE
See Also:
Constant Field Values

ACTIVE

public static final String ACTIVE
See Also:
Constant Field Values

inactiveIcon

public static final ImageIcon inactiveIcon

activeIcon

public static final ImageIcon activeIcon
Constructor Detail

CollectionWrapper

public CollectionWrapper(Collection<E> collection,
                         Object proxy)
Constructor.

Parameters:
collection -
proxy -
Method Detail

setArooaSession

public void setArooaSession(ArooaSession session)
Specified by:
setArooaSession in interface ArooaSessionAware

getWrapped

protected Object getWrapped()

getDynaBean

protected org.apache.commons.beanutils.DynaBean getDynaBean()

getProxy

protected Object getProxy()

logger

protected org.apache.log4j.Logger logger()

initialised

public void initialised()
Description copied from interface: ArooaLifeAware
The configuration for the bean has been initialised. Constant properties and element properties will have been injected.

Specified by:
initialised in interface ArooaLifeAware

configured

public void configured()
Description copied from interface: ArooaLifeAware
The configuration for the bean has been fully configured. Runtime properties will have been injected.

Specified by:
configured in interface ArooaLifeAware

destroy

public void destroy()
Description copied from interface: ArooaLifeAware
The configuration for the bean is about to be destroyed. A bean can use this method to free resources.

Specified by:
destroy in interface ArooaLifeAware

loggerName

public String loggerName()
Description copied from interface: LogEnabled
Provide the logger name. The name should be unique for each component that is LogEnabled.

Specified by:
loggerName in interface LogEnabled
Returns:
A logger name. Never Null.

prepare

public void prepare(BusConductor busConductor)
Description copied from interface: BusPart
Prepare this part of a bus. Intended to allow components to configure themselves.

Specified by:
prepare in interface BusPart
Parameters:
busConductor - The bus conductor. Will never be null.

conductorForService

public BusConductor conductorForService(BusConductor busConductor)
Description copied from interface: BusPart
A Bodge method to allow a Bus Conductor to be adpator for logging.

Specified by:
conductorForService in interface BusPart
Returns:

iconForId

public ImageIcon iconForId(String iconId)
Return an icon tip for a given id. Part of the Iconic interface.

Specified by:
iconForId in interface Iconic
Parameters:
iconId - The icon id.
Returns:
The IconTip or null if it doesn't exist.

addIconListener

public void addIconListener(IconListener listener)
Add an icon listener. Part of the Iconic interface.

Specified by:
addIconListener in interface Iconic
Parameters:
listener - The listener.

removeIconListener

public void removeIconListener(IconListener listener)
Remove an icon listener. Part of the Iconic interface.

Specified by:
removeIconListener in interface Iconic
Parameters:
listener - The listener.

equals

public boolean equals(Object other)
Specified by:
equals in interface Collection<E>
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

contains

public boolean contains(String name,
                        String key)
Specified by:
contains in interface org.apache.commons.beanutils.DynaBean

get

public Object get(String name)
Specified by:
get in interface org.apache.commons.beanutils.DynaBean

get

public Object get(String name,
                  int index)
Specified by:
get in interface org.apache.commons.beanutils.DynaBean

get

public Object get(String name,
                  String key)
Specified by:
get in interface org.apache.commons.beanutils.DynaBean

getDynaClass

public org.apache.commons.beanutils.DynaClass getDynaClass()
Specified by:
getDynaClass in interface org.apache.commons.beanutils.DynaBean

remove

public void remove(String name,
                   String key)
Specified by:
remove in interface org.apache.commons.beanutils.DynaBean

set

public void set(String name,
                int index,
                Object value)
Specified by:
set in interface org.apache.commons.beanutils.DynaBean

set

public void set(String name,
                Object value)
Specified by:
set in interface org.apache.commons.beanutils.DynaBean

set

public void set(String name,
                String key,
                Object value)
Specified by:
set in interface org.apache.commons.beanutils.DynaBean

describe

public Map<String,String> describe()
Description copied from interface: Describeable
Provides the properties.

Specified by:
describe in interface Describeable
Returns:
A map of property values. Must not be null.

add

public boolean add(E e)
Specified by:
add in interface Collection<E>

addAll

public boolean addAll(Collection<? extends E> c)
Specified by:
addAll in interface Collection<E>

clear

public void clear()
Specified by:
clear in interface Collection<E>

contains

public boolean contains(Object o)
Specified by:
contains in interface Collection<E>

containsAll

public boolean containsAll(Collection<?> c)
Specified by:
containsAll in interface Collection<E>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection<E>

iterator

public Iterator<E> iterator()
Specified by:
iterator in interface Iterable<E>
Specified by:
iterator in interface Collection<E>

remove

public boolean remove(Object o)
Specified by:
remove in interface Collection<E>

removeAll

public boolean removeAll(Collection<?> c)
Specified by:
removeAll in interface Collection<E>

retainAll

public boolean retainAll(Collection<?> c)
Specified by:
retainAll in interface Collection<E>

size

public int size()
Specified by:
size in interface Collection<E>

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection<E>

toArray

public <T> T[] toArray(T[] a)
Specified by:
toArray in interface Collection<E>