Return-Path: X-Original-To: apmail-flex-commits-archive@www.apache.org Delivered-To: apmail-flex-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6D5BC1825A for ; Mon, 24 Aug 2015 05:32:55 +0000 (UTC) Received: (qmail 71071 invoked by uid 500); 24 Aug 2015 05:32:52 -0000 Delivered-To: apmail-flex-commits-archive@flex.apache.org Received: (qmail 71005 invoked by uid 500); 24 Aug 2015 05:32:52 -0000 Mailing-List: contact commits-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flex.apache.org Delivered-To: mailing list commits@flex.apache.org Received: (qmail 70214 invoked by uid 99); 24 Aug 2015 05:32:52 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Aug 2015 05:32:52 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C2793DFC63; Mon, 24 Aug 2015 05:32:51 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: aharui@apache.org To: commits@flex.apache.org Date: Mon, 24 Aug 2015 05:33:08 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [18/34] git commit: [flex-asjs] [refs/heads/develop] - move examples into a flexjs folder now that we have a native folder for low-level examples http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/FlexJSStore_jquery/src/productsView/CatalogTitleButtons.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/FlexJSStore_jquery/src/productsView/CatalogTitleButtons.mxml b/examples/flexjs/FlexJSStore_jquery/src/productsView/CatalogTitleButtons.mxml new file mode 100755 index 0000000..9dbd4c8 --- /dev/null +++ b/examples/flexjs/FlexJSStore_jquery/src/productsView/CatalogTitleButtons.mxml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/FlexJSStore_jquery/src/productsView/Grip.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/FlexJSStore_jquery/src/productsView/Grip.mxml b/examples/flexjs/FlexJSStore_jquery/src/productsView/Grip.mxml new file mode 100755 index 0000000..2938156 --- /dev/null +++ b/examples/flexjs/FlexJSStore_jquery/src/productsView/Grip.mxml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/FlexJSStore_jquery/src/productsView/ProductCart.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/FlexJSStore_jquery/src/productsView/ProductCart.mxml b/examples/flexjs/FlexJSStore_jquery/src/productsView/ProductCart.mxml new file mode 100755 index 0000000..8c42027 --- /dev/null +++ b/examples/flexjs/FlexJSStore_jquery/src/productsView/ProductCart.mxml @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/FlexJSStore_jquery/src/productsView/ProductCatalogPanel.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/FlexJSStore_jquery/src/productsView/ProductCatalogPanel.mxml b/examples/flexjs/FlexJSStore_jquery/src/productsView/ProductCatalogPanel.mxml new file mode 100755 index 0000000..47597ed --- /dev/null +++ b/examples/flexjs/FlexJSStore_jquery/src/productsView/ProductCatalogPanel.mxml @@ -0,0 +1,547 @@ + + + + + + [Event(name="purchase", type="samples.flexstore.ProductThumbEvent")] + [Event(name="compare", type="samples.flexstore.ProductThumbEvent")] + [Event(name="details", type="samples.flexstore.ProductThumbEvent")] + + + + 0) + { + var p:Parallel = new Parallel(); + n = targets.length; + for (i = 0; i < n; i++) + { + var fadeOut:Fade = new Fade(targets[i] as IUIBase); + fadeOut.alphaFrom = 1; + fadeOut.alphaTo = .1; + p.addChild(fadeOut); + } + p.play(); + p.addEventListener(Effect.EFFECT_END, + function(event:org.apache.flex.events.Event):void + { + layoutCatalog(); + }); + } + else if (!live) + { + layoutCatalog(); + } + } + + private function layoutCatalog():Effect + { + var tileWidth:Number; + var tileHeight:Number; + var numCols:int; + + if (filterCount > 9 || currentState == "compare") + { + numCols = 4; + tileWidth = ProductCatalogThumbnail.COL_WIDTH_4; + tileWidth = currentState == "compare" + ? ProductCatalogThumbnail.COMPARE_WIDTH + : ProductCatalogThumbnail.COL_WIDTH_4 + tileHeight = currentState == "compare" + ? height - 4 + : ProductCatalogThumbnail.COL_HEIGHT_4; + } + else if (filterCount > 4) + { + numCols = 3; + tileWidth = ProductCatalogThumbnail.COL_WIDTH_3; + tileHeight = ProductCatalogThumbnail.COL_HEIGHT_3; + } + else if (filterCount <= 9) + { + numCols = 2; + tileWidth = ProductCatalogThumbnail.COL_WIDTH_2; + tileHeight = ProductCatalogThumbnail.COL_HEIGHT_2; + } + else + { + } + + var row:int = 0; + var col:int = -1; + + var move:Move = null; + + var n:int = catalog.length; + for (var i:int = 0 ; i < n ; i++) + { + var product:Product = catalog.getItemAt(i) as Product; + var thumb:ProductCatalogThumbnail = thumbnails[i]; + if (accepted[product.productId.toString()]) + { + thumb.currentState = "x" + numCols + "cols"; + col++; + if (col > numCols - 1) + { + row++; + col = 0; + } + + var xTo:Number = col * (tileWidth + ProductCatalogThumbnail.HORIZONTAL_GAP); + var yTo:Number = row * (tileHeight + ProductCatalogThumbnail.VERTICAL_GAP); + + // If the thumbnail is already visible + // animate it to its new position. + if (thumb.visible) + { + // Animate only if the position is different + // from its current position. + if (thumb.x != xTo || thumb.y != yTo) + { + move = new Move(thumb); + move.xTo = xTo; + move.yTo = yTo; + move.play(); + } + } + + // If the thumbnail was not previously visible, sets its + // x and y coordinates. We'll make it reappear after all + // the visible thumbnails have reached their new position. + else + { + thumb.x = xTo; + thumb.y = yTo; +// thumb.includeInLayout = true; + } + } + else + { + thumb.visible = false; +// thumb.includeInLayout = false; + } + } + + if (!move) + { + // No visible thumbnails were animated to a new position; + // fade in newly selected thumbnails right away. + fadeInThumbnails(); + } + else + { + //since movement is happening get the scrollbar back to the top + scv.verticalScrollPosition = 0; + // Fade in newly selected thumbnails after the last + // visible thumbnail has moved to its new position. + move.addEventListener(Effect.EFFECT_END, + function(event:org.apache.flex.events.Event):void + { + fadeInThumbnails(); + }); + } + thumbContentGroup.dispatchEvent(new org.apache.flex.events.Event("layoutNeeded")); + //return the last move to watch + return move; + } + + //return the last effect so we could add effectEnd handler if desired + private function fadeInThumbnails():void + { + var n:int = thumbnails.length; + var targets:Array = []; + for (var i:int = 0; i < n ; i++) + { + var thumb:ProductCatalogThumbnail = thumbnails[i]; + if (accepted[thumb.product.productId.toString()] && !thumb.visible) + { + thumb.alpha = 0; + thumb.visible = true; + targets.push(thumb); + } + } + if (targets.length > 0) + { + n = targets.length; + for (i = 0; i < n; i++) + { + var effect:Fade = new Fade(targets[i] as IUIBase); + effect.alphaTo = 1; + effect.play(); + } + } + } + + private function showDetails(product:Product):void + { + if (currentState == "details") + { + details.product = product; + return; + } + + var row:int = -1; + + //should be computed using border metrics instead of hard-coding the 20, but... + var xTo:Number = thumbContent.width - ProductCatalogThumbnail.COL_WIDTH_4 - 20; + var yTo:Number; + + var move:Move; + var first:Boolean = true; + var selectedThumb:ProductCatalogThumbnail; + + var n:int = thumbnails.length; + for (var i:int = 0; i < n; i++) + { + var thumb:ProductCatalogThumbnail = thumbnails[i]; + if (thumb.visible) + { + row++; + yTo = row * (ProductCatalogThumbnail.COL_HEIGHT_4 + ProductCatalogThumbnail.VERTICAL_GAP); + + thumb.currentState = "x4cols"; + + if (thumb.x != xTo || thumb.y != yTo) + { + move = new Move(thumb); + if (first) + { + move.addEventListener(Effect.EFFECT_END, + function(event:org.apache.flex.events.Event):void + { + details.product = product; + currentState = "details"; + }); + + first = false; + } + move.xTo = xTo; + move.yTo = yTo; + move.play(); + } + + if (thumb.product == product) + { + selectedThumb = thumb; + } + } + } + if (selectedThumb != null) + { + //make sure that the selected thumb is visible in the list on the right + move.addEventListener(Effect.EFFECT_END, + function(e:org.apache.flex.events.Event):void + { + var curpos:int = scv.verticalScrollPosition; + if (selectedThumb.y < curpos) + { + scv.verticalScrollPosition = y; + } + else if (selectedThumb.y + ProductCatalogThumbnail.COL_HEIGHT_4 > curpos + thumbContent.height) + { + //this logic doesn't seem to be perfect but it will do + var diff:int = selectedThumb.y - (curpos + thumbContent.height) + scv.verticalScrollPosition += diff + ProductCatalogThumbnail.COL_HEIGHT_4 + ProductCatalogThumbnail.VERTICAL_GAP; + } + }); + } + + } + + private function productThumbEventHandler(event:ProductThumbEvent):void + { + if (event.type == ProductThumbEvent.DETAILS) + { + showDetails(event.product); + } + else if (event.type == ProductThumbEvent.BROWSE) + { + if (thumbnailState == "browse") + { + currentState = "browse"; + layoutCatalog(); + } + else + { + compare(); + } + } + else + { + dispatchEvent(event); + } + } + + public function compare(toCompare:Array=null):void + { + currentState = "compare"; + thumbnailState = "compare"; + if (toCompare != null) + { + var n:int = thumbnails.length; + for (var i:int = 0; i < n; i++) + { + accepted[thumbnails[i].product.productId.toString()] = false; + } + for (i=0; i < toCompare.length; i++) + { + accepted[toCompare[i].productId.toString()] = true; + } + } + var lastEffect:Effect = layoutCatalog(); + if (lastEffect != null) + { + lastEffect.addEventListener(Effect.EFFECT_END, + function (event:org.apache.flex.events.Event):void + { + setCompareState(); + }); + } + else + { + setCompareState(); + } + } + + private function setCompareState():void + { + //avoid an issue if the user clicks quickly where we move into + //compare state even though we're no longer in compare + if (currentState == "compare") + { + var n:int = thumbnails.length; + for (var i:int = 0; i < n; i++) + { + var thumb:ProductCatalogThumbnail = thumbnails[i]; + if (accepted[thumb.product.productId.toString()]) + { + thumb.currentState = "compare"; + } + } + + } + } + + public function acceptingDrop(dropTarget:Object, type:String):void + { + + } + + public function acceptedDrop(dropTarget:Object, type:String):void + { + + } + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/FlexJSStore_jquery/src/productsView/ProductCatalogPanelTitleBarView.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/FlexJSStore_jquery/src/productsView/ProductCatalogPanelTitleBarView.mxml b/examples/flexjs/FlexJSStore_jquery/src/productsView/ProductCatalogPanelTitleBarView.mxml new file mode 100755 index 0000000..b89c7b6 --- /dev/null +++ b/examples/flexjs/FlexJSStore_jquery/src/productsView/ProductCatalogPanelTitleBarView.mxml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/FlexJSStore_jquery/src/productsView/ProductCatalogThumbnail.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/FlexJSStore_jquery/src/productsView/ProductCatalogThumbnail.mxml b/examples/flexjs/FlexJSStore_jquery/src/productsView/ProductCatalogThumbnail.mxml new file mode 100755 index 0000000..848d202 --- /dev/null +++ b/examples/flexjs/FlexJSStore_jquery/src/productsView/ProductCatalogThumbnail.mxml @@ -0,0 +1,220 @@ + + + + + + + + + + + + + [Event(name="purchase", type="samples.flexstore.ProductThumbEvent")] + [Event(name="compare", type="samples.flexstore.ProductThumbEvent")] + [Event(name="details", type="samples.flexstore.ProductThumbEvent")] + + + + + + + + + + + + + + + + + + + + + " + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/FlexJSStore_jquery/src/productsView/ProductDetails.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/FlexJSStore_jquery/src/productsView/ProductDetails.mxml b/examples/flexjs/FlexJSStore_jquery/src/productsView/ProductDetails.mxml new file mode 100755 index 0000000..d1b89ab --- /dev/null +++ b/examples/flexjs/FlexJSStore_jquery/src/productsView/ProductDetails.mxml @@ -0,0 +1,150 @@ + + + + + + + + + [Event(name="purchase", type="samples.flexstore.ProductThumbEvent")] + [Event(name="compare", type="samples.flexstore.ProductThumbEvent")] + [Event(name="browse", type="samples.flexstore.ProductThumbEvent")] + + + + + + + + + + + + + + + + + + + + + + + + + Features + Support + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/FlexJSStore_jquery/src/productsView/ProductFilterPanel.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/FlexJSStore_jquery/src/productsView/ProductFilterPanel.mxml b/examples/flexjs/FlexJSStore_jquery/src/productsView/ProductFilterPanel.mxml new file mode 100755 index 0000000..cffd4a4 --- /dev/null +++ b/examples/flexjs/FlexJSStore_jquery/src/productsView/ProductFilterPanel.mxml @@ -0,0 +1,215 @@ + + + + + + + + + + [Event(name="filter", type="samples.flexstore.ProductFilterEvent")] + [Event("compare")] + + + + 0) + { + dispatchEvent(new Event("compare")); + currentState = "showingComparison"; + } + else + { + SimpleAlert.show("There are no items to compare.", "Compare"); + } + } + + ]]> + + + + {series.selectedItem} + {loPrice.value} + {hiPrice.value} + {cbBlazeDS.selected} + {cbMobile.selected} + {cbVideo.selected} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + All + 3 + 5 + 7 + 9 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/FlexJSStore_jquery/src/productsView/ProductList.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/FlexJSStore_jquery/src/productsView/ProductList.mxml b/examples/flexjs/FlexJSStore_jquery/src/productsView/ProductList.mxml new file mode 100755 index 0000000..c1a67c7 --- /dev/null +++ b/examples/flexjs/FlexJSStore_jquery/src/productsView/ProductList.mxml @@ -0,0 +1,216 @@ + + + + + + + + + + [Event(name="addProduct", type="samples.flexstore.ProductListEvent")] + [Event(name="duplicateProduct", type="samples.flexstore.ProductListEvent")] + [Event(name="productQtyChange", type="samples.flexstore.ProductListEvent")] + [Event(name="removeProduct", type="samples.flexstore.ProductListEvent")] + + + + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/FlexJSStore_jquery/src/productsView/ProductListItem.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/FlexJSStore_jquery/src/productsView/ProductListItem.mxml b/examples/flexjs/FlexJSStore_jquery/src/productsView/ProductListItem.mxml new file mode 100755 index 0000000..0a83e1a --- /dev/null +++ b/examples/flexjs/FlexJSStore_jquery/src/productsView/ProductListItem.mxml @@ -0,0 +1,130 @@ + + + + + + + [Event(name="productQtyChange", type="samples.flexstore.ProductListEvent")] + [Event(name="removeProduct", type="samples.flexstore.ProductListEvent")] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/FlexJSStore_jquery/src/productsView/ProductSupport.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/FlexJSStore_jquery/src/productsView/ProductSupport.mxml b/examples/flexjs/FlexJSStore_jquery/src/productsView/ProductSupport.mxml new file mode 100755 index 0000000..b3c8429 --- /dev/null +++ b/examples/flexjs/FlexJSStore_jquery/src/productsView/ProductSupport.mxml @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/FlexJSStore_jquery/src/samples/flexstore/ButtonBarButtonSkin.as ---------------------------------------------------------------------- diff --git a/examples/flexjs/FlexJSStore_jquery/src/samples/flexstore/ButtonBarButtonSkin.as b/examples/flexjs/FlexJSStore_jquery/src/samples/flexstore/ButtonBarButtonSkin.as new file mode 100755 index 0000000..5e94b58 --- /dev/null +++ b/examples/flexjs/FlexJSStore_jquery/src/samples/flexstore/ButtonBarButtonSkin.as @@ -0,0 +1,298 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 samples.flexstore +{ + +import flash.display.GradientType; +import mx.containers.BoxDirection; +import mx.controls.Button; +import mx.controls.ButtonBar; +import mx.skins.Border; +import mx.skins.halo.*; +import mx.styles.StyleManager; +import mx.utils.ColorUtil; + +/** + * Adapted from mx.skins.halo.ButtonBarButtonSkin. + * This version of the ButtonBarButtonSkin is applied for the + * selectedOver, selectedUp, and over states to use the 2nd two + * values of the fillColors for the selected state of the + * button. The over state then uses a computed value from + * the themeColor to show emphasis. The border of the selected + * button also uses a computed value from the themeColor, but + * is partially transparent. + */ +public class ButtonBarButtonSkin extends Border +{ + //-------------------------------------------------------------------------- + // + // Class variables + // + //-------------------------------------------------------------------------- + + /** + * @private + */ + private static var cache:Object = {}; + + //-------------------------------------------------------------------------- + // + // Class methods + // + //-------------------------------------------------------------------------- + + /** + * @private + * Several colors used for drawing are calculated from the base colors + * of the component (themeColor, borderColor and fillColors). + * Since these calculations can be a bit expensive, + * we calculate once per color set and cache the results. + */ + private static function calcDerivedStyles(themeColor:uint, + fillColor0:uint, + fillColor1:uint):Object + { + var key:String = HaloColors.getCacheKey(themeColor, + fillColor0, fillColor1); + + if (!cache[key]) + { + var o:Object = cache[key] = {}; + + // Cross-component styles. + HaloColors.addHaloColors(o, themeColor, fillColor0, fillColor1); + + // Button-specific styles. + o.innerEdgeColor1 = ColorUtil.adjustBrightness2(fillColor0, -10); + o.innerEdgeColor2 = ColorUtil.adjustBrightness2(fillColor1, -25); + } + + return cache[key]; + } + + //-------------------------------------------------------------------------- + // + // Constructor + // + //-------------------------------------------------------------------------- + + /** + * @private + * Constructor. + */ + public function ButtonBarButtonSkin() + { + super(); + } + + //-------------------------------------------------------------------------- + // + // Overridden properties + // + //-------------------------------------------------------------------------- + + //---------------------------------- + // measuredWidth + //---------------------------------- + + /** + * @private + */ + override public function get measuredWidth():Number + { + return 50; + } + + //---------------------------------- + // measuredHeight + //---------------------------------- + + /** + * @private + */ + override public function get measuredHeight():Number + { + return 22; + } + + //-------------------------------------------------------------------------- + // + // Overridden methods + // + //-------------------------------------------------------------------------- + + /** + * @private + */ + override protected function updateDisplayList(w:Number, h:Number):void + { + super.updateDisplayList(w, h); + + // User-defined styles. + var borderColor:uint = getStyle("borderColor"); + var cornerRadius:Number = getStyle("cornerRadius"); + var fillAlphas:Array = getStyle("fillAlphas"); + var fillColors:Array = getStyle("fillColors"); + styleManager.getColorNames(fillColors); + var highlightAlphas:Array = getStyle("highlightAlphas"); + var themeColor:uint = getStyle("themeColor"); + + // Derivative styles. + var derStyles:Object = calcDerivedStyles(themeColor, fillColors[0], + fillColors[1]); + + var borderColorDrk1:Number = + ColorUtil.adjustBrightness2(borderColor, -50); + + var themeColorDrk1:Number = + ColorUtil.adjustBrightness2(themeColor, -25); + + var emph:Boolean = false; + + if (parent is Button) + emph = (parent as Button).emphasized; + + var tmp:Number; + + var bar:ButtonBar = parent ? ButtonBar(parent.parent) : null; + var horizontal:Boolean = true; + var pos:int = 0; + + if (bar) + { + if (bar.direction == BoxDirection.VERTICAL) + horizontal = false; + + // first: -1, middle: 0, last: 1 + var index:int = bar.getChildIndex(parent); + pos = (index == 0 ? -1 : (index == bar.numChildren - 1 ? 1 : 0)); + } + + var radius:Object = getCornerRadius(pos, horizontal, cornerRadius); + var cr:Object = getCornerRadius(pos, horizontal, cornerRadius); + var cr1:Object = getCornerRadius(pos, horizontal, cornerRadius - 1); + var cr2:Object = getCornerRadius(pos, horizontal, cornerRadius - 2); + var cr3:Object = getCornerRadius(pos, horizontal, cornerRadius - 3); + + graphics.clear(); + + switch (name) + { + case "selectedUpSkin": + case "selectedOverSkin": + { + var overFillColors:Array; + if (fillColors.length > 2) + overFillColors = [ fillColors[2], fillColors[3] ]; + else + overFillColors = [ fillColors[0], fillColors[1] ]; + + var overFillAlphas:Array; + if (fillAlphas.length > 2) + overFillAlphas = [ fillAlphas[2], fillAlphas[3] ]; + else + overFillAlphas = [ fillAlphas[0], fillAlphas[1] ]; + + // button border/edge + drawRoundRect( + 0, 0, w, h, cr, + [ themeColor, derStyles.themeColDrk1 ], 0.5, + verticalGradientMatrix(0, 0, w , h), + GradientType.LINEAR, null, + { x: 1, y: 1, w: w - 2, h: h - 2, r: cr1 }); + + // button fill + drawRoundRect( + 1, 1, w - 2, h - 2, cr1, + overFillColors, overFillAlphas, + verticalGradientMatrix(0, 0, w - 2, h - 2)); + + // top highlight + if (!(radius is Number)) + { radius.bl = radius.br = 0;} + drawRoundRect( + 1, 1, w - 2, (h - 2) / 2, radius, + [ 0xFFFFFF, 0xFFFFFF ], highlightAlphas, + verticalGradientMatrix(1, 1, w - 2, (h - 2) / 2)); + break; + } + + case "overSkin": + { + // button border/edge + drawRoundRect( + 0, 0, w, h, cr, + [ themeColor, derStyles.themeColDrk1 ], 0.5, + verticalGradientMatrix(0, 0, w, h)); + + // button fill + drawRoundRect( + 1, 1, w - 2, h - 2, cr1, + [ derStyles.fillColorPress1, derStyles.fillColorPress2 ], 1, + verticalGradientMatrix(0, 0, w - 2, h - 2)); + + // top highlight + if (!(radius is Number)) + { radius.bl = radius.br = 0;} + drawRoundRect( + 1, 1, w - 2, (h - 2) / 2, radius, + [ 0xFFFFFF, 0xFFFFFF ], highlightAlphas, + verticalGradientMatrix(1, 1, w - 2, (h - 2) / 2)); + + break; + } + } + } + + //-------------------------------------------------------------------------- + // + // Methods + // + //-------------------------------------------------------------------------- + + /** + * @private + */ + private function getCornerRadius(pos:int, horizontal:Boolean, + radius:Number):Object + { + if (pos == 0) + return 0; + + radius = Math.max(0, radius); + + if (horizontal) + { + if (pos == -1) + return { tl: radius, tr: 0, bl: radius, br: 0 }; + else // pos == 1 + return { tl: 0, tr: radius, bl: 0, br: radius }; + } + else + { + if (pos == -1) + return { tl: radius, tr: radius, bl: 0, br: 0 }; + else // pos == 1 + return { tl: 0, tr: 0, bl: radius, br: radius }; + } + } +} + +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/FlexJSStore_jquery/src/samples/flexstore/Product.as ---------------------------------------------------------------------- diff --git a/examples/flexjs/FlexJSStore_jquery/src/samples/flexstore/Product.as b/examples/flexjs/FlexJSStore_jquery/src/samples/flexstore/Product.as new file mode 100755 index 0000000..040fb8f --- /dev/null +++ b/examples/flexjs/FlexJSStore_jquery/src/samples/flexstore/Product.as @@ -0,0 +1,78 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 samples.flexstore +{ + +[Bindable] +public class Product +{ + + public var productId:int; + public var name:String; + public var description:String; + public var price:Number; + public var image:String; + public var experience:String; + public var blazeds:Boolean; + public var mobile:Boolean; + public var video:Boolean; + public var highlight1:String; + public var highlight2:String; + public var qty:int; + + public function Product() + { + + } + + public function fill(obj:Object):void + { + for (var i:String in obj) + { + this[i] = obj[i]; + } + } + + [Bindable(event="propertyChange")] + public function get featureString():String + { + var str:String = ""; + if (blazeds) + str += "BlazeDS"; + + if (mobile) + { + if (str.length > 0) + str += "\n"; + str += "Mobile"; + } + + if (video) + { + if (str.length > 0) + str += "\n"; + str += "Video"; + } + + return str; + } + +} + +} \ No newline at end of file