Re: [API Review]: Node validation

2013-07-15 Thread Martin Sladecek
Sounds like a plan. I'll retarget RT-31133 ("validate") to Van Ness in case it would be required later. I will change the layout processing so that it uses flags instead of dirty root lists. That way, getRoot().layout() will trigger a complete layout pass or both Scenes and SubScenes. Means

Re: [API Review]: Node validation

2013-07-12 Thread Richard Bair
I'm thinking applyCSS would just call impl_processCSS(true) and then we should work towards removing impl_processCSS(boolean) if possible, so that we're all just using applyCSS() all the time (once impl_processCSS(boolean) can be removed and all bugs sorted out, then we could just move impl_proc

Re: [API Review]: Node validation

2013-07-12 Thread David Grieve
There is Node#impl_processCSS() that is the normal css processing path (Scene#doCSSPass -> Node#processCSS -> Node#impl_processCSS() -> CssStyleHelper#transitionToState) . impl_processCSS(boolean) was left in because it is a way of forcing the reapply in cases where CSS was needed to be process

Re: [API Review]: Node validation

2013-07-12 Thread Richard Bair
My thought was that applyCSS could for now just call impl_processCSS(true) -- so it is "Thor's Hammer" and will just hammer everything to be updated. Not necessarily fast. Then in subsequent releases we could maybe tune it up. Do we *need* the boolean? I know it is sometimes false (TreeView, Tab

Re: [API Review]: Node validation

2013-07-12 Thread David Grieve
I hesitate to mention Node#impl_processCSS(boolean) which is very very close to your notion of applyCss(); impl_processCSS(boolean) is a thorn in my side, but is used in certain places in controls code to ensure CSS is applied before layout in order to ascertain a node's dimensions. What it doe

Re: [API Review]: Node validation

2013-07-12 Thread Richard Bair
>> Is there any reason why I might want to measure a node independent of the >> layout of its parent? If I have a Button in a StackPane, is there a time I >> might want to measure the Button independent of the StackPane? I suppose so, >> if for example I wanted to get snapshots of it at its min

Re: [API Review]: Node validation

2013-07-12 Thread Richard Bair
> The thing is that in order to compute the layout correctly, you have to start > from the layout root. I think where you start the computation from depends on what you are trying to do. I think that "validate" or whatever we would call it would just be a convenient wrapper that did whatever w

Re: [API Review]: Node validation

2013-07-12 Thread Martin Sladecek
On 07/12/2013 04:49 PM, Richard Bair wrote: The thing is that in order to compute the layout correctly, you have to start from the layout root. I think where you start the computation from depends on what you are trying to do. I think that "validate" or whatever we would call it would just be

Re: [API Review]: Node validation

2013-07-12 Thread Martin Sladecek
The thing is that in order to compute the layout correctly, you have to start from the layout root. The concept of layout roots is not documented well in the API ( we use the term in few place, but never define it) and people would have to know how to identify the layout root and also know that

Re: [API Review]: Node validation

2013-07-12 Thread steve . x . northover
I don't agree. It's pretty clear that when you call applyCSS(), then CSS is applied. The rest of the JFX API works exactly as expected and as documented. The programmer has precise control over what happens, when it happens and where it happens. Can you summarize what "validate" does? Is i

Re: [API Review]: Node validation

2013-07-12 Thread Martin Sladecek
What you suggest would be quite hard to use. Actually I think most of the developers will not know how to use it properly in order to get the right measurement. Simple "validate" call would be more convenient and less error-prone. -Martin On 07/12/2013 12:02 AM, steve.x.northo...@oracle.com wr

Re: [API Review]: Node validation

2013-07-11 Thread steve . x . northover
I don't think I understand the answer. Are you saying that what we are suggesting is wrong conceptually or hard to implement or ...? Steve On 11/07/2013 1:23 PM, Martin Sladecek wrote: No, I will change the dirty roots to dirty flags on every node. With them, it's possible to use it the way y

Re: [API Review]: Node validation

2013-07-11 Thread Martin Sladecek
No, I will change the dirty roots to dirty flags on every node. With them, it's possible to use it the way you suggest (applyCSS & layout on nearest layout root), but it's much more convenient if we could identify the layout root of the subtree and apply the layout from there downwards. I think

Re: [API Review]: Node validation

2013-07-11 Thread Richard Bair
>> This might work for CSS, but won't for layout. The second example won't work >> because you'd just do layout of the node itself. It might get a different >> size from it's parent during the next layout pass (and the parent from it's >> parent, etc...). So the layout will look different after

Re: [API Review]: Node validation

2013-07-11 Thread steve . x . northover
On 11/07/2013 3:16 AM, Martin Sladecek wrote: This might work for CSS, but won't for layout. The second example won't work because you'd just do layout of the node itself. It might get a different size from it's parent during the next layout pass (and the parent from it's parent, etc...). So t

Re: [API Review]: Node validation

2013-07-11 Thread Martin Sladecek
This might work for CSS, but won't for layout. The second example won't work because you'd just do layout of the node itself. It might get a different size from it's parent during the next layout pass (and the parent from it's parent, etc...). So the layout will look different after the next pu

Re: [API Review]: Node validation

2013-07-10 Thread steve . x . northover
Hi Martin, How about exposing the concept of applying CCS to the programmer? Let's say we add applyCSS() that does exactly what it says (applies CSS when called). Here are a few use cases: 1) Positioning a popup: node.applyCSS() node.autosize(); // width and height are now vali

Re: [API Review]: Node validation

2013-07-09 Thread Martin Sladecek
On 07/09/2013 10:59 PM, David Grieve wrote: Since there is already a "requestLayout()" which defers to the next pulse, what about "demandLayout()"? Or why can't getBoundsInParent() or getBoundsInLocal() do this? Even with this function, there is still the problem where the dimensions of a nod

Re: [API Review]: Node validation

2013-07-09 Thread Martin Sladecek
+1 -Martin On 07/09/2013 05:06 PM, Pavel Safrata wrote: To me this sounds best so far. Perhaps updateVisuals() would be even better? Pavel On 8.7.2013 18:45, Scott Palmer wrote: validateVisuals() ? Or something with the word "visual" as it combines layout and other CSS information. Scott

Re: [API Review]: Node validation

2013-07-09 Thread Tom Schindl
On 09.07.13 22:59, David Grieve wrote: > Since there is already a "requestLayout()" which defers to the next pulse, > what about "demandLayout()"? then I would go for forceLayout() Tom

Re: [API Review]: Node validation

2013-07-09 Thread David Grieve
Since there is already a "requestLayout()" which defers to the next pulse, what about "demandLayout()"? Or why can't getBoundsInParent() or getBoundsInLocal() do this? Even with this function, there is still the problem where the dimensions of a node won't be right if called before the node is

Re: [API Review]: Node validation

2013-07-09 Thread Pavel Safrata
To me this sounds best so far. Perhaps updateVisuals() would be even better? Pavel On 8.7.2013 18:45, Scott Palmer wrote: validateVisuals() ? Or something with the word "visual" as it combines layout and other CSS information. Scott On Mon, Jul 8, 2013 at 12:31 PM, Richard Bair wrote: OK, j

Re: [API Review]: Node validation

2013-07-08 Thread Martin Sladecek
I think there would be a problem with property invalidation at least. A property (like layoutBounds or any property set by CSS) would change on get() although there was no invalidation notification (unless we'd invalidate all affected properties on CSS/layout change - but most of them would NOT

Re: [API Review]: Node validation

2013-07-08 Thread Martin Sladecek
On 07/08/2013 06:29 PM, Richard Bair wrote: But that is by far not the only thing the method will do. It will also make sure all the CSS properties are applied. For example you can see what the background of a Region will be, or any other property that can be set from CSS. You are right, it's

Re: [API Review]: Node validation

2013-07-08 Thread Richard Bair
So this was also my first desire. I wanted to actually make it so that nobody would ever have to invoke a CSS pass manually, but instead we would just do it lazily on first request as needed. If this is possible then we can only think of the layout problem in isolation. In this case, just reusin

Re: [API Review]: Node validation

2013-07-08 Thread David Grieve
I'm wondering why this "validate" can't just be implicit in any call that uses or returns layout bounds. Surely we can tell from the dirty bits whether or not something needs layout and/or css. On Jul 8, 2013, at 12:31 PM, Richard Bair wrote: > OK, just throwing something wild out there. Right

Re: [API Review]: Node validation

2013-07-08 Thread Ali Ebrahimi
I say validate should also not change state, otherwise computeBounds would be better name for method. Consider validate in input validation. On Mon, Jul 8, 2013 at 8:57 PM, Scott Palmer wrote: > Since CSS is implicitly tied to layout, validateLayout() seems to be > enough. > > I don't like "ver

Re: [API Review]: Node validation

2013-07-08 Thread Scott Palmer
validateVisuals() ? Or something with the word "visual" as it combines layout and other CSS information. Scott On Mon, Jul 8, 2013 at 12:31 PM, Richard Bair wrote: > OK, just throwing something wild out there. Right now we have a layout > pass and a css pass. Can they be combined? Can we combin

Re: [API Review]: Node validation

2013-07-08 Thread Richard Bair
But that is by far not the only thing the method will do. It will also make sure all the CSS properties are applied. For example you can see what the background of a Region will be, or any other property that can be set from CSS. Is the reason you want to avoid validateLayoutAndCSS is that it mi

Re: [API Review]: Node validation

2013-07-08 Thread Richard Bair
OK, just throwing something wild out there. Right now we have a layout pass and a css pass. Can they be combined? Can we combine them just into something that happens during layout? And can the existing "layout()" method be the thing that kicks it all off? Wild and crazy but just throwing it ou

Re: [API Review]: Node validation

2013-07-08 Thread Scott Palmer
Since CSS is implicitly tied to layout, validateLayout() seems to be enough. I don't like "verify" or "check" - To me, these imply a method that is doing checks only and not changing state. A "verify" method would be something that returns a boolean or throws an exception. Scott On Mon, Jul 8,

Re: [API Review]: Node validation

2013-07-08 Thread Mario Torre
On Mon, 2013-07-08 at 14:20 +0200, Martin Sladecek wrote: > The plan is to have a final validate() method. > Anyway, does anybody have a better suggestion? The validate should do > both CSS and layout and I would like to avoid method name that's too > descriptive (like validateLayoutAndCSS()) if

Re: [API Review]: Node validation

2013-07-08 Thread Ali Ebrahimi
just my suggestions: validation is a side effect free concept. but your validate contains css & layout processing for Node, so validate is very poor name in this case. May be better use computeBounds instead. But alternates for validate( if method is a side effect free): verify() verfifyNode() ve

Re: [API Review]: Node validation

2013-07-08 Thread Martin Sladecek
The plan is to have a final validate() method. Anyway, does anybody have a better suggestion? The validate should do both CSS and layout and I would like to avoid method name that's too descriptive (like validateLayoutAndCSS()) if possible. I think the most important thing about the method is th

RE: [API Review]: Node validation

2013-07-08 Thread John C. Turnbull
x-dev-boun...@openjdk.java.net] On Behalf Of Pavel Safrata Sent: Monday, 8 July 2013 21:21 To: openjfx-dev@openjdk.java.net Subject: Re: [API Review]: Node validation Hello, one more discussion topic: perhaps the "validate" name is too general? Maybe we can come up with more descriptive name? There ar

Re: [API Review]: Node validation

2013-07-08 Thread Anthony Petrov
+1 The validate()/isValid() in AWT/Swing are often overridden by user apps for tasks that have nothing to do with the layout. And this causes a lot of problems. -- best regards, Anthony On 07/08/13 15:20, Pavel Safrata wrote: Hello, one more discussion topic: perhaps the "validate" name is

Re: [API Review]: Node validation

2013-07-08 Thread Pavel Safrata
Hello, one more discussion topic: perhaps the "validate" name is too general? Maybe we can come up with more descriptive name? There are all kinds of nodes and sometimes this name can be misleading (not ringing the layout bell at all). For example TextField.validate() may look like validating

Re: [API Review]: Node validation

2013-07-03 Thread Martin Sladecek
Without tests, there are actually only 2 in graphics (Parent, Text) and 2 in controls (XYChart). XYChart seems to invoke the layout of both axes during the layout of the chart. Not sure if this is necessary. The layout() method of children should be normally called after the layoutChildren() of

Re: [API Review]: Node validation

2013-07-03 Thread Richard Bair
Why does layout() need to be deprecated? Find Usages from IntelliJ reports 481 usages (139 in controls 2 in designTime, 339 in Graphics, including tests and such). We should only deprecate the method if it should not be used anymore by anybody for any reason, in which case we need to replace all

Re: [API Review]: Node validation

2013-07-03 Thread Phil Race
I think SceneBuilder would like this, and I know printing would love it :-) -phil. On 7/3/13 7:03 AM, Kevin Rushforth wrote: +1 This would allow apps to dispense with the following workaround when taking a snapshot: // create a dummy scene so layout and CSS will work new Scene(new Gro

Re: [API Review]: Node validation

2013-07-03 Thread Kevin Rushforth
+1 This would allow apps to dispense with the following workaround when taking a snapshot: // create a dummy scene so layout and CSS will work new Scene(new Group(node)); node.shapshot(...) -- Kevin David Grieve wrote: Hi Martin, With regard to having this work without a Scene…

Re: [API Review]: Node validation

2013-07-03 Thread Martin Sladecek
Thank you David for your insight. You are right with the use-case for scene-less layoutbounds query, but I think this is a completely different API, so I'd leave the validate to support only the cases where a Scene is present. -Martin On 07/03/2013 03:23 PM, David Grieve wrote: Hi Martin, W

Re: [API Review]: Node validation

2013-07-03 Thread David Grieve
Hi Martin, With regard to having this work without a Scene… I think having a method that would layout a node without the node actually having to be part of the scene-graph would be _very_ useful. Often times, developers will do the show-hide trick or add-remove trick to get a node's bounds be

[API Review]: Node validation

2013-07-03 Thread Martin Sladecek
Hi, JIRA: https://javafx-jira.kenai.com/browse/RT-31133 I propose a single method "public final void validate()" to be added to Node class. The validate method would ensure that the metrics (layout bounds) of the Node are valid with regards to the current scenegraph (CSS & layout). Together