WATableReport


Seaside-Components-Widgets

Comment:



Hierarchy:

ProtoObject
Object
WAPresenter
WAComponent
WAReport
WATableReport
  • EnhancedTableReport
  • SCTableReport

Summary:

instance variables:

columns isReversed rowColors rowPeriod sortColumn

methods:

instance class
accessing as yet unclassified rendering state variables no messages

Detail:

instance variables:

columns
isReversed
rowColors
rowPeriod
sortColumn

instance methods:

accessing
columns: anArray

	columns _ anArray
initialize

	super initialize.
	isReversed := false.
	columns := #().
	sortColumn := WAStateHolder new.
	rowColors := #('white' 'lightyellow').
	rowPeriod := 3
rowColors: colorArray

	rowColors _ colorArray
rowPeriod: aNumber

	rowPeriod _ aNumber

as yet unclassified
chooseRow: aRow column: aColumn
	
	aColumn chooseRow: aRow
colorForRowNumber: aNumber

	^ rowColors at: ((aNumber-1 // rowPeriod) \\ rowColors size) + 1 ifAbsent: ['white']
isReversed

	^ isReversed
rows

	| r |
	self sortColumn ifNil: [^ rows].
	r _ self sortColumn sortRows: rows.
	^ self isReversed ifTrue: [r reversed] ifFalse: [r]

rendering
renderColumn: aColumn row: aRow on: html

	|text|
	text _ aColumn textForRow: aRow.
	text isEmpty ifTrue: [text _ ' '].
	html tableData: [
		aColumn canChoose
			ifFalse: [html text: text]
			ifTrue: [html anchorWithAction: [self chooseRow: aRow column: aColumn] text: text]
	]
renderContentOn: html

	html attributeAt: 'cellspacing' put: 0; attributeAt: 'cellpadding' put: 5.
	html table: [
		self renderTableHeaderOn: html.
		self renderRowsOn: html.
		self renderTableFooterOn: html.
	]
renderFooterForColumn: aColumn on: html

	html tableHeading: [ html text: (aColumn totalForRows: rows)]
renderHeaderForColumn: aColumn on: html

	html tableHeading: [
		aColumn canSort
			ifTrue: [
				html anchorWithAction: [self sortColumn: aColumn] text: aColumn title]
			ifFalse: [
				html text: aColumn title]
	]
renderRowNumber: index item: row on: html

	html attributeAt: 'bgcolor' put: (self colorForRowNumber: index).
	html tableRow: [ columns do: [:ea | self renderColumn: ea row: row on: html] ]
renderRowsOn: html

	self rows withIndexDo: [:row :i | self renderRowNumber: i item: row on: html ]
renderTableFooterOn: html

	html tableRow: [ columns do: [ :ea | self renderFooterForColumn: ea on: html] ]
renderTableHeaderOn: html

	html tableRow: [ columns do: [ :ea | self renderHeaderForColumn: ea on: html] ]

state variables
sortColumn

	^ sortColumn contents
sortColumn: anObject
 
	anObject = self sortColumn
		ifTrue: [isReversed _ isReversed not]
		ifFalse: [isReversed _ false].
	sortColumn contents: anObject

class methods:

^top


- made by Dandelion -