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/02/20 17:44:37 UTC
[1/2] git commit: [flex-asjs] [refs/heads/develop] - Adding
DateChooserExample. Cross-compile step fails when compile generates faulty
type declarations.
Repository: flex-asjs
Updated Branches:
refs/heads/develop e3ef83eed -> b1c546be3
Adding DateChooserExample. Cross-compile step fails when compile generates faulty type declarations.
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/3c678607
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/3c678607
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/3c678607
Branch: refs/heads/develop
Commit: 3c67860718d64b6630b4d02321675c5b50236330
Parents: e3ef83e
Author: Peter Ent <pe...@apache.org>
Authored: Thu Feb 20 11:41:14 2014 -0500
Committer: Peter Ent <pe...@apache.org>
Committed: Thu Feb 20 11:41:14 2014 -0500
----------------------------------------------------------------------
examples/DateChooserExample/build.xml | 47 ++++
.../src/DateChooserExample.mxml | 36 +++
.../DateChooserExample/src/MyInitialView.mxml | 51 ++++
.../flex/html/staticControls/DateChooser.as | 75 ++++++
.../staticControls/beads/DateChooserView.as | 253 +++++++++++++++++++
.../controllers/DateChooserMouseController.as | 126 +++++++++
.../beads/models/DateChooserModel.as | 186 ++++++++++++++
.../supportClasses/DateChooserButton.as | 67 +++++
8 files changed, 841 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/3c678607/examples/DateChooserExample/build.xml
----------------------------------------------------------------------
diff --git a/examples/DateChooserExample/build.xml b/examples/DateChooserExample/build.xml
new file mode 100644
index 0000000..ac351a5
--- /dev/null
+++ b/examples/DateChooserExample/build.xml
@@ -0,0 +1,47 @@
+<?xml version="1.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.
+
+-->
+
+
+<project name="datechooserexample" default="main" basedir=".">
+ <property name="FLEXJS_HOME" location="../.."/>
+ <property name="example" value="DateChooserExample" />
+
+ <property file="${FLEXJS_HOME}/env.properties"/>
+ <property environment="env"/>
+ <property file="${FLEXJS_HOME}/build.properties"/>
+ <property name="FLEX_HOME" value="${FLEXJS_HOME}"/>
+ <property name="FALCON_HOME" value="${env.FALCON_HOME}"/>
+ <property name="FALCONJX_HOME" value="${env.FALCONJX_HOME}"/>
+ <property name="GOOG_HOME" value="${env.GOOG_HOME}"/>
+
+ <include file="${basedir}/../build_example.xml" />
+
+ <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" />
+ <delete dir="${basedir}/bin-debug" failonerror="false" />
+ <delete dir="${basedir}/bin-release" failonerror="false" />
+ </target>
+
+
+
+</project>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/3c678607/examples/DateChooserExample/src/DateChooserExample.mxml
----------------------------------------------------------------------
diff --git a/examples/DateChooserExample/src/DateChooserExample.mxml b/examples/DateChooserExample/src/DateChooserExample.mxml
new file mode 100644
index 0000000..13363db
--- /dev/null
+++ b/examples/DateChooserExample/src/DateChooserExample.mxml
@@ -0,0 +1,36 @@
+<?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:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:local="*"
+ xmlns:models="models.*"
+ xmlns:basic="library://ns.apache.org/flexjs/basic"
+ >
+
+ <basic:valuesImpl>
+ <basic:SimpleCSSValuesImpl />
+ </basic:valuesImpl>
+ <!--<basic:model>
+ <models:ProductsModel />
+ </basic:model>-->
+ <basic:initialView>
+ <local:MyInitialView />
+ </basic:initialView>
+</basic:Application>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/3c678607/examples/DateChooserExample/src/MyInitialView.mxml
----------------------------------------------------------------------
diff --git a/examples/DateChooserExample/src/MyInitialView.mxml b/examples/DateChooserExample/src/MyInitialView.mxml
new file mode 100644
index 0000000..55634a7
--- /dev/null
+++ b/examples/DateChooserExample/src/MyInitialView.mxml
@@ -0,0 +1,51 @@
+<?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: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.*">
+ <fx:Script>
+ <![CDATA[
+
+
+ private function dateChanged():void
+ {
+ trace("Selected date: "+dateChooser.selectedDate);
+ output.text = String(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:ViewBase>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/3c678607/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
new file mode 100644
index 0000000..cdb3f06
--- /dev/null
+++ b/examples/DateChooserExample/src/org/apache/flex/html/staticControls/DateChooser.as
@@ -0,0 +1,75 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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/3c678607/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
new file mode 100644
index 0000000..f8b32e8
--- /dev/null
+++ b/examples/DateChooserExample/src/org/apache/flex/html/staticControls/beads/DateChooserView.as
@@ -0,0 +1,253 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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/3c678607/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
new file mode 100644
index 0000000..69343eb
--- /dev/null
+++ b/examples/DateChooserExample/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
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/3c678607/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
new file mode 100644
index 0000000..ac9acaf
--- /dev/null
+++ b/examples/DateChooserExample/src/org/apache/flex/html/staticControls/beads/models/DateChooserModel.as
@@ -0,0 +1,186 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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/3c678607/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
new file mode 100644
index 0000000..70c7606
--- /dev/null
+++ b/examples/DateChooserExample/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
[2/2] git commit: [flex-asjs] [refs/heads/develop] - Removed build
step that would fail and placed it into a comment block.
Posted by pe...@apache.org.
Removed build step that would fail and placed it into a comment block.
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/b1c546be
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/b1c546be
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/b1c546be
Branch: refs/heads/develop
Commit: b1c546be38583c18c601060b2517689c7ab59ff8
Parents: 3c67860
Author: Peter Ent <pe...@apache.org>
Authored: Thu Feb 20 11:44:24 2014 -0500
Committer: Peter Ent <pe...@apache.org>
Committed: Thu Feb 20 11:44:24 2014 -0500
----------------------------------------------------------------------
examples/DateChooserExample/build.xml | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b1c546be/examples/DateChooserExample/build.xml
----------------------------------------------------------------------
diff --git a/examples/DateChooserExample/build.xml b/examples/DateChooserExample/build.xml
index ac351a5..15470b1 100644
--- a/examples/DateChooserExample/build.xml
+++ b/examples/DateChooserExample/build.xml
@@ -33,8 +33,12 @@
<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" />