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 457a6f9 join all emphasis button styles in one single property and its constants, and update all examples accordingly 457a6f9 is described below commit 457a6f9cf2c581a9f8091c8e708c92e96f8faf96 Author: Carlos Rovira <carlosrov...@apache.org> AuthorDate: Thu Jun 14 15:17:17 2018 +0200 join all emphasis button styles in one single property and its constants, and update all examples accordingly --- .../royale/BE0002_Using_Jewel_Alert_Control.mxml | 2 +- .../royale/BE0003_Using_Jewel_Slider_Control.mxml | 2 +- .../BE0004_Adding_an_item_to_a_Jewel_List.mxml | 2 +- ...005_Creating_a_group_of_Jewel_RadioButtons.mxml | 2 +- ...ns_from_a_group_of_jewel_checkbox_controls.mxml | 2 +- ..._Using_View_States_to_show_or_hide_content.mxml | 2 +- .../src/main/royale/ButtonPlayGround.mxml | 16 +- .../src/main/royale/ListPlayGround.mxml | 8 +- .../src/main/royale/SliderPlayGround.mxml | 7 +- .../src/main/royale/TextInputPlayGround.mxml | 9 +- .../RemoteObjectAMFTest/src/main/royale/App.mxml | 8 +- .../main/royale/org/apache/royale/jewel/Button.as | 165 +++++---------------- .../apache/royale/jewel/beads/views/AlertView.as | 4 +- .../jewel/beads/views/JewelLabelViewBead.mxml | 2 +- 14 files changed, 77 insertions(+), 154 deletions(-) diff --git a/examples/blog/BE0002_Using_Jewel_Alert_Control/src/main/royale/BE0002_Using_Jewel_Alert_Control.mxml b/examples/blog/BE0002_Using_Jewel_Alert_Control/src/main/royale/BE0002_Using_Jewel_Alert_Control.mxml index b498192..35441d2 100644 --- a/examples/blog/BE0002_Using_Jewel_Alert_Control/src/main/royale/BE0002_Using_Jewel_Alert_Control.mxml +++ b/examples/blog/BE0002_Using_Jewel_Alert_Control/src/main/royale/BE0002_Using_Jewel_Alert_Control.mxml @@ -46,7 +46,7 @@ <j:initialView> <j:View> - <j:Button id="button" text="Click Me" primary="true" click="clickHandler(event)"/> + <j:Button id="button" text="Click Me" emphasis ="primary" click="clickHandler(event)"/> </j:View> </j:initialView> diff --git a/examples/blog/BE0003_Using_Jewel_Slider_Control/src/main/royale/BE0003_Using_Jewel_Slider_Control.mxml b/examples/blog/BE0003_Using_Jewel_Slider_Control/src/main/royale/BE0003_Using_Jewel_Slider_Control.mxml index 8a701c6..2ac86e9 100644 --- a/examples/blog/BE0003_Using_Jewel_Slider_Control/src/main/royale/BE0003_Using_Jewel_Slider_Control.mxml +++ b/examples/blog/BE0003_Using_Jewel_Slider_Control/src/main/royale/BE0003_Using_Jewel_Slider_Control.mxml @@ -50,7 +50,7 @@ <j:Slider id="slider_h" width="250" value="80" minimum="40" maximum="300" valueChange="onValueChange(event)"/> - <j:Button id="button" text="Slider to 400x200" width="250" height="80" secondary="true" + <j:Button id="button" text="Slider to 400x200" width="250" height="80" emphasis="secondary" click="clickHandler(event)"/> </j:View> </j:initialView> diff --git a/examples/blog/BE0004_Adding_an_item_to_a_Jewel_List/src/main/royale/BE0004_Adding_an_item_to_a_Jewel_List.mxml b/examples/blog/BE0004_Adding_an_item_to_a_Jewel_List/src/main/royale/BE0004_Adding_an_item_to_a_Jewel_List.mxml index f03c341..4111f04 100644 --- a/examples/blog/BE0004_Adding_an_item_to_a_Jewel_List/src/main/royale/BE0004_Adding_an_item_to_a_Jewel_List.mxml +++ b/examples/blog/BE0004_Adding_an_item_to_a_Jewel_List/src/main/royale/BE0004_Adding_an_item_to_a_Jewel_List.mxml @@ -50,7 +50,7 @@ <j:Label id="selected"/> - <j:Button width="200" primary="true" text="who is missing?" click="clickHandler(event)"/> + <j:Button width="200" emphasis ="primary" text="who is missing?" click="clickHandler(event)"/> </j:View> </j:initialView> diff --git a/examples/blog/BE0005_Creating_a_group_of_Jewel_RadioButtons/src/main/royale/BE0005_Creating_a_group_of_Jewel_RadioButtons.mxml b/examples/blog/BE0005_Creating_a_group_of_Jewel_RadioButtons/src/main/royale/BE0005_Creating_a_group_of_Jewel_RadioButtons.mxml index 07657be..265c5e6 100644 --- a/examples/blog/BE0005_Creating_a_group_of_Jewel_RadioButtons/src/main/royale/BE0005_Creating_a_group_of_Jewel_RadioButtons.mxml +++ b/examples/blog/BE0005_Creating_a_group_of_Jewel_RadioButtons/src/main/royale/BE0005_Creating_a_group_of_Jewel_RadioButtons.mxml @@ -50,7 +50,7 @@ <j:Label id="result" text="The radio button selected has the value:"/> - <j:Button text="disable/enable option 3" primary="true" click="opt3disable.disabled = !opt3disable.disabled"/> + <j:Button text="disable/enable option 3" emphasis ="primary" click="opt3disable.disabled = !opt3disable.disabled"/> </j:View> </j:initialView> diff --git a/examples/blog/BE0007_Selecting_options_from_a_group_of_jewel_checkbox_controls/src/main/royale/BE0007_Selecting_options_from_a_group_of_jewel_checkbox_controls.mxml b/examples/blog/BE0007_Selecting_options_from_a_group_of_jewel_checkbox_controls/src/main/royale/BE0007_Selecting_options_from_a_group_of_jewel_checkbox_controls.mxml index cd7d2f3..f3aeae7 100644 --- a/examples/blog/BE0007_Selecting_options_from_a_group_of_jewel_checkbox_controls/src/main/royale/BE0007_Selecting_options_from_a_group_of_jewel_checkbox_controls.mxml +++ b/examples/blog/BE0007_Selecting_options_from_a_group_of_jewel_checkbox_controls/src/main/royale/BE0007_Selecting_options_from_a_group_of_jewel_checkbox_controls.mxml @@ -59,7 +59,7 @@ <j:Label id="result" text="The options selected are:"/> - <j:Button text="disable/enable option 3" primary="true" click="opt3disable.disabled = !opt3disable.disabled"/> + <j:Button text="disable/enable option 3" emphasis="primary" click="opt3disable.disabled = !opt3disable.disabled"/> </j:View> </j:initialView> diff --git a/examples/blog/BE0008_Using_View_States_to_show_or_hide_content/src/main/royale/BE0008_Using_View_States_to_show_or_hide_content.mxml b/examples/blog/BE0008_Using_View_States_to_show_or_hide_content/src/main/royale/BE0008_Using_View_States_to_show_or_hide_content.mxml index 42c9c04..a126e84 100644 --- a/examples/blog/BE0008_Using_View_States_to_show_or_hide_content/src/main/royale/BE0008_Using_View_States_to_show_or_hide_content.mxml +++ b/examples/blog/BE0008_Using_View_States_to_show_or_hide_content/src/main/royale/BE0008_Using_View_States_to_show_or_hide_content.mxml @@ -41,7 +41,7 @@ <j:PasswordInput/> </j:beads> </j:TextInput> - <j:Button text="Login" primary="true" click="view.currentState = 'loggedIn'" /> + <j:Button text="Login" emphasis="primary" click="view.currentState = 'loggedIn'" /> </j:Card> <j:Card id="loggedInForm" includeIn="loggedIn"> diff --git a/examples/royale/JewelExample/src/main/royale/ButtonPlayGround.mxml b/examples/royale/JewelExample/src/main/royale/ButtonPlayGround.mxml index 2b15276..eeeef51 100644 --- a/examples/royale/JewelExample/src/main/royale/ButtonPlayGround.mxml +++ b/examples/royale/JewelExample/src/main/royale/ButtonPlayGround.mxml @@ -25,7 +25,7 @@ limitations under the License. <fx:Script> <![CDATA[ private function clickHandler(event:MouseEvent):void { - button.primary = !button.primary; + button.emphasis = (button.emphasis == Button.PRIMARY) ? "" : Button.PRIMARY; } ]]> </fx:Script> @@ -38,10 +38,10 @@ limitations under the License. <j:Button text="Default" id="button" click="clickHandler(event)"/> <j:Button text="Button With More Text"/> - <j:Button text="Primary" primary="true"/> - <j:Button text="Secondary" secondary="true"/> - <j:Button text="Emphasized" emphasized="true"/> - <j:Button text="Disabled" primary="true"> + <j:Button text="Primary" emphasis="{Button.PRIMARY}"/> + <j:Button text="Secondary" emphasis="{Button.SECONDARY}"/> + <j:Button text="Emphasized" emphasis="{Button.EMPHASIZED}"/> + <j:Button text="Disabled" emphasis="{Button.PRIMARY}"> <j:beads> <j:Disabled/> </j:beads> @@ -50,8 +50,8 @@ limitations under the License. <html:H4 text="Sizes"/> <j:Button text="xsmall" size="{Button.XSMALL}"/> - <j:Button text="small" size="{Button.SMALL}" primary="true"/> - <j:Button text="large" size="{Button.LARGE}" secondary="true"/> - <j:Button text="xlarge" size="{Button.XLARGE}" emphasized="true"/> + <j:Button text="small" size="{Button.SMALL}" emphasis="{Button.PRIMARY}"/> + <j:Button text="large" size="{Button.LARGE}" emphasis="{Button.SECONDARY}"/> + <j:Button text="xlarge" size="{Button.XLARGE}" emphasis="{Button.EMPHASIZED}"/> </j:Card> diff --git a/examples/royale/JewelExample/src/main/royale/ListPlayGround.mxml b/examples/royale/JewelExample/src/main/royale/ListPlayGround.mxml index 125c293..ec34d6e 100644 --- a/examples/royale/JewelExample/src/main/royale/ListPlayGround.mxml +++ b/examples/royale/JewelExample/src/main/royale/ListPlayGround.mxml @@ -31,7 +31,7 @@ limitations under the License. selected.text = "Selected: " + list.selectedItem; } - private var _simple:ArrayList = new ArrayList(["Blueberries", "Bananas", "Lemons", "Oranges", "Watermelons"]); + private var _simple:ArrayList = new ArrayList(["Blueberries", "Bananas", "Lemons", "Oranges", "Watermelons", "1", "2", "3", "4", "5", "6", "7"]); public function get simple():ArrayList { @@ -54,6 +54,10 @@ limitations under the License. <models:ListsModel/> </j:model> + <j:beads> + <js:ContainerDataBinding/> + </j:beads> + <html:H3 text="Jewel List"/> <j:List id="list" width="200" height="300" change="onChange(event)"> @@ -66,6 +70,6 @@ limitations under the License. <j:Label id="selected"/> - <j:Button text="Assign new data" primary="true" click="assignNewData()"/> + <j:Button text="Assign new data" emphasis="{Button.PRIMARY}" click="assignNewData()"/> </j:Card> diff --git a/examples/royale/JewelExample/src/main/royale/SliderPlayGround.mxml b/examples/royale/JewelExample/src/main/royale/SliderPlayGround.mxml index a09e5bb..d29fb91 100644 --- a/examples/royale/JewelExample/src/main/royale/SliderPlayGround.mxml +++ b/examples/royale/JewelExample/src/main/royale/SliderPlayGround.mxml @@ -19,6 +19,7 @@ limitations under the License. --> <j:Card 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"> <fx:Script> @@ -51,6 +52,10 @@ limitations under the License. ]]> </fx:Script> + <j:beads> + <js:ContainerDataBinding/> + </j:beads> + <html:H3 text="Jewel Slider"/> <j:Slider id="slider_w" width="250" value="250" minimum="100" maximum="500" @@ -68,7 +73,7 @@ limitations under the License. </j:beads> </j:Slider> - <j:Button id="button" text="Slider to 400x200" width="250" height="80" primary="true" + <j:Button id="button" text="Slider to 400x200" width="250" height="80" emphasis="{Button.PRIMARY}" click="clickHandler(event)"/> </j:Card> diff --git a/examples/royale/JewelExample/src/main/royale/TextInputPlayGround.mxml b/examples/royale/JewelExample/src/main/royale/TextInputPlayGround.mxml index 356a698..898d829 100644 --- a/examples/royale/JewelExample/src/main/royale/TextInputPlayGround.mxml +++ b/examples/royale/JewelExample/src/main/royale/TextInputPlayGround.mxml @@ -19,15 +19,20 @@ limitations under the License. --> <j:Card 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"> + <j:beads> + <js:ContainerDataBinding/> + </j:beads> + <html:H3 text="Jewel TextInput"/> <j:Group> <j:beads> <j:HorizontalLayout gap="10"/> </j:beads> - <j:Button text="Check it!" primary="true"/> + <j:Button text="Check it!" emphasis="{Button.PRIMARY}"/> <j:TextInput text="A TextInput"/> </j:Group> @@ -40,7 +45,7 @@ limitations under the License. <j:TextPrompt prompt="With prompt..."/> </j:beads> </j:TextInput> - <j:Button text="Send" primary="true"/> + <j:Button text="Send" emphasis="{Button.PRIMARY}"/> </j:Group> <j:TextInput text="Disabled with text..."> diff --git a/examples/royale/RemoteObjectAMFTest/src/main/royale/App.mxml b/examples/royale/RemoteObjectAMFTest/src/main/royale/App.mxml index b0090cc..27efe11 100644 --- a/examples/royale/RemoteObjectAMFTest/src/main/royale/App.mxml +++ b/examples/royale/RemoteObjectAMFTest/src/main/royale/App.mxml @@ -167,7 +167,7 @@ limitations under the License. <j:TextPrompt prompt="Name to send via AMF"/> </j:beads> </j:TextInput> - <j:Button text="Send to Name" primary="true" click="sendName()"/> + <j:Button text="Send to Name" emphasis="primary" click="sendName()"/> </j:Group> <j:Label id="received" text="Received:"/> @@ -190,15 +190,15 @@ limitations under the License. </j:Card> <j:Card width="400"> - <j:Button text="Get Array of ValueObjects" emphasized="true" click="getVOs()" width="100%"/> + <j:Button text="Get Array of ValueObjects" emphasis="emphasized" click="getVOs()" width="100%"/> <j:List id="list" labelField="id" width="100%" height="200" change="reportChange()"/> <j:Label id="received2" text="Selected:"/> </j:Card> <j:Card width="400"> - <j:Button text="Get Some Product" primary="true" click="getSomeProduct()"/> - <j:Button text="Get Some Compressed Product" primary="true" click="getSomeCompressedProduct()"/> + <j:Button text="Get Some Product" true" click="getSomeProduct()"/> + <j:Button text="Get Some Compressed Product" emphasis="primary" click="getSomeCompressedProduct()"/> <j:Label id="received3" text="Received:" multiline="true"/> </j:Card> diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Button.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Button.as index c5bfde8..b6540d2 100644 --- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Button.as +++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Button.as @@ -175,6 +175,11 @@ package org.apache.royale.jewel public static const SMALL:String = "small"; public static const LARGE:String = "large"; public static const XLARGE:String = "xlarge"; + + public static const PRIMARY:String = "primary"; + public static const SECONDARY:String = "secondary"; + public static const EMPHASIZED:String = "emphasized"; + /** * Constructor. * @@ -235,11 +240,11 @@ package org.apache.royale.jewel ITextModel(model).html = value; } - private var _primary:Boolean = false; + private var _emphasis:String; /** - * A boolean flag to activate "primary" effect selector. - * Applies primary color display effect. + * Activate "emphasis" effect selector. Applies emphasis color display effect. + * Possible values are constants (PRIMARY, SECONDARY, EMPHASIZED) * Colors are defined in royale-jewel.css * * @langversion 3.0 @@ -247,75 +252,25 @@ package org.apache.royale.jewel * @playerversion AIR 2.6 * @productversion Royale 0.9.3 */ - public function get primary():Boolean + public function get emphasis():String { - return _primary; + return _emphasis; } - public function set primary(value:Boolean):void + public function set emphasis(value:String):void { - if (_primary != value) + if (_emphasis != value) { - _primary = value; + if(_emphasis) + { + classSelectorList.toggle(_emphasis, false); + } + _emphasis = value; - classSelectorList.toggle("primary", value); + classSelectorList.toggle(_emphasis, value); } } - private var _secondary:Boolean = false; - - /** - * A boolean flag to activate "secondary" effect selector. - * Applies secondary color display effect. - * Colors are defined in royale-jewel.css - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.9.3 - */ - public function get secondary():Boolean - { - return _secondary; - } - - public function set secondary(value:Boolean):void - { - if (_secondary != value) - { - _secondary = value; - - classSelectorList.toggle("secondary", value); - } - } - - private var _emphasized:Boolean = false; - - /** - * A boolean flag to activate "emphasized" effect selector. - * Applies emphasized color display effect. - * Colors are defined in royale-jewel.css - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.9.3 - */ - public function get emphasized():Boolean - { - return _emphasized; - } - - public function set emphasized(value:Boolean):void - { - if (_emphasized != value) - { - _emphasized = value; - - classSelectorList.toggle("emphasized", value); - } - } - private var _size:String = false; /** @@ -374,6 +329,10 @@ package org.apache.royale.jewel public static const LARGE:String = "large"; public static const XLARGE:String = "xlarge"; + public static const PRIMARY:String = "primary"; + public static const SECONDARY:String = "secondary"; + public static const EMPHASIZED:String = "emphasized"; + /** * Constructor. * @@ -432,11 +391,11 @@ package org.apache.royale.jewel this.dispatchEvent('textChange'); } - private var _primary:Boolean = false; + private var _emphasis:String; /** - * A boolean flag to activate "primary" effect selector. - * Applies primary color display effect. + * Activate "emphasis" effect selector. Applies emphasis color display effect. + * Possible values are constants (PRIMARY, SECONDARY, EMPHASIZED) * Colors are defined in royale-jewel.css * * @langversion 3.0 @@ -444,72 +403,22 @@ package org.apache.royale.jewel * @playerversion AIR 2.6 * @productversion Royale 0.9.3 */ - public function get primary():Boolean + public function get emphasis():String { - return _primary; + return _emphasis; } - public function set primary(value:Boolean):void + public function set emphasis(value:String):void { - if (_primary != value) + if (_emphasis != value) { - _primary = value; - - toggleClass("primary", value); - } - } - - private var _secondary:Boolean = false; - - /** - * A boolean flag to activate "secondary" effect selector. - * Applies secondary color display effect. - * Colors are defined in royale-jewel.css - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.9.3 - */ - public function get secondary():Boolean - { - return _secondary; - } - - public function set secondary(value:Boolean):void - { - if (_secondary != value) - { - _secondary = value; - - toggleClass("secondary", value); - } - } - - private var _emphasized:Boolean = false; - - /** - * A boolean flag to activate "emphasized" effect selector. - * Applies emphasized color display effect. - * Colors are defined in royale-jewel.css - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.9.3 - */ - public function get emphasized():Boolean - { - return _emphasized; - } - - public function set emphasized(value:Boolean):void - { - if (_emphasized != value) - { - _emphasized = value; + if(_emphasis) + { + classSelectorList.toggle(_emphasis, false); + } + _emphasis = value; - toggleClass("emphasized", value); + classSelectorList.toggle(_emphasis, value); } } @@ -536,11 +445,11 @@ package org.apache.royale.jewel { if(_size) { - classSelectorList.toggle(_size, false); + toggleClass(_size, false); } _size = value; - classSelectorList.toggle(_size, true); + toggleClass(_size, true); } } diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/AlertView.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/AlertView.as index e70cd74..2a1bb22 100644 --- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/AlertView.as +++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/AlertView.as @@ -168,7 +168,7 @@ package org.apache.royale.jewel.beads.views if( flags & Alert.OK ) { okButton = new Button(); - okButton.primary = true; + okButton.emphasis = "primary"; okButton.text = alertModel.okLabel; okButton.addEventListener("click", handleOK); @@ -187,7 +187,7 @@ package org.apache.royale.jewel.beads.views if( flags & Alert.YES ) { yesButton = new Button(); - yesButton.primary = true; + yesButton.emphasis = "primary"; yesButton.text = alertModel.yesLabel; yesButton.addEventListener("click", handleYes); diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/JewelLabelViewBead.mxml b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/JewelLabelViewBead.mxml index bf69ea5..35e6f17 100644 --- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/JewelLabelViewBead.mxml +++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/JewelLabelViewBead.mxml @@ -38,7 +38,7 @@ limitations under the License. <js:MXMLBeadViewDataBinding /> </js:beads> - <j:Button id="textButton" text="JewelLabelViewBead" primary="true"/> + <j:Button id="textButton" text="JewelLabelViewBead" emphasis="primary"/> <!-- -- To stop receiving notification emails like this one, please contact carlosrov...@apache.org.