Page 1 of 1

DeckImport - some new features

PostPosted: 30 Sep 2013, 07:04
by Max mtg
I have added date filter to deck importer to allow players specify the year when that deck was playing. This will prevent any newer reprints from appearing among recognized cards and reduce the need for external tools.

I have also tried to skin that dialog, but reached only a partial success, since JDialog instances are not supported at FSkin class level. Managed to drop a panel on root level of the dialog and put all the skinnable components inside.

The import dialog can be further improved by adding a preview of recoginzed cards (I still don't know how to catch mouse events from inside JEditorPane)


I also got very surprised by the code in FComboBoxWrapper
Code: Select all
    private static ArrayList<FComboBoxWrapper<?>> allWrappers = new ArrayList<FComboBoxWrapper<?>>();

    public static void refreshAllSkins() {
        for (FComboBoxWrapper<?> wrapper : allWrappers) {
            wrapper.refreshSkin();
        }
    }
that is to say that once created a ComboBoxWrapper will be held in that list forever.
Guess that code can be improved if weak references are applied here.

Re: DeckImport - some new features

PostPosted: 30 Sep 2013, 12:25
by drdev
Max mtg wrote:I also got very surprised by the code in FComboBoxWrapper
Code: Select all
    private static ArrayList<FComboBoxWrapper<?>> allWrappers = new ArrayList<FComboBoxWrapper<?>>();

    public static void refreshAllSkins() {
        for (FComboBoxWrapper<?> wrapper : allWrappers) {
            wrapper.refreshSkin();
        }
    }
that is to say that once created a ComboBoxWrapper will be held in that list forever.
Guess that code can be improved if weak references are applied here.
Sadly, I had a lot of trouble getting combo boxes to update their skin properly, and this was the only solution I found that worked. I'm definitely open to improving it if anyone knows how.

As for skinning JDialog, what were you trying to skin exactly? The ComponentSkin class and derived classes, along with their corresponding FSkin.get functions, can certainly be expanded if needed.

Re: DeckImport - some new features

PostPosted: 30 Sep 2013, 14:23
by Max mtg
I was trying to skin the dialog represented by the DeckImport class. Just didn't know which method to call to make it look like the rest of application. The panel I added to the dialog is semitransparent (by skin definition) but the default form background is visible behind the panel - it looks ugly.

Re: DeckImport - some new features

PostPosted: 30 Sep 2013, 14:31
by drdev
Max mtg wrote:I was trying to skin the dialog represented by the DeckImport class. Just didn't know which method to call to make it look like the rest of application. The panel I added to the dialog is semitransparent (by skin definition) but the default form background is visible behind the panel - it looks ugly.
That's doesn't sound like a problem with FSkin, but rather just a result of frames not supporting transparency easily. You'll need to research how to make a transparent dialog.

Re: DeckImport - some new features

PostPosted: 30 Sep 2013, 15:18
by spr
Max mtg wrote:I was trying to skin the dialog represented by the DeckImport class. Just didn't know which method to call to make it look like the rest of application. The panel I added to the dialog is semitransparent (by skin definition) but the default form background is visible behind the panel - it looks ugly.
You could try using "setOpaque(true)" on the panel or use CLR_THEME2 instead of CLR_THEME. Utimately though, using UIManager calls should be used to make all dialogs consistent via the setForgeLookAndFeel() method in the FSkin.ForgeLookAndFeel class.

Cheers,
Steve