flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ha...@apache.org
Subject [21/29] git commit: [flex-asjs] [refs/heads/tlf] - FLEX-35328 - Introduce "selectedValue" property in DropDownList - gives convinient way to get value of Option component
Date Mon, 03 Jul 2017 13:33:18 GMT
FLEX-35328 - Introduce "selectedValue" property in DropDownList - gives convinient way to get
value of Option component


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/a4b17326
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/a4b17326
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/a4b17326

Branch: refs/heads/tlf
Commit: a4b173261cd143fe588d609b8cb2946fa12a8401
Parents: 181082a
Author: piotrz <piotrz@apache.org>
Authored: Mon Jun 26 22:52:58 2017 +0200
Committer: piotrz <piotrz@apache.org>
Committed: Mon Jun 26 22:52:58 2017 +0200

----------------------------------------------------------------------
 .../src/main/flex/MDLClasses.as                 |  1 +
 .../flex/org/apache/flex/mdl/DropDownList.as    | 21 ++++++-
 .../beads/controllers/DropDownListController.as | 10 +--
 .../flex/mdl/beads/models/DropDownListModel.as  | 64 ++++++++++++++++++++
 .../flex/mdl/beads/models/IDropDownListModel.as | 43 +++++++++++++
 .../src/main/resources/defaults.css             |  2 +-
 6 files changed, 135 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a4b17326/frameworks/projects/MaterialDesignLite/src/main/flex/MDLClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/MDLClasses.as b/frameworks/projects/MaterialDesignLite/src/main/flex/MDLClasses.as
index aa4c17b..d9ac1ac 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/flex/MDLClasses.as
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/MDLClasses.as
@@ -34,6 +34,7 @@ package
 		import org.apache.flex.mdl.beads.models.ToastModel; ToastModel;
 		import org.apache.flex.mdl.beads.models.SnackbarModel; SnackbarModel;
 		import org.apache.flex.mdl.beads.models.SliderRangeModel; SliderRangeModel;
+		import org.apache.flex.mdl.beads.models.DropDownListModel; DropDownListModel;
 		import org.apache.flex.mdl.materialIcons.MaterialIconType; MaterialIconType;
 		import org.apache.flex.mdl.beads.UpgradeElement; UpgradeElement;
 		import org.apache.flex.mdl.beads.UpgradeChildren; UpgradeChildren;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a4b17326/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/DropDownList.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/DropDownList.as
b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/DropDownList.as
index dd4f35b..d2db22d 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/DropDownList.as
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/DropDownList.as
@@ -25,6 +25,7 @@ package org.apache.flex.mdl
     import org.apache.flex.html.DataContainer;
     import org.apache.flex.html.Select;
     import org.apache.flex.mdl.beads.UpgradeElement;
+    import org.apache.flex.mdl.beads.models.IDropDownListModel;
 
     COMPILE::JS
     {
@@ -119,7 +120,25 @@ package org.apache.flex.mdl
                 _labelDisplay = value;
             }
         }
-        
+
+        [Bindable("change")]
+        /**
+         *  @copy org.apache.flex.core.IDropDownListModel#selectedValue
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.9
+         */
+        public function get selectedValue():String
+        {
+            return IDropDownListModel(model).selectedValue;
+        }
+        public function set selectedValue(value:String):void
+        {
+            IDropDownListModel(model).selectedValue = value;
+        }
+
         [Bindable("change")]
         /**
          *  @copy org.apache.flex.core.ISelectionModel#selectedIndex

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a4b17326/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/controllers/DropDownListController.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/controllers/DropDownListController.as
b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/controllers/DropDownListController.as
index 149be7d..6c384d2 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/controllers/DropDownListController.as
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/controllers/DropDownListController.as
@@ -19,12 +19,13 @@
 package org.apache.flex.mdl.beads.controllers
 {
     import org.apache.flex.core.IBeadController;
-    import org.apache.flex.core.ISelectionModel;
     import org.apache.flex.core.IStrand;
     import org.apache.flex.mdl.DropDownList;
     import org.apache.flex.events.Event;
+    import org.apache.flex.mdl.beads.models.DropDownListModel;
+    import org.apache.flex.mdl.beads.models.IDropDownListModel;
 
-	/**
+    /**
 	 *  The DropDownListController class bead handles mouse events on the
      *  drop down list component parts and dispatches change event on behalf of the DropDownList
 	 *
@@ -55,7 +56,7 @@ package org.apache.flex.mdl.beads.controllers
 		 *  @playerversion AIR 2.6
 		 *  @productversion FlexJS 0.8
          */
-		protected var model:ISelectionModel;
+		protected var model:DropDownListModel;
 		protected var _strand:IStrand;
 
 		/**
@@ -72,7 +73,7 @@ package org.apache.flex.mdl.beads.controllers
 
             var dropDownList:DropDownList = (value as DropDownList);
 
-            model = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
+            model = _strand.getBeadByType(IDropDownListModel) as DropDownListModel;
 
 			COMPILE::JS
             {
@@ -90,6 +91,7 @@ package org.apache.flex.mdl.beads.controllers
             {
                 model.selectedIndex = selectedIndex;
                 model.selectedItem = model.dataProvider[selectedIndex];
+				model.selectedValue = eventTarget.value;
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a4b17326/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/models/DropDownListModel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/models/DropDownListModel.as
b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/models/DropDownListModel.as
new file mode 100644
index 0000000..631c03c
--- /dev/null
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/models/DropDownListModel.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.flex.mdl.beads.models
+{
+    import org.apache.flex.events.Event;
+    import org.apache.flex.html.beads.models.ArraySelectionModel;
+
+    /**
+     *  The DropDownListModel class defines the data associated with an org.apache.flex.mdl.DropDownListModel
+     *  component.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @playerversion AIR 2.6
+     *  @productversion FlexJS 0.9
+     */
+    public class DropDownListModel extends ArraySelectionModel implements IDropDownListModel
+    {
+        public function DropDownListModel()
+        {
+            super();
+        }
+
+        private var _selectedValue:String = "";
+
+        /**
+         *  @copy org.apache.flex.mdl.beads.models.IDropDownListModel#selectedValue
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.9
+         */
+        public function get selectedValue():String
+        {
+            return _selectedValue;
+        }
+
+        public function set selectedValue(value:String):void
+        {
+            if (_selectedValue != value)
+            {
+                _selectedValue = value;
+                dispatchEvent(new org.apache.flex.events.Event("selectedValueChanged"));
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a4b17326/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/models/IDropDownListModel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/models/IDropDownListModel.as
b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/models/IDropDownListModel.as
new file mode 100644
index 0000000..4a5f6e5
--- /dev/null
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/models/IDropDownListModel.as
@@ -0,0 +1,43 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.mdl.beads.models
+{
+    /**
+     *  The IDropDownListModel interface describes the minimum set of properties
+     *  available to DropDownList control
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @playerversion AIR 2.6
+     *  @productversion FlexJS 0.9
+     */
+    public interface IDropDownListModel
+    {
+        /**
+         *  Gets selectedValue from Select in DropDownList
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.9
+         */
+        function get selectedValue():String;
+        function set selectedValue(value:String):void;
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a4b17326/frameworks/projects/MaterialDesignLite/src/main/resources/defaults.css
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/resources/defaults.css b/frameworks/projects/MaterialDesignLite/src/main/resources/defaults.css
index 347c226..033ec2a 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/resources/defaults.css
+++ b/frameworks/projects/MaterialDesignLite/src/main/resources/defaults.css
@@ -154,7 +154,7 @@ FooterLinkList
 DropDownList
 {
     IBeadView: ClassReference("org.apache.flex.mdl.beads.views.DropDownListView");
-    IBeadModel: ClassReference("org.apache.flex.html.beads.models.ArraySelectionModel");
+    IBeadModel: ClassReference("org.apache.flex.mdl.beads.models.DropDownListModel");
     IBeadLayout: ClassReference(null);
     IBeadController: ClassReference("org.apache.flex.mdl.beads.controllers.DropDownListController");
     IDataProviderItemRendererMapper: ClassReference("org.apache.flex.html.beads.DataItemRendererFactoryForArrayData");


Mime
View raw message