ChangeScreen2: Make the selected tab stay

On the right of ChangeScreen2 there is a TabPanel with tabs containing
changes related to the currently displayed change. Each tab has a
subject, for example "Related Changes" for ordinarily related changes
and "Same Topic" for changes with the same topic. The "Related Changes"
tab is the one that's shown by default if ordinarily related changes
exist.

Suppose that you want to look around in the changes of one topic and use
the "Same Topic" tab for that. The old behaviour is that each time you
select a change in a tab, that change will be opened in a ChangeScreen2
and the selected tab in that newly opened screen is the default tab,
"Related Changes". That's quite annoying, because when want to continue
browsing changes of the same topic, you have to select the "Same Topic"
tab again.

Therefore add a static variable where the last opened tab is saved and
then selected when opening another change.

You might wonder what happens if you open a change from a related
changes tab in a different browser tab. (Or you might not if you know
more about JavaScript and GWT than me.) If you open a change in a new
browser tab, the default "Related Changes" tab is selected if there are
ordinarily related changes. (So it's like the old behaviour.) That's
because a new tab is something like an independent instance of the
application, I guess.

I put the selecting of the saved tab into
RelatedChanges.TabCallback.onDone(), because I couldn't find another
place on initialisation where the tabs are enabled and therefore could
be selected. I thought about whether to merge selecting tabs with the
other slightly obscure code in that method rather than just appending
it, but I think I don't understand the implications well enough.

I also considered saving the tab as an int like it is done in the field
selectedTab. However, saving it as a Tab conveys more meaning and I
don't need a -1 value for my purposes.

Bug: issue 3007
Change-Id: If7ca7e56a80894b720e44fc378763b961e212d88
2 files changed