I plan to improve SectionPainters API in next update. These painters are used in some complex components like JTree to paint some specific areas. For instance JTree has whole 5 section painters - rowPainter, nodePainter, selectionPainter, dropLocationPainter and selectorPainter.
They're used if specified in the style, here is the default tree style:
It uses 4 out of 5 available SectionPainters by default.
The improvement I'm going to make is basically a streamlined API for these section painters. Right now they are defined directly in parent Painter implementation, for instance in TreePainter for JTree. Each separate SectionPainter has it's own custom API and has to be approached differently because of that. There are also some internal issues with SectionPainter implementations performing a lot of unnecessary actions.
First thing that needs to be introduced is a Section interface that can be implemented for each separate section each component/painter can provide and which can then be used by a new streamlined API of SectionPainter.
Each Section implementation should be able to provide:
Unique identifier (or type) - it will be used in style to attach added section painter to a particular component section - for instance node for tree node background painter
Bounds to be used by the SectionPainter - will simply provide bounds that are currently passed by Painter to it's section painters directly
States to be used by section decoration - currently these are provided within each separate SectionPainter implementation, but those are often identical between some sections and sometimes it's simply inconvenient to retrieve them there
Some other options might also be available in the API, like SectionPainter default or base class
Also something like SectionParameters interface might be required to separate Section from actual data used for bounds/states calculation for each particular case.
Next all currently available section painters will be replaced with the new streamlined approach, both in the code and the style, for instance <nodePainter> will be replaced with:
Where node type is the identifier of TreePainter section.
This is just an early stage idea, but I will be working on it in v1.2.12 update since it will allow me to improve quite a few things internally and also slightly improve UI performance.
I plan to improve
SectionPainter
s API in next update. These painters are used in some complex components likeJTree
to paint some specific areas. For instanceJTree
has whole 5 section painters -rowPainter
,nodePainter
,selectionPainter
,dropLocationPainter
andselectorPainter
.They're used if specified in the style, here is the default
tree
style:It uses 4 out of 5 available
SectionPainter
s by default.The improvement I'm going to make is basically a streamlined API for these section painters. Right now they are defined directly in parent
Painter
implementation, for instance inTreePainter
forJTree
. Each separateSectionPainter
has it's own custom API and has to be approached differently because of that. There are also some internal issues withSectionPainter
implementations performing a lot of unnecessary actions.First thing that needs to be introduced is a
Section
interface that can be implemented for each separate section each component/painter can provide and which can then be used by a new streamlined API ofSectionPainter
.Each
Section
implementation should be able to provide:node
for tree node background painterSectionPainter
- will simply provide bounds that are currently passed byPainter
to it's section painters directlySectionPainter
implementation, but those are often identical between some sections and sometimes it's simply inconvenient to retrieve them thereSectionPainter
default or base classAlso something like
SectionParameters
interface might be required to separateSection
from actual data used for bounds/states calculation for each particular case.Next all currently available section painters will be replaced with the new streamlined approach, both in the code and the style, for instance
<nodePainter>
will be replaced with:Where
node
type is the identifier ofTreePainter
section.This is just an early stage idea, but I will be working on it in v1.2.12 update since it will allow me to improve quite a few things internally and also slightly improve UI performance.