This is an automated email from the ASF dual-hosted git repository. aharui pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit 75653d66184cdc46e63b1fec45a98268211e8d14 Author: Alex Harui <aha...@apache.org> AuthorDate: Wed Oct 31 15:22:41 2018 -0700 Try using Label for UITextField and have it implement its interface --- .../src/main/royale/mx/core/IUITextField.as | 26 +++---- .../src/main/royale/mx/core/UITextField.as | 79 +++++++++++++--------- 2 files changed, 61 insertions(+), 44 deletions(-) diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/IUITextField.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/IUITextField.as index 2bc3c81..d16c740 100644 --- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/IUITextField.as +++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/IUITextField.as @@ -47,10 +47,10 @@ package mx.core function set text(value:String):void; function get textWidth():Number; - function set textWidth(value:Number):void; + //function set textWidth(value:Number):void; function get textHeight():Number; - function set textHeight(value:Number):void; + //function set textHeight(value:Number):void; function get wordWrap():Boolean; function set wordWrap(value:Boolean):void; @@ -64,8 +64,8 @@ package mx.core * @playerversion AIR 1.1 * @productversion Flex 3 */ - function get ignorePadding():Boolean; - function set ignorePadding(value:Boolean):void; + //function get ignorePadding():Boolean; + //function set ignorePadding(value:Boolean):void; /** * @copy mx.core.UITextField#inheritingStyles @@ -75,8 +75,8 @@ package mx.core * @playerversion AIR 1.1 * @productversion Flex 3 */ - function get inheritingStyles():Object; - function set inheritingStyles(value:Object):void; + //function get inheritingStyles():Object; + //function set inheritingStyles(value:Object):void; /** * @copy mx.core.UITextField#nestLevel @@ -86,8 +86,8 @@ package mx.core * @playerversion AIR 1.1 * @productversion Flex 3 */ - function get nestLevel():int; - function set nestLevel(value:int):void; + //function get nestLevel():int; + //function set nestLevel(value:int):void; /** * @copy mx.core.UITextField#nonInheritingStyles @@ -97,8 +97,8 @@ package mx.core * @playerversion AIR 1.1 * @productversion Flex 3 */ - function get nonInheritingStyles():Object; - function set nonInheritingStyles(value:Object):void; + //function get nonInheritingStyles():Object; + //function set nonInheritingStyles(value:Object):void; /** * @copy mx.core.UITextField#nonZeroTextHeight @@ -108,7 +108,7 @@ package mx.core * @playerversion AIR 1.1 * @productversion Flex 3 */ - function get nonZeroTextHeight():Number; + //function get nonZeroTextHeight():Number; /** * @copy mx.core.UITextField#getStyle() @@ -160,7 +160,9 @@ package mx.core */ function truncateToFit(truncationIndicator:String = null):Boolean; - function setTextFormat(format:UITextFormat):void; + function setTextFormat(format:UITextFormat, + beginIndex:int = -1, + endIndex:int = -1):void; } diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/UITextField.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/UITextField.as index e4794b9..8c11a01 100644 --- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/UITextField.as +++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/UITextField.as @@ -31,28 +31,15 @@ import flash.text.TextFormat; import flash.text.TextFormatAlign; import flash.text.TextLineMetrics; */ + import mx.controls.Label; + import mx.core.UIComponent; + import mx.managers.ISystemManager; + import mx.styles.ISimpleStyleClient; + import mx.styles.IStyleManager2; + import mx.utils.StringUtil; + import org.apache.royale.events.Event; -//import mx.automation.IAutomationObject; -//import mx.core.LayoutDirection; -import mx.managers.ISystemManager; -//import mx.managers.IToolTipManagerClient; -//import mx.managers.SystemManager; -//import mx.managers.ToolTipManager; -//import mx.resources.IResourceManager; -//import mx.resources.ResourceManager; -import mx.styles.ISimpleStyleClient; -//import mx.styles.IStyleClient; -import mx.styles.IStyleManager2; -//import mx.styles.StyleManager; -//import mx.styles.StyleProtoChain; -//import mx.utils.MatrixUtil; -//import mx.utils.NameUtil; -import mx.utils.StringUtil; - - -import mx.core.UIComponent; - use namespace mx_internal; /* include "../styles/metadata/LeadingStyle.as" @@ -95,7 +82,7 @@ include "../styles/metadata/TextStyles.as" * @playerversion AIR 1.1 * @productversion Royale 0.9.3 */ -public class UITextField extends UIComponent +public class UITextField extends Label implements IUITextField { @@ -469,10 +456,10 @@ public class UITextField extends UIComponent /** * @private */ - /* override */ public function set htmlText(value:String):void + /* override public function set htmlText(value:String):void { // TextField's htmlText property can't be set to null. - /* if (!value) + if (!value) value = ""; // Performance optimization: if the htmlText hasn't changed, @@ -494,8 +481,8 @@ public class UITextField extends UIComponent explicitHTMLText = value; if (invalidateDisplayListFlag) - validateNow(); */ - } + validateNow(); + }*/ //---------------------------------- // parent @@ -538,10 +525,10 @@ public class UITextField extends UIComponent /** * @private */ - /* override */ public function set text(value:String):void + /* override public function set text(value:String):void { // TextField's text property can't be set to null. - /* if (!value) + if (!value) value = ""; // Performance optimization: if the text hasn't changed, @@ -554,12 +541,12 @@ public class UITextField extends UIComponent explicitHTMLText = null; if (invalidateDisplayListFlag) - validateNow(); */ + validateNow(); } public function get text():String { // TextField's text property can't be set to null. - /* if (!value) + if (!value) value = ""; // Performance optimization: if the text hasn't changed, @@ -572,9 +559,10 @@ public class UITextField extends UIComponent explicitHTMLText = null; if (invalidateDisplayListFlag) - validateNow(); */ + validateNow(); return ""; } + */ //---------------------------------- // textColor @@ -1909,7 +1897,7 @@ public class UITextField extends UIComponent /** * @private */ - /* override */ public function setTextFormat(format:Object, + /* override */ public function setTextFormat(format:UITextFormat, beginIndex:int = -1, endIndex:int = -1):void { @@ -2702,7 +2690,6 @@ public class UITextField extends UIComponent /** * @private - */ public function set selectable(value:Boolean):void { } @@ -2711,6 +2698,7 @@ public class UITextField extends UIComponent { return true; } + */ public function set getCharIndexAtPoint(value:int):void { } @@ -2735,6 +2723,33 @@ public class UITextField extends UIComponent return null; } */ + public function getUITextFormat():UITextFormat + { + return new UITextFormat(systemManager); + } + + public function truncateToFit(truncationIndicator:String = null):Boolean + { + return true; + } + + public function get textWidth():Number + { + return width; + } + + public function get textHeight():Number + { + return height; + } + + public function get wordWrap():Boolean + { + return true; + } + public function set wordWrap(value:Boolean):void + { + } } }