Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JavaFX TableView Issues Moving from Swing

digidanApr 26 2017 — edited Apr 28 2017

We are currently migrating a swing application to JavaFX. The application makes heavy use of TableViews. We have 17 table views that are updated constantly many times a second each.

Users can scroll, and select as the table views are being updated.

In JavaFX we have the following blockers:

  1. Very slow ui behaviour when these tables are being updated. We have had to slow down the rate of updates to the table views as otherwise the whole ui slows to a crawl.
  2. Single Cell selection flickers every time a row is added to a table view which looks very unprofessional - http://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8177945
  3. If you scroll down a table view and let go of the mouse, every additional row to the table view causes the table to scroll slightly. This makes the table view appear as if it is slowly scrolling when new rows are being added when it should be completely still. http://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8178297
  4. The JavaFX table view does not provide the drag selection behaviour of the swing table view out of the box.

We have been forced to use a java agent with a ClassFileTransformer to intercept class loading to replace the VirtualFlow class with our modified version but this is less than ideal.

More details to the above bullet points:

  1. It seems that JavaFX calls layoutChildren every time a row is added, whether that row is within the view port or not which seems excessive when you have multiple table views being dynamically updated.
  2. We have raised a bug but has been given very low priority P3 targeted for v10 so don’t imagine this being fixed quickly. We have temporarily fixed this by doing a Toolkit.getToolkit().firePulse(); at the end of VirtualFlow.layoutChildren.
  3. We have raised a bug but has been given very low priority P3 targeted for v10 so don’t imagine this being fixed quickly. This seems to be caused by the code in VirtualFlow starting at 1159 where the function adjustPixelAmount is being called with floating point values. Take a look at the firstCellOffset and viewportTopToCellTop double variables. We have temporarily fixed this by rounding these values to integers.
  4. Our customers are used to being able to drag square selections in table views and to extend these selections by dragging outside of the boundary of the tableView. We have tried to implement a similar but incomplete behaviour by overriding TableColumn cellFactories and intercepting dragEntered events for table cells. But it is near impossible to mirror the dragging outside of the table view to extend the selection behaviour of the Swing table view.

My questions are:

Are these issues likely to be fixed? it doesn’t seem that JavaFX TableViews have been tested with tables that are being dynamically updated.

Is there a better way to patch issue 2 and 3 other than replacing the VirtualFlow class at class load time using a Java Agent?

Thanks

Danny

Comments

Solomon Yakobson

SQL> SELECT  TO_CHAR(LEVEL,'FM0000')

  2    FROM  DUAL

  3    CONNECT BY LEVEL <= 5 -- choose your limit

  4  /

TO_C

----

0001

0002

0003

0004

0005

SQL>

SY.

L. Fernigrini

This is a script we use on some cases (modified for your output requirements) , you can provide an initial value and the increment.

WITH vData AS (

SELECT 1 AS InitialValue, 1 AS StepIncrement, 5 AS DesiredRows FROM DUAL )

SELECT TO_CHAR(InitialValue + ( (Level - 1) * StepIncrement), '0000')

FROM vData

    CONNECT BY Level <= DesiredRows;

[Deleted User]

4141147 wrote:

select to_char('0001') from dual;

Pay attention to your datatypes: You're giving to_char a string, while it expects a number or a date. So Oracle implicitly converst your string first to a number, in order to use the to_char function. Don't rely on implicit conversions, ALWAYS pay attention to your datatypes and deal with them properly. If you don't, I can guarantee you that it will come back and bite you at some point in the future.

User_40B57

Thanks for the information this is useful for me. Also i need solution , after 0005 it should continue with 0001.

For example :

0001

0002

0003

0004

0005

0001

0002

Thanks,

Hema

Paulzip

>select to_char(mod(level - 1, 5) + 1, 'FM0000') val

>from dual

>connect by level <= 15 -- choose your limit

>/

VAL

-----

0001

0002

0003

0004

0005

0001

0002

0003

0004

0005

0001

0002

0003

0004

0005

15 rows selected.

Solomon Yakobson

4141147 wrote:

Thanks for the information this is useful for me. Also i need solution , after 0005 it should continue with 0001.

Generic solution:

WITH DRIVER AS (

                SELECT  1 LOWER_BAND,

                        5 UPPER_BAND,

                        3 REPEAT_NUMBER

                  FROM  DUAL

              )

SELECT  TO_CHAR(LOWER_BAND + MOD(LEVEL - 1,UPPER_BAND),'FM0000') N

  FROM  DRIVER

  CONNECT BY LEVEL <= UPPER_BAND * REPEAT_NUMBER

/

N

-----

0001

0002

0003

0004

0005

0001

0002

0003

0004

0005

0001

0002

0003

0004

0005

15 rows selected.

SQL>

SY.

Solomon Yakobson

Actually it isn't 100% generic since we have hardcoded FM0000. You could do something like:

WITH DRIVER AS (

                SELECT  1 LOWER_BAND,

                        5 UPPER_BAND,

                        3 REPEAT_NUMBER,

                        3 MIN_LEADING_ZEROES

                  FROM  DUAL

              )

SELECT  TO_CHAR(LOWER_BAND + MOD(LEVEL - 1,UPPER_BAND),'FM' || LPAD('0',MIN_LEADING_ZEROES + CEIL(UPPER_BAND / 10),'0')) N

  FROM  DRIVER

  CONNECT BY LEVEL <= UPPER_BAND * REPEAT_NUMBER

/

N

-----

0001

0002

0003

0004

0005

0001

0002

0003

0004

0005

0001

0002

0003

0004

0005

15 rows selected.

SQL>

WITH DRIVER AS (

                SELECT  1 LOWER_BAND,

                        10 UPPER_BAND,

                        2 REPEAT_NUMBER,

                        3 MIN_LEADING_ZEROES

                  FROM  DUAL

              )

SELECT  TO_CHAR(LOWER_BAND + MOD(LEVEL - 1,UPPER_BAND),'FM' || LPAD('0',MIN_LEADING_ZEROES + CEIL(UPPER_BAND / 10),'0')) N

  FROM  DRIVER

  CONNECT BY LEVEL <= UPPER_BAND * REPEAT_NUMBER

/

N

-----

0001

0002

0003

0004

0005

0006

0007

0008

0009

0010

0001

0002

0003

0004

0005

0006

0007

0008

0009

0010

20 rows selected.

SQL>

SY.

1 - 7
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on May 26 2017
Added on Apr 26 2017
3 comments
428 views