graphics.js revision 45be085c4155ae7ef409ffa4d79457928742f18f
/**
* The Graphics widget provides an api for basic drawing operations.
*
* @module graphics
*/
var SETTER = "setter",
VALUE = "value",
VALUEFN = "valueFn",
READONLY = "readOnly",
STR = "string",
WRITE_ONCE = "writeOnce",
/**
* AttributeLite provides Attribute-like getters and setters for shape classes in the Graphics module. It provides a get/set API without the event infastructure.
* This class is temporary and a work in progress.
*
* @class AttributeLite
* @constructor
*/
AttributeLite = function()
{
var host = this; // help compression
// Perf tweak - avoid creating event literals if not required.
host._ATTR_E_FACADE = {};
};
/**
* Initializes the attributes for a shape. If an attribute config is passed into the constructor of the host,
* the initial values will be overwritten.
*
* @method addAttrs
* @param {Object} cfg Optional object containing attributes key value pairs to be set.
*/
{
var host = this,
attr,
i,
fn,
for(i in attrConfig)
{
if(attrConfig.hasOwnProperty(i))
{
attr = attrConfig[i];
{
}
{
{
}
else
{
}
}
}
}
for(i in attrConfig)
{
if(attrConfig.hasOwnProperty(i))
{
attr = attrConfig[i];
{
continue;
}
{
}
{
{
}
else
{
}
}
}
}
},
/**
* For a given item, returns the value of the property requested, or undefined if not found.
*
* @method get
* @param name {String} The name of the item
* @return {Any} The value of the supplied property.
*/
{
var host = this,
{
if(getter)
{
{
}
}
}
return null;
},
/**
* Sets the value of an attribute.
*
* @method set
* @param {String|Object} name The name of the attribute. Alternatively, an object of key value pairs can
* be passed in to set multiple attributes at once.
* @param {Any} value The value to set the attribute to. This value is ignored if an object is received as
* the name param.
*/
{
var i;
{
for(i in attr)
{
if(attr.hasOwnProperty(i))
{
}
}
}
else
{
}
},
/**
* Provides setter logic. Used by `set`.
*
* @method _set
* @param {String|Object} name The name of the attribute. Alternatively, an object of key value pairs can
* be passed in to set multiple attributes at once.
* @param {Any} value The value to set the attribute to. This value is ignored if an object is received as
* the name param.
* @protected
*/
{
var host = this,
args,
{
if(setter)
{
{
}
else
{
}
}
}
}
};
/**
* BaseGraphic serves as the base class for the graphic layer. It serves the same purpose as
* This class is temporary and a work in progress.
*
* @class BaseGraphic
* @constructor
* @param {Object} cfg Key value pairs for attributes
*/
BaseGraphic = function(cfg)
{
var host = this,
}
if (host._initPlugins) {
// Need to initPlugins manually, to handle constructor parsing, static Plug parsing
}
host.initialized = true;
};
BaseGraphic.prototype = {
/**
* Init method, invoked during construction.
* Fires an init event after calling `initializer` on implementers.
*
* @method init
* @protected
*/
init: function()
{
this.publish("init", {
fireOnce:true
});
}
};
//Straightup augment, no wrapper functions
Y.BaseGraphic = BaseGraphic;