@@ -0,0 +1,3035 @@
+package com.io7m.jsycamore;%0A%0Aimport javax.annotation.Nonnull;%0A%0Aimport com.io7m.jaux.Constraints;%0Aimport com.io7m.jaux.Constraints.ConstraintError;%0A%0A/**%0A * Utility functions for setting limits on positions for components.%0A */%0A%0Apublic final class ComponentLimits%0A%7B%0A  /**%0A   * Set the maximum allowed X position of %3Ccode%3Ec%3C/code%3E such that the X%0A   * position of the right edge of %3Ccode%3Ec%3C/code%3E will always be less than or%0A   * equal to the X position of the right edge of its parent. The current%0A   * position of %3Ccode%3Ec%3C/code%3E is unaffected.%0A   * %0A   * @param c%0A   *          The component to adjust%0A   * @throws ConstraintError%0A   *           Iff %3Ccode%3Ec == null%3C/code%3E.%0A   */%0A%0A  public static void setMaximumXContainerRight(%0A    final @Nonnull Component c)%0A    throws ConstraintError%0A  %7B%0A    Constraints.constrainNotNull(c, %22Component%22);%0A%0A    final Component parent = c.componentGetParent();%0A    if (parent != null) %7B%0A      final int parent_w = parent.componentGetWidth();%0A      final int current_w = c.componentGetWidth();%0A      c.componentSetMaximumX(parent_w - current_w);%0A    %7D%0A  %7D%0A%0A  /**%0A   * Set the minimum and maximum X and Y positions for %3Ccode%3Ec%3C/code%3E such%0A   * that the component may not overlap any of the sides of its container. The%0A   * current position of %3Ccode%3Ec%3C/code%3E is unaffected.%0A   * %0A   * @param c%0A   *          The component to adjust%0A   * @throws ConstraintError%0A   *           Iff %3Ccode%3Ec == null%3C/code%3E.%0A   */%0A%0A  public static void setMaximumXYContainer(%0A    final @Nonnull Component c)%0A    throws ConstraintError%0A  %7B%0A    Constraints.constrainNotNull(c, %22Component%22);%0A%0A    final Component parent = c.componentGetParent();%0A    if (parent != null) %7B%0A      final int parent_w = parent.componentGetWidth();%0A      final int parent_h = parent.componentGetHeight();%0A      final int current_h = c.componentGetHeight();%0A      final int current_w = c.componentGetWidth();%0A      final int max_y = parent_h - current_h;%0A      final int max_x = parent_w - current_w;%0A%0A      c.componentSetMinimumX(0);%0A      c.componentSetMinimumY(0);%0A%0A      if (max_y %3E 0) %7B%0A        c.componentSetMaximumY(max_y);%0A      %7D%0A      if (max_x %3E 0) %7B%0A        c.componentSetMaximumX(max_x);%0A      %7D%0A    %7D%0A  %7D%0A%0A  /**%0A   * Set the maximum allowed Y position of %3Ccode%3Ec%3C/code%3E such that the Y%0A   * position of the bottom edge of %3Ccode%3Ec%3C/code%3E will always be less than or%0A   * equal to the Y position of the bottom edge of its parent. The current%0A   * position of %3Ccode%3Ec%3C/code%3E is unaffected.%0A   * %0A   * @param c%0A   *          The component to adjust%0A   * @throws ConstraintError%0A   *           Iff %3Ccode%3Ec == null%3C/code%3E.%0A   */%0A%0A  public static void setMaximumYContainerBottom(%0A    final @Nonnull Component c)%0A    throws ConstraintError%0A  %7B%0A    Constraints.constrainNotNull(c, %22Component%22);%0A%0A    final Component parent = c.componentGetParent();%0A    if (parent != null) %7B%0A      final int parent_h = parent.componentGetHeight();%0A      final int current_h = c.componentGetHeight();%0A      c.componentSetMaximumY(parent_h - current_h);%0A    %7D%0A  %7D%0A%7D%0A

Add javadoc