This is an automated email from the ASF dual-hosted git repository. carlosrovira pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/develop by this push: new 2df1f37 Jewel DateChooser & DateField components 2df1f37 is described below commit 2df1f3768e61e30309e0a450fdd42148599ef12a Author: Carlos Rovira <carlosrov...@apache.org> AuthorDate: Sat Jul 28 20:19:08 2018 +0200 Jewel DateChooser & DateField components --- examples/royale/JewelExample/pom.xml | 14 + .../src/main/royale/DateComponentsPlayGround.mxml | 43 +++- .../JewelExample/src/main/royale/MainContent.mxml | 11 +- .../src/main/royale/TextInputPlayGround.mxml | 9 +- .../src/main/royale/models/MainNavigationModel.as | 1 + .../projects/Jewel/src/main/resources/defaults.css | 54 +++- .../projects/Jewel/src/main/royale/JewelClasses.as | 10 + .../royale/core/IListWithPresentationModel.as | 47 ++++ .../org/apache/royale/jewel/DataContainer.as | 135 ++++++++++ .../royale/org/apache/royale/jewel/DateChooser.as | 76 ++++++ .../royale/org/apache/royale/jewel/DateField.as | 101 ++++++++ .../controllers/DateChooserMouseController.as | 122 +++++++++ .../beads/controllers/DateFieldMouseController.as | 165 ++++++++++++ .../beads/itemRenderers/DataFieldProviderBead.as | 87 +++++++ .../DataItemRendererFactoryForArrayData.as | 207 +++++++++++++++ .../jewel/beads/itemRenderers/ITextItemRenderer.as | 45 ++++ .../royale/jewel/beads/models/DataProviderModel.as | 117 +++++++++ .../royale/jewel/beads/models/DateChooserModel.as | 281 +++++++++++++++++++++ .../royale/jewel/beads/views/DateChooserView.as | 266 +++++++++++++++++++ .../royale/jewel/beads/views/DateFieldView.as | 241 ++++++++++++++++++ .../royale/jewel/itemRenderers/DateItemRenderer.as | 104 ++++++++ .../jewel/itemRenderers/DayNameItemRenderer.as | 81 ++++++ .../jewel/itemRenderers/StringItemRenderer.as | 170 +++++++++++++ .../jewel/supportClasses/DateChooserHeader.as | 64 +++++ .../royale/jewel/supportClasses/DateChooserList.as | 38 +++ .../jewel/supportClasses/util/getLabelFromData.as | 41 +++ .../projects/Jewel/src/main/sass/_global.sass | 10 + .../src/main/sass/components/_datechooser.sass | 60 +++++ .../Jewel/src/main/sass/components/_datefield.sass | 33 +++ .../projects/Jewel/src/main/sass/defaults.sass | 4 +- .../JewelTheme/src/main/resources/defaults.css | 20 ++ .../main/sass/components-primary/_datechooser.sass | 42 +++ .../main/sass/components-primary/_datefield.sass | 26 ++ .../themes/JewelTheme/src/main/sass/defaults.sass | 2 + 34 files changed, 2705 insertions(+), 22 deletions(-) diff --git a/examples/royale/JewelExample/pom.xml b/examples/royale/JewelExample/pom.xml index cf6c1d9..4d38582 100644 --- a/examples/royale/JewelExample/pom.xml +++ b/examples/royale/JewelExample/pom.xml @@ -60,6 +60,20 @@ </dependency> <dependency> <groupId>org.apache.royale.framework</groupId> + <artifactId>Formatters</artifactId> + <version>0.9.3-SNAPSHOT</version> + <type>swc</type> + <classifier>js</classifier> + </dependency> + <dependency> + <groupId>org.apache.royale.framework</groupId> + <artifactId>Formatters</artifactId> + <version>0.9.3-SNAPSHOT</version> + <type>swc</type> + <classifier>swf</classifier> + </dependency> + <dependency> + <groupId>org.apache.royale.framework</groupId> <artifactId>Jewel</artifactId> <version>0.9.3-SNAPSHOT</version> <type>swc</type> diff --git a/examples/royale/JewelExample/src/main/royale/DateComponentsPlayGround.mxml b/examples/royale/JewelExample/src/main/royale/DateComponentsPlayGround.mxml index 2e09cea..abefbbf 100644 --- a/examples/royale/JewelExample/src/main/royale/DateComponentsPlayGround.mxml +++ b/examples/royale/JewelExample/src/main/royale/DateComponentsPlayGround.mxml @@ -23,17 +23,46 @@ limitations under the License. xmlns:html="library://ns.apache.org/royale/html"> <fx:Script> - <![CDATA[ - + <![CDATA[ + private function dateChooserChanged():void + { + dateChooserSelectedDate.text = "DateChooser selected date: " + dateChooser.selectedDate; + //dateField.selectedDate = dateChooser.selectedDate; + } + + private function dateFieldChanged():void + { + dateFieldSelectedDate.text = "DateField selected date: " + dateField.selectedDate; + //dateChooser.selectedDate = dateField.selectedDate; + } + + private function toToday():void + { + dateChooser.selectedDate = new Date(); + } + private function dateChooserInit():void + { + dateChooser.model.firstDayOfWeek = 1; + dateChooser.model.dayNames = ['S','M','T','W','T','F','S']; + } ]]> </fx:Script> - <j:Card width="350"> - - <html:H3 text="Jewel DateChooser"/> - - <j:DateChooser/> + <j:beads> + <j:HorizontalCenteredLayout gap="3"/> + </j:beads> + <j:Card width="400"> + <html:H3 text="Jewel DateChooser"/> + <j:DateChooser id="dateChooser" change="dateChooserChanged()" initComplete="dateChooserInit()"/> + <j:Label id="dateChooserSelectedDate" text="DateChooser selected date: "/> + </j:Card> + + <j:Card width="400"> + <html:H3 text="Jewel DateField"/> + <j:DateField id="dateField" change="dateFieldChanged()"/> + <j:Label id="dateFieldSelectedDate" text="DateField selected date: "/> + <j:Button text="Today!" click="toToday()"/> </j:Card> </j:SectionContent> diff --git a/examples/royale/JewelExample/src/main/royale/MainContent.mxml b/examples/royale/JewelExample/src/main/royale/MainContent.mxml index e3adad9..2aa1e26 100644 --- a/examples/royale/JewelExample/src/main/royale/MainContent.mxml +++ b/examples/royale/JewelExample/src/main/royale/MainContent.mxml @@ -18,11 +18,11 @@ limitations under the License. --> <j:ApplicationResponsiveView xmlns:fx="http://ns.adobe.com/mxml/2009" - xmlns:j="library://ns.apache.org/royale/jewel" - xmlns:js="library://ns.apache.org/royale/basic" - xmlns:html="library://ns.apache.org/royale/html" - xmlns:models="models.*" - xmlns:local="*"> + xmlns:j="library://ns.apache.org/royale/jewel" + xmlns:js="library://ns.apache.org/royale/basic" + xmlns:html="library://ns.apache.org/royale/html" + xmlns:models="models.*" + xmlns:local="*"> <fx:Script> <![CDATA[ @@ -112,6 +112,7 @@ limitations under the License. <local:WelcomeSection isActive="true"/> <local:AlertPlayGround id="alert_panel"/> <local:ButtonPlayGround id="button_panel"/> + <local:DateComponentsPlayGround id="datecomponents_panel"/> <local:DropDownListPlayGround id="dropdownlist_panel"/> <local:CheckBoxPlayGround id="checkbox_panel"/> <local:MiscelaneaPlayGound id="miscelanea_panel"/> diff --git a/examples/royale/JewelExample/src/main/royale/TextInputPlayGround.mxml b/examples/royale/JewelExample/src/main/royale/TextInputPlayGround.mxml index 2794daa..31cbadc 100644 --- a/examples/royale/JewelExample/src/main/royale/TextInputPlayGround.mxml +++ b/examples/royale/JewelExample/src/main/royale/TextInputPlayGround.mxml @@ -179,11 +179,14 @@ limitations under the License. </j:icon> </j:IconTextInput> - <!-- <j:IconTextInput text="Searching something"> + <j:IconTextInput text="Searching something"> + <j:beads> + <j:SizeControl size="xlarge"/> + </j:beads> <j:icon> - <js:FontIcon text="{MaterialIconType.SEARCH}" material="true" size="48"/> + <js:FontIcon text="{MaterialIconType.SEARCH}" material="true"/> </j:icon> - </j:IconTextInput> --> + </j:IconTextInput> </j:Card> </j:GridCell> </j:Grid> diff --git a/examples/royale/JewelExample/src/main/royale/models/MainNavigationModel.as b/examples/royale/JewelExample/src/main/royale/models/MainNavigationModel.as index 45dd3e0..b409561 100644 --- a/examples/royale/JewelExample/src/main/royale/models/MainNavigationModel.as +++ b/examples/royale/JewelExample/src/main/royale/models/MainNavigationModel.as @@ -27,6 +27,7 @@ package models private var _controlsDrawerNavigation:ArrayList = new ArrayList([ new NavigationLinkVO("Alert", "alert_panel", MaterialIconType.WEB_ASSET), new NavigationLinkVO("Button", "button_panel", MaterialIconType.CROP_7_5), + new NavigationLinkVO("Date Components", "datecomponents_panel", MaterialIconType.DATE_RANGE), new NavigationLinkVO("DropDownList", "dropdownlist_panel", MaterialIconType.CREDIT_CARD), new NavigationLinkVO("CheckBox", "checkbox_panel", MaterialIconType.CHECK_BOX), new NavigationLinkVO("Icon", "miscelanea_panel", MaterialIconType.FACE), diff --git a/frameworks/projects/Jewel/src/main/resources/defaults.css b/frameworks/projects/Jewel/src/main/resources/defaults.css index 89b1df3..9e9c8ae 100644 --- a/frameworks/projects/Jewel/src/main/resources/defaults.css +++ b/frameworks/projects/Jewel/src/main/resources/defaults.css @@ -79,6 +79,17 @@ j|Image { IBeadView: ClassReference("org.apache.royale.jewel.beads.views.ImageView"); } +j|DataContainer { + IBeadModel: ClassReference("org.apache.royale.jewel.beads.models.DataProviderModel"); + IBeadView: ClassReference("org.apache.royale.html.beads.DataContainerView"); + IBeadLayout: ClassReference("org.apache.royale.jewel.beads.layouts.VerticalLayout"); + IDataProviderItemRendererMapper: ClassReference("org.apache.royale.jewel.beads.itemRenderers.DataItemRendererFactoryForArrayData"); + IItemRendererClassFactory: ClassReference("org.apache.royale.core.ItemRendererClassFactory"); + IItemRenderer: ClassReference("org.apache.royale.jewel.itemRenderers.StringItemRenderer"); + IViewport: ClassReference("org.apache.royale.html.supportClasses.Viewport"); + IViewportModel: ClassReference("org.apache.royale.html.beads.models.ViewportModel"); +} + @media -royale-swf { j|Container { IContentView: ClassReference("org.apache.royale.core.supportClasses.ContainerContentArea"); @@ -230,6 +241,43 @@ j|ControlBar { IMeasurementBead: ClassReference("org.apache.royale.html.beads.ControlBarMeasurementBead"); } } +.calendar.item { + width: 36px; + height: 36px; + text-align: center; + padding: 10px; +} + +j|DateChooser { + IBeadModel: ClassReference("org.apache.royale.jewel.beads.models.DateChooserModel"); + IBeadView: ClassReference("org.apache.royale.jewel.beads.views.DateChooserView"); + IBeadLayout: ClassReference("org.apache.royale.jewel.beads.layouts.VerticalFlowLayout"); + IBeadController: ClassReference("org.apache.royale.jewel.beads.controllers.DateChooserMouseController"); +} + +j|DateChooserHeader { + IItemRenderer: ClassReference("org.apache.royale.jewel.itemRenderers.DayNameItemRenderer"); + IBeadLayout: ClassReference("org.apache.royale.jewel.beads.layouts.HorizontalLayout"); +} + +j|DateChooserList { + IItemRenderer: ClassReference("org.apache.royale.jewel.itemRenderers.DateItemRenderer"); + IBeadLayout: ClassReference("org.apache.royale.jewel.beads.layouts.HorizontalFlowLayout"); +} + +j|DateField { + IBeadView: ClassReference("org.apache.royale.jewel.beads.views.DateFieldView"); + IBeadModel: ClassReference("org.apache.royale.jewel.beads.models.DateChooserModel"); + IBeadController: ClassReference("org.apache.royale.jewel.beads.controllers.DateFieldMouseController"); + IFormatBead: ClassReference("org.apache.royale.html.accessories.DateFormatDDMMYYYY"); +} + +.jewel.divider { + height: 0; + margin: 0; + border: none; +} + .jewel.drawer.float { position: fixed; pointer-events: none; @@ -320,12 +368,6 @@ j|ControlBar { touch-action: pan-y; } -.jewel.divider { - height: 0; - margin: 0; - border: none; -} - @media -royale-swf { j|DropDownList { IBeadModel: ClassReference("org.apache.royale.html.beads.models.ArraySelectionModel"); diff --git a/frameworks/projects/Jewel/src/main/royale/JewelClasses.as b/frameworks/projects/Jewel/src/main/royale/JewelClasses.as index b786a4e..86dbfb4 100644 --- a/frameworks/projects/Jewel/src/main/royale/JewelClasses.as +++ b/frameworks/projects/Jewel/src/main/royale/JewelClasses.as @@ -33,8 +33,12 @@ package import org.apache.royale.jewel.beads.models.TitleBarModel; TitleBarModel; import org.apache.royale.jewel.beads.models.TextModel; TextModel; import org.apache.royale.jewel.beads.models.RangeModel; RangeModel; + import org.apache.royale.jewel.beads.models.DateChooserModel; DateChooserModel; + import org.apache.royale.jewel.beads.models.DataProviderModel; DataProviderModel; import org.apache.royale.jewel.beads.controllers.SliderMouseController; SliderMouseController; + import org.apache.royale.jewel.beads.controllers.DateChooserMouseController; DateChooserMouseController; + import org.apache.royale.jewel.beads.controllers.DateFieldMouseController; DateFieldMouseController; import org.apache.royale.jewel.beads.controllers.AlertController; AlertController; import org.apache.royale.jewel.beads.controllers.ListSingleSelectionMouseController; ListSingleSelectionMouseController; @@ -44,10 +48,16 @@ package import org.apache.royale.jewel.beads.views.TitleBarView; TitleBarView; import org.apache.royale.jewel.beads.views.AlertTitleBarView; AlertTitleBarView; import org.apache.royale.jewel.beads.views.ListView; ListView; + import org.apache.royale.jewel.beads.views.DateChooserView; DateChooserView; import org.apache.royale.jewel.beads.models.SingleSelectionCollectionViewModel; SingleSelectionCollectionViewModel; import org.apache.royale.jewel.beads.models.SingleSelectionArrayListModel; SingleSelectionArrayListModel; import org.apache.royale.jewel.supportClasses.ScrollingViewport; ScrollingViewport; + + import org.apache.royale.jewel.itemRenderers.StringItemRenderer; StringItemRenderer; + import org.apache.royale.jewel.itemRenderers.ListItemRenderer; ListItemRenderer; + import org.apache.royale.jewel.itemRenderers.DateItemRenderer; DateItemRenderer; + import org.apache.royale.jewel.itemRenderers.DayNameItemRenderer; DayNameItemRenderer; COMPILE::SWF { diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/core/IListWithPresentationModel.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/core/IListWithPresentationModel.as new file mode 100644 index 0000000..360a940 --- /dev/null +++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/core/IListWithPresentationModel.as @@ -0,0 +1,47 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.royale.core +{ + import org.apache.royale.core.IList + import org.apache.royale.core.IListPresentationModel; + + /** + * The IListWithPresentationModel interface is implemented by any IList + * that supports a separate IListPresentationModel + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.0 + */ + public interface IListWithPresentationModel extends IList + { + /** + * Returns the component within the list (maybe even the list shell itself) + * which will be the parent of each itemRenderer. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.0 + */ + function get presentationModel():IListPresentationModel; + + } +} diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/DataContainer.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/DataContainer.as new file mode 100644 index 0000000..cb4b5c4 --- /dev/null +++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/DataContainer.as @@ -0,0 +1,135 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.royale.jewel +{ + import org.apache.royale.core.DataContainerBase; + + import org.apache.royale.core.IDataProviderItemRendererMapper; + import org.apache.royale.core.IItemRenderer; + import org.apache.royale.core.IListWithPresentationModel; + import org.apache.royale.core.IListPresentationModel; + import org.apache.royale.core.IDataProviderModel; + import org.apache.royale.jewel.beads.models.ListPresentationModel; + + /** + * Indicates that the initialization of the list is complete. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.3 + */ + [Event(name="initComplete", type="org.apache.royale.events.Event")] + + /** + * The DataContainer class is a component that displays multiple data items. The DataContainer uses + * the following bead types: + * + * org.apache.royale.core.IBeadModel: the data model, which includes the dataProvider. + * org.apache.royale.core.IBeadView: the bead that constructs the visual parts of the list. + * org.apache.royale.core.IBeadController: the bead that handles input and output. + * org.apache.royale.core.IBeadLayout: the bead responsible for the size and position of the itemRenderers. + * org.apache.royale.core.IDataProviderItemRendererMapper: the bead responsible for creating the itemRenders. + * org.apache.royale.core.IItemRenderer: the class or factory used to display an item in the list. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.3 + */ + public class DataContainer extends DataContainerBase implements IListWithPresentationModel + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.3 + */ + public function DataContainer() + { + super(); + typeNames = ""; + } + + /** + * The name of field within the data used for display. Each item of the + * data should have a property with this name. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9 + * @royaleignorecoercion org.apache.royale.core.IDataProviderModel + */ + public function get labelField():String + { + return IDataProviderModel(model).labelField; + } + /** + * @royaleignorecoercion org.apache.royale.core.IDataProviderModel + */ + public function set labelField(value:String):void + { + IDataProviderModel(model).labelField = value; + } + + /** + * The data being display by the List. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9 + * @royaleignorecoercion org.apache.royale.core.IDataProviderModel + */ + public function get dataProvider():Object + { + return IDataProviderModel(model).dataProvider; + } + /** + * @royaleignorecoercion org.apache.royale.core.IDataProviderModel + */ + public function set dataProvider(value:Object):void + { + IDataProviderModel(model).dataProvider = value; + } + + + /** + * The presentation model for the list. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9 + * @royaleignorecoercion org.apache.royale.core.IListPresentationModel + */ + public function get presentationModel():IListPresentationModel + { + var presModel:IListPresentationModel = getBeadByType(IListPresentationModel) as IListPresentationModel; + if (presModel == null) { + presModel = new ListPresentationModel(); + addBead(presModel); + } + return presModel; + } + } +} diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/DateChooser.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/DateChooser.as new file mode 100644 index 0000000..df26a39 --- /dev/null +++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/DateChooser.as @@ -0,0 +1,76 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.royale.jewel +{ + import org.apache.royale.core.IDateChooserModel; + import org.apache.royale.jewel.Group; + + /** + * The change event is dispatched when the selectedDate is changed. + */ + [Event(name="change", type="org.apache.royale.events.Event")] + + /** + * The DateChooser class is a component that displays a calendar. + * + * @toplevel + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.3 + */ + public class DateChooser extends Group + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.3 + */ + public function DateChooser() + { + super(); + + typeNames = "jewel datechooser"; + + // default to today + selectedDate = new Date(); + } + + [Bindable("selectedDateChanged")] + /** + * The currently selected date (or null if no date has been selected). + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.3 + */ + public function get selectedDate():Date + { + return IDateChooserModel(model).selectedDate; + } + public function set selectedDate(value:Date):void + { + IDateChooserModel(model).selectedDate = value; + } + } +} diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/DateField.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/DateField.as new file mode 100644 index 0000000..6d5fad8 --- /dev/null +++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/DateField.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.royale.jewel +{ + import org.apache.royale.core.StyledUIBase; + import org.apache.royale.core.IDateChooserModel; + import org.apache.royale.core.IFormatBead; + import org.apache.royale.events.Event; + import org.apache.royale.utils.loadBeadFromValuesManager; + + COMPILE::JS + { + import org.apache.royale.core.WrappedHTMLElement; + import org.apache.royale.html.util.addElementToWrapper; + } + + /** + * The change event is dispatched when the selectedDate is changed. + */ + [Event(name="change", type="org.apache.royale.events.Event")] + + /** + * 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. + * + * @toplevel + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.3 + */ + public class DateField extends StyledUIBase + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.3 + */ + public function DateField() + { + super(); + + typeNames = "jewel 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 Royale 0.9.3 + */ + override public function addedToParent():void + { + super.addedToParent(); + loadBeadFromValuesManager(IFormatBead, "iFormatBead", this); + + dispatchEvent(new Event("initComplete")); + } + + [Bindable("selectedDateChanged")] + /** + * The currently selected date (or null if no date has been selected). + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.3 + */ + public function get selectedDate():Date + { + return IDateChooserModel(model).selectedDate; + } + public function set selectedDate(value:Date):void + { + IDateChooserModel(model).selectedDate = value; + } + } +} diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controllers/DateChooserMouseController.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controllers/DateChooserMouseController.as new file mode 100644 index 0000000..976dfc4 --- /dev/null +++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controllers/DateChooserMouseController.as @@ -0,0 +1,122 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.royale.jewel.beads.controllers +{ + import org.apache.royale.jewel.beads.views.DateChooserView; + import org.apache.royale.jewel.beads.models.DateChooserModel; + import org.apache.royale.jewel.supportClasses.DateChooserList; + + import org.apache.royale.core.IBeadController; + import org.apache.royale.core.IBeadModel; + import org.apache.royale.core.IBeadView; + import org.apache.royale.core.IStrand; + import org.apache.royale.events.Event; + import org.apache.royale.events.MouseEvent; + import org.apache.royale.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 Royale 0.0 + */ + public class DateChooserMouseController implements IBeadController + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.0 + */ + public function DateChooserMouseController() + { + } + + private var _strand:IStrand; + + /** + * @copy org.apache.royale.core.IBead#strand + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 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); + + IEventDispatcher(view.dayList).addEventListener("change", listHandler); + } + + private function listHandler(event:Event):void + { + var list:DateChooserList = event.target as DateChooserList; + var model:DateChooserModel = _strand.getBeadByType(IBeadModel) as DateChooserModel; + model.selectedDate = list.selectedItem as Date; + } + + /** + * @private + */ + private function prevMonthClickHandler(event:MouseEvent):void + { + event.preventDefault(); + + 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:MouseEvent):void + { + event.preventDefault(); + + 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; + } + + } +} diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controllers/DateFieldMouseController.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controllers/DateFieldMouseController.as new file mode 100644 index 0000000..7d5ad64 --- /dev/null +++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controllers/DateFieldMouseController.as @@ -0,0 +1,165 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.royale.jewel.beads.controllers +{ + import org.apache.royale.core.IBeadController; + import org.apache.royale.core.IDateChooserModel; + import org.apache.royale.core.IStrand; + import org.apache.royale.core.IUIBase; + import org.apache.royale.core.UIBase; + import org.apache.royale.events.Event; + import org.apache.royale.events.MouseEvent; + import org.apache.royale.events.IEventDispatcher; + import org.apache.royale.jewel.beads.views.DateFieldView; + import org.apache.royale.utils.Timer; + import org.apache.royale.utils.UIUtils; + + /** + * 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 Royale 0.9.3 + */ + public class DateFieldMouseController implements IBeadController + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.3 + */ + public function DateFieldMouseController() + { + } + + private var _strand:IStrand; + + /** + * @copy org.apache.royale.core.IBead#strand + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.3 + */ + 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:MouseEvent):void + { + event.stopImmediatePropagation(); + + var viewBead:DateFieldView = _strand.getBeadByType(DateFieldView) as DateFieldView; + viewBead.popUpVisible = true; + IEventDispatcher(viewBead.popUp).addEventListener("change", changeHandler); + removeDismissHandler(); + + // use a timer to delay the installation of the event handler, otherwise + // the event handler is called immediately and will dismiss the popup. + var t:Timer = new Timer(0.25,1); + t.addEventListener("timer",addDismissHandler); + t.start(); + } + + /** + * @private + */ + private function addDismissHandler(event:Event):void + { + var host:UIBase = UIUtils.findPopUpHost(_strand as UIBase) as UIBase; + if (host) { + host.addEventListener("click", dismissHandler); + } + } + + /** + * @private + */ + private function removeDismissHandler():void + { + var host:UIBase = UIUtils.findPopUpHost(_strand as UIBase) as UIBase; + if (host) { + host.removeEventListener("click", dismissHandler); + } + } + + /** + * @private + */ + private function changeHandler(event:Event):void + { + event.stopImmediatePropagation(); + + 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")); + + removeDismissHandler(); + } + + /** + * @private + */ + private function dismissHandler(event:MouseEvent):void + { + var viewBead:DateFieldView = _strand.getBeadByType(DateFieldView) as DateFieldView; + var popup:IUIBase = IUIBase(viewBead.popUp); + + COMPILE::SWF { + var before:IUIBase = event.targetBeforeBubbling["royale_wrapper"] as IUIBase; + if (before) { + while (before != null) { + if (before == popup) return; + before = before.parent as IUIBase; + } + } + } + COMPILE::JS { + var before:IUIBase = event.target as IUIBase; + if (before) { + while (before != null) { + if (before == popup) return; + before = before.parent as IUIBase; + } + } + } + + viewBead.popUpVisible = false; + removeDismissHandler(); + } + } +} diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/DataFieldProviderBead.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/DataFieldProviderBead.as new file mode 100644 index 0000000..c6ddbf7 --- /dev/null +++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/DataFieldProviderBead.as @@ -0,0 +1,87 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.royale.jewel.beads.itemRenderers +{ + import org.apache.royale.core.IStrand; + import org.apache.royale.core.IBead; + + /** + * The DataFieldProviderBead class is a model that holds dataField used mostly + * in item renderers for retrieve some value from dataProvider items. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.3 + */ + public class DataFieldProviderBead implements IBead + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.3 + */ + public function DataFieldProviderBead() + { + } + + private var _strand:IStrand; + + /** + * @copy org.apache.royale.core.IBead#strand + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9 + */ + public function set strand(value:IStrand):void + { + _strand = value; + } + + private var _dataField:String = null; + + /** + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9 + */ + public function get dataField():String + { + return _dataField; + } + + /** + * @private + */ + public function set dataField(value:String):void + { + if (value != _dataField) + { + _dataField = value; + } + } + } +} diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/DataItemRendererFactoryForArrayData.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/DataItemRendererFactoryForArrayData.as new file mode 100644 index 0000000..027ea8d --- /dev/null +++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/DataItemRendererFactoryForArrayData.as @@ -0,0 +1,207 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.royale.jewel.beads.itemRenderers +{ + import org.apache.royale.core.IBead; + import org.apache.royale.core.IDataProviderItemRendererMapper; + import org.apache.royale.core.IItemRendererClassFactory; + import org.apache.royale.core.IItemRendererParent; + import org.apache.royale.core.IListPresentationModel; + import org.apache.royale.core.ISelectableItemRenderer; + import org.apache.royale.core.IDataProviderModel; + import org.apache.royale.core.IStrand; + import org.apache.royale.core.SimpleCSSStyles; + import org.apache.royale.core.UIBase; + import org.apache.royale.events.Event; + import org.apache.royale.events.EventDispatcher; + import org.apache.royale.events.IEventDispatcher; + import org.apache.royale.events.ItemRendererEvent; + + import org.apache.royale.core.IList; + import org.apache.royale.html.supportClasses.DataItemRenderer; + import org.apache.royale.utils.loadBeadFromValuesManager; + import org.apache.royale.jewel.beads.itemRenderers.DataFieldProviderBead; + + [Event(name="itemRendererCreated",type="org.apache.royale.events.ItemRendererEvent")] + + /** + * The DataItemRendererFactoryForArrayData class reads an + * array of data and creates an item renderer for every + * item in the array. Other implementations of + * IDataProviderItemRendererMapper map different data + * structures or manage a virtual set of renderers. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.8 + */ + public class DataItemRendererFactoryForArrayData extends EventDispatcher implements IBead, IDataProviderItemRendererMapper + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.8 + */ + public function DataItemRendererFactoryForArrayData(target:Object=null) + { + super(target); + } + + protected var dataProviderModel:IDataProviderModel; + protected var dataFieldProvider:DataFieldProviderBead; + + protected var labelField:String; + protected var dataField:String; + + private var _strand:IStrand; + + /** + * @copy org.apache.royale.core.IBead#strand + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.8 + * @royaleignorecoercion org.apache.royale.events.IEventDispatcher + */ + public function set strand(value:IStrand):void + { + _strand = value; + IEventDispatcher(value).addEventListener("initComplete",finishSetup); + } + + /** + * @private + * @royaleignorecoercion org.apache.royale.core.IDataProviderModel + * @royaleignorecoercion org.apache.royale.core.IItemRendererClassFactory + * @royaleignorecoercion org.apache.royale.html.beads.DataFieldProviderBead + */ + private function finishSetup(event:Event):void + { + dataProviderModel = _strand.getBeadByType(IDataProviderModel) as IDataProviderModel; + dataProviderModel.addEventListener("dataProviderChanged", dataProviderChangeHandler); + labelField = dataProviderModel.labelField; + + dataFieldProvider = _strand.getBeadByType(DataFieldProviderBead) as DataFieldProviderBead; + if (dataFieldProvider) + { + dataField = dataFieldProvider.dataField; + } + + // if the host component inherits from DataContainerBase, the itemRendererClassFactory will + // already have been loaded by DataContainerBase.addedToParent function. + if(!_itemRendererFactory) + _itemRendererFactory = loadBeadFromValuesManager(IItemRendererClassFactory, "iItemRendererClassFactory", _strand) as IItemRendererClassFactory; + + dataProviderChangeHandler(null); + } + + private var _itemRendererFactory:IItemRendererClassFactory; + + /** + * The org.apache.royale.core.IItemRendererClassFactory used + * to generate instances of item renderers. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.8 + * @royaleignorecoercion org.apache.royale.core.IItemRendererClassFactory + */ + public function get itemRendererFactory():IItemRendererClassFactory + { + if(!_itemRendererFactory) + _itemRendererFactory = loadBeadFromValuesManager(IItemRendererClassFactory, "iItemRendererClassFactory", _strand) as IItemRendererClassFactory; + + return _itemRendererFactory; + } + + /** + * @private + */ + public function set itemRendererFactory(value:IItemRendererClassFactory):void + { + _itemRendererFactory = value; + } + + /** + * The org.apache.royale.core.IItemRendererParent that will + * parent the item renderers. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.8 + * @royaleignorecoercion Array + * @royaleignorecoercion org.apache.royale.core.IList + * @royaleignorecoercion org.apache.royale.core.IListPresentationModel + * @royaleignorecoercion org.apache.royale.core.UIBase + * @royaleignorecoercion org.apache.royale.core.ISelectableItemRenderer + * @royaleignorecoercion org.apache.royale.html.supportClasses.DataItemRenderer + * @royaleignorecoercion org.apache.royale.events.IEventDispatcher + */ + protected function dataProviderChangeHandler(event:Event):void + { + var dp:Array = dataProviderModel.dataProvider as Array; + if (!dp) + return; + + var list:IList = _strand as IList; + var dataGroup:IItemRendererParent = list.dataGroup; + + dataGroup.removeAllItemRenderers(); + + var presentationModel:IListPresentationModel = _strand.getBeadByType(IListPresentationModel) as IListPresentationModel; + + var n:int = dp.length; + for (var i:int = 0; i < n; i++) + { + var ir:ISelectableItemRenderer = itemRendererFactory.createItemRenderer(dataGroup) as ISelectableItemRenderer; + var dataItemRenderer:DataItemRenderer = ir as DataItemRenderer; + + dataGroup.addItemRenderer(ir, false); + ir.index = i; + ir.labelField = labelField; + if (dataItemRenderer) + { + dataItemRenderer.dataField = dataField; + } + + if (presentationModel) { + var style:SimpleCSSStyles = new SimpleCSSStyles(); + style.marginBottom = presentationModel.separatorThickness; + UIBase(ir).style = style; + UIBase(ir).height = presentationModel.rowHeight; + UIBase(ir).percentWidth = 100; + } + ir.data = dp[i]; + + var newEvent:ItemRendererEvent = new ItemRendererEvent(ItemRendererEvent.CREATED); + newEvent.itemRenderer = ir; + dispatchEvent(newEvent); + } + + IEventDispatcher(_strand).dispatchEvent(new Event("itemsCreated")); + } + } +} diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/ITextItemRenderer.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/ITextItemRenderer.as new file mode 100644 index 0000000..5c5f1aa --- /dev/null +++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/ITextItemRenderer.as @@ -0,0 +1,45 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.royale.jewel.beads.itemRenderers +{ + import org.apache.royale.core.ISelectableItemRenderer; + + /** + * The ITextItemRenderer interface is the interface for + * for org.apache.royale.core.IItemRenderer that display text. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.0 + */ + public interface ITextItemRenderer extends ISelectableItemRenderer + { + /** + * The text to be displayed in the item renderer. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.0 + */ + function get text():String; + function set text(value:String):void; + } +} diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/models/DataProviderModel.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/models/DataProviderModel.as new file mode 100644 index 0000000..975792c --- /dev/null +++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/models/DataProviderModel.as @@ -0,0 +1,117 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.royale.jewel.beads.models +{ + import org.apache.royale.core.IDataProviderModel; + import org.apache.royale.core.IStrand; + import org.apache.royale.events.Event; + import org.apache.royale.events.EventDispatcher; + + /** + * The DataProviderModel class is a model for + * a dataProvider and an optional labelField. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.3 + */ + public class DataProviderModel extends EventDispatcher implements IDataProviderModel + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.3 + */ + public function DataProviderModel() + { + } + + private var _strand:IStrand; + + /** + * @copy org.apache.royale.core.IBead#strand + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.3 + */ + public function set strand(value:IStrand):void + { + _strand = value; + } + + private var _dataProvider:Object; + + /** + * @copy org.apache.royale.core.ISelectionModel#dataProvider + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.3 + */ + public function get dataProvider():Object + { + return _dataProvider; + } + + /** + * @private + */ + public function set dataProvider(value:Object):void + { + if (value === _dataProvider) return; + + _dataProvider = value; + dispatchEvent(new Event("dataProviderChanged")); + } + + private var _labelField:String = null; + + /** + * @copy org.apache.royale.core.ISelectionModel#labelField + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.3 + */ + public function get labelField():String + { + return _labelField; + } + + /** + * @private + */ + public function set labelField(value:String):void + { + if (value != _labelField) { + _labelField = value; + dispatchEvent(new Event("labelFieldChanged")); + } + } + + } +} diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/models/DateChooserModel.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/models/DateChooserModel.as new file mode 100644 index 0000000..2f98cf5 --- /dev/null +++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/models/DateChooserModel.as @@ -0,0 +1,281 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.royale.jewel.beads.models +{ + import org.apache.royale.core.IDateChooserModel; + import org.apache.royale.core.IStrand; + import org.apache.royale.events.Event; + import org.apache.royale.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 Royale 0.9.3 + */ + 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.royale.core.IBead#strand + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.3 + */ + 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 _days:Array; + 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 Royale 0.9.3 + */ + 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 Royale 0.9.3 + */ + 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 Royale 0.9.3 + */ + public function get displayedYear():Number + { + return _displayedYear; + } + public function set displayedYear(value:Number):void + { + if (value != _displayedYear) { + _displayedYear = value; + updateCalendar(); + dispatchEvent( new Event("displayedYearChanged") ); + } + } + + /** + * The month currently displayed by the DateChooser. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.3 + */ + public function get displayedMonth():Number + { + return _displayedMonth; + } + public function set displayedMonth(value:Number):void + { + if (_displayedMonth != value) { + _displayedMonth = value; + updateCalendar(); + 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 Royale 0.9.3 + */ + public function get firstDayOfWeek():Number + { + return _firstDayOfWeek; + } + public function set firstDayOfWeek(value:Number):void + { + if (value != _firstDayOfWeek) { + _firstDayOfWeek = value; + dispatchEvent( new Event("firstDayOfWeekChanged") ); + } + } + + public function get days():Array + { + return _days; + } + public function set days(value:Array):void + { + if (value != _days) { + _days = value; + dispatchEvent( new Event("daysChanged") ); + } + } + + /** + * The currently selected date or null if no date has been selected. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.3 + */ + public function get selectedDate():Date + { + return _selectedDate; + } + public function set selectedDate(value:Date):void + { + if (value != _selectedDate) { + _selectedDate = value; + + if (value != null) { + var needsUpdate:Boolean = false; + if (value.getMonth() != _displayedMonth) { + needsUpdate = true; + _displayedMonth = value.getMonth(); + } + if (value.getFullYear() != _displayedYear) { + needsUpdate = true; + _displayedYear = value.getFullYear(); + } + if (needsUpdate) updateCalendar(); + } + + dispatchEvent( new Event("selectedDateChanged") ); + } + } + + // Utilities + + + /** + * @private + */ + private function updateCalendar():void + { + var firstDay:Date = new Date(displayedYear, displayedMonth, 1); + + _days = new Array(42); + + // skip to the first day and renumber to the last day of the month + var i:int = firstDay.getDay(); + var dayNumber:int = 1; + var numDays:Number = numberOfDaysInMonth(displayedMonth, displayedYear); + + while(dayNumber <= numDays) { + _days[i++] = new Date(displayedYear, displayedMonth, dayNumber++); + } + + } + + /** + * @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 + */ + public function getIndexForSelectedDate():Number + { + if (!_selectedDate) return -1; + + var str:String = _selectedDate.toDateString(); + + for(var i:int=0; i < _days.length; i++) { + var test:Date = _days[i] as Date; + + if (test && test.toDateString() == str) + return i; + + } + return -1; + } + } +} diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/DateChooserView.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/DateChooserView.as new file mode 100644 index 0000000..23a2244 --- /dev/null +++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/DateChooserView.as @@ -0,0 +1,266 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.royale.jewel.beads.views +{ + import org.apache.royale.core.IBeadModel; + import org.apache.royale.core.IBeadView; + import org.apache.royale.core.IStrand; + // import org.apache.royale.core.SimpleCSSStylesWithFlex; + import org.apache.royale.core.UIBase; + import org.apache.royale.events.Event; + import org.apache.royale.events.IEventDispatcher; + import org.apache.royale.jewel.Group; + import org.apache.royale.jewel.List; + import org.apache.royale.jewel.beads.models.DateChooserModel; + import org.apache.royale.jewel.Button; + import org.apache.royale.jewel.supportClasses.DateChooserHeader; + import org.apache.royale.jewel.supportClasses.DateChooserList; + import org.apache.royale.utils.loadBeadFromValuesManager; + import org.apache.royale.html.beads.GroupView; + // import org.apache.royale.html.beads.layouts.HorizontalFlexLayout; + + /** + * 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. + * + * @viewbead + */ + public class DateChooserView extends GroupView implements IBeadView + { + /** + * constructor + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.3 + */ + public function DateChooserView() + { + super(); + } + + override public function set strand(value:IStrand):void + { + super.strand = value; + + model = loadBeadFromValuesManager(IBeadModel, "iBeadModel", _strand) as DateChooserModel; + + model.addEventListener("firstDayOfWeekChanged", handleModelChange); + model.addEventListener("dayNamesChanged", handleModelChange); + model.addEventListener("displayedMonthChanged", handleModelChange); + model.addEventListener("displayedYearChanged", handleModelChange); + + createChildren(); + updateDisplay(); + } + + private var model:DateChooserModel; + + private var monthButtonsContainer:Group; + private var monthLabel:Button; + private var dayNamesContainer:DateChooserHeader; + + /** + * @royaleignorecoercion org.apache.royale.core.UIBase + */ + private function getHost():UIBase + { + return _strand as UIBase; + } + + private var _prevMonthButton:Button; + /** + * 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 Royale 0.9.3 + */ + public function get prevMonthButton():Button + { + return _prevMonthButton; + } + + private var _nextMonthButton:Button; + /** + * 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 Royale 0.9.3 + */ + public function get nextMonthButton():Button + { + return _nextMonthButton; + } + + private var _dayList:DateChooserList; + /** + * The List of days to display + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.3 + */ + public function get dayList():List + { + return _dayList; + } + + // private const controlHeight:int = 26; + // private const commonButtonWidth:int = 40; + + /** + * @private + */ + private function createChildren():void + { + // HEADER BUTTONS + + monthButtonsContainer = new Group(); + + monthLabel = new Button(); + monthLabel.text = "Month Here"; + monthButtonsContainer.addElement(monthLabel); + + _prevMonthButton = new Button(); + _prevMonthButton.text = "<"; + monthButtonsContainer.addElement(_prevMonthButton); + + _nextMonthButton = new Button(); + _nextMonthButton.text = ">"; + monthButtonsContainer.addElement(_nextMonthButton); + + getHost().addElement(monthButtonsContainer, false); + + // DAY NAMES + + dayNamesContainer = new DateChooserHeader(); + //dayNamesContainer.id = "dateChooserDayNames"; + COMPILE::SWF { + dayNamesContainer.percentWidth = 100; + } + + getHost().addElement(dayNamesContainer, false); + + // DAYS + + _dayList = new DateChooserList(); + COMPILE::SWF { + _dayList.percentWidth = 100; + } + getHost().addElement(_dayList, false); + + IEventDispatcher(_dayList).dispatchEvent( new Event("itemsCreated") ); + model.addEventListener("selectedDateChanged", selectionChangeHandler); + + // monthButtonsContainer.id = "dateChooserMonthButtons"; + // monthButtonsContainer.addBead(new HorizontalFlexLayout()); + // monthButtonsContainer.height = controlHeight; + // monthButtonsContainer.style = new SimpleCSSStylesWithFlex(); + // monthButtonsContainer.style.flexGrow = 0; + // COMPILE::JS { + // monthButtonsContainer.element.style["flex-grow"] = "0"; + // } + // _prevMonthButton.width = commonButtonWidth; + // if (_prevMonthButton.style == null) { + // _prevMonthButton.style = new SimpleCSSStylesWithFlex(); + // } + // _prevMonthButton.style.flexGrow = 0; + // COMPILE::JS { + // _prevMonthButton.element.style["flex-grow"] = "0"; + // } + + // if (monthLabel.style == null) { + // monthLabel.style = new SimpleCSSStylesWithFlex(); + // } + // monthLabel.style.flexGrow = 1; + // COMPILE::JS { + // monthLabel.element.style["flex-grow"] = "1"; + // } + + // _nextMonthButton.width = commonButtonWidth; + // if (_nextMonthButton.style == null) { + // _nextMonthButton.style = new SimpleCSSStylesWithFlex(); + // } + // COMPILE::JS { + // _nextMonthButton.element.style["flex-grow"] = "0"; + // } + //_nextMonthButton.style.flexGrow = 0; + + // dayNamesContainer.className = "DateChooserHeader"; + // dayNamesContainer.height = controlHeight; + // dayNamesContainer.style = new SimpleCSSStylesWithFlex(); + // dayNamesContainer.style.flexGrow = 0; + // COMPILE::JS { + // dayNamesContainer.element.style["flex-grow"] = "0"; + // dayNamesContainer.element.style["align-items"] = "center"; + // } + + // _dayList.className = "DateChooserList"; + // _dayList.id = "dateChooserList"; + // _dayList.style = new SimpleCSSStylesWithFlex(); + // _dayList.style.flexGrow = 1; + // COMPILE::JS { + // _dayList.element.style["flex-grow"] = "1"; + // } + } + + /** + * @private + */ + private function updateDisplay():void + { + monthLabel.text = model.monthNames[model.displayedMonth] + " " + + String(model.displayedYear); + + dayNamesContainer.dataProvider = model.dayNames; + + _dayList.dataProvider = model.days; + + _dayList.selectedIndex = model.getIndexForSelectedDate(); + } + + /** + * @private + */ + private function selectionChangeHandler(event:Event):void + { + updateDisplay(); + + getHost().dispatchEvent(new Event("selectedDateChanged")); + getHost().dispatchEvent( new Event("change") ); + } + + /** + * @private + */ + private function handleModelChange(event:Event):void + { + updateDisplay(); + } + } +} diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/DateFieldView.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/DateFieldView.as new file mode 100644 index 0000000..d71d2bc --- /dev/null +++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/DateFieldView.as @@ -0,0 +1,241 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.royale.jewel.beads.views +{ + import org.apache.royale.core.BeadViewBase; + import org.apache.royale.core.IBeadView; + import org.apache.royale.core.IBeadModel; + import org.apache.royale.core.IDateChooserModel; + import org.apache.royale.core.IFormatBead; + import org.apache.royale.core.IPopUpHost; + import org.apache.royale.core.IStrand; + import org.apache.royale.core.UIBase; + import org.apache.royale.events.Event; + import org.apache.royale.events.IEventDispatcher; + import org.apache.royale.utils.UIUtils; + import org.apache.royale.utils.PointUtils; + import org.apache.royale.geom.Point; + import org.apache.royale.jewel.DateChooser; + import org.apache.royale.jewel.Button; + import org.apache.royale.jewel.TextInput; + COMPILE::SWF + { + //import org.apache.royale.jewel.beads.views.TextInputView; + import flash.text.TextFieldType; + } + + /** + * The DateFieldView class is a bead for DateField that creates the + * input and button controls. This class also handles the pop-up + * mechanics. + * + * @viewbead + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.3 + */ + public class DateFieldView extends BeadViewBase implements IBeadView + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.3 + */ + public function DateFieldView() + { + } + + private var _textInput:TextInput; + private var _button:Button; + + /** + * The TextButton that triggers the display of the DateChooser pop-up. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.3 + */ + public function get menuButton():Button + { + return _button; + } + + /** + * The TextInput that displays the date selected. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.3 + */ + public function get textInput():TextInput + { + return _textInput; + } + + /** + * @royaleignorecoercion org.apache.royale.core.UIBase + */ + protected function getHost():UIBase + { + return _strand as UIBase; + } + + /** + * @copy org.apache.royale.core.IBead#strand + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.3 + */ + override public function set strand(value:IStrand):void + { + super.strand = value; + + _textInput = new TextInput(); + getHost().addElement(_textInput); + _textInput.width = 100; + _textInput.height = 18; + + _button = new Button(); + _button.text = "⬇︎"; + getHost().addElement(_button); + + COMPILE::SWF { + _button.x = _textInput.width; + _button.y = _textInput.y; + //var view:TextInputView = _strand.getBeadByType(IBeadView) as TextInputView; + //if(view) + // view.textField.type = TextFieldType.DYNAMIC; + } + + // COMPILE::JS + // { + // _textInput.element.setAttribute('readonly', 'true'); + // } + + getHost().addEventListener("initComplete",handleInitComplete); + } + + private function handleInitComplete(event:Event):void + { + var formatter:IFormatBead = _strand.getBeadByType(IFormatBead) as IFormatBead; + formatter.addEventListener("formatChanged",handleFormatChanged); + _textInput.height = _button.height; + + var model:IBeadModel = _strand.getBeadByType(IBeadModel) as IBeadModel; + IEventDispatcher(model).addEventListener("selectedDateChanged", selectionChangeHandler); + } + + 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 Royale 0.9.3 + */ + 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 Royale 0.9.3 + */ + public function get popUpVisible():Boolean + { + return _popUpVisible; + } + private var _showingPopup:Boolean; + public function set popUpVisible(value:Boolean):void + { + // prevent resursive calls + // setting _popUp.selectedDate below triggers a change event + // which tries to close the popup causing a recursive call. + // There might be a better way to resolve this problem, but this works for now... + if(_showingPopup) + return; + + if (value != _popUpVisible) + { + _showingPopup = true; + _popUpVisible = value; + if (value) + { + if (!_popUp) + { + _popUp = new DateChooser(); + _popUp.width = 210; + _popUp.height = 230; + } + + var model:IDateChooserModel = _strand.getBeadByType(IDateChooserModel) as IDateChooserModel; + _popUp.selectedDate = model.selectedDate; + + var host:IPopUpHost = UIUtils.findPopUpHost(getHost()) as IPopUpHost; + var point:Point = new Point(_textInput.width, _button.height); + var p2:Point = PointUtils.localToGlobal(point, _strand); + var p3:Point = PointUtils.globalToLocal(p2, host); + _popUp.x = p3.x; + _popUp.y = p3.y; + COMPILE::JS { + _popUp.element.style.position = "absolute"; + } + + host.popUpParent.addElement(_popUp); + } + else + { + UIUtils.removePopUp(_popUp); + } + } + _showingPopup = false; + } + + /** + * @private + */ + private function selectionChangeHandler(event:Event):void + { + getHost().dispatchEvent(new Event("selectedDateChanged")); + } + } +} diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/itemRenderers/DateItemRenderer.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/itemRenderers/DateItemRenderer.as new file mode 100644 index 0000000..62707dd --- /dev/null +++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/itemRenderers/DateItemRenderer.as @@ -0,0 +1,104 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.royale.jewel.itemRenderers +{ + COMPILE::SWF + { + import flash.text.TextFieldAutoSize; + } + + /** + * The DateItemRenderer class renders date values for the DateChooser. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.0 + */ + public class DateItemRenderer extends StringItemRenderer + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.0 + */ + public function DateItemRenderer() + { + super(); + + typeNames = "calendar item date"; + } + + /** + * Sets the data value and uses the String version of the data for display. + * + * @param Object data The object being displayed by the itemRenderer instance. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.0 + */ + override public function set data(value:Object):void + { + super.data = value; + + COMPILE::SWF { + textField.autoSize = TextFieldAutoSize.CENTER; + } + + if (value is Date) { + this.text = String( (value as Date).getDate() ); + + COMPILE::SWF { + mouseEnabled = true; + mouseChildren = true; + } + + // COMPILE::JS { + // element.style["pointer-events"] = ""; + // } + } else { + this.text = ""; + + COMPILE::SWF { + mouseEnabled = false; + mouseChildren = false; + } + + // COMPILE::JS { + // element.style["pointer-events"] = "none"; + // } + } + } + + /** + * @private + */ + COMPILE::JS + override public function set height(value:Number):void + { + super.height = value; + // element.style["line-height"] = String(value)+"px"; + } + } +} diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/itemRenderers/DayNameItemRenderer.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/itemRenderers/DayNameItemRenderer.as new file mode 100644 index 0000000..fc6697e --- /dev/null +++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/itemRenderers/DayNameItemRenderer.as @@ -0,0 +1,81 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.royale.jewel.itemRenderers +{ + COMPILE::SWF + { + import flash.text.TextFieldAutoSize; + } + + /** + * The DayNameItemRenderer class renders the names of days of the week + * for the DateChooser. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.3 + */ + public class DayNameItemRenderer extends StringItemRenderer + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.3 + */ + public function DayNameItemRenderer() + { + super(); + + typeNames = "calendar item dayName"; + } + + /** + * Sets the data value and uses the String version of the data for display. + * + * @param Object data The object being displayed by the itemRenderer instance. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.3 + */ + override public function set data(value:Object):void + { + super.data = value; + + COMPILE::SWF { + textField.autoSize = TextFieldAutoSize.CENTER; + } + } + + /** + * @private + */ + COMPILE::JS + override public function set height(value:Number):void + { + super.height = value; + // element.style["line-height"] = String(value)+"px"; + } + } +} diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/itemRenderers/StringItemRenderer.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/itemRenderers/StringItemRenderer.as new file mode 100644 index 0000000..bfb23e7 --- /dev/null +++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/itemRenderers/StringItemRenderer.as @@ -0,0 +1,170 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.royale.jewel.itemRenderers +{ + import org.apache.royale.html.supportClasses.DataItemRenderer; + COMPILE::SWF + { + import flash.text.TextFieldAutoSize; + import flash.text.TextFieldType; + + import org.apache.royale.core.CSSTextField; + } + COMPILE::JS + { + import org.apache.royale.core.WrappedHTMLElement; + import org.apache.royale.html.util.addElementToWrapper; + } + import org.apache.royale.jewel.beads.itemRenderers.ITextItemRenderer; + import org.apache.royale.jewel.supportClasses.util.getLabelFromData; + + /** + * The StringItemRenderer class displays data in string form using the data's toString() + * function. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.3 + */ + public class StringItemRenderer extends DataItemRenderer implements ITextItemRenderer + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.3 + */ + public function StringItemRenderer() + { + super(); + + typeNames = ""; + + COMPILE::SWF + { + textField = new CSSTextField(); + textField.type = TextFieldType.DYNAMIC; + textField.autoSize = TextFieldAutoSize.LEFT; + textField.selectable = false; + textField.parentDrawsBackground = true; + } + } + + COMPILE::SWF + public var textField:CSSTextField; + + /** + * @private + */ + COMPILE::SWF + override public function addedToParent():void + { + super.addedToParent(); + + addChild(textField); + + adjustSize(); + } + + /** + * @private + */ + COMPILE::SWF + override public function adjustSize():void + { + var cy:Number = height/2; + + textField.x = 0; + textField.y = cy - textField.height/2; + textField.width = width; + + updateRenderer(); + } + + /** + * The text currently displayed by the itemRenderer instance. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.3 + */ + public function get text():String + { + COMPILE::SWF + { + return textField.text; + } + COMPILE::JS + { + return this.element.textContent; + } + } + + public function set text(value:String):void + { + COMPILE::SWF + { + textField.text = value; + } + COMPILE::JS + { + this.element.textContent = value; + } + } + + /** + * Sets the data value and uses the String version of the data for display. + * + * @param Object data The object being displayed by the itemRenderer instance. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9 + * @royaleignorecoercion String + */ + override public function set data(value:Object):void + { + super.data = value; + var text:String; + this.text = getLabelFromData(this, value); + } + + // COMPILE::JS + // private var backgroundView:WrappedHTMLElement; + + /** + * @royaleignorecoercion org.apache.royale.core.WrappedHTMLElement + */ + COMPILE::JS + override protected function createElement():WrappedHTMLElement + { + return addElementToWrapper(this,'span'); + // itemRenderers should provide something for the background to handle + // the selection and highlight + // backgroundView = element; + // return element; + } + + } +} diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/supportClasses/DateChooserHeader.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/supportClasses/DateChooserHeader.as new file mode 100644 index 0000000..b267821 --- /dev/null +++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/supportClasses/DateChooserHeader.as @@ -0,0 +1,64 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.royale.jewel.supportClasses +{ + import org.apache.royale.jewel.DataContainer; + // import org.apache.royale.html.beads.layouts.HorizontalFlexLayout; + + /** + * The DateChooserHeader is the container for the days of the week labels + * in the DateChooser. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.0 + */ + public class DateChooserHeader extends DataContainer + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.0 + */ + public function DateChooserHeader() + { + super(); + + // myLayout = new HorizontalFlexLayout(); + // addBead(myLayout); + } + + /** + * @private + */ + // private var myLayout:HorizontalFlexLayout; + + /** + * @private + */ + // override public function set height(value:Number):void + // { + // super.height = value; + // } + } +} diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/supportClasses/DateChooserList.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/supportClasses/DateChooserList.as new file mode 100644 index 0000000..e93a272 --- /dev/null +++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/supportClasses/DateChooserList.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 org.apache.royale.jewel.supportClasses +{ + import org.apache.royale.jewel.List; + // import org.apache.royale.html.supportClasses.Viewport; + // import org.apache.royale.html.beads.layouts.TileLayout; + + public class DateChooserList extends List + { + public function DateChooserList() + { + super(); + + // addBead(new Viewport()); + + // var tileLayout:TileLayout = new TileLayout(); + // tileLayout.numColumns = 7; + // addBead(tileLayout); + } + } +} diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/supportClasses/util/getLabelFromData.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/supportClasses/util/getLabelFromData.as new file mode 100644 index 0000000..1dc8cab --- /dev/null +++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/supportClasses/util/getLabelFromData.as @@ -0,0 +1,41 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 "Licens"); 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.royale.jewel.supportClasses.util +{ + /** + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.3 + * Utility function to get a label string from a value object + */ + public function getLabelFromData(obj:Object,data:Object):String + { + // slightly more code, but we bail early if it's a string which is often + if (data is String) return "" + data; + if(!data) return ""; + + if (obj["labelField"]) return "" + data[obj["labelField"]]; + if (obj["dataField"]) return "" + data[obj["dataField"]]; + if (data.hasOwnProperty("label")) return "" + data["label"]; + + return "" + data; + + } +} diff --git a/frameworks/projects/Jewel/src/main/sass/_global.sass b/frameworks/projects/Jewel/src/main/sass/_global.sass index ca3e9ee..2523e32 100644 --- a/frameworks/projects/Jewel/src/main/sass/_global.sass +++ b/frameworks/projects/Jewel/src/main/sass/_global.sass @@ -90,6 +90,16 @@ j|Image //j|Grid // IBeadLayout: ClassReference("org.apache.royale.jewel.beads.layouts.GridLayout") +j|DataContainer + IBeadModel: ClassReference("org.apache.royale.jewel.beads.models.DataProviderModel") + IBeadView: ClassReference("org.apache.royale.html.beads.DataContainerView") + IBeadLayout: ClassReference("org.apache.royale.jewel.beads.layouts.VerticalLayout") + IDataProviderItemRendererMapper: ClassReference("org.apache.royale.jewel.beads.itemRenderers.DataItemRendererFactoryForArrayData") + IItemRendererClassFactory: ClassReference("org.apache.royale.core.ItemRendererClassFactory") + IItemRenderer: ClassReference("org.apache.royale.jewel.itemRenderers.StringItemRenderer") + IViewport: ClassReference("org.apache.royale.html.supportClasses.Viewport") + IViewportModel: ClassReference("org.apache.royale.html.beads.models.ViewportModel") + @media -royale-swf j|View // --- IBackgroundBead: ClassReference("org.apache.royale.html.beads.SolidBackgroundBead") diff --git a/frameworks/projects/Jewel/src/main/sass/components/_datechooser.sass b/frameworks/projects/Jewel/src/main/sass/components/_datechooser.sass new file mode 100644 index 0000000..a12f5c7 --- /dev/null +++ b/frameworks/projects/Jewel/src/main/sass/components/_datechooser.sass @@ -0,0 +1,60 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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. +// +//////////////////////////////////////////////////////////////////////////////// + +// Jewel DateChooser + +// DateChooser variables + +.jewel.datechooser + +.calendar + &.item + width: 36px + height: 36px + text-align: center + padding: 10px + +j|DateChooser + IBeadModel: ClassReference("org.apache.royale.jewel.beads.models.DateChooserModel") + IBeadView: ClassReference("org.apache.royale.jewel.beads.views.DateChooserView") + IBeadLayout: ClassReference("org.apache.royale.jewel.beads.layouts.VerticalFlowLayout") + IBeadController: ClassReference("org.apache.royale.jewel.beads.controllers.DateChooserMouseController") + // width: 280px + // height: 240px + +j|DateChooserHeader + IItemRenderer: ClassReference("org.apache.royale.jewel.itemRenderers.DayNameItemRenderer") + IBeadLayout: ClassReference("org.apache.royale.jewel.beads.layouts.HorizontalLayout") + // height: 20px + // border-style: solid + // border-color: #000000 + // border-width: 1px + // background-color: #FFFFFF + +j|DateChooserList + // IDataProviderItemRendererMapper: ClassReference("org.apache.royale.jewel.beads.itemRenderers.DataItemRendererFactoryForArrayData") + // IItemRendererClassFactory: ClassReference("org.apache.royale.core.ItemRendererClassFactory") + IItemRenderer: ClassReference("org.apache.royale.jewel.itemRenderers.DateItemRenderer") + IBeadLayout: ClassReference("org.apache.royale.jewel.beads.layouts.HorizontalFlowLayout") + // width: 280px + // height: 240px + // border-style: solid + // border-color: #000000 + // border-width: 1px + // background-color: #FFFFFF diff --git a/frameworks/projects/Jewel/src/main/sass/components/_datefield.sass b/frameworks/projects/Jewel/src/main/sass/components/_datefield.sass new file mode 100644 index 0000000..467c5ef --- /dev/null +++ b/frameworks/projects/Jewel/src/main/sass/components/_datefield.sass @@ -0,0 +1,33 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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. +// +//////////////////////////////////////////////////////////////////////////////// + +// Jewel DateField + +// DateField variables + +.jewel.datefield + +j|DateField + IBeadView: ClassReference("org.apache.royale.jewel.beads.views.DateFieldView") + IBeadModel: ClassReference("org.apache.royale.jewel.beads.models.DateChooserModel") + IBeadController: ClassReference("org.apache.royale.jewel.beads.controllers.DateFieldMouseController") + IFormatBead: ClassReference("org.apache.royale.html.accessories.DateFormatDDMMYYYY") + +@media -royale-swf + diff --git a/frameworks/projects/Jewel/src/main/sass/defaults.sass b/frameworks/projects/Jewel/src/main/sass/defaults.sass index b5f08d2..d5aa50b 100644 --- a/frameworks/projects/Jewel/src/main/sass/defaults.sass +++ b/frameworks/projects/Jewel/src/main/sass/defaults.sass @@ -28,8 +28,10 @@ @import "components/card" @import "components/checkbox" @import "components/controlbar" -@import "components/drawer" +@import "components/datechooser" +@import "components/datefield" @import "components/divider" +@import "components/drawer" @import "components/dropdownlist" @import "components/icons" @import "components/itemRenderer" diff --git a/frameworks/themes/JewelTheme/src/main/resources/defaults.css b/frameworks/themes/JewelTheme/src/main/resources/defaults.css index e7fee4b..810ed3c 100644 --- a/frameworks/themes/JewelTheme/src/main/resources/defaults.css +++ b/frameworks/themes/JewelTheme/src/main/resources/defaults.css @@ -241,6 +241,26 @@ j|Card { font-size: 16px; } +.jewel.datechooser { + background: white; + width: 280px; +} +.jewel.datechooser .jewel.button, .jewel.datechooser .jewel.list { + background: white; + border: none; + box-shadow: none; +} + +.calendar.item { + font-size: 1em; +} +.calendar.item.dayName { + font-weight: 600; +} +.calendar.item.date { + color: grey; +} + .jewel.divider { border-bottom-color: #d9d9d9; border-bottom-width: 1px; diff --git a/frameworks/themes/JewelTheme/src/main/sass/components-primary/_datechooser.sass b/frameworks/themes/JewelTheme/src/main/sass/components-primary/_datechooser.sass new file mode 100644 index 0000000..d7562d7 --- /dev/null +++ b/frameworks/themes/JewelTheme/src/main/sass/components-primary/_datechooser.sass @@ -0,0 +1,42 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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. +// +//////////////////////////////////////////////////////////////////////////////// + +// Jewel DateChooser + +// DateChooser variables + +.jewel.datechooser + background: white + width: 280px + + .jewel.button, .jewel.list + background: white + border: none + box-shadow: none + +.calendar + &.item + font: + size: 1em + &.dayName + font: + weight: 600 + + &.date + color: grey \ No newline at end of file diff --git a/frameworks/themes/JewelTheme/src/main/sass/components-primary/_datefield.sass b/frameworks/themes/JewelTheme/src/main/sass/components-primary/_datefield.sass new file mode 100644 index 0000000..ba1d362 --- /dev/null +++ b/frameworks/themes/JewelTheme/src/main/sass/components-primary/_datefield.sass @@ -0,0 +1,26 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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. +// +//////////////////////////////////////////////////////////////////////////////// + +// Jewel DateField + +// DateField variables + +.jewel.datefield + + diff --git a/frameworks/themes/JewelTheme/src/main/sass/defaults.sass b/frameworks/themes/JewelTheme/src/main/sass/defaults.sass index 71de04c..5e23041 100644 --- a/frameworks/themes/JewelTheme/src/main/sass/defaults.sass +++ b/frameworks/themes/JewelTheme/src/main/sass/defaults.sass @@ -31,6 +31,8 @@ @import "components-primary/card" @import "components-primary/checkbox" @import "components-primary/controlbar" +@import "components-primary/datechooser" +@import "components-primary/datefield" @import "components-primary/divider" @import "components-primary/drawer" @import "components-primary/dropdownlist"