Discussion:
[Freecol-developers] New Label package
Caleb Williams
2016-10-07 01:20:26 UTC
Permalink
Hey all:

In an effort reduce some of the bloat of the panel package
(net.sf.freecol.client.gui.panel), I have moved seven files having to do
with Labels (all implementing JLabel) into this a new label package
(..panel.label) as well as created a simple wrapper called FreeColLabel
that eventually will hold common parts of all Labels and eventually step
between JLabel and the rest of the contents of the label package.

This change has been fully tested via `ant testall` and with live game play
and no ill effects were found so far. The commit is available as [bd86a6] @
<
https://sourceforge.net/p/freecol/git/ci/bd86a60a4c61db8936f9d118fe82cde6cee74389/>
for your perusal.

I believe it's possible that splitting the panel package into at least one
other sub package for dialog-specific panels could help separate some
functionality, but this would be a larger move and one I wouldn't take
without a larger consensus of the dev community.

Thanks,

--
*Caleb R. Williams*
Michael T. Pope
2016-10-07 09:12:33 UTC
Permalink
On Thu, 6 Oct 2016 20:20:26 -0500
Caleb Williams <***@gmail.com> wrote:
> I believe it's possible that splitting the panel package into at least one
> other sub package for dialog-specific panels could help separate some
> functionality, but this would be a larger move and one I wouldn't take
> without a larger consensus of the dev community.

I have no problem with that, or the label move. However I do not touch
the GUI much if I can help it. The only thing I might have done
differently is to put label under gui rather than panel.

Cheers,
Mike Pope
Caleb Williams
2016-10-08 04:22:31 UTC
Permalink
>
> I have no problem with that, or the label move. However I do not touch
> the GUI much if I can help it. The only thing I might have done
> differently is to put label under gui rather than panel.
>

At this point, it looks like there are a few distinct groupings:

- Main Panel (base of most all imagery presented to the user) --
Generally extending MigPanel
- Colopedia Panels (not so many of these)
- Dialogs -- Generally extending JDialog
- Labels -- Generally extending JLabel/evenuatlly FreeColLabel
- Reports -- Generally extending ReportUnitPanel
- A couple of odds-and-ends that don't extend a common tree:
- Flag -- used by ConfirmDeclarationDialog
- LabourData -- really part of Reports
- MiniMap -- used by GUI and MapControls classes
- Parameters -- used by ParametersDialog and DetermineHighSeasAction
- PlayersTable -- used by StartGamePanel
- RebelToolTip -- used by ColonyPanel -> Population Panel
- ServerListTableModel -- goes with the ServerListPanel
- UnitButton -- extends JButton
- Utility -- used across the code base

Going my Mike's suggestion that would mean that moving some of the above of
groups and the odds-and-ends classes to something along the lines of
(existing packages stay where they are):

- gui
- dialog
- label
- panel
- report

I have no allegiance to putting label or any of these other proposed
sub-packages within panel or on the same level (under the gui package).

Thanks for your consideration,

--
*Caleb R. Williams*
w***@genial.ms
2016-10-08 08:06:40 UTC
Permalink
Hi,

over the time I thought several times about moving all dialog related stuff
into .gui.dialog, cause of the long list of classes contained within .gui.panel,
but was holding off, as there was other changes I imagined will be useful,
like over time removing uses of JDialog, as there had been those
longstanding bugs, you for sure remember, caused by FreeCol using dialogs in a
non-supported way, especially in fullscreen mode (but that is much more difficult).
So if you want move them it would help for now for easier navigation through
all those classes. Though I would keep the few little helpers in the same package
with the classes that use them.


Greetings,

wintertime


> Gesendet: Freitag, 07. Oktober 2016 um 11:12 Uhr
> Von: "Michael T. Pope" <***@computer.org>
> An: freecol-***@lists.sourceforge.net
> Betreff: Re: [Freecol-developers] New Label package
>
> On Thu, 6 Oct 2016 20:20:26 -0500
> Caleb Williams <***@gmail.com> wrote:
> > I believe it's possible that splitting the panel package into at least one
> > other sub package for dialog-specific panels could help separate some
> > functionality, but this would be a larger move and one I wouldn't take
> > without a larger consensus of the dev community.
>
> I have no problem with that, or the label move. However I do not touch
> the GUI much if I can help it. The only thing I might have done
> differently is to put label under gui rather than panel.
>
> Cheers,
> Mike Pope
Caleb Williams
2016-10-08 22:19:07 UTC
Permalink
After analyzing all files within the gui.panel package, I ended up with the
following structure (new packages in bold):


- gui
- action
- animation
- *dialog*
- *label*
- menu
- option
- panel
- *colopedia*
- *report*
- plaf
- *tooltip*
- video

I decided to split the panel into the two sub-panels as they are all based
on their own version of the FreeColPanel and grouping them makes sense.

The tooltip package probably wasn't really needed other to denote that
these are based off JToolTip, and not JPanel, JFrame, etc.

I did move the label down to gui as suggested above.

The dialog package and it's helpers were easiest the largest change.

I have fully tested ant, ant testall and ant javadoc for any errors and I
am able to play the latest git, so I'd call the move largely a successful
re-organization.

Thanks,

--
*Caleb R. Williams*
Loading...