/** * Sets the component constraint for the component that already must be handleded by this layout * manager. * * <p>See the class JavaDocs for information on how this string is formatted. * * @param constr The component constraints as a String or {@link CCCommon.miginfocom.layout.CC}. * <code>null</code> is ok. * @param comp The component to set the constraints for. * @param noCheck Doesn't check if control already is managed. * @throws RuntimeException if the constaint was not valid. * @throws IllegalArgumentException If the component is not handling the component. */ private void setComponentConstraintsImpl( final IControl comp, final Object constr, final boolean noCheck) { if (noCheck == false && scrConstrMap.containsKey(comp) == false) { throw new IllegalArgumentException("Component must already be added to parent!"); } final IComponentWrapperCommon cw = new JoMigComponentWrapper(comp); if (constr == null || constr instanceof String) { final String cStr = ConstraintParserCommon.prepare((String) constr); scrConstrMap.put(comp, constr); ccMap.put(cw, ConstraintParserCommon.parseComponentConstraint(cStr)); } else if (constr instanceof CCWrapper) { scrConstrMap.put(comp, constr); ccMap.put(cw, ((CCWrapper) constr).getCC()); } else if (constr instanceof CCCommon) { scrConstrMap.put(comp, constr); ccMap.put(cw, (CCCommon) constr); } else { throw new IllegalArgumentException( "Constraint must be String or ComponentConstraint: " + constr.getClass().toString()); } grid = null; }
@Override public void setLayoutConstraints(Object constraints) { if (constraints == null || constraints instanceof String) { constraints = ConstraintParserCommon.prepare((String) constraints); lc = ConstraintParserCommon.parseLayoutConstraint((String) constraints); } else if (constraints instanceof LCWrapper) { lc = ((LCWrapper) constraints).getLC(); } else if (constraints instanceof LCCommon) { lc = (LCCommon) constraints; } else { throw new IllegalArgumentException( "Illegal constraint type: " + constraints.getClass().toString()); } this.constraints = constraints; grid = null; }
@Override public void setRowConstraints(Object constraints) { if (constraints == null || constraints instanceof String) { constraints = ConstraintParserCommon.prepare((String) constraints); rowSpecs = ConstraintParserCommon.parseRowConstraints((String) constraints); } else if (constraints instanceof ACWrapper) { rowSpecs = ((ACWrapper) constraints).getAC(); } else if (constraints instanceof ACCommon) { rowSpecs = (ACCommon) constraints; } else { throw new IllegalArgumentException( "Illegal constraint type: " + constraints.getClass().toString()); } rowConstraints = constraints; grid = null; }