Pakiet | spark.globalization |
Klasa | public class SortingCollator |
Dziedziczenie | SortingCollator CollatorBase GlobalizationBase AdvancedStyleClient EventDispatcher Object |
Wersja języka: | ActionScript 3.0 |
Wersja produktu: | Flex 4.5 |
Wersje środowiska wykonawczego: | Flash Player 10.1, AIR 2.5 |
SortingCollator
class provides locale-sensitve string
comparison capabilities with inital settings suitable for linguistic
sorting purposes such as sorting a list of
text strings that are displayed to an end-user.
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 SortingCollator 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.
Powiązane elementy interfejsu API
Metoda | Zdefiniowane przez | ||
---|---|---|---|
Constructs a new SortingCollator object to provide string comparisons
according to the conventions of a specified locale. | SortingCollator | ||
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Rejestruje obiekt detektora zdarzeń w obiekcie EventDispatcher, dzięki czemu detektor będzie otrzymywał powiadomienia o zdarzeniu. | 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 | ||
Wywołuje zdarzenie, tj. kieruje je do przepływu zdarzeń. | EventDispatcher | ||
Compares two strings and returns a Boolean value indicating whether
the strings are equal. | CollatorBase | ||
[statyczny]
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 | ||
[przesłanianie]
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 | ||
Sprawdza, czy obiekt EventDispatcher zawiera jakiekolwiek detektory zarejestrowane dla konkretnego typu zdarzeń. | EventDispatcher | ||
Wskazuje, czy dla obiektu zdefiniowano określoną właściwość. | Object | ||
The initialized method is called when this class or a class that
extends this class is used in an MXML declaration. | AdvancedStyleClient | ||
Wskazuje, czy instancja klasy Object należy do łańcucha prototypów obiektu określonego jako parametr. | 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 | ||
Wskazuje, czy określona właściwość istnieje i jest przeliczalna. | 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 | ||
Usuwa detektor z obiektu EventDispatcher. | EventDispatcher | ||
Ustawia dostępność właściwości dynamicznej używanej w pętlach. | 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 | ||
Zwraca ciąg reprezentujący obiekt — sformatowany zgodnie z konwencjami właściwymi dla ustawień regionalnych. | Object | ||
Zwraca ciąg reprezentujący określony obiekt. | Object | ||
Zwraca pierwotną wartość dla określonego obiektu. | Object | ||
Sprawdza, czy detektor zdarzeń określonego typu jest zarejestrowany w tym obiekcie EventDispatcher lub jego elementach macierzystych. | EventDispatcher |
Wyróżnia się style wspólne i powiązane z konkretnymi motywami. Styl wspólny może być używany z dowolnym motywem. Styl powiązany z konkretnym motywem może być używany pod warunkiem, że w aplikacji jest używany właśnie ten motyw.
SortingCollator | () | Konstruktor |
public function SortingCollator()
Wersja języka: | ActionScript 3.0 |
Wersja produktu: | Flex 4.5 |
Wersje środowiska wykonawczego: | Flash Player 10.1, AIR 2.5 |
Constructs a new SortingCollator object to provide string comparisons according to the conventions of a specified locale.
This class sets the initial values of the various collation options for general linguistic sorting usages such as sorting a list of text strings that are displayed to an end user. In this mode, differences in uppercase and lowercase letters, accented characters, and other differences specific to the locale are considered 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.SORTING
.
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:SortingCollator id="sc" /> </fx:Declarations>
- By using an MXML declaration and specifying the locale value
in the list of assignments.
Example: <fx:Declarations> <s:SortingCollator id="sc_France" locale="fr-FR" /> </fx:Declarations>
- Calling the setStyle method, e.g.
sc.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.
Powiązane elementy interfejsu API
<?xml version="1.0" encoding="utf-8"?> <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" width="100%" height="100%"> <fx:Declarations> <s:SortingCollator id="sortingCollator"/> </fx:Declarations> <fx:Script> <![CDATA[ import mx.collections.ArrayCollection; import mx.events.ListEvent; [Bindable] private var localeList:ArrayCollection = new ArrayCollection([ { label:"English (en)", data:"en" }, { label:"French (fr)", data:"fr" }, { label:"German (de)", data:"de" }, { label:"Latvian (lt)", data:"lt" }, { label:"Sweedish (sv)", data:"sv" }, { label:"Chinese (zh)", data:"zh" }]); private static const wordList:ArrayCollection = new ArrayCollection([ "B", "b", "a", "A" , "y (lt)", "i (lt)", "k (lt)", "n (sv)", "ö (sv)", "o (sv)", "z (sv)", "vu (sv)", "wo (sv)", "däd (de)", "daed (de)", "öf (de)", "of (de)", "côte (fr)", "coté (fr)", "手 (zh)", "ä¸ (zh)", "土 (zh)", "å²€ (zh)" ]); protected function localeSelector_changeHandler( event:ListEvent):void { setStyle("locale", ComboBox(event.target).selectedItem.data); wordList.refresh(); } ]]> </fx:Script> <mx:VBox> <mx:HBox> <s:Label text="Select Language"/> <mx:ComboBox id="localeSelector" change="localeSelector_changeHandler(event)" dataProvider="{localeList}"/> </mx:HBox> <mx:DataGrid id="dataGrid" width="100%" dataProvider="{wordList}" rowCount="{wordList.length}"> <mx:columns> <mx:DataGridColumn headerText="Click here to sort" sortCompareFunction="{sortingCollator.compare}"/> </mx:columns> </mx:DataGrid> </mx:VBox> </s:Application>
Tue Jun 12 2018, 12:06 PM Z