Re: Event when CSS is applied

2015-02-18 Thread Tom Eugelink
(after a night's sleep) Well... I was trying to do things by composition and it did not work. My implemention worked, but it had to depend on a layoutChildren, only at the top level (Skin), which was not fine grained enough. Interesting is that for JFXtras Agenda I used the inherit pattern, bu

Re: Event when CSS is applied

2015-02-18 Thread Tomas Mikula
Hmm, my view is rather reverse to yours: The fact that the implementation of layout is best solved with inheritance is a sign that JavaFX does _not_ aim enough at doing things via composition. Tomas On Wed, Feb 18, 2015 at 4:37 PM, Tom Eugelink wrote: > > > On 18-2-2015 21:49, Tomas Mikula wrote

Re: Event when CSS is applied

2015-02-18 Thread Tom Eugelink
On 18-2-2015 21:49, Tomas Mikula wrote: So back to your original question: Basically I would like to be informed when the styling of a node has been applied or changed. Is there some place that can provide this information? Turns out you don't actually need this information ;) Indeed. P

Re: Event when CSS is applied

2015-02-18 Thread Tomas Mikula
So back to your original question: > Basically I would like to be informed when the styling of a node has been > applied or changed. Is there some place that can provide this information? Turns out you don't actually need this information ;) Regards, Tomas On Wed, Feb 18, 2015 at 3:20 PM, Tom

Re: Event when CSS is applied

2015-02-18 Thread Tom Eugelink
I like the improvements to the code. Thanks! Tom

Re: Event when CSS is applied

2015-02-18 Thread Tomas Mikula
On Wed, Feb 18, 2015 at 2:32 PM, Tom Eugelink wrote: > On 18-2-2015 08:34, Tomas Mikula wrote: >> >> What I think should be done is, instead of trying to hack around Pane, >> create class NeedlePane that extends Region and overrides >> layoutChildren. It would create its children in the constructo

Re: Event when CSS is applied

2015-02-18 Thread Tom Eugelink
On 18-2-2015 08:34, Tomas Mikula wrote: What I think should be done is, instead of trying to hack around Pane, create class NeedlePane that extends Region and overrides layoutChildren. It would create its children in the constructor (or take them as constructor parameters), add them to its childr

Re: Event when CSS is applied

2015-02-18 Thread Tomas Mikula
In case this information was buried in the previous email, maybe all you need to better understand the problem is that layout() works roughly* like this: public final void layout() { layoutChildren(); for(Node child: getChildren()) { child.layout(); } } layoutChildren() just r

Re: Event when CSS is applied

2015-02-18 Thread Tom Eugelink
On 18-2-2015 08:34, Tomas Mikula wrote: Hope this helps. I'll give it a try! Maybe it will solve some of the TBEERNOT (TODO) tags further down the code. Tom

Re: Event when CSS is applied

2015-02-17 Thread Tomas Mikula
OK, so the major problem I see is that a lot of layout is done outside layoutChildren, using code like this: needlePane = new Pane(); needlePane.widthProperty().addListener( (observable) -> { drawNeedlePane(); }); What I think should be done is, instead of trying to hack around Pane, create c

Re: Event when CSS is applied

2015-02-17 Thread Tom Eugelink
Sure! I'm very curious what can be done better. https://github.com/JFXtras/jfxtras-labs/blob/8.0/src/main/java/jfxtras/labs/internal/scene/control/skin/gauge/linear/SimpleMetroArcGaugeSkin.java You can also checkout the sources, you should be able to run SimpleMetroArcGaugeTrial1.java without an

Re: Event when CSS is applied

2015-02-17 Thread Tomas Mikula
Maybe if you can post the relevant part of your layoutChildren method so that others can look if they can suggest an improvement. Tomas On Tue, Feb 17, 2015 at 5:05 PM, Tom Eugelink wrote: > On 17-2-2015 20:01, David Grieve wrote: >> >> On 2/17/15 1:30 PM, Tom Eugelink wrote: >>> >>> The control

Re: Event when CSS is applied

2015-02-17 Thread Tom Eugelink
On 17-2-2015 20:01, David Grieve wrote: On 2/17/15 1:30 PM, Tom Eugelink wrote: The control is a codewise polish up one of Gerrit's gauges (with permission!) and pulled into JFXtras (with tests and all). For an idea on what we are talking about: https://www.youtube.com/watch?v=RH5X1uBu1d8 The

Re: Event when CSS is applied

2015-02-17 Thread Tom Eugelink
On 17-2-2015 19:55, Tomas Mikula wrote: Maybe I was misunderstood. I didn't suggest not doing it in layoutChildren. My conclusion was to keep doing it in layoutChildren and not worry about repositioning the text too often. No, I understood, just repositioning is ok, but I need to do all; scal

Re: Event when CSS is applied

2015-02-17 Thread David Grieve
On 2/17/15 1:30 PM, Tom Eugelink wrote: The control is a codewise polish up one of Gerrit's gauges (with permission!) and pulled into JFXtras (with tests and all). For an idea on what we are talking about: https://www.youtube.com/watch?v=RH5X1uBu1d8 The process of centering the Text in that ci

Re: Event when CSS is applied

2015-02-17 Thread Tomas Mikula
On Tue, Feb 17, 2015 at 1:30 PM, Tom Eugelink wrote: > The control is a codewise polish up one of Gerrit's gauges (with > permission!) and pulled into JFXtras (with tests and all). For an idea on > what we are talking about: > https://www.youtube.com/watch?v=RH5X1uBu1d8 > > The process of centerin

Re: Event when CSS is applied

2015-02-17 Thread Tom Eugelink
The control is a codewise polish up one of Gerrit's gauges (with permission!) and pulled into JFXtras (with tests and all). For an idea on what we are talking about: https://www.youtube.com/watch?v=RH5X1uBu1d8 The process of centering the Text in that circle is a bit more complex. 1. The value

Re: Event when CSS is applied

2015-02-17 Thread Tomas Mikula
Hi Tom, suppose you have such an event and can tell whether CSS of your Text has changed. But is changed CSS the only time you want to re-position the Text? I guess you also need to re-position it when the size of the parent changes. I imagine the logic for determining whether you need to re-posit

Re: Event when CSS is applied

2015-02-17 Thread Tom Eugelink
Registering to fontProperty works, but potentially requires a lot of listeners on every property that may affect the size, like effect, scale, etc. So I'm leaving it in layoutChildren for now; better once to many than not often enough. Would adding such an event be a big change? On 17-2-2015

Re: Event when CSS is applied

2015-02-17 Thread Tom Eugelink
needsLayoutProperty() is not available on Text, and I figure that on the container it in the end will call layoutChildren, which I'm using already. On 17-2-2015 14:24, Benjamin Gudehus wrote: Basically I would like to be informed when the styling of a node has been applied or changed. There

Re: Event when CSS is applied

2015-02-17 Thread David Grieve
On 2/17/15 8:02 AM, Tom Eugelink wrote: I have a skin (of a control) that centers a Text node. This Text node can be styled via CSS, so this styling is a factor when centering. because larger font means wider text. The centering works perfectly, the only problem is figuring out when to cente

Re: Event when CSS is applied

2015-02-17 Thread Benjamin Gudehus
>Basically I would like to be informed when the styling of a node has been >applied or changed. There are isNeedsLayout() and needsLayoutProperty() and they might give Node-based information whether the the layout and thus the styling was applied. I guess this might be true, since doCSSPass() is