GBConstraintsConverter.java revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* ident "%Z%%M% %I% %E% SMI"
*
* Copyright (c) 2000 by Sun Microsystems, Inc.
* All rights reserved.
*/
/*
* Copyright (C) 1996 Active Software, Inc.
* All rights reserved.
*
* @(#) GBConstraintsConverter.java 1.21 - last change made 07/25/97
*/
/**
* Converts instances of GBConstraints to strings and back again.
*
* @version 1.21, 07/25/97
*/
public class GBConstraintsConverter extends Converter {
private static final GBConstraints constraintsDefault =
new GBConstraints();
private String constantToString(int c) {
if (c == GBConstraints.RELATIVE)
return (/* NOI18N */"relative");
else if (c == GBConstraints.REMAINDER)
return (/* NOI18N */"remainder");
else if (c == GBConstraints.NONE)
return (/* NOI18N */"none");
else if (c == GBConstraints.BOTH)
return (/* NOI18N */"both");
else if (c == GBConstraints.HORIZONTAL)
return (/* NOI18N */"horizontal");
else if (c == GBConstraints.VERTICAL)
return (/* NOI18N */"vertical");
else if (c == GBConstraints.CENTER)
return (/* NOI18N */"center");
else if (c == GBConstraints.NORTH)
return (/* NOI18N */"north");
else if (c == GBConstraints.NORTHEAST)
return (/* NOI18N */"northeast");
else if (c == GBConstraints.EAST)
return (/* NOI18N */"east");
else if (c == GBConstraints.SOUTHEAST)
return (/* NOI18N */"southeast");
else if (c == GBConstraints.SOUTH)
return (/* NOI18N */"south");
else if (c == GBConstraints.SOUTHWEST)
return (/* NOI18N */"southwest");
else if (c == GBConstraints.WEST)
return (/* NOI18N */"west");
else if (c == GBConstraints.NORTHWEST)
return (/* NOI18N */"northwest");
else
/* BEGIN JSTYLED */
"sunsoft.jws.visual.rt.type.GBConstraintsConverter.FMT.29",
new Integer(c)));
/* END JSTYLED */
}
private int stringToConstant(String s) {
return GBConstraints.RELATIVE;
return GBConstraints.REMAINDER;
return GBConstraints.NONE;
return GBConstraints.BOTH;
return GBConstraints.HORIZONTAL;
return GBConstraints.VERTICAL;
return GBConstraints.CENTER;
return GBConstraints.NORTH;
return GBConstraints.NORTHEAST;
return GBConstraints.EAST;
return GBConstraints.SOUTHEAST;
return GBConstraints.SOUTH;
return GBConstraints.SOUTHWEST;
return GBConstraints.WEST;
return GBConstraints.NORTHWEST;
else
/* BEGIN JSTYLED */
"sunsoft.jws.visual.rt.type.GBConstraintsConverter.FMT.29",
s));
/* END JSTYLED */
}
/**
* Converts an instance of GBConstraints to a string representation.
*/
+ /* NOI18N */";";
}
+ /* NOI18N */";";
}
+ /* NOI18N */";";
}
}
+ /* NOI18N */";";
}
+ /* NOI18N */";";
}
}
+ c.ipadx + ";");
}
+ c.ipady + ";");
}
+ c.shrinkx + ";");
}
+ c.shrinky + ";");
}
else
return (retval);
} else {
return (null);
}
}
/**
* Returns a code for creating a GBConstraints instance
* like the one given.
*
* @param obj an instance of GBConstraints
*/
return (/* NOI18N */("new GBConstraints(\""
}
else
return (0);
}
else
return (false);
}
else
return (0.0);
}
return (stringToConstant(value));
else
return (0);
}
/**
* Converts a string into a new instance of GBConstraints.
*
* @exception Error when there is a problem with the string
*/
}
}
}
}
}
}
}
}
}
}
}
return (retval);
} else {
return (null);
}
}
}