[Seaside] AddressBook demo
Lukas Renggli
seaside@lists.squeakfoundation.org
Fri, 2 Aug 2002 17:06:32 +0200
This is a multi-part message in MIME format.
------=_NextPart_000_000F_01C23A46.F33D2E70
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
> I am just writing a component that is able to generate sortable
> tables.
Here is the component IASort, that is able to generate sortable tables.
Unfortunately it is not very customizable at the moment, but it works quite
well. A cache could be easily added to improve performance.
Have a look at the demo IASortDemo to see how it works.
Cheers
Lukas
------=_NextPart_000_000F_01C23A46.F33D2E70
Content-Type: application/octet-stream;
name="SortTable.1.cs"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="SortTable.1.cs"
'From Squeak 3.2 of 11 July 2002 [latest update: #4917] on 2 August 2002 =
at 5:04:22 pm'!=0D"Change Set: SortTable=0DDate: 2 August =
2002=0DAuthor: Lukas Renggli=0D=0DThe component IASort is able to =
generate sortable tables. Unfortunately it is not very customizable at =
the moment, but it works quite well. Also a cache could be added =
easily.=0D=0DEvaluate the expression below to install it in the Seaside =
applications list:=0D=0D IASortTest initialize"!=0D=0DIAComponent =
subclass: #IASort=0D instanceVariableNames: 'list columns sort reverse =
'=0D classVariableNames: ''=0D poolDictionaries: ''=0D category: =
'Seaside-Components'!=0DIAComponent subclass: #IASortTest=0D =
instanceVariableNames: ''=0D classVariableNames: ''=0D poolDictionaries: =
''=0D category: 'Seaside-Examples'!=0D=0D!IASort methodsFor: 'actions' =
stamp: 'LR 8/2/2002 16:29'!=0DsortBy: aString=0D | newsort |=0D newsort =
_ (columns detect: [ :column | column =3D aString ]) value.=0D (sort =3D =
newsort)=0D ifTrue: [ reverse _ reverse not ]=0D ifFalse: [ sort _ =
newsort. reverse _ false ]! !=0D=0D!IASort methodsFor: 'accessing' =
stamp: 'LR 8/2/2002 15:06'!=0Dcolumns=0D ^ columns! !=0D=0D!IASort =
methodsFor: 'accessing' stamp: 'LR 8/2/2002 15:06'!=0Dcolumns: =
aCollection=0D columns _ aCollection! !=0D=0D!IASort methodsFor: =
'accessing' stamp: 'LR 8/2/2002 15:37'!=0Dlist=0D ^ list! !=0D=0D!IASort =
methodsFor: 'accessing' stamp: 'LR 8/2/2002 15:37'!=0Dlist: =
aCollection=0D list _ aCollection=0D ! !=0D=0D!IASort methodsFor: =
'accessing' stamp: 'LR 8/2/2002 15:39'!=0Dreverse=0D ^ reverse! =
!=0D=0D!IASort methodsFor: 'accessing' stamp: 'LR 8/2/2002 =
15:39'!=0Dreverse: aBoolean=0D reverse _ aBoolean! !=0D=0D!IASort =
methodsFor: 'accessing' stamp: 'LR 8/2/2002 15:39'!=0Dsort=0D ^ sort! =
!=0D=0D!IASort methodsFor: 'accessing' stamp: 'LR 8/2/2002 =
15:39'!=0Dsort: aSymbol=0D sort _ aSymbol! !=0D=0D!IASort methodsFor: =
'initialize-release' stamp: 'LR 8/2/2002 15:35'!=0Dinitialize=0D list _ =
columns _ #().=0D reverse _ false.=0D sort _ nil=0D! !=0D=0D!IASort =
methodsFor: 'templates' stamp: 'LR 8/2/2002 17:00'!=0Dhtml=0D ^ =
=0D#(table border: 0=0D (tr=0D (th align: 'left' sea:id: =
'column/columns'=0D (a sea:id: '@sortBy:' '[column.key]')=0D (span =
sea:id: 'isSortedColumn=3Dtrue'=0D (span sea:id: 'reverse=3Dfalse' ' =
v')=0D (span sea:id: 'reverse=3Dtrue' ' ^'))))=0D (tr sea:id: =
'item/sortedlist'=0D (td sea:id: 'column/columns' '[value]')))! =
!=0D=0D!IASort methodsFor: 'private' stamp: 'LR 8/2/2002 =
16:46'!=0DisSortedColumn=0D | column |=0D column _ self valueForKey: =
'column'.=0D ^ sort =3D column value! !=0D=0D!IASort methodsFor: =
'private' stamp: 'LR 8/2/2002 16:03'!=0Dsortedlist=0D sort =0D ifNil: [ =
^ list ]=0D ifNotNil: [ ^ list asSortedCollection: [ :x :y | =0D =
reverse xor: ((x perform: sort) <=3D (y perform: sort)) ] ]! =
!=0D=0D!IASort methodsFor: 'private' stamp: 'LR 8/2/2002 =
16:04'!=0Dvalue=0D | item column |=0D item _ self valueForKey: =
'item'.=0D column _ self valueForKey: 'column'.=0D ^ item perform: =
column value! !=0D=0D=0D!IASortTest methodsFor: 'templates' stamp: 'LR =
8/2/2002 15:33'!=0DaddHandlers=0D (template elementNamed: =
'sortedtable')=0D onDisplay: [ :l | l list: self list; columns: self =
columns ]! !=0D=0D!IASortTest methodsFor: 'templates' stamp: 'LR =
8/2/2002 15:23'!=0Dhtml=0D ^ #(iasort sea:id: sortedtable)=0D! =
!=0D=0D!IASortTest methodsFor: 'accessing' stamp: 'LR 8/2/2002 =
16:29'!=0Dcolumns=0D ^ OrderedCollection new=0D add: 'Class Name' -> =
#name;=0D add: 'Category' -> #category;=0D add: 'Instance Variables' =
-> #instanceVariablesString;=0D add: 'Lines of Code' -> =
#linesOfCode;=0D add: 'Space Used' -> #spaceUsed;=0D yourself! =
!=0D=0D!IASortTest methodsFor: 'accessing' stamp: 'LR 8/2/2002 =
16:51'!=0Dlist=0D ^ IAComponent allSubclasses! !=0D=0D=0D!IASortTest =
class methodsFor: 'class initialization' stamp: 'LR 8/2/2002 =
10:47'!=0Dinitialize=0D (IAApplication named: 'sort')=0D mainClass: =
self! !=0D=0DIASortTest initialize!=0D
------=_NextPart_000_000F_01C23A46.F33D2E70--