int computeHeight (Control control, FormData data, boolean flushCache) { FormAttachment top = data.getTopAttachment (control, spacing, flushCache); FormAttachment bottom = data.getBottomAttachment (control, spacing, flushCache); FormAttachment height = bottom.minus (top); if (height.numerator == 0) { if (bottom.numerator == 0) return bottom.offset; if (bottom.numerator == bottom.denominator) return -top.offset; if (bottom.offset <= 0) { return -top.offset * top.denominator / bottom.numerator; } int divider = bottom.denominator - bottom.numerator; return bottom.denominator * bottom.offset / divider; } return height.solveY (data.getHeight (control, flushCache)); }
int computeHeight (Control control, FormData data, boolean flushCache) { FormAttachment top = data.getTopAttachment (control, spacing, flushCache); FormAttachment bottom = data.getBottomAttachment (control, spacing, flushCache); FormAttachment height = bottom.minus (top); if (height.numerator == 0) { if (bottom.numerator == 0) return bottom.offset; if (bottom.numerator == bottom.denominator) return -top.offset; if (bottom.offset <= 0) { return -top.offset * top.denominator / bottom.numerator; } int divider = bottom.denominator - bottom.numerator; return bottom.denominator * bottom.offset / divider; } return height.solveY (data.getHeight (control, flushCache)); }
int computeHeight (Control control, FormData data, boolean flushCache) { FormAttachment top = data.getTopAttachment (control, spacing, flushCache); FormAttachment bottom = data.getBottomAttachment (control, spacing, flushCache); FormAttachment height = bottom.minus (top); if (height.numerator == 0) { if (bottom.numerator == 0) return bottom.offset; if (bottom.numerator == bottom.denominator) return -top.offset; if (bottom.offset <= 0) { return -top.offset * top.denominator / bottom.numerator; } int divider = bottom.denominator - bottom.numerator; return bottom.denominator * bottom.offset / divider; } return height.solveY (data.getHeight (control, flushCache)); }
int computeHeight (Control control, FormData data, boolean flushCache) { FormAttachment top = data.getTopAttachment (control, spacing, flushCache); FormAttachment bottom = data.getBottomAttachment (control, spacing, flushCache); FormAttachment height = bottom.minus (top); if (height.numerator == 0) { if (bottom.numerator == 0) return bottom.offset; if (bottom.numerator == bottom.denominator) return -top.offset; if (bottom.offset <= 0) { return -top.offset * top.denominator / bottom.numerator; } int divider = bottom.denominator - bottom.numerator; return bottom.denominator * bottom.offset / divider; } return height.solveY (data.getHeight (control, flushCache)); }
int computeHeight (Control control, FormData data, boolean flushCache) { FormAttachment top = data.getTopAttachment (control, spacing, flushCache); FormAttachment bottom = data.getBottomAttachment (control, spacing, flushCache); FormAttachment height = bottom.minus (top); if (height.numerator == 0) { if (bottom.numerator == 0) return bottom.offset; if (bottom.numerator == bottom.denominator) return -top.offset; if (bottom.offset <= 0) { return -top.offset * top.denominator / bottom.numerator; } int divider = bottom.denominator - bottom.numerator; return bottom.denominator * bottom.offset / divider; } return height.solveY (data.getHeight (control, flushCache)); }
int computeHeight (Control control, FormData data, boolean flushCache) { FormAttachment top = data.getTopAttachment (control, spacing, flushCache); FormAttachment bottom = data.getBottomAttachment (control, spacing, flushCache); FormAttachment height = bottom.minus (top); if (height.numerator == 0) { if (bottom.numerator == 0) return bottom.offset; if (bottom.numerator == bottom.denominator) return -top.offset; if (bottom.offset <= 0) { return -top.offset * top.denominator / bottom.numerator; } int divider = bottom.denominator - bottom.numerator; return bottom.denominator * bottom.offset / divider; } return height.solveY (data.getHeight (control, flushCache)); }
FormAttachment getBottomAttachment (Control control, int spacing, boolean flushCache) { if (cacheBottom != null) return cacheBottom; if (isVisited) return cacheBottom = new FormAttachment (0, getHeight (control, flushCache)); if (bottom == null) { if (top == null) return cacheBottom = new FormAttachment (0, getHeight (control, flushCache)); return cacheBottom = getTopAttachment (control, spacing, flushCache).plus (getHeight (control, flushCache)); FormAttachment topAttachment = bottomData.getTopAttachment (bottomControl, spacing, flushCache); FormAttachment bottomHeight = bottomAttachment.minus (topAttachment); cacheBottom = bottomAttachment.minus (bottomHeight.minus (getHeight (control, flushCache)).divide (2)); break;
FormAttachment getBottomAttachment (Control control, int spacing, boolean flushCache) { if (cacheBottom != null) return cacheBottom; if (isVisited) return cacheBottom = new FormAttachment (0, getHeight (control, flushCache)); if (bottom == null) { if (top == null) return cacheBottom = new FormAttachment (0, getHeight (control, flushCache)); return cacheBottom = getTopAttachment (control, spacing, flushCache).plus (getHeight (control, flushCache)); FormAttachment topAttachment = bottomData.getTopAttachment (bottomControl, spacing, flushCache); FormAttachment bottomHeight = bottomAttachment.minus (topAttachment); cacheBottom = bottomAttachment.minus (bottomHeight.minus (getHeight (control, flushCache)).divide (2)); break;
FormAttachment getBottomAttachment (Control control, int spacing, boolean flushCache) { if (cacheBottom != null) return cacheBottom; if (isVisited) return cacheBottom = new FormAttachment (0, getHeight (control, flushCache)); if (bottom == null) { if (top == null) return cacheBottom = new FormAttachment (0, getHeight (control, flushCache)); return cacheBottom = getTopAttachment (control, spacing, flushCache).plus (getHeight (control, flushCache)); FormAttachment topAttachment = bottomData.getTopAttachment (bottomControl, spacing, flushCache); FormAttachment bottomHeight = bottomAttachment.minus (topAttachment); cacheBottom = bottomAttachment.minus (bottomHeight.minus (getHeight (control, flushCache)).divide (2)); break;
FormAttachment getBottomAttachment (Control control, int spacing, boolean flushCache) { if (cacheBottom != null) return cacheBottom; if (isVisited) return cacheBottom = new FormAttachment (0, getHeight (control, flushCache)); if (bottom == null) { if (top == null) return cacheBottom = new FormAttachment (0, getHeight (control, flushCache)); return cacheBottom = getTopAttachment (control, spacing, flushCache).plus (getHeight (control, flushCache)); FormAttachment topAttachment = bottomData.getTopAttachment (bottomControl, spacing, flushCache); FormAttachment bottomHeight = bottomAttachment.minus (topAttachment); cacheBottom = bottomAttachment.minus (bottomHeight.minus (getHeight (control, flushCache)).divide (2)); break;
FormAttachment getBottomAttachment (Control control, int spacing, boolean flushCache) { if (cacheBottom != null) return cacheBottom; if (isVisited) return cacheBottom = new FormAttachment (0, getHeight (control, flushCache)); if (bottom == null) { if (top == null) return cacheBottom = new FormAttachment (0, getHeight (control, flushCache)); return cacheBottom = getTopAttachment (control, spacing, flushCache).plus (getHeight (control, flushCache)); FormAttachment topAttachment = bottomData.getTopAttachment (bottomControl, spacing, flushCache); FormAttachment bottomHeight = bottomAttachment.minus (topAttachment); cacheBottom = bottomAttachment.minus (bottomHeight.minus (getHeight (control, flushCache)).divide (2)); break;
FormAttachment getBottomAttachment (Control control, int spacing, boolean flushCache) { if (cacheBottom != null) return cacheBottom; if (isVisited) return cacheBottom = new FormAttachment (0, getHeight (control, flushCache)); if (bottom == null) { if (top == null) return cacheBottom = new FormAttachment (0, getHeight (control, flushCache)); return cacheBottom = getTopAttachment (control, spacing, flushCache).plus (getHeight (control, flushCache)); FormAttachment topAttachment = bottomData.getTopAttachment (bottomControl, spacing, flushCache); FormAttachment bottomHeight = bottomAttachment.minus (topAttachment); cacheBottom = bottomAttachment.minus (bottomHeight.minus (getHeight (control, flushCache)).divide (2)); break;
if (top == null) { if (bottom == null) return cacheTop = new FormAttachment (0, 0); return cacheTop = getBottomAttachment (control, spacing, flushCache).minus (getHeight (control, flushCache)); FormAttachment bottomAttachment = topData.getBottomAttachment (topControl, spacing, flushCache); FormAttachment topHeight = bottomAttachment.minus (topAttachment); cacheTop = topAttachment.plus (topHeight.minus (getHeight (control, flushCache)).divide (2)); break;
if (top == null) { if (bottom == null) return cacheTop = new FormAttachment (0, 0); return cacheTop = getBottomAttachment (control, spacing, flushCache).minus (getHeight (control, flushCache)); FormAttachment bottomAttachment = topData.getBottomAttachment (topControl, spacing, flushCache); FormAttachment topHeight = bottomAttachment.minus (topAttachment); cacheTop = topAttachment.plus (topHeight.minus (getHeight (control, flushCache)).divide (2)); break;
if (top == null) { if (bottom == null) return cacheTop = new FormAttachment (0, 0); return cacheTop = getBottomAttachment (control, spacing, flushCache).minus (getHeight (control, flushCache)); FormAttachment bottomAttachment = topData.getBottomAttachment (topControl, spacing, flushCache); FormAttachment topHeight = bottomAttachment.minus (topAttachment); cacheTop = topAttachment.plus (topHeight.minus (getHeight (control, flushCache)).divide (2)); break;
if (top == null) { if (bottom == null) return cacheTop = new FormAttachment (0, 0); return cacheTop = getBottomAttachment (control, spacing, flushCache).minus (getHeight (control, flushCache)); FormAttachment bottomAttachment = topData.getBottomAttachment (topControl, spacing, flushCache); FormAttachment topHeight = bottomAttachment.minus (topAttachment); cacheTop = topAttachment.plus (topHeight.minus (getHeight (control, flushCache)).divide (2)); break;
if (top == null) { if (bottom == null) return cacheTop = new FormAttachment (0, 0); return cacheTop = getBottomAttachment (control, spacing, flushCache).minus (getHeight (control, flushCache)); FormAttachment bottomAttachment = topData.getBottomAttachment (topControl, spacing, flushCache); FormAttachment topHeight = bottomAttachment.minus (topAttachment); cacheTop = topAttachment.plus (topHeight.minus (getHeight (control, flushCache)).divide (2)); break;
if (top == null) { if (bottom == null) return cacheTop = new FormAttachment (0, 0); return cacheTop = getBottomAttachment (control, spacing, flushCache).minus (getHeight (control, flushCache)); FormAttachment bottomAttachment = topData.getBottomAttachment (topControl, spacing, flushCache); FormAttachment topHeight = bottomAttachment.minus (topAttachment); cacheTop = topAttachment.plus (topHeight.minus (getHeight (control, flushCache)).divide (2)); break;