WADateTable


Seaside-Components-Widgets

Comment:



Hierarchy:

ProtoObject
Object
WAPresenter
WAComponent
WADateTable

Summary:

instance variables:

datesCache endDate rows startDate

methods:

instance class
as yet unclassified no messages

Detail:

instance variables:

datesCache
endDate
rows
startDate

instance methods:

as yet unclassified
datesDo: aBlock separatedBy: monthlyBlock

	| month|
	month _ datesCache first monthIndex.
	datesCache do:
		[:date |
		date monthIndex = month ifFalse: [month _ date monthIndex. monthlyBlock value].
		aBlock value: date].
	monthlyBlock value.
endDate: aDate

	endDate _ aDate.
	self updateDatesCache.
monthsAndLengthsDo: aBlock

	|count last|
	count _ 0.
	self
		datesDo: [:ea | count _ count + 1. last _ ea]
		separatedBy: [aBlock value: last month value: count.
						count _ 0]
renderCellForDate: aDate row: anObject index: aNumber on: html

	html tableData: [html space]
renderContentOn: html

	html attributes border: 1.
	html cssClass: 'DateTable'; table: [
		html tableRow: [self renderMonthHeadingsOn: html].
		html tableRow: [self renderDayHeadingsOn: html].
		rows withIndexDo:
			[:ea :i|
			html tableRow: [self renderRow: ea index: i on: html]].
	]
renderDayHeadingsOn: html

	self renderHeadingSpacerOn: html.
	self
		datesDo: [:date | html cssClass: 'DayHeading'; tableHeading: [html text: date dayOfMonth]]
		separatedBy: [self renderHeadingSpacerOn: html]
renderHeadingForRow: anObject on: html

	html cssClass: 'RowHeading'; tableHeading: [html text: anObject]
renderHeadingSpacerOn: html

	html tableData: []
renderMonthHeadingsOn: html

	self monthsAndLengthsDo:
		[:month :length |
		self renderHeadingSpacerOn: html.
		html
			cssClass: 'MonthHeading';
			attributeAt: 'colspan' put: length;
			tableHeading: [html text: month name; space; text: month year]]
renderRow: anObject index: aNumber on: html

	self renderHeadingForRow: anObject on: html.
	self
		datesDo: [:date | self renderCellForDate: date row: anObject index: aNumber on: html]	
		separatedBy: [	self renderHeadingSpacerOn: html ]
rows: aCollection

	rows _ aCollection
startDate: aDate

	startDate _ aDate.
	self updateDatesCache.
updateDatesCache

	| date |
	(startDate isNil or: [endDate isNil]) ifTrue: [^ self].
	
	datesCache _ OrderedCollection new.
	date _ startDate.
	[date > endDate] whileFalse:
		[datesCache add: date.
		date _ date next]

class methods:

^top


- made by Dandelion -