New TableView merged

54 views
Skip to first unread message

Francisco Tolmasky

unread,
Aug 22, 2009, 5:00:02 AM8/22/09
to Cappuccino & Objective-J
I just pushed the merge of the tableview branch. Before I continue, I
want to make it clear that you can still continue using the old
tableview implementation which have been moved to OLDCPTableView.j and
OLDCPTableColumn.j. We won't completely remove them until we ship the
next update to Cappuccino, which will theoretically have a very mature
tableview.

Secondly, I would like to personally thank Randy (RCLConcepts) for
doing a lot of the work on tableview. He has been working non stop and
has implemented a bunch of tableview's features.

Ok, so that being said, this is a rough breakdown of the working
features in tableview (that aren't present in the old tableview):

1. table headers
2. alternating row colors (arbitrary amount, not just limited to two)
3. row selection and column selection
4. many of the delegate methods
5. beginnings of nib2cib support

There are still a number of bugs, this is by no means a "complete"
tableview. We are using drawRect: for a lot of the tableview
operations, so we have a lot of redrawing issues (particularly with
redrawing, due to the way we handle drawing incredibly large tables
with hundred of thousands of items). We will be working hard to
getting this even closer to usability.

This branch also includes a bunch of other fixes, which is one of the
reasons we wanted to merge it in. A lot of the scroll view bugs people
were experiencing, such as disabled looking horizontal scrollers, have
been fixed. Nib2cib has been improved substantially as well, namely,
the non-deterministic bug of views "moving" when converted to cibs
should be fixed.

We've also added a bunch of new tests, some of which begin to test
interface elements. I'd really like to move the tests to <a href=
"http://github.com/Shadowfiend/ojspec/tree/master">ojspec</a>, so if
anyone is feeling ambitious and likes testing, this is an area that
we'd love help on.

Thanks!

Francisco

Luke

unread,
Aug 22, 2009, 11:58:51 AM8/22/09
to Cappuccino & Objective-J
Excellent - and many thanks to all concerned.
This has come at the perfect time for me :-)

Oh, and thanks for the note about the moving views. I was wondering
about that recently, but it was obviously a bug - and one that didn't
seem too difficult to reproduce, so likely to be fixed.

OK, now it's time to get hoisted onto the trunk... fingers crossed...

Timothy Perrett

unread,
Aug 22, 2009, 12:00:58 PM8/22/09
to Cappuccino & Objective-J
Awesome stuff Francisco...

Out of interest, does this rewrite of CPTableView go anyway nearer to
making CPOutlineView a more feasible possibility?

Cheers, Tim

On Aug 22, 10:00 am, Francisco Tolmasky <franci...@280north.com>
wrote:

Jérôme Denanot

unread,
Aug 23, 2009, 6:38:40 AM8/23/09
to objec...@googlegroups.com
Thanks, will make a try to check if headers now display.

Also important, I didn's see call of delegate's sortDescriptorDidChange message in the new table view (still commented text). Seems we would only have to intercept click on a header view and send this message (updating the datasource has to be made by the delegate, and then it just has to call reload).

2009/8/22 Francisco Tolmasky <fran...@280north.com>

RCLConcepts

unread,
Aug 23, 2009, 12:40:27 PM8/23/09
to Cappuccino & Objective-J
First off, thanks you very much Francisco for merging all this. Like
you said It’s not complete so I’ll continue working on it, at least
until it’s completed enough for my own project.

The outline view is a subclass of the tableview so I would so it
shouldn’t be too difficult to add eventually. Timothy, if you’re
feeling ambitious you can start it and I’m sure you’ll be able to find
some help out there. ;)





A few things lacking in this Tableview is table sorting, selection
gradient for source list style selection, and styling for selected row
cells (the text should be white by default when a row is selected, and
bold if it’s a sourcelist). I’d also like to add theming to the
tableview. This would give it an aristo theme by default with the
ability to change it without having to mess inside the class files;
however, that’s not really a priority for me.

I might end up adding editing for cells simply because it doesn’t look
that hard to implement (though I could be wrong).

If there are any other pressing features people need right now — you
can throw them out there, but no promises that I’ll work on them.

-Randy

cacaodev

unread,
Aug 23, 2009, 1:12:12 PM8/23/09
to objec...@googlegroups.com

Le 23 août 2009 à 18:40, RCLConcepts a écrit :
>
> If there are any other pressing features people need right now — you
> can throw them out there, but no promises that I’ll work on them.
>
> -Randy

It would be great to have a selected state for table view data views,
like UITableViewCell. I know currently data views are not a particular
type, just views (and CPtextField when no data view is provided). So
we could either have :
- a CPTableViewCell (CPview subclass, not a real cell) with a
setSelected: method and a default impl turning text color to white,
- OR implement -setSelected directly in CPView, maybe with a protocol
that you could choose to conform to or not.

What's cool in iphone is that you just set selectedtextColor,
selectedBackgroundView and selectedImage on creation and you don't
have to do anything else in the delegate.
Just a suggestion, tell me what you think about it.

Jérôme Denanot

unread,
Aug 24, 2009, 6:16:59 PM8/24/09
to objec...@googlegroups.com
Hi,

It seems CPTableColumn still holds a headerView. However CPTableView holds a CPTableHeaderView (for the whole columns). Then how to construct the tableview header view (I suppose we have to use setHeaderView on the tableView, passing it a new CPTableHeaderView - however drawRect doesn't seems to display the columns names) ?

I wonder if we can add mouseDown in CPTableHeaderView, and then use columnAtPoint (passing the point corresponding to the mouseDown event), and then calls performSelector:@SEL(sortDescriptorDidChange:) on [[self tableView] delegate/datasource], withObject:oldDescriptor withObject:newDescriptor (newDescriptor being constructed from the computed column - I personnaly use the column identifier as the sorting key/property path).

Thanks

2009/8/22 Francisco Tolmasky <fran...@280north.com>

Ross Boucher

unread,
Aug 24, 2009, 6:44:17 PM8/24/09
to objec...@googlegroups.com
CPTableHeaderView draws all the individual header views on the individual CPTableColumns in the right place. CPScrollView actually draws the CPTableHeaderView.

Jérôme Denanot

unread,
Aug 25, 2009, 12:41:39 PM8/25/09
to objec...@googlegroups.com
Thanks Ross,

In CPScrollView I found a _headerView variable in class declaration, however I didn't find where it is set.
In CPTableView's initWithFrame a CPTableHeaderView is created.

2009/8/25 Ross Boucher <rbou...@gmail.com>

Ross Boucher

unread,
Aug 25, 2009, 12:56:00 PM8/25/09
to objec...@googlegroups.com
It never gets set. The scroll view dynamically queries it's document view for a header when the header is needed.

Jérôme Denanot

unread,
Aug 25, 2009, 2:53:28 PM8/25/09
to objec...@googlegroups.com
Thank Ross !

2009/8/25 Ross Boucher <rbou...@gmail.com>

Jérôme Denanot

unread,
Aug 27, 2009, 5:55:42 PM8/27/09
to objec...@googlegroups.com
Hi,

I finally updated from the main branch and had to make some changes to CP2JavaWS to make it work with the new CPTableView : the selectionDidChange delegate method isn't called anymore and so I now use selectionIsChanging (available in both tableView implementations). I also use load method (if new tableView used) to refresh the exposed rows after a row update (the _objectValues array structure changed from the previous _objectValueCache - and now only stores the exposed rows).

All is working ok (still have to check if faster on Firefox), however I still have a strange rendering of the header (no gradient and a colored square on the corner) :

Is that expected (if not I will try to fix it before releasing the update) ?

Thanks,
Jerome



2009/8/25 Jérôme Denanot <jden...@gmail.com>

Ross Boucher

unread,
Aug 27, 2009, 6:17:38 PM8/27/09
to objec...@googlegroups.com
Yeah there is still no UI for table view headers or corners. Feedback welcome.

RCLConcepts

unread,
Aug 27, 2009, 11:59:12 PM8/27/09
to Cappuccino & Objective-J
So, what I did for the table cornerview.

[[expensesTable cornerView] setBackgroundColor:[CPColor aColor]];

You can do the same for the headerview, by replacing “cornerView” with
“headerView”

I basically just used the Aristo button style from the psd and used
those, but I didn’t apply any of that to my tableview commits because
I wasn’t sure how all that would be handled in the future.

On Aug 27, 6:17 pm, Ross Boucher <rbouc...@gmail.com> wrote:
> Yeah there is still no UI for table view headers or corners. Feedback  
> welcome.
>
> On Aug 27, 2009, at 2:55 PM, Jérôme Denanot wrote:
>
>
>
> > Hi,
>
> > I finally updated from the main branch and had to make some changes  
> > to CP2JavaWS to make it work with the new CPTableView : the  
> > selectionDidChange delegate method isn't called anymore and so I now  
> > use selectionIsChanging (available in both tableView  
> > implementations). I also use load method (if new tableView used) to  
> > refresh the exposed rows after a row update (the _objectValues array  
> > structure changed from the previous _objectValueCache - and now only  
> > stores the exposed rows).
>
> > All is working ok (still have to check if faster on Firefox),  
> > however I still have a strange rendering of the header (no gradient  
> > and a colored square on the corner) :
> >http://jdenanot.free.fr/cappuccino/newTableview.gif
>
> > Is that expected (if not I will try to fix it before releasing the  
> > update) ?
>
> > Thanks,
> > Jerome
>
> > 2009/8/25 Jérôme Denanot <jdena...@gmail.com>
> > Thank Ross !
>
> > 2009/8/25 Ross Boucher <rbouc...@gmail.com>
> > It never gets set. The scroll view dynamically queries it's document  
> > view for a header when the header is needed.
>
> > On Aug 25, 2009, at 9:41 AM, Jérôme Denanot wrote:
>
> >> Thanks Ross,
>
> >> In CPScrollView I found a _headerView variable in class  
> >> declaration, however I didn't find where it is set.
> >> In CPTableView's initWithFrame a CPTableHeaderView is created.
>
> >> 2009/8/25 Ross Boucher <rbouc...@gmail.com>
> >> CPTableHeaderView draws all the individual header views on the  
> >> individual CPTableColumns in the right place. CPScrollView actually  
> >> draws the CPTableHeaderView.
>
> >> On Aug 24, 2009, at 3:16 PM, Jérôme Denanot wrote:
>
> >>> Hi,
>
> >>> It seems CPTableColumn still holds a headerView. However  
> >>> CPTableView holds a CPTableHeaderView (for the whole columns).  
> >>> Then how to construct the tableview header view (I suppose we have  
> >>> to use setHeaderView on the tableView, passing it a new  
> >>> CPTableHeaderView - however drawRect doesn't seems to display the  
> >>> columns names) ?
>
> >>> I wonder if we can add mouseDown in CPTableHeaderView, and then  
> >>> use columnAtPoint (passing the point corresponding to the  
> >>> mouseDown event), and then calls  
> >>> performSelector:@SEL(sortDescriptorDidChange:) on [[self  
> >>> tableView] delegate/datasource], withObject:oldDescriptor  
> >>> withObject:newDescriptor (newDescriptor being constructed from the  
> >>> computed column - I personnaly use the column identifier as the  
> >>> sorting key/property path).
>
> >>> Thanks
>
> >>> 2009/8/22 Francisco Tolmasky <franci...@280north.com>

Jérôme Denanot

unread,
Aug 28, 2009, 8:40:54 AM8/28/09
to objec...@googlegroups.com
Thanks a lot Ross and Randy !

In fact I had discovered the cornerView in the source (and wondered what is was intented to) before I did my test, but I forgot about it just thereafter :-)

I wilk use you trick for now. I wonder if we could use a CGGradient for headers (and probably for buttons), to reduce the number of images (and loadtime). And CSS gradient would be even better !

2009/8/28 RCLConcepts <rclco...@gmail.com>

Jérôme Denanot

unread,
Aug 28, 2009, 8:52:10 AM8/28/09
to objec...@googlegroups.com
Sorry about gradient, we always discussed this just two weeks ago :


2009/8/28 Jérôme Denanot <jden...@gmail.com>

Jérôme Denanot

unread,
Aug 28, 2009, 10:04:29 AM8/28/09
to objec...@googlegroups.com
I finally used a background image (as Randy said) from Aristo buttons :

var headerColor = [CPColor colorWithPatternImage:[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:[CPTableView class]] pathForResource:@"Aristo.blend/Resources/button-bezel-center.png"]]]
  
[[masterTableView cornerView] setBackgroundColor:headerColor];
[[masterTableView headerView] setBackgroundColor:headerColor];


It looks ok :

http://jdenanot.free.fr/cappuccino/newTableView_imageHeader.png


2009/8/28 Jérôme Denanot <jden...@gmail.com>

RCLConcepts

unread,
Aug 28, 2009, 12:31:54 PM8/28/09
to Cappuccino & Objective-J
Sorry, I should have been more specific.

The aristo psd uses layer styles for just about everything, so I
copied those layer styles into a block the size of the header and got
something like so:
http://www.rclconcepts.com/temp/tableheaderexample.png

On Aug 28, 10:04 am, Jérôme Denanot <jdena...@gmail.com> wrote:
> I finally used a background image (as Randy said) from Aristo buttons :
>
> var headerColor = [CPColor colorWithPatternImage:[[CPImage alloc]
> initWithContentsOfFile:[[CPBundle bundleForClass:[CPTableView class]]
> pathForResource:@"Aristo.blend/Resources/button-bezel-center.png"]]]
>
> [[masterTableView cornerView] setBackgroundColor:headerColor];
> [[masterTableView headerView] setBackgroundColor:headerColor];
>
> It looks ok :
>
> http://jdenanot.free.fr/cappuccino/newTableView_imageHeader.png
>
> 2009/8/28 Jérôme Denanot <jdena...@gmail.com>
>
>
>
> > Sorry about gradient, we always discussed this just two weeks ago :
> >http://mail.google.com/mail/?shva=1#search/gradient/1231bc55f2323645
>
> > 2009/8/28 Jérôme Denanot <jdena...@gmail.com>
>
> > Thanks a lot Ross and Randy !
> >> In fact I had discovered the cornerView in the source (and wondered what
> >> is was intented to) before I did my test, but I forgot about it just
> >> thereafter :-)
>
> >> I wilk use you trick for now. I wonder if we could use a CGGradient for
> >> headers (and probably for buttons), to reduce the number of images (and
> >> loadtime). And CSS gradient would be even better !
>
> >> 2009/8/28 RCLConcepts <rclconce...@gmail.com>

Jérôme Denanot

unread,
Aug 28, 2009, 3:13:47 PM8/28/09
to objec...@googlegroups.com
Oups, missed that. I like the embossed style of the header text, will make a try for the next version !
The background looks similar finally.

Thank you,

2009/8/28 RCLConcepts <rclco...@gmail.com>

Ross Boucher

unread,
Aug 28, 2009, 4:22:04 PM8/28/09
to objec...@googlegroups.com
You should put all of these enhancements into the actual header view and make that a themeable component.

Jérôme Denanot

unread,
Aug 28, 2009, 5:19:16 PM8/28/09
to objec...@googlegroups.com
Thanks Ross, we could merge both ideas into the old tableview branch before (background setting in headerView init, and sort selection management).

However there is still a pb : it seems the image background is used for the whole header view (that is accross all the columns headers, not for each), then we couldn't use alternate images when sort order changes (requires to have a separate background image for each column header).

2009/8/28 Ross Boucher <rbou...@gmail.com>

RCLConcepts

unread,
Aug 28, 2009, 7:41:07 PM8/28/09
to Cappuccino & Objective-J
The reason the image takes up the whole header was for simplicity
sake. Otherwise I would have been doing that for each the columns
individually. Ideally it would make sense to set it to the column
header. The concept is the same as what you’re doing to add the text
to the header, you’re just going to be calling setBackgroundColor:
instead.

I agree, all of this should be themeable.

A list of things that should be themeable:
header image,
header selection image (implementation for sorting needed),
selection color,
selection source list color,
selected row style (change cell text color to white and bold it),
alternating row colors,
grid color

I’ll add this when I get a chance (if no one beats me to it). This
last week has been extremely busy for me and next week probably wont
be any better.

On Aug 28, 5:19 pm, Jérôme Denanot <jdena...@gmail.com> wrote:
> Thanks Ross, we could merge both ideas into the old tableview branch before
> (background setting in headerView init, and sort selection management).
> However there is still a pb : it seems the image background is used for the
> whole header view (that is accross all the columns headers, not for each),
> then we couldn't use alternate images when sort order changes (requires to
> have a separate background image for each column header).
>
> 2009/8/28 Ross Boucher <rbouc...@gmail.com>
>
>
>
> > You should put all of these enhancements into the actual header view and
> > make that a themeable component.
>
> > On Aug 28, 2009, at 12:13 PM, Jérôme Denanot wrote:
>
> > Oups, missed that. I like the embossed style of the header text, will make
> > a try for the next version !The background looks similar finally.
>
> > Thank you,
>
> > 2009/8/28 RCLConcepts <rclconce...@gmail.com>

Jérôme Denanot

unread,
Aug 29, 2009, 12:04:25 PM8/29/09
to objec...@googlegroups.com
Thanks Randy, it will be important work. Perhaps an interaction diagram (with roles of each objects : table view, table column, tableHeaderView, table delegate, etc.) could be useful to undersand the current implementation (and planned updates), and decide how to complete it (headers and sorting), as it goes beyond just applying the Cocoa datasource/delegate patterns.

It seems the added (new) CPTableHeaderView acts as a controller between the views (tableColumns) and the model (tableView delegate). That is what I understood, and then I added here (CPTableHeaderHeader)  the sending of sortDescriptorsDidChange messages.

2009/8/29 RCLConcepts <rclco...@gmail.com>

Jérôme Denanot

unread,
Aug 29, 2009, 12:05:24 PM8/29/09
to objec...@googlegroups.com
I meant CPTableHeaderView.

2009/8/29 Jérôme Denanot <jden...@gmail.com>

Luke

unread,
Aug 31, 2009, 2:06:40 AM8/31/09
to Cappuccino & Objective-J
Oooh, I could really benefit from cell editing right now :-)

Will you be checking further changes (whatever/whenever they are) to
Table View incrementally into the head now, or are you developing in a
separate branch?

BTW, my Table View is coming up with a grey background, which I don't
seem to be able to make disappear with changes in the source nib...
but perhaps not all the attributes are properly handled in conversion
at this point (... I can just do this programmatically in an -
awakeFromCib for the time being).

RCLConcepts

unread,
Aug 31, 2009, 12:30:52 PM8/31/09
to Cappuccino & Objective-J
My updates will be pushed to my own fork in the master branch.
(username is Me1000 on github)
I haven’t used nib2cib at all.

Don’t put a lot of faith in many updates in the near future though.
I’ve been swamped with school and until I get a chance to get all my
time managed accordingly — both TimeTable and Cappuccino development
are a hiatus. Hopefully in a week or so I’ll have everything in order
and life will slow down.

-Randy
Reply all
Reply to author
Forward
0 new messages