/*
 * Paper.js
 *
 * This file is part of Paper.js, a JavaScript Vector Graphics Library,
 * based on Scriptographer.org and designed to be largely API compatible.
 * http://paperjs.org/
 * http://scriptographer.org/
 *
 * Copyright (c) 2011, Juerg Lehni & Jonathan Puckey
 * http://lehni.org/ & http://jonathanpuckey.com/
 *
 * Distributed under the MIT license. See LICENSE file for details.
 *
 * All rights reserved.
 */

var Palette = this.Palette = Base.extend(Callback, /** @lends Palette# */{
	_events: [ 'onChange' ],

	initialize: function(title, components, values) {
		var parent = DomElement.find('.paperjs-palettes')
			|| DomElement.find('body').appendChild(
				DomElement.create('div', { 'class': 'paperjs-palettes' }));
		var table = parent.appendChild(
				DomElement.create('table', { 'class': 'paperjs-palette' }));
		this._title = title;
		if (!values)
			values = {};
		this._components = Base.each(components, function(component, name) {
			if (!(component instanceof Component)) {
				if (component.value == null)
					component.value = values[name];
				component.name = name;
				component = components[name] = new Component(component);
			}
			component.palette = this;
			// Make sure each component has an entry in values, so observers get
			// installed further down.
			if (values[name] === undefined)
				values[name] = null;
			var row = table.appendChild(
				DomElement.create('tr', [
					'td', { text: (component.label || name) + ':' },
					'td', component.element
				])
			);
		}, this);
		this._values = Base.each(values, function(value, name) {
			// Replace each entry with an getter / setters so we can observe
			// change.
			Base.define(values, name, {
				enumerable: true,
				configurable: true,
				writable: true,
				get: function() {
					return value;
				},
				set: function(val) {
					value = val;
					components[name].setValue(val);
				}
			});
		});
	},

	reset: function() {
		for (var i in this._components)
			this._components[i].reset();
	}
});

@@ -733,16 +733,13 @@
  %7D))
-;%0A%09%09var 
+,%0A%09%09%09
 tabl
@@ -825,16 +825,32 @@
 tte' %7D))
+,%0A%09%09%09that = this
 ;%0A%09%09this
@@ -1196,26 +1196,26 @@
 palette = th
-is
+at
 ;%0A%09%09%09// Make
@@ -1528,17 +1528,11 @@
 %09);%0A
+
 %09%09%7D
-, this
 );%0A%09

Make Palette#reset() work.