Sorting icons not appearing with WinLAF and Java 1.5

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Sorting icons not appearing with WinLAF and Java 1.5

Dan Godfrey
WinLAF installs a custom table header renderer, that, like the GlazedLists tableHeaderRenderer delegates to the original tableHeaderRenderer. On Java1.5, this results in the sort indicator icons not appearing. I don't understand why, but they appear fine on Java1.4.

Anyway, I changed the contents of SortArrowHeaderRenderer.getTableCellRendererComponent to the following, which fixed the problem.

            Component component = delegateRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
            if(component instanceof JLabel) {
                JLabel label = (JLabel)component;
                int sortingStyle = getSortingStyle(column);
                Icon iconToUse = icons[sortingStyle];
                label.setIcon(iconToUse);
                label.setHorizontalTextPosition(SwingConstants.LEADING);
                return label;
            } else {
                return delegateRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
            }


Cheers,
Dan.

--
Daniel Godfrey
Java Developer
D +44 (0)20 7956 2693
Salerio e2e
Cor Financial Solutions
www.cor-fs.com


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Sorting icons not appearing with WinLAF and Java 1.5

James Lemieux
Dan,

    We have augmented they way we dress Table Header Renderers with sort icons to be compatible with WinLAF's default table header renderer. It should work seemlessly for you now on JDK 1.4 and 1.5 with no code changes on your side.

Help yourself to the latest jar here:

https://glazedlists.dev.java.net/files/documents/1073/18783/glazedlists.jar

Let us know if you find any other problems.

Jesse James.


On 8/22/05, Dan Godfrey <[hidden email]> wrote:
WinLAF installs a custom table header renderer, that, like the GlazedLists tableHeaderRenderer delegates to the original tableHeaderRenderer. On Java1.5, this results in the sort indicator icons not appearing. I don't understand why, but they appear fine on Java1.4.

Anyway, I changed the contents of SortArrowHeaderRenderer.getTableCellRendererComponent to the following, which fixed the problem.

            Component component = delegateRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
            if(component instanceof JLabel) {
                JLabel label = (JLabel)component;
                int sortingStyle = getSortingStyle(column);
                Icon iconToUse = icons[sortingStyle];
                label.setIcon(iconToUse);
                label.setHorizontalTextPosition(SwingConstants.LEADING);
                return label;
            } else {
                return delegateRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
            }


Cheers,
Dan.

--
Daniel Godfrey
Java Developer
D +44 (0)20 7956 2693
Salerio e2e
Cor Financial Solutions
www.cor-fs.com


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]