Print Friendly

# Class YAHOO.util.Attribute

Package: | YAHOO.util
Class: | Attribute
Extends: | Object
Defined In: | tabview.js

Provides Attribute configurations.

## Public Properties

Property | Defined By
--- | ---
| method : Function | Attribute
The method to use when setting the attribute's value. The method recieves the new value as the only argument.
| name : String | Attribute
The name of the attribute.
| owner : YAHOO.util.AttributeProvider | Attribute
The owner of the attribute.
| readOnly : Boolean | Attribute
Whether or not the attribute is read only.
| validator : Function | Attribute
The validator to use when setting the attribute's value.
| value : String | Attribute
The value of the attribute.
| writeOnce : Boolean | Attribute
Whether or not the attribute can only be written once.

## Public Methods

Method | Defined By
--- | ---
| Attribute(`hash {Object}`, `YAHOO.util.AttributeProvider The`) | Attribute
| configure(`Object map`, `Boolean init`) : void | Attribute
Allows for configuring the Attribute's properties.
| getValue() : any | Attribute
Retrieves the current value of the attribute.
| refresh() : Boolean | Attribute
Resets the value to the current value. Useful when values may have gotten out of sync with actual properties.
| resetConfig() : void | Attribute
Resets the attribute config to the initial config state.
| resetValue() : Boolean | Attribute
Resets the value to the initial config value.
| setValue(`Any value`, `Boolean silent`) : Boolean | Attribute
Sets the value of the attribute and fires beforeChange and change events.

## Public Events

This class has no public events.

## Property Details

### method

`public Function method`
The method to use when setting the attribute's value. The method recieves the new value as the only argument.
This property is defined by Attribute.

### name

`public String name`
The name of the attribute.
This property is defined by Attribute.

### owner

`public YAHOO.util.AttributeProvider owner`
The owner of the attribute.
This property is defined by Attribute.

### readOnly

`public Boolean readOnly`
Whether or not the attribute is read only.
This property is defined by Attribute.

### validator

`public Function validator`
The validator to use when setting the attribute's value.
This property is defined by Attribute.

### value

`public String value`
The value of the attribute.
This property is defined by Attribute.

### writeOnce

`public Boolean writeOnce`
Whether or not the attribute can only be written once.
This property is defined by Attribute.

## Constructor Details

### Attribute

`public function Attribute(`hash {Object}`, `YAHOO.util.AttributeProvider The`)`
Parameters:

- `{Object}` : hash
  The intial Attribute.
- `The` : YAHOO.util.AttributeProvider
  owner of the Attribute instance.

## Method Details

### configure

`public function configure(`Object map`, `Boolean init`)`
Allows for configuring the Attribute's properties.
Parameters:

- `map` : Object
  A key-value map of Attribute properties.
- `init` : Boolean
  Whether or not this should become the initial config.

Returns:

- `void`

This method is defined by Attribute.

### getValue

`public function getValue()`
Retrieves the current value of the attribute.
Parameters:

- None.

Returns:

- `any`
  The current value of the attribute.

This method is defined by Attribute.

### refresh

`public function refresh()`
Resets the value to the current value. Useful when values may have gotten out of sync with actual properties.
Parameters:

- None.

Returns:

- `Boolean`
  Whether or not the value was set.

This method is defined by Attribute.

### resetConfig

`public function resetConfig()`
Resets the attribute config to the initial config state.
Parameters:

- None.

Returns:

- `void`

This method is defined by Attribute.

### resetValue

`public function resetValue()`
Resets the value to the initial config value.
Parameters:

- None.

Returns:

- `Boolean`
  Whether or not the value was set.

This method is defined by Attribute.

### setValue

`public function setValue(`Any value`, `Boolean silent`)`
Sets the value of the attribute and fires beforeChange and change events.
Parameters:

- `value` : Any
  The value to apply to the attribute.
- `silent` : Boolean
  If true the change events will not be fired.

Returns:

- `Boolean`
  Whether or not the value was set.

This method is defined by Attribute.

Copyright © 2006 Jack Slocum. All rights reserved.