- Timestamp:
- 08/23/10 12:21:43 (21 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
ssme/trunk/flex/Calendar/src/com/kh/ssme/components/DayEventsField.as
r4045 r4046 23 23 package com.kh.ssme.components { 24 24 25 import com.kh.ssme.entity.TimeFrameEntity; 25 import com.kh.ssme.components.EventTooltip; 26 import com.kh.ssme.entity.TimeFrameEntity; 26 27 import com.kh.ssme.util.DayEventsFieldTypeEnum; 27 28 import com.kh.ssme.util.HashArray; … … 32 33 import mx.controls.Button; 33 34 import mx.controls.Label; 35 import mx.events.ToolTipEvent; 34 36 import mx.formatters.DateFormatter; 35 37 … … 48 50 this.visible = this.includeInLayout = true; 49 51 setStyle("borderThickness", 2); 50 setStyle("borderColor", 0xBBBBFF); 52 setStyle("borderColor", 0xBBBBFF); 53 this.verticalScrollPolicy = "off"; 54 this.horizontalScrollPolicy = "off"; 51 55 52 56 container_ = new VBox(); 53 57 container_.percentWidth = 100; 54 58 container_.percentHeight = 100; 59 container_.setStyle("verticalGap",0); 60 container_.setStyle("textAlign","center"); 61 container_.verticalScrollPolicy = "off"; 62 container_.horizontalScrollPolicy = "off"; 55 63 this.addChild( container_ ); 56 64 … … 64 72 innerContainer_.percentWidth = 100; 65 73 innerContainer_.percentHeight = 100; 66 innerContainer_.setStyle( "backgroundColor", 0x880000 ); 74 innerContainer_.setStyle("verticalGap",1); 75 innerContainer_.setStyle("paddingLeft",2); 76 innerContainer_.setStyle("paddingRight",2); 77 innerContainer_.setStyle("textAlign","center"); 78 innerContainer_.verticalScrollPolicy = "off"; 79 innerContainer_.horizontalScrollPolicy = "off"; 67 80 container_.addChild( innerContainer_ ); 68 81 … … 76 89 timeFormatter.formatString = "JJ:NN"; 77 90 78 this.toolTip = "";79 91 } 80 92 … … 106 118 var timeframe:TimeFrameEntity, o:Object, tempButton:Button; 107 119 for each(o in dataProviderArray_){ 108 timeframe = (o.value Ofas TimeFrameEntity);120 timeframe = (o.value as TimeFrameEntity); 109 121 if(timeframe){ 110 tempButton = new Button(); 111 tempButton.height = 20; 112 tempButton.setStyle( "highlightAlphas", [0, 0]); 113 tempButton.setStyle( "fillAlphas", [0.6, 0.4, 0.6, 0.4]); 114 tempButton.setStyle( "fillColors", [0xffffff, 0x999999, 0xffffff, 0x999999]); 115 tempButton.setStyle( "themeColor", 0x0000cc ); 116 tempButton.label = timeFormatter.format( timeframe.from )+" - "+timeFormatter.format( timeframe.to ); 122 tempButton = new EventBox(); 123 tempButton.height = 15; 124 tempButton.width = 120; 125 tempButton.label = timeFormatter.format( timeframe.from )+" - "+timeFormatter.format( timeframe.to )+" "+timeframe.description; 126 tempButton.data = timeframe; 117 127 innerContainer_.addChild( tempButton ); 118 128 } … … 126 136 } 127 137 private function sortTimeFrames(a:Object, b:Object):int { 138 var result:Number = 0; 128 139 if(a && b && a.value && b.value && a.value is TimeFrameEntity && b.value is TimeFrameEntity){ 129 re turn(a.value as TimeFrameEntity).from.time - (b.value as TimeFrameEntity).from.time;140 result = (a.value as TimeFrameEntity).from.time - (b.value as TimeFrameEntity).from.time; 130 141 } 131 return 0; 142 if(result == 0){ 143 return (a.value as TimeFrameEntity).to.time - (b.value as TimeFrameEntity).to.time; 144 } 145 return result; 146 } 147 private function createEventTooltip(event:ToolTipEvent, timeframe:TimeFrameEntity):void { 148 event.toolTip = new EventTooltip(); 149 (event.toolTip as EventTooltip).data = timeframe; 132 150 } 133 151 152 134 153 protected override function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{ 135 154 super.updateDisplayList( unscaledWidth, unscaledHeight ); … … 145 164 sumHeight += button.height; 146 165 button.visible = button.includeInLayout = sumHeight < unscaledHeight; 166 button.width = unscaledWidth - 8;//Math.max( 0, unscaledWidth-button.width/2 ); 147 167 if(sumHeight < unscaledHeight) displayed++; 148 168 } 149 150 bottomTitle_.text = "+"+(dataProvider_.size - displayed); 169 bottomTitle_.text = (dataProvider_.size > displayed) ? "+"+(dataProvider_.size - displayed) : ""; 151 170 } 152 171
