public class ComponentPosition implements Serializable {
private int zIndex = -1;
- private float top = -1;
- private float right = -1;
- private float bottom = -1;
- private float left = -1;
+ private float topValue = -1;
+ private float rightValue = -1;
+ private float bottomValue = -1;
+ private float leftValue = -1;
private int topUnits;
private int rightUnits;
float v = Float.parseFloat(value);
int unitInt = parseCssUnit(unit);
if (key.equals("top")) {
- top = v;
+ topValue = v;
topUnits = unitInt;
} else if (key.equals("right")) {
- right = v;
+ rightValue = v;
rightUnits = unitInt;
} else if (key.equals("bottom")) {
- bottom = v;
+ bottomValue = v;
bottomUnits = unitInt;
} else if (key.equals("left")) {
- left = v;
+ leftValue = v;
leftUnits = unitInt;
}
}
public String getCSSString() {
String s = "";
- if (top >= 0) {
- s += "top:" + top + UNIT_SYMBOLS[topUnits] + ";";
+ if (topValue >= 0) {
+ s += "top:" + topValue + UNIT_SYMBOLS[topUnits] + ";";
}
- if (right >= 0) {
- s += "right:" + right + UNIT_SYMBOLS[rightUnits] + ";";
+ if (rightValue >= 0) {
+ s += "right:" + rightValue + UNIT_SYMBOLS[rightUnits] + ";";
}
- if (bottom >= 0) {
- s += "bottom:" + bottom + UNIT_SYMBOLS[bottomUnits] + ";";
+ if (bottomValue >= 0) {
+ s += "bottom:" + bottomValue + UNIT_SYMBOLS[bottomUnits] + ";";
}
- if (left >= 0) {
- s += "left:" + left + UNIT_SYMBOLS[leftUnits] + ";";
+ if (leftValue >= 0) {
+ s += "left:" + leftValue + UNIT_SYMBOLS[leftUnits] + ";";
}
if (zIndex >= 0) {
s += "z-index:" + zIndex + ";";
public void setTop(float topValue, int topUnits) {
validateLength(topValue, topUnits);
- top = topValue;
+ this.topValue = topValue;
this.topUnits = topUnits;
requestRepaint();
}
public void setRight(float rightValue, int rightUnits) {
validateLength(rightValue, rightUnits);
- right = rightValue;
+ this.rightValue = rightValue;
this.rightUnits = rightUnits;
requestRepaint();
}
public void setBottom(float bottomValue, int units) {
validateLength(bottomValue, units);
- bottom = bottomValue;
+ this.bottomValue = bottomValue;
bottomUnits = units;
requestRepaint();
}
public void setLeft(float leftValue, int units) {
validateLength(leftValue, units);
- left = leftValue;
+ this.leftValue = leftValue;
leftUnits = units;
requestRepaint();
}
requestRepaint();
}
+ public void setTopValue(float topValue) {
+ validateLength(topValue, topUnits);
+ this.topValue = topValue;
+ requestRepaint();
+ }
+
+ public float getTopValue() {
+ return topValue;
+ }
+
+ /**
+ * @return the rightValue
+ */
+ public float getRightValue() {
+ return rightValue;
+ }
+
+ /**
+ * @param rightValue
+ * the rightValue to set
+ */
+ public void setRightValue(float rightValue) {
+ validateLength(rightValue, rightUnits);
+ this.rightValue = rightValue;
+ requestRepaint();
+ }
+
+ /**
+ * @return the bottomValue
+ */
+ public float getBottomValue() {
+ return bottomValue;
+ }
+
+ /**
+ * @param bottomValue
+ * the bottomValue to set
+ */
+ public void setBottomValue(float bottomValue) {
+ validateLength(bottomValue, bottomUnits);
+ this.bottomValue = bottomValue;
+ requestRepaint();
+ }
+
+ /**
+ * @return the leftValue
+ */
+ public float getLeftValue() {
+ return leftValue;
+ }
+
+ /**
+ * @param leftValue
+ * the leftValue to set
+ */
+ public void setLeftValue(float leftValue) {
+ validateLength(leftValue, leftUnits);
+ this.leftValue = leftValue;
+ requestRepaint();
+ }
+
+ /**
+ * @return the topUnits
+ */
+ public int getTopUnits() {
+ return topUnits;
+ }
+
+ /**
+ * @param topUnits
+ * the topUnits to set
+ */
+ public void setTopUnits(int topUnits) {
+ validateLength(topValue, topUnits);
+ this.topUnits = topUnits;
+ requestRepaint();
+ }
+
+ /**
+ * @return the rightUnits
+ */
+ public int getRightUnits() {
+ return rightUnits;
+ }
+
+ /**
+ * @param rightUnits
+ * the rightUnits to set
+ */
+ public void setRightUnits(int rightUnits) {
+ validateLength(rightValue, rightUnits);
+ this.rightUnits = rightUnits;
+ requestRepaint();
+ }
+
+ /**
+ * @return the bottomUnits
+ */
+ public int getBottomUnits() {
+ return bottomUnits;
+ }
+
+ /**
+ * @param bottomUnits
+ * the bottomUnits to set
+ */
+ public void setBottomUnits(int bottomUnits) {
+ validateLength(bottomValue, bottomUnits);
+ this.bottomUnits = bottomUnits;
+ requestRepaint();
+ }
+
+ /**
+ * @return the leftUnits
+ */
+ public int getLeftUnits() {
+ return leftUnits;
+ }
+
+ /**
+ * @param leftUnits
+ * the leftUnits to set
+ */
+ public void setLeftUnits(int leftUnits) {
+ validateLength(leftValue, leftUnits);
+ this.leftUnits = leftUnits;
+ requestRepaint();
+ }
+
+ /**
+ * @return the zIndex
+ */
+ public int getZIndex() {
+ return zIndex;
+ }
+
}
@Override