changeset 2851:fd5419fef373

Modena Test App added test case for RT-28410
author "Jasper Potts"
date Wed, 06 Mar 2013 18:00:53 -0800
parents 4110414745eb
children 5cb29e82fed6
files apps/experiments/Modena/src/modena/SamplePageTableHelper.java
diffstat 1 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/apps/experiments/Modena/src/modena/SamplePageTableHelper.java	Wed Mar 06 17:46:20 2013 -0800
+++ b/apps/experiments/Modena/src/modena/SamplePageTableHelper.java	Wed Mar 06 18:00:53 2013 -0800
@@ -45,6 +45,7 @@
 import javafx.collections.SetChangeListener;
 import javafx.event.EventHandler;
 import javafx.scene.Node;
+import javafx.scene.control.Label;
 import javafx.scene.control.SelectionMode;
 import javafx.scene.control.TableCell;
 import javafx.scene.control.TableColumn;
@@ -300,6 +301,25 @@
                 return new ReadOnlyObjectWrapper<String>("New Zealand");
             }
         });
+        // Test case for RT-28410 MODENA: can't make tree/table cell factories change color based
+        // on background when setGraphic(...) is used
+        countryCol.setCellFactory(new Callback<TableColumn<Person, String>, TableCell<Person, String>>() {
+            @Override public TableCell<Person, String> call(TableColumn<Person, String> param) {
+                final Label label = new Label();
+                label.setStyle(
+                        "-fx-font-family: 'Times New Roman';" +
+                        "-fx-font-size: 0.8em;" +
+                        "-fx-text-fill: ladder(-fx-background, yellow 49%, red 50%);");
+                TableCell cell = new TableCell() {
+                    @Override protected void updateItem(Object item, boolean empty) {
+                        label.setText(empty ? null : item.toString());
+                    }
+                };
+                cell.setGraphic(label);
+                return cell;
+            }
+        });
+
         invitedCol = new TableColumn<Person, Boolean>();
         invitedCol.setText("Invited");
         invitedCol.setPrefWidth(55);