int computeWidth (Control control, FormData data, boolean flushCache) { FormAttachment left = data.getLeftAttachment (control, spacing, flushCache); FormAttachment right = data.getRightAttachment (control, spacing, flushCache); FormAttachment width = right.minus (left); if (width.numerator == 0) { if (right.numerator == 0) return right.offset; if (right.numerator == right.denominator) return -left.offset; if (right.offset <= 0) { return -left.offset * left.denominator / left.numerator; } int divider = right.denominator - right.numerator; return right.denominator * right.offset / divider; } return width.solveY (data.getWidth (control, flushCache)); }
int computeWidth (Control control, FormData data, boolean flushCache) { FormAttachment left = data.getLeftAttachment (control, spacing, flushCache); FormAttachment right = data.getRightAttachment (control, spacing, flushCache); FormAttachment width = right.minus (left); if (width.numerator == 0) { if (right.numerator == 0) return right.offset; if (right.numerator == right.denominator) return -left.offset; if (right.offset <= 0) { return -left.offset * left.denominator / left.numerator; } int divider = right.denominator - right.numerator; return right.denominator * right.offset / divider; } return width.solveY (data.getWidth (control, flushCache)); }
int computeWidth (Control control, FormData data, boolean flushCache) { FormAttachment left = data.getLeftAttachment (control, spacing, flushCache); FormAttachment right = data.getRightAttachment (control, spacing, flushCache); FormAttachment width = right.minus (left); if (width.numerator == 0) { if (right.numerator == 0) return right.offset; if (right.numerator == right.denominator) return -left.offset; if (right.offset <= 0) { return -left.offset * left.denominator / left.numerator; } int divider = right.denominator - right.numerator; return right.denominator * right.offset / divider; } return width.solveY (data.getWidth (control, flushCache)); }
int computeWidth (Control control, FormData data, boolean flushCache) { FormAttachment left = data.getLeftAttachment (control, spacing, flushCache); FormAttachment right = data.getRightAttachment (control, spacing, flushCache); FormAttachment width = right.minus (left); if (width.numerator == 0) { if (right.numerator == 0) return right.offset; if (right.numerator == right.denominator) return -left.offset; if (right.offset <= 0) { return -left.offset * left.denominator / left.numerator; } int divider = right.denominator - right.numerator; return right.denominator * right.offset / divider; } return width.solveY (data.getWidth (control, flushCache)); }
int computeWidth (Control control, FormData data, boolean flushCache) { FormAttachment left = data.getLeftAttachment (control, spacing, flushCache); FormAttachment right = data.getRightAttachment (control, spacing, flushCache); FormAttachment width = right.minus (left); if (width.numerator == 0) { if (right.numerator == 0) return right.offset; if (right.numerator == right.denominator) return -left.offset; if (right.offset <= 0) { return -left.offset * left.denominator / left.numerator; } int divider = right.denominator - right.numerator; return right.denominator * right.offset / divider; } return width.solveY (data.getWidth (control, flushCache)); }
int computeWidth (Control control, FormData data, boolean flushCache) { FormAttachment left = data.getLeftAttachment (control, spacing, flushCache); FormAttachment right = data.getRightAttachment (control, spacing, flushCache); FormAttachment width = right.minus (left); if (width.numerator == 0) { if (right.numerator == 0) return right.offset; if (right.numerator == right.denominator) return -left.offset; if (right.offset <= 0) { return -left.offset * left.denominator / left.numerator; } int divider = right.denominator - right.numerator; return right.denominator * right.offset / divider; } return width.solveY (data.getWidth (control, flushCache)); }
FormAttachment getRightAttachment (Control control, int spacing, boolean flushCache) { if (cacheRight != null) return cacheRight; if (isVisited) return cacheRight = new FormAttachment (0, getWidth (control, flushCache)); if (right == null) { if (left == null) return cacheRight = new FormAttachment (0, getWidth (control, flushCache)); return cacheRight = getLeftAttachment (control, spacing, flushCache).plus (getWidth (control, flushCache)); FormAttachment leftAttachment = rightData.getLeftAttachment (rightControl, spacing, flushCache); FormAttachment rightWidth = rightAttachment.minus (leftAttachment); cacheRight = rightAttachment.minus (rightWidth.minus (getWidth (control, flushCache)).divide (2)); break;
FormAttachment getRightAttachment (Control control, int spacing, boolean flushCache) { if (cacheRight != null) return cacheRight; if (isVisited) return cacheRight = new FormAttachment (0, getWidth (control, flushCache)); if (right == null) { if (left == null) return cacheRight = new FormAttachment (0, getWidth (control, flushCache)); return cacheRight = getLeftAttachment (control, spacing, flushCache).plus (getWidth (control, flushCache)); FormAttachment leftAttachment = rightData.getLeftAttachment (rightControl, spacing, flushCache); FormAttachment rightWidth = rightAttachment.minus (leftAttachment); cacheRight = rightAttachment.minus (rightWidth.minus (getWidth (control, flushCache)).divide (2)); break;
FormAttachment getRightAttachment (Control control, int spacing, boolean flushCache) { if (cacheRight != null) return cacheRight; if (isVisited) return cacheRight = new FormAttachment (0, getWidth (control, flushCache)); if (right == null) { if (left == null) return cacheRight = new FormAttachment (0, getWidth (control, flushCache)); return cacheRight = getLeftAttachment (control, spacing, flushCache).plus (getWidth (control, flushCache)); FormAttachment leftAttachment = rightData.getLeftAttachment (rightControl, spacing, flushCache); FormAttachment rightWidth = rightAttachment.minus (leftAttachment); cacheRight = rightAttachment.minus (rightWidth.minus (getWidth (control, flushCache)).divide (2)); break;
FormAttachment getRightAttachment (Control control, int spacing, boolean flushCache) { if (cacheRight != null) return cacheRight; if (isVisited) return cacheRight = new FormAttachment (0, getWidth (control, flushCache)); if (right == null) { if (left == null) return cacheRight = new FormAttachment (0, getWidth (control, flushCache)); return cacheRight = getLeftAttachment (control, spacing, flushCache).plus (getWidth (control, flushCache)); FormAttachment leftAttachment = rightData.getLeftAttachment (rightControl, spacing, flushCache); FormAttachment rightWidth = rightAttachment.minus (leftAttachment); cacheRight = rightAttachment.minus (rightWidth.minus (getWidth (control, flushCache)).divide (2)); break;
FormAttachment getRightAttachment (Control control, int spacing, boolean flushCache) { if (cacheRight != null) return cacheRight; if (isVisited) return cacheRight = new FormAttachment (0, getWidth (control, flushCache)); if (right == null) { if (left == null) return cacheRight = new FormAttachment (0, getWidth (control, flushCache)); return cacheRight = getLeftAttachment (control, spacing, flushCache).plus (getWidth (control, flushCache)); FormAttachment leftAttachment = rightData.getLeftAttachment (rightControl, spacing, flushCache); FormAttachment rightWidth = rightAttachment.minus (leftAttachment); cacheRight = rightAttachment.minus (rightWidth.minus (getWidth (control, flushCache)).divide (2)); break;
FormAttachment getRightAttachment (Control control, int spacing, boolean flushCache) { if (cacheRight != null) return cacheRight; if (isVisited) return cacheRight = new FormAttachment (0, getWidth (control, flushCache)); if (right == null) { if (left == null) return cacheRight = new FormAttachment (0, getWidth (control, flushCache)); return cacheRight = getLeftAttachment (control, spacing, flushCache).plus (getWidth (control, flushCache)); FormAttachment leftAttachment = rightData.getLeftAttachment (rightControl, spacing, flushCache); FormAttachment rightWidth = rightAttachment.minus (leftAttachment); cacheRight = rightAttachment.minus (rightWidth.minus (getWidth (control, flushCache)).divide (2)); break;
if (left == null) { if (right == null) return cacheLeft = new FormAttachment (0, 0); return cacheLeft = getRightAttachment (control, spacing, flushCache).minus (getWidth (control, flushCache)); FormAttachment rightAttachment = leftData.getRightAttachment (leftControl, spacing, flushCache); FormAttachment leftWidth = rightAttachment.minus (leftAttachment); cacheLeft = leftAttachment.plus (leftWidth.minus (getWidth (control, flushCache)).divide (2)); break;
if (left == null) { if (right == null) return cacheLeft = new FormAttachment (0, 0); return cacheLeft = getRightAttachment (control, spacing, flushCache).minus (getWidth (control, flushCache)); FormAttachment rightAttachment = leftData.getRightAttachment (leftControl, spacing, flushCache); FormAttachment leftWidth = rightAttachment.minus (leftAttachment); cacheLeft = leftAttachment.plus (leftWidth.minus (getWidth (control, flushCache)).divide (2)); break;
if (left == null) { if (right == null) return cacheLeft = new FormAttachment (0, 0); return cacheLeft = getRightAttachment (control, spacing, flushCache).minus (getWidth (control, flushCache)); FormAttachment rightAttachment = leftData.getRightAttachment (leftControl, spacing, flushCache); FormAttachment leftWidth = rightAttachment.minus (leftAttachment); cacheLeft = leftAttachment.plus (leftWidth.minus (getWidth (control, flushCache)).divide (2)); break;
if (left == null) { if (right == null) return cacheLeft = new FormAttachment (0, 0); return cacheLeft = getRightAttachment (control, spacing, flushCache).minus (getWidth (control, flushCache)); FormAttachment rightAttachment = leftData.getRightAttachment (leftControl, spacing, flushCache); FormAttachment leftWidth = rightAttachment.minus (leftAttachment); cacheLeft = leftAttachment.plus (leftWidth.minus (getWidth (control, flushCache)).divide (2)); break;
if (left == null) { if (right == null) return cacheLeft = new FormAttachment (0, 0); return cacheLeft = getRightAttachment (control, spacing, flushCache).minus (getWidth (control, flushCache)); FormAttachment rightAttachment = leftData.getRightAttachment (leftControl, spacing, flushCache); FormAttachment leftWidth = rightAttachment.minus (leftAttachment); cacheLeft = leftAttachment.plus (leftWidth.minus (getWidth (control, flushCache)).divide (2)); break;
if (left == null) { if (right == null) return cacheLeft = new FormAttachment (0, 0); return cacheLeft = getRightAttachment (control, spacing, flushCache).minus (getWidth (control, flushCache)); FormAttachment rightAttachment = leftData.getRightAttachment (leftControl, spacing, flushCache); FormAttachment leftWidth = rightAttachment.minus (leftAttachment); cacheLeft = leftAttachment.plus (leftWidth.minus (getWidth (control, flushCache)).divide (2)); break;