From commits-return-2640-archive-asf-public=cust-asf.ponee.io@royale.apache.org Fri Mar 9 17:07:44 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 45CEA18064A for ; Fri, 9 Mar 2018 17:07:42 +0100 (CET) Received: (qmail 37011 invoked by uid 500); 9 Mar 2018 16:07:41 -0000 Mailing-List: contact commits-help@royale.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@royale.apache.org Delivered-To: mailing list commits@royale.apache.org Received: (qmail 37002 invoked by uid 99); 9 Mar 2018 16:07:41 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Mar 2018 16:07:41 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 9CD1E80825; Fri, 9 Mar 2018 16:07:40 +0000 (UTC) Date: Fri, 09 Mar 2018 16:07:40 +0000 To: "commits@royale.apache.org" Subject: [royale-asjs] branch feature/MXRoyale updated: TextInput compiles. Added missing components to manifest file. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <152061166058.2767.95648279701601365@gitbox.apache.org> From: pent@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: royale-asjs X-Git-Refname: refs/heads/feature/MXRoyale X-Git-Reftype: branch X-Git-Oldrev: 518ac164ca6c63d6f8f555e57542080150a3f3b8 X-Git-Newrev: 7b94007f4146f175b7ec41fd411fcd6051b00218 X-Git-Rev: 7b94007f4146f175b7ec41fd411fcd6051b00218 X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. pent pushed a commit to branch feature/MXRoyale in repository https://gitbox.apache.org/repos/asf/royale-asjs.git The following commit(s) were added to refs/heads/feature/MXRoyale by this push: new 7b94007 TextInput compiles. Added missing components to manifest file. 7b94007 is described below commit 7b94007f4146f175b7ec41fd411fcd6051b00218 Author: Peter Ent AuthorDate: Fri Mar 9 11:07:37 2018 -0500 TextInput compiles. Added missing components to manifest file. --- .../src/main/resources/mx-royale-manifest.xml | 6 + .../src/main/royale/mx/controls/TextInput.as | 1564 +++++++++++++++++--- .../royale/mx/controls/listClasses/BaseListData.as | 239 +++ .../MXRoyale/src/main/royale/mx/core/ITextInput.as | 345 +++++ 4 files changed, 1976 insertions(+), 178 deletions(-) diff --git a/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml b/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml index 3fccab1..0f9170c 100644 --- a/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml +++ b/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml @@ -22,6 +22,12 @@ + + + + + + diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/TextInput.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/TextInput.as index dd47568..3bf171f 100644 --- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/TextInput.as +++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/TextInput.as @@ -21,14 +21,10 @@ package mx.controls { COMPILE::JS { - import goog.DEBUG; - import goog.events; - import org.apache.royale.core.WrappedHTMLElement; - import org.apache.royale.html.util.addElementToWrapper; + import goog.DEBUG; } -import org.apache.royale.core.ITextModel; -import org.apache.royale.core.UIBase; import org.apache.royale.events.Event; +import org.apache.royale.core.ITextModel; /* import flash.accessibility.AccessibilityProperties; import flash.display.DisplayObject; @@ -45,7 +41,9 @@ import flash.text.TextFormat; import flash.text.TextLineMetrics; import flash.ui.Keyboard; +*/ import mx.controls.listClasses.BaseListData; +/* import mx.controls.listClasses.IDropInListItemRenderer; import mx.controls.listClasses.IListItemRenderer; import mx.core.EdgeMetrics; @@ -57,11 +55,15 @@ import mx.core.IIMESupport; import mx.core.IInvalidating; import mx.core.IRectangularBorder; import mx.core.IUITextField; +*/ import mx.core.ITextInput; import mx.core.UIComponent; +/* import mx.core.UITextField; import mx.core.mx_internal; +*/ import mx.events.FlexEvent; +/* import mx.managers.IFocusManager; import mx.managers.IFocusManagerComponent; import mx.managers.ISystemManager; @@ -140,30 +142,16 @@ use namespace mx_internal; */ [Event(name="textInput", type="flash.events.TextEvent")] -//-------------------------------------- -// Styles -//-------------------------------------- - - //-------------------------------------- // Other metadata //-------------------------------------- -[DataBindingInfo("editEvents", ""focusIn;focusOut"")] - [DefaultBindingProperty(source="text", destination="text")] [DefaultTriggerEvent("change")] -[Alternative(replacement="spark.components.TextInput", since="4.0")] - -//-------------------------------------- -// Excluded APIs -//-------------------------------------- - - /** * The TextInput control is a single-line text field * that is optionally editable. @@ -300,7 +288,7 @@ use namespace mx_internal; * @playerversion AIR 1.1 * @productversion Flex 3 */ -public class TextInput extends UIComponent +public class TextInput extends UIComponent implements ITextInput { //-------------------------------------------------------------------------- // @@ -319,11 +307,7 @@ public class TextInput extends UIComponent public function TextInput() { super(); - - COMPILE::SWF - { - model.addEventListener("textChange", textChangeHandler); - } + typeNames = "TextInput"; } //-------------------------------------------------------------------------- @@ -332,28 +316,57 @@ public class TextInput extends UIComponent // //-------------------------------------------------------------------------- + /** + * @private + * Flag that will block default data/listData behavior. + */ + private var textSet:Boolean; + + /** + * @private + */ + private var selectionChanged:Boolean = false; + + /** + * @private + */ + private var errorCaught:Boolean = false; + //-------------------------------------------------------------------------- // // Overridden properties // //-------------------------------------------------------------------------- - /** - * @royaleignorecoercion org.apache.royale.core.WrappedHTMLElement - */ - COMPILE::JS - override protected function createElement():WrappedHTMLElement - { - addElementToWrapper(this,'input'); - element.setAttribute('type', 'text'); - typeNames = 'TextInput'; - //attach input handler to dispatch royale change event when user write in textinput - //goog.events.listen(element, 'change', killChangeHandler); - goog.events.listen(element, 'input', textChangeHandler); - return element; - } + //---------------------------------- + // enabled + //---------------------------------- + + /** + * @private + */ + private var enabledChanged:Boolean = false; + + [Inspectable(category="General", enumeration="true,false", defaultValue="true")] + + /** + * @private + * Disable TextField when we're disabled. + */ + override public function set enabled(value:Boolean):void + { + if (value == enabled) + return; + + super.enabled = value; + enabledChanged = true; + + invalidateProperties(); +// if (border && border is IInvalidating) +// IInvalidating(border).invalidateDisplayList(); + } //---------------------------------- // tabIndex @@ -379,22 +392,24 @@ public class TextInput extends UIComponent * @tiptext tabIndex of the component * @helpid 3198 */ - override public function get tabIndex():int - { - return _tabIndex; - } +// override public function get tabIndex():int +// { +// return _tabIndex; +// } /** * @private */ - override public function set tabIndex(value:int):void - { - if (value == _tabIndex) - return; - - _tabIndex = value; - tabIndexChanged = true; - } +// override public function set tabIndex(value:int):void +// { +// if (value == _tabIndex) +// return; +// +// _tabIndex = value; +// tabIndexChanged = true; +// +// invalidateProperties(); +// } //-------------------------------------------------------------------------- // @@ -403,13 +418,150 @@ public class TextInput extends UIComponent //-------------------------------------------------------------------------- + //---------------------------------- + // data + //---------------------------------- + + /** + * @private + * Storage for the data property. + */ + private var _data:Object; + + [Bindable("dataChange")] + [Inspectable(environment="none")] + + /** + * Lets you pass a value to the component + * when you use it in an item renderer or item editor. + * You typically use data binding to bind a field of the data + * property to a property of this component. + * + *

When you use the control as a drop-in item renderer or drop-in + * item editor, Flex automatically writes the current value of the item + * to the text property of this control.

+ * + *

You do not set this property in MXML.

+ * + * @default null + * @see mx.core.IDataRenderer + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public function get data():Object + { + return _data; + } + + /** + * @private + */ + public function set data(value:Object):void + { + var newText:*; + + _data = value; + + if (_listData) + { + newText = _listData.label; + } + else if (_data != null) + { + if (_data is String) + newText = String(_data); + else + newText = _data.toString(); + } + + if (newText !== undefined && !textSet) + { + text = newText; + textSet = false; + // changing text should trigger the TextInput's view bead to change the display. + //textField.setSelection(0, 0); + } + + dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE)); + } + + //---------------------------------- + // displayAsPassword + //---------------------------------- + + /** + * @private + * Storage for the displayAsPassword property. + */ + private var _displayAsPassword:Boolean = false; + + /** + * @private + */ + private var displayAsPasswordChanged:Boolean = false; + + [Bindable("displayAsPasswordChanged")] + [Inspectable(category="General", defaultValue="false")] + + /** + * Indicates whether this control is used for entering passwords. + * If true, the field does not display entered text, + * instead, each text character entered into the control + * appears as the character "*". + * + * @default false + * @tiptext Specifies whether to display '*' + * instead of the actual characters + * @helpid 3197 + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public function get displayAsPassword():Boolean + { + return _displayAsPassword; + } + + /** + * @private + */ + public function set displayAsPassword(value:Boolean):void + { + if (value == _displayAsPassword) + return; + + _displayAsPassword = value; + displayAsPasswordChanged = true; + invalidateProperties(); + invalidateSize(); + invalidateDisplayList(); + dispatchEvent(new Event("displayAsPasswordChanged")); + } //---------------------------------- // editable //---------------------------------- + /** + * @private + * Storage for the editable property. + */ + private var _editable:Boolean = true; + + /** + * @private + */ + private var editableChanged:Boolean = false; + + [Bindable("editableChanged")] + [Inspectable(category="General", defaultValue="true")] /** * @inheritDoc @@ -421,7 +573,7 @@ public class TextInput extends UIComponent */ public function get editable():Boolean { - return true; + return _editable; } /** @@ -429,148 +581,1204 @@ public class TextInput extends UIComponent */ public function set editable(value:Boolean):void { - if (goog.DEBUG) - trace("setting editable is not yet implemented") - } - - //---------------------------------- - // text and htmlText - //---------------------------------- - - /** - * @copy org.apache.royale.html.Label#text - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.0 - * @royaleignorecoercion HTMLInputElement - */ - [Bindable(event="change")] - public function get text():String - { - COMPILE::SWF - { - return ITextModel(model).text; - } - COMPILE::JS - { - return (element as HTMLInputElement).value; - } - } - - /** - * @private - * @royaleignorecoercion HTMLInputElement - */ - public function set text(value:String):void - { - COMPILE::SWF - { - inSetter = true; - ITextModel(model).text = value; - inSetter = false; - } - COMPILE::JS - { - (element as HTMLInputElement).value = value; - dispatchEvent(new Event('textChange')); - } - } - - /** - * @copy org.apache.royale.html.Label#html - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.0 - * @royaleignorecoercion HTMLInputElement - */ - [Bindable(event="change")] - public function get html():String - { - COMPILE::SWF - { - return ITextModel(model).html; - } - COMPILE::JS - { - return (element as HTMLInputElement).value; - } - } - - /** - * @private - * @royaleignorecoercion HTMLInputElement - */ - public function set html(value:String):void - { - COMPILE::SWF - { - ITextModel(model).html = value; - } - COMPILE::JS - { - (element as HTMLInputElement).value = value; - dispatchEvent(new Event('textChange')); - } - } - - private var inSetter:Boolean; - - /** - * dispatch change event in response to a textChange event - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.0 - */ - public function textChangeHandler(event:Event):void - { - if (!inSetter) - dispatchEvent(new Event(Event.CHANGE)); - } + if (value == _editable) + return; + + _editable = value; + editableChanged = true; + + invalidateProperties(); + + dispatchEvent(new Event("editableChanged")); + } + + //---------------------------------- + // horizontalScrollPosition + //---------------------------------- + + /** + * @private + * Used to store the init time value if any. + */ + private var _horizontalScrollPosition:Number = 0; + + /** + * @private + */ + private var horizontalScrollPositionChanged:Boolean = false; + + [Bindable("horizontalScrollPositionChanged")] + [Inspectable(defaultValue="0")] + + + /** + * @inheritDoc + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public function get horizontalScrollPosition():Number + { + return _horizontalScrollPosition; + } + + /** + * @private + */ + public function set horizontalScrollPosition(value:Number):void + { + if (value == _horizontalScrollPosition) + return; + + _horizontalScrollPosition = value; + horizontalScrollPositionChanged = true; + + invalidateProperties(); + + dispatchEvent(new Event("horizontalScrollPositionChanged")); + } //---------------------------------- - // Methods + // htmlText //---------------------------------- + /** + * @private + * Storage for the htmlText property. + * In addition to being set in the htmlText setter, + * it is automatically updated at two other times. + * 1. When the 'text' or 'htmlText' is pushed down into + * the textField in commitProperties(), this causes + * the textField to update its own 'htmlText'. + * Therefore in commitProperties() we reset this storage var + * to be in sync with the textField. + * 2. When the TextFormat of the textField changes + * because a CSS style has changed (see validateNow() + * in UITextField), the textField also updates its own 'htmlText'. + * Therefore in textField_textFieldStyleChangeHandler() + */ + private var _htmlText:String = ""; /** - * Selects the text in the range specified by the parameters. - * If the control is not in focus, the selection highlight will not show - * until the control gains focus. Also, if the focus is gained by clicking - * on the control, any previous selection would be lost. - * If the two parameter values are the same, - * the new selection is an insertion point. + * @private + */ + private var htmlTextChanged:Boolean = false; + + /** + * @private + * The last value of htmlText that was set. + * We have to keep track of this because when you set the htmlText + * of a TextField and read it back, you don't get what you set. + * In general it will have additional HTML markup corresponding + * to the defaultTextFormat set from the CSS styles. + * If this var is null, it means that 'text' rather than 'htmlText' + * was last set. + */ + private var explicitHTMLText:String = null; + + [Bindable("htmlTextChanged")] + [CollapseWhiteSpace] + [Inspectable(category="General", defaultValue="")] + [NonCommittingChangeEvent("change")] + + /** + * Specifies the text displayed by the TextInput control, including HTML markup that + * expresses the styles of that text. + * When you specify HTML text in this property, you can use the subset of HTML + * tags that is supported by the Flash TextField control. * - * @param beginIndex The zero-based index of the first character in the - * selection; that is, the first character is 0, the second character - * is 1, and so on. + *

When you set this property, the HTML markup is applied + * after the CSS styles for the TextInput instance are applied. + * When you get this property, the HTML markup includes + * the CSS styles.

* - * @param endIndex The zero-based index of the position after - * the last character in the selection (equivalent to the one-based - * index of the last character). - * If the parameter is 5, the last character in the selection, for - * example, is the fifth character. - * When the TextInput control gets the focus, the selection is visible - * if the selectionBeginIndex and selectionEndIndex - * properties are both set. + *

For example, if you set this to be a string such as, + * "This is an example of <b>bold</b> markup", + * the text "This is an example of bold markup" appears + * in the TextInput with whatever CSS styles normally apply. + * Also, the word "bold" appears in boldface font because of the + * <b> markup.

* - * @tiptext Sets a new text selection. + *

HTML markup uses characters such as < and >, + * which have special meaning in XML (and therefore in MXML). So, + * code such as the following does not compile:

+ * + *
+     *  <mx:TextInput htmlText="This is an example of <b>bold</b> markup"/>
+     *  
+ * + *

There are three ways around this problem.

+ * + *
    + * + *
  • + * + *

    Set the htmlText property in an ActionScript method called as + * an initialize handler:

    + * + *
    +     *  <mx:TextInput id="myTextInput" initialize="myTextInput_initialize()"/>
    +     *  
    + * + *

    where the myTextInput_initialize method is in a script CDATA section:

    + * + *
    +     *  <fx:Script>
    +     *  <![CDATA[
    +     *  private function myTextInput_initialize():void {
    +     *      myTextInput.htmlText = "This is an example of <b>bold</b> markup";
    +     *  }
    +     *  ]]>
    +     *  </fx:Script>
    +     *
    +     *  
    + * + *

    This is the simplest approach because the HTML markup + * remains easily readable. + * Notice that you must assign an id to the TextInput + * so you can refer to it in the initialize + * handler.

    + * + *
  • + * + *
  • + * + *

    Specify the htmlText property by using a child tag + * with a CDATA section. A CDATA section in XML contains character data + * where characters like < and > aren't given a special meaning.

    + * + *
    +     *  <mx:TextInput>
    +     *      <mx:htmlText><![CDATA[This is an example of <b>bold</b> markup]]></mx:htmlText>
    +     *  <mx:TextInput/>
    +     *  
    + * + *

    You must write the htmlText property as a child tag + * rather than as an attribute on the <mx:TextInput> tag + * because XML doesn't allow CDATA for the value of an attribute. + * Notice that the markup is readable, but the CDATA section makes + * this approach more complicated.

    + * + *
  • + * + *
  • + * + *

    Use an hmtlText attribute where any occurences + * of the HTML markup characters < and > in the attribute value + * are written instead as the XML "entities" &lt; + * and &gt;:

    + * + *
    +     *  <mx:TextInput htmlText="This is an example of &lt;b&gt;bold&lt;/b&gt; markup"/&gt;
    +     *  
    + * + * Adobe does not recommend this approach because the HTML markup becomes + * nearly impossible to read. + * + *
  • + * + *
+ * + *

If the condenseWhite property is true + * when you set the htmlText property, multiple + * white-space characters are condensed, as in HTML-based browsers; + * for example, three consecutive spaces are displayed + * as a single space. + * The default value for condenseWhite is + * false, so you must set condenseWhite + * to true to collapse the white space.

+ * + *

If you read back the htmlText property quickly + * after setting it, you get the same string that you set. + * However, after the LayoutManager runs, the value changes + * to include additional markup that includes the CSS styles.

+ * + *

Setting the htmlText property affects the text + * property in several ways. + * If you read the text property quickly after setting + * the htmlText property, you get null, + * which indicates that the text corresponding to the new + * htmlText has not yet been determined. + * However, after the LayoutManager runs, the text property + * value changes to the htmlText string with all the + * HTML markup removed; that is, + * the value is the characters that the TextInput actually displays.

+ * + *

Conversely, if you set the text property, + * any previously set htmlText is irrelevant. + * If you read the htmlText property quickly after setting + * the text property, you get null, + * which indicates that the htmlText that corresponds to the new + * text has not yet been determined. + * However, after the LayoutManager runs, the htmlText property + * value changes to the new text plus the HTML markup for the CSS styles.

+ * + *

To make the LayoutManager run immediately, you can call the + * validateNow() method on the TextInput. + * For example, you could set some htmlText, + * call the validateNow() method, and immediately + * obtain the corresponding text that doesn't have + * the HTML markup.

+ * + *

If you set both text and htmlText properties + * in ActionScript, whichever is set last takes effect. + * Do not set both in MXML, because MXML does not guarantee that + * the properties of an instance get set in any particular order.

+ * + *

Setting either text or htmlText property + * inside a loop is a fast operation, because the underlying TextField + * that actually renders the text is not updated until + * the LayoutManager runs.

+ * + *

If you try to set this property to null, + * it is set, instead, to the empty string. + * If the property temporarily has the value null, + * it indicates that the text has been recently set + * and the corresponding htmlText + * has not yet been determined.

+ * + * @default "" + * + * @see flash.text.TextField#htmlText * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ - public function setSelection(beginIndex:int, endIndex:int):void + public function get htmlText():String + { + return ITextModel(model).html; + } + + /** + * @private + */ + public function set htmlText(value:String):void + { + textSet = true; + + // The htmlText property can't be set to null, + // only to the empty string, because if you set the htmlText + // of a TextField to null it throws an RTE. + // If the getter returns null, it means that 'text' was just set + // and the value of 'htmlText' isn't yet known, because the 'text' + // hasn't been committed into the textField and the 'htmlText' + // hasn't yet been read back out of the textField. + if (!value) + value = ""; + + ITextModel(model).html = value; + htmlTextChanged = true; + + // The text property is unknown until commitProperties(), + // when we push the htmlText into the TextField and it + // calculates the text. + // But you can call validateNow() to make this happen right away. + ITextModel(model).text = null; + + explicitHTMLText = value; + + invalidateProperties(); + invalidateSize(); + invalidateDisplayList(); + + // Trigger bindings to htmlText. + dispatchEvent(new Event("htmlTextChanged")); + + // commitProperties() will dispatch a "valueCommit" event + // after the TextField determines the 'text' based on the + // 'htmlText'; this event will trigger any bindings to 'text'. + } + + //---------------------------------- + // isHTML + //---------------------------------- + + /** + * @private + */ + private function get isHTML():Boolean { - if (goog.DEBUG) - trace("setSelection is not implemented"); + return explicitHTMLText != null; } + + //---------------------------------- + // length + //---------------------------------- + + /** + * The number of characters of text displayed in the TextArea. + * + * @default 0 + * @tiptext The number of characters in the TextInput. + * @helpid 3192 + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public function get length():int + { + return text != null ? text.length : -1; + } + + //---------------------------------- + // listData + //---------------------------------- + + private var _listData:BaseListData; + + [Bindable("dataChange")] + [Inspectable(environment="none")] + + /** + * When a component is used as a drop-in item renderer or drop-in + * item editor, Flex initializes the listData property + * of the component with the appropriate data from the list control. + * The component can then use the listData property + * to initialize the data property of the drop-in + * item renderer or drop-in item editor. + * + *

You do not set this property in MXML or ActionScript; + * Flex sets it when the component is used as a drop-in item renderer + * or drop-in item editor.

+ * + * @default null + * @see mx.controls.listClasses.IDropInListItemRenderer + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public function get listData():BaseListData + { + return _listData; + } + + /** + * @private + */ + public function set listData(value:BaseListData):void + { + _listData = value; + } + + //---------------------------------- + // maxChars + //---------------------------------- + + /** + * @private + * Storage for the maxChars property. + */ + private var _maxChars:int = 0; + + /** + * @private + */ + private var maxCharsChanged:Boolean = false; + + [Bindable("maxCharsChanged")] + [Inspectable(category="General", defaultValue="0")] + + /** + * @inheritDoc + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public function get maxChars():int + { + return _maxChars; + } + + /** + * @private + */ + public function set maxChars(value:int):void + { + if (value == _maxChars) + return; + + _maxChars = value; + maxCharsChanged = true; + + invalidateProperties(); + + dispatchEvent(new Event("maxCharsChanged")); + } + + //---------------------------------- + // maxHorizontalScrollPosition + //---------------------------------- + + /** + * @private + * Maximum value of horizontalScrollPosition. + * + *

The default value is 0, which means that horizontal scrolling is not + * required.

+ * + *

The value of the maxHorizontalScrollPosition property is + * computed from the data and size of component, and must not be set by + * the application code.

+ */ + public function get maxHorizontalScrollPosition():Number + { + return 0;//textField ? textField.maxScrollH : 0; + } + + //---------------------------------- + // parentDrawsFocus + //---------------------------------- + + /** + * @private + * Storage for the parentDrawsFocus property. + */ + private var _parentDrawsFocus:Boolean = false; + + [Inspectable(category="General", enumeration="true,false", defaultValue="false")] + + /** + * @inheritDoc + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public function get parentDrawsFocus():Boolean + { + return _parentDrawsFocus; + } + + /** + * @private + */ + public function set parentDrawsFocus(value:Boolean):void + { + _parentDrawsFocus = value; + } + + //---------------------------------- + // restrict + //---------------------------------- + + /** + * @private + * Storage for the restrict property. + */ + private var _restrict:String; + + /** + * @private + */ + private var restrictChanged:Boolean = false; + + [Bindable("restrictChanged")] + [Inspectable(category="General")] + + /** + * @inheritDoc + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public function get restrict():String + { + return _restrict; + } + + /** + * @private + */ + public function set restrict(value:String):void + { + if (value == _restrict) + return; + + _restrict = value; + restrictChanged = true; + + invalidateProperties(); + + dispatchEvent(new Event("restrictChanged")); + } + + //---------------------------------- + // selectable + //---------------------------------- + + /** + * @private + * Used to make TextInput function correctly in the components that use it + * as a subcomponent. ComboBox, at this point. + */ + private var _selectable:Boolean = true; + + /** + * @private + */ + private var selectableChanged:Boolean = false; + + /** + * @inheritDoc + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public function get selectable():Boolean + { + return _selectable; + } + + /** + * @private + */ + public function set selectable(value:Boolean):void + { + if (_selectable == value) + return; + _selectable = value; + selectableChanged = true; + invalidateProperties(); + } + //---------------------------------- + // selectionBeginIndex + //---------------------------------- + + /** + * @private + * Storage for the selectionBeginIndex property. + */ + private var _selectionBeginIndex:int = 0; + + [Inspectable(defaultValue="0")] + + /** + * The zero-based character index value of the first character + * in the current selection. + * For example, the first character is 0, the second character is 1, + * and so on. + * When the control gets the focus, the selection is visible if the + * selectionBeginIndex and selectionEndIndex + * properties are both set. + * + * @default 0 + * + * @tiptext The zero-based index value of the first character + * in the selection. + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public function get selectionBeginIndex():int + { + return _selectionBeginIndex; + } + + /** + * @private + */ + public function set selectionBeginIndex(value:int):void + { + _selectionBeginIndex = value; + } + + //---------------------------------- + // selectionEndIndex + //---------------------------------- + + /** + * @private + * Storage for the selectionEndIndex property. + */ + private var _selectionEndIndex:int = 0; + + [Inspectable(defaultValue="0")] + + /** + * The zero-based index of the position after the last character + * in the current selection (equivalent to the one-based index of the last + * character). + * If the last character in the selection, for example, is the fifth + * character, this property has the value 5. + * When the control gets the focus, the selection is visible if the + * selectionBeginIndex and selectionEndIndex + * properties are both set. + * + * @default 0 + * + * @tiptext The zero-based index value of the last character + * in the selection. + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public function get selectionEndIndex():int + { + return _selectionEndIndex; + } + + /** + * @private + */ + public function set selectionEndIndex(value:int):void + { + _selectionEndIndex = value; + selectionChanged = true; + + invalidateProperties(); + } + + //---------------------------------- + // text + //---------------------------------- + + + /** + * @private + */ + private var textChanged:Boolean = false; + + [Bindable("textChanged")] + [CollapseWhiteSpace] + [Inspectable(category="General", defaultValue="")] + [NonCommittingChangeEvent("change")] + + /** + * @inheritDoc + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public function get text():String + { + return ITextModel(model).text; + } + + /** + * @private + */ + public function set text(value:String):void + { + textSet = true; + + // The text property can't be set to null, only to the empty string. + // If the getter returns null, it means that 'htmlText' was just set + // and the value of 'text' isn't yet known, because the 'htmlText' + // hasn't been committed into the textField and the 'text' + // hasn't yet been read back out of the textField. + if (!value) + value = ""; + + if (!isHTML && value == ITextModel(model).text) + return; + + ITextModel(model).text = value; + + textChanged = true; + + // The htmlText property is unknown until commitProperties(), + // when we push the text into the TextField and it + // calculates the htmlText. + // But you can call validateNow() to make this happen right away. + ITextModel(model).html = null; + + explicitHTMLText = null; + + invalidateProperties(); + invalidateSize(); + invalidateDisplayList(); + + // Trigger bindings to 'text'. + dispatchEvent(new Event("textChanged")); + + // commitProperties() will dispatch an "htmlTextChanged" event + // after the TextField determines the 'htmlText' based on the + // 'text'; this event will trigger any bindings to 'htmlText'. + + dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT)); + } + + //-------------------------------------------------------------------------- + // + // Overridden methods + // + //-------------------------------------------------------------------------- + + /** + * @private + * Create child objects. + */ + override protected function createChildren():void + { + super.createChildren(); + } + + /** + * @private + */ + override protected function commitProperties():void + { + super.commitProperties(); + + +// if (hasFontContextChanged() && textField != null) +// { +// var childIndex:int = getChildIndex(DisplayObject(textField)); +// removeTextField(); +// createTextField(childIndex); +// +// accessibilityPropertiesChanged = true; +// condenseWhiteChanged = true; +// displayAsPasswordChanged = true; +// enabledChanged = true; +// maxCharsChanged = true; +// restrictChanged = true; +// tabIndexChanged = true; +// textChanged = true; +// selectionChanged = true; +// horizontalScrollPositionChanged = true; +// } +// +// if (accessibilityPropertiesChanged) +// { +// textField.accessibilityProperties = _accessibilityProperties; +// +// accessibilityPropertiesChanged = false; +// } +// +// if (condenseWhiteChanged) +// { +// textField.condenseWhite = _condenseWhite; +// +// condenseWhiteChanged = false; +// } +// +// if (displayAsPasswordChanged) +// { +// textField.displayAsPassword = _displayAsPassword; +// +// displayAsPasswordChanged = false; +// } +// +// if (enabledChanged || editableChanged) +// { +// textField.type = enabled && _editable ? +// TextFieldType.INPUT : +// TextFieldType.DYNAMIC; +// +// if (enabledChanged) +// { +// if (textField.enabled != enabled) +// textField.enabled = enabled; +// +// enabledChanged = false; +// } +// selectableChanged = true; +// editableChanged = false; +// } +// +// if (selectableChanged) +// { +// if (_editable) +// textField.selectable = enabled; +// else +// textField.selectable = enabled && _selectable; +// selectableChanged = false; +// } +// +// if (maxCharsChanged) +// { +// textField.maxChars = _maxChars; +// +// maxCharsChanged = false; +// } +// +// if (restrictChanged) +// { +// textField.restrict = _restrict; +// +// restrictChanged = false; +// } +// +// if (tabIndexChanged) +// { +// textField.tabIndex = _tabIndex; +// +// tabIndexChanged = false; +// } +// +// if (textChanged || htmlTextChanged) +// { +// // If the 'text' and 'htmlText' properties have both changed, +// // the last one set wins. +// if (isHTML) +// textField.htmlText = explicitHTMLText; +// else +// textField.text = _text; +// +// textFieldChanged(false, true); +// +// textChanged = false; +// htmlTextChanged = false; +// } +// +// if (selectionChanged) +// { +// textField.setSelection(_selectionBeginIndex, _selectionEndIndex); +// +// selectionChanged = false; +// } +// +// if (horizontalScrollPositionChanged) +// { +// textField.scrollH = _horizontalScrollPosition; +// +// horizontalScrollPositionChanged = false; +// } + } + + /** + * @private + */ + override protected function measure():void + { + super.measure(); + + if (GOOG::DEBUG) + trace("TextInput.measure not implemented"); + +// var bm:EdgeMetrics = border && border is IRectangularBorder ? +// IRectangularBorder(border).borderMetrics : +// EdgeMetrics.EMPTY; +// +// var w:Number; +// var h:Number; +// +// // Start with a width of 160. This may change. +// measuredWidth = DEFAULT_MEASURED_WIDTH; +// +// if (maxChars) +// { +// // Use the width of "W" and multiply by the maxChars +// measuredWidth = Math.min(measuredWidth, +// measureText("W").width * maxChars + bm.left + bm.right + 8); +// } +// +// if (!text || text == "") +// { +// w = DEFAULT_MEASURED_MIN_WIDTH; +// h = measureText(" ").height + +// bm.top + bm.bottom + UITextField.TEXT_HEIGHT_PADDING; +// h += getStyle("paddingTop") + getStyle("paddingBottom"); +// } +// else +// { +// var lineMetrics:TextLineMetrics; +// lineMetrics = measureText(text); +// +// w = lineMetrics.width + bm.left + bm.right + 8; +// h = lineMetrics.height + bm.top + bm.bottom + UITextField.TEXT_HEIGHT_PADDING; +// +// w += getStyle("paddingLeft") + getStyle("paddingRight"); +// h += getStyle("paddingTop") + getStyle("paddingBottom"); +// } +// +// measuredWidth = Math.max(w, measuredWidth); +// measuredHeight = Math.max(h, DEFAULT_MEASURED_HEIGHT); +// +// measuredMinWidth = DEFAULT_MEASURED_MIN_WIDTH; +// measuredMinHeight = DEFAULT_MEASURED_MIN_HEIGHT; + } + + /** + * @private + * Stretch the border and fit the TextField inside it. + */ + override protected function updateDisplayList(unscaledWidth:Number, + unscaledHeight:Number):void + { + super.updateDisplayList(unscaledWidth, unscaledHeight); + + if (GOOG::DEBUG) + trace("TextInput.updateDisplayList not implemented"); +// var bm:EdgeMetrics; +// +// if (border) +// { +// border.setActualSize(unscaledWidth, unscaledHeight); +// bm = border is IRectangularBorder ? +// IRectangularBorder(border).borderMetrics : EdgeMetrics.EMPTY; +// } +// else +// { +// bm = EdgeMetrics.EMPTY; +// } +// +// var paddingLeft:Number = getStyle("paddingLeft"); +// var paddingRight:Number = getStyle("paddingRight"); +// var paddingTop:Number = getStyle("paddingTop"); +// var paddingBottom:Number = getStyle("paddingBottom"); +// var widthPad:Number = bm.left + bm.right; +// var heightPad:Number = bm.top + bm.bottom + 1; +// +// textField.x = bm.left; +// textField.y = bm.top; +// +// textField.x += paddingLeft; +// textField.y += paddingTop; +// widthPad += paddingLeft + paddingRight; +// heightPad += paddingTop + paddingBottom; +// +// textField.width = Math.max(0, unscaledWidth - widthPad); +// textField.height = Math.max(0, unscaledHeight - heightPad); + } + + /** + * @private + * Focus should always be on the internal TextField. + */ + override public function setFocus():void + { + if (GOOG::DEBUG) + trace("TextInput.setFocus not implemented"); + //textField.setFocus(); + } + + /** + * @private + */ + override public function styleChanged(styleProp:String):void + { + if (GOOG::DEBUG) + trace("TextInput.styleChanged not implemented"); +// var allStyles:Boolean = (styleProp == null || styleProp == "styleName"); +// +// super.styleChanged(styleProp); +// +// // Replace the borderSkin +// if (allStyles || styleProp == "borderSkin") +// { +// if (border) +// { +// removeChild(DisplayObject(border)); +// border = null; +// createBorder(); +// } +// } + } + + //-------------------------------------------------------------------------- + // + // Methods + // + //-------------------------------------------------------------------------- + + + /** + * Creates the border for this component. + * Normally the border is determined by the + * borderStyle and borderSkin styles. + * It must set the border property to the instance + * of the border. + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + protected function createBorder():void + { + if (GOOG::DEBUG) + trace("TextInput.createBorder not implemented"); +// if (!border) +// { +// var borderClass:Class = getStyle("borderSkin"); +// +// if (borderClass != null) +// { +// border = new borderClass(); +// +// if (border is ISimpleStyleClient) +// ISimpleStyleClient(border).styleName = this; +// +// // Add the border behind all the children. +// addChildAt(DisplayObject(border), 0); +// +// invalidateDisplayList(); +// } +// } + } + + /** + * Selects the text in the range specified by the parameters. + * If the control is not in focus, the selection highlight will not show + * until the control gains focus. Also, if the focus is gained by clicking + * on the control, any previous selection would be lost. + * If the two parameter values are the same, + * the new selection is an insertion point. + * + * @param beginIndex The zero-based index of the first character in the + * selection; that is, the first character is 0, the second character + * is 1, and so on. + * + * @param endIndex The zero-based index of the position after + * the last character in the selection (equivalent to the one-based + * index of the last character). + * If the parameter is 5, the last character in the selection, for + * example, is the fifth character. + * When the TextInput control gets the focus, the selection is visible + * if the selectionBeginIndex and selectionEndIndex + * properties are both set. + * + * @tiptext Sets a new text selection. + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public function setSelection(beginIndex:int, endIndex:int):void + { + _selectionBeginIndex = beginIndex; + _selectionEndIndex = endIndex; + selectionChanged = true; + + invalidateProperties(); + } + + /** + * @private + * Setting the 'htmlText' of textField changes its 'text', + * and vice versa, so afterwards doing so we call this method + * to update the storage vars for various properties. + * Afterwards, the TextInput's 'text', 'htmlText', 'textWidth', + * and 'textHeight' are all in sync with each other + * and are identical to the TextField's. + */ + private function textFieldChanged(styleChangeOnly:Boolean, + dispatchValueCommitEvent:Boolean):void + { + if (GOOG::DEBUG) + trace("TextInput.textFieldChanged not implemented"); +// var changed1:Boolean; +// var changed2:Boolean; +// +// if (!styleChangeOnly) +// { +// changed1 = _text != textField.text; +// _text = textField.text; +// } +// +// changed2 = _htmlText != textField.htmlText; +// _htmlText = textField.htmlText; +// +// // If the 'text' property changes, trigger bindings to it +// // and conditionally dispatch a 'valueCommit' event. +// if (changed1) +// { +// dispatchEvent(new Event("textChanged")); +// +// if (dispatchValueCommitEvent) +// dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT)); +// } +// // If the 'htmlText' property changes, trigger bindings to it. +// if (changed2) +// dispatchEvent(new Event("htmlTextChanged")); +// +// _textWidth = textField.textWidth; +// _textHeight = textField.textHeight; + } + + //-------------------------------------------------------------------------- + // + // ITextInput Interface + // + //-------------------------------------------------------------------------- + + /** + * @inheritDoc + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public function get selectionActivePosition():int + { + return selectionEndIndex; + } + + + /** + * @inheritDoc + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public function get selectionAnchorPosition():int + { + return selectionBeginIndex; + } + + /** + * Selects the text in the range specified by the parameters. Unlike + * setSelection this is done immediately. + * + * @param anchorIndex The zero-based character index specifying the beginning + * of the selection that stays fixed when the selection is extended. + * + * @param activeIndex The zero-based character index specifying + * the end of the selection that moves when the selection is extended. + * + * @langversion 3.0 + * @playerversion Flash 10 + * @playerversion AIR 1.5 + * @productversion Flex 4 + */ + public function selectRange(anchorIndex:int, activeIndex:int):void + { + if (GOOG::DEBUG) + trace("TextInput.selectRange not implemented"); + // Do it immediately. +// textField.setSelection(anchorIndex, activeIndex); + } + + //-------------------------------------------------------------------------- + // + // Overridden event handlers: UIComponent + // + //-------------------------------------------------------------------------- + + + //-------------------------------------------------------------------------- + // + // Event handlers + // + //-------------------------------------------------------------------------- + } } diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/BaseListData.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/BaseListData.as new file mode 100644 index 0000000..69d96ef --- /dev/null +++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/BaseListData.as @@ -0,0 +1,239 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 mx.controls.listClasses +{ +COMPILE::JS +{ + import goog.DEBUG; +} + +import org.apache.royale.events.EventDispatcher; +/* +import flash.events.EventDispatcher; +*/ +import mx.core.IUIComponent; +/* +import mx.core.IUID; +*/ + +/** + * The BaseListData class defines the data type of the listData + * property implemented by drop-in item renderers or drop-in item editors. + * All drop-in item renderers and drop-in item editors must implement the + * IDropInListItemRenderer interface, which defines the listData + * property. + * + *

The listData property is of type BaseListData, + * where the BaseListData class has three subclasses: + * DataGridListData, ListData, and TreeListData. + * The actual data type of the value of the listData property + * depends on the control using the drop-in item renderer or item editor. + * For a DataGrid control, the value is of type DataGridListData, + * for a List control the value is of type ListData, + * and for a Tree control, the value is of type TreeListData.

+ * + *

When used as a drop-in item renderer or drop-in item editor, + * Flex sets the listData property to a BaseListData-derived + * class containing information computed about the item in the data provider + * containing the data for the item.

+ * + *

While the properties of this class are writable, + * you should consider them to be read only. + * They are initialized by the list class, + * and read by an item renderer or item editor. + * Changing these values can lead to unexpected results.

+ * + *

The properties are marked bindable, but these properties + * do not actually do any change detection or send change events. + * The properties are changed as a whole by setting a new + * value for the listData property. + * The change event for the modification of + * the listData property updates all bindings.

+ * + * @see mx.controls.listClasses.IDropInListItemRenderer + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + +public class BaseListData extends EventDispatcher +{ + + //-------------------------------------------------------------------------- + // + // Constructor + // + //-------------------------------------------------------------------------- + + /** + * Constructor. + * + * @param label The textual representation of the item data. + * + * @param uid A unique identifier. + * + * @param owner A reference to the list control. + * + * @param rowIndex The index of the row in the currently visible rows of the control. + * + * @param columnIndex The index of the column in the currently visible columns of the + * control. + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public function BaseListData(label:String, uid:String, + owner:IUIComponent, rowIndex:int = 0, + columnIndex:int = 0) + { + super(); + + this.label = label; + this.uid = uid; + this.owner = owner; + this.rowIndex = rowIndex; + this.columnIndex = columnIndex; + } + + + //-------------------------------------------------------------------------- + // + // Properties + // + //-------------------------------------------------------------------------- + + //---------------------------------- + // columnIndex + //---------------------------------- + + [Bindable("__NoChangeEvent__")] + + /** + * The index of the column of the List-based control relative + * to the currently visible columns of the control, where the first column + * is at an index of 1. + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public var columnIndex:int; + + //---------------------------------- + // label + //---------------------------------- + + [Bindable("__NoChangeEvent__")] + + /** + * The textual representation of the item data, based on the list class's + * itemToLabel() method. + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public var label:String; + + //---------------------------------- + // owner + //---------------------------------- + + [Bindable("__NoChangeEvent__")] + + /** + * A reference to the list object that owns this item. + * This should be a ListBase-derived class. + * This property is typed as IUIComponent so that drop-ins + * like Label and TextInput don't have to have dependencies + * on List and all of its dependencies. + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public var owner:IUIComponent; + + //---------------------------------- + // rowIndex + //---------------------------------- + + [Bindable("__NoChangeEvent__")] + + /** + * The index of the row of the DataGrid, List, or Tree control relative + * to the currently visible rows of the control, where the first row + * is at an index of 1. + * For example, you click on an item in the control and rowIndex + * is set to 3. + * You then scroll the control to change the row's position in the visible rows + * of the control, and then click on the same row as before. + * The rowIndex now contains a different value corresponding to + * the new index of the row in the currently visible rows. + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public var rowIndex:int; + + //---------------------------------- + // uid + //---------------------------------- + + /** + * @private + * Storage for the uid property. + */ + private var _uid:String; + + [Bindable("__NoChangeEvent__")] + + /** + * The unique identifier for this item. + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public function get uid():String + { + return _uid; + } + + /** + * @private + */ + public function set uid(value:String):void + { + _uid = value; + } +} + +} diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/ITextInput.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/ITextInput.as new file mode 100644 index 0000000..b355e13 --- /dev/null +++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/ITextInput.as @@ -0,0 +1,345 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 mx.core +{ + +/* +import mx.controls.listClasses.IDropInListItemRenderer; +import mx.controls.listClasses.IListItemRenderer; +import mx.managers.IFocusManagerComponent; +import mx.styles.IStyleClient; +*/ + +/** + * Defines an interface for a single-line text field that is optionally editable. + * + * @langversion 3.0 + * @playerversion Flash 10 + * @playerversion AIR 1.5 + * @productversion Flex 4 + */ +public interface ITextInput + extends IDataRenderer, IUIComponent +{ + //-------------------------------------------------------------------------- + // + // Properties + // + //-------------------------------------------------------------------------- + + //---------------------------------- + // selectionActivePosition + //---------------------------------- + + /** + * The zero-based index of the position after the last character + * in the current selection (equivalent to the one-based index of the last + * character). + * If the last character in the selection, for example, is the fifth + * character, this property has the value 5. + * When the control gets the focus, the selection is visible if the + * selectionAnchorIndex and selectionActiveIndex + * properties are both set. + * + * @default 0 + * + * @tiptext The zero-based index value of the last character + * in the selection. + * + * @langversion 3.0 + * @playerversion Flash 10 + * @playerversion AIR 1.5 + * @productversion Flex 4 + */ + function get selectionActivePosition():int; + + //---------------------------------- + // selectionAnchorPosition + //---------------------------------- + + /** + * The zero-based character index value of the first character + * in the current selection. + * For example, the first character is 0, the second character is 1, + * and so on. + * When the control gets the focus, the selection is visible if the + * selectionAnchorIndex and selectionActiveIndex + * properties are both set. + * + * @default 0 + * + * @tiptext The zero-based index value of the first character + * in the selection. + * + * @langversion 3.0 + * @playerversion Flash 10 + * @playerversion AIR 1.5 + * @productversion Flex 4 + */ + function get selectionAnchorPosition():int; + + //---------------------------------- + // editable + //---------------------------------- + + /** + * Indicates whether the user is allowed to edit the text in this control. + * If true, the user can edit the text. + * + * @default true + * + * @tiptext Specifies whether the component is editable or not + * @helpid 3196 + * + * @langversion 3.0 + * @playerversion Flash 10 + * @playerversion AIR 1.5 + * @productversion Flex 4 + */ + function get editable():Boolean; + + /** + * @private + */ + function set editable(value:Boolean):void; + + //---------------------------------- + // horizontalScrollPosition + //---------------------------------- + + /** + * Pixel position in the content area of the leftmost pixel + * that is currently displayed. + * (The content area includes all contents of a control, not just + * the portion that is currently displayed.) + * This property is always set to 0, and ignores changes, + * if wordWrap is set to true. + * + * @default 0 + + * @tiptext The pixel position of the left-most character + * that is currently displayed + * @helpid 3194 + * + * @langversion 3.0 + * @playerversion Flash 10 + * @playerversion AIR 1.5 + * @productversion Flex 4 + */ + function get horizontalScrollPosition():Number; + + /** + * @private + */ + function set horizontalScrollPosition(value:Number):void; + + //---------------------------------- + // maxChars + //---------------------------------- + + /** + * Maximum number of characters that users can enter in the text field. + * This property does not limit the length of text specified by the + * setting the control's text or htmlText property. + * + *

The default value is 0, which is a special case + * meaning an unlimited number.

+ * + * @tiptext The maximum number of characters + * that the TextInput can contain + * @helpid 3191 + * + * @langversion 3.0 + * @playerversion Flash 10 + * @playerversion AIR 1.5 + * @productversion Flex 4 + */ + function get maxChars():int; + + /** + * @private + */ + function set maxChars(value:int):void; + + //---------------------------------- + // parentDrawsFocus + //---------------------------------- + + /** + * If true, calls to this control's drawFocus() method are forwarded + * to its parent's drawFocus() method. + * This is used when a TextInput is part of a composite control + * like NumericStepper or ComboBox; + * + * @default false + * + * @langversion 3.0 + * @playerversion Flash 10 + * @playerversion AIR 1.5 + * @productversion Flex 4 + */ + function get parentDrawsFocus():Boolean; + + /** + * @private + */ + function set parentDrawsFocus(value:Boolean):void; + + //---------------------------------- + // restrict + //---------------------------------- + + /** + * Indicates the set of characters that a user can enter into the control. + * If the value of the restrict property is null, + * you can enter any character. If the value of the restrict + * property is an empty string, you cannot enter any character. + * This property only restricts user interaction; a script + * can put any text into the text field. If the value of + * the restrict property is a string of characters, + * you may enter only characters in that string into the + * text field. + * + *

Flex scans the string from left to right. You can specify a range by + * using the hyphen (-) character. + * If the string begins with a caret (^) character, all characters are + * initially accepted and succeeding characters in the string are excluded + * from the set of accepted characters. If the string does not begin with a + * caret (^) character, no characters are initially accepted and succeeding + * characters in the string are included in the set of accepted characters.

+ * + *

Because some characters have a special meaning when used + * in the restrict property, you must use + * backslash characters to specify the literal characters -, ^, and \. + * When you use the restrict property as an attribute + * in an MXML tag, use single backslashes, as in the following + * example: \^\-\\. + * When you set the restrict In and ActionScript expression, + * use double backslashes, as in the following example: \\^\\-\\\.

+ * + * @default null + * @see flash.text.TextField#restrict + * @tiptext The set of characters that may be entered + * into the TextInput. + * @helpid 3193 + * + * @langversion 3.0 + * @playerversion Flash 10 + * @playerversion AIR 1.5 + * @productversion Flex 4 + */ + function get restrict():String; + + /** + * @private + */ + function set restrict(value:String):void; + + //---------------------------------- + // selectable + //---------------------------------- + + /** + * A flag indicating whether the text in the TextInput can be selected. + * + * @langversion 3.0 + * @playerversion Flash 10 + * @playerversion AIR 1.5 + * @productversion Flex 4 + */ + function get selectable():Boolean; + + /** + * @private + */ + function set selectable(value:Boolean):void; + + //---------------------------------- + // text + //---------------------------------- + + /** + * Plain text that appears in the control. + * Its appearance is determined by the CSS styles of this Label control. + * + *

Any HTML tags in the text string are ignored, + * and appear as entered in the string. + * To display text formatted using HTML tags, + * use the htmlText property instead. + * If you set the htmlText property, + * the HTML replaces any text you had set using this propety, and the + * text property returns a plain-text version of the + * HTML text, with all HTML tags stripped out. For more information + * see the htmlText property.

+ * + *

To include the special characters left angle bracket (<), + * right angle bracket (>), or ampersand (&) in the text, + * wrap the text string in the CDATA tag. + * Alternatively, you can use HTML character entities for the + * special characters, for example, &lt;.

+ * + *

If you try to set this property to null, + * it is set, instead, to the empty string. + * The text property can temporarily have the value null, + * which indicates that the htmlText has been recently set + * and the corresponding text value + * has not yet been determined.

+ * + * @default "" + * @tiptext Gets or sets the TextInput content + * @helpid 3190 + * + * @langversion 3.0 + * @playerversion Flash 10 + * @playerversion AIR 1.5 + * @productversion Flex 4 + */ + function get text():String; + + /** + * @private + */ + function set text(value:String):void; + + //-------------------------------------------------------------------------- + // + // Methods + // + //-------------------------------------------------------------------------- + + /** + * Selects the text in the range specified by the parameters. + * + * @param anchorPosition The zero-based character index value + * of the first character in the current selection. + * + * @param activePosition The zero-based index of the position + * after the last character in the current selection + * (equivalent to the one-based index of the last character). + * + * @langversion 3.0 + * @playerversion Flash 10 + * @playerversion AIR 1.5 + * @productversion Flex 4 + */ + function selectRange(anchorPosition:int, activePosition:int):void; +} + +} -- To stop receiving notification emails like this one, please contact pent@apache.org.