The DeckView = when initialised = after editing the current deck in editor, tries to select it in the decklist view. However, at startup this won't be actually successful due to an un-initialised table model.
The issue only happens at startup time, and it is related to the fact that despite any selected item can be set (with the current Deck in editor) - see `populate` - the `update` method that initialise the (table)models is only called afterwards.
Therefore, the update method of Controller has been modified to re-try a selection with current deck in editor.
The whole procedure is skipped if the selected index is different from zero = assuming zero is the default fallback option.
If that's not the case, say the zero first deck should be indeed selected, the selected item shouldn't be activated twice anyway if that's exactly what's already been selected.
Deck model comparison may be triggered a certain number of times, and the new deep-comparison on each part may slow down performance in deck editor. Therefore, a caching strategy has been integrated to avoid comparing the same objects multiple times.
the loadDeck method now has a better handling of the deck (model) status, also wrt. the state of the UI editor.
If the deck is Stored, the editor will be in "modified - not saved" state.
This FIXES a bug causing the Deck Editor to not properly restore its state after saving a Deck and not originally in Main Decksection.
This commit also avoids repeating code and reset tables only if necessary.
.Dec files have collector nr//art-index as separated by a Pipe.
RegExps with collector numbers have been extended to further support decks in this format (with simply copy & paste the listing).
Tests updated/added to verify the new regexp & behaviour.
DeckImport now avoids including non-deck and metadata info in decklist as UnknownText, whilst any line that looks like a card request (i.e. includes a card quantity in the beginning) is interpreted as Unknown card.
This seems a good compromise with showing typo and any mispelling in card list whilst avoiding flooding decklist with unnecessary info.
This commit introduces major refactoring to code of Deck Import to extend support to all DeckRecognizer.Token types, as well as better-organised methods for message and status display. On this note, the CSS has been updated, along with decklist HTML which now leverages on HTML-table to display tokens and status messages separately and all well-aligned.
Card Preview has been also refined, with proper CSS classes and messages.
Finally, the HTML_WELCOME_TEXT now reflects the latest changes in translation file (e.g. included an additional example, and extra paragraph in Options)
Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
Now all cards displayed in cardpreview panel will automatically adapt to any change in the decklist.
That is, the panel will be reset only if current-displayed card is not in decklist anymore. In all other cases, the preview will adjust depending on the new token status, and/or whether the card is/was foiled!
Signed-off-by: leriomaggio <valeriomaggio@gmail.com>