• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

Make css class "private"

Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.

Could you hold this puppy for a sec? I need to adjust this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic