Add a few Apache Flex 4.10 examples
Project: http://git-wip-us.apache.org/repos/asf/flex-utilities/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-utilities/commit/c7f5a333 Tree: http://git-wip-us.apache.org/repos/asf/flex-utilities/tree/c7f5a333 Diff: http://git-wip-us.apache.org/repos/asf/flex-utilities/diff/c7f5a333 Branch: refs/heads/develop Commit: c7f5a333c9a8d98e01e525089e32bc80b017f86d Parents: 3aca3c9 Author: Justin Mclean <jmcl...@apache.org> Authored: Mon Aug 25 21:22:38 2014 +1000 Committer: Justin Mclean <jmcl...@apache.org> Committed: Mon Aug 25 21:22:38 2014 +1000 ---------------------------------------------------------------------- TourDeFlex/TourDeFlex3/build.xml | 5 ++ .../src/apache/i18n/DateExample.mxml | 84 ++++++++++++++++++++ .../src/apache/i18n/MillisecondExample.mxml | 57 +++++++++++++ .../src/apache/i18n/NumericStepperExample.mxml | 34 ++++++++ .../src/apache/i18n/ScientificExample.mxml | 44 ++++++++++ .../src/apache/i18n/TimeZoneExample.mxml | 67 ++++++++++++++++ TourDeFlex/TourDeFlex3/src/explorer.xml | 9 ++- 7 files changed, 298 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/c7f5a333/TourDeFlex/TourDeFlex3/build.xml ---------------------------------------------------------------------- diff --git a/TourDeFlex/TourDeFlex3/build.xml b/TourDeFlex/TourDeFlex3/build.xml index 3ff61b4..a9f0916 100644 --- a/TourDeFlex/TourDeFlex3/build.xml +++ b/TourDeFlex/TourDeFlex3/build.xml @@ -410,6 +410,11 @@ <compile-mxml example="/apache/formatters/PostCodeFormatterExample"/> <compile-mxml example="/apache/validators/PostCodeValidatorExample"/> <compile-mxml-locales example="/apache/i18n/LocaleExample"/> + <compile-mxml example="/apache/i18n/DateExample"/> + <compile-mxml example="/apache/i18n/TimeZoneExample"/> + <compile-mxml example="/apache/i18n/MillisecondExample"/> + <compile-mxml example="/apache/i18n/ScientificExample"/> + <compile-mxml example="/apache/i18n/NumericStepperExample"/> </target> <target name="package" description="package up all source files" depends="package-dir,package-tar,package-zip"> http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/c7f5a333/TourDeFlex/TourDeFlex3/src/apache/i18n/DateExample.mxml ---------------------------------------------------------------------- diff --git a/TourDeFlex/TourDeFlex3/src/apache/i18n/DateExample.mxml b/TourDeFlex/TourDeFlex3/src/apache/i18n/DateExample.mxml new file mode 100644 index 0000000..6c40b4c --- /dev/null +++ b/TourDeFlex/TourDeFlex3/src/apache/i18n/DateExample.mxml @@ -0,0 +1,84 @@ +<?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. + +--> +<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" + xmlns:s="library://ns.adobe.com/flex/spark" + xmlns:mx="library://ns.adobe.com/flex/mx"> + <fx:Script> + <![CDATA[ + import mx.formatters.DateFormatter; + + private var formatter:DateFormatter; + + protected function formatDate(event:Event):void + { + formatter = new DateFormatter(); + + if (int1.selected) { + formatter.formatString = "DD/MM/YYYY"; + } + else if (int2.selected) { + formatter.formatString = "D/M/YYYY"; + } + else if (int3.selected) { + formatter.formatString = "D.M.YYYY"; + } + else if (jap.selected) { + formatter.formatString = "YYYYå¹´MMæDDæ¥"; + } + else if (chi.selected) { + formatter.formatString = "YYYYå¹´MMæDDæ¥"; + } + else if (kor.selected) { + formatter.formatString = "YYYYë MMì DDì¼"; + } + + formatted.text = formatter.format(date.selectedDate); + parsed.text = DateFormatter.parseDateString(formatted.text, formatter.formatString).toString(); + } + ]]> + </fx:Script> + + <s:Panel title="International Date Formating" width="100%" height="100%" borderAlpha="0.15"> + <s:layout> + <s:VerticalLayout paddingLeft="20" paddingTop="20" gap="10" /> + </s:layout> + <s:HGroup verticalAlign="middle"> + <s:Label text="Date" /> + <mx:DateField id="date" change="formatDate(event)" /> + </s:HGroup> + <s:HGroup verticalAlign="middle"> + <s:Label text="Date Format" /> + <s:RadioButton id="int1" label="DD/MM/YYYY" selected="true" click="formatDate(event)" /> + <s:RadioButton id="int2" label="D/M/YYYY" click="formatDate(event)" /> + <s:RadioButton id="int3" label="D.M.YYYY" click="formatDate(event)" /> + <s:RadioButton id="jap" label="Japanese" click="formatDate(event)" /> + <s:RadioButton id="chi" label="Chinese" click="formatDate(event)" /> + <s:RadioButton id="kor" label="Korean" click="formatDate(event)" /> + </s:HGroup> + <s:HGroup> + <s:Label text="Formatted Date" /> + <s:Label id="formatted" /> + </s:HGroup> + <s:HGroup> + <s:Label text="Parsed Date String" /> + <s:Label id="parsed" /> + </s:HGroup> + </s:Panel> +</s:Application> http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/c7f5a333/TourDeFlex/TourDeFlex3/src/apache/i18n/MillisecondExample.mxml ---------------------------------------------------------------------- diff --git a/TourDeFlex/TourDeFlex3/src/apache/i18n/MillisecondExample.mxml b/TourDeFlex/TourDeFlex3/src/apache/i18n/MillisecondExample.mxml new file mode 100644 index 0000000..2164b65 --- /dev/null +++ b/TourDeFlex/TourDeFlex3/src/apache/i18n/MillisecondExample.mxml @@ -0,0 +1,57 @@ +<?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. + +--> +<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" + xmlns:s="library://ns.adobe.com/flex/spark" + xmlns:mx="library://ns.adobe.com/flex/mx" + initialize="init(event)"> + <fx:Script> + <![CDATA[ + import mx.events.FlexEvent; + import mx.formatters.DateFormatter; + + private var formatter:DateFormatter; + private var timer:Timer = new Timer(20); + + protected function formatDate(event:TimerEvent):void + { + formatted.text = formatter.format(new Date()); + } + + protected function init(event:FlexEvent):void + { + formatter = new DateFormatter(); + formatter.formatString = "DD/MM/YYYY H:NN:SS QQQ"; + + timer.addEventListener(TimerEvent.TIMER, formatDate); + timer.start(); + } + ]]> + </fx:Script> + + <s:Panel title="Millisecond Format" width="100%" height="100%" borderAlpha="0.15"> + <s:layout> + <s:VerticalLayout paddingLeft="20" paddingTop="20" gap="10" /> + </s:layout> + <s:HGroup> + <s:Label text="Formatted Date" /> + <s:Label id="formatted" /> + </s:HGroup> + </s:Panel> +</s:Application> http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/c7f5a333/TourDeFlex/TourDeFlex3/src/apache/i18n/NumericStepperExample.mxml ---------------------------------------------------------------------- diff --git a/TourDeFlex/TourDeFlex3/src/apache/i18n/NumericStepperExample.mxml b/TourDeFlex/TourDeFlex3/src/apache/i18n/NumericStepperExample.mxml new file mode 100644 index 0000000..17f6a31 --- /dev/null +++ b/TourDeFlex/TourDeFlex3/src/apache/i18n/NumericStepperExample.mxml @@ -0,0 +1,34 @@ +<?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. + +--> +<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" + xmlns:s="library://ns.adobe.com/flex/spark" + xmlns:mx="library://ns.adobe.com/flex/mx" + locale="en_ES"> + + <s:Panel title="European Numeric Stepper" width="100%" height="100%" borderAlpha="0.15"> + <s:layout> + <s:VerticalLayout paddingLeft="20" paddingTop="20" gap="10" /> + </s:layout> + <s:HGroup verticalAlign="middle"> + <s:Label text="Number" /> + <s:NumericStepper maximum="10" snapInterval="0.05" stepSize="0.05" /> + </s:HGroup> +</s:Panel> +</s:Application> http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/c7f5a333/TourDeFlex/TourDeFlex3/src/apache/i18n/ScientificExample.mxml ---------------------------------------------------------------------- diff --git a/TourDeFlex/TourDeFlex3/src/apache/i18n/ScientificExample.mxml b/TourDeFlex/TourDeFlex3/src/apache/i18n/ScientificExample.mxml new file mode 100644 index 0000000..2c69ad0 --- /dev/null +++ b/TourDeFlex/TourDeFlex3/src/apache/i18n/ScientificExample.mxml @@ -0,0 +1,44 @@ +<?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. + +--> +<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" + xmlns:s="library://ns.adobe.com/flex/spark" + xmlns:mx="library://ns.adobe.com/flex/mx"> + <fx:Declarations> + <mx:CurrencyFormatter id="amount" /> + </fx:Declarations> + + <s:Panel title="Scientific Notation" width="100%" height="100%" borderAlpha="0.15"> + <s:layout> + <s:VerticalLayout paddingLeft="20" paddingTop="20" gap="10" /> + </s:layout> + <s:HGroup verticalAlign="middle"> + <s:Label text="Number" /> + <s:Label text="1.23e02" /> + <s:Label text="Formatted" /> + <s:Label text="{amount.format('1.23e2')}" /> + </s:HGroup> + <s:HGroup verticalAlign="middle"> + <s:Label text="Number" /> + <s:Label text="1.23e-1" /> + <s:Label text="Formatted" /> + <s:Label text="{amount.format('1.23e-2')}" /> + </s:HGroup> +</s:Panel> +</s:Application> http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/c7f5a333/TourDeFlex/TourDeFlex3/src/apache/i18n/TimeZoneExample.mxml ---------------------------------------------------------------------- diff --git a/TourDeFlex/TourDeFlex3/src/apache/i18n/TimeZoneExample.mxml b/TourDeFlex/TourDeFlex3/src/apache/i18n/TimeZoneExample.mxml new file mode 100644 index 0000000..0227dcc --- /dev/null +++ b/TourDeFlex/TourDeFlex3/src/apache/i18n/TimeZoneExample.mxml @@ -0,0 +1,67 @@ +<?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. + +--> +<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" + xmlns:s="library://ns.adobe.com/flex/spark" + xmlns:mx="library://ns.adobe.com/flex/mx"> + <fx:Script> + <![CDATA[ + import mx.formatters.DateFormatter; + + private var formatter:DateFormatter; + + protected function formatDate(event:Event):void + { + formatter = new DateFormatter(); + + if (format1.selected) { + formatter.formatString = "DD/MM/YYYY ZO"; + } + else if (format2.selected) { + formatter.formatString = "DD/MM/YYYY ZOO"; + } + else if (format3.selected) { + formatter.formatString = "DD/MM/YYYY ZOOO"; + } + + formatted.text = formatter.format(date.selectedDate); + } + ]]> + </fx:Script> + + <s:Panel title="Timezone Formating" width="100%" height="100%" borderAlpha="0.15"> + <s:layout> + <s:VerticalLayout paddingLeft="20" paddingTop="20" gap="10" /> + </s:layout> + <s:HGroup verticalAlign="middle"> + <s:Label text="Date" /> + <mx:DateField id="date" change="formatDate(event)" /> + </s:HGroup> + <s:HGroup verticalAlign="middle"> + <s:Label text="Date Format" /> + <s:RadioButton id="format1" label="DD/MM/YYYY ZO" selected="true" click="formatDate(event)" /> + <s:RadioButton id="format2" label="DD/MM/YYYY ZOO" click="formatDate(event)"/> + <s:RadioButton id="format3" label="DD/MM/YYYY ZOOO" click="formatDate(event)"/> + </s:HGroup> + <s:HGroup> + <s:Label text="Formatted Date" /> + <s:Label id="formatted" /> + </s:HGroup> + </s:Panel> +</s:Application> http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/c7f5a333/TourDeFlex/TourDeFlex3/src/explorer.xml ---------------------------------------------------------------------- diff --git a/TourDeFlex/TourDeFlex3/src/explorer.xml b/TourDeFlex/TourDeFlex3/src/explorer.xml index 8946f1d..944daf6 100755 --- a/TourDeFlex/TourDeFlex3/src/explorer.xml +++ b/TourDeFlex/TourDeFlex3/src/explorer.xml @@ -444,13 +444,18 @@ <!-- Add more examples here --> </node> <node label="Apache Flex 4.9" app="apache/ApacheFlex4_9_0"> - <!-- Add examples here --> + <!-- Add more examples here --> <compile-mxml label="PostCodeFormatter" app="apache/formatters/PostCodeFormatterExample"/> <compile-mxml label="PostCodeValidator" app="apache/validators/PostCodeValidatorExample"/> <compile-mxml label="New SDK locales" app="apache/i18n/LocaleExample"/> </node> <node label="Apache Flex 4.10" app="apache/ApacheFlex4_10_0"> - <!-- Add examples here --> + <!-- Add more examples here --> + <compile-mxml label="International Dates" app="apache/i18n/DateExample"/> + <compile-mxml label="Millisecond Formatting" app="apache/i18n/MillisecondExample"/> + <compile-mxml label="NumberStepper" app="apache/i18n/NumericStepperExample"/> + <compile-mxml label="Scientific Notation Formatting" app="apache/i18n/ScientificExample"/> + <compile-mxml label="Timezone Formatting" app="apache/i18n/TimezoneExample"/> </node> <node label="Apache Flex 4.11" app="apache/ApacheFlex4_11_0"> <!-- Add examples here -->