/** * A3Layout.java * * @author David H Nguyen */ import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.Vector; import java.util.Enumeration; import java.util.Hashtable; import EDU.Washington.grad.gjb.cassowary.*; public class A3Layout implements LayoutManager { /** * The parts of the JComponent we are interested in * and will connect to ClVariables... */ public static final int X_PART = 0; public static final int Y_PART = 1; public static final int WIDTH_PART = 2; public static final int HEIGHT_PART = 3; public static final int AX_PART = 4; public static final int AY_PART = 5; A3Layout() { } /** * This LayoutVariable is special. * Only one for width and one for height of the container. */ public LayoutVariable getContainerWidthVariable(Container parent) { } /** * This LayoutVariable is special. * Only one for width and one for height of the container */ public LayoutVariable getContainerHeightVariable(Container parent) { } /** * Get a LayoutVariable which will be connected/associated with the * particular JComponent's part. */ public LayoutVariable getVariable(JComponent comp, int part) { } /** * Get a new variable, to be used as a vertical or horizonal guide. The * semantics are not enforced, but used by the visualization optional * credit to decide how to draw an reference line for the variable. */ public LayoutVariable getGuideVariableX() { } public LayoutVariable getGuideVariableY() { } /** * Simply pass the cn to the solver */ public void addConstraint(ClConstraint cn) throws ExCLInternalError, ExCLRequiredFailure { } /** * Simply pass the cn to the solver */ public void removeConstraint(ClConstraint cn) throws ExCLInternalError, ExCLConstraintNotFound { } /** * Simply pass the point and weight to the solver */ public void addStay(LayoutVariable var, ClStrength strength, double weight) throws ExCLInternalError, ExCLRequiredFailure { } /** * Set up the constraint a = (b1+b2)/2 */ public ClConstraint addAverageConstraint(LayoutVariable a, LayoutVariable b1, LayoutVariable b2) throws ExCLInternalError, ExCLRequiredFailure { } /** * Set up the constraint a = (b1+b2+...+bn)/n, where n is the size of * the vector of LayoutVariables. */ public ClConstraint addAverageConstraint(LayoutVariable a, Vector variables) throws ExCLInternalError, ExCLRequiredFailure { } /** * Set up the constraint a = b + c, where c is a constant. */ public ClConstraint addOffsetConstraint(LayoutVariable a, LayoutVariable b, double c) throws ExCLInternalError, ExCLRequiredFailure { } /** * Set up the constraint a = b */ public ClConstraint addEqualityConstraint(LayoutVariable a, LayoutVariable b) throws ExCLInternalError, ExCLRequiredFailure { } /** * Set up n constraints of the form a > vn, where vn is the nth variable * in the vector. Also, set up a weaker constraint a < vn, for some vn * in the vector, to keep a tightly held against the max. */ public ClConstraint addMaxConstraint (LayoutVariable a, Vector variables) throws ExCLInternalError, ExCLRequiredFailure { } /** * Set up n constraints of the form a < vn, where vn is the nth variable * in the vector. Also, set up a weaker constraint a > vn, for some vn * in the vector, to keep a tightly held against the min. */ public ClConstraint addMinConstraint (LayoutVariable a, Vector variables) throws ExCLInternalError, ExCLRequiredFailure { } /******************************************/ /** THINGS REQUIRED BY THE LAYOUTMANAGER **/ /** * Required by LayoutManager. */ public void addLayoutComponent(String name, Component comp) { } /** * Required by LayoutManager. */ public void removeLayoutComponent(Component comp) { } /** * Required by LayoutManager. */ public Dimension preferredLayoutSize(Container parent) { } /** * Required by LayoutManager. */ public Dimension minimumLayoutSize(Container parent) { } /** * Required by LayoutManager. * * This is called when the panel is first displayed, * and every time its size changes. * Note: You CAN'T assume preferredLayoutSize or * minimumLayoutSize will be called -- in the case * of applets, at least, they probably won't be. */ public void layoutContainer(Container parent) { } /** * Generally good to have a toString() */ public String toString() { } /** * set debug mode. If the optional part of the assignment is being done, * setting debug mode on will insert a container in the glass pane to * capture right click events and render the visualization on. */ public void debug(boolean on) { } }