From fed159396c52901384235e04a2bd3ab969faf74c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marko=20Gr=C3=B6nroos?= Date: Fri, 29 Aug 2008 11:10:46 +0000 Subject: [PATCH] Updated book examples. Table examples, formatting. svn changeset:5304/svn branch:trunk --- .../ITMILL/themes/tests-book/styles.css | 34 +++++++++++++++++++ .../tests/book/BookTestApplication.java | 6 ++++ .../toolkit/tests/book/TableExample.java | 15 ++++---- .../toolkit/tests/book/TableExample1.java | 3 -- 4 files changed, 46 insertions(+), 12 deletions(-) diff --git a/WebContent/ITMILL/themes/tests-book/styles.css b/WebContent/ITMILL/themes/tests-book/styles.css index c33cbb36f3..9ec120b767 100644 --- a/WebContent/ITMILL/themes/tests-book/styles.css +++ b/WebContent/ITMILL/themes/tests-book/styles.css @@ -25,6 +25,40 @@ height: 54px; /* 3*18px = 54px. */ } +/****************************************************************************** + * For TableCellStyle.java. + ******************************************************************************/ +/* Center the text in header. */ +.i-table-header-cell { + text-align: center; +} + +/* Basic style for all cells. */ +.i-table-checkerboard .i-table-cell-content { + text-align: center; + vertical-align: middle; + padding-top: 12px; + width: 20px; + height: 28px; +} + +/* Style specifically for the row header cells. */ +.i-table-cell-content-rowheader { + background: #E7EDF3 url(../default/table/img/header-bg.png) repeat-x scroll 0 0; +} + +/* Style specifically for the "white" cells. */ +.i-table-cell-content-white { + background: white; + color: black; +} + +/* Style specifically for the "black" cells. */ +.i-table-cell-content-black { + background: black; + color: white; +} + /*****************************************************************************/ /* For example_Tree() */ /*****************************************************************************/ diff --git a/src/com/itmill/toolkit/tests/book/BookTestApplication.java b/src/com/itmill/toolkit/tests/book/BookTestApplication.java index e91841099b..db84225e07 100644 --- a/src/com/itmill/toolkit/tests/book/BookTestApplication.java +++ b/src/com/itmill/toolkit/tests/book/BookTestApplication.java @@ -588,6 +588,12 @@ public class BookTestApplication extends com.itmill.toolkit.Application { main.addComponent(new TableEditable()); } else if (param.equals("bean")) { main.addComponent(new TableEditableBean()); + } else if (param.equals("long")) { + main.addComponent(new TableExample()); + } else if (param.equals("cellstyle")) { + main.addComponent(new TableCellStyle()); + } else if (param.equals("huge")) { + main.addComponent(new TableHuge()); } else if (param.equals("paging")) { PagingTable table = new PagingTable(); table.addContainerProperty("Column 1", String.class, null); diff --git a/src/com/itmill/toolkit/tests/book/TableExample.java b/src/com/itmill/toolkit/tests/book/TableExample.java index cac01d204c..80c5dad3b0 100644 --- a/src/com/itmill/toolkit/tests/book/TableExample.java +++ b/src/com/itmill/toolkit/tests/book/TableExample.java @@ -26,19 +26,16 @@ public class TableExample extends CustomComponent { layout.addComponent(table); /* Define the names, data types, and default values of columns. */ - table.addContainerProperty("First Name", String.class, - "(no first name)"); - table.addContainerProperty("Last Name", String.class, "(no last name)"); - table.addContainerProperty("Year", Integer.class, null); + table.addContainerProperty("First Name", String.class, "(no first name)"); + table.addContainerProperty("Last Name", String.class, "(no last name)"); + table.addContainerProperty("Year", Integer.class, null); /* We use these entries to generate random items in a table. */ - final String[] firstnames = new String[] { "Donald", "Patty", "Sally", - "Douglas" }; - final String[] lastnames = new String[] { "Smith", "Jones", " Adams", - "Knuth" }; + final String[] firstnames = new String[] { "Donald", "Patty", "Sally", "Douglas" }; + final String[] lastnames = new String[] { "Smith", "Jones", "Adams", "Knuth" }; /* Add some items in the table and assign them an Item ID (IID). */ - for (int i = 0; i < 500; i++) { + for (int i = 0; i < 1000; i++) { /* Add a randomly generated item in the Table. */ table.addItem(new Object[] { firstnames[(int) (Math.random() * (firstnames.length - 0.01))], diff --git a/src/com/itmill/toolkit/tests/book/TableExample1.java b/src/com/itmill/toolkit/tests/book/TableExample1.java index 6b76a89df9..52d1513394 100644 --- a/src/com/itmill/toolkit/tests/book/TableExample1.java +++ b/src/com/itmill/toolkit/tests/book/TableExample1.java @@ -4,10 +4,7 @@ package com.itmill.toolkit.tests.book; -import com.itmill.toolkit.data.Property; -import com.itmill.toolkit.data.Property.ValueChangeEvent; import com.itmill.toolkit.ui.CustomComponent; -import com.itmill.toolkit.ui.Label; import com.itmill.toolkit.ui.OrderedLayout; import com.itmill.toolkit.ui.Table; -- 2.39.5