Re: [API Review]: Add margin property to node and make it styleable from CSS

2013-06-11 Thread Tom Eugelink


I know I'm reiterating, but just to keep the point alive; personally I would 
still prefer to have such information placed in an explicit layout constraint 
class.

node.setMargin(x); layout.getChildren().add(node);
vs
layout.add(node, new Constraint().margin(x));

It also prevents the Node class from bloating.




On 2013-06-11 14:47, Martin Sladecek wrote:

Hi,

JIRA issue: https://javafx-jira.kenai.com/browse/RT-27785
This API change is about adding marginProperty() to Node that would be then 
used by layout Panes instead of the current constraints (static methods 
getMargin/setMargin). The getMargin/setMargin on these Panes will just delegate 
to the property.

Unfortunately, it's not possible to update Region.layoutInArea and 
Region.positionInArea methods to use child.getMargin() internally, as there's 
an overloaded method (in both cases) that already doesn't have Margin in it's 
parameters and uses Insets.EMPTY instead. Changing this to child.getMargin() 
might cause backward incompatibility issues.

Thanks,
-Martin





Re: [API Review]: Add margin property to node and make it styleable from CSS

2013-06-11 Thread Martin Sladecek

On 06/11/2013 03:01 PM, Tom Eugelink wrote:


I know I'm reiterating, but just to keep the point alive; personally I 
would still prefer to have such information placed in an explicit 
layout constraint class.


node.setMargin(x); layout.getChildren().add(node);
vs
layout.add(node, new Constraint().margin(x));

It also prevents the Node class from bloating.


Means new *Constraint class and new add method for each layout *Pane 
class. Also one of the nice side-effects of having this as a property is 
that we can style it using -fx-margin CSS property.


Regards,
-Martin


Re: [API Review]: Add margin property to node and make it styleable from CSS

2013-06-11 Thread Tom Eugelink


On 2013-06-11 15:36, Martin Sladecek wrote:

Means new *Constraint class and new add method for each layout *Pane class. Also one of 
the nice side-effects of having this as a property is that we can style it using 
-fx-margin CSS property.


Yup, constraint classes with values that are relevant for / supported by the 
used layout. The one layout may support totally different layout parameters 
than another. By adding this to the node, basically all layout must be modified 
to support this.

Tom