kba / lanterna

Automatically exported from code.google.com/p/lanterna
GNU Lesser General Public License v3.0
0 stars 0 forks source link

Change Theme.Category to interface #92

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
This would allow us to define our own categories for e.g. custom components or 
to define styles in custom themes for components.

For example:

Theme myTheme;
myTheme.setDefinition( MY_CATEGORY, new MyCustomDefinition() );

Label myLabel;
myLabel.setStyle( MY_CATEGORY );

Interface definition could be:

public interface Category {
    public String name();
}

which would allow in Theme.java something like:

enum CoreCategory implements Category {
    ... nothing to change here ...
}

The EnumMap for Category->Definition could be changed into an IdentityHashMap.

Original issue reported on code.google.com by f.bant...@axon-e.eu on 25 Nov 2013 at 10:24

GoogleCodeExporter commented 9 years ago
Alternatively one could name the interface in e.g. CategoryI and leave the 
enum's name as it is. This wouldn't break most of the userland code and reduce 
refactoring the existing codebase.

Original comment by f.bant...@axon-e.eu on 25 Nov 2013 at 10:38

GoogleCodeExporter commented 9 years ago
Yes, the current way theming works was something I put in there quickly. The 
next version of lanterna will have a completely re-written theme system that 
doesn't rely on any enum constants.

Original comment by mab...@gmail.com on 1 Dec 2013 at 1:51