file choosers and filters for 3.1.0

I’m looking at the first of the issues I said I’d handle for beta2—
adding file filters for modules, extensions, saves, and logs to the
file choosers we display—and it’s turning out to be rather vexing.

Here’s why: So far as I can see, it’s not possible to set more than
one file filter on a java.awt.FileDialog, which is what we use on
Windows and Macs in order to get a native chooser. (If I’m wrong about
this, please tell me—I can’t check this on a Mac or a Windows box
right now.) Can anyone tell me whether these native dialogs really
do support selectable file filters? If so, then it’s AWT’s fault
that it doesn’t expose this capability. If not, then …um, what are
we supposed to do? People complained when we didn’t use the native
file choosers.

I guess on the Mac, we could get a decent JFileChooser by using Quaqua
for our LookAndFeel (randelshofer.ch/quaqua/index.html),
which might be a good idea anyway since it would get us even closer to
looking native on a Mac.

I’m not sure what we can do on Windows. (How does a JFileChooser differ
from an AWT FileDialog on Windows?)

I’d love to hear people’s thoughts on how to address this problem.

Thus spake “Michael Kiefte”:

Well, I’m against file choosers which don’t look native, and I’m also
against file choosers which don’t let us specify multiple file filters.

I know that Quaqua provides us with an epsilon-native JFileChooser for
Macs, so we could use that there. The JFileChooser you get on Windows
when you use the Windows LaF is quite different from the one in the
Java LaF, but I’d need someone to look at a native Windows file chooser
and let us know how they compare. Also, there’s the issue of whether
layouts get screwed up if we move to Windows LaF on Windows—I tried
this once, and I think Brent also looked at it, but I don’t recall
anymore what it was like.

It would be great if someone had already created a near-native
JFileChooser subclass or (UIDelegate) for Windows… Maybe someone
has? I’m going to be pretty pissed off at the world if I end up writing
one.


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Michael Kiefte”:

Possibly—but then it’s going to look really weird if nothing else is
in the Windows LaF.

Whether the Windows LaF screws things up is easy enough to test—I’ll
upload a build tonight which is that way.


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Michael Kiefte”:

I guess so, but it doesn’t look weird to the Windows users, because
it’s a native dialog.


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

If you mean system natively (as opposed to ‘native to what Java uses to talk to Windows’) of course you can!

I’ve attached a shot of the filter list from Excel. I assume this is the type of thing you’re talking about.

Thus spake “Rindis”:

Yes, this is what I was referring to. I wish that the API for FileDialog
had taken the approach of having more methods but throwing an
UnsupportedOperationException for some when the functionality isn’t
available on the underlying windowing system, rather than providing only
methods which work everywhere.


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)