Skip to main content

Added LF specific sortIcons - some questions/comments

2 replies [Last post]
Anonymous

The basic approach was simple enough, thanks to ComponentAddons: I
created an Addon for ColumnHeaderRenderer which checks for the LF and
loads/unloads the icons accordingly. Some dirty details (make
JXTableHeader behave and update the renderer, make sure the renderer
asks the UIManager for the icons to use) later it seems to work - the
demo in swingx_dev switches nicely, mostly...

- how to detect XP reliably? Currently, I'm checking the OS, but I'm
pretty sure that's not the best way to do it.

- in the columnAddon I had to c&p the LF-family deciding code snippets
from another addon. Wouldn't it be nice to have a AbstractComponentAddon
implementing these?

- what about Synth? Couldn't find a default skin (but didn't look
thoroughly).

- LookAndFeelAddons doesn't recognize goodies plastic (or any of the
other metal derivatives) as metal, so returns the windows addons which
don't use the metal icons.

- in the columnAddon I had to c&p the LF-family deciding code snippets
from another addon. Wouldn't it be nice to have a AbstractComponentAddon
implementing these?

Okay, as always with LF specifics I could easily be looking into the
totally wrong direction, please let me know (Frederic?)

Thanks
Jeanette

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Frederic Lavigne

Kleopatra wrote:
>
> The basic approach was simple enough, thanks to ComponentAddons: I
> created an Addon for ColumnHeaderRenderer which checks for the LF and
> loads/unloads the icons accordingly. Some dirty details (make
> JXTableHeader behave and update the renderer, make sure the renderer
> asks the UIManager for the icons to use) later it seems to work - the
> demo in swingx_dev switches nicely, mostly...
>
> - how to detect XP reliably? Currently, I'm checking the OS, but I'm
> pretty sure that's not the best way to do it.

OS.isWindowsXP() looks like a good way to check if we are running on
Windows XP. If needed, you might want to check if the end-user is using
visual styles or not.

What you want to avoid are checks like if (lnf instanceof
WindowsLookAndFeel) because it is likely to throw ClassNotFoundException
on Linux/Mac OS X, that's one of the reason WindowsLookAndFeelAddons
exist...

> - in the columnAddon I had to c&p the LF-family deciding code snippets
> from another addon. Wouldn't it be nice to have a AbstractComponentAddon
> implementing these?

I have it in my workspace, will commit it soon and update existing
addons accordingly.

> - what about Synth? Couldn't find a default skin (but didn't look
> thoroughly).
>
> - LookAndFeelAddons doesn't recognize goodies plastic (or any of the
> other metal derivatives) as metal, so returns the windows addons which
> don't use the metal icons.

Should we have a "DerivedFromMetalLookAndFeelAddons" or more specific
like "PlasticLookAndFeelAddons", "Plastic3DLookAndFeelAddons"...? I
don't think we want to have addons for all existing look and feels but
it looks fair to provide at least support for the most commonly used.

In the meantime, I'm also doing some experimentations where I add
methods like "isXP()", "isPlastic()", ... to LookAndFeelAddons. It
removes the need for XXXAddons classes but add tons of methods to
LookAndFeelAddons and prevent the developer from selecting the addon
(s)he'd like to use.

> - in the columnAddon I had to c&p the LF-family deciding code snippets
> from another addon. Wouldn't it be nice to have a AbstractComponentAddon
> implementing these?

Hum, I've seen this already somewhere :) I guess you really want this
AbstractComponentAddon!

> Okay, as always with LF specifics I could easily be looking into the
> totally wrong direction, please let me know (Frederic?)
>
> Thanks
> Jeanette
>

-fred

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net

Kleopatra

>>
>>- how to detect XP reliably? Currently, I'm checking the OS, but I'm
>>pretty sure that's not the best way to do it.
>
>
> OS.isWindowsXP() looks like a good way to check if we are running on
> Windows XP. If needed, you might want to check if the end-user is using
> visual styles or not.

Don't know if that's needed - Ann? Should the xp-style sort icons be
used only if the end-user is using visual styles?

>
> What you want to avoid are checks like if (lnf instanceof
> WindowsLookAndFeel) because it is likely to throw ClassNotFoundException
> on Linux/Mac OS X, that's one of the reason WindowsLookAndFeelAddons
> exist...
>

got that and checked if I did it accidentally

>
>>- in the columnAddon I had to c&p the LF-family deciding code snippets
>>from another addon. Wouldn't it be nice to have a AbstractComponentAddon
>>implementing these?
>
>
> I have it in my workspace, will commit it soon and update existing
> addons accordingly.
>

great! I think the AbstractComponentAddon is a good place to do so (as
opposed to LookAndFeelAddons). If developers want to specifically
support new LFs they can easily add to an addon even by subclassing, but
might not so easily change the LookAndFeelAddons. At least they should
be discouraged to tweak too much there (yeah, I'm pleading guilty of
adding swingx framework resourcebundle loading - btw, what do you
think about it? Is it the right place to do it?)

>>
>>- LookAndFeelAddons doesn't recognize goodies plastic (or any of the
>>other metal derivatives) as metal, so returns the windows addons which
>>don't use the metal icons.
>
>
> Should we have a "DerivedFromMetalLookAndFeelAddons" or more specific
> like "PlasticLookAndFeelAddons", "Plastic3DLookAndFeelAddons"...? I
> don't think we want to have addons for all existing look and feels but
> it looks fair to provide at least support for the most commonly used.
>

no - I was thinking more along the lines of families of LFs: Plastic is
more metal than windows. With the current check for bestMatching it
returns WindowsAddon on my machine, which doesn't feel quite right. But
I'm not sure how to solve it...

>
> Hum, I've seen this already somewhere :) I guess you really want this
> AbstractComponentAddon!
>
>

yeah When writing the post I copied the snippet to the top (instead
of moving)

Jeanette

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net