Table cell flashing

Hi,
Before I start to hack away a solution that might not be fx-like, I'd like to get your expert opinion about implementing cell flashing for a table view.
I have done this several times in Swing (using a timer, a customer renderer, switching the bg/fg colors 3 times, and firing up an even table cell update), but how do implement this feature in JavaFX?
* The table cell renderer (override def call (...)) could be used
* The bg/fg color switch can be done using different css styles
* what would be the best way to implement the timer and ask the view to "repaint" a specific cell?
Thx v much

Below is a bit of code that does something like what you want (the port to groovy should be easy). It may need some testing/tweaking for a real scenario and I'm not sure just how many animated cells you could have going at a time before performance becomes an issue (maybe someone from the JFX team could comment on this?).
Also, regarding the use of styles for animating the change, you should be aware of this: Removing CSS style classes?
Basically you need to make sure your 'default' style has values set for everything your 'highlight' style messes with, otherwise the highlight won't get turned off.
import javafx.animation.FadeTransition;
import javafx.animation.Timeline;
import javafx.application.Application;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.TableCell;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
import javafx.util.Callback;
import javafx.util.Duration;
public class TestApp extends Application
    public static void main(String[] args)
        Application.launch(args);
    @Override
    public void start(Stage stage) throws Exception
        BorderPane root = new BorderPane();
        TableView<Person> table = new TableView<Person>();
        table.getItems().addAll(
                new Person("Cathy", "Freeman"),
                new Person("Albert", "Namatjira"),
                new Person("Noel", "Pearson"),
                new Person("Oodgeroo", "Nooncal")
        TableColumn<Person, String> firstNameCol = new TableColumn<Person, String>("First Name");
        firstNameCol.setCellValueFactory(
                new PropertyValueFactory<Person, String>("firstName")
        table.getColumns().add(firstNameCol);
        TableColumn<Person, String> lastNameCol = new TableColumn<Person, String>("Last Name");
        lastNameCol.setCellValueFactory(
                new PropertyValueFactory<Person, String>("lastName")
        lastNameCol.setCellFactory(new Callback<TableColumn<Person, String>, TableCell<Person, String>>()
            public TableCell<Person, String> call(TableColumn<Person, String> column)
                final FlashingLabel label = new FlashingLabel();
                label.setStyle("-fx-background-color: #ffaaaa");
                TableCell<Person, String> cell = new TableCell<Person, String>()
                    protected void updateItem(String value, boolean empty)
                        super.updateItem(value, empty);
                        label.setText(value);
                        label.setVisible(!empty);
                cell.setGraphic(label);
                return cell;
        table.getColumns().add(lastNameCol);
        root.setCenter(table);
        Scene scene = new Scene(root, 800, 600);
        scene.getStylesheets().add("styles.css");
        stage.setScene(scene);
        stage.show();
    public class FlashingLabel extends Label
        private FadeTransition animation;
        public FlashingLabel()
            animation = new FadeTransition(Duration.millis(1000), this);
            animation.setFromValue(1.0);
            animation.setToValue(0);
            animation.setCycleCount(Timeline.INDEFINITE);
            animation.setAutoReverse(true);
            animation.play();
            visibleProperty().addListener(new ChangeListener<Boolean>()
                public void changed(ObservableValue<? extends Boolean> source, Boolean oldValue, Boolean newValue)
                    if (newValue)
                        animation.playFromStart();
                    else
                        animation.stop();
    public class Person
        private String firstName;
        private String lastName;
        private Person(String firstName, String lastName)
            this.firstName = firstName;
            this.lastName = lastName;
        public String getFirstName()
            return firstName;
        public String getLastName()
            return lastName;
}

Similar Messages

  • Urgent! HTML table cell - Flash movie display browser dependent

    Hi all,
    I wonder if anyone has experienced the same problem i have
    (note, Windows XP, Dreamweaver 4).
    Consider the (rough) HTML code attached: A simple HTML table
    of one column and two rows is constructed to hold an image banner
    link and a Flash movie banner link in each cell consecutively.
    The Flash movie works normally when the HTML page is viewed
    in IE and Opera, until that is, it is placed inside a table cell.
    Inside the cell the flash movie seems to disappear, though i
    suspect it collapses to an image 1 pixel in height, as this can
    just about be seen using Opera.
    Is there something that I am missing? The code of course
    seems correct to me - perhaps there is a browser setting i am
    missing?
    Any help apprceiated - as i need to implement this code ..
    Daz

    Hi Alan,
    Dont think that was the problem (percentages used to scale to
    users browser?) ... though you did set me thinking!
    Was tired before, so only just remembered that when i was
    experimenting with setting the Table Properties the image was
    actually occasionally visible!!
    Short version: When formatting a cell containing a Flash
    animation dont leave the H field blank or use % (even though you're
    suppose to be able to!), use pixels instead - otherwise the Flash
    image collapses/disappears. Blank and % are fine everywhere else
    (I did type a long answer before, but it got eaten by the
    forum monster
    Someone/i will probably figure out
    why this is so or maybe i've just rediscovered the wheel
    here - but thats not really important now - because my Flash
    animation now renders similarly across IE, Opera and FireFox !!
    So thanks for your help!
    Daren

  • Want Flash movie to scale with table cell. NOT WORKING!

    Greetings;
    I have authored a Flash movie and it is working fine. When I
    use the html page output by Flash it scales fine but when I cut and
    paste this code into a table cell the movie will not scale (in
    Firefox) and not showup at all in IE 7.
    Help appreciated. Here is the html page output by Flash:
    http://www.howardbakerphotography.com/gallery/bakerGallery.html
    (Scaling fine)
    Here is the content placed inside a simple table cell:
    http://www.howardbakerphotography.com/gallery/index3.php
    (Only shows up small not scaling)
    Help appreciated.
    Rip

    Found the solution myself! It appears the problem was in the
    document type I was declaring:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN" "
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml">
    *The above was preventing my Flash from scaling when placed
    in a table cell. When I changed it to:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
    Transitional//EN" >
    It worked fine.
    I'd be curious to know a little more about this problem if
    anyone else has some insight ...
    Is this document type I've gone to now an older one and going
    to eventually go away?
    Rip

  • Flash and fade effect on table cell

    is there any website that shows an example of this?
    basically i want to have the cell flash when it gets updated
    and color fades away
    i tried setting backgrounds to different alpha of the color
    but i guess computer are too fast, so i only see the last color =)

    yeah, you have to change the color and then delay and change the color, then delay.
    For this, you'd have a thread to change the color, call repaint, sleep,etc til done.

  • How to highlight the table cell color in respective colors as needed per the requirements??

    var aData = [
        {notificationNo: "10000000", description: "Maintenance for boiler", location: "G001-STG-UTLR-BLR", equipmentNo: "100000053", orderStatus: "ordered"},
        {notificationNo: "10000010", description: "Genreal Maintenance for boiler", location: "G001-STG-UTLR-BLR", equipmentNo: "100000053", orderStatus: "notordered"},
        {notificationNo: "10000011", description: "boiler Maintenance", location: "G001-STG-UTLR-BLR", equipmentNo: "100000053", orderStatus: "ordered"},
        {notificationNo: "10000012", description: "Pump breakdown", location: "G001-STG-UTLR-BLR", equipmentNo: "100000053", orderStatus: "ordered"},
        {notificationNo: "10000013", description: "External service boiler", location: "G001-STG-UTLR-BLR", equipmentNo: "100000053", orderStatus: "notordered"},
    jQuery.sap.require("sap.ui.model.json.JSONModel");
    var oEnterpriseAsset_NotificationConsole;
    sap.ui.model.json.JSONModel.extend("EAM_Notification_Console", {
        CreateNotificationConsole:function(){
            oEnterpriseAsset_NotificationConsole = this;
                var oTable = new sap.ui.table.Table({
                //title: "Table Example",
                visibleRowCount: 7,
                firstVisibleRow: 3,
                selectionMode: sap.ui.table.SelectionMode.Single,
            /*    toolbar: new sap.ui.commons.Toolbar({items: [
                    new sap.ui.commons.Button({text: "Button in the Toolbar", press: function() { alert("Button pressed!"); }})
                extension: [
                    new sap.ui.commons.Button({text: "Button in the Extension Area", press: function() { alert("Button pressed!"); }})
            }).addStyleClass("tableform");;
            oTable.addColumn(new sap.ui.table.Column({
            label: new sap.ui.commons.Label({text: "Notification"}),
            template: new sap.ui.commons.Link().bindProperty("text", "notificationNo").bindProperty("href", "href",
                    function(aValue)
            //    sortProperty: "notificationNo",
                //filterProperty: "notificationNo",
                width: "200px"
            oTable.addColumn(new sap.ui.table.Column({
                label: new sap.ui.commons.Label({text: "Description"}),
                template: new sap.ui.commons.Link().bindProperty("text", "description").bindProperty("href", "href"),
                //sortProperty: "notificationNo",
                //filterProperty: "notificationNo",
                //width: "200px"
            var oModel = new sap.ui.model.json.JSONModel();
            oModel.setData({modelData: aData});
            oTable.setModel(oModel);
            oTable.bindRows("/modelData");
        var idForTable= "DimTable"
            //alert("id of tbale " + idForTable);
            var htmlOutput = '<table id=' + idForTable + ' name="DimTab" style="border: 1px solid black;margin-left:15px;" cellpadding=6 cellspacing=0><tr style="background-color:#E5E5E5"><td><b>Dimension</b></td><td><b>Value</b></td></tr>';
            for(var i=0;i<aData.length;i++)
             alert(aData[i].notificationNo);
            htmlOutput += '<tr style="display:none;"><td style="border-right:1px solid #e5e5e5;">Contract No</td><td>'+ aData[i].notificationNo+'</td></tr>';
            htmlOutput += '<tr style="display:none;"><td  style="border-right:1px solid #e5e5e5;">Unit No</td><td>'+ aData[i].description+'</td></tr>';
            htmlOutput += '</table>';   
             var html2 = new sap.ui.core.HTML({
                 // static content
                 //content : "<div style='position:relative;background-color:white;'>Weather</div><script src='//www.gmodules.com/ig/ifr?url=http://www.google.com/ig/modules/builtin_weather.xml&synd=open&w=320&h=200&title=__MSG_weather_title__&lang=en&country=ALL&border=http%3A%2F%2Fwww.gmodules.com%2Fig%2Fimages%2F&output=js'></script>",
            content : htmlOutput,
                  //2 wrkng sydney content : '<div id="cont_Mzc0NjN8NXwxfDF8NHxlZGY1ZjV8M3xGRkZGRkZ8Y3wx"><div id="spa_Mzc0NjN8NXwxfDF8NHxlZGY1ZjV8M3xGRkZGRkZ8Y3wx"><a id="a_Mzc0NjN8NXwxfDF8NHxlZGY1ZjV8M3xGRkZGRkZ8Y3wx" href="http://www.weather-wherever.co.uk/australia/sydney_v37463/" target="_blank" style="color:#333;text-decoration:none;">Weather forecast</a> © weather</div><script type="text/javascript" src="http://widget.weather-wherever.co.uk/js/Mzc0NjN8NXwxfDF8NHxlZGY1ZjV8M3xGRkZGRkZ8Y3wx"></script></div>',
                  //content : '<div style="margin-left:-10px;margin-top:10px;width:100%;"><LINK rel="StyleSheet" href="http://weatherandtime.net/new_wid/w_5/style.css" type="text/css" media="screen"><div class="ww_5" id="ww_5_2119"><div class="l_b"></div><div class="c_b"><div class="day" id="d_0"><span class="den"></span><br><span class="date"></span><br><span class="temp"></span><div class="pict"></div><span class="press"></span><br><span class="hum"></span><br><span class="vet"></span><br></div><div class="day" id="d_1"><span class="den"></span><br><span class="date"></span><br><span class="temp"></span><div class="pict"></div><span class="press"></span><br><span class="hum"></span><br><span class="vet"></span><br></div><div class="day" id="d_2"><span class="den"></span><br><span class="date"></span><br><span class="temp"></span><div class="pict"></div><span class="press"></span><br><span class="hum"></span><br><span class="vet"></span><br></div><div class="cl"></div><div class="links"><a target="_blank" title="Pune Weather forecast" href="http://weatherandtime.net/en/Asia/India/Pune-weather.html">Pune Weather forecast</a><br><a style="font-size:12px !important;color:#12A0D7 !important;text-decoration:none !important;" href="http://weatherandtime.net/en/widgets-gallery.html" title="weather"></a></div></div><div class="r_b"></div></div><script type="text/javascript" src="http://weatherandtime.net/w_5.js?city=2119&lang=en&type=2&day=3"></script></div>',
              // initially behaves the same as Sample 1
                 preferDOM : false,
                 // use the afterRendering event for 2 purposes
        return     oTable;
    /* In the screen shot as u can see.. I have to highlight the table cell in green color and red color for ordered and unordered status(which is binded to a json data) respectively....anyone please help??

    Hi Abhi,
                   Check this link it may helpHow I made highlight of specific values in Table

  • Looping table cells....... is it possible to loop more than one table cell?

    Hi there
    Hope everyone is doing well
    I have been using the addt looper wizard and it works great.....
    I usually put all the things I want to loop into one cell.... then select all the things and apply the looper.... which works fine....
    But..... it is hard to align all the elements I want to loop
    I have been using transparent gif images to space the loops evenly but when I space dynamic taxt on top of each other there is a large gap.....
    It is a nightmare to get it looking even
    Ok say I want to loop this.....
    A thumbnail
    Product ID
    Price
    It would look like this
    A thumbnail
    Product ID
    Price
    Because I cannot reduce the space between the lines......
    So I would like to place all the different elements in separate table cells and loop them..... I have tried and get really strange results....
    When you look at most online shops, their product pages have a thumbnail image the id, price, description, etc.... all spaced evenly.... and looks like is looped...... So.... how do I do it?
    Is there any easier way to align the things I want to loop?
    Any help would be great

    Hi there
    I seem to have figured out how to loop cells....
    Should have thought of it earliar but anyway
    Was easy....
    Just create a looped (repeat) region and insert a table into the region and edit the table to align all the looped elements easily....
    Cool

  • Highlighting text in a table cell

    Im trying to get text in a table have it background shaded a different colour to the rest of the table cell but it doesnt work. No exceptions are thrown does anyone have any idea.
    public Component getTableCellRendererComponent(JTable table,
            Object value,
            boolean isSelected,
            boolean hasFocus,
            int row,
            int column)
            setFont(table.getFont());     
            this.setText(value));
            this.selectAll();
            this.setSelectionColor(new Color(0,0,255,100);
            return this;
        }

    The answer is similar to what someone else asked recently for highlighting text in a JFormattedTextField cell.
    class MyFocusListener extends FocusAdapter
    public void focusGained(FocusEvent e)
    SwingUtilities.invokeLater(new Runnable()
    public void run()
    selectAll();
    Put that in your cell editor or its base class. You can change the color or whatever you want. I think the problem is a timing thing where normal focus processing is interrupting your changes. So give the focus processing time to run with this Runnable triggering your processing to occur on the Awt thread (as is proper) after the system is doing whatever it wants to do. Let us know if it works for you.

  • How can I make a table cell extend beyond the page?  The text disappears when the cell becomes larger than the page.

    How can I make a table cell extend beyond a page?  The text disappears when the cell becomes bigger than the page.  I want the table to continue to the next page.

    As a student, you might be able to get Office for Mac from the college bookstore at a substantial discount. Otherwise, I think your best option for documents that need to be shared with Office users is to get one of the free Office clones such as LibreOffice.

  • How to use a checkbox table cell in FXML

    I've figured out how to make a column in a TableView render as a checkbox rather then just text when the UI is written in Java. Now I'm trying to figure out how to do the same thing with FXML. I've tried a couple experiments which have all failed, usually with an exception complaining that it can't coerce a table cell class type (or extension) to an interface (i.e. Callback).
    Right now I'm just trying to make one of the columns be a checkbox. I'm not trying to use any custom type. In other words, in Java I would have done the following:
    TableColumn<MyModel, Boolean> col1 = new TableColumn<MyModel, Boolean>();
    col1.setCellValueFactory(new PropertyValueFactory<MyModel, Boolean>("col1Field"));
    col1.setCellFactory(CheckBoxTableCell.forTableColumn(col1));This works when I build the UI using Java API calls. Does anyone know how to do this in FXML?

    Thank you both.
    I used Luca's suggestion as a first step.
    You'll find attached my v.i. that enables me to do what I wanted. It finally works as I expected. It would have been much simpler if my DAQ was able to measure directly a resistance!
    Loris
    Attachments:
    banc_de_test_température.vi ‏205 KB

  • Changing the color of a Basic line object nested in a table cell

    Can anyone help me out here...I have inserted a line object from the Basic palette into a table cell on my web page and it displays fine but is default black color...I would like to change the color but haven't been successful in doing so..any ideas

    Hmm - doesn't sound right.
    "color=#hex" is not appropriate HTML markup.... Can you show us where you
    made this change?
    Murray

  • How to wrap a line in a table cell in adf

    How do I wrap a line of text in a table cell?

    Yes, I tried that. But I have 2 sets of information. I want it to wrap exactly at the start of the second piece of information
    So I am trying to use noWrap in combination with width. How else can I do this. appending \n does not work

  • How to print global variable in smart form table cell

    hi,
    i have smartform and i insert table in it, i also have set global variable, i want to show variable in table cell.
    regards
    shahid rais

    Hi Shahid Rais 
    You can use this global variable that has been declared in anywhere as you like.
    For displaying global variable in table lines, You can first set the column and row of the table by using the table tab in table node . Then, u can decide either the variable u want to used will be placed on header, main, or footer. After that, right click on one of the table part, and choose create table line. After choosing the correct line type as already been declared in the table painter, just simply right click on the table cell, and then create text node.
    You can now enter your variable by using "insert field".
    And don't forget the & & signs before and after your variable name.
    Regards,
    William Prawira

  • How to write text vertically in an table cell?

    Is it possible to make a table cell where the
    text would be written along a vertical base line?
    I found how to make a text box and rotate it
    vertically.
    How may I place such a text box in a table cell?
    dan    

    Hello daniel,
    if the table will not be resized or repositioned a lot, the best way to display what you want to have is to create a textbox with the styles and adjustments you need, rotate it and place it over the table cell. Be sure to make the cell big enough to pretend the text of the textbox would be inside of it. The textbox has to be a fix positioned object in the top layer.
    It's only a work-around, but the best you can achieve.
    Frank.

  • How to create a context menu in ALV table cell editor(Webdynpro abap )

    Hello Experts,
    I am having a problem in creating a context menu in a table cell editor in the ALV table output.I have assigned a 'lta' as the cell editor.But befor assigning the lta as cell editor I have assigned the menu to the lta.But when the view is rendered I can see the lta with the actioned assigned to it.But I cannot see the context menu.
    The code snippet below:
      "Create menu for each coloumn
      create OBJECT lo_menu_actions type CL_SALV_WD_VE_MENU EXPORTING
          id = 'MITM_ACTIONS'.
      lo_menu_actions->set_visible( value = abap_true ). 
      lo_menu_actions->set_visible_fieldname( value = 'ACTIONS' ).
      "ADd menu items
      CREATE OBJECT lo_menu_item_create type CL_SALV_WD_VE_MENU
      exporting
        id = 'MITM_CREATE_EXPRESSION'.
      lo_menu_item_create->set_visible( value = abap_true ).
      lo_menu_item_create->set_visible_fieldname( value = 'Create' ).
      "Add item 1
      lo_menu_actions->ADD_ITEM( VALUE = lo_menu_item_create ). 
      "  Set the cell editor for each column cell(link to an action)
      LOOP AT lt_node_dec_tab_cols INTO ls_node_dec_tab_cols .
        lv_column_name = ls_node_dec_tab_cols-object_name.
        lr_column = lr_column_settings->get_column( lv_column_name ).
       "Create 'lta' Ui item
        CREATE OBJECT lo_lta TYPE cl_salv_wd_uie_link_to_action.
        lo_lta->set_menu( value = lo_menu_actions ).
        lo_lta->set_text_fieldname( lv_column_name ).
        lr_column->set_cell_editor( lo_lta ).
        IF ls_node_dec_tab_cols-is_result EQ abap_true.
          lr_column->set_cell_design( value =
                      cl_wd_table_column=>e_cell_design-key_medium ).
        ENDIF.
      ENDLOOP.

    Hi Prakash,
    I have not come across this requirement till now to have context menu in a cell editor of alv.
    Unfortunately  the implementation of method SET_MENU of alv ui elements ( ex: cl_salv_wd_uie_text_view ) is not updating alv configurable table, instead it just stores in a global attribute as string. Hence has no effect on context menu.
    If your user is very particular about this requirement of having context menu in cell editor, you can go for a normal table. Because, normal table's cell editor has the property to set the menuID as we do it for other ui elements.
    Regards,
    Rama

  • How to get the data from a table cell

    Could somebody suggest me how I can get the data value from a table cell if I set that cell a Double object previously.
    Thanks very much

    Thanks for camickr's information.
    And thanks uhrand,
    I haven't got it sloved. I am sick on this problem.
    I have the methods to let the table editable. My tableModel code is from Sun Tutorial.
    It has the code like this:
    public int getColumnCount() {
                return columnNames.length;
             public int getRowCount() {
                return data.length;
              public String getColumnName(int col) {
                return columnNames[col];
             public Object getValueAt(int row, int col) {
                return data[row][col];
             * JTable uses this method to determine the default renderer/
             * editor for each cell.  If we didn't implement this method,
             * then the last column would contain text ("true"/"false"),
             * rather than a check box.
            public Class getColumnClass(int c) {
                return getValueAt(0, c).getClass();
             * Don't need to implement this method unless your table's
             * editable.
            public boolean isCellEditable(int row, int col) {
                //Note that the data/cell address is constant,
                //no matter where the cell appears onscreen.
                if (col < 1) {
                    return false;
                } else {
                    return true;
             * Don't need to implement this method unless your table's
             * data can change.
            public void setValueAt(Object value, int row, int col) {
                if (DEBUG) {
                    System.out.println("Setting value at " + row + "," + col
                                       + " to " + value
                                       + " (an instance of "
                                       + value.getClass() + ")");
                data[row][col] = value;
                fireTableCellUpdated(row, col);
                if (DEBUG) {
                    System.out.println("New value of data:");
                    printDebugData();
            public void printDebugData() {
                int numRows = getRowCount();
                int numCols = getColumnCount();
                for (int i=0; i < numRows; i++) {
                    System.out.print("    row " + i + ":");
                    for (int j=0; j < numCols; j++) {
                        System.out.print("  " + data[i][j]);
                    System.out.println();
                System.out.println("--------------------------");
            }

Maybe you are looking for

  • IPhoto 6 has become corrupt and I have lost 50 amended images

    This is my second post re a major/ serious corruption issue I have with iPhoto 6 Within my library I have 50 images that have had multi amendments made and each amendment has been saved as an image revision (e.g. Image6 when 6 changes had been made)

  • Acrobat Pro won't allow to save with Reader Extended Features

    I've saved forms this way before because all the users of our forms only have the free Reader version. For some reason it now won't allow me to save with the extended features. When I save as and hover over "Reader Extended PDF" it shows my 3 options

  • Problem with downloading documents

    Over the past couple of weeks everytime I have tried to download a documents on  my Macbook Pro using Firefox is has given a 'failed' message. I am on Lion 10.7.5. Any advice appreciated.

  • Need help finding wallpaper

    Hi everyone, I saw a thread that I liked and wanted to respond but I couldn't find a way to reply, so here I am going to start a new one. I am looking for TWO of the PINK rose wallpapers that are on ios4. Those two were my favorites and I did a Googl

  • John Nack on HTML Extensions in CC 2014

    This went out a few days ago, but I've only just seen it.  Some interesting info in the links, and a positive look on the move from Flash to HTML http://jnack.com/blog/2014/06/24/on-the-adobe-panel-migration-from-flash-to-html/