Started to render column groups. Added a sample data set with CVTs.
git-svn-id: http://google-refine.googlecode.com/svn/trunk@42 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
f8e15798e2
commit
93f0dfd63a
@ -15,15 +15,17 @@ import com.metaweb.gridworks.Jsonizable;
|
||||
public class ColumnGroup implements Serializable, Jsonizable {
|
||||
private static final long serialVersionUID = 2161780779920066118L;
|
||||
|
||||
final public int[] cellIndices; // must be in order from smallest to largest
|
||||
final public int keyCellIndex; // could be -1 if there is no key cell
|
||||
final public int startColumnIndex;
|
||||
final public int columnSpan;
|
||||
final public int keyColumnIndex; // could be -1 if there is no key cell
|
||||
|
||||
transient public ColumnGroup parentGroup;
|
||||
transient public List<ColumnGroup> subgroups;
|
||||
|
||||
public ColumnGroup(int[] cellIndices, int keyCellIndex) {
|
||||
this.cellIndices = cellIndices;
|
||||
this.keyCellIndex = keyCellIndex;
|
||||
public ColumnGroup(int startColumnIndex, int columnSpan, int keyColumnIndex) {
|
||||
this.startColumnIndex = startColumnIndex;
|
||||
this.columnSpan = columnSpan;
|
||||
this.keyColumnIndex = keyColumnIndex;
|
||||
internalInitialize();
|
||||
}
|
||||
|
||||
@ -33,11 +35,9 @@ public class ColumnGroup implements Serializable, Jsonizable {
|
||||
|
||||
writer.object();
|
||||
|
||||
writer.key("cellIndices"); writer.array();
|
||||
for (int i : cellIndices) {
|
||||
writer.value(i);
|
||||
}
|
||||
writer.endArray();
|
||||
writer.key("startColumnIndex"); writer.value(startColumnIndex);
|
||||
writer.key("columnSpan"); writer.value(columnSpan);
|
||||
writer.key("keyColumnIndex"); writer.value(keyColumnIndex);
|
||||
|
||||
if (subgroups != null && subgroups.size() > 0) {
|
||||
writer.key("subgroups"); writer.array();
|
||||
@ -51,19 +51,8 @@ public class ColumnGroup implements Serializable, Jsonizable {
|
||||
}
|
||||
|
||||
public boolean contains(ColumnGroup g) {
|
||||
for (int c : g.cellIndices) {
|
||||
boolean has = false;
|
||||
for (int d : cellIndices) {
|
||||
if (c == d) {
|
||||
has = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!has) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return (g.startColumnIndex >= startColumnIndex &&
|
||||
g.startColumnIndex < startColumnIndex + columnSpan);
|
||||
}
|
||||
|
||||
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
|
||||
|
@ -104,10 +104,10 @@ public class ColumnModel implements Serializable, Jsonizable {
|
||||
Collections.sort(_rootColumnGroups, new Comparator<ColumnGroup>() {
|
||||
@Override
|
||||
public int compare(ColumnGroup o1, ColumnGroup o2) {
|
||||
int firstDiff = o1.cellIndices[0] - o2.cellIndices[0];
|
||||
int firstDiff = o1.startColumnIndex - o2.startColumnIndex;
|
||||
return firstDiff != 0 ?
|
||||
firstDiff : // whichever group that starts first goes first
|
||||
(o2.cellIndices.length - o1.cellIndices.length); // otherwise, the larger group goes first
|
||||
(o2.columnSpan - o1.columnSpan); // otherwise, the larger group goes first
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -75,8 +75,9 @@ DataTableView.prototype.render = function() {
|
||||
renderPageSize(i);
|
||||
}
|
||||
|
||||
/*
|
||||
* Data table
|
||||
/*============================================================
|
||||
* Data Table
|
||||
*============================================================
|
||||
*/
|
||||
var tableDiv = $('<div></div>').addClass("data-table-container").css("width", container.width() + "px").appendTo(container);
|
||||
|
||||
@ -84,7 +85,82 @@ DataTableView.prototype.render = function() {
|
||||
table.className = "data-table";
|
||||
tableDiv.append(table);
|
||||
|
||||
var trHead = table.insertRow(0);
|
||||
var columns = theProject.columnModel.columns;
|
||||
var columnGroups = theProject.columnModel.columnGroups;
|
||||
|
||||
/*------------------------------------------------------------
|
||||
* Column Group Headers
|
||||
*------------------------------------------------------------
|
||||
*/
|
||||
|
||||
var renderColumnKeys = function(keys) {
|
||||
if (keys.length > 0) {
|
||||
var tr = table.insertRow(table.rows.length);
|
||||
tr.insertCell(0); // row index
|
||||
|
||||
for (var c = 0; c < columns.length; c++) {
|
||||
var td = tr.insertCell(tr.cells.length);
|
||||
|
||||
for (var k = 0; k < keys.length; k++) {
|
||||
if (c == keys[k]) {
|
||||
$('<img />').attr("src", "images/down-arrow.png").appendTo(td);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
var renderColumnGroups = function(groups, keys) {
|
||||
var nextLayer = [];
|
||||
|
||||
if (groups.length > 0) {
|
||||
var tr = table.insertRow(table.rows.length);
|
||||
tr.insertCell(0); // row index
|
||||
|
||||
for (var c = 0; c < columns.length; c++) {
|
||||
var foundGroup = false;
|
||||
|
||||
for (var g = 0; g < groups.length; g++) {
|
||||
var columnGroup = groups[g];
|
||||
if (columnGroup.startColumnIndex == c) {
|
||||
foundGroup = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var td = tr.insertCell(tr.cells.length);
|
||||
if (foundGroup) {
|
||||
td.setAttribute("colspan", columnGroup.columnSpan);
|
||||
td.style.background = "blue";
|
||||
|
||||
if (columnGroup.keyColumnIndex >= 0) {
|
||||
keys.push(columnGroup.keyColumnIndex);
|
||||
}
|
||||
|
||||
c += (columnGroup.columnSpan - 1);
|
||||
|
||||
nextLayer = nextLayer.concat(columnGroup.subgroups);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
renderColumnKeys(keys);
|
||||
|
||||
if (nextLayer.length > 0) {
|
||||
renderColumnGroups(nextLayer, []);
|
||||
}
|
||||
};
|
||||
renderColumnGroups(
|
||||
columnGroups,
|
||||
[ theProject.columnModel.keyCellIndex ]
|
||||
);
|
||||
|
||||
/*------------------------------------------------------------
|
||||
* Column Headers with Menus
|
||||
*------------------------------------------------------------
|
||||
*/
|
||||
|
||||
var trHead = table.insertRow(table.rows.length);
|
||||
|
||||
var td = trHead.insertCell(trHead.cells.length);
|
||||
$(td).addClass("column-header");
|
||||
@ -118,11 +194,15 @@ DataTableView.prototype.render = function() {
|
||||
}
|
||||
};
|
||||
|
||||
var columns = theProject.columnModel.columns;
|
||||
for (var i = 0; i < columns.length; i++) {
|
||||
createColumnHeader(columns[i], i);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------
|
||||
* Data Cells
|
||||
*------------------------------------------------------------
|
||||
*/
|
||||
|
||||
var renderCell = function(cell, td) {
|
||||
if (cell == null || cell.v == null) {
|
||||
return;
|
||||
|
233
tests/movies.tsv
Normal file
233
tests/movies.tsv
Normal file
@ -0,0 +1,233 @@
|
||||
name Directed by Performances - Actor Performances - Character Estimated budget - Currency Estimated budget - Amount Genres Initial release date Languages
|
||||
Wayne's World Penelope Spheeris Mike Myers Wayne Campbell US$ 20000000 Comedy 2/14/1992 English Language
|
||||
Dana Carvey Garth Algar Satire
|
||||
Rob Lowe Buddy film
|
||||
Tia Carrere
|
||||
Lara Flynn Boyle Stacy
|
||||
Chris Farley
|
||||
Ed O'Neill
|
||||
Robert Patrick
|
||||
Alice Cooper
|
||||
Wayne's World 2 Stephen Surjik Mike Myers Wayne Campbell Comedy 12/10/1993 English Language
|
||||
Dana Carvey Garth Algar Buddy film
|
||||
Christopher Walken
|
||||
Tia Carrere
|
||||
Chris Farley
|
||||
Ted McGinley
|
||||
Olivia d'Abo
|
||||
Kevin Pollak
|
||||
Ed O'Neill
|
||||
Kim Basinger
|
||||
Heather Locklear
|
||||
Austin Powers: Goldmember Jay Roach Mike Myers Austin Powers Parody 7/26/2002 English Language
|
||||
Beyoncé Foxxy Cleopatra Time travel
|
||||
Seth Green Scott Evil Comedy
|
||||
Michael York
|
||||
Robert Wagner
|
||||
Michael Caine
|
||||
Verne Troyer
|
||||
Gwyneth Paltrow Dixie Normous
|
||||
Fred Savage
|
||||
Aaron Himelstein
|
||||
Mindy Sterling
|
||||
Josh Zuckerman
|
||||
Greg Grunberg
|
||||
Tommy 'Tiny' Lister
|
||||
Rob Lowe
|
||||
Masi Oka
|
||||
Nikki Schieler Ziering
|
||||
Britney Spears
|
||||
Tom Cruise Him/Herself
|
||||
John Travolta
|
||||
Danny DeVito
|
||||
Katie Couric Prison Guard
|
||||
Steven Spielberg
|
||||
Austin Powers: International Man of Mystery Jay Roach Mike Myers Austin Powers Parody 5/2/1997 English Language
|
||||
Elizabeth Hurley Time travel
|
||||
Michael York Comedy
|
||||
Mimi Rogers
|
||||
Robert Wagner
|
||||
Patrick Bristow
|
||||
Fabiana Udenio
|
||||
Elya Baskin
|
||||
Paul Dillon
|
||||
Lois Chiles
|
||||
Christian Slater
|
||||
Brian George
|
||||
Cynthia Lamontagne
|
||||
Cindy Margolis Fembot
|
||||
Mindy Sterling
|
||||
Joe Son
|
||||
So I Married an Axe Murderer Thomas Schlamme Mike Myers Comedy 7/30/1993 English Language
|
||||
Nancy Travis
|
||||
Anthony LaPaglia
|
||||
Amanda Plummer
|
||||
Brenda Fricker
|
||||
Michael G. Hagerty
|
||||
Luenell Police Records Officer
|
||||
Debi Mazar
|
||||
Matt Doherty
|
||||
Steven Wright
|
||||
Charles Grodin
|
||||
Patrick Bristow
|
||||
Phil Hartman
|
||||
Cintra Wilson
|
||||
Michael Richards
|
||||
Sheila Kelley
|
||||
Alan Arkin
|
||||
M. C. Brennan
|
||||
Holly Lewis
|
||||
Austin Powers: The Spy Who Shagged Me Jay Roach Mike Myers Austin Powers Parody 6/11/1999 English Language
|
||||
Heather Graham Comedy German Language
|
||||
Robert Wagner Time travel
|
||||
Rob Lowe
|
||||
Michael York
|
||||
Verne Troyer
|
||||
David Koechner
|
||||
Muse Watson
|
||||
Michael G. Hagerty
|
||||
Kristen Johnston
|
||||
Mindy Sterling
|
||||
Gia Carides
|
||||
Will Ferrell
|
||||
Bree Turner
|
||||
Scott Cooper
|
||||
Shrek 2 Andrew Adamson John Lithgow Lord Farquaad US$ 125000000 Comedy 5/19/2004 English Language
|
||||
Kelly Asbury Mike Myers Shrek Computer animation
|
||||
Conrad Vernon Eddie Murphy Donkey Fantasy
|
||||
Cameron Diaz Princess Fiona
|
||||
Julie Andrews Queen
|
||||
Antonio Banderas Puss in Boots
|
||||
John Cleese King
|
||||
Rupert Everett Prince Charming
|
||||
Jennifer Saunders Fairy Godmother
|
||||
Aron Warner Wolf
|
||||
Kelly Asbury Page
|
||||
Cody Cameron Pinocchio
|
||||
Conrad Vernon Gingerbread Man
|
||||
Christopher Knights Blind Mouse
|
||||
Mark Moseley Mirror
|
||||
Inglourious Basterds Quentin Tarantino Brad Pitt Lt. Aldo Raine US$ 70000000 War 8/21/2009 English Language
|
||||
Mike Myers General Ed French Adventure German Language
|
||||
Diane Kruger Bridget von Hammersmark Action French Language
|
||||
Daniel Brühl Frederick Zoller Black comedy Italian Language
|
||||
Til Schweiger Sgt. Hugo Stiglitz
|
||||
B. J. Novak PFC Utivich
|
||||
Michael Fassbender Lt. Archie Hicox
|
||||
Julie Dreyfus Francesca Mondino
|
||||
Maggie Cheung Madame Mimieux
|
||||
Rod Taylor Winston Churchhill
|
||||
Gedeon Burkhard
|
||||
Christian Berkel Eric the Barkeeper
|
||||
Samuel L. Jackson
|
||||
Samm Levine PFC Hirschberg
|
||||
Cloris Leachman Mrs. Himmelstein
|
||||
Christoph Waltz Colonel Hans Landa
|
||||
Ludger Pistor
|
||||
Omar Doom PFC Omar Ulmer
|
||||
Jana Pallaske
|
||||
Enzo G. Castellari
|
||||
Jacky Ido
|
||||
Eli Roth
|
||||
Mélanie Laurent
|
||||
54 Mark Christopher Ryan Phillippe Shane O'Shea US$ 18000000 LGBT 8/28/1998 English Language
|
||||
Salma Hayek Anita Randazzo Drama
|
||||
Neve Campbell Julie Black
|
||||
Mike Myers Steve Rubell
|
||||
Sela Ward Billie Auster
|
||||
Breckin Meyer Greg Randazzo
|
||||
Sherry Stringfield Viv
|
||||
Ellen Albertini Dow Disco Dottie
|
||||
Cameron Mathison Atlanta
|
||||
Noam Jenkins Romeo
|
||||
Jay Goede Buck
|
||||
Patrick Taylor Tarzan
|
||||
Heather Matarazzo Grace O'Shea
|
||||
Heidi Klum VIP Patron
|
||||
Mark Ruffalo
|
||||
Lauren Hutton
|
||||
Skipp Sudduth
|
||||
Michael York
|
||||
Shrek the Third Raman Hui Mike Myers Shrek Comedy 5/18/2007 English Language
|
||||
Chris Miller Cameron Diaz Princess Fiona Computer animation
|
||||
Raman Hui Eddie Murphy Fantasy
|
||||
Antonio Banderas
|
||||
Julie Andrews
|
||||
John Cleese
|
||||
Rupert Everett
|
||||
Justin Timberlake Artie
|
||||
Regis Philbin
|
||||
Seth Rogen Ship Captain
|
||||
Eric Idle
|
||||
Cheri Oteri
|
||||
Edison Chen
|
||||
View from the Top Bruno Barreto Gwyneth Paltrow Donna Jensen Romantic comedy 3/21/2003 English Language
|
||||
Christina Applegate Comedy
|
||||
Mark Ruffalo
|
||||
Candice Bergen
|
||||
Joshua Malina
|
||||
Kelly Preston
|
||||
Mike Myers
|
||||
Rob Lowe
|
||||
Marc Blucas
|
||||
Pete's Meteor Brenda Fricker Drama 1998
|
||||
Mike Myers
|
||||
The Cat in the Hat Bo Welch Mike Myers The Cat in the Hat US$ 109000000 Musical 11/21/2003 English Language
|
||||
Alec Baldwin Larry Quinn Fantasy
|
||||
Kelly Preston Joan Walden
|
||||
Dakota Fanning Sally Walden
|
||||
Spencer Breslin Conrad Walden
|
||||
Amy Hill
|
||||
Sean Hayes The Fish
|
||||
Shrek Andrew Adamson Mike Myers Shrek US$ 60000000 Parody 5/18/2001 English Language
|
||||
Vicky Jenson Eddie Murphy Donkey Computer animation
|
||||
Cameron Diaz Princess Fiona Comedy
|
||||
John Lithgow Lord Farquaad Fantasy
|
||||
Chris Farley
|
||||
Conrad Vernon
|
||||
Vincent Cassel
|
||||
Val Bettin
|
||||
Christopher Knights
|
||||
The Thin Pink Line Joe Dietl Laura Kightlinger Satire 1998 English Language
|
||||
Michael Irpino Janeane Garofalo Joyce Wintergarden-Dingle Indie
|
||||
Margaret Cho Comedy
|
||||
Jennifer Aniston Clove
|
||||
David Schwimmer
|
||||
Mike Myers
|
||||
Will Ferrell
|
||||
Shrek the Halls Gary Trousdale Eddie Murphy Animation 11/28/2007 English Language
|
||||
Antonio Banderas Fantasy
|
||||
Cameron Diaz Princess Fiona Short film
|
||||
Mike Myers Adventure
|
||||
Aron Warner Comedy
|
||||
Conrad Vernon
|
||||
Christopher Knights
|
||||
Marissa Jaret Winokur
|
||||
Shrek Ever After Mike Mitchell Cameron Diaz Princess Fiona Comedy 5/21/2010 English Language
|
||||
Mike Mitchell Eric Idle Merlin Computer animation
|
||||
Antonio Banderas Puss in Boots Fantasy
|
||||
Eddie Murphy Donkey
|
||||
Justin Timberlake Arthur Pendragon
|
||||
Julie Andrews Queen Lillian
|
||||
Mike Myers Shrek
|
||||
Paul McCartney Rumpelstiltskin
|
||||
Larry King Doris the Ugly Stepsister
|
||||
The Love Guru Mike Myers Maurice Pitka US$ 62000000 Comedy 6/20/2008 English Language
|
||||
Jessica Alba Jane Bullard
|
||||
Justin Timberlake Jacques Grande
|
||||
Romany Malco Darren Roanoke
|
||||
Jessica Simpson
|
||||
Ben Kingsley
|
||||
Verne Troyer
|
||||
Shrek Goes Fourth Cameron Diaz Princess Fiona Computer animation
|
||||
Antonio Banderas Puss in Boots
|
||||
Eddie Murphy Donkey
|
||||
Mike Myers Shrek
|
||||
View from the top Bruno Barreto Gwyneth Paltrow Romantic comedy 3/21/2003 English Language
|
||||
Mike Myers
|
||||
Rob Lowe
|
||||
Christina Applegate
|
||||
Kelly Preston
|
||||
Candice Bergen
|
||||
Mark Ruffalo
|
||||
Joshua Malina
|
|
Loading…
Reference in New Issue
Block a user