AdamBien / afterburner.fx

The Opinionated Un-Framework For Java FX Applications
http://afterburner.adam-bien.com
279 stars 82 forks source link

-Default Style- similar to -Default Locale- #9

Open aliebelt opened 10 years ago

aliebelt commented 10 years ago

Hi Adam,

I'm currently integrating afterburner.fx in our R&D software front-end for energy-management (virtual power plant).

We use this front-end in different R&D projects which have different CI colors, fonts and so forth. But this is an issue in many other cases (E.g. use different skins depending on OS or User-Role and so forth)

The basic idea is similar to the -Default Locale- and the properties-files: -> There are parameters affecting the View. -> But in contrast to changing the label-text based on the language via properties-files the skin is changed via css-stylesheet(s).

It would be nice, if afterburner.fx would provide skinning via css similar to internationalization via properties.

This maybe could be realized as follows:

-> Set the default style via a style-code (e.g. "custom1") for the whole VM: [new method] public static void FXMLView.setDefaultStyle(String styleCode)

-> When reading the stylesheet-name this style-code is added (resulting filename e.g. "myclazz.css" if no custom default style was set or "myclazz_custom1.css" if style-code is "custom1"): [changed method] getStyleSheetName() return getConventionalName(getStyleSheetNameSuffix() + ".css");

A package-content could now look like as follows: MyClazzView.java MyClazzPresenter.java myclazz.css myclazz_custom1.css myclazz.fxml myclazz.properties myclazz_de.properties

AdamBien commented 10 years ago

Styling is a very good idea. I'm going to think about skins / styles a bit more. Is a good feature for next version :-)