Add getters for all style properties

For consistency and because now we have some use cases for it.
This commit is contained in:
Lucas Rocha
2015-10-21 10:37:09 +01:00
parent 8f7632bc7f
commit eb1d1726b9

View File

@@ -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) { public void setFlexDirection(CSSFlexDirection flexDirection) {
if (style.flexDirection != flexDirection) { if (style.flexDirection != flexDirection) {
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) { public void setJustifyContent(CSSJustify justifyContent) {
if (style.justifyContent != justifyContent) { if (style.justifyContent != justifyContent) {
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) { public void setAlignItems(CSSAlign alignItems) {
if (style.alignItems != alignItems) { if (style.alignItems != alignItems) {
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) { public void setAlignSelf(CSSAlign alignSelf) {
if (style.alignSelf != alignSelf) { if (style.alignSelf != alignSelf) {
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) { public void setPositionType(CSSPositionType positionType) {
if (style.positionType != positionType) { if (style.positionType != positionType) {
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) { public void setFlex(float flex) {
if (!valuesEqual(style.flex, flex)) { if (!valuesEqual(style.flex, flex)) {
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) { public void setMargin(int spacingType, float margin) {
if (style.margin.set(spacingType, margin)) { if (style.margin.set(spacingType, margin)) {
dirty(); 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) { public void setBorder(int spacingType, float border) {
if (style.border.set(spacingType, border)) { if (style.border.set(spacingType, border)) {
dirty(); dirty();
} }
} }
/**
* Get this node's position top, as defined by style.
*/
public float getPositionTop() {
return style.position[POSITION_TOP];
}
public void setPositionTop(float positionTop) { public void setPositionTop(float positionTop) {
if (!valuesEqual(style.position[POSITION_TOP], positionTop)) { if (!valuesEqual(style.position[POSITION_TOP], positionTop)) {
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) { public void setPositionBottom(float positionBottom) {
if (!valuesEqual(style.position[POSITION_BOTTOM], positionBottom)) { if (!valuesEqual(style.position[POSITION_BOTTOM], positionBottom)) {
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) { public void setPositionLeft(float positionLeft) {
if (!valuesEqual(style.position[POSITION_LEFT], positionLeft)) { if (!valuesEqual(style.position[POSITION_LEFT], positionLeft)) {
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) { public void setPositionRight(float positionRight) {
if (!valuesEqual(style.position[POSITION_RIGHT], positionRight)) { if (!valuesEqual(style.position[POSITION_RIGHT], positionRight)) {
style.position[POSITION_RIGHT] = positionRight; style.position[POSITION_RIGHT] = positionRight;