Changeset 4040
- Timestamp:
- 08/11/10 12:55:02 (18 months ago)
- Location:
- ssme/trunk/flex
- Files:
-
- 1 added
- 6 modified
-
Calendar/src/Calendar.mxml (modified) (9 diffs)
-
Calendar/src/com/kh/ssme/components/DayCanvas.as (modified) (5 diffs)
-
Calendar/src/com/kh/ssme/components/EventField.as (modified) (3 diffs)
-
Calendar/src/com/kh/ssme/components/SimpleEventDisplay.as (modified) (1 diff)
-
Common/src/com/kh/ssme/components/GridCanvas.as (modified) (5 diffs)
-
Common/src/com/kh/ssme/IconSet.as (added)
-
Common/src/com/kh/ssme/util/DateUtil.as (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ssme/trunk/flex/Calendar/src/Calendar.mxml
r4037 r4040 155 155 width="100%" height="100%" minHeight="400" 156 156 outerBorderColor="0x000000" outerBorderAlpha="1.0" outerBorderThickness="1" 157 innerBorderColors="[ 0x000000, 0x 444444, 0x888888 ]" innerBorderAlphas="[ 0.5, 0.3, 0.3 ]" innerBorderThicknesses="[ 2, 1, 1 ]"158 backgroundColor="0xffffff" backgroundAlpha="0" 159 rows="[ 24, 48,96 ]" columns="[ 1 ]"157 innerBorderColors="[ 0x000000, 0x888888 ]" innerBorderAlphas="[ 0.5, 0.3 ]" innerBorderThicknesses="[ 2, 1 ]" 158 backgroundColor="0xffffff" backgroundAlpha="0" 159 rows="[ 24, 96 ]" columns="[ 1 ]" 160 160 visible="true" includeInLayout="true" 161 161 cornerRadius="0"> … … 166 166 width="100%" height="100%" minHeight="400" 167 167 outerBorderColor="0x000000" outerBorderAlpha="1.0" outerBorderThickness="1" 168 innerBorderColors="[ 0x000000, 0x 444444, 0x888888 ]" innerBorderAlphas="[ 0.5, 0.3, 0.3 ]" innerBorderThicknesses="[ 2, 1, 1 ]"169 backgroundColor="0xffffff" backgroundAlpha="0" 170 rows="[ 24, 48,96 ]" columns="[ 1 ]"168 innerBorderColors="[ 0x000000, 0x888888 ]" innerBorderAlphas="[ 0.5, 0.3 ]" innerBorderThicknesses="[ 2, 1 ]" 169 backgroundColor="0xffffff" backgroundAlpha="0" 170 rows="[ 24, 96 ]" columns="[ 1 ]" 171 171 showEffect="{ fadeIn }" hideEffect="{ fadeOut }" 172 172 cornerRadius="0"> … … 177 177 width="100%" height="100%" minHeight="400" 178 178 outerBorderColor="0x000000" outerBorderAlpha="1.0" outerBorderThickness="1" 179 innerBorderColors="[ 0x000000, 0x 444444, 0x888888 ]" innerBorderAlphas="[ 0.5, 0.3, 0.3 ]" innerBorderThicknesses="[ 2, 1, 1 ]"180 backgroundColor="0xffffff" backgroundAlpha="0" 181 rows="[ 24, 48,96 ]" columns="[ 1 ]"179 innerBorderColors="[ 0x000000, 0x888888 ]" innerBorderAlphas="[ 0.5, 0.3 ]" innerBorderThicknesses="[ 2, 1 ]" 180 backgroundColor="0xffffff" backgroundAlpha="0" 181 rows="[ 24, 96 ]" columns="[ 1 ]" 182 182 showEffect="{ fadeIn }" hideEffect="{ fadeOut }" 183 183 cornerRadius="0"> … … 188 188 width="100%" height="100%" minHeight="400" 189 189 outerBorderColor="0x000000" outerBorderAlpha="1.0" outerBorderThickness="1" 190 innerBorderColors="[ 0x000000, 0x 444444, 0x888888 ]" innerBorderAlphas="[ 0.5, 0.3, 0.3 ]" innerBorderThicknesses="[ 2, 1, 1 ]"191 backgroundColor="0xffffff" backgroundAlpha="0" 192 rows="[ 24, 48,96 ]" columns="[ 1 ]"190 innerBorderColors="[ 0x000000, 0x888888 ]" innerBorderAlphas="[ 0.5, 0.3 ]" innerBorderThicknesses="[ 2, 1 ]" 191 backgroundColor="0xffffff" backgroundAlpha="0" 192 rows="[ 24, 96 ]" columns="[ 1 ]" 193 193 showEffect="{ fadeIn }" hideEffect="{ fadeOut }" 194 194 cornerRadius="0"> … … 199 199 width="100%" height="100%" minHeight="400" 200 200 outerBorderColor="0x000000" outerBorderAlpha="1.0" outerBorderThickness="1" 201 innerBorderColors="[ 0x000000, 0x 444444, 0x888888 ]" innerBorderAlphas="[ 0.5, 0.3, 0.3 ]" innerBorderThicknesses="[ 2, 1, 1 ]"202 backgroundColor="0xffffff" backgroundAlpha="0" 203 rows="[ 24, 48,96 ]" columns="[ 1 ]"201 innerBorderColors="[ 0x000000, 0x888888 ]" innerBorderAlphas="[ 0.5, 0.3 ]" innerBorderThicknesses="[ 2, 1 ]" 202 backgroundColor="0xffffff" backgroundAlpha="0" 203 rows="[ 24, 96 ]" columns="[ 1 ]" 204 204 showEffect="{ fadeIn }" hideEffect="{ fadeOut }" 205 205 cornerRadius="0"> … … 210 210 width="100%" height="100%" minHeight="400" 211 211 outerBorderColor="0x000000" outerBorderAlpha="1.0" outerBorderThickness="1" 212 innerBorderColors="[ 0x000000, 0x 444444, 0x888888 ]" innerBorderAlphas="[ 0.5, 0.3, 0.3 ]" innerBorderThicknesses="[ 2, 1, 1 ]"213 backgroundColor="0xffffff" backgroundAlpha="0" 214 rows="[ 24, 48,96 ]" columns="[ 1 ]"212 innerBorderColors="[ 0x000000, 0x888888 ]" innerBorderAlphas="[ 0.5, 0.3 ]" innerBorderThicknesses="[ 2, 1 ]" 213 backgroundColor="0xffffff" backgroundAlpha="0" 214 rows="[ 24, 96 ]" columns="[ 1 ]" 215 215 showEffect="{ fadeIn }" hideEffect="{ fadeOut }" 216 216 cornerRadius="0"> … … 221 221 width="100%" height="100%" minHeight="400" 222 222 outerBorderColor="0x000000" outerBorderAlpha="1.0" outerBorderThickness="1" 223 innerBorderColors="[ 0x000000, 0x 444444, 0x888888 ]" innerBorderAlphas="[ 0.5, 0.3, 0.3 ]" innerBorderThicknesses="[ 2, 1, 1 ]"224 backgroundColor="0xffffff" backgroundAlpha="0" 225 rows="[ 24, 48,96 ]" columns="[ 1 ]"223 innerBorderColors="[ 0x000000, 0x888888 ]" innerBorderAlphas="[ 0.5, 0.3 ]" innerBorderThicknesses="[ 2, 1 ]" 224 backgroundColor="0xffffff" backgroundAlpha="0" 225 rows="[ 24, 96 ]" columns="[ 1 ]" 226 226 showEffect="{ fadeIn }" hideEffect="{ fadeOut }" 227 227 cornerRadius="0"> … … 301 301 calendarsList.push( { uuid:key, name:loggedUserEntity.calendarsNames[key] } ); 302 302 } 303 calendarsList.sort( sortCalendars ); 303 304 calendarsList.push( { uuid:null, name: "All" } ); 304 calendarCombo.selectedIndex = -1; 305 calendarCombo.selectedIndex = -1; 306 } 307 private function sortCalendars(a:Object, b:Object):int { 308 return ( a.name < b.name ) ? -1 : (( a.name > b.name ) ? 1 : 0 ); 305 309 } 306 310 … … 387 391 private var dayCanvas:Array = [ canvas_1, canvas_2, canvas_3, canvas_4, canvas_5, canvas_6, canvas_7 ]; 388 392 private function showDayEvents():void { 393 canvas_1.currentDay = chosenDate.selectedDate; 389 394 canvas_1.dataProvider = calendarEntity.timeFramesEntitites; 390 395 } -
ssme/trunk/flex/Calendar/src/com/kh/ssme/components/DayCanvas.as
r4037 r4040 24 24 25 25 import com.kh.ssme.entity.TimeFrameEntity; 26 import com.kh.ssme.util.DateUtil; 26 27 import com.kh.ssme.util.HashArray; 27 28 … … 38 39 } 39 40 40 // public var showHourLabels:Boolean = false; 41 // 42 // private var hourLabels:HashArray = new HashArray(); 43 // 44 // override protected function createChildren():void{ 45 // super.createChildren(); 46 // 47 // if(showHourLabels){ 48 // var score:int; 49 // var el:Label; 50 // for(var i:int=0; i<=24; i++){ 51 // el = new Label(); 52 // el.id = el.text = ((i<10)?("0"+i):(i))+":00"; 53 // 54 // if( !hourLabels.containsKey(el.id) ){ 55 // 56 // this.addChild( el ); 57 // 58 // el.setStyle("textAlign","right"); 59 // el.setStyle("color", 0x000000); 60 // el.setStyle("fontSize", 11); 61 // el.visible = el.includeInLayout = false;//((i%24) == 0); 62 // score = 0x20; 63 // if(i%24 == 0) score |= 0x01; 64 // if(i%12 == 0) score |= 0x02; 65 // if(i%6 == 0) score |= 0x04; 66 // if(i%3 == 0) score |= 0x08; 67 // if(i%2 == 0) score |= 0x10; 68 // 69 // hourLabels.put( el.id, { score:score, element:el } ); 70 // 71 // } 72 // } 73 // } 74 // 75 // } 41 public var currentDay:Date; 76 42 77 43 override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{ 78 44 79 // call first in order to get grid drawn correctly 80 super.updateDisplayList(unscaledWidth, unscaledHeight); 81 82 // do not erase old drawings! 83 //graphics.clear(); 84 85 // if(showHourLabels && hourLabels.size>0){ // added 86 // 87 // var textHeight:int = (hourLabels.getValueAt(0).element as Label).textHeight; // label text height 88 // var count:int = Math.floor( unscaledHeight / (textHeight*1.5) ); // determine number of labels 89 // var mark:int = 0x01; 90 // if(count <= 3) mark = 0x02; 91 // else if (count <= 5) mark = 0x04; 92 // else if (count <= 9) mark = 0x08; 93 // else if (count <= 12) mark = 0x10; 94 // else /*if (count <= 24)*/ mark = 0x20; 95 // 96 // var item:Object; 97 // var inBorderThicknesses:Array = getStyle_("innerBorderThicknesses", [ 1 ]); 98 // var ystep:Number = (unscaledHeight - (2*outerBorderThickness_+2*verticalMargin_) - (23*inBorderThicknesses[0])) / 24; 99 // var y:Number = outerBorderThickness_+verticalMargin_; 100 // //graphics.lineStyle(1, 0x0000ff, 0.7, true); // debug 101 // for (var row:int = 0; row <=24; row++ ){ 102 // //graphics.drawRoundRect(0, y - (textHeight*0.66), leftHorizontalMargin_, Math.min( Math.floor( ystep ), textHeight), 0, 0);// debug 103 // 104 // item = hourLabels.getValueAt(row); 105 // item.element.visible = item.element.includeInLayout = true;//(item.score & mark) > 0; 106 // item.element.x = 0; 107 // item.element.y = Math.floor( y - (textHeight*0.66) ); 108 // item.element.width = leftHorizontalMargin_; 109 // item.element.height = Math.min( Math.floor( ystep ), textHeight); 110 // 111 // y += (ystep + inBorderThicknesses[0]); 112 // } 113 // 114 // } 115 45 if(visible){ // repaint only if visible 46 // call first in order to get grid drawn correctly 47 super.updateDisplayList(unscaledWidth, unscaledHeight); 48 } 116 49 } 117 50 … … 120 53 public function set dataProvider(value:HashArray):void{ 121 54 dataProvider_ = value; 122 55 123 56 for(var i:int = 0; i<eventsMap.size; i++){ 124 this.removeChild( eventsMap.getValueAt(i) ); 57 if( eventsMap.getValueAt(i) ){ 58 this.removeChild( eventsMap.getValueAt(i) ); 59 trace( "REMOVE : "+eventsMap.getValueAt(i).data+" - ["+eventsMap.getValueAt(i).data.UUID+"] " ); 60 } 125 61 } 62 eventsMap.clear(); 63 126 64 createEvents(); 127 65 validateNow(); … … 143 81 ev = new EventField(); 144 82 eventsMap.put(json.UUID, ev); 145 //ev.setStyle("backgroundColor", 0xffff00); 83 84 ev.eventInfo = new SimpleEventDisplay(); 85 ev.data = json; 86 ev.name = json.UUID; 146 87 ev.setStyle("borderThickness", 5); 147 88 ev.setStyle("cornerRadius", 20); 148 ev.name = json.UUID; 149 150 ev.eventInfo = new SimpleEventDisplay(); 151 ev.eventInfo.eventData = json; 89 trace( "ADD : "+ev.data+" - ["+ev.data.UUID+"] " ); 152 90 153 91 addChild( ev ); 154 92 sizeEvent( ev, i ); 155 93 i += 100; 156 157 // var c:Canvas = new Canvas();158 // c.width = 100;159 // c.height = ev.height;160 // c.x = 300;161 // c.y = ev.y;162 // c.setStyle("backgroundColor", 0xff0000);163 // addChild( c );164 94 165 95 } … … 170 100 var data:TimeFrameEntity = ev.eventInfo.eventData; 171 101 if(data){ 172 var stepY:Number = (this.height - 2*outerBorderThickness_);173 stepY /= 96; // (24hours * 4quarters)102 var timeBegin:int = (data.from.getHours() * 4) + ((data.from.getMinutes() as int)/15); 103 var timeEnd:int = (data.to.getHours() * 4) + ((data.to.getMinutes() as int)/15); 174 104 175 var timeBegin:int = ((data.from.getMinutes() as int)/15); 176 var timeWidth:int = data.to.getHours() - data.from.getHours() + 1; 177 timeWidth *= 4; 178 timeWidth -= ( timeBegin + (4 -((data.to.getMinutes() as int)/15)) ); 179 180 ev.height = stepY * timeWidth; 105 // if event exceed current day 106 var from:DateUtil = (new DateUtil(data.from)).dayBegin(); 107 var current:DateUtil = (new DateUtil(currentDay)).dayBegin(); 108 var to:DateUtil = (new DateUtil(data.to)).dayBegin(); 109 110 if( current.compare(from) > 0 ){ 111 timeBegin = 0; 112 } 113 if( current.compare(to) < 0 ){ 114 timeEnd = rowsPosition[1].length - 1; 115 } 116 181 117 ev.width = 200;//XXX 118 ev.height = rowsPosition[1][timeEnd] - rowsPosition[1][timeBegin]; 182 119 ev.x = 50+i;//XXX 183 ev.y = (data.from.getHours()*4 + timeBegin)*stepY + outerBorderThickness_;120 ev.y = rowsPosition[1][timeBegin]; 184 121 ev.invalidateSize(); 185 122 ev.invalidateDisplayList(); -
ssme/trunk/flex/Calendar/src/com/kh/ssme/components/EventField.as
r4031 r4040 23 23 package com.kh.ssme.components { 24 24 25 import flash.display.DisplayObject; 25 import com.kh.ssme.entity.TimeFrameEntity; 26 27 import flash.display.DisplayObject; 26 28 27 29 import mx.binding.utils.BindingUtils; … … 51 53 ( eventInfo_ as UIComponent ).x = ( eventInfo_ as UIComponent ).y = 0; 52 54 container_.addChild( eventInfo_ as UIComponent ); 53 // var a:TextArea = new TextArea();54 // a.text = "[TEST]";55 // a.width = 100;56 // a.height = 100;57 // container_.addChild( a );58 55 } 59 56 } … … 61 58 return eventInfo_; 62 59 } 60 61 public override function set data(value:Object):void{ 62 if(eventInfo_){ 63 eventInfo_.eventData = value as TimeFrameEntity; 64 } 65 } 66 public override function get data():Object{ 67 return (eventInfo_) ? eventInfo_.eventData : null; 68 } 69 63 70 64 71 protected override function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{ -
ssme/trunk/flex/Calendar/src/com/kh/ssme/components/SimpleEventDisplay.as
r4031 r4040 49 49 this.text += eventData_.from+"-"+eventData_.to+"\n"; 50 50 this.text += eventData_.description+"\n"; 51 52 this.toolTip = this.text; 51 53 } 52 54 } -
ssme/trunk/flex/Common/src/com/kh/ssme/components/GridCanvas.as
r4037 r4040 39 39 * Number of columns 40 40 */ 41 private var columns_:Array; 41 private var columns_:Array; 42 42 public function get columns():Array{ 43 43 return columns_; … … 49 49 } 50 50 } 51 public var columnsPosition:Array; 52 51 53 52 54 /** … … 63 65 } 64 66 } 67 public var rowsPosition:Array; 65 68 66 69 … … 183 186 184 187 // inner border 185 var inBorderThickness:int; 188 var inBorderThickness:int, xTempPos:int, yTempPos:int; 189 columnsPosition = []; 190 rowsPosition = []; 186 191 for (var i:int = 0; i<inBorderThicknesses.length; i++){ 187 if (inBorderThicknesses[i] > 0)188 {192 // for each border level 193 if (inBorderThicknesses[i] > 0){ 189 194 inBorderThickness = inBorderThicknesses[i]; 190 195 graphics.lineStyle(inBorderThickness,inBorderColors[i],inBorderAlphas[i], … … 193 198 CapsStyle.NONE); 194 199 200 var tempColumnsPos:Array = [], tempRowsPos:Array = []; 195 201 if(columns_.length>=i){ 196 202 var xstep:Number = (unscaledWidth - (2*outBorderThickness+leftHorizontalMargin+rightHorizontalMargin) - (columns_[i] - 1)*inBorderThickness) / columns_[i]; 203 // left border position 197 204 var x:Number = outBorderThickness+leftHorizontalMargin; 198 for ( var col:int = 1; col < columns_[i]; col++ ) 199 { 205 xTempPos = x - inBorderThickness*0.5; 206 tempColumnsPos.push( xTempPos ); 207 // draw column lines 208 for ( var col:int = 1; col < columns_[i]; col++ ){ 200 209 x += (xstep + inBorderThickness); 201 graphics.moveTo(x - inBorderThickness*0.5, outBorderThickness + verticalMargin);// + inBorderThickness*0.5); 202 graphics.lineTo(x - inBorderThickness*0.5, unscaledHeight - outBorderThickness - verticalMargin);// - inBorderThickness*0.5); 210 xTempPos = x - inBorderThickness*0.5; 211 graphics.moveTo(xTempPos, outBorderThickness + verticalMargin); 212 graphics.lineTo(xTempPos, unscaledHeight - outBorderThickness - verticalMargin); 213 tempColumnsPos.push( xTempPos ); 203 214 } 215 // right border position 216 x += (xstep + inBorderThickness); 217 xTempPos = x - inBorderThickness*0.5; 218 tempColumnsPos.push( xTempPos ); 204 219 } 205 220 if(rows_.length>=i){ 206 221 var ystep:Number = (unscaledHeight - (2*outBorderThickness+2*verticalMargin) - (rows_[i] - 1)*inBorderThickness) / rows_[i]; 222 // top border position 207 223 var y:Number = outBorderThickness+verticalMargin; 208 for (var row:int = 1; row < rows_[i]; row++ ) 209 { 224 yTempPos = y - inBorderThickness*0.5; 225 tempRowsPos.push( yTempPos ); 226 // draw rows lines 227 for (var row:int = 1; row < rows_[i]; row++ ){ 210 228 y += (ystep + inBorderThickness); 211 graphics.moveTo(outBorderThickness + leftHorizontalMargin,// + inBorderThickness*0.5,212 y - inBorderThickness*0.5);213 graphics.lineTo(unscaledWidth - outBorderThickness - rightHorizontalMargin, // - inBorderThickness*0.5,214 y - inBorderThickness*0.5);229 yTempPos = y - inBorderThickness*0.5; 230 graphics.moveTo(outBorderThickness + leftHorizontalMargin, yTempPos); 231 graphics.lineTo(unscaledWidth - outBorderThickness - rightHorizontalMargin, yTempPos); 232 tempRowsPos.push( yTempPos ); 215 233 } 234 // bottom border position 235 y += (ystep + inBorderThickness); 236 yTempPos = y - inBorderThickness*0.5; 237 tempRowsPos.push( yTempPos ); 216 238 } 217 239 columnsPosition.push( tempColumnsPos ); 240 rowsPosition.push( tempRowsPos ); 218 241 } 219 242 } 220 243 221 222 223 244 } 224 245 -
ssme/trunk/flex/Common/src/com/kh/ssme/util/DateUtil.as
r4037 r4040 109 109 } 110 110 111 /** 112 * Returns whether this DateUtil represents a time before the time represented by the specified date param 113 * @param date 114 * @return 115 */ 116 public function before(date:Date):Boolean{ 117 return date_.time < date.time; 118 } 119 120 /** 121 * Returns whether this DateUtil represents a time after the time represented by the specified date param 122 * @param date 123 * @return 124 */ 125 public function after(date:Date):Boolean{ 126 return date_.time < date.time; 127 } 128 129 /** 130 * Compares the time values (millisecond offsets from the Epoch) represented by this DateUtil and given Date. 131 * @param date 132 * @return the value 0 if the time represented by the argument is equal to the time represented by this DateUtil; 133 * a value less than 0 if the time of this Calendar is before the time represented by the argument; 134 * and a value greater than 0 if the time of this Calendar is after the time represented by the argument. 135 */ 136 public function compare(date:DateUtil):int{ 137 return (date_.time - date.timestamp) as int; 138 } 139 140 /** 141 * String representation of this DateUtil 142 * @return 143 */ 144 public function toString():String{ 145 return "[DateUtil: "+date_.toString()+"]"; 146 } 111 147 112 148 //----------------------------------------------
