'From Squeak3.6 of ''6 October 2003'' [latest update: #5429] on 4 September 2004 at 2:37:30 pm'! WAComponent subclass: #SelectorWithCalendar instanceVariableNames: 'selector calendar showCalendar ' classVariableNames: '' poolDictionaries: '' category: 'WADateExamples'! !SelectorWithCalendar methodsFor: 'actions' stamp: 'cds 8/30/2004 20:06'! dateSelectedInCal: date selector date: date. self hideCalendar! ! !SelectorWithCalendar methodsFor: 'initialization' stamp: 'cds 9/4/2004 14:23'! initialize super initialize. selector _ WADateSelector new. showCalendar _ false. self setupCalendar! ! !SelectorWithCalendar methodsFor: 'initialization' stamp: 'cds 8/30/2004 20:05'! setupCalendar calendar _ WAMiniCalendar new. calendar canSelectBlock: [:date | true]. calendar selectBlock: [:date | self dateSelectedInCal: date]! ! !SelectorWithCalendar methodsFor: 'accessing' stamp: 'cds 8/30/2004 19:56'! hideCalendar showCalendar _ false! ! !SelectorWithCalendar methodsFor: 'accessing' stamp: 'cds 8/30/2004 19:56'! shouldShowCalendar ^showCalendar ifNil: [false]! ! !SelectorWithCalendar methodsFor: 'accessing' stamp: 'cds 8/30/2004 19:56'! showCalendar showCalendar _ true! ! !SelectorWithCalendar methodsFor: 'accessing' stamp: 'cds 9/4/2004 14:22'! toggleCalendar showCalendar _ showCalendar not! ! !SelectorWithCalendar methodsFor: 'rendering' stamp: 'cds 8/30/2004 19:58'! renderCalendarOn: html selector dateIsValid ifTrue: [calendar date: selector date]. html render: calendar! ! !SelectorWithCalendar methodsFor: 'rendering' stamp: 'cds 9/4/2004 14:24'! renderContentOn: html html cssClass: 'outerBox'. html div: [html cssClass: 'selectorWithCal'. html span: [html render: selector. self renderPopupButtonOn: html. self shouldShowCalendar ifTrue: [self renderCalendarOn: html]]]! ! !SelectorWithCalendar methodsFor: 'rendering' stamp: 'cds 9/4/2004 14:30'! renderPopupButtonOn: html html submitButtonWithAction: [self toggleCalendar] text: (self shouldShowCalendar ifTrue: ['^'] ifFalse: ['...'])! ! !SelectorWithCalendar methodsFor: 'rendering' stamp: 'cds 9/4/2004 14:05'! style ^ '*.selectorWithCal { background-color: tan; content-width: auto; float: left; } *.calendarCaption { font-weight: bold; } *.calendarTitle { font-weight: bold; } *.calendar td { background-color: tan; text-align: right; }'! ! !SelectorWithCalendar methodsFor: 'tree' stamp: 'cds 8/30/2004 20:01'! children ^self shouldShowCalendar ifTrue: [Array with: selector with: calendar] ifFalse: [Array with: selector]! !