WASelectionDateTable


Seaside-Components-Widgets

Comment:



Hierarchy:

ProtoObject
Object
WAPresenter
WAComponent
WADateTable
WASelectionDateTable

Summary:

instance variables:

cellBlock dateSelectionEnd dateSelectionStart rowSelectionEnd rowSelectionStart

methods:

instance class
as yet unclassified no messages

Detail:

instance variables:

cellBlock
dateSelectionEnd
dateSelectionStart
rowSelectionEnd
rowSelectionStart

instance methods:

as yet unclassified
clearSelection

	dateSelectionStart _ dateSelectionEnd _ rowSelectionStart _ rowSelectionEnd _ nil
colorForDate: aDate rowIndex: aNumber

	^ (self hasSelection
		and: [self selectionContainsDate: aDate rowIndex: aNumber])
			ifTrue: ['lightgrey']
			ifFalse: ['white']
endDate: aDate

	self clearSelection.
	super endDate: aDate
endDateSelection

	^ dateSelectionStart ifNotNil: [dateSelectionStart max: dateSelectionEnd]
endRow

	^ rowSelectionStart max: rowSelectionEnd
endRowSelection

	^ rowSelectionStart ifNotNil: [rows at: (rowSelectionStart max: rowSelectionEnd)]
hasSelection

	^ dateSelectionStart notNil
renderCellForDate: aDate row: anObject index: aNumber on: html

	|text|
	html attributeAt: 'bgcolor' put: (self colorForDate: aDate rowIndex: aNumber).
	html attributeAt: 'align' put: 'center'.
	html tableData: [
		text _ cellBlock value: anObject value: aDate.
		html anchorWithAction: [self selectDate: aDate rowIndex: aNumber] text: text.
	]
rows: aCollection

	self clearSelection.
	super rows: aCollection
rowsAndDatesDisplay: aBlock

	cellBlock _ aBlock
selectAll

	dateSelectionStart _ startDate.
	dateSelectionEnd _ endDate.
	rowSelectionStart _ 1.
	rowSelectionEnd _ rows size.
selectDate: aDate rowIndex: rowIndex

	self hasSelection
		ifFalse: [dateSelectionStart _ dateSelectionEnd _ aDate. rowSelectionStart _ rowSelectionEnd _ rowIndex]
		ifTrue: [dateSelectionEnd _ aDate. rowSelectionEnd _ rowIndex]
selectedRows

	^ rows copyFrom: self startRow to: self endRow
selectionContainsDate: aDate rowIndex: aNumber

	^ ((aDate between: dateSelectionStart and: dateSelectionEnd) or: [aDate between: dateSelectionEnd and: dateSelectionStart])
		and: [(aNumber between: rowSelectionStart and: rowSelectionEnd) or: [aNumber between: rowSelectionEnd and: rowSelectionStart]]
startDate: aDate

	self clearSelection.
	super startDate: aDate
startDateSelection

	^ dateSelectionStart ifNotNil: [dateSelectionStart min: dateSelectionEnd]
startRow

	^ rowSelectionStart min: rowSelectionEnd
startRowSelection

	^ rowSelectionStart ifNotNil: [rows at: (rowSelectionStart min: rowSelectionEnd)]
style

	^ 'td a {text-decoration: none}'

class methods:

^top


- made by Dandelion -