You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@royale.apache.org by GitBox <gi...@apache.org> on 2018/06/04 06:50:15 UTC

[GitHub] alinakazi closed pull request #219: TitleWindow and ColorPicker Added

alinakazi closed pull request #219: TitleWindow and ColorPicker Added
URL: https://github.com/apache/royale-asjs/pull/219
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml b/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml
index a8b84fcf0..d78d3a08c 100644
--- a/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml
+++ b/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml
@@ -52,6 +52,8 @@
 	<component id="ApplicationLayout" class="mx.containers.beads.ApplicationLayout" />
 	<component id="BoxLayout" class="mx.containers.beads.BoxLayout" />
 	<component id="CanvasLayout" class="mx.containers.beads.CanvasLayout" />
+	<component id="TitleWindow" class="mx.containers.TitleWindow"/>
+	<component id="ColorPicker" class="mx.controls.ColorPicker"/>
 	<component id="RemoteObject" class="mx.rpc.remoting.mxml.RemoteObject" lookupOnly="true"/>
 	<component id="HTTPService" class="mx.rpc.http.mxml.HTTPService" lookupOnly="true"/>
 	<component id="NumberValidator" class="mx.validators.NumberValidator"/>
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/Panel.as b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/Panel.as
index b591f75fe..aa3f60124 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/Panel.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/Panel.as
@@ -163,7 +163,7 @@ include "../styles/metadata/ModalTransparencyStyles.as";
  *  @playerversion AIR 1.1
  *  @productversion Flex 3
  */
-//[Style(name="cornerRadius", type="Number", format="Length", inherit="no", theme="halo, spark")]
+[Style(name="cornerRadius", type="Number", format="Length", inherit="no", theme="halo, spark")]
 
 /**
  *  Boolean property that controls the visibility
@@ -247,7 +247,7 @@ include "../styles/metadata/ModalTransparencyStyles.as";
  *  @playerversion AIR 1.1
  *  @productversion Flex 3
  */
-//[Style(name="paddingBottom", type="Number", format="Length", inherit="no")]
+[Style(name="paddingBottom", type="Number", format="Length", inherit="no")]
 
 /**
  *  Number of pixels between the container's top border
@@ -260,7 +260,7 @@ include "../styles/metadata/ModalTransparencyStyles.as";
  *  @playerversion AIR 1.1
  *  @productversion Flex 3
  */
-//[Style(name="paddingTop", type="Number", format="Length", inherit="no")]
+[Style(name="paddingTop", type="Number", format="Length", inherit="no")]
 
 /**
  *  Flag to enable rounding for the bottom two corners of the container.
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/TitleWindow.as b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/TitleWindow.as
new file mode 100644
index 000000000..9539da869
--- /dev/null
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/TitleWindow.as
@@ -0,0 +1,291 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package mx.containers
+{
+
+	import org.apache.royale.events.CloseEvent;
+/*
+import mx.core.mx_internal;
+
+use namespace mx_internal;
+*/
+//--------------------------------------
+//  Events
+//--------------------------------------
+
+/**
+ *  Dispatched when the user selects the close button.
+ *
+ *  @eventType mx.events.CloseEvent.CLOSE
+ *  @helpid 3985
+ *  @tiptext close event
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Royale 0.9.3
+ */
+[Event(name="close", type="mx.events.CloseEvent")]
+
+//--------------------------------------
+//  Styles
+//--------------------------------------
+/**
+ *  The close button default skin.
+ *
+ *  @default null
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Royale 0.9.3
+ */
+//[Style(name="closeButtonSkin", type="Class", inherit="no", states="up, over, down, disabled")]
+
+/**
+ *  The close button disabled skin.
+ *
+ *  The default value is the "CloseButtonDisabled" symbol in the Assets.swf file.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Royale 0.9.3
+ */
+//[Style(name="closeButtonDisabledSkin", type="Class", inherit="no")]
+
+/**
+ *  The close button down skin.
+ *
+ *  The default value is the "CloseButtonDown" symbol in the Assets.swf file.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Royale 0.9.3
+ */
+//[Style(name="closeButtonDownSkin", type="Class", inherit="no")]
+
+/**
+ *  The close button over skin.
+ *
+ *  The default value is the "CloseButtonOver" symbol in the Assets.swf file.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Royale 0.9.3
+ */
+//[Style(name="closeButtonOverSkin", type="Class", inherit="no")]
+
+/**
+ *  The close button up skin.
+ *
+ *  The default value is the "CloseButtonUp" symbol in the Assets.swf file.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Royale 0.9.3
+ */
+//[Style(name="closeButtonUpSkin", type="Class", inherit="no")]
+
+//--------------------------------------
+//  Excluded APIs
+//--------------------------------------
+/*
+[Exclude(name="focusIn", kind="event")]
+[Exclude(name="focusOut", kind="event")]
+
+[Exclude(name="focusBlendMode", kind="style")]
+[Exclude(name="focusSkin", kind="style")]
+[Exclude(name="focusThickness", kind="style")]
+
+[Exclude(name="focusInEffect", kind="effect")]
+[Exclude(name="focusOutEffect", kind="effect")]
+
+//--------------------------------------
+//  Other metadata
+//--------------------------------------
+
+[AccessibilityClass(implementation="mx.accessibility.TitleWindowAccImpl")]
+
+[IconFile("TitleWindow.png")]
+
+[Alternative(replacement="spark.components.TitleWindow", since="4.0")]
+*/
+/**
+ *  A TitleWindow layout container contains a title bar, a caption,
+ *  a border, and a content area for its child.
+ *  Typically, you use TitleWindow containers to wrap self-contained
+ *  application modules.
+ *  For example, you could include a form in a TitleWindow container.
+ *  When the user completes the form, you can close the TitleWindow
+ *  container programmatically, or let the user close it by using the
+ *  Close button.
+ *  
+ *  <p>The TitleWindow container has the following default sizing characteristics:</p>
+ *     <table class="innertable">
+ *        <tr>
+ *           <th>Characteristic</th>
+ *           <th>Description</th>
+ *        </tr>
+ *        <tr>
+ *           <td>Default size</td>
+ *           <td>Height is large enough to hold all of the children in the content area at the default or 
+ *               explicit heights of the children, plus the title bar and border, plus any vertical gap between 
+ *               the children, plus the top and bottom padding of the container.<br/> 
+ *               Width is the larger of the default or explicit width of the widest child, plus the left and 
+ *               right container borders padding, or the width of the title text.</td>
+ *        </tr>
+ *        <tr>
+ *           <td>borders</td>
+ *           <td>10 pixels for the left and right values.<br/>
+ *               2 pixels for the top value.<br/>
+ *               0 pixels for the bottom value.
+ *           </td>
+ *        </tr>
+ *        <tr>
+ *           <td>padding</td>
+ *           <td>4 pixels for the top, bottom, left, and right values.</td>
+ *        </tr>
+ *     </table>
+ *
+ *  @mxml
+ *  
+ *  <p>The <code>&lt;mx:TitleWindow&gt;</code> tag inherits all of the tag 
+ *  attributes of its superclass, and adds the following tag attributes:</p>
+ *  
+ *  <pre>
+ *  &lt;mx:TitleWindow
+ *   <b>Properties</b>
+ *   showCloseButton="false|true"
+ * 
+ *   <b>Styles</b>
+ *   closeButtonDisabledSkin="<i>'CloseButtonDisabled' symbol in Assets.swf</i>"
+ *   closeButtonDownSkin="<i>'CloseButtonDown' symbol in Assets.swf</i>"
+ *   closeButtonOverSkin="<i>'CloseButtonOver' symbol in Assets.swf</i>"
+ *   closeButtonUpSkin="<i>'CloseButtonUp' symbol in Assets.swf</i>"
+ *  
+ *   <strong>Events</strong>
+ *   close="<i>No default</i>"
+ *   &gt;
+ *    ...
+ *      child tags
+ *    ...
+ *  /&gt;
+ *  </pre>
+ *  
+ *  @includeExample examples/SimpleTitleWindowExample.mxml -noswf
+ *  @includeExample examples/TitleWindowApp.mxml
+ *  
+ *  @see mx.core.Application
+ *  @see mx.managers.PopUpManager
+ *  @see mx.containers.Panel
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Royale 0.9.3
+ */
+public class TitleWindow extends Panel
+{
+    //include "../core/Version.as";
+
+    //--------------------------------------------------------------------------
+    //
+    //  Class mixins
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  Placeholder for mixin by TitleWindowAccImpl.
+     */
+    //mx_internal static var createAccessibilityImplementation:Function;
+
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Constructor.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Royale 0.9.3
+     */
+    public function TitleWindow()
+    {
+        super();
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    //--------------------------------------------------------------------------
+
+    //----------------------------------
+    //  showCloseButton
+    //----------------------------------
+
+    [Inspectable(category="General")]
+
+    /**
+     *  Whether to display a Close button in the TitleWindow container.
+     *  The default value is <code>false</code>.
+     *  Set it to <code>true</code> to display the Close button.
+     *  Selecting the Close button generates a <code>close</code> event,
+     *  but does not close the TitleWindow container.
+     *  You must write a handler for the <code>close</code> event
+     *  and close the TitleWindow from within it.
+     *
+     *  @default false
+     *
+     *  @tiptext If true, the close button is displayed
+     *  @helpid 3986
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Royale 0.9.3
+     */
+    private var _showCloseButton:Boolean = false;
+	
+    public function get showCloseButton():Boolean
+    {
+        return _showCloseButton;
+    }
+
+    /**
+     *  @private
+     */
+    public function set showCloseButton(value:Boolean):void
+    {
+        _showCloseButton = value;
+    }
+
+}
+
+}
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/ColorPicker.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/ColorPicker.as
new file mode 100644
index 000000000..91485d949
--- /dev/null
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/ColorPicker.as
@@ -0,0 +1,648 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package mx.controls
+{
+	import org.apache.royale.events.Event;
+	import mx.controls.ComboBase;
+/*
+import flash.display.DisplayObject;
+import flash.events.Event;
+import flash.events.FocusEvent;
+import flash.events.KeyboardEvent;
+import flash.events.MouseEvent;
+import flash.geom.Point;
+import flash.geom.Rectangle;
+import flash.ui.Keyboard;
+import flash.utils.getTimer;
+import mx.controls.colorPickerClasses.SwatchPanel;
+import mx.controls.colorPickerClasses.WebSafePalette;
+import mx.core.LayoutDirection;
+import mx.core.UIComponent;
+import mx.core.UIComponentGlobals;
+import mx.core.mx_internal;
+import mx.effects.Tween;
+import mx.events.ColorPickerEvent;
+import mx.events.DropdownEvent;
+import mx.events.FlexEvent;
+import mx.events.FlexMouseEvent;
+import mx.events.InterManagerRequest;
+import mx.events.SandboxMouseEvent;
+import mx.managers.IFocusManager;
+import mx.managers.ISystemManager;
+import mx.managers.PopUpManager;
+import mx.managers.SystemManager;
+import mx.skins.halo.SwatchSkin;
+import mx.styles.StyleProxy;
+
+use namespace mx_internal;
+*/
+//--------------------------------------
+//  Events
+//--------------------------------------
+
+/**
+ *  Dispatched when the selected color 
+ *  changes as a result of user interaction.
+ *
+ *  @eventType mx.events.ColorPickerEvent.CHANGE
+ *  @helpid 4918
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Royale 0.9.3
+ */
+//[Event(name="change", type="mx.events.ColorPickerEvent")]
+
+/**
+ *  Dispatched when the swatch panel closes.
+ *
+ *  @eventType mx.events.DropdownEvent.CLOSE
+ *  @helpid 4921
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Royale 0.9.3
+ */
+//[Event(name="close", type="mx.events.DropdownEvent")]
+
+/**
+ *  Dispatched if the ColorPicker <code>editable</code>
+ *  property is set to <code>true</code>
+ *  and the user presses Enter after typing in a hexadecimal color value.
+ *
+ *  @eventType mx.events.ColorPickerEvent.ENTER
+ *  @helpid 4919
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Royale 0.9.3
+ */
+//[Event(name="enter", type="mx.events.ColorPickerEvent")]
+
+/**
+ *  Dispatched when the user rolls the mouse out of a swatch
+ *  in the SwatchPanel object.
+ *
+ *  @eventType mx.events.ColorPickerEvent.ITEM_ROLL_OUT
+ *  @helpid 4924
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Royale 0.9.3
+ */
+//[Event(name="itemRollOut", type="mx.events.ColorPickerEvent")]
+
+/**
+ *  Dispatched when the user rolls the mouse over a swatch
+ *  in the SwatchPanel object.
+ *
+ *  @eventType mx.events.ColorPickerEvent.ITEM_ROLL_OVER
+ *  @helpid 4923
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Royale 0.9.3
+ */
+//[Event(name="itemRollOver", type="mx.events.ColorPickerEvent")]
+
+/**
+ *  Dispatched when the color swatch panel opens.
+ *
+ *  @eventType mx.events.DropdownEvent.OPEN
+ *  @helpid 4920
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Royale 0.9.3
+ */
+//[Event(name="open", type="mx.events.DropdownEvent")]
+
+//--------------------------------------
+//  Styles
+//--------------------------------------
+
+//include "../styles/metadata/FocusStyles.as"
+//include "../styles/metadata/IconColorStyles.as"
+//include "../styles/metadata/LeadingStyle.as"
+//include "../styles/metadata/TextStyles.as"
+
+/**
+ *  Color of the outer border on the SwatchPanel object.
+ *  The default value is <code>0xA5A9AE</code>.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Royale 0.9.3
+ */
+//[Style(name="borderColor", type="uint", format="Color", inherit="no", theme="halo")]
+
+/**
+ *  Length of a close transition, in milliseconds.
+ * 
+ *  The default value for the Halo theme is 250.
+ *  The default value for the Spark theme is 50.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Royale 0.9.3
+ */
+//[Style(name="closeDuration", type="Number", format="Time", inherit="no")]
+
+/**
+ *  Easing function to control component tweening.
+ *  The default value is <code>undefined</code>.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Royale 0.9.3
+ */
+//[Style(name="closeEasingFunction", type="Function", inherit="no")]
+
+/**
+ *  Alphas used for the background fill of controls.
+ *  The default value is <code>[ 0.6, 0.4 ]</code>.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Royale 0.9.3
+ */
+//[Style(name="fillAlphas", type="Array", arrayType="Number", inherit="no", theme="halo")]
+
+/**
+ *  Colors used to tint the background of the control.
+ *  Pass the same color for both values for a flat-looking control.
+ *  The default value is <code>[ 0xFFFFFF, 0xCCCCCC ]</code>.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Royale 0.9.3
+ */
+//[Style(name="fillColors", type="Array", arrayType="uint", format="Color", inherit="no", theme="halo")]
+
+/**
+ *  Alphas used for the highlight fill of controls.
+ *  The default value is <code>[ 0.3, 0.0 ]</code>.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Royale 0.9.3
+ */
+//[Style(name="highlightAlphas", type="Array", arrayType="Number", inherit="no", theme="halo")]
+
+/**
+ *  Length of an open transition, in milliseconds.
+ *
+ *  The default value for the Halo theme is 250.
+ *  The default value for the Spark theme is 0.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Royale 0.9.3
+ */
+//[Style(name="openDuration", type="Number", format="Time", inherit="no")]
+
+/**
+ *  Easing function to control component tweening.
+ *  The default value is <code>undefined</code>.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Royale 0.9.3
+ */
+//[Style(name="openEasingFunction", type="Function", inherit="no")]
+
+/**
+ *  Bottom padding of SwatchPanel object below the swatch grid.
+ *  The default value is 5.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Royale 0.9.3
+ */
+//[Style(name="paddingBottom", type="Number", format="Length", inherit="no")]
+
+/**
+ *  Left padding of SwatchPanel object to the side of the swatch grid.
+ *  The default value is 5.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Royale 0.9.3
+ */
+//[Style(name="paddingLeft", type="Number", format="Length", inherit="no")]
+
+/**
+ *  Right padding of SwatchPanel object to the side of the swatch grid.
+ *  The default value is 5.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Royale 0.9.3
+ */
+//[Style(name="paddingRight", type="Number", format="Length", inherit="no")]
+
+/**
+ *  Top padding of SwatchPanel object above the swatch grid.
+ *  The default value is 4.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Royale 0.9.3
+ */
+//[Style(name="paddingTop", type="Number", format="Length", inherit="no")]
+
+/**
+ *  Color of the swatches' borders.
+ *  The default value is <code>0x000000</code>.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Royale 0.9.3
+ */
+//[Style(name="swatchBorderColor", type="uint", format="Color", inherit="no", theme="halo")]
+
+/**
+ *  Size of the outlines of the swatches' borders.
+ *  The default value is 1.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Royale 0.9.3
+ */
+//[Style(name="swatchBorderSize", type="Number", format="Length", inherit="no")]
+
+/**
+ *  Name of the class selector that defines style properties for the swatch panel.
+ *  The default value is <code>undefined</code>. The following example shows the default style properties
+ *  that are defined by the <code>swatchPanelStyleName</code>. 
+ *  <pre>
+ *  ColorPicker {
+ *      swatchPanelStyleName:mySwatchPanelStyle;
+ *  }
+ *  
+ *  .mySwatchPanelStyle {
+ *      backgroundColor:#E5E6E7;
+ *      columnCount:20;
+ *      horizontalGap:0;
+ *      previewHeight:22;
+ *      previewWidth:45;
+ *      swatchGridBackgroundColor:#000000;
+ *      swatchGridBorderSize:0;
+ *      swatchHeight:12;
+ *      swatchHighlightColor:#FFFFFF;
+ *      swatchHighlightSize:1;
+ *      swatchWidth:12;
+ *      textFieldWidth:72;
+ *      verticalGap:0;
+ *  }
+ *  </pre>
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Royale 0.9.3
+ */
+//[Style(name="swatchPanelStyleName", type="String", inherit="no")]
+
+//--------------------------------------
+//  Excluded APIs
+//--------------------------------------
+//[Exclude(name="text", kind="property")]
+
+//[Exclude(name="fillAlphas", kind="style")]
+//[Exclude(name="fillColors", kind="style")]
+//[Exclude(name="highlightAlphas", kind="style")]
+
+//--------------------------------------
+//  Other metadata
+//--------------------------------------
+
+
+//[AccessibilityClass(implementation="mx.accessibility.ColorPickerAccImpl")]
+
+//[DataBindingInfo("acceptedTypes", "{ dataProvider: { label: &quot;String&quot; } }")]
+
+//[DefaultBindingProperty(source="selectedItem", destination="dataProvider")]
+
+//[DefaultTriggerEvent("change")]
+
+//[IconFile("ColorPicker.png")]
+
+   
+
+/**
+ *  The ColorPicker control provides a way for a user to choose a color from a swatch list.
+ *  The default mode of the component shows a single swatch in a square button.
+ *  When the user clicks the swatch button, the swatch panel appears and
+ *  displays the entire swatch list.
+ *
+ *  <p>The ColorPicker control has the following default sizing characteristics:</p>
+ *     <table class="innertable">
+ *        <tr>
+ *           <th>Characteristic</th>
+ *           <th>Description</th>
+ *        </tr>
+ *        <tr>
+ *           <td>Default size</td>
+ *           <td>ColorPicker: 22 by 22 pixels
+ *          <br>Swatch panel: Sized to fit the ColorPicker control width</br></td>
+ *        </tr>
+ *        <tr>
+ *           <td>Minimum size</td>
+ *           <td>0 pixels by 0 pixels</td>
+ *        </tr>
+ *        <tr>
+ *           <td>Maximum size</td>
+ *           <td>Undefined</td>
+ *        </tr>
+ *     </table>
+ *
+ *  @mxml
+ *
+ *  <p>The <code>&lt;mx:ColorPicker&gt;</code> tag inherits all of the properties of its
+ *  superclass, and the following properties:</p>
+ *
+ *  <pre>
+ *  &lt;mx:ColorPicker
+ *    <b>Properties</b>
+ *    colorField="color"
+ *    labelField="label"
+ *    selectedColor="0x000000"
+ *    selectedIndex="0"
+ *    showTextField="true|false"
+ * 
+ *    <b>Styles</b>
+ *    borderColor="0xA5A9AE"
+ *    closeDuration="250"
+ *    closeEasingFunction="undefined"
+ *    color="0x0B333C"
+ *    disabledIconColor="0x999999"
+ *    fillAlphas="[0.6,0.4]"
+ *    fillColors="[0xFFFFFF, 0xCCCCCC]"
+ *    focusAlpha="0.5"
+ *    focusRoundedCorners="tl tr bl br"
+ *    fontAntiAliasType="advanced"
+ *    fontfamily="Verdana"
+ *    fontGridFitType="pixel"
+ *    fontSharpness="0""
+ *    fontSize="10"
+ *    fontStyle="normal"
+ *    fontThickness="0"
+ *    fontWeight="normal"
+ *    highlightAlphas="[0.3,0.0]"
+ *    iconColor="0x000000"
+ *    leading="2"
+ *    openDuration="250"
+ *    openEasingFunction="undefined"
+ *    paddingBottom="5"
+ *    paddingLeft="5"
+ *    paddingRight="5"
+ *    paddingTop="4"
+ *    swatchBorderColor="0x000000"
+ *    swatchBorderSize="1"
+ *    swatchPanelStyleName="undefined"
+ *    textAlign="left"
+ *    textDecoration="none"
+ *    textIndent="0"
+ * 
+ *    <b>Events</b>
+ *    change="<i>No default</i>"
+ *    close="<i>No default</i>"
+ *    enter="<i>No default</i>"
+ *    itemRollOut="<i>No default</i>"
+ *    itemRollOver="<i>No default</i>"
+ *    open="<i>No default</i>"
+ *    /&gt;
+ *  </pre>
+ *
+ *  @see mx.controls.List
+ *  @see mx.effects.Tween
+ *  @see mx.managers.PopUpManager
+ *
+ *  @includeExample examples/ColorPickerExample.mxml
+ *
+ *  @helpid 4917
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Royale 0.9.3
+ */
+public class ColorPicker extends ComboBase
+{
+    //include "../core/Version.as";
+
+    //--------------------------------------------------------------------------
+    //
+    //  Class mixins
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  Placeholder for mixin by SliderAccImpl.
+     */
+    //mx_internal static var createAccessibilityImplementation:Function;
+    
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Constructor.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Royale 0.9.3
+     */
+    public function ColorPicker()
+    {
+        super();
+
+        //if (!isModelInited)
+        //    loadDefaultPalette();
+
+        // Make editable false so that focus doesn't go
+        // to the comboBase's textInput which is not used by CP
+        super.editable = false;
+
+        // Register for events.
+        //addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Variables
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  Used by SwatchPanel
+     */
+    //mx_internal var showingDropdown:Boolean = false;
+
+    /**
+     *  @private
+     *  Used by SwatchPanel
+     */
+    //mx_internal var isDown:Boolean = false;
+
+    /**
+     *  @private
+     *  Used by SwatchPanel
+     */
+    //mx_internal var isOpening:Boolean = false;
+
+    /**
+     *  @private
+     */
+    //private var dropdownGap:Number = 6;
+
+    /**
+     *  @private
+     */
+    //private var indexFlag:Boolean = false;
+
+    /**
+     *  @private
+     */
+    //private var initializing:Boolean = true;
+
+    /**
+     *  @private
+     */
+    //private var isModelInited:Boolean = false;
+
+    /**
+     *  @private
+     */
+    //private var collectionChanged:Boolean = false;
+
+    /**
+     *  @private
+     */
+    //private var swatchPreview:SwatchSkin;
+
+    /**
+     *  @private
+     */
+    //private var dropdownSwatch:SwatchPanel;
+
+    /**
+     *  @private
+     */
+    //private var triggerEvent:Event;
+
+    //--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    //--------------------------------------------------------------------------
+
+    //----------------------------------
+    //  selectedColor
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage for the selectedColor property.
+     */
+    private var _selectedColor:uint = 0x000000;
+
+    //[Bindable("change")]
+    //[Bindable("valueCommit")]
+    //[Inspectable(category="General", defaultValue="0", format="Color")]
+
+    /**
+     *  The value of the currently selected color in the
+     *  SwatchPanel object. 
+     *  In the &lt;mx:ColorPicker&gt; tag only, you can set this property to 
+     *  a standard string color name, such as "blue".
+     *  If the dataProvider contains an entry for black (0x000000), the
+     *  default value is 0; otherwise, the default value is the color of
+     *  the item at index 0 of the data provider.
+     *
+     *  @helpid 4932
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Royale 0.9.3
+     */
+    public function get selectedColor():uint
+    {
+        return _selectedColor;
+    }
+
+    /**
+     *  @private
+     */
+    public function set selectedColor(value:uint):void
+    {
+		/*
+        if (!indexFlag)
+        {
+            super.selectedIndex = findColorByName(value);
+        }
+        else
+        {
+            indexFlag = false;
+        }
+		*/
+        if (value != selectedColor)
+        {
+            _selectedColor = value;
+
+            //updateColor(value);
+
+            //if (dropdownSwatch)
+            //    dropdownSwatch.selectedColor = value;
+        }
+
+        //dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT));
+    }
+
+}
+
+} 
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/colorPickerClasses/SwatchPanel.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/colorPickerClasses/SwatchPanel.as
new file mode 100644
index 000000000..c76fb29ef
--- /dev/null
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/colorPickerClasses/SwatchPanel.as
@@ -0,0 +1,1464 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package mx.controls.colorPickerClasses
+{
+	import mx.core.UIComponent;
+	import org.apache.royale.events.Event;
+	import org.apache.royale.events.MouseEvent;
+	import org.apache.royale.events.KeyboardEvent;
+	import mx.managers.IFocusManagerContainer;
+	import org.apache.royale.geom.Rectangle;
+	import mx.collections.IList;
+	import mx.collections.ArrayList;
+	import mx.controls.ColorPicker;
+/*
+import flash.display.DisplayObject;
+import flash.events.Event;
+import flash.events.EventPhase;
+import flash.events.KeyboardEvent;
+import flash.events.MouseEvent;
+import flash.geom.Rectangle;
+import flash.ui.Keyboard;
+
+import mx.collections.ArrayList;
+import mx.collections.IList;
+import mx.controls.ColorPicker;
+import mx.controls.TextInput;
+import mx.core.FlexVersion;
+import mx.core.IFlexDisplayObject;
+import mx.core.ITextInput;
+import mx.core.UIComponent;
+import mx.core.mx_internal;
+import mx.events.ColorPickerEvent;
+import mx.managers.IFocusManagerContainer;
+import mx.skins.halo.SwatchPanelSkin;
+import mx.skins.halo.SwatchSkin;
+import mx.styles.StyleManager;
+
+use namespace mx_internal;
+*/
+//--------------------------------------
+//  Events
+//--------------------------------------
+
+/**
+ *  Dispatched when the selected color changes.
+ *
+ *  @eventType flash.events.Event.CHANGE
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+//[Event(name="change", type="flash.events.Event")]
+
+/**
+ *  Dispatched when the user presses the Enter key.
+ *
+ *  @eventType mx.events.FlexEvent.ENTER
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+//[Event(name="enter", type="flash.events.Event")]
+
+/**
+ *  Dispatched when the mouse rolls over a color.
+ *
+ *  @eventType mx.events.ColorPickerEvent.ITEM_ROLL_OVER
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+//[Event(name="itemRollOver", type="mx.events.ColorPickerEvent")]
+
+/**
+ *  Dispatched when the mouse rolls out of a color.
+ *
+ *  @eventType mx.events.ColorPickerEvent.ITEM_ROLL_OUT
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+//[Event(name="itemRollOut", type="mx.events.ColorPickerEvent")]
+
+//--------------------------------------
+//  Styles
+//--------------------------------------
+
+//include "../../styles/metadata/GapStyles.as"
+//include "../../styles/metadata/PaddingStyles.as"
+//include "../../styles/metadata/TextStyles.as"
+
+/**
+ *  Background color of the component.
+ *  You can either have a <code>backgroundColor</code> or a
+ *  <code>backgroundImage</code>, but not both.
+ *  Note that some components, like a Button, do not have a background
+ *  because they are completely filled with the button face or other graphics.
+ *  The DataGrid control also ignores this style.
+ *  The default value is <code>0xE5E6E7</code>. If both this style and the
+ *  backgroundImage style are undefined, the control has a transparent background.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+//[Style(name="backgroundColor", type="uint", format="Color", inherit="no")]
+
+/**
+ *  Black section of a three-dimensional border, or the color section
+ *  of a two-dimensional border.
+ * 
+ *  The default value is 0xA5A9AE.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+//[Style(name="borderColor", type="uint", format="Color", inherit="no")]
+
+/**
+ *  Number of columns in the swatch grid.
+ *  The default value is 20.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+//[Style(name="columnCount", type="int", inherit="no")]
+
+/**
+ *  Color of the control border highlight.
+ *  The default value is <code>0xFFFFFF</code>.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+//[Style(name="highlightColor", type="uint", format="Color", inherit="yes", theme="halo, spark")]
+
+/**
+ *  Number of pixels between the component's top border
+ *  and the top edge of its content area.
+ *
+ *  @default 4
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+//[Style(name="paddingTop", type="Number", format="Length", inherit="no")]
+
+/**
+ *  Number of pixels between the component's bottom border
+ *  and the bottom edge of its content area.
+ *
+ *  @default 5
+ *
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+//[Style(name="paddingBottom", type="Number", format="Length", inherit="no")]
+
+/**
+ *  Color for the left and right inside edges of a component's skin.
+ *  The default value is <code>0xD5DDDD</code>.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+//[Style(name="shadowCapColor", type="uint", format="Color", inherit="yes", theme="halo")]
+
+/**
+ *  Bottom inside color of a button's skin.
+ *  A section of the three-dimensional border.
+ *  The default value is <code>0x4D555E</code> (light gray).
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+//[Style(name="shadowColor", type="uint", format="Color", inherit="yes", theme="halo, spark")]
+
+/**
+ *  Height of the larger preview swatch that appears above the swatch grid on
+ *  the top left of the SwatchPanel object.
+ *  The default value is 22.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+//[Style(name="previewHeight", type="Number", format="Length", inherit="no")]
+
+/**
+ *  Width of the larger preview swatch.
+ *  The default value is 45.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+//[Style(name="previewWidth", type="Number", format="Length", inherit="no")]
+
+/**
+ *  Size of the swatchBorder outlines.
+ *  The default value is 1.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+//[Style(name="swatchBorderSize", type="Number", format="Length", inherit="no")]
+
+/**
+ *  Color of the swatch borders.
+ *  The default value is <code>0x000000</code>.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+//[Style(name="swatchBorderColor", type="uint", format="Color", inherit="no")]
+
+/**
+ *  Size of the single border around the grid of swatches.
+ *  The default value is 0.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+//[Style(name="swatchGridBorderSize", type="Number", format="Length", inherit="no")]
+
+/**
+ *  Color of the background rectangle behind the swatch grid.
+ *  The default value is <code>0x000000</code>.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+//[Style(name="swatchGridBackgroundColor", type="uint", format="Color", inherit="no")]
+
+/**
+ *  Height of each swatch.
+ *  The default value is 12.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+//[Style(name="swatchHeight", type="Number", format="Length", inherit="no")]
+
+/**
+ *  Color of the highlight that appears around the swatch when the user
+ *  rolls over a swatch.
+ *  The default value is <code>0xFFFFFF</code>.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+//[Style(name="swatchHighlightColor", type="uint", format="Color", inherit="no")]
+
+/**
+ *  Size of the highlight that appears around the swatch when the user
+ *  rolls over a swatch.
+ *  The default value is 1.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+//[Style(name="swatchHighlightSize", type="Number", format="Length", inherit="no")]
+
+/**
+ *  Width of each swatch.
+ *  The default value is 12.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+//[Style(name="swatchWidth", type="Number", format="Length", inherit="no")]
+
+/**
+ *  Name of the style sheet definition to configure the text input control.
+ *  The default value is "swatchPanelTextField"
+ * 
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+//[Style(name="textFieldStyleName", type="String", inherit="no")]
+
+/**
+ *  Width of the hexadecimal text box that appears above the swatch grid.
+ *  The default value is 72.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+//[Style(name="textFieldWidth", type="Number", format="Length", inherit="no")]
+
+/**
+ *  The class implementing ITextInput that is used by this component
+ *  to input text.
+ *
+ *  <p>It can be set to either the mx.core.TextInput class
+ *  (to use the classic Halo TextInput control)
+ *  or the mx.controls.MXFTETextInput class
+ *  (to use the Spark TextInput component based on the Text Layout Framework 
+ *  to get improved text rendering, including bidirectional layout).</p>
+ *
+ *  @default mx.controls.TextInput
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 1.5
+ *  @productversion Flex 4
+ */
+//[Style(name="textInputClass", type="Class", inherit="no")]
+
+//--------------------------------------
+//  Other metadata
+//--------------------------------------
+
+//[ExcludeClass]
+
+/**
+ *  @private
+ */
+public class SwatchPanel extends UIComponent implements IFocusManagerContainer
+{
+    //include "../../core/Version.as";
+    
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Constructor.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function SwatchPanel() 
+    {
+        super();
+        
+        // Register for events.
+        //addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
+        //addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);        
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Variables
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */    
+    //mx_internal var textInput:ITextInput;
+
+    /**
+     *  @private
+     *  Set by the parent to determine the type of TextInput to be created.
+     *  If this style is also set on this component directly, it will take
+     *  precedence.
+     */    
+    //mx_internal var textInputClass:Class;
+
+    /**
+     *  @private
+     */    
+    //private var border:SwatchPanelSkin;
+
+    /**
+     *  @private
+     */    
+    //private var preview:SwatchSkin;
+
+    /**
+     *  @private
+     */    
+    //private var swatches:SwatchSkin;
+
+    /**
+     *  @private
+     */    
+    //private var highlight:SwatchSkin;
+
+    /**
+     *  @private
+     *  Used by ColorPicker
+     */   
+    //mx_internal var isOverGrid:Boolean = false;
+
+    /**
+     *  @private
+     *  Used by ColorPicker
+     */   
+    //mx_internal var isOpening:Boolean = false;
+
+    /**
+     *  @private
+     *  Used by ColorPicker
+     */   
+    //mx_internal var focusedIndex:int = -1;
+
+    /**
+     *  @private
+     *  Used by ColorPicker
+     */   
+    //mx_internal var tweenUp:Boolean = false;
+    
+    /**
+     *  @private
+     */    
+    private var initializing:Boolean = true;
+ 
+    /**
+     *  @private
+     */    
+    private var indexFlag:Boolean = false;
+ 
+    /**
+     *  @private
+     */    
+    private var lastIndex:int = -1;
+ 
+    /**
+     *  @private
+     */    
+    private var grid:Rectangle;
+ 
+    /**
+     *  @private
+     */    
+    private var rows:int;
+    
+    /**
+     *  @private
+	 *  Cached style.
+     */        
+    private var horizontalGap:Number;
+    
+    /**
+     *  @private
+	 *  Cached style.
+     */        
+    private var verticalGap:Number;
+    
+    /**
+     *  @private
+	 *  Cached style.
+     */        
+    private var columnCount:int;
+    
+    /**
+     *  @private
+	 *  Cached style.
+     */        
+    private var paddingLeft:Number;
+    
+    /**
+     *  @private
+	 *  Cached style.
+     */        
+    private var paddingRight:Number;
+    
+    /**
+     *  @private
+	 *  Cached style.
+     */        
+    private var paddingTop:Number;
+    
+    /**
+     *  @private
+	 *  Cached style.
+     */        
+    private var paddingBottom:Number;
+    
+    /**
+     *  @private
+	 *  Cached style.
+     */        
+    private var textFieldWidth:Number;
+     
+    /**
+     *  @private
+	 *  Cached style.
+     */        
+    private var previewWidth:Number;
+    
+    /**
+     *  @private
+	 *  Cached style.
+     */        
+    private var previewHeight:Number;
+    
+    /**
+     *  @private
+	 *  Cached style.
+     */        
+    private var swatchWidth:Number;
+    
+    /**
+     *  @private
+	 *  Cached style.
+     */        
+    private var swatchHeight:Number;
+    
+    /**
+     *  @private
+	 *  Cached style.
+     */        
+    private var swatchGridBorderSize:Number;
+    
+    /**
+     *  @private
+     */        
+	private var cellOffset:Number = 1;
+ 
+    /**
+     *  @private
+     */        
+    private var itemOffset:Number = 3;
+    
+    //--------------------------------------------------------------------------
+    //
+    //  Overridden Properties
+    //
+    //--------------------------------------------------------------------------
+    
+    //----------------------------------
+    //  height
+    //----------------------------------
+    
+    /**
+     *  @private
+     *  We set our size internally based on style values.
+	 *  Setting height has no effect on the panel.
+	 *  Override to return the preferred width and height of our contents.
+     */    
+    override public function get height():Number
+    {
+        return getExplicitOrMeasuredHeight();
+    }
+
+    /**
+     *  @private
+     */
+    override public function set height(value:Number):void 
+    {
+        // do nothing...
+    }
+    
+    //----------------------------------
+    //  width
+    //----------------------------------
+    
+    /**
+     *  @private
+     *  We set our size internally based on style values.
+	 *  Setting width has no effect on the panel.
+	 *  Override to return the preferred width and height of our contents.
+     */    
+    override public function get width():Number
+    {
+        return getExplicitOrMeasuredWidth();
+    }
+
+    /**
+     *  @private
+     */
+    override public function set width(value:Number):void 
+    {
+        // do nothing...
+    }
+    
+    //--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    //--------------------------------------------------------------------------
+
+    //----------------------------------
+    //  colorField
+    //----------------------------------
+    
+    /**
+	 *  Storage for the colorField property.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+    private var _colorField:String = "color";
+
+    /**
+     *  @private
+     */    
+    public function get colorField():String
+    {
+        return _colorField;
+    }
+
+    /**
+     *  @private
+     */
+    public function set colorField(value:String):void
+    {
+        _colorField = value;
+    }
+
+    //----------------------------------
+    //  dataProvider
+    //----------------------------------
+    
+    /**
+	 *  Storage for the dataProvider property.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	private var _dataProvider:IList;
+
+    /**
+     *  @private
+     */    
+    public function get dataProvider():Object
+    {
+        return _dataProvider;
+    }
+
+    /**
+     *  @private
+     */
+    public function set dataProvider(value:Object):void
+    {
+        if (value is IList)
+        {
+	        _dataProvider = IList(value);        
+        }
+        else if (value is Array)
+		{
+			var tmpDP:IList = new ArrayList(value as Array);
+			value = tmpDP;
+		}
+		else
+		{
+	        _dataProvider = null;			
+        }        
+
+        if (!initializing)
+        {
+            // Adjust if dataProvider is empty
+            if (length == 0 || isNaN(length))
+            {
+                //highlight.visible = false;
+                _selectedIndex = -1;
+            }
+            
+			// Redraw using new dataProvider
+            refresh();
+        }
+    }
+
+    //----------------------------------
+    //  editable
+    //----------------------------------    
+    
+    /**
+	 *  Storage for the editable property.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	private var _editable:Boolean = true;
+
+    /**
+     *  @private
+     */    
+    public function get editable():Boolean
+    {
+        return _editable;
+    }
+
+    /**
+     *  @private
+     */
+    public function set editable(value:Boolean):void
+    {
+        _editable = value;
+        
+		//if (!initializing)
+            //textInput.editable = value;
+    }
+
+    //----------------------------------
+    //  labelField
+    //----------------------------------
+    
+    /**
+	 *  Storage for the labelField property.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+    private var _labelField:String = "label";
+
+    /**
+     *  @private
+     */    
+    public function get labelField():String
+    {
+        return _labelField;
+    }
+
+    /**
+     *  @private
+     */
+    public function set labelField(value:String):void
+    {
+        _labelField = value;
+    }
+
+    //----------------------------------
+    //  length
+    //----------------------------------
+    
+    /**
+     *  @private
+     */    
+    public function get length():int
+    {
+        return _dataProvider ? _dataProvider.length : 0;
+    }
+
+    //----------------------------------
+    //  selectedColor
+    //----------------------------------
+    
+    /**
+	 *  Storage for the selectedColor property.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+    private var _selectedColor:uint = 0x000000;
+
+    /**
+     *  @private
+     */    
+    public function get selectedColor():uint
+    {
+        return _selectedColor;
+    }
+
+    /**
+     *  @private
+     */
+    public function set selectedColor(value:uint):void
+    {
+        // Set index unless it set us
+        if (!indexFlag)
+        {
+            var SI:int = findColorByName(value);
+            if (SI != -1)
+            {
+                //focusedIndex = findColorByName(value);
+                //_selectedIndex = focusedIndex;
+            }
+            else
+			{
+                selectedIndex = -1;
+			}
+        }
+        else
+        {
+            indexFlag = false;
+        }
+        /*
+		if (value != selectedColor || !isOverGrid || isOpening)
+        {
+            _selectedColor = value;
+            updateColor(value);
+
+            if (isOverGrid || isOpening)
+                setFocusOnSwatch(selectedIndex);
+            if (isOpening)
+                isOpening = false;
+        }*/
+    }
+
+    //----------------------------------
+    //  selectedIndex
+    //----------------------------------
+    
+    /**
+	 *  Storage for the selectedIndex property.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+    private var _selectedIndex:int = 0;
+
+    /**
+     *  @private
+     */    
+    public function get selectedIndex():int
+    {
+        return _selectedIndex;
+    }
+
+    /**
+     *  @private
+     */
+    public function set selectedIndex(value:int):void
+    {
+        if (value != selectedIndex && !initializing)
+        {
+            //focusedIndex = value;
+            //_selectedIndex = focusedIndex;
+            
+			if (value >= 0)
+            {
+                indexFlag = true;
+                selectedColor = getColor(value);
+            }
+        }
+    }
+
+    //----------------------------------
+    //  selectedItem
+    //----------------------------------
+    
+    /**
+     *  @private
+     */    
+    public function get selectedItem():Object
+    {
+        return dataProvider ? dataProvider.getItemAt(selectedIndex) : null;
+    }
+
+    /**
+     *  @private
+     */
+    public function set selectedItem(value:Object):void
+    {
+        if (value != selectedItem)
+        {
+            var color:Number;
+			if (typeof(value) == "object")
+                color = Number(value[colorField]);
+            else if (typeof(value) == "number")
+                color = Number(value);
+            
+			selectedIndex = findColorByName(color);
+        }
+    }
+    
+    //----------------------------------
+    //  showTextField
+    //----------------------------------
+    
+    /**
+	 *  Storage for the showTextField property.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+    private var _showTextField:Boolean = true;
+
+    /**
+     *  @private
+     */        
+    public function get showTextField():Boolean
+    {
+        return _showTextField;
+    }
+
+    /**
+     *  @private
+     */
+    public function set showTextField(value:Boolean):void
+    {
+        _showTextField = value;
+
+        //if (!initializing)
+        //    textInput.visible = value;
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Overridden methods: UIComponent
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */            
+    override protected function createChildren():void
+    {
+        super.createChildren();
+        /*
+        // Create the panel background
+        if (!border)
+		{
+			border = new SwatchPanelSkin();
+			
+			border.styleName = this;
+			border.name = "swatchPanelBorder";
+			
+			addChild(border);  
+		}      
+                    
+        // Create the preview swatch
+        if (!preview)
+		{
+			preview = new SwatchSkin();
+			
+			preview.styleName = this;
+			preview.color = selectedColor;
+			preview.name = "swatchPreview";
+			
+			preview.setStyle("swatchBorderSize", 0);
+			
+			addChild(preview);        
+		}    
+		
+        // Create the hex text field  
+        if (!textInput)
+		{			
+            // Mechanism to use FTETextInput. Look for it in SwatchPanel and
+            // if not found see if we got it from our parent.
+            var c:Class = getStyle("textInputClass");
+            if (!c) 
+                c = textInputClass;
+            
+            if (!c || FlexVersion.compatibilityVersion < FlexVersion.VERSION_4_0)
+                textInput = new TextInput();
+            else
+                textInput = new textInputClass();
+			
+			textInput.styleName = getStyle("textFieldStyleName");
+			
+			textInput.editable = _editable;
+			textInput.maxChars = 6;
+			textInput.name = "inset";
+			textInput.text = rgbToHex(selectedColor);
+			textInput.restrict = "#xa-fA-F0-9";   
+			
+			textInput.addEventListener(Event.CHANGE, textInput_changeHandler);
+			textInput.addEventListener(KeyboardEvent.KEY_DOWN, textInput_keyDownHandler);
+			
+			addChild(DisplayObject(textInput));        
+		}
+        
+        // Create the swatches grid
+        if (!swatches)
+		{
+			swatches = new SwatchSkin();
+			
+			swatches.styleName = this;
+			swatches.colorField = colorField;
+			swatches.name = "swatchGrid";
+						
+			swatches.addEventListener(MouseEvent.CLICK, swatches_clickHandler);
+			
+			addChild(swatches);        
+		}
+    
+        // Create the swatch highlight for grid rollovers
+        if (!highlight)
+		{
+			highlight = new SwatchSkin();
+			
+			highlight.styleName = this;
+			highlight.visible = false;
+			highlight.name = "swatchHighlight";
+						
+			addChild(highlight);        
+		}
+		*/
+        refresh();
+
+        initializing = false;
+    }
+
+    /**
+     *  @private
+     *  Change
+     */    
+    override protected function measure():void
+    {
+		super.measure();
+        
+        //swatches.updateGrid(IList(dataProvider));
+
+        // Make sure we're at least 100 pixels wide
+        
+		//measuredWidth = Math.max(
+		//	paddingLeft + paddingRight + swatches.width, 100);
+        
+		//measuredHeight = Math.max(
+		//	paddingTop + previewHeight + itemOffset +
+		//	paddingBottom + swatches.height, 100);
+    }
+
+    /**
+     *  @private
+     */    
+	override protected function updateDisplayList(unscaledWidth:Number,
+												  unscaledHeight:Number):void
+    {
+        super.updateDisplayList(unscaledWidth, unscaledHeight);
+
+        // Layout preview position.
+        //preview.updateSkin(selectedColor);
+        //preview.move(paddingLeft, paddingTop);
+
+        // Layout hex text field position.
+        //textInput.setActualSize(textFieldWidth, previewHeight);
+        //textInput.move(paddingLeft + previewWidth + itemOffset, paddingTop);
+
+        // Layout grid position.
+        //swatches.updateGrid(IList(dataProvider));
+        //swatches.move(paddingLeft, paddingTop + previewHeight + itemOffset);
+
+        // Layout highlight skin.
+		// Highlight doesn't require a color, hence we pass 0.
+        //highlight.updateSkin(0);
+
+        // Layout panel skin.
+        //border.setActualSize(unscaledWidth, unscaledHeight);
+        
+        // Define area surrounding the swatches.
+		/*
+        if (!grid) 
+            grid = new Rectangle();
+        grid.left = swatches.x + swatchGridBorderSize;
+        grid.top = swatches.y + swatchGridBorderSize;
+        grid.right = swatches.x + swatchGridBorderSize +
+					 (swatchWidth - 1) * columnCount + 1 +
+					 horizontalGap * (columnCount - 1);
+        grid.bottom = swatches.y + swatchGridBorderSize +
+					  (swatchHeight - 1) * rows + 1 +
+					  verticalGap * (rows - 1);*/
+    }
+
+
+    /**
+     *  @private
+     */    
+    override public function styleChanged(styleProp:String):void
+    {
+        super.styleChanged(styleProp);
+        
+        if (!initializing)
+            refresh();
+    }
+    
+    /**
+     *  @private
+     */    
+    override public function setFocus():void
+    {
+        // Our text field controls focus
+        if (showTextField && editable)
+        {
+            //textInput.setFocus();
+            //ensure text field has the correct color value
+	        //textInput.text = rgbToHex(selectedColor);
+        }
+    }
+        
+    //--------------------------------------------------------------------------
+    //
+    //  Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */    
+    private function updateStyleCache():void
+    {
+        horizontalGap = getStyle("horizontalGap");
+        verticalGap = getStyle("verticalGap");
+        columnCount = getStyle("columnCount");
+        paddingLeft = getStyle("paddingLeft");
+        paddingRight = getStyle("paddingRight");
+        paddingTop = getStyle("paddingTop");
+        paddingBottom = getStyle("paddingBottom");
+        textFieldWidth = getStyle("textFieldWidth");
+        previewWidth = getStyle("previewWidth");
+        previewHeight = getStyle("previewHeight");
+        swatchWidth = getStyle("swatchWidth");
+        swatchHeight = getStyle("swatchHeight");
+        swatchGridBorderSize = getStyle("swatchGridBorderSize");
+
+        // Adjust if columnCount is greater than # of swatches
+        if (columnCount > length)
+            columnCount = length;
+
+        // Rows based on columnCount and list length
+        rows = Math.ceil(length / columnCount);
+    }
+
+    /**
+     *  @private
+     */    
+    private function refresh():void
+    {
+        updateStyleCache();
+        updateDisplayList(unscaledWidth, unscaledHeight);
+
+        // Changes may have invalidated the size, so make sure we re-measure - SDK-13855
+        invalidateSize();
+    }
+
+    /**
+     *  @private
+	 *  Update color values in preview
+     */    
+    private function updateColor(color:uint):void
+    {
+        if (initializing || isNaN(color))
+            return;
+		/*
+        // Update the preview swatch
+        preview.updateSkin(color);
+
+        // Set hex field
+        if (isOverGrid)
+        {            
+            var label:String = null;
+            
+			if (focusedIndex >= 0 && 
+                typeof(dataProvider.getItemAt(focusedIndex)) == "object")
+            {
+                label = dataProvider.getItemAt(focusedIndex)[labelField];
+            }
+
+            
+            // MXFTETextInput does not maintain its selection when the
+            // text is reset.  Remember to maintain soft link to MXFTETextInput.
+            if (!(textInput is TextInput))
+            {
+                var anchorPosition:int = textInput.selectionAnchorPosition;
+                var activePosition:int = textInput.selectionActivePosition;
+            }
+
+            textInput.text = label != null && label.length != 0 ?
+							 label :
+                             rgbToHex(color);
+
+            if (!(textInput is TextInput))
+                textInput.selectRange(anchorPosition, activePosition);
+        }*/
+    }
+
+    /**
+     *  @private
+	 *  Convert RGB offset to Hex.
+     */    
+    private function rgbToHex(color:uint):String
+    {
+        // Find hex number in the RGB offset
+        var colorInHex:String = color.toString(16);
+        var c:String = "00000" + colorInHex;
+        var e:int = c.length;
+        c = c.substring(e - 6, e);
+        return c.toUpperCase();
+    }
+
+    /**
+     *  @private
+     */    
+    private function findColorByName(name:Number):int
+    {
+        if (name == getColor(selectedIndex))
+            return selectedIndex;
+
+        for (var i:int = 0; i < length; i++)
+		{
+            if (name == getColor(i))
+                return i;
+		}
+
+        return -1;
+    }
+    
+    /**
+     *  @private
+     */    
+    private function getColor(index:int):uint
+    {
+		if (!dataProvider || dataProvider.length < 1 ||
+			index < 0 || index >= length)
+		{
+			//return StyleManager.NOT_A_COLOR;
+		}
+        
+		return uint(typeof(dataProvider.getItemAt(index)) == "object" ?
+        	   		dataProvider.getItemAt(index)[colorField] : 
+					dataProvider.getItemAt(index));
+    }
+
+    /**
+     *  @private
+     */    
+    private function setFocusOnSwatch(index:int):void
+    {
+        if (index < 0 || index > length - 1)
+        {
+            //highlight.visible = false;
+            return;
+        }
+        
+		// Swatch highlight activated by mouse move or key events
+        var row:Number = Math.floor(index / columnCount);
+        var column:Number = index - (row * columnCount);
+        
+		var xPos:Number = swatchWidth * column + horizontalGap * column -
+						  cellOffset * column + paddingLeft +
+						  swatchGridBorderSize;
+        var yPos:Number = swatchHeight * row + verticalGap * row -
+						  cellOffset * row + paddingTop + previewHeight +
+						  itemOffset + swatchGridBorderSize;
+        
+		//highlight.move(xPos, yPos);
+        //highlight.visible = true;
+        
+		//isOverGrid = true;
+        
+		updateColor(getColor(index));
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Event handlers
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */    
+    private function mouseMoveHandler(event:MouseEvent):void
+    {    
+	/*
+        if (ColorPicker(owner).isDown && enabled)
+        {
+            var colorPickerEvent:ColorPickerEvent;
+                    
+            // Only assess movements that occur over the swatch grid.
+            if (mouseX > grid.left && mouseX < grid.right &&
+                mouseY > grid.top && mouseY < grid.bottom)
+            {
+                // Calculate location
+                var column:Number = Math.floor(
+					(Math.floor(mouseX) - (grid.left + verticalGap)) /
+					(swatchWidth + horizontalGap - cellOffset));
+				var row:Number = Math.floor(
+					(Math.floor(mouseY) - grid.top) /
+					((swatchHeight + verticalGap) - cellOffset));
+                var index:Number = row * columnCount + column;
+
+                // Adjust for edges
+                if (column == -1)
+					index++;
+                else if (column > (columnCount - 1))
+				    index--;
+                else if (row > (rows - 1))
+					index -= columnCount;
+                else if (index < 0)
+					index += columnCount;
+
+                // Set state
+                if ((lastIndex != index || highlight.visible == false) &&
+					index < length)
+                {
+                    if (lastIndex != -1 && lastIndex != index)
+                    {
+                        // Dispatch a ColorPickerEvent with type "itemRollOut".
+						colorPickerEvent = new ColorPickerEvent(
+                            ColorPickerEvent.ITEM_ROLL_OUT);
+                        colorPickerEvent.index = lastIndex;
+						colorPickerEvent.color = getColor(lastIndex);
+                        dispatchEvent(colorPickerEvent);
+                    }
+
+                    focusedIndex = index;
+                    lastIndex = focusedIndex;
+                    setFocusOnSwatch(focusedIndex);
+                    
+                    // Dispatch a ColorPickerEvent with type "itemRollOver".
+					colorPickerEvent = new ColorPickerEvent(
+                        ColorPickerEvent.ITEM_ROLL_OVER);
+                    colorPickerEvent.index =  focusedIndex;
+					colorPickerEvent.color = getColor(focusedIndex);
+                    dispatchEvent(colorPickerEvent); 
+                }
+            }
+            else
+            {
+                if (highlight.visible == true && isOverGrid && lastIndex != -1)
+                {
+                    highlight.visible = false;
+
+                    // Dispatch a ColorPickerEvent with type "itemRollOut".
+                    colorPickerEvent = new ColorPickerEvent(
+                        ColorPickerEvent.ITEM_ROLL_OUT);
+                    colorPickerEvent.index = lastIndex;
+					colorPickerEvent.color = getColor(lastIndex);
+                    dispatchEvent(colorPickerEvent); 
+                }
+
+                isOverGrid = false;
+            }
+        }
+		*/
+    }
+    
+    /**
+     *  @private
+     */    
+    private function swatches_clickHandler(event:MouseEvent):void
+    {
+	/*
+		if (!enabled)
+			return;
+	
+        if (mouseX > grid.left && mouseX < grid.right &&
+            mouseY > grid.top && mouseY < grid.bottom)
+        {
+            selectedIndex = focusedIndex;
+            
+			if (ColorPicker(owner).selectedIndex != selectedIndex)
+            {
+                ColorPicker(owner).selectedIndex = selectedIndex;
+                
+				var cpEvent:ColorPickerEvent = 
+                    new ColorPickerEvent(ColorPickerEvent.CHANGE);
+                cpEvent.index = selectedIndex;
+                cpEvent.color = getColor(selectedIndex);
+                ColorPicker(owner).dispatchEvent(cpEvent);
+            }
+
+            ColorPicker(owner).close(); // owner = ColorPicker
+        }
+		*/
+    }
+        
+    /**
+     *  @private
+     */    
+    private function textInput_keyDownHandler(event:KeyboardEvent):void
+    {
+        // Redispatch the event from the ColorPicker
+		// and let its keyDownHandler() handle it.
+        //ColorPicker(owner).dispatchEvent(event);
+    }
+
+    /**
+     *  @private
+     */    
+    private function textInput_changeHandler(event:Event):void
+    {
+        // Handle events from hex TextField.
+        /*var color:String = ITextInput(event.target).text;
+        if (color.charAt(0) == "#")
+        {
+            textInput.maxChars = 7;
+            color = "0x"+color.substring(1);
+        }
+        else if (color.substring(0,2) == "0x")
+        {
+            textInput.maxChars = 8;
+        }
+        else
+        {
+            textInput.maxChars = 6;
+            color = "0x"+color;
+        }
+        
+		highlight.visible = false;
+        isOverGrid = false;
+		selectedColor = Number(color);
+        
+		dispatchEvent(new Event("change"));   */
+    }
+}
+
+}


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services