From eb1d1726b9e7bda2480e25de62f6588f9c667b5e Mon Sep 17 00:00:00 2001 From: Lucas Rocha Date: Wed, 21 Oct 2015 10:37:09 +0100 Subject: [PATCH] Add getters for all style properties For consistency and because now we have some use cases for it. --- .../src/com/facebook/csslayout/CSSNode.java | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/src/java/src/com/facebook/csslayout/CSSNode.java b/src/java/src/com/facebook/csslayout/CSSNode.java index 27d104e8..cc74884f 100644 --- a/src/java/src/com/facebook/csslayout/CSSNode.java +++ b/src/java/src/com/facebook/csslayout/CSSNode.java @@ -228,6 +228,13 @@ public class CSSNode { } } + /** + * Get this node's flex direction, as defined by style. + */ + public CSSFlexDirection getFlexDirection() { + return style.flexDirection; + } + public void setFlexDirection(CSSFlexDirection flexDirection) { if (style.flexDirection != flexDirection) { style.flexDirection = flexDirection; @@ -235,6 +242,13 @@ public class CSSNode { } } + /** + * Get this node's justify content, as defined by style. + */ + public CSSJustify getJustifyContent() { + return style.justifyContent; + } + public void setJustifyContent(CSSJustify justifyContent) { if (style.justifyContent != justifyContent) { style.justifyContent = justifyContent; @@ -242,6 +256,13 @@ public class CSSNode { } } + /** + * Get this node's align items, as defined by style. + */ + public CSSAlign getAlignItems() { + return style.alignItems; + } + public void setAlignItems(CSSAlign alignItems) { if (style.alignItems != alignItems) { style.alignItems = alignItems; @@ -249,6 +270,13 @@ public class CSSNode { } } + /** + * Get this node's align items, as defined by style. + */ + public CSSAlign getAlignSelf() { + return style.alignSelf; + } + public void setAlignSelf(CSSAlign alignSelf) { if (style.alignSelf != alignSelf) { style.alignSelf = alignSelf; @@ -256,6 +284,13 @@ public class CSSNode { } } + /** + * Get this node's position type, as defined by style. + */ + public CSSPositionType getPositionType() { + return style.positionType; + } + public void setPositionType(CSSPositionType positionType) { if (style.positionType != positionType) { style.positionType = positionType; @@ -270,6 +305,13 @@ public class CSSNode { } } + /** + * Get this node's flex, as defined by style. + */ + public float getFlex() { + return style.flex; + } + public void setFlex(float flex) { if (!valuesEqual(style.flex, flex)) { style.flex = flex; @@ -277,6 +319,13 @@ public class CSSNode { } } + /** + * Get this node's margin, as defined by style + default margin. + */ + public Spacing getMargin() { + return style.margin; + } + public void setMargin(int spacingType, float margin) { if (style.margin.set(spacingType, margin)) { dirty(); @@ -289,12 +338,26 @@ public class CSSNode { } } + /** + * Get this node's border, as defined by style. + */ + public Spacing getBorder() { + return style.border; + } + public void setBorder(int spacingType, float border) { if (style.border.set(spacingType, border)) { dirty(); } } + /** + * Get this node's position top, as defined by style. + */ + public float getPositionTop() { + return style.position[POSITION_TOP]; + } + public void setPositionTop(float positionTop) { if (!valuesEqual(style.position[POSITION_TOP], positionTop)) { style.position[POSITION_TOP] = positionTop; @@ -302,6 +365,13 @@ public class CSSNode { } } + /** + * Get this node's position bottom, as defined by style. + */ + public float getPositionBottom() { + return style.position[POSITION_BOTTOM]; + } + public void setPositionBottom(float positionBottom) { if (!valuesEqual(style.position[POSITION_BOTTOM], positionBottom)) { style.position[POSITION_BOTTOM] = positionBottom; @@ -309,6 +379,13 @@ public class CSSNode { } } + /** + * Get this node's position left, as defined by style. + */ + public float getPositionLeft() { + return style.position[POSITION_LEFT]; + } + public void setPositionLeft(float positionLeft) { if (!valuesEqual(style.position[POSITION_LEFT], positionLeft)) { style.position[POSITION_LEFT] = positionLeft; @@ -316,6 +393,13 @@ public class CSSNode { } } + /** + * Get this node's position right, as defined by style. + */ + public float getPositionRight() { + return style.position[POSITION_RIGHT]; + } + public void setPositionRight(float positionRight) { if (!valuesEqual(style.position[POSITION_RIGHT], positionRight)) { style.position[POSITION_RIGHT] = positionRight;