<?xml version="1.0" encoding="UTF-8"?>
<!--

        Copyright 2006-2008 OpenAjax Alliance

        Licensed under the Apache License, Version 2.0 (the "License"); 
        you may not use this file except in compliance with the License. 
        You may obtain a copy of the License at
        
                http://www.apache.org/licenses/LICENSE-2.0

        Unless required by applicable law or agreed to in writing, software 
        distributed under the License is distributed on an "AS IS" BASIS, 
        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
        See the License for the specific language governing permissions and 
        limitations under the License.
-->
<widget name="ColorPalette" id="http://openajax.org/samples/widgets/colorpalette"
		spec="1.0" width="208" height="148"
		xmlns="http://openajax.org/metadata">

    <requires>
		<library name="dojo" version="1.3" src="http://ajax.googleapis.com/ajax/libs/dojo/1.3/">
            <preload>
				djConfig = { isDebug: false, parseOnLoad: false, afterOnLoad: true };
			</preload>
		    <require type="javascript" src="dojo/dojo.xd.js"/>
		    <require type="css" src="dojo/resources/dojo.css"/>
		    <require type="css" src="dijit/themes/dijit.css"/>
		    <require type="css" src="dijit/themes/dijit_rtl.css"/>
		    <require type="css" src="dijit/themes/tundra/ColorPalette.css"/>
		</library>
    </requires>

  <properties>
    <property name='color' datatype='String' defaultValue="#ffffff" sharedAs='color'/>
    <!-- publish='true' -->
  </properties>
  
    <javascript location='afterContent'>
		dojo.require("dijit.ColorPalette");

      	dojo.addOnLoad(function(){
			new dijit.ColorPalette(
                    {   "class": "tundra",
                        onChange: function( color ) {
                            OpenAjax.widget.byId('__WID__').OpenAjax.setPropertyValue( 'color', color );
                        }
                    },
                    "__WID__palette"
            );
		});
    </javascript>

    <content>
      <![CDATA[
          <div class="tundra" style="background-color:#f5f5f5" >
	        <span ID='__WID__palette' dojoType="dijit.ColorPalette">
            </span>
          </div> 
      ]]>      
    </content>
</widget>
