Pakket | spark.globalization |
Klasse | public class MatchingCollator |
Overerving | MatchingCollator CollatorBase GlobalizationBase AdvancedStyleClient EventDispatcher Object |
Taalversie: | ActionScript 3.0 |
Productversie: | Flex 4.5 |
Runtimeversies: | Flash Player 10.1, AIR 2.5 |
MatchingCollator
class provides locale-sensitve string
comparison capabilities with inital settings suitable for general string
matching such as finding a matching word in a block of text.
This class is a wrapper class around the
flash.globalization.Collator
.
Therefore the locale-specific string comparison is provided by the
flash.globalization.Collator
.
However, this MatchingCollator class can be used in MXML declartions, uses
the locale style for the requested Locale ID name, and has methods and
properties that are bindable.
Additionally, LastOperationStatus
is set, if there is an error or warning
generated by the flash.globalization class.
The flash.globalization.Collator class uses the underlying operating system for the formatting functionality and to supply the locale specific data. On some operating systems, the flash.globalization classes are unsupported, this wrapper class provides a fallback functionality.
Meer voorbeelden
Verwante API-elementen
Methode | Gedefinieerd door | ||
---|---|---|---|
Constructs a new MatchingCollator object to provide string
comparisons according to the conventions of a specified locale. | MatchingCollator | ||
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registreert een gebeurtenislistenerobject bij een object EventDispatcher, zodat de listener een melding van een gebeurtenis ontvangt. | EventDispatcher | ||
Deletes a style property from this component instance. | AdvancedStyleClient | ||
Compares two strings and returns an integer value indicating whether
the first string is less than, equal to, or greater than the second
string. | CollatorBase | ||
Verzendt een gebeurtenis naar de gebeurtenisstroom. | EventDispatcher | ||
Compares two strings and returns a Boolean value indicating whether
the strings are equal. | CollatorBase | ||
[statisch]
Lists all of the locale ID names supported by this class. | CollatorBase | ||
Returns an Array of CSSStyleDeclaration objects for the type selector
that applies to this component, or null if none exist. | AdvancedStyleClient | ||
[overschrijven]
Gets a style property that has been set anywhere in this
component's style lookup chain. | GlobalizationBase | ||
Returns true if currentCSSState is not null. | AdvancedStyleClient | ||
Controleert of het object EventDispatcher listeners heeft geregistreerd voor een specifiek type gebeurtenis. | EventDispatcher | ||
Geeft aan of voor een object een opgegeven eigenschap is gedefinieerd. | Object | ||
The initialized method is called when this class or a class that
extends this class is used in an MXML declaration. | AdvancedStyleClient | ||
Geeft aan of een instantie van de klasse Object zich in de prototypeketen van het object bevindt dat als parameter is opgegeven. | Object | ||
Returns true if cssState matches currentCSSState. | AdvancedStyleClient | ||
Determines whether this instance is the same as, or is a subclass of,
the given type. | AdvancedStyleClient | ||
Propagates style changes to the children of this style client
instance. | AdvancedStyleClient | ||
Geeft aan of de opgegeven eigenschap bestaat en kan worden opgesomd. | Object | ||
Sets up the internal style cache values so that the
getStyle()
method functions. | AdvancedStyleClient | ||
Registers the EffectManager as one of the event listeners
for each effect event. | AdvancedStyleClient | ||
Verwijdert een listener uit het object EventDispatcher. | EventDispatcher | ||
Stelt de beschikbaarheid van een dynamische eigenschap voor lusbewerkingen in. | Object | ||
Sets a style property on this component instance. | AdvancedStyleClient | ||
Detects changes to style properties. | AdvancedStyleClient | ||
Flex calls the stylesInitialized() method when
the styles for a component are first initialized. | AdvancedStyleClient | ||
Geeft de tekenreeksweergave van dit object weer, geformatteerd volgens de locatiespecifieke conventies. | Object | ||
Retourneert een tekenreeksrepresentatie van het opgegeven object. | Object | ||
Retourneert de primitieve waarde van het opgegeven object. | Object | ||
Controleert of een gebeurtenislistener is geregistreerd bij dit object EventDispatcher of een van de voorouders voor het opgegeven type gebeurtenis. | EventDispatcher |
Stijlen zijn of algemeen of ze zijn gekoppeld aan een bepaald thema. Als de stijl algemeen is, kan deze bij elk thema worden gebruikt. Als een stijl is gekoppeld aan een bepaald thema, kan de stijl alleen worden gebruikt als uw toepassing het desbetreffende thema gebruikt.
MatchingCollator | () | Constructor |
public function MatchingCollator()
Taalversie: | ActionScript 3.0 |
Productversie: | Flex 4.5 |
Runtimeversies: | Flash Player 10.1, AIR 2.5 |
Constructs a new MatchingCollator object to provide string comparisons according to the conventions of a specified locale.
This class sets the initial values of the various collation for general string matching uses such as determining if two strings are equivalent or finding a matching word in a block of text. In this mode, differences in uppercase and lower case letters, accented characters, and so on are ignored when doing string comparisons.
The comparison provided by an instance of this class is
equivalent to constructing an instance of the
flash.globalization.Collator
with the
initialMode
paramater set to
CollatorMode.MATCHING
.
For more details and examples of this mode, please
see the documentation for the
flash.globalization.Collator
class
The locale for this class is supplied by the locale style. The locale style can be set in several ways:
- Inheriting the style from a
UIComponent
by calling the UIComponent's addStyleClient method. - By using the class in an MXML declaration and inheriting the
locale from the document that contains the declaration.
Example: <fx:Declarations> <s:MatchingCollator id="mc" /> </fx:Declarations>
- By using an MXML declaration and specifying the locale value
in the list of assignments.
Example: <fx:Declarations> <s:MatchingCollator id="mc_France" locale="fr-FR" /> </fx:Declarations>
- Calling the setStyle method, e.g.
mc.setStyle("locale", "fr-FR")
If the locale
style is not set by one of the above
techniques, the instance of this class will be added as a
StyleClient
to the topLevelApplication
and
will therefore inherit the locale
style from the
topLevelApplication
object when the locale
dependent property getter or locale
dependent method is
called.
Verwante API-elementen
<?xml version="1.0" encoding="utf-8"?> <!-- Sample program for spark.globalization.MatchingCollator --> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx"> <fx:Declarations> <s:MatchingCollator id="collator"/> </fx:Declarations> <fx:Script> <![CDATA[ import mx.collections.ArrayCollection; import mx.events.ListEvent; private static const localeList:ArrayCollection = new ArrayCollection([ { label:"English (en)", data:"en" }, { label:"Turkish (tr)", data:"tr" } ]); private static const wordList:ArrayCollection = new ArrayCollection([ "Windows", "windows", "WINDOWS", "Wındows", "wındows", "WİNDOWS" ]); private function inputWord_changeHandler(event:Event):void { const word:String = inputWord.selectedItem as String; resultWordList.text = ""; for (var i:int = 0; i < wordList.length; ++i) { if (collator.equals(word, wordList[i])) resultWordList.text += wordList[i] + " "; } } ]]> </fx:Script> <mx:Form> <mx:FormItem label="Select Language"> <mx:ComboBox id="localeSelector" change="setStyle('locale', localeSelector.selectedItem.data);" dataProvider="{localeList}"/> </mx:FormItem> <mx:FormItem label="Ignore case"> <s:CheckBox id="ignoreCase" selected="{collator.ignoreCase}" change="collator.ignoreCase = ignoreCase.selected"/> </mx:FormItem> <mx:FormItem label="Input word"> <mx:ComboBox id="inputWord" dataProvider="{wordList}"/> <s:Button click="inputWord_changeHandler(event)" label="Find"/> </mx:FormItem> <mx:FormItem label="Result Matching Words"> <mx:Text id="resultWordList"/> </mx:FormItem> </mx:Form> </s:Application>
Wed Jun 13 2018, 11:42 AM Z