org.barracudamvc.core.comp
Class DefaultItemMap

java.lang.Object
  extended by org.barracudamvc.core.comp.DefaultItemMap
All Implemented Interfaces:
Attrs, ItemMap

public class DefaultItemMap
extends Object
implements ItemMap

An ItemMap can be returned by the getItem() methods within any of the model implementations. It is used to associate a key with a particular value. It is primarily used by the BSelect component (which can use both key and value information when rendering). The other components just use the value information.


Field Summary
protected  Map attrs
           
protected  Object key
           
protected  Object value
           
 
Constructor Summary
DefaultItemMap(int ikey, Object ivalue)
          Create a new DefaultItemMap with the given key and value
DefaultItemMap(Object ikey, Object ivalue)
          Create a new DefaultItemMap with the given key and value
 
Method Summary
 Object getAttr(Object attr)
          get an attribute associated with this particular component.
 Map getAttrMap()
          get a reference of the underlying component attribute Map
 Object getKey()
          Returns the key corresponding to this entry.
 Object getValue()
          Returns the value corresponding to this entry.
 Attrs setAttr(Object attr, Object val)
          set an attribute for this particular component.
 Object setValue(Object ivalue)
          Replaces the value corresponding to this entry with the specified value (optional operation).
 String toString()
          Return a String representation of the ItemMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

key

protected Object key

value

protected Object value

attrs

protected Map attrs
Constructor Detail

DefaultItemMap

public DefaultItemMap(int ikey,
                      Object ivalue)
Create a new DefaultItemMap with the given key and value

Parameters:
ikey - an int key
ivalue - the object value

DefaultItemMap

public DefaultItemMap(Object ikey,
                      Object ivalue)
Create a new DefaultItemMap with the given key and value

Parameters:
ikey - an Integer key
ivalue - the object value
Method Detail

getKey

public Object getKey()
Returns the key corresponding to this entry.

Specified by:
getKey in interface ItemMap

getValue

public Object getValue()
Returns the value corresponding to this entry.

Specified by:
getValue in interface ItemMap

setValue

public Object setValue(Object ivalue)
Replaces the value corresponding to this entry with the specified value (optional operation).

Specified by:
setValue in interface ItemMap

setAttr

public Attrs setAttr(Object attr,
                     Object val)
set an attribute for this particular component. When the component is rendered, component attributes will be shown as element attributes in the elements that back each of the views associated with this component. This means that if you set an attribute for the component, it will affect all views associated with the component.If you wish to set an attribute for a specific view alone, then you should get the view, find the node that backs it, and then set the attribute manually that way.

Specified by:
setAttr in interface Attrs
Parameters:
attr - the attribute name
val - the attribute value

getAttr

public Object getAttr(Object attr)
get an attribute associated with this particular component. Note that the attribute map that backs this method only keeps tracks of specific attributes you have added to the component. It does not look at attributes that are physically associated with the underlying elements that back each of the views associated with this component. What this means is that if the template that backs a view has some attribute "foo" and you try to see the value of that attribute using this method, you will not be able to find it unless you have actually associated an attribute named "foo" with the specific component.

Specified by:
getAttr in interface Attrs
Parameters:
attr - the attribute name
Returns:
the value for the given attribute (may be null)

getAttrMap

public Map getAttrMap()
get a reference of the underlying component attribute Map

Specified by:
getAttrMap in interface Attrs
Returns:
a reference of the underlying component attribute Map

toString

public String toString()
Return a String representation of the ItemMap

Overrides:
toString in class Object


Copyright © 2006 BarracudaMVC.org All Rights Reserved.