|
@@ -8,7 +8,7 @@
|
|
|
<s:HGroup id="dt" gap="0" verticalAlign="middle" width="100%" height="22">
|
|
|
<cus:QTextInput id="returnTime" width="100%" editable="{initeditable}" text="{initvalue}"/>
|
|
|
<s:Button width="22" height="22" click="open(event)"
|
|
|
- icon="@Embed(source='resource/yjpt/list/DateChooser.png')"/>
|
|
|
+ icon="@Embed(source='mx/controls/DateChooser.png')"/>
|
|
|
<s:Spacer width="5"/>
|
|
|
<s:Button width="22" height="22" click="button1_clickHandler(event)" icon="@Embed(source='resource/yjpt/list/iconpng.png')" toolTip="清空"/>
|
|
|
</s:HGroup>
|
|
@@ -33,39 +33,40 @@
|
|
|
private var initvalue: String;
|
|
|
[Bindable]
|
|
|
private var initeditable:Boolean;
|
|
|
-// [Bindable]
|
|
|
-// public var dt_percentWidth:Number;
|
|
|
+ // [Bindable]
|
|
|
+ // public var dt_percentWidth:Number;
|
|
|
|
|
|
public var hasTime:Boolean=false;
|
|
|
|
|
|
private var m_width:Number = 168;
|
|
|
|
|
|
private var pop:Object;
|
|
|
-// private var isOpen:Boolean = false;
|
|
|
+ // private var isOpen:Boolean = false;
|
|
|
private var nowTime:Date;
|
|
|
+ private var newTime:Date;
|
|
|
private var popEventX:Number;
|
|
|
private var popEventY:Number;
|
|
|
private var popEventHeight:Number;
|
|
|
|
|
|
protected function creationCompleteHandler(event:FlexEvent):void
|
|
|
{
|
|
|
-// BindingUtils.bindProperty(this.dt,"percentWidth",this,"dt_percentWidth");
|
|
|
+ // BindingUtils.bindProperty(this.dt,"percentWidth",this,"dt_percentWidth");
|
|
|
}
|
|
|
|
|
|
-// override public function set width(value:Number):void{
|
|
|
-// dt.width = value;
|
|
|
-// }
|
|
|
-
|
|
|
-// override public function set percentWidth(value:Number):void{
|
|
|
-// dt_percentWidth = value;
|
|
|
-// }
|
|
|
+ // override public function set width(value:Number):void{
|
|
|
+ // dt.width = value;
|
|
|
+ // }
|
|
|
+
|
|
|
+ // override public function set percentWidth(value:Number):void{
|
|
|
+ // dt_percentWidth = value;
|
|
|
+ // }
|
|
|
|
|
|
private function movePop(e:FlexEvent):void{
|
|
|
-// trace("FlexGlobals.topLevelApplication.height:"+FlexGlobals.topLevelApplication.height);
|
|
|
+ // trace("FlexGlobals.topLevelApplication.height:"+FlexGlobals.topLevelApplication.height);
|
|
|
if(popEventY+pop.height+25>FlexGlobals.topLevelApplication.height)
|
|
|
pop.move(popEventX,popEventY-pop.height);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
private function yearChangeHandler(evt:NumericStepperEvent):void{
|
|
|
nowTime.setFullYear(evt.value,nowTime.month,nowTime.date);
|
|
|
(pop as Container).removeAllChildren();
|
|
@@ -337,31 +338,34 @@
|
|
|
// hBoxBottom.addChild(subBtn);
|
|
|
pop.addChild(hBoxBottom);
|
|
|
}
|
|
|
-// if(systemManager.contains(pop as DisplayObject)){
|
|
|
-// PopUpManager.removePopUp(pop as IFlexDisplayObject);
|
|
|
-// pop = null;
|
|
|
-// open(null);
|
|
|
-// }
|
|
|
+ // if(systemManager.contains(pop as DisplayObject)){
|
|
|
+ // PopUpManager.removePopUp(pop as IFlexDisplayObject);
|
|
|
+ // pop = null;
|
|
|
+ // open(null);
|
|
|
+ // }
|
|
|
// isOpen = false;
|
|
|
}
|
|
|
|
|
|
private function minuteChangeHandler(evt:NumericStepperEvent):void{
|
|
|
nowTime.setHours(nowTime.hours,evt.value,nowTime.seconds,nowTime.milliseconds);
|
|
|
- returnTime.text = dateToStr(nowTime);
|
|
|
+ newTime.setFullYear(nowTime.fullYear,nowTime.month,nowTime.date);
|
|
|
+ returnTime.text = dateToStr(newTime);
|
|
|
}
|
|
|
|
|
|
private function hourChangeHandler(evt:NumericStepperEvent):void{
|
|
|
nowTime.setHours(evt.value,nowTime.minutes,nowTime.seconds,nowTime.milliseconds);
|
|
|
- returnTime.text = dateToStr(nowTime);
|
|
|
+ newTime.setFullYear(nowTime.fullYear,nowTime.month,nowTime.date);
|
|
|
+ returnTime.text = dateToStr(newTime);
|
|
|
}
|
|
|
|
|
|
private function testHandler(event:ListEvent):void{
|
|
|
nowTime.date = new Number(event.target.selectedItems[0]);
|
|
|
- returnTime.text = dateToStr(nowTime);
|
|
|
+ newTime.setFullYear(nowTime.fullYear,nowTime.month,nowTime.date);
|
|
|
+ returnTime.text = dateToStr(newTime);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
private function open(event:MouseEvent):void{
|
|
|
-// if(!isOpen){
|
|
|
+ // if(!isOpen){
|
|
|
if(event!=null){
|
|
|
popEventX = event.stageX-event.localX-returnTime.width;
|
|
|
popEventY = event.stageY-event.localY;
|
|
@@ -371,6 +375,10 @@
|
|
|
if(nowTime==null){
|
|
|
nowTime=new Date;
|
|
|
}
|
|
|
+ if(newTime==null){
|
|
|
+ newTime=new Date;
|
|
|
+ }
|
|
|
+ nowTime.setFullYear(newTime.fullYear,newTime.month,newTime.date);
|
|
|
pop = PopUpManager.createPopUp(this, mx.containers.TitleWindow, false);
|
|
|
this.addEventListener(Event.REMOVED_FROM_STAGE,function(e:Event):void{
|
|
|
PopUpManager.removePopUp(pop as IFlexDisplayObject);
|
|
@@ -516,19 +524,19 @@
|
|
|
pop.addChild(hBoxBottom);
|
|
|
}
|
|
|
|
|
|
-// isOpen = true;
|
|
|
+ // isOpen = true;
|
|
|
}else{
|
|
|
if(systemManager.contains(pop as DisplayObject)){
|
|
|
PopUpManager.removePopUp(pop as IFlexDisplayObject);
|
|
|
}
|
|
|
-// isOpen = false;
|
|
|
+ // isOpen = false;
|
|
|
}
|
|
|
}
|
|
|
private function closeHandler(event:Event):void{
|
|
|
if(systemManager.contains(pop as DisplayObject)){
|
|
|
PopUpManager.removePopUp(pop as IFlexDisplayObject);
|
|
|
}
|
|
|
-// isOpen = false;
|
|
|
+ // isOpen = false;
|
|
|
}
|
|
|
|
|
|
public function set text(str:String):void{
|
|
@@ -542,15 +550,17 @@
|
|
|
if(str==null)
|
|
|
{
|
|
|
nowTime = new Date();
|
|
|
+ newTime = new Date();
|
|
|
returnTime.text = "";
|
|
|
return;
|
|
|
}
|
|
|
nowTime = str;
|
|
|
-// var strDate:String = nowTime.fullYear + "-" + (nowTime.month+1) + "-" + nowTime.date ;
|
|
|
-// if(hasTime)
|
|
|
-// strDate = strDate
|
|
|
-// + " " + nowTime.hours + ":" + nowTime.minutes + ":" + nowTime.seconds;
|
|
|
- returnTime.text = dateToStr(nowTime);
|
|
|
+ newTime = str;
|
|
|
+ // var strDate:String = nowTime.fullYear + "-" + (nowTime.month+1) + "-" + nowTime.date ;
|
|
|
+ // if(hasTime)
|
|
|
+ // strDate = strDate
|
|
|
+ // + " " + nowTime.hours + ":" + nowTime.minutes + ":" + nowTime.seconds;
|
|
|
+ returnTime.text = dateToStr(newTime);
|
|
|
|
|
|
}
|
|
|
public function get dateTime():Date{
|
|
@@ -558,12 +568,12 @@
|
|
|
{
|
|
|
if(!hasTime)
|
|
|
{
|
|
|
- nowTime.hours=0;
|
|
|
- nowTime.minutes=0;
|
|
|
- nowTime.seconds=0;
|
|
|
- nowTime.milliseconds=0;
|
|
|
+ newTime.hours=0;
|
|
|
+ newTime.minutes=0;
|
|
|
+ newTime.seconds=0;
|
|
|
+ newTime.milliseconds=0;
|
|
|
}
|
|
|
- return nowTime;
|
|
|
+ return newTime;
|
|
|
}
|
|
|
return null;
|
|
|
}
|