You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by pe...@apache.org on 2017/04/24 20:24:45 UTC
[3/8] git commit: [flex-asjs] [refs/heads/dual] - Map examples now
working on JS platform.
Map examples now working on JS platform.
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/0c568e3c
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/0c568e3c
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/0c568e3c
Branch: refs/heads/dual
Commit: 0c568e3cca0713d6c2227edcd850d6abe49267e3
Parents: 3757338
Author: Peter Ent <pe...@apache.org>
Authored: Wed Apr 19 10:49:41 2017 -0400
Committer: Peter Ent <pe...@apache.org>
Committed: Wed Apr 19 10:49:41 2017 -0400
----------------------------------------------------------------------
.../DesktopMap/src/main/flex/MyInitialView.mxml | 56 +++++++++++---------
.../DesktopMap/src/main/flex/models/MyModel.as | 6 ++-
.../MapSearch/src/main/flex/MyInitialView.mxml | 16 +++++-
.../src/main/flex/SearchResultItemRenderer.mxml | 53 ++++++++++++++++++
.../MapSearch/src/main/flex/models/MyModel.as | 3 +-
.../flex/maps/google/beads/GoogleMapView.as | 2 +-
6 files changed, 105 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0c568e3c/examples/flexjs/DesktopMap/src/main/flex/MyInitialView.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/DesktopMap/src/main/flex/MyInitialView.mxml b/examples/flexjs/DesktopMap/src/main/flex/MyInitialView.mxml
index cedfe57..fdaa025 100644
--- a/examples/flexjs/DesktopMap/src/main/flex/MyInitialView.mxml
+++ b/examples/flexjs/DesktopMap/src/main/flex/MyInitialView.mxml
@@ -26,6 +26,7 @@ limitations under the License.
<![CDATA[
import models.MyModel;
import org.apache.flex.events.Event;
+ import google.maps.LatLng;
private function initControls() : void
@@ -41,9 +42,9 @@ limitations under the License.
{
var lat:Number = Number(latInput.text);
var lng:Number = Number(longInput.text);
- var zoom:Number = Number(zoomInput.text);
+ var center:LatLng = new LatLng(lat, lng);
- map.loadMap(lat, lng, zoom);
+ map.setCenter(center);
}
private var selectedCity:String;
@@ -57,7 +58,9 @@ limitations under the License.
var index:int = list.selectedIndex;
var latlng:Object = MyModel(applicationModel).coordinates[index];
- map.loadMap(latlng.lat, latlng.lng, Number(zoomInput.text));
+ var address:String = MyModel(applicationModel).cities[index];
+ mapLocation.text = address;
+ map.centerOnAddress(address);
latInput.text = String(latlng.lat);
longInput.text = String(latlng.lng);
@@ -112,7 +115,6 @@ limitations under the License.
.SearchGroup {
flex-grow: 0;
padding: 4px;
- backgroundColor: lightgray;
}
.InputGroup {
@@ -120,6 +122,11 @@ limitations under the License.
padding: 4px;
margin-top: 10px;
}
+
+ .FieldInput {
+ margin-left: 5px;
+ margin-right: 5px;
+ }
</fx:Style>
@@ -133,44 +140,43 @@ limitations under the License.
<js:VerticalFlexLayout />
</js:beads>
- <js:Group className="LocationGroup">
- <js:beads>
- <js:OneFlexibleChildHorizontalLayout flexibleChild="mapLocation" />
- </js:beads>
- <js:Label text="Location:" />
- <js:TextInput id="mapLocation" />
- <js:TextButton text="Go" click="orientMap()" />
- </js:Group>
-
- <google:Map id="map" className="Map" token="AIzaSyDkQgg2iojLCYeuW6hK7DkuAHD-SwJJhdE" />
-
<js:Group className="SearchGroup">
<js:beads>
<js:OneFlexibleChildHorizontalLayout flexibleChild="search" />
</js:beads>
<js:Label text="Search on Map:" />
- <js:TextInput id="search" />
+ <js:TextInput id="search" className="FieldInput" />
<js:TextButton text="Find" click="searchOnMap()" />
<js:TextButton text="Clear" click="clearSearchResults()" />
</js:Group>
- <js:Group className="InputGroup">
+ <google:Map id="map" className="Map" token="AIzaSyDkQgg2iojLCYeuW6hK7DkuAHD-SwJJhdE" />
+
+ <js:Group className="LocationGroup">
<js:beads>
- <js:VerticalLayout />
+ <js:OneFlexibleChildHorizontalLayout flexibleChild="mapLocation" />
</js:beads>
- <js:Label text="History" />
- <js:DropDownList id="list" width="100" height="17"
+ <js:Label text="Location:" />
+ <js:TextInput id="mapLocation" className="FieldInput" />
+ <js:TextButton text="Go" click="orientMap()" />
+ <js:Spacer width="10" />
+ <js:DropDownList id="list"
change="changeCity(event)"
dataProvider="{MyModel(applicationModel).cities}" />
+ </js:Group>
+
+ <js:Group className="InputGroup">
+ <js:beads>
+ <js:HorizontalLayout />
+ </js:beads>
<js:Label text="Lat:" />
- <js:TextInput id="latInput" text="-34.397" />
+ <js:TextInput id="latInput" text="" width="70" />
+ <js:Spacer width="10" />
<js:Label text="Long:" />
- <js:TextInput id="longInput" text="150.644" />
-
- <js:Label text="Zoom:" />
- <js:TextInput id="zoomInput" text="8" />
+ <js:TextInput id="longInput" text="" width="70" />
+ <js:Spacer width="10" />
<js:TextButton text="MapIt" click="mapIt()" />
</js:Group>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0c568e3c/examples/flexjs/DesktopMap/src/main/flex/models/MyModel.as
----------------------------------------------------------------------
diff --git a/examples/flexjs/DesktopMap/src/main/flex/models/MyModel.as b/examples/flexjs/DesktopMap/src/main/flex/models/MyModel.as
index e0dab68..8a89d7b 100644
--- a/examples/flexjs/DesktopMap/src/main/flex/models/MyModel.as
+++ b/examples/flexjs/DesktopMap/src/main/flex/models/MyModel.as
@@ -37,7 +37,7 @@ package models
_strand = value;
}
- private var _cities:Array = ["Sydney", "NYC", "Mexico City", "London", "Rio de Janeiro"];
+ private var _cities:Array = ["San Jose, CA", "Sydney", "NYC", "Mexico City", "London", "Rio de Janeiro"];
[Bindable]
public function get cities():Array
@@ -45,7 +45,9 @@ package models
return _cities;
}
- private var _coordinates:Array = [{lat:-33.86, lng:151.211},
+ private var _coordinates:Array = [
+ {lat:37.3, lng: -121.5},
+ {lat:-33.86, lng:151.211},
{lat:40.712, lng:-74.0059},
{lat:19.26, lng:-99.03},
{lat:51.4, lng:-0.1},
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0c568e3c/examples/flexjs/MapSearch/src/main/flex/MyInitialView.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/MapSearch/src/main/flex/MyInitialView.mxml b/examples/flexjs/MapSearch/src/main/flex/MyInitialView.mxml
index 433057e..5f033bc 100644
--- a/examples/flexjs/MapSearch/src/main/flex/MyInitialView.mxml
+++ b/examples/flexjs/MapSearch/src/main/flex/MyInitialView.mxml
@@ -142,12 +142,23 @@ limitations under the License.
.Results {
backgroundColor: lightgray;
- flex-grow: 1;
+ flex-grow: 0;
+ height: 200px;
+ min-height: 200px;
border: 1px solid #555555;
margin-left: 10px;
margin-right: 10px;
margin-bottom: 10px;
}
+
+ .ResultPlaceName {
+ font-weight: bold;
+ font-size: 12;
+ }
+ .ResultPlaceAddress {
+ font-weight: normal;
+ font-size: 10;
+ }
.FormLabel {
font-weight: bold;
@@ -213,13 +224,14 @@ limitations under the License.
<js:TextButton text="Clear"click="clearSearchResults()" className="FormButton" />
</js:Group>
- <js:List id="resultsList" className="Results">
+ <js:List id="resultsList" className="Results" itemRenderer="SearchResultItemRenderer" rowHeight="40">
<js:beads>
<js:SimpleBinding
sourceID="applicationModel"
sourcePropertyName="searchResults"
eventName="searchResultsChanged"
destinationPropertyName="dataProvider" />
+ <js:ScrollingViewport />
</js:beads>
</js:List>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0c568e3c/examples/flexjs/MapSearch/src/main/flex/SearchResultItemRenderer.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/MapSearch/src/main/flex/SearchResultItemRenderer.mxml b/examples/flexjs/MapSearch/src/main/flex/SearchResultItemRenderer.mxml
new file mode 100644
index 0000000..14c69c8
--- /dev/null
+++ b/examples/flexjs/MapSearch/src/main/flex/SearchResultItemRenderer.mxml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!---
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+-->
+<js:MXMLItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:local="*"
+ xmlns:models="models.*"
+ xmlns:js="library://ns.apache.org/flexjs/basic"
+ >
+
+ <fx:Script>
+ <![CDATA[
+ [Bindable]
+ private var placeName:String;
+
+ [Bindable]
+ private var placeAddress:String;
+
+ override public function set data(value:Object):void
+ {
+ super.data = value;
+
+ placeName = value["name"];
+ placeAddress = value["vicinity"];
+ }
+ ]]>
+ </fx:Script>
+
+ <js:beads>
+ <js:VerticalLayout />
+ <js:MXMLBeadViewDataBinding />
+ </js:beads>
+
+ <js:Label text="{placeName}" className="ResultPlaceName" />
+ <js:Label text="{placeAddress}" className="ResultPlaceAddress" />
+
+</js:MXMLItemRenderer>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0c568e3c/examples/flexjs/MapSearch/src/main/flex/models/MyModel.as
----------------------------------------------------------------------
diff --git a/examples/flexjs/MapSearch/src/main/flex/models/MyModel.as b/examples/flexjs/MapSearch/src/main/flex/models/MyModel.as
index 61ad036..90fcbc9 100644
--- a/examples/flexjs/MapSearch/src/main/flex/models/MyModel.as
+++ b/examples/flexjs/MapSearch/src/main/flex/models/MyModel.as
@@ -45,7 +45,8 @@ package models
return _cities;
}
- private var _coordinates:Array = [{lat:-37.3, lng: -121.5},
+ private var _coordinates:Array = [
+ {lat:37.3, lng: -121.5},
{lat:-33.86, lng:151.211},
{lat:40.712, lng:-74.0059},
{lat:19.26, lng:-99.03},
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0c568e3c/frameworks/projects/GoogleMaps/src/main/flex/org/apache/flex/maps/google/beads/GoogleMapView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/GoogleMaps/src/main/flex/org/apache/flex/maps/google/beads/GoogleMapView.as b/frameworks/projects/GoogleMaps/src/main/flex/org/apache/flex/maps/google/beads/GoogleMapView.as
index 658bfd2..f64e909 100644
--- a/frameworks/projects/GoogleMaps/src/main/flex/org/apache/flex/maps/google/beads/GoogleMapView.as
+++ b/frameworks/projects/GoogleMaps/src/main/flex/org/apache/flex/maps/google/beads/GoogleMapView.as
@@ -153,7 +153,7 @@ package org.apache.flex.maps.google.beads
{
mapit(37.333, -121.900, 12);
initialized = true;
- dispatchEvent(new Event('ready'));
+ IEventDispatcher(_strand).dispatchEvent(new Event('ready'));
}
/**