Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

Cliff Evan

Greenhorn
+ Follow
since Oct 06, 2018
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Cliff Evan

Hello.

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?

1)
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.


2)
I'v tried to set a root class of my SuperComponent and make css like:  


or



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.



1 year ago
Hello again.

I'm trying to make a swap animation of two cells in ListView<String>. The code looks like:


Everything works, except one thing. If cellMax is out from viewport  of ListView ( you need to scroll listview to see cellMax) then it's not rendered (or visible) when Transition changes cellMax.tranlateY.

I tried to do: cellMax.setVisible(true), cellMax.setOpacity(1) but nothing helped.

Don't know if that can help, but for cellMin in a debug:
LayoutFlag = CLEAN
Visible = BooleanProperty [bean: ListViewSkin$2@4a5c2efb[styleClass=cell indexed-cell list-cell]'book0', name: visible, value: true]

And for a cellMax (that located out of viewport) :
LayoutFlag = NEEDS_LAYOUT
Visible = null

How can i render cellMax, when it appear in viewport by Translating it's Y value? Or may be there is another way to swap two cells with a Transitions?

Big thanks for any help


1 year ago
Hello.

I created a FXML with fx:root construct and put on it for example ImageView image; The root AnchorPane has 500 x 500 dimension, and that image located in a center 250 x 250 and has width = 50 and height = 50. I can see all bounds and cooridnates in Scene Builder.
Then i need to do some calculation in a constructor based on image Width\Height and X, Y; But all of them are equals to zero.



As i understood all layouts are invalid until my component is placed into some other parent container of stage and after stage.show() method. But i need to do calculations based just on initial FXML of a component.
I found 2 ways.
The first is to surround them into Platform->runLater():

But i'm sure that this is a wrong approach, because i have to put all initialisation component logic (positioning, transitions and so on) inside that thread.

The second way is to create a method with that calculations and execute it after parent stage initialized    ShellForm.Shell.SOME_INIT_METHOD();


That also seems to be wrong, because i have to control initialization of component inner structure outside that component.


How can i get a correct dimensions of those "child" components in a constructor of my FXML component?
1 year ago
Hello.

I'm trying to create unique resizable interface on the transparent stage. 4 corner elements are perfoming resizing of the window.
I put them into AcnhorPane and wrote handlers (for test left top and right top):


but when i resize and change stage width the opposite elements are twiching\jiggling. The same behavior you can see in top right corner of Chrome Browser, when you resize it. https://youtu.be/JJI9z6hfHs4";" target="_new" rel="nofollow">Here you can see what's happening.
Can you give an advice how to avoid and "fix" that issue?
Thanks

1 year ago