metsci/glimpse — Issue #1: Allow Adjustment of Painter Ordering
Author: ulmangt
Created: 2012-03-08 21:12:29+00:00
State: open

Currently, GlimpseLayouts paint their painter on a "first in, first painted" basis. However, this makes it impossible to swap one painter for another, retaining the relative ordering of all the other painters. (Well, not impossible, the current workaround is to use a [DelegatePainter](https://github.com/metsci/glimpse/blob/master/core/src/main/java/com/metsci/glimpse/painter/group/DelegatePainter.java) to hold the place for the painter).

This could be avoided by adding an integer "ordering value" similar to the way [JLayeredPane](http://docs.oracle.com/javase/1.5.0/docs/api/javax/swing/JLayeredPane.html) works. Objects with the same order would be still be drawn "first in, first painter" allowing backwards compatibility.

This would greatly simplify customization of many of the [com.metsci.glimpse.plot](https://github.com/metsci/glimpse/tree/master/core/src/main/java/com/metsci/glimpse/plot) classes. Currently, one has to override the protected `createXXXX()` methods in order to modify painters for the various built-in plot decorations. This fix would allow that to change to a more standard public setter method `setXXXXPainter( GlimpsePainter painter )`. Note: this could (and should) be done such that the prior override method still works.

The prebuild Glimpse plots also currently customize Axes, MouseListeners and other non-painter settings using this protected method method. This should also be changed, although the issues are different.