myk's code contributions
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Re: myk's code contributions
by ArsenalNut » 29 Jan 2013, 07:03
myk wrote:I just took a look at the advanced search page for Gatherer -- there definitely is some good functionality there. It would take a separate UI page to implement, though. Not to say it can't be done -- it could be implemented in a dialog that comes up when you select "Advanced search" from the "Filter by" popup menu. The advanced search would be added to the restriction list just like the other restrictions.ArsenalNut wrote:I would suggest making three separate input fields for Name, Text, and Type so you can do more complex searches like "goblins with haste".
If you haven't played with the Advanced search mode of the Gatherer, you might want to look at it. I really like the way you can build up the logic for the search. I use the rules text search functionality all the time to find cards with similar effects when scripting new cards. I also like the way the types and subtypes are actually list boxes instead of free text.
I'd like to point out, though, that in this design you /can/ search for goblins with haste: searches are stackable. Type in Goblin, check type and uncheck the others, hit ctrl-enter. this will add that restriction to the filter stack and clear the search textbox. Then type in haste, check text and uncheck type.

I think most of the useful functionality of the Gatherer is covered by what is currently implemented and what you are planning to add. I was thinking more of the actual Gatherer's UI implementation with the and/or/not pull down and the add button. For me the add button would more intuitive than Ctrl-Enter but I'll get used to whatever is implemented. I personally like list boxes for enumerated lists like subtype so I don't fat finger free text in my search. I do that enough with card names

So many cards, so little time
-
ArsenalNut - Posts: 512
- Joined: 08 Jul 2011, 03:49
- Has thanked: 27 times
- Been thanked: 121 times
Re: myk's code contributions
by Chris H. » 29 Jan 2013, 17:25
myk wrote:Thoughts? Suggestions? The code is currently just the UI elements, and currently don't actually do anything other than appear and disappear. If this looks good, though, I'll start on hooking up the plumbing and moving the code from its current jumble in the view to appropriate places in the controller.
I am not an expert in UI design by any means.

I like the idea of having a basic and an advanced type of set up. Click on a checkbox titled Advanced Filters would add in additional filter options. Might not be practicle.
At some point we will need to add in some of your work so that we can let the masses play test and they can then get back to us with their creative ideas.
-
Chris H. - Forge Moderator
- Posts: 6320
- Joined: 04 Nov 2008, 12:11
- Location: Mac OS X Yosemite
- Has thanked: 644 times
- Been thanked: 643 times
Re: myk's code contributions
by myk » 29 Jan 2013, 17:32
ok, let me write up the plumbing, then, and get the point where we can merge.
- myk
- Posts: 439
- Joined: 17 Jan 2013, 02:39
- Location: California
- Has thanked: 38 times
- Been thanked: 57 times
Re: myk's code contributions
by Hellfish » 29 Jan 2013, 17:50
Since you're doing extensive deck editor work, myk, I was wondering if you have any thoughts regarding Variants and sideboards in deck editors?
Currently, there are editors for Scheme decks and Planar decks separately but none to "bake" default scheme/planar decks into regular decks, like in the decks gos release.There is also the matter of having the ability to edit the sideboard, with or without Variant decks.
Currently, there are editors for Scheme decks and Planar decks separately but none to "bake" default scheme/planar decks into regular decks, like in the decks gos release.There is also the matter of having the ability to edit the sideboard, with or without Variant decks.
So now you're
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
-
Hellfish - Programmer
- Posts: 1297
- Joined: 07 Jun 2009, 10:41
- Location: South of the Pumphouse
- Has thanked: 110 times
- Been thanked: 169 times
Re: myk's code contributions
by myk » 29 Jan 2013, 19:29
Unfortunately, I don't have enough experience yet with scheme and planar decks to have a solid opinion on what should be done, but making the sideboard easier to use is definitely on my radar.Hellfish wrote:Since you're doing extensive deck editor work, myk, I was wondering if you have any thoughts regarding Variants and sideboards in deck editors?
Currently, there are editors for Scheme decks and Planar decks separately but none to "bake" default scheme/planar decks into regular decks, like in the decks gos release.There is also the matter of having the ability to edit the sideboard, with or without Variant decks.
- myk
- Posts: 439
- Joined: 17 Jan 2013, 02:39
- Location: California
- Has thanked: 38 times
- Been thanked: 57 times
Re: myk's code contributions
by myk » 29 Jan 2013, 21:43
I'm implementing dynamic retrieval of quest world restrictions, and I have a quick question: why is the Main world's GameFormatQuest object null?
- myk
- Posts: 439
- Joined: 17 Jan 2013, 02:39
- Location: California
- Has thanked: 38 times
- Been thanked: 57 times
Re: myk's code contributions
by Max mtg » 29 Jan 2013, 21:57
GameFormatQuest AFAIR holds restrictions for cards that one can win in that world.myk wrote:I'm implementing dynamic retrieval of quest world restrictions, and I have a quick question: why is the Main world's GameFormatQuest object null?
Probably it's null due to no restriction applied.
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
Re: myk's code contributions
by myk » 29 Jan 2013, 22:08
That is not the case for my current quest. My quest data file includes, for example:
Edit: ah, I think I see. getWorlds() will only get me the definitions in worlds.txt. I need to go through QuestData to get the custom global format.
- Code: Select all
<format>
<format name="Standard" unlocksUsed="2" canUnlock="1"/>
<set s="ISD"/>
<set s="DKA"/>
<set s="AVR"/>
<set s="M13"/>
<set s="RTR"/>
<set s="M12"/>
<set s="PC2"/>
</format>
<mode>Fantasy</mode>
<worldId>Main world</worldId>
- Code: Select all
for (final QuestWorld w : Singletons.getModel().getWorlds()) {
addMenuItem(world, w.getName() + " world", !isActive(activeWorlds, w), null, new Command() {
@Override
public void execute() {
addRestriction(buildWorldRestriction(w), activeWorlds, w);
}
});
}
Edit: ah, I think I see. getWorlds() will only get me the definitions in worlds.txt. I need to go through QuestData to get the custom global format.
- myk
- Posts: 439
- Joined: 17 Jan 2013, 02:39
- Location: California
- Has thanked: 38 times
- Been thanked: 57 times
Re: myk's code contributions
by myk » 30 Jan 2013, 19:16
ok, I'm just about ready to merge my code to trunk. I had gone through and added appropriate subversion properties to source files (e.g. svn:eol-style native, setting mime types, etc), but I realize now that it will make the diff almost impossible to read: marking the line endings as native will make the entire file appear in the diff (at least on WebSVN. you can ignore whitespace change if diffing from the commandline), so I'll nix that part of the merge and just copy over the modified files instead of doing a svn merge --reintegrate. Here's the list of changes:
- fixed resize cursor not appearing when hovering between columns in table headers
- added forge-specific spinner widget (FSpinner)
- allowed labels to have their toggle state read externally and added configuration to set whether the onClick command is executed on mouse button down or mouse button up (FLabel)
- added builder pattern to FTextField and autoset properties to common values
- fixed header comments in WrapLayout
- renamed DialogCustomFormat to the more generic DialogChooseSets since I use it now from the filters too; extended its functionality to run a specified command on ok button click
- removed Filters dockable panel
- added old filters functionality to the stats buttons above the catalog table (stats can no longer be removed via a preference setting)
- combined scattered metadata about the filters (e.g. icon, label, filter predicate) into a single enum
- rewrote filter utility functions to not have any side effects (they now use no global data/singletons)
- added "Owned" column to spell shop catalog, indicating number of cards already owned by player (can remove column with preference)
- don't count the "click" as a sort command when resizing a column
- exposed top-level main world custom format in QuestController -- other format-retrieving methods would be masked by the current world selection
- added utility fn to TextUtils to create a (locale-independent) Title out of an ENUM
- added a templated Pair<T, V> utility class for ad-hoc two-value parameter returning
- fixed resize cursor not appearing when hovering between columns in table headers
- added forge-specific spinner widget (FSpinner)
- allowed labels to have their toggle state read externally and added configuration to set whether the onClick command is executed on mouse button down or mouse button up (FLabel)
- added builder pattern to FTextField and autoset properties to common values
- fixed header comments in WrapLayout
- renamed DialogCustomFormat to the more generic DialogChooseSets since I use it now from the filters too; extended its functionality to run a specified command on ok button click
- removed Filters dockable panel
- added old filters functionality to the stats buttons above the catalog table (stats can no longer be removed via a preference setting)
- combined scattered metadata about the filters (e.g. icon, label, filter predicate) into a single enum
- rewrote filter utility functions to not have any side effects (they now use no global data/singletons)
- added "Owned" column to spell shop catalog, indicating number of cards already owned by player (can remove column with preference)
- don't count the "click" as a sort command when resizing a column
- exposed top-level main world custom format in QuestController -- other format-retrieving methods would be masked by the current world selection
- added utility fn to TextUtils to create a (locale-independent) Title out of an ENUM
- added a templated Pair<T, V> utility class for ad-hoc two-value parameter returning
- myk
- Posts: 439
- Joined: 17 Jan 2013, 02:39
- Location: California
- Has thanked: 38 times
- Been thanked: 57 times
Re: myk's code contributions
by myk » 30 Jan 2013, 22:10
committed to trunk. tell me if you have any issues with it!
- myk
- Posts: 439
- Joined: 17 Jan 2013, 02:39
- Location: California
- Has thanked: 38 times
- Been thanked: 57 times
Re: myk's code contributions
by Chris H. » 31 Jan 2013, 00:04
myk wrote:committed to trunk. tell me if you have any issues with it!
I updated my local copy to rev 19299 and checked out the deck editor. I like it and being able to check it out first hand helps me to visualize your changes.
In the past several people commented that they were not able to find the search feature. It was there in a tab named filters and there was no tab named search.

Might want to move the add card buttons down and to move the filter text box up.
Overall I like what I see so far.
-
Chris H. - Forge Moderator
- Posts: 6320
- Joined: 04 Nov 2008, 12:11
- Location: Mac OS X Yosemite
- Has thanked: 644 times
- Been thanked: 643 times
Re: myk's code contributions
by Sloth » 31 Jan 2013, 08:49
I like it. Good work myk!myk wrote:committed to trunk. tell me if you have any issues with it!
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: myk's code contributions
by Max mtg » 31 Jan 2013, 11:38
That's wrong.myk wrote:- added a templated Pair<T, V> utility class for ad-hoc two-value parameter returning
There are already such classes:
- Code: Select all
org.apache.commons.lang3.tuple.ImmutablePair<L, R>
org.apache.commons.lang3.tuple.MutablePair<L, R>
- Code: Select all
org.apache.commons.lang3.tuple.Pair<L, R>
- Code: Select all
java.util.Map.Entry<K, V>
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
Re: myk's code contributions
by myk » 31 Jan 2013, 16:25
tuple.Pair is exactly what I was looking for. Thanks! Fixed in r19310.
Chris: I play tested moving the add buttons below the search bar, but it seemed I was racking up more "mouse mileage" than having it the other way around. Moreover, the modifications to the UI that the spell shop makes would look strange (IMHO) if they were below the search bar and the restriction markers. I'd kind of like to get it out to users and start cataloging some user opinions before I make too many more changes.
Chris: I play tested moving the add buttons below the search bar, but it seemed I was racking up more "mouse mileage" than having it the other way around. Moreover, the modifications to the UI that the spell shop makes would look strange (IMHO) if they were below the search bar and the restriction markers. I'd kind of like to get it out to users and start cataloging some user opinions before I make too many more changes.
- myk
- Posts: 439
- Joined: 17 Jan 2013, 02:39
- Location: California
- Has thanked: 38 times
- Been thanked: 57 times
Re: myk's code contributions
by Chris H. » 31 Jan 2013, 20:46
myk wrote:Chris: I play tested moving the add buttons below the search bar, but it seemed I was racking up more "mouse mileage" than having it the other way around. Moreover, the modifications to the UI that the spell shop makes would look strange (IMHO) if they were below the search bar and the restriction markers. I'd kind of like to get it out to users and start cataloging some user opinions before I make too many more changes.
Ah, sounds good to me.

myk wrote:At this point, I'm just making minor adjustments and adding bits of functionality here and there as I play test the changes. Is there anything specific you think needs to be done before a release?
Just for the heck of it I minimized the forge window down to 800 x 600 pixels. Some things are being drawn outside of the panels. The previous deck editor had similar issues.
Not sure how to handle this one. Might make sense to move the panels around until we get a layout that is friendly to small sized displays. Or we can just let people move them around themselves.
-
Chris H. - Forge Moderator
- Posts: 6320
- Joined: 04 Nov 2008, 12:11
- Location: Mac OS X Yosemite
- Has thanked: 644 times
- Been thanked: 643 times
Who is online
Users browsing this forum: No registered users and 7 guests