org.barracudamvc.core.comp
Interface Attrs

All Known Subinterfaces:
ItemMap
All Known Implementing Classes:
AbstractBComponent, BAction, BComponent, BImage, BInput, BLabel, BLink, BList, BScript, BScriptResource, BSelect, BTable, BTemplate, BText, BToggleButton, DefaultItemMap

public interface Attrs

This interface defines the methods needed to implement an Attrs object (ie. something for which you can get/set markup attrs). Currently implemented by BComponent and ItemMap, this allows the renderers to update attributes within elements (ie. class, title, alt, etc attributes


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
 Attrs setAttr(Object attr, Object val)
          set an attribute for this particular component.
 

Method Detail

setAttr

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.

Parameters:
attr - the attribute name
val - the attribute value

getAttr

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.

Parameters:
attr - the attribute name
Returns:
the value for the given attribute (may be null)

getAttrMap

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

Returns:
a reference of the underlying component attribute Map


Copyright © 2006 BarracudaMVC.org All Rights Reserved.