You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by pe...@apache.org on 2014/03/21 21:18:04 UTC
[1/2] Moved DateChooser from FlexJSUI project to FlexJSJX project
since it can be cross-compiled into JavaScript. Created DateField component
in FlexJSJX project as it can be cross-compiled into JavaScript. Updated
DateChooser example to include DateFiel
Repository: flex-asjs
Updated Branches:
refs/heads/develop 8a08cdd23 -> 2380008e2
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/beads/controllers/DateFieldMouseController.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/beads/controllers/DateFieldMouseController.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/beads/controllers/DateFieldMouseController.as
new file mode 100644
index 0000000..e603b04
--- /dev/null
+++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/beads/controllers/DateFieldMouseController.as
@@ -0,0 +1,97 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 org.apache.flex.html.staticControls.beads.controllers
+{
+ import org.apache.flex.core.IBeadController;
+ import org.apache.flex.core.IDateChooserModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.staticControls.beads.DateFieldView;
+
+ /**
+ * The DateFieldMouseController class is responsible for monitoring
+ * the mouse events on the elements of the DateField. A click on the
+ * DateField's menu button triggers the pop-up, for example.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DateFieldMouseController implements IBeadController
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DateFieldMouseController()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ var viewBead:DateFieldView = _strand.getBeadByType(DateFieldView) as DateFieldView;
+ IEventDispatcher(viewBead.menuButton).addEventListener("click", clickHandler);
+ }
+
+ /**
+ * @private
+ */
+ private function clickHandler(event:Event):void
+ {
+ var viewBead:DateFieldView = _strand.getBeadByType(DateFieldView) as DateFieldView;
+ viewBead.popUpVisible = true;
+ UIBase(viewBead.popUp).x = UIBase(_strand).x + UIBase(_strand).width - 20;
+ UIBase(viewBead.popUp).y = UIBase(_strand).y + UIBase(_strand).height;
+ IEventDispatcher(viewBead.popUp).addEventListener("change", changeHandler);
+ }
+
+ /**
+ * @private
+ */
+ private function changeHandler(event:Event):void
+ {
+ var viewBead:DateFieldView = _strand.getBeadByType(DateFieldView) as DateFieldView;
+
+ var model:IDateChooserModel = _strand.getBeadByType(IDateChooserModel) as IDateChooserModel;
+ model.selectedDate = IDateChooserModel(viewBead.popUp.getBeadByType(IDateChooserModel)).selectedDate;
+
+ viewBead.popUpVisible = false;
+ IEventDispatcher(_strand).dispatchEvent(new Event("change"));
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/beads/models/DateChooserModel.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/beads/models/DateChooserModel.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/beads/models/DateChooserModel.as
new file mode 100644
index 0000000..245e3cb
--- /dev/null
+++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/beads/models/DateChooserModel.as
@@ -0,0 +1,189 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 org.apache.flex.html.staticControls.beads.models
+{
+ import org.apache.flex.core.IDateChooserModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.EventDispatcher;
+
+ /**
+ * The DateChooserModel is a bead class that manages the data for a DataChooser.
+ * This includes arrays of names for the months and days of the week as well the
+ * currently selected date.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DateChooserModel extends EventDispatcher implements IDateChooserModel
+ {
+ public function DateChooserModel()
+ {
+ // default displayed year and month to "today"
+ var today:Date = new Date();
+ displayedYear = today.getFullYear();
+ displayedMonth = today.getMonth();
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+
+ private var _dayNames:Array = ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];
+ private var _monthNames:Array = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
+ private var _displayedYear:Number;
+ private var _displayedMonth:Number;
+ private var _firstDayOfWeek:Number = 0;
+ private var _selectedDate:Date;
+
+ /**
+ * An array of strings used to name the days of the week with Sunday being the
+ * first element of the array.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get dayNames():Array
+ {
+ return _dayNames;
+ }
+ public function set dayNames(value:Array):void
+ {
+ _dayNames = value;
+ dispatchEvent( new Event("dayNamesChanged") );
+ }
+
+ /**
+ * An array of strings used to name the months of the year with January being
+ * the first element of the array.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get monthNames():Array
+ {
+ return _monthNames;
+ }
+ public function set monthNames(value:Array):void
+ {
+ _monthNames = value;
+ dispatchEvent( new Event("monthNames") );
+ }
+
+ /**
+ * The year currently displayed by the DateChooser.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get displayedYear():Number
+ {
+ return _displayedYear;
+ }
+ public function set displayedYear(value:Number):void
+ {
+ if (value != _displayedYear) {
+ _displayedYear = value;
+ dispatchEvent( new Event("displayedYearChanged") );
+ }
+ }
+
+ /**
+ * The month currently displayed by the DateChooser.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get displayedMonth():Number
+ {
+ return _displayedMonth;
+ }
+ public function set displayedMonth(value:Number):void
+ {
+ if (_displayedMonth != value) {
+ _displayedMonth = value;
+ dispatchEvent( new Event("displayedMonthChanged") );
+ }
+ }
+
+ /**
+ * The index of the first day of the week, Sunday = 0.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get firstDayOfWeek():Number
+ {
+ return _firstDayOfWeek;
+ }
+ public function set firstDayOfWeek(value:Number):void
+ {
+ if (value != _firstDayOfWeek) {
+ _firstDayOfWeek = value;
+ dispatchEvent( new Event("firstDayOfWeekChanged") );
+ }
+ }
+
+ /**
+ * The currently selected date or null if no date has been selected.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selectedDate():Date
+ {
+ return _selectedDate;
+ }
+ public function set selectedDate(value:Date):void
+ {
+ if (value != _selectedDate) {
+ _selectedDate = value;
+ dispatchEvent( new Event("selectedDateChanged") );
+
+ displayedMonth = value.getMonth();
+ displayedYear = value.getFullYear();
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/supportClasses/DateChooserButton.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/supportClasses/DateChooserButton.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/supportClasses/DateChooserButton.as
new file mode 100644
index 0000000..70c7606
--- /dev/null
+++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/supportClasses/DateChooserButton.as
@@ -0,0 +1,67 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 org.apache.flex.html.staticControls.supportClasses
+{
+ import org.apache.flex.html.staticControls.TextButton;
+
+ /**
+ * The DateChooserButton class is used for each button in the DateChooser. The
+ * button holds the day of the month the button is representing.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DateChooserButton extends TextButton
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DateChooserButton()
+ {
+ super();
+ className = "DateChooserButton";
+ }
+
+ private var _dayOfMonth:int;
+
+ /**
+ * The day of the month the button represents.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get dayOfMonth():int
+ {
+ return _dayOfMonth;
+ }
+ public function set dayOfMonth(value:int):void
+ {
+ _dayOfMonth = value;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/frameworks/as/projects/FlexJSUI/basic-manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/basic-manifest.xml b/frameworks/as/projects/FlexJSUI/basic-manifest.xml
index 3e433a9..01b7a46 100644
--- a/frameworks/as/projects/FlexJSUI/basic-manifest.xml
+++ b/frameworks/as/projects/FlexJSUI/basic-manifest.xml
@@ -29,12 +29,8 @@
<component id="SimpleBinding" class="org.apache.flex.binding.SimpleBinding"/>
<component id="Button" class="org.apache.flex.html.staticControls.Button"/>
<component id="ButtonBar" class="org.apache.flex.html.staticControls.ButtonBar"/>
- <component id="DateChooser" class="org.apache.flex.html.staticControls.DateChooser"/>
- <component id="DateField" class="org.apache.flex.html.staticControls.DateField"/>
<component id="DropDownList" class="org.apache.flex.html.staticControls.DropDownList"/>
<component id="DropDownListList" class="org.apache.flex.html.staticControls.supportClasses.DropDownListList"/>
- <component id="FormatableLabelView" class="org.apache.flex.html.staticControls.beads.FormatableLabelView"/>
- <component id="FormatableTextInputView" class="org.apache.flex.html.staticControls.beads.FormatableTextInputView"/>
<component id="Image" class="org.apache.flex.html.staticControls.Image"/>
<component id="Label" class="org.apache.flex.html.staticControls.Label"/>
<component id="TextButton" class="org.apache.flex.html.staticControls.TextButton"/>
@@ -63,6 +59,7 @@
<component id="Alert" class="org.apache.flex.html.staticControls.Alert"/>
<component id="Spinner" class="org.apache.flex.html.staticControls.Spinner"/>
<component id="Slider" class="org.apache.flex.html.staticControls.Slider"/>
+ <component id="SolidBackgroundBead" class="org.apache.flex.html.staticControls.beads.SolidBackgroundBead"/>
<component id="ViewBaseDataBinding" class="org.apache.flex.core.ViewBaseDataBinding"/>
<component id="NumericStepper" class="org.apache.flex.html.staticControls.NumericStepper" />
<component id="TextFieldItemRenderer" class="org.apache.flex.html.staticControls.supportClasses.TextFieldItemRenderer"/>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/frameworks/as/projects/FlexJSUI/defaults.css
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/defaults.css b/frameworks/as/projects/FlexJSUI/defaults.css
index 9fd5117..7a4d2f8 100644
--- a/frameworks/as/projects/FlexJSUI/defaults.css
+++ b/frameworks/as/projects/FlexJSUI/defaults.css
@@ -161,22 +161,6 @@ ControlBar
border-thickness: 1;
}
-DateChooser {
- IBeadView: ClassReference("org.apache.flex.html.staticControls.beads.DateChooserView");
- IBeadModel: ClassReference("org.apache.flex.html.staticControls.beads.models.DateChooserModel");
- IBeadController: ClassReference("org.apache.flex.html.staticControls.beads.controllers.DateChooserMouseController");
- width: 280px;
- height: 240px;
-}
-
-DateField {
- IBeadView: ClassReference("org.apache.flex.html.staticControls.beads.DateFieldView");
- IBeadModel: ClassReference("org.apache.flex.html.staticControls.beads.models.DateChooserModel");
- IBeadController: ClassReference("org.apache.flex.html.staticControls.beads.controllers.DateFieldMouseController");
- IPopUp: ClassReference("org.apache.flex.html.staticControls.DateChooser");
- IFormatBead: ClassReference("org.apache.flex.html.staticControls.accessories.DateFormatMMDDYYYYBead");
-}
-
DropDownList
{
IBeadModel: ClassReference("org.apache.flex.html.staticControls.beads.models.ArraySelectionModel");
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as b/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
index 96767b0..46102d7 100644
--- a/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
+++ b/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
@@ -28,7 +28,6 @@ package
internal class FlexJSUIClasses
{
- import org.apache.flex.html.staticControls.accessories.DateFormatMMDDYYYYBead; DateFormatMMDDYYYYBead;
import org.apache.flex.html.staticControls.accessories.NumericOnlyTextInputBead; NumericOnlyTextInputBead;
import org.apache.flex.html.staticControls.accessories.PasswordInputBead; PasswordInputBead;
import org.apache.flex.html.staticControls.accessories.TextPromptBead; TextPromptBead;
@@ -40,11 +39,7 @@ internal class FlexJSUIClasses
import org.apache.flex.html.staticControls.beads.ControlBarMeasurementBead; ControlBarMeasurementBead;
import org.apache.flex.html.staticControls.beads.CSSButtonView; CSSButtonView;
import org.apache.flex.html.staticControls.beads.CSSTextButtonView; CSSTextButtonView;
- import org.apache.flex.html.staticControls.beads.DateChooserView; DateChooserView;
- import org.apache.flex.html.staticControls.beads.DateFieldView; DateFieldView;
import org.apache.flex.html.staticControls.beads.DropDownListView; DropDownListView;
- import org.apache.flex.html.staticControls.beads.FormatableLabelView; FormatableLabelView;
- import org.apache.flex.html.staticControls.beads.FormatableTextInputView; FormatableTextInputView;
import org.apache.flex.html.staticControls.beads.ImageView; ImageView;
import org.apache.flex.html.staticControls.beads.ListView; ListView;
import org.apache.flex.html.staticControls.beads.NumericStepperView; NumericStepperView;
@@ -69,7 +64,6 @@ internal class FlexJSUIClasses
import org.apache.flex.html.staticControls.beads.models.AlertModel; AlertModel;
import org.apache.flex.html.staticControls.beads.models.ArraySelectionModel; ArraySelectionModel;
import org.apache.flex.html.staticControls.beads.models.ComboBoxModel; ComboBoxModel;
- import org.apache.flex.html.staticControls.beads.models.DateChooserModel; DateChooserModel;
import org.apache.flex.html.staticControls.beads.models.ImageModel; ImageModel;
import org.apache.flex.html.staticControls.beads.models.PanelModel; PanelModel;
import org.apache.flex.html.staticControls.beads.models.SingleLineBorderModel; SingleLineBorderModel;
@@ -79,8 +73,6 @@ internal class FlexJSUIClasses
import org.apache.flex.html.staticControls.beads.models.ValueToggleButtonModel; ValueToggleButtonModel;
import org.apache.flex.html.staticControls.beads.controllers.AlertController; AlertController;
import org.apache.flex.html.staticControls.beads.controllers.ComboBoxController; ComboBoxController;
- import org.apache.flex.html.staticControls.beads.controllers.DateChooserMouseController; DateChooserMouseController;
- import org.apache.flex.html.staticControls.beads.controllers.DateFieldMouseController; DateFieldMouseController;
import org.apache.flex.html.staticControls.beads.controllers.DropDownListController; DropDownListController;
import org.apache.flex.html.staticControls.beads.controllers.EditableTextKeyboardController; EditableTextKeyboardController;
import org.apache.flex.html.staticControls.beads.controllers.ItemRendererMouseController; ItemRendererMouseController;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IDateChooserModel.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IDateChooserModel.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IDateChooserModel.as
deleted file mode 100644
index 7944591..0000000
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IDateChooserModel.as
+++ /dev/null
@@ -1,101 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// 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 org.apache.flex.core
-{
- import org.apache.flex.events.IEventDispatcher;
-
- /**
- * The IDateChooserModel interface.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public interface IDateChooserModel extends IEventDispatcher, IBeadModel
- {
- /**
- * An array of strings used to name the days of the week with Sunday being the
- * first element of the array.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- function get dayNames():Array;
- function set dayNames(value:Array):void;
-
- /**
- * An array of strings used to name the months of the year with January being
- * the first element of the array.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- function get monthNames():Array;
- function set monthNames(value:Array):void;
-
- /**
- * The year currently displayed by the DateChooser.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- function get displayedYear():Number;
- function set displayedYear(value:Number):void;
-
- /**
- * The month currently displayed by the DateChooser.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- function get displayedMonth():Number;
- function set displayedMonth(value:Number):void;
-
- /**
- * The index of the first day of the week, Sunday = 0.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- function get firstDayOfWeek():Number;
- function set firstDayOfWeek(value:Number):void;
-
- /**
- * The currently selected date or null if no date has been selected.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- function get selectedDate():Date;
- function set selectedDate(value:Date):void;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IFormatBead.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IFormatBead.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IFormatBead.as
deleted file mode 100644
index 3880f5a..0000000
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IFormatBead.as
+++ /dev/null
@@ -1,69 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// 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 org.apache.flex.core
-{
- import org.apache.flex.events.IEventDispatcher;
-
- /**
- * The IFormatBead interface should be implemented by any bead that
- * provides a formatting service. When the bead instance is created it
- * should listen for change events and set its formattedString property
- * for later retrieveal.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public interface IFormatBead extends IBead, IEventDispatcher
- {
- /**
- * The name of the property for the source to be formatted.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- function get propertyName():String;
- function set propertyName(value:String):void;
-
- /**
- * The name of the event to listen for, indicating that propertyName
- * property has changed. The default event is propertyName+"Changed".
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- function get eventName():String;
- function set eventName(value:String):void;
-
- /**
- * The formatted result.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- function get formattedString():String;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/DateChooser.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/DateChooser.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/DateChooser.as
deleted file mode 100644
index 55d355a..0000000
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/DateChooser.as
+++ /dev/null
@@ -1,74 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// 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 org.apache.flex.html.staticControls
-{
- import org.apache.flex.core.IDateChooserModel;
- import org.apache.flex.core.UIBase;
-
- /**
- * The change event is dispatched when the selectedDate is changed.
- */
- [Event(name="change", type="org.apache.flex.events.Event")]
-
- /**
- * The DateChooser class is a component that displays a calendar.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class DateChooser extends UIBase
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function DateChooser()
- {
- super();
- className = "DateChooser";
-
- // fix the DateChooser's size
-// width = 350;
-// height = 225;
- }
-
- /**
- * The currently selected date (or null if no date has been selected).
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get selectedDate():Date
- {
- return IDateChooserModel(model).selectedDate;
- }
- public function set selectedDate(value:Date):void
- {
- IDateChooserModel(model).selectedDate = value;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/DateField.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/DateField.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/DateField.as
deleted file mode 100644
index 622e4fb..0000000
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/DateField.as
+++ /dev/null
@@ -1,89 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// 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 org.apache.flex.html.staticControls
-{
- import org.apache.flex.core.IBead;
- import org.apache.flex.core.IDateChooserModel;
- import org.apache.flex.core.UIBase;
- import org.apache.flex.core.ValuesManager;
-
- /**
- * The DateField class provides an input field where a date can be entered
- * and a pop-up calendar control for picking a date as an alternative to
- * the text field.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class DateField extends UIBase
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function DateField()
- {
- super();
-
- className = "DateField";
- }
-
- /**
- * The method called when added to a parent. The DateField class uses
- * this opportunity to install additional beads.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- override public function addedToParent():void
- {
- super.addedToParent();
-
- var bead:IBead = new (ValuesManager.valuesImpl.getValue(this,"iFormatBead"))() as IBead;
- if (bead) {
- addBead(bead);
- }
- }
-
- /**
- * The currently selected date (or null if no date has been selected).
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get selectedDate():Date
- {
- return IDateChooserModel(model).selectedDate;
- }
- public function set selectedDate(value:Date):void
- {
- IDateChooserModel(model).selectedDate = value;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/accessories/DateFormatMMDDYYYYBead.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/accessories/DateFormatMMDDYYYYBead.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/accessories/DateFormatMMDDYYYYBead.as
deleted file mode 100644
index 3b52c40..0000000
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/accessories/DateFormatMMDDYYYYBead.as
+++ /dev/null
@@ -1,151 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// 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 org.apache.flex.html.staticControls.accessories
-{
- import org.apache.flex.core.IBead;
- import org.apache.flex.core.IDateChooserModel;
- import org.apache.flex.core.IFormatBead;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.events.Event;
- import org.apache.flex.events.EventDispatcher;
- import org.apache.flex.html.staticControls.TextInput;
- import org.apache.flex.html.staticControls.beads.DateFieldView;
-
- /**
- * The DateFormatBead class formats the display of a DateField using MM/DD/YYYY format.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class DateFormatMMDDYYYYBead extends EventDispatcher implements IBead, IFormatBead
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function DateFormatMMDDYYYYBead()
- {
- }
-
- private var _propertyName:String;
- private var _eventName:String;
- private var _formattedResult:String;
-
- /**
- * The name of the property on the model holding the value to be formatted.
- * The default is selectedDate.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get propertyName():String
- {
- if (_propertyName == null) {
- return "selectedDate";
- }
- return _propertyName;
- }
- public function set propertyName(value:String):void
- {
- _propertyName = value;
- }
-
- /**
- * The name of the event dispatched when the property changes. The
- * default is selectedDateChanged.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get eventName():String
- {
- if (_eventName == null) {
- return _propertyName+"Changed";
- }
- return _eventName;
- }
- public function set eventName(value:String):void
- {
- _eventName = value;
- }
-
- /**
- * The formatted result.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get formattedString():String
- {
- return _formattedResult;
- }
-
- private var _strand:IStrand;
-
- /**
- * @copy org.apache.flex.core.IBead#strand
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function set strand(value:IStrand):void
- {
- _strand = value;
-
- var model:IDateChooserModel = _strand.getBeadByType(IDateChooserModel) as IDateChooserModel;
- model.addEventListener("selectedDateChanged",handleTextChange);
- }
-
- /**
- * @private
- */
- private function handleTextChange(event:Event):void
- {
- var model:IDateChooserModel = _strand.getBeadByType(IDateChooserModel) as IDateChooserModel;
- /*var view:DateFieldView = _strand.getBeadByType(DateFieldView) as DateFieldView;
- var input:TextInput = view.textInput;*/
-
- var d:Date = model.selectedDate;
- var month:String = String(d.getMonth()+1);
- if (Number(month)<10) month = "0"+month;
- var date:String = String(d.getDate());
- if (Number(date)<10) date = "0"+date;
- var fmt:String = month+"/"+date+"/"+String(d.getFullYear());
- /*input.text = fmt;*/
- _formattedResult = month+"/"+date+"/"+String(d.getFullYear());
-
- dispatchEvent( new Event("formatChanged") );
- }
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/DateChooserView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/DateChooserView.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/DateChooserView.as
deleted file mode 100644
index f8b32e8..0000000
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/DateChooserView.as
+++ /dev/null
@@ -1,253 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// 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 org.apache.flex.html.staticControls.beads
-{
- import org.apache.flex.html.staticControls.beads.models.DateChooserModel;
- import org.apache.flex.html.staticControls.supportClasses.DateChooserButton;
-
- import org.apache.flex.core.IBeadModel;
- import org.apache.flex.core.IBeadView;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.core.UIBase;
- import org.apache.flex.core.ValuesManager;
- import org.apache.flex.events.Event;
- import org.apache.flex.events.IEventDispatcher;
- import org.apache.flex.html.staticControls.Container;
- import org.apache.flex.html.staticControls.TextButton;
- import org.apache.flex.html.staticControls.beads.layouts.TileLayout;
-
- /**
- * The DateChooserView class is a view bead for the DateChooser. This class
- * creates the elements for the DateChooser: the buttons to move between
- * months, the labels for the days of the week, and the buttons for each day
- * of the month.
- */
- public class DateChooserView implements IBeadView
- {
- /**
- * constructor
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function DateChooserView()
- {
- }
-
- private var _strand:IStrand;
-
- /**
- * @copy org.apache.flex.core.IBead#strand
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function set strand(value:IStrand):void
- {
- _strand = value;
-
- // make sure there is a model.
- model = _strand.getBeadByType(IBeadModel) as DateChooserModel;
- if (model == null) {
- model = new (ValuesManager.valuesImpl.getValue(_strand,"iBeadModel")) as DateChooserModel;
- }
- model.addEventListener("displayedMonthChanged",handleModelChange);
- model.addEventListener("displayedYearChanged",handleModelChange);
-
- createChildren();
- }
-
- private var _prevMonthButton:TextButton;
- private var _nextMonthButton:TextButton;
- private var _dayButtons:Array;
- private var monthLabel:TextButton;
- private var dayContainer:Container;
-
- private var model:DateChooserModel;
-
- /**
- * The button that causes the previous month to be displayed by the DateChooser.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get prevMonthButton():TextButton
- {
- return _prevMonthButton;
- }
-
- /**
- * The button that causes the next month to be displayed by the DateChooser.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get nextMonthButton():TextButton
- {
- return _nextMonthButton;
- }
-
- /**
- * The array of DateChooserButton instances that represent each day of the month.
- */
- public function get dayButtons():Array
- {
- return _dayButtons;
- }
-
- /**
- * @private
- */
- private function createChildren():void
- {
- _prevMonthButton = new TextButton();
- _prevMonthButton.width = 40;
- _prevMonthButton.height = 20;
- _prevMonthButton.x = 0;
- _prevMonthButton.y = 0;
- _prevMonthButton.text = "<";
- UIBase(_strand).addElement(_prevMonthButton);
-
- _nextMonthButton = new TextButton();
- _nextMonthButton.width = 40;
- _nextMonthButton.height = 20;
- _nextMonthButton.x = UIBase(_strand).width - _nextMonthButton.width;
- _nextMonthButton.y = 0;
- _nextMonthButton.text = ">";
- UIBase(_strand).addElement(_nextMonthButton);
-
- monthLabel = new TextButton();
- monthLabel.text = "Month Here";
- monthLabel.width = 100;
- monthLabel.height = 20;
- monthLabel.x = (UIBase(_strand).width - monthLabel.width)/2;
- monthLabel.y = 0;
- UIBase(_strand).addElement(monthLabel);
-
- dayContainer = new Container();
- var tileLayout:TileLayout = new TileLayout();
- dayContainer.addBead(tileLayout);
- tileLayout.numColumns = 7;
- dayContainer.x = 0;
- dayContainer.y = monthLabel.y + monthLabel.height + 5;
- dayContainer.width = UIBase(_strand).width;
- dayContainer.height = UIBase(_strand).height - (monthLabel.height+5);
-
- // the calendar has 7 columns with 6 rows, the first row are the day names
- for(var i:int=0; i < 7; i++) {
- var dayName:DateChooserButton = new DateChooserButton();
- dayName.text = model.dayNames[i];
- dayName.dayOfMonth = 0;
- dayContainer.addElement(dayName);
- }
-
- _dayButtons = new Array();
-
- for(i=0; i < 42; i++) {
- var date:DateChooserButton = new DateChooserButton();
- date.text = String(i+1);
- dayContainer.addElement(date);
- dayButtons.push(date);
- }
-
- UIBase(_strand).addElement(dayContainer);
-
- IEventDispatcher(dayContainer).dispatchEvent( new Event("itemsCreated") );
- IEventDispatcher(_strand).dispatchEvent( new Event("layoutNeeded") );
- IEventDispatcher(dayContainer).dispatchEvent( new Event("layoutNeeded") );
-
- updateCalendar();
- }
-
- /**
- * @private
- */
- private function updateCalendar():void
- {
- monthLabel.text = model.monthNames[model.displayedMonth] + " " +
- String(model.displayedYear);
-
- var firstDay:Date = new Date(model.displayedYear,model.displayedMonth,1);
-
- // blank out the labels for the first firstDay.day-1 entries.
- for(var i:int=0; i < firstDay.getDay(); i++) {
- var dateButton:DateChooserButton = dayButtons[i] as DateChooserButton;
- dateButton.dayOfMonth = -1;
- dateButton.text = "";
- }
-
- // renumber to the last day of the month
- var dayNumber:int = 1;
- var numDays:Number = numberOfDaysInMonth(model.displayedMonth, model.displayedYear);
-
- for(; i < dayButtons.length && dayNumber <= numDays; i++) {
- dateButton = dayButtons[i] as DateChooserButton;
- dateButton.dayOfMonth = dayNumber;
- dateButton.text = String(dayNumber++);
- }
-
- // blank out the rest
- for(; i < dayButtons.length; i++) {
- dateButton = dayButtons[i] as DateChooserButton;
- dateButton.dayOfMonth = -1;
- dateButton.text = "";
- }
- }
-
- /**
- * @private
- */
- private function numberOfDaysInMonth(month:Number, year:Number):Number
- {
- var n:int;
-
- if (month == 1) // Feb
- {
- if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) // leap year
- n = 29;
- else
- n = 28;
- }
-
- else if (month == 3 || month == 5 || month == 8 || month == 10)
- n = 30;
-
- else
- n = 31;
-
- return n;
- }
-
- /**
- * @private
- */
- private function handleModelChange(event:Event):void
- {
- updateCalendar();
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/DateFieldView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/DateFieldView.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/DateFieldView.as
deleted file mode 100644
index 441f204..0000000
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/DateFieldView.as
+++ /dev/null
@@ -1,192 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// 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 org.apache.flex.html.staticControls.beads
-{
- import flash.display.DisplayObject;
- import flash.display.DisplayObjectContainer;
-
- import org.apache.flex.core.IBeadView;
- import org.apache.flex.core.IDateChooserModel;
- import org.apache.flex.core.IFormatBead;
- import org.apache.flex.core.IParent;
- import org.apache.flex.core.IPopUpHost;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.core.UIBase;
- import org.apache.flex.core.ValuesManager;
- import org.apache.flex.events.Event;
- import org.apache.flex.events.IEventDispatcher;
- import org.apache.flex.html.staticControls.DateChooser;
- import org.apache.flex.html.staticControls.TextButton;
- import org.apache.flex.html.staticControls.TextInput;
-
- /**
- * The DateFieldView class is a bead for DateField that creates the
- * input and button controls. This class also handles the pop-up
- * mechanics.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class DateFieldView implements IBeadView
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function DateFieldView()
- {
- }
-
- private var _strand:IStrand;
-
- private var _textInput:TextInput;
- private var _button:TextButton;
-
- /**
- * The TextButton that triggers the display of the DateChooser pop-up.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get menuButton():TextButton
- {
- return _button;
- }
-
- /**
- * The TextInput that displays the date selected.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get textInput():TextInput
- {
- return _textInput;
- }
-
- /**
- * @copy org.apache.flex.core.IBead#strand
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function set strand(value:IStrand):void
- {
- _strand = value;
-
- _textInput = new TextInput();
- IParent(_strand).addElement(_textInput);
- _textInput.width = 100;
- _textInput.height = 18;
-
- _button = new TextButton();
- _button.text = "M";
- IParent(_strand).addElement(_button);
- _button.x = _textInput.width;
- _button.y = _textInput.y;
-
- IEventDispatcher(_strand).addEventListener("beadsAdded",handleBeadsAdded);
- }
-
- private function handleBeadsAdded(event:Event):void
- {
- var formatter:IFormatBead = _strand.getBeadByType(IFormatBead) as IFormatBead;
- formatter.addEventListener("formatChanged",handleFormatChanged);
- }
-
- private function handleFormatChanged(event:Event):void
- {
- var formatter:IFormatBead = event.target as IFormatBead;
- _textInput.text = formatter.formattedString;
- }
-
- private var _popUp:IStrand;
-
- /**
- * The pop-up component that holds the selection list.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get popUp():IStrand
- {
- return _popUp;
- }
-
- private var _popUpVisible:Boolean;
-
- /**
- * This property is true if the pop-up selection list is currently visible.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get popUpVisible():Boolean
- {
- return _popUpVisible;
- }
- public function set popUpVisible(value:Boolean):void
- {
- if (value != _popUpVisible)
- {
- _popUpVisible = value;
- if (value)
- {
- if (!_popUp)
- {
- var popUpClass:Class = ValuesManager.valuesImpl.getValue(_strand, "iPopUp") as Class;
- _popUp = new popUpClass() as IStrand;
- UIBase(_popUp).width = 210;
- UIBase(_popUp).height = 220;
- }
-
- var model:IDateChooserModel = _strand.getBeadByType(IDateChooserModel) as IDateChooserModel;
- DateChooser(_popUp).selectedDate = model.selectedDate;
-
- var root:Object = DisplayObject(_strand).root;
- var host:DisplayObjectContainer = DisplayObject(_strand).parent;
- while (host && !(host is IPopUpHost))
- host = host.parent;
- if (host)
- IPopUpHost(host).addElement(popUp);
- }
- else
- {
- DisplayObject(_popUp).parent.removeChild(_popUp as DisplayObject);
- }
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/FormatableLabelView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/FormatableLabelView.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/FormatableLabelView.as
deleted file mode 100644
index 1fc8e1a..0000000
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/FormatableLabelView.as
+++ /dev/null
@@ -1,90 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// 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 org.apache.flex.html.staticControls.beads
-{
- import org.apache.flex.core.IFormatBead;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.events.Event;
- import org.apache.flex.events.IEventDispatcher;
-
- /**
- * The FormatableLabelView class is a View bead that is capable of working
- * with a format bead to display a formatted value. When the format bead has
- * created a formatted string, it dispatches a formatChanged event that the
- * FormatableLabelView class intercepts and displays in the label.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class FormatableLabelView extends TextFieldView
- {
- /**
- * constructor
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function FormatableLabelView()
- {
- super();
- }
-
- private var _formatter:IFormatBead;
-
- /**
- * @copy org.apache.flex.core.IBead#strand
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- override public function set strand(value:IStrand):void
- {
- super.strand = value;
- IEventDispatcher(value).addEventListener("beadsAdded",handleBeadsAdded);
- }
-
- /**
- * @private
- */
- private function handleBeadsAdded(event:Event):void
- {
- _formatter = strand.getBeadByType(IFormatBead) as IFormatBead;
- _formatter.addEventListener("formatChanged",formatReadyHandler);
-
- // process any text set in the label at this moment
- text = _formatter.formattedString;
- }
-
- /**
- * @private
- */
- private function formatReadyHandler(event:Event):void
- {
- if (_formatter) {
- text = _formatter.formattedString;
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/FormatableTextInputView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/FormatableTextInputView.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/FormatableTextInputView.as
deleted file mode 100644
index 66fcab4..0000000
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/FormatableTextInputView.as
+++ /dev/null
@@ -1,89 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// 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 org.apache.flex.html.staticControls.beads
-{
- import org.apache.flex.core.IFormatBead;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.events.Event;
- import org.apache.flex.events.IEventDispatcher;
-
- /**
- * The FormatableTextInputView class is a View bead that extends TextInputWithBorderView
- * and is capable of working with a format bead. When a format bead dispatches a
- * formatChanged event, the FormatableTextInputView bead copies the formatted string to
- * to the text field.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class FormatableTextInputView extends TextInputWithBorderView
- {
- /**
- * constructor
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function FormatableTextInputView()
- {
- super();
- }
-
- private var _formatter:IFormatBead;
-
- /**
- * @copy org.apache.flex.core.IBead#strand
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- override public function set strand(value:IStrand):void
- {
- super.strand = value;
- IEventDispatcher(value).addEventListener("beadsAdded",handleBeadsAdded);
- }
-
- /**
- * @private
- */
- private function handleBeadsAdded(event:Event):void
- {
- _formatter = strand.getBeadByType(IFormatBead) as IFormatBead;
- _formatter.addEventListener("formatChanged",formatChangedHandler);
- }
-
- /**
- * @private
- */
- private function formatChangedHandler(event:Event):void
- {
- this.textField.text = _formatter.formattedString;
-
- // move the cursor to the end
- var l:int = this.textField.text.length;
- this.textField.setSelection(l,l);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/controllers/DateChooserMouseController.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/controllers/DateChooserMouseController.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/controllers/DateChooserMouseController.as
deleted file mode 100644
index 69343eb..0000000
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/controllers/DateChooserMouseController.as
+++ /dev/null
@@ -1,126 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// 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 org.apache.flex.html.staticControls.beads.controllers
-{
- import org.apache.flex.html.staticControls.beads.DateChooserView;
- import org.apache.flex.html.staticControls.beads.models.DateChooserModel;
- import org.apache.flex.html.staticControls.supportClasses.DateChooserButton;
-
- import org.apache.flex.core.IBeadController;
- import org.apache.flex.core.IBeadModel;
- import org.apache.flex.core.IBeadView;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.events.Event;
- import org.apache.flex.events.IEventDispatcher;
-
- /**
- * The DateChooserMouseController class is responsible for listening to
- * mouse event related to the DateChooser. Events such as selecting a date
- * or changing the calendar.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class DateChooserMouseController implements IBeadController
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function DateChooserMouseController()
- {
- }
-
- private var _strand:IStrand;
-
- /**
- * @copy org.apache.flex.core.IBead#strand
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function set strand(value:IStrand):void
- {
- _strand = value;
-
- var view:DateChooserView = value.getBeadByType(IBeadView) as DateChooserView;
- view.prevMonthButton.addEventListener("click", prevMonthClickHandler);
- view.nextMonthButton.addEventListener("click", nextMonthClickHandler);
-
- var dayButtons:Array = view.dayButtons;
- for(var i:int=0; i < dayButtons.length; i++) {
- IEventDispatcher(dayButtons[i]).addEventListener("click", dayButtonClickHandler);
- }
- }
-
- /**
- * @private
- */
- private function prevMonthClickHandler(event:Event):void
- {
- var model:DateChooserModel = _strand.getBeadByType(IBeadModel) as DateChooserModel;
- var month:Number = model.displayedMonth - 1;
- var year:Number = model.displayedYear;
- if (month < 0) {
- month = 11;
- year--;
- }
- model.displayedMonth = month;
- model.displayedYear = year;
- }
-
- /**
- * @private
- */
- private function nextMonthClickHandler(event:Event):void
- {
- var model:DateChooserModel = _strand.getBeadByType(IBeadModel) as DateChooserModel;
- var month:Number = model.displayedMonth + 1;
- var year:Number = model.displayedYear;
- if (month >= 12) {
- month = 0;
- year++;
- }
- model.displayedMonth = month;
- model.displayedYear = year;
- }
-
- /**
- * @private
- */
- private function dayButtonClickHandler(event:Event):void
- {
- var dateButton:DateChooserButton = event.target as DateChooserButton;
- if (dateButton.dayOfMonth > 0) {
- var model:DateChooserModel = _strand.getBeadByType(IBeadModel) as DateChooserModel;
- var newDate:Date = new Date(model.displayedYear,model.displayedMonth,dateButton.dayOfMonth);
- model.selectedDate = newDate;
- IEventDispatcher(_strand).dispatchEvent( new Event("change") );
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/controllers/DateFieldMouseController.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/controllers/DateFieldMouseController.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/controllers/DateFieldMouseController.as
deleted file mode 100644
index a19d176..0000000
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/controllers/DateFieldMouseController.as
+++ /dev/null
@@ -1,98 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// 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 org.apache.flex.html.staticControls.beads.controllers
-{
- import flash.display.DisplayObject;
-
- import org.apache.flex.core.IBeadController;
- import org.apache.flex.core.IDateChooserModel;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.events.Event;
- import org.apache.flex.events.IEventDispatcher;
- import org.apache.flex.html.staticControls.beads.DateFieldView;
-
- /**
- * The DateFieldMouseController class is responsible for monitoring
- * the mouse events on the elements of the DateField. A click on the
- * DateField's menu button triggers the pop-up, for example.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class DateFieldMouseController implements IBeadController
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function DateFieldMouseController()
- {
- }
-
- private var _strand:IStrand;
-
- /**
- * @copy org.apache.flex.core.IBead#strand
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function set strand(value:IStrand):void
- {
- _strand = value;
-
- var viewBead:DateFieldView = _strand.getBeadByType(DateFieldView) as DateFieldView;
- IEventDispatcher(viewBead.menuButton).addEventListener("click", clickHandler);
- }
-
- /**
- * @private
- */
- private function clickHandler(event:Event):void
- {
- var viewBead:DateFieldView = _strand.getBeadByType(DateFieldView) as DateFieldView;
- viewBead.popUpVisible = true;
- DisplayObject(viewBead.popUp).x = DisplayObject(_strand).x + DisplayObject(_strand).width - 20;
- DisplayObject(viewBead.popUp).y = DisplayObject(_strand).y + DisplayObject(_strand).height;
- IEventDispatcher(viewBead.popUp).addEventListener("change", changeHandler);
- }
-
- /**
- * @private
- */
- private function changeHandler(event:Event):void
- {
- var viewBead:DateFieldView = _strand.getBeadByType(DateFieldView) as DateFieldView;
-
- var model:IDateChooserModel = _strand.getBeadByType(IDateChooserModel) as IDateChooserModel;
- model.selectedDate = IDateChooserModel(viewBead.popUp.getBeadByType(IDateChooserModel)).selectedDate;
-
- viewBead.popUpVisible = false;
- IEventDispatcher(_strand).dispatchEvent(new Event("change"));
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/models/DateChooserModel.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/models/DateChooserModel.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/models/DateChooserModel.as
deleted file mode 100644
index 245e3cb..0000000
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/models/DateChooserModel.as
+++ /dev/null
@@ -1,189 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// 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 org.apache.flex.html.staticControls.beads.models
-{
- import org.apache.flex.core.IDateChooserModel;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.events.Event;
- import org.apache.flex.events.EventDispatcher;
-
- /**
- * The DateChooserModel is a bead class that manages the data for a DataChooser.
- * This includes arrays of names for the months and days of the week as well the
- * currently selected date.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class DateChooserModel extends EventDispatcher implements IDateChooserModel
- {
- public function DateChooserModel()
- {
- // default displayed year and month to "today"
- var today:Date = new Date();
- displayedYear = today.getFullYear();
- displayedMonth = today.getMonth();
- }
-
- private var _strand:IStrand;
-
- /**
- * @copy org.apache.flex.core.IBead#strand
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function set strand(value:IStrand):void
- {
- _strand = value;
- }
-
- private var _dayNames:Array = ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];
- private var _monthNames:Array = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
- private var _displayedYear:Number;
- private var _displayedMonth:Number;
- private var _firstDayOfWeek:Number = 0;
- private var _selectedDate:Date;
-
- /**
- * An array of strings used to name the days of the week with Sunday being the
- * first element of the array.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get dayNames():Array
- {
- return _dayNames;
- }
- public function set dayNames(value:Array):void
- {
- _dayNames = value;
- dispatchEvent( new Event("dayNamesChanged") );
- }
-
- /**
- * An array of strings used to name the months of the year with January being
- * the first element of the array.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get monthNames():Array
- {
- return _monthNames;
- }
- public function set monthNames(value:Array):void
- {
- _monthNames = value;
- dispatchEvent( new Event("monthNames") );
- }
-
- /**
- * The year currently displayed by the DateChooser.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get displayedYear():Number
- {
- return _displayedYear;
- }
- public function set displayedYear(value:Number):void
- {
- if (value != _displayedYear) {
- _displayedYear = value;
- dispatchEvent( new Event("displayedYearChanged") );
- }
- }
-
- /**
- * The month currently displayed by the DateChooser.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get displayedMonth():Number
- {
- return _displayedMonth;
- }
- public function set displayedMonth(value:Number):void
- {
- if (_displayedMonth != value) {
- _displayedMonth = value;
- dispatchEvent( new Event("displayedMonthChanged") );
- }
- }
-
- /**
- * The index of the first day of the week, Sunday = 0.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get firstDayOfWeek():Number
- {
- return _firstDayOfWeek;
- }
- public function set firstDayOfWeek(value:Number):void
- {
- if (value != _firstDayOfWeek) {
- _firstDayOfWeek = value;
- dispatchEvent( new Event("firstDayOfWeekChanged") );
- }
- }
-
- /**
- * The currently selected date or null if no date has been selected.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get selectedDate():Date
- {
- return _selectedDate;
- }
- public function set selectedDate(value:Date):void
- {
- if (value != _selectedDate) {
- _selectedDate = value;
- dispatchEvent( new Event("selectedDateChanged") );
-
- displayedMonth = value.getMonth();
- displayedYear = value.getFullYear();
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/DateChooserButton.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/DateChooserButton.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/DateChooserButton.as
deleted file mode 100644
index 70c7606..0000000
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/DateChooserButton.as
+++ /dev/null
@@ -1,67 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// 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 org.apache.flex.html.staticControls.supportClasses
-{
- import org.apache.flex.html.staticControls.TextButton;
-
- /**
- * The DateChooserButton class is used for each button in the DateChooser. The
- * button holds the day of the month the button is representing.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class DateChooserButton extends TextButton
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function DateChooserButton()
- {
- super();
- className = "DateChooserButton";
- }
-
- private var _dayOfMonth:int;
-
- /**
- * The day of the month the button represents.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get dayOfMonth():int
- {
- return _dayOfMonth;
- }
- public function set dayOfMonth(value:int):void
- {
- _dayOfMonth = value;
- }
- }
-}
\ No newline at end of file
[2/2] git commit: [flex-asjs] [refs/heads/develop] - Moved
DateChooser from FlexJSUI project to FlexJSJX project since it can be
cross-compiled into JavaScript. Created DateField component in FlexJSJX
project as it can be cross-compiled into JavaScript.
Posted by pe...@apache.org.
Moved DateChooser from FlexJSUI project to FlexJSJX project since it can be cross-compiled into JavaScript. Created DateField component in FlexJSJX project as it can be cross-compiled into JavaScript. Updated DateChooser example to include DateField. Updated FormatExample to illustrate a custom component as a pop-up.
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/2380008e
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/2380008e
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/2380008e
Branch: refs/heads/develop
Commit: 2380008e2b36dc780000910167f725340d695888
Parents: 8a08cdd
Author: Peter Ent <pe...@apache.org>
Authored: Fri Mar 21 16:17:50 2014 -0400
Committer: Peter Ent <pe...@apache.org>
Committed: Fri Mar 21 16:17:50 2014 -0400
----------------------------------------------------------------------
examples/DateChooserExample/build.xml | 4 -
.../DateChooserExample/src/MyInitialView.mxml | 19 +-
.../flex/html/staticControls/DateChooser.as | 75 ------
.../staticControls/beads/DateChooserView.as | 253 ------------------
.../controllers/DateChooserMouseController.as | 126 ---------
.../beads/models/DateChooserModel.as | 186 --------------
.../supportClasses/DateChooserButton.as | 67 -----
examples/FormatExample/src/MyFormView.mxml | 34 +++
.../FormatExample/src/dialogs/DialogView.as | 38 +++
.../FormatExample/src/dialogs/LoginDialog.mxml | 70 +++++
.../as/projects/FlexJSJX/basic-manifest.xml | 5 +
frameworks/as/projects/FlexJSJX/defaults.css | 15 ++
.../as/projects/FlexJSJX/src/FlexJSJXClasses.as | 11 +-
.../org/apache/flex/core/IDateChooserModel.as | 101 ++++++++
.../src/org/apache/flex/core/IFormatBead.as | 69 +++++
.../flex/html/staticControls/DateChooser.as | 74 ++++++
.../flex/html/staticControls/DateField.as | 90 +++++++
.../accessories/DateFormatMMDDYYYYBead.as | 151 +++++++++++
.../staticControls/beads/DateChooserView.as | 257 +++++++++++++++++++
.../html/staticControls/beads/DateFieldView.as | 187 ++++++++++++++
.../staticControls/beads/FormatableLabelView.as | 90 +++++++
.../beads/FormatableTextInputView.as | 89 +++++++
.../controllers/DateChooserMouseController.as | 126 +++++++++
.../controllers/DateFieldMouseController.as | 97 +++++++
.../beads/models/DateChooserModel.as | 189 ++++++++++++++
.../supportClasses/DateChooserButton.as | 67 +++++
.../as/projects/FlexJSUI/basic-manifest.xml | 5 +-
frameworks/as/projects/FlexJSUI/defaults.css | 16 --
.../as/projects/FlexJSUI/src/FlexJSUIClasses.as | 8 -
.../org/apache/flex/core/IDateChooserModel.as | 101 --------
.../src/org/apache/flex/core/IFormatBead.as | 69 -----
.../flex/html/staticControls/DateChooser.as | 74 ------
.../flex/html/staticControls/DateField.as | 89 -------
.../accessories/DateFormatMMDDYYYYBead.as | 151 -----------
.../staticControls/beads/DateChooserView.as | 253 ------------------
.../html/staticControls/beads/DateFieldView.as | 192 --------------
.../staticControls/beads/FormatableLabelView.as | 90 -------
.../beads/FormatableTextInputView.as | 89 -------
.../controllers/DateChooserMouseController.as | 126 ---------
.../controllers/DateFieldMouseController.as | 98 -------
.../beads/models/DateChooserModel.as | 189 --------------
.../supportClasses/DateChooserButton.as | 67 -----
42 files changed, 1766 insertions(+), 2341 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/examples/DateChooserExample/build.xml
----------------------------------------------------------------------
diff --git a/examples/DateChooserExample/build.xml b/examples/DateChooserExample/build.xml
index 15470b1..ac351a5 100644
--- a/examples/DateChooserExample/build.xml
+++ b/examples/DateChooserExample/build.xml
@@ -33,12 +33,8 @@
<include file="${basedir}/../build_example.xml" />
- <target name="main" depends="clean,build_example.compile" description="Clean build of ${example}">
- </target>
- <!-- Uncomment to reproduce cross-compilation error in compilejs step
<target name="main" depends="clean,build_example.compile,build_example.compilejs" description="Clean build of ${example}">
</target>
- -->
<target name="clean">
<delete dir="${basedir}/bin" failonerror="false" />
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/examples/DateChooserExample/src/MyInitialView.mxml
----------------------------------------------------------------------
diff --git a/examples/DateChooserExample/src/MyInitialView.mxml b/examples/DateChooserExample/src/MyInitialView.mxml
index 55634a7..6da2f69 100644
--- a/examples/DateChooserExample/src/MyInitialView.mxml
+++ b/examples/DateChooserExample/src/MyInitialView.mxml
@@ -20,8 +20,7 @@ limitations under the License.
<basic:ViewBase xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:basic="library://ns.apache.org/flexjs/basic"
xmlns:local="*"
- xmlns:models="models.*"
- xmlns:staticControls1="org.apache.flex.html.staticControls.*">
+ xmlns:models="models.*">
<fx:Script>
<![CDATA[
@@ -30,22 +29,16 @@ limitations under the License.
{
trace("Selected date: "+dateChooser.selectedDate);
output.text = String(dateChooser.selectedDate);
+
+ dateField.selectedDate = dateChooser.selectedDate;
}
]]>
</fx:Script>
- <fx:Style>
- @namespace staticControls1 "org.apache.flex.html.staticControls.*";
-
- staticControls1|DateChooser {
- IBeadView: ClassReference("org.apache.flex.html.staticControls.beads.DateChooserView");
- IBeadModel: ClassReference("org.apache.flex.html.staticControls.beads.models.DateChooserModel");
- IBeadController: ClassReference("org.apache.flex.html.staticControls.beads.controllers.DateChooserMouseController");
- }
- </fx:Style>
-
<basic:Label id="output" x="450" y="30" width="100" />
- <staticControls1:DateChooser id="dateChooser" x="20" y="30" change="dateChanged()" />
+ <basic:DateChooser id="dateChooser" x="20" y="30" width="280" height="240" change="dateChanged()" />
+
+ <basic:DateField id="dateField" x="450" y="90" />
</basic:ViewBase>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/examples/DateChooserExample/src/org/apache/flex/html/staticControls/DateChooser.as
----------------------------------------------------------------------
diff --git a/examples/DateChooserExample/src/org/apache/flex/html/staticControls/DateChooser.as b/examples/DateChooserExample/src/org/apache/flex/html/staticControls/DateChooser.as
deleted file mode 100644
index cdb3f06..0000000
--- a/examples/DateChooserExample/src/org/apache/flex/html/staticControls/DateChooser.as
+++ /dev/null
@@ -1,75 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// 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 org.apache.flex.html.staticControls
-{
- import org.apache.flex.html.staticControls.beads.models.DateChooserModel;
-
- import org.apache.flex.core.UIBase;
-
- /**
- * The change event is dispatched when the selectedDate is changed.
- */
- [Event(name="change", type="org.apache.flex.events.Event")]
-
- /**
- * The DateChooser class is a component that displays a calendar.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class DateChooser extends UIBase
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function DateChooser()
- {
- super();
- className = "DateChooser";
-
- // fix the DateChooser's size
- width = 350;
- height = 225;
- }
-
- /**
- * The currently selected date (or null if no date has been selected).
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get selectedDate():Date
- {
- return DateChooserModel(model).selectedDate;
- }
- public function set selectedDate(value:Date):void
- {
- DateChooserModel(model).selectedDate = value;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/examples/DateChooserExample/src/org/apache/flex/html/staticControls/beads/DateChooserView.as
----------------------------------------------------------------------
diff --git a/examples/DateChooserExample/src/org/apache/flex/html/staticControls/beads/DateChooserView.as b/examples/DateChooserExample/src/org/apache/flex/html/staticControls/beads/DateChooserView.as
deleted file mode 100644
index f8b32e8..0000000
--- a/examples/DateChooserExample/src/org/apache/flex/html/staticControls/beads/DateChooserView.as
+++ /dev/null
@@ -1,253 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// 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 org.apache.flex.html.staticControls.beads
-{
- import org.apache.flex.html.staticControls.beads.models.DateChooserModel;
- import org.apache.flex.html.staticControls.supportClasses.DateChooserButton;
-
- import org.apache.flex.core.IBeadModel;
- import org.apache.flex.core.IBeadView;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.core.UIBase;
- import org.apache.flex.core.ValuesManager;
- import org.apache.flex.events.Event;
- import org.apache.flex.events.IEventDispatcher;
- import org.apache.flex.html.staticControls.Container;
- import org.apache.flex.html.staticControls.TextButton;
- import org.apache.flex.html.staticControls.beads.layouts.TileLayout;
-
- /**
- * The DateChooserView class is a view bead for the DateChooser. This class
- * creates the elements for the DateChooser: the buttons to move between
- * months, the labels for the days of the week, and the buttons for each day
- * of the month.
- */
- public class DateChooserView implements IBeadView
- {
- /**
- * constructor
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function DateChooserView()
- {
- }
-
- private var _strand:IStrand;
-
- /**
- * @copy org.apache.flex.core.IBead#strand
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function set strand(value:IStrand):void
- {
- _strand = value;
-
- // make sure there is a model.
- model = _strand.getBeadByType(IBeadModel) as DateChooserModel;
- if (model == null) {
- model = new (ValuesManager.valuesImpl.getValue(_strand,"iBeadModel")) as DateChooserModel;
- }
- model.addEventListener("displayedMonthChanged",handleModelChange);
- model.addEventListener("displayedYearChanged",handleModelChange);
-
- createChildren();
- }
-
- private var _prevMonthButton:TextButton;
- private var _nextMonthButton:TextButton;
- private var _dayButtons:Array;
- private var monthLabel:TextButton;
- private var dayContainer:Container;
-
- private var model:DateChooserModel;
-
- /**
- * The button that causes the previous month to be displayed by the DateChooser.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get prevMonthButton():TextButton
- {
- return _prevMonthButton;
- }
-
- /**
- * The button that causes the next month to be displayed by the DateChooser.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get nextMonthButton():TextButton
- {
- return _nextMonthButton;
- }
-
- /**
- * The array of DateChooserButton instances that represent each day of the month.
- */
- public function get dayButtons():Array
- {
- return _dayButtons;
- }
-
- /**
- * @private
- */
- private function createChildren():void
- {
- _prevMonthButton = new TextButton();
- _prevMonthButton.width = 40;
- _prevMonthButton.height = 20;
- _prevMonthButton.x = 0;
- _prevMonthButton.y = 0;
- _prevMonthButton.text = "<";
- UIBase(_strand).addElement(_prevMonthButton);
-
- _nextMonthButton = new TextButton();
- _nextMonthButton.width = 40;
- _nextMonthButton.height = 20;
- _nextMonthButton.x = UIBase(_strand).width - _nextMonthButton.width;
- _nextMonthButton.y = 0;
- _nextMonthButton.text = ">";
- UIBase(_strand).addElement(_nextMonthButton);
-
- monthLabel = new TextButton();
- monthLabel.text = "Month Here";
- monthLabel.width = 100;
- monthLabel.height = 20;
- monthLabel.x = (UIBase(_strand).width - monthLabel.width)/2;
- monthLabel.y = 0;
- UIBase(_strand).addElement(monthLabel);
-
- dayContainer = new Container();
- var tileLayout:TileLayout = new TileLayout();
- dayContainer.addBead(tileLayout);
- tileLayout.numColumns = 7;
- dayContainer.x = 0;
- dayContainer.y = monthLabel.y + monthLabel.height + 5;
- dayContainer.width = UIBase(_strand).width;
- dayContainer.height = UIBase(_strand).height - (monthLabel.height+5);
-
- // the calendar has 7 columns with 6 rows, the first row are the day names
- for(var i:int=0; i < 7; i++) {
- var dayName:DateChooserButton = new DateChooserButton();
- dayName.text = model.dayNames[i];
- dayName.dayOfMonth = 0;
- dayContainer.addElement(dayName);
- }
-
- _dayButtons = new Array();
-
- for(i=0; i < 42; i++) {
- var date:DateChooserButton = new DateChooserButton();
- date.text = String(i+1);
- dayContainer.addElement(date);
- dayButtons.push(date);
- }
-
- UIBase(_strand).addElement(dayContainer);
-
- IEventDispatcher(dayContainer).dispatchEvent( new Event("itemsCreated") );
- IEventDispatcher(_strand).dispatchEvent( new Event("layoutNeeded") );
- IEventDispatcher(dayContainer).dispatchEvent( new Event("layoutNeeded") );
-
- updateCalendar();
- }
-
- /**
- * @private
- */
- private function updateCalendar():void
- {
- monthLabel.text = model.monthNames[model.displayedMonth] + " " +
- String(model.displayedYear);
-
- var firstDay:Date = new Date(model.displayedYear,model.displayedMonth,1);
-
- // blank out the labels for the first firstDay.day-1 entries.
- for(var i:int=0; i < firstDay.getDay(); i++) {
- var dateButton:DateChooserButton = dayButtons[i] as DateChooserButton;
- dateButton.dayOfMonth = -1;
- dateButton.text = "";
- }
-
- // renumber to the last day of the month
- var dayNumber:int = 1;
- var numDays:Number = numberOfDaysInMonth(model.displayedMonth, model.displayedYear);
-
- for(; i < dayButtons.length && dayNumber <= numDays; i++) {
- dateButton = dayButtons[i] as DateChooserButton;
- dateButton.dayOfMonth = dayNumber;
- dateButton.text = String(dayNumber++);
- }
-
- // blank out the rest
- for(; i < dayButtons.length; i++) {
- dateButton = dayButtons[i] as DateChooserButton;
- dateButton.dayOfMonth = -1;
- dateButton.text = "";
- }
- }
-
- /**
- * @private
- */
- private function numberOfDaysInMonth(month:Number, year:Number):Number
- {
- var n:int;
-
- if (month == 1) // Feb
- {
- if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) // leap year
- n = 29;
- else
- n = 28;
- }
-
- else if (month == 3 || month == 5 || month == 8 || month == 10)
- n = 30;
-
- else
- n = 31;
-
- return n;
- }
-
- /**
- * @private
- */
- private function handleModelChange(event:Event):void
- {
- updateCalendar();
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/examples/DateChooserExample/src/org/apache/flex/html/staticControls/beads/controllers/DateChooserMouseController.as
----------------------------------------------------------------------
diff --git a/examples/DateChooserExample/src/org/apache/flex/html/staticControls/beads/controllers/DateChooserMouseController.as b/examples/DateChooserExample/src/org/apache/flex/html/staticControls/beads/controllers/DateChooserMouseController.as
deleted file mode 100644
index 69343eb..0000000
--- a/examples/DateChooserExample/src/org/apache/flex/html/staticControls/beads/controllers/DateChooserMouseController.as
+++ /dev/null
@@ -1,126 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// 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 org.apache.flex.html.staticControls.beads.controllers
-{
- import org.apache.flex.html.staticControls.beads.DateChooserView;
- import org.apache.flex.html.staticControls.beads.models.DateChooserModel;
- import org.apache.flex.html.staticControls.supportClasses.DateChooserButton;
-
- import org.apache.flex.core.IBeadController;
- import org.apache.flex.core.IBeadModel;
- import org.apache.flex.core.IBeadView;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.events.Event;
- import org.apache.flex.events.IEventDispatcher;
-
- /**
- * The DateChooserMouseController class is responsible for listening to
- * mouse event related to the DateChooser. Events such as selecting a date
- * or changing the calendar.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class DateChooserMouseController implements IBeadController
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function DateChooserMouseController()
- {
- }
-
- private var _strand:IStrand;
-
- /**
- * @copy org.apache.flex.core.IBead#strand
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function set strand(value:IStrand):void
- {
- _strand = value;
-
- var view:DateChooserView = value.getBeadByType(IBeadView) as DateChooserView;
- view.prevMonthButton.addEventListener("click", prevMonthClickHandler);
- view.nextMonthButton.addEventListener("click", nextMonthClickHandler);
-
- var dayButtons:Array = view.dayButtons;
- for(var i:int=0; i < dayButtons.length; i++) {
- IEventDispatcher(dayButtons[i]).addEventListener("click", dayButtonClickHandler);
- }
- }
-
- /**
- * @private
- */
- private function prevMonthClickHandler(event:Event):void
- {
- var model:DateChooserModel = _strand.getBeadByType(IBeadModel) as DateChooserModel;
- var month:Number = model.displayedMonth - 1;
- var year:Number = model.displayedYear;
- if (month < 0) {
- month = 11;
- year--;
- }
- model.displayedMonth = month;
- model.displayedYear = year;
- }
-
- /**
- * @private
- */
- private function nextMonthClickHandler(event:Event):void
- {
- var model:DateChooserModel = _strand.getBeadByType(IBeadModel) as DateChooserModel;
- var month:Number = model.displayedMonth + 1;
- var year:Number = model.displayedYear;
- if (month >= 12) {
- month = 0;
- year++;
- }
- model.displayedMonth = month;
- model.displayedYear = year;
- }
-
- /**
- * @private
- */
- private function dayButtonClickHandler(event:Event):void
- {
- var dateButton:DateChooserButton = event.target as DateChooserButton;
- if (dateButton.dayOfMonth > 0) {
- var model:DateChooserModel = _strand.getBeadByType(IBeadModel) as DateChooserModel;
- var newDate:Date = new Date(model.displayedYear,model.displayedMonth,dateButton.dayOfMonth);
- model.selectedDate = newDate;
- IEventDispatcher(_strand).dispatchEvent( new Event("change") );
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/examples/DateChooserExample/src/org/apache/flex/html/staticControls/beads/models/DateChooserModel.as
----------------------------------------------------------------------
diff --git a/examples/DateChooserExample/src/org/apache/flex/html/staticControls/beads/models/DateChooserModel.as b/examples/DateChooserExample/src/org/apache/flex/html/staticControls/beads/models/DateChooserModel.as
deleted file mode 100644
index ac9acaf..0000000
--- a/examples/DateChooserExample/src/org/apache/flex/html/staticControls/beads/models/DateChooserModel.as
+++ /dev/null
@@ -1,186 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// 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 org.apache.flex.html.staticControls.beads.models
-{
- import org.apache.flex.core.IBeadModel;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.events.Event;
- import org.apache.flex.events.EventDispatcher;
-
- /**
- * The DateChooserModel is a bead class that manages the data for a DataChooser.
- * This includes arrays of names for the months and days of the week as well the
- * currently selected date.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class DateChooserModel extends EventDispatcher implements IBeadModel
- {
- public function DateChooserModel()
- {
- // default displayed year and month to "today"
- var today:Date = new Date();
- displayedYear = today.getFullYear();
- displayedMonth = today.getMonth();
- }
-
- private var _strand:IStrand;
-
- /**
- * @copy org.apache.flex.core.IBead#strand
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function set strand(value:IStrand):void
- {
- _strand = value;
- }
-
- private var _dayNames:Array = ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];
- private var _monthNames:Array = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
- private var _displayedYear:Number;
- private var _displayedMonth:Number;
- private var _firstDayOfWeek:Number = 0;
- private var _selectedDate:Date;
-
- /**
- * An array of strings used to name the days of the week with Sunday being the
- * first element of the array.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get dayNames():Array
- {
- return _dayNames;
- }
- public function set dayNames(value:Array):void
- {
- _dayNames = value;
- dispatchEvent( new Event("dayNamesChanged") );
- }
-
- /**
- * An array of strings used to name the months of the year with January being
- * the first element of the array.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get monthNames():Array
- {
- return _monthNames;
- }
- public function set monthNames(value:Array):void
- {
- _monthNames = value;
- dispatchEvent( new Event("monthNames") );
- }
-
- /**
- * The year currently displayed by the DateChooser.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get displayedYear():Number
- {
- return _displayedYear;
- }
- public function set displayedYear(value:Number):void
- {
- if (value != _displayedYear) {
- _displayedYear = value;
- dispatchEvent( new Event("displayedYearChanged") );
- }
- }
-
- /**
- * The month currently displayed by the DateChooser.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get displayedMonth():Number
- {
- return _displayedMonth;
- }
- public function set displayedMonth(value:Number):void
- {
- if (_displayedMonth != value) {
- _displayedMonth = value;
- dispatchEvent( new Event("displayedMonthChanged") );
- }
- }
-
- /**
- * The index of the first day of the week, Sunday = 0.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get firstDayOfWeek():Number
- {
- return _firstDayOfWeek;
- }
- public function set firstDayOfWeek(value:Number):void
- {
- if (value != _firstDayOfWeek) {
- _firstDayOfWeek = value;
- dispatchEvent( new Event("firstDayOfWeekChanged") );
- }
- }
-
- /**
- * The currently selected date or null if no date has been selected.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get selectedDate():Date
- {
- return _selectedDate;
- }
- public function set selectedDate(value:Date):void
- {
- if (value != _selectedDate) {
- _selectedDate = value;
- dispatchEvent( new Event("selectedDateChanged") );
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/examples/DateChooserExample/src/org/apache/flex/html/staticControls/supportClasses/DateChooserButton.as
----------------------------------------------------------------------
diff --git a/examples/DateChooserExample/src/org/apache/flex/html/staticControls/supportClasses/DateChooserButton.as b/examples/DateChooserExample/src/org/apache/flex/html/staticControls/supportClasses/DateChooserButton.as
deleted file mode 100644
index 70c7606..0000000
--- a/examples/DateChooserExample/src/org/apache/flex/html/staticControls/supportClasses/DateChooserButton.as
+++ /dev/null
@@ -1,67 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// 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 org.apache.flex.html.staticControls.supportClasses
-{
- import org.apache.flex.html.staticControls.TextButton;
-
- /**
- * The DateChooserButton class is used for each button in the DateChooser. The
- * button holds the day of the month the button is representing.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class DateChooserButton extends TextButton
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function DateChooserButton()
- {
- super();
- className = "DateChooserButton";
- }
-
- private var _dayOfMonth:int;
-
- /**
- * The day of the month the button represents.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function get dayOfMonth():int
- {
- return _dayOfMonth;
- }
- public function set dayOfMonth(value:int):void
- {
- _dayOfMonth = value;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/examples/FormatExample/src/MyFormView.mxml
----------------------------------------------------------------------
diff --git a/examples/FormatExample/src/MyFormView.mxml b/examples/FormatExample/src/MyFormView.mxml
index 2231da3..60df6dd 100644
--- a/examples/FormatExample/src/MyFormView.mxml
+++ b/examples/FormatExample/src/MyFormView.mxml
@@ -31,6 +31,33 @@ limitations under the License.
</fx:Style>
+ <fx:Script>
+ <![CDATA[
+ import dialogs.LoginDialog;
+
+ import org.apache.flex.core.IPopUpHost;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.utils.UIUtils;
+
+
+ private function showLogin():void
+ {
+ var dialog:LoginDialog = new LoginDialog();
+ var host:IPopUpHost = UIUtils.findPopUpHost(this);
+ host.addElement(dialog);
+ UIUtils.center(dialog,this);
+
+ dialog.addEventListener("close",closeDialog);
+ }
+
+ private function closeDialog(event:org.apache.flex.events.Event):void
+ {
+ var dialog:LoginDialog = event.currentTarget as LoginDialog;
+ UIUtils.removePopUp(dialog);
+ }
+ ]]>
+ </fx:Script>
+
<basic:Container width="600" height="700" x="50" y="50">
<basic:beads>
<basic:NonVirtualVerticalLayout />
@@ -94,6 +121,13 @@ limitations under the License.
</basic:TextInput>
</basic:Container>
+ <basic:Container width="500">
+ <basic:beads>
+ <basic:NonVirtualHorizontalLayout />
+ </basic:beads>
+ <basic:TextButton text="Login" click="showLogin()" />
+ </basic:Container>
+
</basic:Container>
</basic:ViewBase>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/examples/FormatExample/src/dialogs/DialogView.as
----------------------------------------------------------------------
diff --git a/examples/FormatExample/src/dialogs/DialogView.as b/examples/FormatExample/src/dialogs/DialogView.as
new file mode 100644
index 0000000..dc4377d
--- /dev/null
+++ b/examples/FormatExample/src/dialogs/DialogView.as
@@ -0,0 +1,38 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 dialogs
+{
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.html.staticControls.beads.PanelView;
+
+ public class DialogView extends PanelView
+ {
+ public function DialogView()
+ {
+ trace("This is DialogView");
+ super();
+ }
+
+ override public function set strand(value:IStrand):void
+ {
+ trace("DialogView strand setter");
+ super.strand = value;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/examples/FormatExample/src/dialogs/LoginDialog.mxml
----------------------------------------------------------------------
diff --git a/examples/FormatExample/src/dialogs/LoginDialog.mxml b/examples/FormatExample/src/dialogs/LoginDialog.mxml
new file mode 100644
index 0000000..cb173d5
--- /dev/null
+++ b/examples/FormatExample/src/dialogs/LoginDialog.mxml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+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.
+
+-->
+<basic:Panel xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:basic="library://ns.apache.org/flexjs/basic"
+ xmlns:local="*"
+ className="LoginDialog"
+ width="280" height="90" title="Login">
+
+ <!-- fx:Metadata is not recognized by FalconJX -->
+ <!--<fx:Metadata>
+ [Event(name="close", type="org.apache.flex.events.Event")]
+ </fx:Metadata>-->
+
+ <fx:Script>
+ <![CDATA[
+ import org.apache.flex.events.Event;
+
+ private function cancelLogin():void
+ {
+ dispatchEvent( new org.apache.flex.events.Event("close") );
+ }
+ ]]>
+ </fx:Script>
+
+ <basic:beads>
+ <basic:NonVirtualVerticalLayout />
+ </basic:beads>
+
+ <basic:Container width="200">
+ <basic:beads>
+ <basic:NonVirtualHorizontalLayout />
+ </basic:beads>
+ <basic:Label text="User Name:" />
+ <basic:TextInput />
+ </basic:Container>
+
+ <basic:Container width="200">
+ <basic:beads>
+ <basic:NonVirtualHorizontalLayout />
+ </basic:beads>
+ <basic:Label text="Password:" />
+ <basic:TextInput />
+ </basic:Container>
+
+ <basic:Container width="200">
+ <basic:beads>
+ <basic:NonVirtualHorizontalLayout />
+ </basic:beads>
+ <basic:TextButton text="Login" click="cancelLogin()" />
+ <basic:TextButton text="Cancel" click="cancelLogin()" />
+ </basic:Container>
+
+</basic:Panel>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/frameworks/as/projects/FlexJSJX/basic-manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/basic-manifest.xml b/frameworks/as/projects/FlexJSJX/basic-manifest.xml
index 7b80e80..85135bf 100644
--- a/frameworks/as/projects/FlexJSJX/basic-manifest.xml
+++ b/frameworks/as/projects/FlexJSJX/basic-manifest.xml
@@ -23,7 +23,12 @@
<component id="DataGrid" class="org.apache.flex.html.staticControls.DataGrid"/>
<component id="DataGridColumn" class="org.apache.flex.html.staticControls.supportClasses.DataGridColumn"/>
+ <component id="FormatableLabelView" class="org.apache.flex.html.staticControls.beads.FormatableLabelView"/>
+ <component id="FormatableTextInputView" class="org.apache.flex.html.staticControls.beads.FormatableTextInputView"/>
<component id="DataGridPresentationModel" class="org.apache.flex.html.staticControls.beads.models.DataGridPresentationModel" />
+
+ <component id="DateChooser" class="org.apache.flex.html.staticControls.DateChooser"/>
+ <component id="DateField" class="org.apache.flex.html.staticControls.DateField"/>
<component id="BarChart" class="org.apache.flex.charts.BarChart" />
<component id="BarChartSeries" class="org.apache.flex.charts.supportClasses.BarChartSeries" />
<component id="BoxItemRenderer" class="org.apache.flex.charts.supportClasses.BoxItemRenderer" />
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/frameworks/as/projects/FlexJSJX/defaults.css
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/defaults.css b/frameworks/as/projects/FlexJSJX/defaults.css
index 7ae6fbe..3666776 100644
--- a/frameworks/as/projects/FlexJSJX/defaults.css
+++ b/frameworks/as/projects/FlexJSJX/defaults.css
@@ -40,3 +40,18 @@ DataGrid
background-color: #FFFFFF;
}
+
+DateChooser {
+ IBeadView: ClassReference("org.apache.flex.html.staticControls.beads.DateChooserView");
+ IBeadModel: ClassReference("org.apache.flex.html.staticControls.beads.models.DateChooserModel");
+ IBeadController: ClassReference("org.apache.flex.html.staticControls.beads.controllers.DateChooserMouseController");
+ width: 280px;
+ height: 240px;
+}
+
+DateField {
+ IBeadView: ClassReference("org.apache.flex.html.staticControls.beads.DateFieldView");
+ IBeadModel: ClassReference("org.apache.flex.html.staticControls.beads.models.DateChooserModel");
+ IBeadController: ClassReference("org.apache.flex.html.staticControls.beads.controllers.DateFieldMouseController");
+ IFormatBead: ClassReference("org.apache.flex.html.staticControls.accessories.DateFormatMMDDYYYYBead");
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/frameworks/as/projects/FlexJSJX/src/FlexJSJXClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/src/FlexJSJXClasses.as b/frameworks/as/projects/FlexJSJX/src/FlexJSJXClasses.as
index 2b8e3c7..7ca0481 100644
--- a/frameworks/as/projects/FlexJSJX/src/FlexJSJXClasses.as
+++ b/frameworks/as/projects/FlexJSJX/src/FlexJSJXClasses.as
@@ -33,12 +33,21 @@ internal class FlexJSJXClasses
import org.apache.flex.charts.beads.layouts.BarChartLayout; BarChartLayout;
import org.apache.flex.charts.supportClasses.BarChartSeries; BarChartSeries;
import org.apache.flex.charts.supportClasses.BoxItemRenderer; BoxItemRenderer;
- import org.apache.flex.html.staticControls.supportClasses.DataGridColumn; DataGridColumn;
+ import org.apache.flex.html.staticControls.accessories.DateFormatMMDDYYYYBead; DateFormatMMDDYYYYBead;
import org.apache.flex.html.staticControls.beads.DataGridColumnView; DataGridColumnView;
import org.apache.flex.html.staticControls.beads.DataGridView; DataGridView;
+ import org.apache.flex.html.staticControls.beads.DateChooserView; DateChooserView;
+ import org.apache.flex.html.staticControls.beads.DateFieldView; DateFieldView;
+ import org.apache.flex.html.staticControls.beads.FormatableLabelView; FormatableLabelView;
+ import org.apache.flex.html.staticControls.beads.FormatableTextInputView; FormatableTextInputView;
import org.apache.flex.html.staticControls.beads.models.DataGridModel; DataGridModel;
+ import org.apache.flex.html.staticControls.beads.models.DateChooserModel; DateChooserModel;
import org.apache.flex.html.staticControls.beads.models.DataGridPresentationModel; DataGridPresentationModel;
+ import org.apache.flex.html.staticControls.beads.controllers.DateChooserMouseController; DateChooserMouseController;
+ import org.apache.flex.html.staticControls.beads.controllers.DateFieldMouseController; DateFieldMouseController;
+ import org.apache.flex.html.staticControls.supportClasses.DataGridColumn; DataGridColumn;
+ import org.apache.flex.html.staticControls.supportClasses.DateChooserButton; DateChooserButton;
}
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/IDateChooserModel.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/IDateChooserModel.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/IDateChooserModel.as
new file mode 100644
index 0000000..7944591
--- /dev/null
+++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/IDateChooserModel.as
@@ -0,0 +1,101 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 org.apache.flex.core
+{
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The IDateChooserModel interface.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public interface IDateChooserModel extends IEventDispatcher, IBeadModel
+ {
+ /**
+ * An array of strings used to name the days of the week with Sunday being the
+ * first element of the array.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get dayNames():Array;
+ function set dayNames(value:Array):void;
+
+ /**
+ * An array of strings used to name the months of the year with January being
+ * the first element of the array.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get monthNames():Array;
+ function set monthNames(value:Array):void;
+
+ /**
+ * The year currently displayed by the DateChooser.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get displayedYear():Number;
+ function set displayedYear(value:Number):void;
+
+ /**
+ * The month currently displayed by the DateChooser.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get displayedMonth():Number;
+ function set displayedMonth(value:Number):void;
+
+ /**
+ * The index of the first day of the week, Sunday = 0.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get firstDayOfWeek():Number;
+ function set firstDayOfWeek(value:Number):void;
+
+ /**
+ * The currently selected date or null if no date has been selected.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get selectedDate():Date;
+ function set selectedDate(value:Date):void;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/IFormatBead.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/IFormatBead.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/IFormatBead.as
new file mode 100644
index 0000000..3880f5a
--- /dev/null
+++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/IFormatBead.as
@@ -0,0 +1,69 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 org.apache.flex.core
+{
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The IFormatBead interface should be implemented by any bead that
+ * provides a formatting service. When the bead instance is created it
+ * should listen for change events and set its formattedString property
+ * for later retrieveal.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public interface IFormatBead extends IBead, IEventDispatcher
+ {
+ /**
+ * The name of the property for the source to be formatted.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get propertyName():String;
+ function set propertyName(value:String):void;
+
+ /**
+ * The name of the event to listen for, indicating that propertyName
+ * property has changed. The default event is propertyName+"Changed".
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get eventName():String;
+ function set eventName(value:String):void;
+
+ /**
+ * The formatted result.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get formattedString():String;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/DateChooser.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/DateChooser.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/DateChooser.as
new file mode 100644
index 0000000..6f36af7
--- /dev/null
+++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/DateChooser.as
@@ -0,0 +1,74 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 org.apache.flex.html.staticControls
+{
+ import org.apache.flex.core.IDateChooserModel;
+ import org.apache.flex.core.UIBase;
+
+ /**
+ * The change event is dispatched when the selectedDate is changed.
+ */
+ [Event(name="change", type="org.apache.flex.events.Event")]
+
+ /**
+ * The DateChooser class is a component that displays a calendar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DateChooser extends UIBase
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DateChooser()
+ {
+ super();
+ className = "DateChooser";
+
+ // fix the DateChooser's size
+// width = 280;
+// height = 240;
+ }
+
+ /**
+ * The currently selected date (or null if no date has been selected).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selectedDate():Date
+ {
+ return IDateChooserModel(model).selectedDate;
+ }
+ public function set selectedDate(value:Date):void
+ {
+ IDateChooserModel(model).selectedDate = value;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/DateField.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/DateField.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/DateField.as
new file mode 100644
index 0000000..f5c77f4
--- /dev/null
+++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/DateField.as
@@ -0,0 +1,90 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 org.apache.flex.html.staticControls
+{
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IDateChooserModel;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+
+ /**
+ * The DateField class provides an input field where a date can be entered
+ * and a pop-up calendar control for picking a date as an alternative to
+ * the text field.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DateField extends UIBase
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DateField()
+ {
+ super();
+
+ className = "DateField";
+ }
+
+ /**
+ * The method called when added to a parent. The DateField class uses
+ * this opportunity to install additional beads.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function addedToParent():void
+ {
+ super.addedToParent();
+
+ var klass:* = ValuesManager.valuesImpl.getValue(this,"iFormatBead");
+ var bead:IBead = new klass() as IBead;
+ if (bead) {
+ addBead(bead);
+ }
+ }
+
+ /**
+ * The currently selected date (or null if no date has been selected).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selectedDate():Date
+ {
+ return IDateChooserModel(model).selectedDate;
+ }
+ public function set selectedDate(value:Date):void
+ {
+ IDateChooserModel(model).selectedDate = value;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/accessories/DateFormatMMDDYYYYBead.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/accessories/DateFormatMMDDYYYYBead.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/accessories/DateFormatMMDDYYYYBead.as
new file mode 100644
index 0000000..3b52c40
--- /dev/null
+++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/accessories/DateFormatMMDDYYYYBead.as
@@ -0,0 +1,151 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 org.apache.flex.html.staticControls.accessories
+{
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IDateChooserModel;
+ import org.apache.flex.core.IFormatBead;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.EventDispatcher;
+ import org.apache.flex.html.staticControls.TextInput;
+ import org.apache.flex.html.staticControls.beads.DateFieldView;
+
+ /**
+ * The DateFormatBead class formats the display of a DateField using MM/DD/YYYY format.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DateFormatMMDDYYYYBead extends EventDispatcher implements IBead, IFormatBead
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DateFormatMMDDYYYYBead()
+ {
+ }
+
+ private var _propertyName:String;
+ private var _eventName:String;
+ private var _formattedResult:String;
+
+ /**
+ * The name of the property on the model holding the value to be formatted.
+ * The default is selectedDate.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get propertyName():String
+ {
+ if (_propertyName == null) {
+ return "selectedDate";
+ }
+ return _propertyName;
+ }
+ public function set propertyName(value:String):void
+ {
+ _propertyName = value;
+ }
+
+ /**
+ * The name of the event dispatched when the property changes. The
+ * default is selectedDateChanged.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get eventName():String
+ {
+ if (_eventName == null) {
+ return _propertyName+"Changed";
+ }
+ return _eventName;
+ }
+ public function set eventName(value:String):void
+ {
+ _eventName = value;
+ }
+
+ /**
+ * The formatted result.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get formattedString():String
+ {
+ return _formattedResult;
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ var model:IDateChooserModel = _strand.getBeadByType(IDateChooserModel) as IDateChooserModel;
+ model.addEventListener("selectedDateChanged",handleTextChange);
+ }
+
+ /**
+ * @private
+ */
+ private function handleTextChange(event:Event):void
+ {
+ var model:IDateChooserModel = _strand.getBeadByType(IDateChooserModel) as IDateChooserModel;
+ /*var view:DateFieldView = _strand.getBeadByType(DateFieldView) as DateFieldView;
+ var input:TextInput = view.textInput;*/
+
+ var d:Date = model.selectedDate;
+ var month:String = String(d.getMonth()+1);
+ if (Number(month)<10) month = "0"+month;
+ var date:String = String(d.getDate());
+ if (Number(date)<10) date = "0"+date;
+ var fmt:String = month+"/"+date+"/"+String(d.getFullYear());
+ /*input.text = fmt;*/
+ _formattedResult = month+"/"+date+"/"+String(d.getFullYear());
+
+ dispatchEvent( new Event("formatChanged") );
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/beads/DateChooserView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/beads/DateChooserView.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/beads/DateChooserView.as
new file mode 100644
index 0000000..12cc8f5
--- /dev/null
+++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/beads/DateChooserView.as
@@ -0,0 +1,257 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 org.apache.flex.html.staticControls.beads
+{
+ import org.apache.flex.html.staticControls.beads.models.DateChooserModel;
+ import org.apache.flex.html.staticControls.supportClasses.DateChooserButton;
+
+ import org.apache.flex.core.IBeadModel;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.staticControls.beads.layouts.TileLayout;
+ import org.apache.flex.html.staticControls.Container;
+ import org.apache.flex.html.staticControls.TextButton;
+
+ /**
+ * The DateChooserView class is a view bead for the DateChooser. This class
+ * creates the elements for the DateChooser: the buttons to move between
+ * months, the labels for the days of the week, and the buttons for each day
+ * of the month.
+ */
+ public class DateChooserView implements IBeadView
+ {
+ /**
+ * constructor
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DateChooserView()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ // make sure there is a model.
+ model = _strand.getBeadByType(IBeadModel) as DateChooserModel;
+ if (model == null) {
+ model = new (ValuesManager.valuesImpl.getValue(_strand,"iBeadModel")) as DateChooserModel;
+ }
+ model.addEventListener("displayedMonthChanged",handleModelChange);
+ model.addEventListener("displayedYearChanged",handleModelChange);
+
+ createChildren();
+ }
+
+ private var _prevMonthButton:TextButton;
+ private var _nextMonthButton:TextButton;
+ private var _dayButtons:Array;
+ private var monthLabel:TextButton;
+ private var dayContainer:Container;
+
+ private var model:DateChooserModel;
+
+ /**
+ * The button that causes the previous month to be displayed by the DateChooser.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get prevMonthButton():TextButton
+ {
+ return _prevMonthButton;
+ }
+
+ /**
+ * The button that causes the next month to be displayed by the DateChooser.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get nextMonthButton():TextButton
+ {
+ return _nextMonthButton;
+ }
+
+ /**
+ * The array of DateChooserButton instances that represent each day of the month.
+ */
+ public function get dayButtons():Array
+ {
+ return _dayButtons;
+ }
+
+ /**
+ * @private
+ */
+ private function createChildren():void
+ {
+ _prevMonthButton = new TextButton();
+ _prevMonthButton.width = 40;
+ _prevMonthButton.height = 20;
+ _prevMonthButton.x = 0;
+ _prevMonthButton.y = 0;
+ _prevMonthButton.text = "<";
+ UIBase(_strand).addElement(_prevMonthButton);
+
+ _nextMonthButton = new TextButton();
+ _nextMonthButton.width = 40;
+ _nextMonthButton.height = 20;
+ _nextMonthButton.x = UIBase(_strand).width - _nextMonthButton.width;
+ _nextMonthButton.y = 0;
+ _nextMonthButton.text = ">";
+ UIBase(_strand).addElement(_nextMonthButton);
+
+ monthLabel = new TextButton();
+ monthLabel.text = "Month Here";
+ monthLabel.width = 100;
+ monthLabel.height = 20;
+ monthLabel.x = (UIBase(_strand).width - monthLabel.width)/2;
+ monthLabel.y = 0;
+ UIBase(_strand).addElement(monthLabel);
+
+ dayContainer = new Container();
+ var tileLayout:TileLayout = new TileLayout();
+ dayContainer.addBead(tileLayout);
+ tileLayout.numColumns = 7;
+ dayContainer.x = 0;
+ dayContainer.y = monthLabel.y + monthLabel.height + 5;
+
+ var sw:Number = UIBase(_strand).width;
+ var sh:Number = UIBase(_strand).height;
+ trace("Strand's width x height is "+sw+" x "+sh);
+ dayContainer.width = sw;
+ dayContainer.height = sh - (monthLabel.height+5);
+
+ // the calendar has 7 columns with 6 rows, the first row are the day names
+ for(var i:int=0; i < 7; i++) {
+ var dayName:DateChooserButton = new DateChooserButton();
+ dayName.text = model.dayNames[i];
+ dayName.dayOfMonth = 0;
+ dayContainer.addElement(dayName);
+ }
+
+ _dayButtons = new Array();
+
+ for(i=0; i < 42; i++) {
+ var date:DateChooserButton = new DateChooserButton();
+ date.text = String(i+1);
+ dayContainer.addElement(date);
+ dayButtons.push(date);
+ }
+
+ UIBase(_strand).addElement(dayContainer);
+
+ IEventDispatcher(dayContainer).dispatchEvent( new Event("itemsCreated") );
+ IEventDispatcher(_strand).dispatchEvent( new Event("layoutNeeded") );
+ IEventDispatcher(dayContainer).dispatchEvent( new Event("layoutNeeded") );
+
+ updateCalendar();
+ }
+
+ /**
+ * @private
+ */
+ private function updateCalendar():void
+ {
+ monthLabel.text = model.monthNames[model.displayedMonth] + " " +
+ String(model.displayedYear);
+
+ var firstDay:Date = new Date(model.displayedYear,model.displayedMonth,1);
+
+ // blank out the labels for the first firstDay.day-1 entries.
+ for(var i:int=0; i < firstDay.getDay(); i++) {
+ var dateButton:DateChooserButton = dayButtons[i] as DateChooserButton;
+ dateButton.dayOfMonth = -1;
+ dateButton.text = "";
+ }
+
+ // renumber to the last day of the month
+ var dayNumber:int = 1;
+ var numDays:Number = numberOfDaysInMonth(model.displayedMonth, model.displayedYear);
+
+ for(; i < dayButtons.length && dayNumber <= numDays; i++) {
+ dateButton = dayButtons[i] as DateChooserButton;
+ dateButton.dayOfMonth = dayNumber;
+ dateButton.text = String(dayNumber++);
+ }
+
+ // blank out the rest
+ for(; i < dayButtons.length; i++) {
+ dateButton = dayButtons[i] as DateChooserButton;
+ dateButton.dayOfMonth = -1;
+ dateButton.text = "";
+ }
+ }
+
+ /**
+ * @private
+ */
+ private function numberOfDaysInMonth(month:Number, year:Number):Number
+ {
+ var n:int;
+
+ if (month == 1) // Feb
+ {
+ if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) // leap year
+ n = 29;
+ else
+ n = 28;
+ }
+
+ else if (month == 3 || month == 5 || month == 8 || month == 10)
+ n = 30;
+
+ else
+ n = 31;
+
+ return n;
+ }
+
+ /**
+ * @private
+ */
+ private function handleModelChange(event:Event):void
+ {
+ updateCalendar();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/beads/DateFieldView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/beads/DateFieldView.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/beads/DateFieldView.as
new file mode 100644
index 0000000..6a9008d
--- /dev/null
+++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/beads/DateFieldView.as
@@ -0,0 +1,187 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 org.apache.flex.html.staticControls.beads
+{
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IDateChooserModel;
+ import org.apache.flex.core.IFormatBead;
+ import org.apache.flex.core.IParent;
+ import org.apache.flex.core.IPopUpHost;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.utils.UIUtils;
+ import org.apache.flex.html.staticControls.DateChooser;
+ import org.apache.flex.html.staticControls.TextButton;
+ import org.apache.flex.html.staticControls.TextInput;
+
+ /**
+ * The DateFieldView class is a bead for DateField that creates the
+ * input and button controls. This class also handles the pop-up
+ * mechanics.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DateFieldView implements IBeadView
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DateFieldView()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ private var _textInput:TextInput;
+ private var _button:TextButton;
+
+ /**
+ * The TextButton that triggers the display of the DateChooser pop-up.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get menuButton():TextButton
+ {
+ return _button;
+ }
+
+ /**
+ * The TextInput that displays the date selected.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get textInput():TextInput
+ {
+ return _textInput;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ _textInput = new TextInput();
+ UIBase(_strand).addElement(_textInput);
+ _textInput.width = 100;
+ _textInput.height = 18;
+
+ _button = new TextButton();
+ _button.text = "M";
+ UIBase(_strand).addElement(_button);
+ _button.x = _textInput.width;
+ _button.y = _textInput.y;
+
+ IEventDispatcher(_strand).addEventListener("beadsAdded",handleBeadsAdded);
+ }
+
+ private function handleBeadsAdded(event:Event):void
+ {
+ var formatter:IFormatBead = _strand.getBeadByType(IFormatBead) as IFormatBead;
+ formatter.addEventListener("formatChanged",handleFormatChanged);
+ }
+
+ private function handleFormatChanged(event:Event):void
+ {
+ var formatter:IFormatBead = event.target as IFormatBead;
+ _textInput.text = formatter.formattedString;
+ }
+
+ private var _popUp:DateChooser;
+
+ /**
+ * The pop-up component that holds the selection list.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get popUp():DateChooser
+ {
+ return _popUp;
+ }
+
+ private var _popUpVisible:Boolean;
+
+ /**
+ * This property is true if the pop-up selection list is currently visible.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get popUpVisible():Boolean
+ {
+ return _popUpVisible;
+ }
+ public function set popUpVisible(value:Boolean):void
+ {
+ if (value != _popUpVisible)
+ {
+ _popUpVisible = value;
+ if (value)
+ {
+ if (!_popUp)
+ {
+ _popUp = new DateChooser();
+ _popUp.width = 210;
+ _popUp.height = 220;
+ _popUp.x = UIBase(_strand).x;
+ _popUp.y = UIBase(_strand).y + 30;
+ }
+
+ var model:IDateChooserModel = _strand.getBeadByType(IDateChooserModel) as IDateChooserModel;
+ _popUp.selectedDate = model.selectedDate;
+
+ var host:IPopUpHost = UIUtils.findPopUpHost(UIBase(_strand));
+ host.addElement(_popUp);
+ }
+ else
+ {
+ UIUtils.removePopUp(_popUp);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/beads/FormatableLabelView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/beads/FormatableLabelView.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/beads/FormatableLabelView.as
new file mode 100644
index 0000000..1fc8e1a
--- /dev/null
+++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/beads/FormatableLabelView.as
@@ -0,0 +1,90 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 org.apache.flex.html.staticControls.beads
+{
+ import org.apache.flex.core.IFormatBead;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The FormatableLabelView class is a View bead that is capable of working
+ * with a format bead to display a formatted value. When the format bead has
+ * created a formatted string, it dispatches a formatChanged event that the
+ * FormatableLabelView class intercepts and displays in the label.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class FormatableLabelView extends TextFieldView
+ {
+ /**
+ * constructor
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function FormatableLabelView()
+ {
+ super();
+ }
+
+ private var _formatter:IFormatBead;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+ IEventDispatcher(value).addEventListener("beadsAdded",handleBeadsAdded);
+ }
+
+ /**
+ * @private
+ */
+ private function handleBeadsAdded(event:Event):void
+ {
+ _formatter = strand.getBeadByType(IFormatBead) as IFormatBead;
+ _formatter.addEventListener("formatChanged",formatReadyHandler);
+
+ // process any text set in the label at this moment
+ text = _formatter.formattedString;
+ }
+
+ /**
+ * @private
+ */
+ private function formatReadyHandler(event:Event):void
+ {
+ if (_formatter) {
+ text = _formatter.formattedString;
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/beads/FormatableTextInputView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/beads/FormatableTextInputView.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/beads/FormatableTextInputView.as
new file mode 100644
index 0000000..66fcab4
--- /dev/null
+++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/beads/FormatableTextInputView.as
@@ -0,0 +1,89 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 org.apache.flex.html.staticControls.beads
+{
+ import org.apache.flex.core.IFormatBead;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The FormatableTextInputView class is a View bead that extends TextInputWithBorderView
+ * and is capable of working with a format bead. When a format bead dispatches a
+ * formatChanged event, the FormatableTextInputView bead copies the formatted string to
+ * to the text field.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class FormatableTextInputView extends TextInputWithBorderView
+ {
+ /**
+ * constructor
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function FormatableTextInputView()
+ {
+ super();
+ }
+
+ private var _formatter:IFormatBead;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+ IEventDispatcher(value).addEventListener("beadsAdded",handleBeadsAdded);
+ }
+
+ /**
+ * @private
+ */
+ private function handleBeadsAdded(event:Event):void
+ {
+ _formatter = strand.getBeadByType(IFormatBead) as IFormatBead;
+ _formatter.addEventListener("formatChanged",formatChangedHandler);
+ }
+
+ /**
+ * @private
+ */
+ private function formatChangedHandler(event:Event):void
+ {
+ this.textField.text = _formatter.formattedString;
+
+ // move the cursor to the end
+ var l:int = this.textField.text.length;
+ this.textField.setSelection(l,l);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2380008e/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/beads/controllers/DateChooserMouseController.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/beads/controllers/DateChooserMouseController.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/beads/controllers/DateChooserMouseController.as
new file mode 100644
index 0000000..69343eb
--- /dev/null
+++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/staticControls/beads/controllers/DateChooserMouseController.as
@@ -0,0 +1,126 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 org.apache.flex.html.staticControls.beads.controllers
+{
+ import org.apache.flex.html.staticControls.beads.DateChooserView;
+ import org.apache.flex.html.staticControls.beads.models.DateChooserModel;
+ import org.apache.flex.html.staticControls.supportClasses.DateChooserButton;
+
+ import org.apache.flex.core.IBeadController;
+ import org.apache.flex.core.IBeadModel;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The DateChooserMouseController class is responsible for listening to
+ * mouse event related to the DateChooser. Events such as selecting a date
+ * or changing the calendar.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DateChooserMouseController implements IBeadController
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DateChooserMouseController()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ var view:DateChooserView = value.getBeadByType(IBeadView) as DateChooserView;
+ view.prevMonthButton.addEventListener("click", prevMonthClickHandler);
+ view.nextMonthButton.addEventListener("click", nextMonthClickHandler);
+
+ var dayButtons:Array = view.dayButtons;
+ for(var i:int=0; i < dayButtons.length; i++) {
+ IEventDispatcher(dayButtons[i]).addEventListener("click", dayButtonClickHandler);
+ }
+ }
+
+ /**
+ * @private
+ */
+ private function prevMonthClickHandler(event:Event):void
+ {
+ var model:DateChooserModel = _strand.getBeadByType(IBeadModel) as DateChooserModel;
+ var month:Number = model.displayedMonth - 1;
+ var year:Number = model.displayedYear;
+ if (month < 0) {
+ month = 11;
+ year--;
+ }
+ model.displayedMonth = month;
+ model.displayedYear = year;
+ }
+
+ /**
+ * @private
+ */
+ private function nextMonthClickHandler(event:Event):void
+ {
+ var model:DateChooserModel = _strand.getBeadByType(IBeadModel) as DateChooserModel;
+ var month:Number = model.displayedMonth + 1;
+ var year:Number = model.displayedYear;
+ if (month >= 12) {
+ month = 0;
+ year++;
+ }
+ model.displayedMonth = month;
+ model.displayedYear = year;
+ }
+
+ /**
+ * @private
+ */
+ private function dayButtonClickHandler(event:Event):void
+ {
+ var dateButton:DateChooserButton = event.target as DateChooserButton;
+ if (dateButton.dayOfMonth > 0) {
+ var model:DateChooserModel = _strand.getBeadByType(IBeadModel) as DateChooserModel;
+ var newDate:Date = new Date(model.displayedYear,model.displayedMonth,dateButton.dayOfMonth);
+ model.selectedDate = newDate;
+ IEventDispatcher(_strand).dispatchEvent( new Event("change") );
+ }
+ }
+ }
+}
\ No newline at end of file