Flex-datechooser-control
フレックス-DateChooserコントロール
DateChooserコントロールを使用して、月の名前、年、および曜日のグリッドを表示し、曜日のラベルが付いた列を表示します。
DateChooserコントロールを使用すると、ユーザーは日付、日付の範囲、または複数の日付を選択できます。 このコントロールには、月と年を変更するための進む矢印ボタンと戻る矢印ボタンが含まれています。
クラス宣言
以下は mx.controls.DateChooser クラスの宣言です-
public class DateChooser
extends UIComponent
implements IFocusManagerComponent, IFontContextComponent
パブリックプロパティ
Sr.No | Property & Description |
---|---|
1 |
allowDisjointSelection : Boolean trueの場合、DateChooserコントロールで非連続(分離)選択が許可されることを指定します。 |
2 |
allowMultipleSelection : Boolean trueの場合、DateChooserコントロールで複数選択が許可されることを指定します。 |
3 |
dayNames : Array DateChooserコントロールの曜日名。 |
4 |
disabledDays : Array 1週間で無効にする日。 |
5 |
disabledRanges : Array 単一および複数の日を無効にします。 |
6 |
displayedMonth : int shownYearプロパティと組み合わせて使用する場合、displayedMonthプロパティは、DateChooserコントロールに表示される月を指定します。 |
7 |
displayedYear : int shownMonthプロパティと併せて使用する場合、displayedYearプロパティは、DateChooserコントロールに表示される年を指定します。 |
8 |
firstDayOfWeek : Object DateChooserコントロールの最初の列に表示する曜日を表す数値。 |
9 |
maxYear : int コントロールで選択可能な最後の年。 |
10 |
minYear : int コントロールで選択可能な最初の年。 |
11 |
monthNames : Array DateChooserコントロールの上部に表示される月の名前。 |
12 |
monthSymbol : String このプロパティは、monthNamesプロパティで指定された値の末尾に追加され、DateChooserコントロールの上部に表示される月の名前を定義します。 |
13 |
selectableRange : Object 日付が選択可能な日付の範囲。 |
14 |
selectedDate : Date DateChooserコントロールで選択された日付。 |
15 |
selectedRanges : Array 選択された日付範囲。 |
16 |
showToday : Boolean trueの場合、DateChooserコントロールで今日が強調表示されることを指定します。 |
17 |
yearNavigationEnabled : Boolean 年ナビゲーションを有効にします。 |
18 |
yearSymbol : String このプロパティは、DateChooserコントロールの上部に表示される年の終わりに追加されます。 |
保護されたプロパティ
Sr.No | Property & Description |
---|---|
1 |
calendarLayoutStyleFilters : Object [read-only] The set of styles to pass from the DateChooser to the calendar layout. |
2 |
nextMonthStyleFilters : Object [read-only] The set of styles to pass from the DateChooser to the next month button. |
3 |
nextYearStyleFilters : Object [read-only] The set of styles to pass from the DateChooser to the next year button. |
4 |
prevMonthStyleFilters : Object [read-only] The set of styles to pass from the DateChooser to the previous month button. |
5 |
prevYearStyleFilters : Object [read-only] The set of styles to pass from the DateChooser to the previous year button. |
パブリックメソッド
Sr.No | Method & Description |
---|---|
1 |
DateChooser() コンストラクタ。 |
イベント
Sr.No | Event & Description |
---|---|
1 |
change 日付が選択または変更されたときに送出されます。 |
2 |
scroll ユーザーの操作により月が変更されたときにディスパッチされます。 |
継承されるメソッド
このクラスは、次のクラスからメソッドを継承します-
- mx.core.UIComponent
- mx.core.FlexSprite
- flash.display.Sprite
- flash.display.DisplayObjectContainer
- flash.display.InteractiveObject
- flash.display.DisplayObject
- flash.events.EventDispatcher
- 対象
Flex DateChooserコントロールの例
次の手順に従って、テストアプリケーションを作成して、FlexアプリケーションでのDateChooserコントロールの使用を確認します。
Step | Description |
---|---|
1 | Create a project with a name HelloWorld under a packagecom.finddevguides.client as explained in the Flex - Create Application chapter. |
2 | Modify HelloWorld.mxml as explained below. Keep rest of the files unchanged. |
3 | Compile and run the application to make sure business logic is working as per the requirements. |
以下は、変更されたmxmlファイル src/com.finddevguides/HelloWorld.mxml の内容です。
<?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%" minWidth = "500" minHeight = "500"
applicationComplete = "application_applicationCompleteHandler(event)">
<fx:Style source = "/com/finddevguides/client/Style.css"/>
<fx:Script>
<![CDATA[
import mx.events.CalendarLayoutChangeEvent;
import mx.events.FlexEvent;
[Bindable]
private var selectedDate:String = "";
protected function dateChooser_changeHandler
event:CalendarLayoutChangeEvent):void {
var date:Date = DateChooser(event.target).selectedDate;
selectedDate = dateFormatter.format(date);
}
protected function application_applicationCompleteHandler
(event:FlexEvent):void {
selectedDate = dateFormatter.format(new Date());
}
]]>
</fx:Script>
<s:BorderContainer width = "550" height = "400" id = "mainContainer"
styleName = "container">
<s:VGroup width = "100%" height = "100%" gap = "50"
horizontalAlign = "center" verticalAlign = "middle">
<s:Label id = "lblHeader" text = "Form Controls Demonstration"
fontSize = "40" color = "0x777777" styleName = "heading"/>
<s:Panel id = "dateChooserPanel" title = "Using DateChooser" width = "400"
height = "300" includeInLayout = "true" visible = "true">
<s:layout>
<s:HorizontalLayout gap = "10" verticalAlign = "middle"
horizontalAlign = "center"/>
</s:layout>
<mx:DateChooser id = "dateChooser" yearNavigationEnabled = "true"
change = "dateChooser_changeHandler(event)"/>
<s:Label id = "selection" fontWeight = "bold"
text = "Date selected: {selectedDate}"/>
</s:Panel>
</s:VGroup>
</s:BorderContainer>
</s:Application>
すべての変更が完了したら、link:/flex/flex_create_application [Flex-アプリケーションの作成]の章で行ったように、アプリケーションを通常モードでコンパイルして実行します。 アプリケーションに問題がない場合は、次の結果が生成されます。