This is an automated email from the ASF dual-hosted git repository.
pent pushed a commit to branch feature/MXRoyale
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/feature/MXRoyale by this push:
new f3da3cc Adding DateChooser.
new e9fc0f2 Merge branch 'feature/MXRoyale' of
https://github.com/apache/royale-asjs into feature/MXRoyale
f3da3cc is described below
commit f3da3cce898cdc53c1490e8ed314198e3bb6ab74
Author: Peter Ent <[email protected]>
AuthorDate: Tue Apr 3 15:44:30 2018 -0400
Adding DateChooser.
---
.../MXRoyale/src/main/resources/defaults.css | 10 +
.../src/main/resources/mx-royale-manifest.xml | 1 +
.../src/main/royale/mx/controls/DateChooser.as | 1018 ++++++++++++++++++++
.../royale/mx/events/CalendarLayoutChangeEvent.as | 169 ++++
4 files changed, 1198 insertions(+)
diff --git a/frameworks/projects/MXRoyale/src/main/resources/defaults.css
b/frameworks/projects/MXRoyale/src/main/resources/defaults.css
index 8679c05..572c909 100644
--- a/frameworks/projects/MXRoyale/src/main/resources/defaults.css
+++ b/frameworks/projects/MXRoyale/src/main/resources/defaults.css
@@ -59,6 +59,16 @@ Container
IViewportModel:
ClassReference("org.apache.royale.html.beads.models.ViewportModel");
}
+DateChooser
+{
+ IBeadView:
ClassReference("org.apache.royale.html.beads.DateChooserView");
+ IBeadModel:
ClassReference("org.apache.royale.html.beads.models.DateChooserModel");
+ IBeadLayout:
ClassReference("org.apache.royale.html.beads.layouts.VerticalFlexLayout");
+ IBeadController:
ClassReference("org.apache.royale.html.beads.controllers.DateChooserMouseController");
+ width: 280px;
+ height: 240px;
+}
+
Image
{
IBeadModel:
ClassReference("org.apache.royale.html.beads.models.ImageModel");
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 3cdd7a6..db16aae 100644
--- a/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml
+++ b/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml
@@ -24,6 +24,7 @@
<component id="Application" class="mx.core.Application" />
<component id="Button" class="mx.controls.Button" />
<component id="CheckBox" class="mx.controls.CheckBox" />
+ <component id="DateChooser" class="mx.controls.DateChooser" />
<component id="Image" class="mx.controls.Image" />
<component id="Label" class="mx.controls.Label" />
<component id="LinkButton" class="mx.controls.LinkButton" />
diff --git
a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/DateChooser.as
b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/DateChooser.as
new file mode 100644
index 0000000..229c6e4
--- /dev/null
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/DateChooser.as
@@ -0,0 +1,1018 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+{
+COMPILE::JS {
+ import goog.DEBUG;
+}
+
+ import org.apache.royale.html.beads.models.DateChooserModel;
+
+/*
+import flash.display.DisplayObject;
+import flash.display.GradientType;
+import flash.display.Graphics;
+import flash.display.Sprite;
+import flash.events.Event;
+import flash.events.EventPhase;
+import flash.events.KeyboardEvent;
+import flash.geom.ColorTransform;
+import flash.geom.Matrix;
+import flash.text.TextFormat;
+import flash.ui.Keyboard;
+import flash.utils.getQualifiedClassName;
+
+import mx.core.FlexSprite;
+import mx.core.FlexVersion;
+import mx.core.IFlexModuleFactory;
+import mx.core.IFontContextComponent;
+import mx.core.IUITextField;
+import mx.core.UITextField;
+*/
+import mx.core.UIComponent;
+import mx.core.mx_internal;
+import mx.events.CalendarLayoutChangeEvent;
+
+/*
+import mx.events.DateChooserEvent;
+import mx.events.FlexEvent;
+import mx.graphics.RectangularDropShadow;
+import mx.managers.IFocusManagerComponent;
+import mx.styles.StyleManager;
+import mx.styles.StyleProxy;
+import mx.utils.GraphicsUtil;
+*/
+use namespace mx_internal;
+
+//--------------------------------------
+// Events
+//--------------------------------------
+
+/**
+ * Dispatched when a date is selected or changed.
+ *
+ * @eventType mx.events.CalendarLayoutChangeEvent.CHANGE
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+[Event(name="change", type="mx.events.CalendarLayoutChangeEvent")]
+
+/**
+ * Dispatched when the month changes due to user interaction.
+ *
+ * @eventType mx.events.DateChooserEvent.SCROLL
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+//[Event(name="scroll", type="mx.events.DateChooserEvent")]
+
+
+/**
+ * The DateChooser control displays the name of a month, the year,
+ * and a grid of the days of the month, with columns labeled
+ * for the day of the week.
+ * The user can select a date, a range of dates, or multiple dates.
+ * The control contains forward and back arrow buttons
+ * for changing the month and year.
+ * You can let users select multiple dates, disable the selection
+ * of certain dates, and limit the display to a range of dates.
+ *
+ * <p>The DateChooser control has the following default characteristics:</p>
+ * <table class="innertable">
+ * <tr>
+ * <th>Characteristic</th>
+ * <th>Description</th>
+ * </tr>
+ * <tr>
+ * <td>Default size</td>
+ * <td>A size large enough to hold the calendar, and wide enough to
display the day names</td>
+ * </tr>
+ * <tr>
+ * <td>Minimum size</td>
+ * <td>0 pixels</td>
+ * </tr>
+ * <tr>
+ * <td>Maximum size</td>
+ * <td>No limit</td>
+ * </tr>
+ * </table>
+ *
+ * @mxml
+ *
+ * <p>The <code><mx:DateChooser></code> tag inherits all of the tag
attributes
+ * of its superclass, and adds the following tag attributes:</p>
+ *
+ * <pre>
+ * <mx:DateChooser
+ * <strong>Properties</strong>
+ * allowDisjointSelection="true|false"
+ * allowMultipleSelection="false|true"
+ * dayNames="["S", "M", "T", "W", "T", "F", "S"]"
+ * disabledDays="<i>No default</i>"
+ * disabledRanges="<i>No default</i>"
+ * displayedMonth="<i>Current month</i>"
+ * displayedYear="<i>Current year</i>"
+ * firstDayOfWeek="0"
+ * maxYear="2100"
+ * minYear="1900"
+ * monthNames="["January", "February", "March", "April", "May",
+ * "June", "July", "August", "September", "October", "November",
+ * "December"]"
+ * monthSymbol=""
+ * selectableRange="<i>No default</i>"
+ * selectedDate="<i>No default</i>"
+ * selectedRanges="<i>No default</i>"
+ * showToday="true|false"
+ * yearNavigationEnabled="false|true"
+ * yearSymbol=""
+ *
+ * <strong>Styles</strong>
+ * backgroundColor="0xFFFFFF"
+ * backgroundAlpha="1.0"
+ * borderColor="0xAAB3B3"
+ * borderThickness="1"
+ * color="0x0B333C"
+ * cornerRadius="4"
+ * disabledColor="0xAAB3B3"
+ * 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|italic"
+ * fontThickness="0"
+ * fontWeight="normal|bold"
+ * headerColors="[0xE1E5EB, 0xF4F5F7]"
+ * headerStyleName="headerDateText"
+ * highlightAlphas="[0.3, 0.0]"
+ * horizontalGap="8"
+ * iconColor="0x111111"
+ * leading="2"
+ * nextMonthDisabledSkin="DateChooserMonthArrowSkin"
+ * nextMonthDownSkin="DateChooserMonthArrowSkin"
+ * nextMonthOverSkin="DateChooserMonthArrowSkin"
+ * nextMonthSkin = "DateChooserMonthArrowSkin"
+ * nextMonthUpSkin="DateChooserMonthArrowSkin"
+ * nextYearDisabledSkin="DateChooserYearArrowSkin"
+ * nextYearDownSkin="DateChooserYearArrowSkin"
+ * nextYearOverSkin="DateChooserYearArrowSkin"
+ * nextYearSkin = "DateChooserYearArrowSkin"
+ * nextYearUpSkin="DateChooserYearArrowSkin"
+ * prevMonthDisabledSkin="DateChooserMonthArrowSkin"
+ * prevMonthDownSkin="DateChooserMonthArrowSkin"
+ * prevMonthOverSkin="DateChooserMonthArrowSkin"
+ * prevMonthSkin = "DateChooserMonthArrowSkin"
+ * prevMonthUpSkin="DateChooserMonthArrowSkin"
+ * prevYearDisabledSkin="DateChooserYearArrowSkin"
+ * prevYearDownSkin="DateChooserYearArrowSkin"
+ * prevYearOverSkin="DateChooserYearArrowSkin"
+ * prevYearSkin = "DateChooserYearArrowSkin"
+ * prevYearUpSkin="DateChooserYearArrowSkin"
+ * rollOverColor="0xEEFEE6"
+ * rollOverIndicatorSkin="DateChooserIndicator"
+ * selectionColor="0xB7F39B"
+ * selectionIndicatorSkin="DateChooserIndicator"
+ * textAlign="left|right|center"
+ * textDecoration="none|underline"
+ * textIndent="0"
+ * todayColor="0x818181"
+ * todayIndicatorSkin="DateChooserIndicator"
+ * todayStyleName="todayStyle"
+ * verticalGap="6"
+ * weekDayStyleName="weekDayStyle"
+ *
+ * <strong>Events</strong>
+ * change="<i>No default</i>"
+ * scroll="<i>No default</i>"
+ * />
+ * </pre>
+ *
+ * @see mx.controls.DateField
+ *
+ * @includeExample examples/DateChooserExample.mxml
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+public class DateChooser extends UIComponent //implements
IFocusManagerComponent, IFontContextComponent
+{
+
+
//--------------------------------------------------------------------------
+ //
+ // Constructor
+ //
+
//--------------------------------------------------------------------------
+
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public function DateChooser()
+ {
+ super();
+ typeNames = "DateChooser";
+ }
+
+
//--------------------------------------------------------------------------
+ //
+ // Overridden properties
+ //
+
//--------------------------------------------------------------------------
+
+
+ //----------------------------------
+ // enabled
+ //----------------------------------
+
+
+ /**
+ * @private
+ */
+ override public function get enabled():Boolean
+ {
+ if (GOOG::DEBUG)
+ trace("get enabled not implemented");
+ return true;
+ }
+
+ /**
+ * @private
+ */
+ override public function set enabled(value:Boolean):void
+ {
+ if (GOOG::DEBUG)
+ trace("set enabled not implemented");
+ }
+
+
//--------------------------------------------------------------------------
+ //
+ // Properties
+ //
+
//--------------------------------------------------------------------------
+
+ //----------------------------------
+ // dayNames
+ //----------------------------------
+
+
+ [Bindable("dayNamesChanged")]
+ [Inspectable(arrayType="String", defaultValue="null")]
+
+ /**
+ * The weekday names for DateChooser control.
+ * Changing this property changes the day labels
+ * of the DateChooser control.
+ * Sunday is the first day (at index 0).
+ * The rest of the week names follow in the normal order.
+ *
+ * @default [ "S", "M", "T", "W", "T", "F", "S" ].
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public function get dayNames():Array
+ {
+ return DateChooserModel(model).dayNames;
+ }
+
+ /**
+ * @private
+ */
+ public function set dayNames(value:Array):void
+ {
+ DateChooserModel(model).dayNames = value;
+// dayNamesOverride = value;
+//
+// _dayNames = value != null ?
+// value :
+// resourceManager.getStringArray(
+// "controls", "dayNamesShortest");
+//
+// // _dayNames will be null if there are no resources.
+// _dayNames = _dayNames ? _dayNames.slice(0) : null;
+//
+// dayNamesChanged = true;
+//
+// invalidateProperties();
+ }
+
+ //----------------------------------
+ // disabledDays
+ //----------------------------------
+
+ [Bindable("disabledDaysChanged")]
+ [Inspectable(arrayType="Date")]
+
+ /**
+ * The days to disable in a week.
+ * All the dates in a month, for the specified day, are disabled.
+ * This property changes the appearance of the DateChooser control.
+ * The elements of this array can have values from 0 (Sunday) to
+ * 6 (Saturday).
+ * For example, a value of <code>[ 0, 6 ]</code>
+ * disables Sunday and Saturday.
+ *
+ * @default []
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public function get disabledDays():Array
+ {
+ if (GOOG::DEBUG)
+ trace("get disabledDays not implemented.");
+ return null;
+ }
+
+ /**
+ * @private
+ */
+ public function set disabledDays(value:Array):void
+ {
+ if (GOOG::DEBUG)
+ trace("set disabledDays not implemented");
+// _disabledDays = value;
+// disabledDaysChanged = true;
+//
+// invalidateProperties();
+ }
+
+ //----------------------------------
+ // disabledRanges
+ //----------------------------------
+
+
+
+ [Bindable("disabledRangesChanged")]
+ [Inspectable(arrayType="Object")]
+
+ /**
+ * Disables single and multiple days.
+ *
+ * <p>This property accepts an Array of objects as a parameter.
+ * Each object in this array is a Date object, specifying a
+ * single day to disable; or an object containing either or both
+ * of the <code>rangeStart</code> and <code>rangeEnd</code> properties,
+ * each of whose values is a Date object.
+ * The value of these properties describes the boundaries
+ * of the date range.
+ * If either is omitted, the range is considered
+ * unbounded in that direction.
+ * If you specify only <code>rangeStart</code>,
+ * all the dates after the specified date are disabled,
+ * including the <code>rangeStart</code> date.
+ * If you specify only <code>rangeEnd</code>,
+ * all the dates before the specified date are disabled,
+ * including the <code>rangeEnd</code> date.
+ * To disable a single day, use a single Date object specifying a date
+ * in the Array. Time values are zeroed out from the Date
+ * object if they are present.</p>
+ *
+ * <p>The following example, disables the following dates: January 11
+ * 2006, the range January 23 - February 10 2006, and March 1 2006
+ * and all following dates.</p>
+ *
+ * <p><code>disabledRanges="{[ new Date(2006,0,11), {rangeStart:
+ * new Date(2006,0,23), rangeEnd: new Date(2006,1,10)},
+ * {rangeStart: new Date(2006,2,1)} ]}"</code></p>
+ *
+ * @default []
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public function get disabledRanges():Array
+ {
+ if (GOOG::DEBUG)
+ trace("get disabledRanged not implemented");
+ return null;
+ }
+
+ /**
+ * @private
+ */
+ public function set disabledRanges(value:Array):void
+ {
+ if (GOOG::DEBUG)
+ trace("set disabledRanges not implemented");
+// _disabledRanges = scrubTimeValues(value);
+// disabledRangesChanged = true;
+//
+// invalidateProperties();
+ }
+
+ //----------------------------------
+ // displayedMonth
+ //----------------------------------
+
+ [Bindable("scroll")]
+ [Bindable("viewChanged")]
+ [Inspectable(category="General")]
+
+ /**
+ * Used together with the <code>displayedYear</code> property,
+ * the <code>displayedMonth</code> property specifies the month
+ * displayed in the DateChooser control.
+ * Month numbers are zero-based, so January is 0 and December is 11.
+ * Setting this property changes the appearance of the DateChooser
control.
+ *
+ * <p>The default value is the current month.</p>
+ *
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public function get displayedMonth():int
+ {
+ return DateChooserModel(model).displayedMonth;
+// if (dateGrid && _displayedMonth != dateGrid.displayedMonth)
+// return dateGrid.displayedMonth;
+// else
+// return _displayedMonth;
+ }
+
+ /**
+ * @private
+ */
+ public function set displayedMonth(value:int):void
+ {
+ DateChooserModel(model).displayedMonth = value;
+// if (isNaN(value) || displayedMonth == value)
+// return;
+//
+// _displayedMonth = value;
+// displayedMonthChanged = true;
+//
+// invalidateProperties();
+//
+// if (dateGrid)
+// dateGrid.displayedMonth = value; // if it's already this value
shouldn't do anything
+ }
+
+ //----------------------------------
+ // displayedYear
+ //----------------------------------
+
+
+// [Bindable("scroll")]
+// [Bindable("viewChanged")]
+ [Inspectable(category="General")]
+
+ /**
+ * Used together with the <code>displayedMonth</code> property,
+ * the <code>displayedYear</code> property specifies the year
+ * displayed in the DateChooser control.
+ * Setting this property changes the appearance of the DateChooser
control.
+ *
+ * <p>The default value is the current year.</p>
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public function get displayedYear():int
+ {
+ return DateChooserModel(model).displayedYear;
+// if (dateGrid)
+// return dateGrid.displayedYear;
+// else
+// return _displayedYear;
+ }
+
+ /**
+ * @private
+ */
+ public function set displayedYear(value:int):void
+ {
+ DateChooserModel(model).displayedYear = value;
+// if (isNaN(value) || displayedYear == value)
+// return;
+//
+// _displayedYear = value;
+// displayedYearChanged = true;
+//
+// invalidateProperties();
+//
+// if (dateGrid)
+// dateGrid.displayedYear = value;// if it's already this value
shouldn't do anything
+ }
+
+ //----------------------------------
+ // firstDayOfWeek
+ //----------------------------------
+
+
+ [Bindable("firstDayOfWeekChanged")]
+ [Inspectable(defaultValue="null")]
+
+ /**
+ * Number representing the day of the week to display in the
+ * first column of the DateChooser control.
+ * The value must be in the range 0 to 6, where 0 corresponds to Sunday,
+ * the first element of the <code>dayNames</code> Array.
+ *
+ * <p>Setting this property changes the order of the day columns.
+ * For example, setting it to 1 makes Monday the first column
+ * in the control.</p>
+ *
+ * @default 0 (Sunday)
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public function get firstDayOfWeek():Object
+ {
+ return DateChooserModel(model).firstDayOfWeek;
+ }
+
+ /**
+ * @private
+ */
+ public function set firstDayOfWeek(value:Object):void
+ {
+ DateChooserModel(model).firstDayOfWeek = Number(value);
+// firstDayOfWeekOverride = value;
+//
+// _firstDayOfWeek = value != null ?
+// int(value) :
+// resourceManager.getInt(
+// "controls", "firstDayOfWeek");
+//
+//
+// firstDayOfWeekChanged = true;
+//
+// invalidateProperties();
+ }
+
+ //----------------------------------
+ // fontContext
+ //----------------------------------
+
+
+ //----------------------------------
+ // maxYear
+ //----------------------------------
+
+ /**
+ * @private
+ * Storage for the maxYear property.
+ */
+ private var _maxYear:int = 2100;
+
+ /**
+ * The last year selectable in the control.
+ *
+ * @default 2100
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public function get maxYear():int
+ {
+ return _maxYear;
+ }
+
+ /**
+ * @private
+ */
+ public function set maxYear(value:int):void
+ {
+ if (_maxYear == value)
+ return;
+
+ _maxYear = value;
+ }
+
+ //----------------------------------
+ // minYear
+ //----------------------------------
+
+ /**
+ * @private
+ * Storage for the minYear property.
+ */
+ private var _minYear:int = 1900;
+
+ /**
+ * The first year selectable in the control.
+ *
+ * @default 1900
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public function get minYear():int
+ {
+ return _minYear;
+ }
+
+ /**
+ * @private
+ */
+ public function set minYear(value:int):void
+ {
+ if (_minYear == value)
+ return;
+
+ _minYear = value;
+ }
+
+ //----------------------------------
+ // monthNames
+ //----------------------------------
+
+
+ [Bindable("monthNamesChanged")]
+ [Inspectable(arrayType="String", defaultValue="null")]
+
+ /**
+ * Names of the months displayed at the top of the DateChooser control.
+ * The <code>monthSymbol</code> property is appended to the end of
+ * the value specified by the <code>monthNames</code> property,
+ * which is useful in languages such as Japanese.
+ *
+ * @default [ "January", "February", "March", "April", "May", "June",
+ * "July", "August", "September", "October", "November", "December" ]
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public function get monthNames():Array
+ {
+ return DateChooserModel(model).monthNames;
+ }
+
+ /**
+ * @private
+ */
+ public function set monthNames(value:Array):void
+ {
+ DateChooserModel(model).monthNames = value;
+// monthNamesOverride = value;
+//
+// _monthNames = value != null ?
+// value :
+// resourceManager.getStringArray(
+// "SharedResources", "monthNames");
+//
+// // _monthNames will be null if there are no resources.
+// _monthNames = _monthNames ? monthNames.slice(0) : null;
+//
+// monthNamesChanged = true;
+//
+// invalidateProperties();
+// invalidateSize();
+ }
+
+
+
+ //----------------------------------
+ // selectableRange
+ //----------------------------------
+
+ /**
+ * @private
+ * Storage for the selectableRange property.
+ */
+ private var _selectableRange:Object;
+
+ /**
+ * @private
+ */
+ private var selectableRangeChanged:Boolean = false;
+
+ [Bindable("selectableRangeChanged")]
+
+ /**
+ * Range of dates between which dates are selectable.
+ * For example, a date between 04-12-2006 and 04-12-2007
+ * is selectable, but dates out of this range are disabled.
+ *
+ * <p>This property accepts an Object as a parameter.
+ * The Object contains two properties, <code>rangeStart</code>
+ * and <code>rangeEnd</code>, of type Date.
+ * If you specify only <code>rangeStart</code>,
+ * all the dates on and after the specified date are enabled.
+ * If you only specify <code>rangeEnd</code>,
+ * all the dates on and before the specified date are enabled.
+ * To enable only a single day in a DateChooser control,
+ * you can pass a Date object directly. Time values are
+ * zeroed out from the Date object if they are present.</p>
+ *
+ * <p>The following example enables only the range
+ * January 1, 2006 through June 30, 2006. Months before January
+ * and after June do not appear in the DateChooser.</p>
+ *
+ * <p><code>selectableRange="{{rangeStart : new Date(2006,0,1),
+ * rangeEnd : new Date(2006,5,30)}}"</code></p>
+ *
+ * @default null
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public function get selectableRange():Object
+ {
+ return _selectableRange;
+ }
+
+ /**
+ * @private
+ */
+ public function set selectableRange(value:Object):void
+ {
+ _selectableRange = scrubTimeValue(value);
+ selectableRangeChanged = true;
+
+ invalidateProperties();
+ }
+
+ //----------------------------------
+ // selectedDate
+ //----------------------------------
+
+ /**
+ * @private
+ * Storage for the selectedDate property.
+ */
+ private var _selectedDate:Date;
+
+ /**
+ * @private
+ */
+ private var selectedDateChanged:Boolean = false;
+
+ [Bindable("change")]
+ [Bindable("valueCommit")]
+ [Inspectable(category="General")]
+
+ /**
+ * Date selected in the DateChooser control.
+ * If the incoming Date object has any time values,
+ * they are zeroed out.
+ *
+ * <p>Holding down the Control key when selecting the
+ * currently selected date in the control deselects it,
+ * sets the <code>selectedDate</code> property to <code>null</code>,
+ * and then dispatches the <code>change</code> event.</p>
+ *
+ * @default null
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public function get selectedDate():Date
+ {
+ return DateChooserModel(model).selectedDate;
+ //return _selectedDate;
+ }
+
+ /**
+ * @private
+ */
+ public function set selectedDate(value:Date):void
+ {
+ DateChooserModel(model).selectedDate = value;
+// _selectedDate = scrubTimeValue(value) as Date;
+// selectedDateChanged = true;
+//
+// invalidateProperties();
+ }
+
+ //----------------------------------
+ // selectedRanges
+ //----------------------------------
+
+ [Bindable("change")]
+ [Bindable("valueCommit")]
+ [Inspectable(arrayType="Date")]
+
+ /**
+ * Selected date ranges.
+ *
+ * <p>This property accepts an Array of objects as a parameter.
+ * Each object in this array has two date Objects,
+ * <code>rangeStart</code> and <code>rangeEnd</code>.
+ * The range of dates between each set of <code>rangeStart</code>
+ * and <code>rangeEnd</code> (inclusive) are selected.
+ * To select a single day, set both <code>rangeStart</code> and
<code>rangeEnd</code>
+ * to the same date. Time values are zeroed out from the Date
+ * object if they are present.</p>
+ *
+ * <p>The following example, selects the following dates: January 11
+ * 2006, the range January 23 - February 10 2006. </p>
+ *
+ * <p><code>selectedRanges="{[ {rangeStart: new Date(2006,0,11),
+ * rangeEnd: new Date(2006,0,11)}, {rangeStart:new Date(2006,0,23),
+ * rangeEnd: new Date(2006,1,10)} ]}"</code></p>
+ *
+ * @default []
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public function get selectedRanges():Array
+ {
+ if (GOOG::DEBUG)
+ trace("get selectedRanges not implemented.");
+ return null;
+// _selectedRanges = dateGrid.selectedRanges;
+// return _selectedRanges;
+ }
+
+ /**
+ * @private
+ */
+ public function set selectedRanges(value:Array):void
+ {
+ if (GOOG::DEBUG)
+ trace("set selectedRanges not implemented.");
+// _selectedRanges = scrubTimeValues(value);
+// selectedRangesChanged = true;
+//
+// invalidateProperties();
+ }
+
+ //----------------------------------
+ // showToday
+ //----------------------------------
+
+ /**
+ * @private
+ * Storage for the showToday property.
+ */
+ private var _showToday:Boolean = true;
+
+ /**
+ * @private
+ */
+ private var showTodayChanged:Boolean = false;
+
+ [Bindable("showTodayChanged")]
+ [Inspectable(category="General", defaultValue="true")]
+
+ /**
+ * If <code>true</code>, specifies that today is highlighted
+ * in the DateChooser control.
+ * Setting this property changes the appearance of the DateChooser
control.
+ *
+ * @default true
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public function get showToday():Boolean
+ {
+ return _showToday;
+ }
+
+ /**
+ * @private
+ */
+ public function set showToday(value:Boolean):void
+ {
+ _showToday = value;
+ showTodayChanged = true;
+
+// invalidateProperties();
+ }
+
+
//--------------------------------------------------------------------------
+ //
+ // Overridden methods: UIComponent
+ //
+
//--------------------------------------------------------------------------
+
+
+
+
+
//--------------------------------------------------------------------------
+ //
+ // Methods
+ //
+
//--------------------------------------------------------------------------
+
+
+
+ /**
+ * @private
+ * This method scrubs out time values from incoming date objects
+ */
+ mx_internal function scrubTimeValue(value:Object):Object
+ {
+ if (value is Date)
+ {
+ return new Date(value.getFullYear(), value.getMonth(),
value.getDate());
+ }
+ else if (value is Object)
+ {
+ var range:Object = {};
+ if (value.hasOwnProperty("rangeStart") && value.rangeStart is Date)
+ {
+ range.rangeStart = new Date(value.rangeStart.getFullYear(),
+ value.rangeStart.getMonth(),
+ value.rangeStart.getDate());
+ }
+
+ if (value.hasOwnProperty("rangeEnd") && value.rangeEnd is Date)
+ {
+ range.rangeEnd = new Date(value.rangeEnd.getFullYear(),
+ value.rangeEnd.getMonth(),
+ value.rangeEnd.getDate());
+ }
+ return range;
+ }
+ return null;
+ }
+
+ /**
+ * @private
+ * This method scrubs out time values from incoming date objects
+ */
+ mx_internal function scrubTimeValues(values:Array):Array
+ {
+ var dates:Array = [];
+ for (var i:int = 0; i < values.length; i++)
+ {
+ dates[i] = scrubTimeValue(values[i]);
+ }
+ return dates;
+ }
+
+
//--------------------------------------------------------------------------
+ //
+ // Overridden event handlers: UIComponent
+ //
+
//--------------------------------------------------------------------------
+
+
+
+
//--------------------------------------------------------------------------
+ //
+ // Event handlers
+ //
+
//--------------------------------------------------------------------------
+
+
+}
+
+}
diff --git
a/frameworks/projects/MXRoyale/src/main/royale/mx/events/CalendarLayoutChangeEvent.as
b/frameworks/projects/MXRoyale/src/main/royale/mx/events/CalendarLayoutChangeEvent.as
new file mode 100644
index 0000000..a624fc4
--- /dev/null
+++
b/frameworks/projects/MXRoyale/src/main/royale/mx/events/CalendarLayoutChangeEvent.as
@@ -0,0 +1,169 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.events
+{
+
+import org.apache.royale.events.Event;
+import org.apache.royale.events.IRoyaleEvent;
+
+/**
+ * The CalendarLayoutChangeEvent class represents the event object passed to
+ * the event listener for the <code>change</code> event for
+ * the DateChooser and DateField controls.
+ *
+ * @see mx.controls.DateChooser
+ * @see mx.controls.DateField
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+public class CalendarLayoutChangeEvent extends Event
+{
+
//--------------------------------------------------------------------------
+ //
+ // Class constants
+ //
+
//--------------------------------------------------------------------------
+
+ /**
+ * The <code>CalendarLayoutChangeEvent.CHANGE</code> constant
+ * defines the value of the <code>type</code> property of the event
+ * object for a <code>change</code> event.
+ *
+ * <p>The properties of the event object have the following values:</p>
+ * <table class="innertable">
+ * <tr><th>Property</th><th>Value</th></tr>
+ * <tr><td><code>bubbles</code></td><td>false</td></tr>
+ * <tr><td><code>cancelable</code></td><td>false</td></tr>
+ * <tr><td><code>currentTarget</code></td><td>The Object that defines
the
+ * event listener that handles the event. For example, if you use
+ * <code>myButton.addEventListener()</code> to register an event
listener,
+ * myButton is the value of the <code>currentTarget</code>.
</td></tr>
+ * <tr><td><code>newDate</code></td><td>The date selected in the
control.</td></tr>
+ * <tr><td><code>target</code></td><td>The Object that dispatched the
event;
+ * it is not always the Object listening for the event.
+ * Use the <code>currentTarget</code> property to always access the
+ * Object listening for the event.</td></tr>
+ * <tr><td><code>triggerEvent</code></td><td>The event that triggered
this change event;
+ * usually a <code>change</code> event.</td></tr>
+ * </table>
+ *
+ * @eventType change
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public static const CHANGE:String = "change";
+
+
//--------------------------------------------------------------------------
+ //
+ // Constructor
+ //
+
//--------------------------------------------------------------------------
+
+ /**
+ * Constructor.
+ *
+ * @param type The event type; indicates the action that triggered the
event.
+ *
+ * @param bubbles Specifies whether the event can bubble
+ * up the display list hierarchy.
+ *
+ * @param cancelable Specifies whether the behavior
+ * associated with the event can be prevented.
+ *
+ * @param newDate The date selected in the control.
+ *
+ * @param triggerEvent The event that triggered this change event;
+ * usually a <code>change</code> event.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public function CalendarLayoutChangeEvent(type:String,
+
bubbles:Boolean = false,
+
cancelable:Boolean = false,
+ newDate:Date = null,
+ triggerEvent:Event = null)
+ {
+ super(type, bubbles, cancelable);
+
+ this.newDate = newDate;
+ this.triggerEvent = triggerEvent;
+ }
+
+
//--------------------------------------------------------------------------
+ //
+ // Properties
+ //
+
//--------------------------------------------------------------------------
+
+ //----------------------------------
+ // newDate
+ //----------------------------------
+
+ /**
+ * The selected date of the control.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public var newDate:Date;
+
+ //----------------------------------
+ // triggerEvent
+ //----------------------------------
+
+ /**
+ * The event that triggered the change of the date;
+ * usually a <code>change</code> event.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public var triggerEvent:Event;
+
+
//--------------------------------------------------------------------------
+ //
+ // Overridden methods: Event
+ //
+
//--------------------------------------------------------------------------
+
+ /**
+ * @private
+ */
+ override public function cloneEvent():IRoyaleEvent
+ {
+ return new CalendarLayoutChangeEvent(type, bubbles, cancelable,
+
newDate, triggerEvent);
+ }
+}
+
+}
--
To stop receiving notification emails like this one, please contact
[email protected].