For example you are independent developer who created a custom component "BaseComponent" that contains only AnchorPane with an empty css class "external".
I'm another developer who created my custom component "SuperComponent", that contains 2 BaseComponent's "One" , "Two", with classes "background" , and "foreground". A SuperComponent.css style class looks like:
And as you can see , i used a "background" class name, that's very common.
A third employee inserts SuperComponent to his big project. And he has already defined css class
Because SuperComponent has only empty class "background" it applies a red background to it, that wasn't expected to.
So how can i encapsulate SuperComponent .background class of being overriten outside?
I'v tried to add another class for each component "One" and "Two", and make css like :
That not helped. A third employee css
overrides it again.
I'v tried to set a root class of my SuperComponent and make css like:
Also not helped.
I'v found only 2 ways of doing that, non of them i liked:
1) Rename my background class to "supercomponent-background", but this is nonsense, because for my point i'm already in supercomponent.css and operating my "unique" .background class
2) Override all properties for .background class. This is also meaningless, because i need to overrite EVERY -fx-property.
Please explain how to properly get out of the situation.
These are not the droids you are looking for. Perhaps I can interest you in a tiny ad?