componentOrientation
+ * property and may be one of two values:
+ * ComponentOrientation.TOP_TO_BOTTOM
+ * ComponentOrientation.BOTTOM_TO_TOP
+ * align
+ * property. The possible values are:
+ * + * import java.awt.*; + * import java.applet.Applet; + * + * public class myButtons extends Applet { + * Button button1, button2, button3; + * public void init() { + * button1 = new Button("Ok"); + * button2 = new Button("Open"); + * button3 = new Button("Close"); + * add(button1); + * add(button2); + * add(button3); + * } + * } + *
align
is the property that determines
+ * how each row distributes empty space.
+ * It can be one of the following values:
+ * TOP
+ * BOTTOM
+ * CENTER
+ * LEADING
+ * TRAILING
+ * newAlign
is the property that determines
+ * how each row distributes empty space for the Java 2 platform,
+ * v1.2 and greater.
+ * It can be one of the following three values:
+ * TOP
+ * BOTTOM
+ * CENTER
+ * LEADING
+ * TRAILING
+ * Container
.
+ *
+ * @serial
+ * @see #getHgap()
+ * @see #setHgap(int)
+ */
+ int hgap;
+
+ /**
+ * The flow layout manager allows a seperation of
+ * components with gaps. The vertical gap will
+ * specify the space between rows and between the
+ * the rows and the borders of the Container
.
+ *
+ * @serial
+ * @see #getHgap()
+ * @see #setHgap(int)
+ */
+ int vgap;
+
+ /*
+ * JDK 1.1 serialVersionUID
+ */
+ private static final long serialVersionUID = -7262534875583282631L;
+
+ /**
+ * Constructs a new VerticalFlowLayout
with a centered alignment and a
+ * default 5-unit horizontal and vertical gap.
+ */
+ public VerticalFlowLayout() {
+ this(CENTER, 5, 5);
+ }
+
+ /**
+ * Constructs a new VerticalFlowLayout
with the specified
+ * alignment and a default 5-unit horizontal and vertical gap.
+ * The value of the alignment argument must be one of
+ * VerticalFlowLayout.TOP
, VerticalFlowLayout.BOTTOM
,
+ * VerticalFlowLayout.CENTER
, VerticalFlowLayout.LEADING
,
+ * or VerticalFlowLayout.TRAILING
.
+ *
+ * @param align the alignment value
+ */
+ public VerticalFlowLayout(int align) {
+ this(align, 5, 5);
+ }
+
+ /**
+ * Creates a new flow layout manager with the indicated alignment
+ * and the indicated horizontal and vertical gaps.
+ *
+ * The value of the alignment argument must be one of
+ * VerticalFlowLayout.TOP
, VerticalFlowLayout.BOTTOM
,
+ * VerticalFlowLayout.CENTER
, VerticalFlowLayout.LEADING
,
+ * or VerticalFlowLayout.TRAILING
.
+ *
+ * @param align the alignment value
+ * @param hgap the horizontal gap between components
+ * and between the components and the
+ * borders of the Container
+ * @param vgap the vertical gap between components
+ * and between the components and the
+ * borders of the Container
+ */
+ public VerticalFlowLayout(int align, int hgap, int vgap) {
+ this.hgap = hgap;
+ this.vgap = vgap;
+ setAlignment(align);
+ }
+
+ /**
+ * Gets the alignment for this layout.
+ * Possible values are VerticalFlowLayout.TOP
,
+ * VerticalFlowLayout.BOTTOM
, VerticalFlowLayout.CENTER
,
+ * VerticalFlowLayout.LEADING
,
+ * or VerticalFlowLayout.TRAILING
.
+ *
+ * @return the alignment value for this layout
+ * @since JDK1.1
+ */
+ public int getAlignment() {
+ return newAlign;
+ }
+
+ /**
+ * Sets the alignment for this layout.
+ * Possible values are
+ * VerticalFlowLayout.TOP
+ * VerticalFlowLayout.BOTTOM
+ * VerticalFlowLayout.CENTER
+ * VerticalFlowLayout.LEADING
+ * VerticalFlowLayout.TRAILING
+ * Container
+ *
+ * @return the horizontal gap between components
+ * and between the components and the borders
+ * of the Container
+ */
+ public int getHgap() {
+ return hgap;
+ }
+
+ /**
+ * Sets the horizontal gap between components and
+ * between the components and the borders of the
+ * Container
.
+ *
+ * @param hgap the horizontal gap between components
+ * and between the components and the borders
+ * of the Container
+ */
+ public void setHgap(int hgap) {
+ this.hgap = hgap;
+ }
+
+ /**
+ * Gets the vertical gap between components and
+ * between the components and the borders of the
+ * Container
.
+ *
+ * @return the vertical gap between components
+ * and between the components and the borders
+ * of the Container
+ */
+ public int getVgap() {
+ return vgap;
+ }
+
+ /**
+ * Sets the vertical gap between components and between
+ * the components and the borders of the Container
.
+ *
+ * @param vgap the vertical gap between components
+ * and between the components and the borders
+ * of the Container
+ */
+ public void setVgap(int vgap) {
+ this.vgap = vgap;
+ }
+
+ /**
+ * Adds the specified component to the layout.
+ * Not used by this class.
+ *
+ * @param name the name of the component
+ * @param comp the component to be added
+ */
+ public void addLayoutComponent(String name, Component comp) {
+ }
+
+ /**
+ * Removes the specified component from the layout.
+ * Not used by this class.
+ *
+ * @param comp the component to remove
+ * @see java.awt.Container#removeAll
+ */
+ public void removeLayoutComponent(Component comp) {
+ }
+
+ /**
+ * Returns the preferred dimensions for this layout given the
+ * visible components in the specified target container.
+ *
+ * @param target the container that needs to be laid out
+ * @return the preferred dimensions to lay out the
+ * subcomponents of the specified container
+ * @see Container
+ * @see #minimumLayoutSize
+ * @see java.awt.Container#getPreferredSize
+ */
+ public Dimension preferredLayoutSize(Container target) {
+ synchronized (target.getTreeLock()) {
+ Dimension dim = new Dimension(0, 0);
+ int nmembers = target.getComponentCount();
+ boolean firstVisibleComponent = true;
+
+ for (int i = 0; i < nmembers; i++) {
+ Component m = target.getComponent(i);
+ if (m.isVisible()) {
+ Dimension d = m.getPreferredSize();
+ dim.width = Math.max(dim.width, d.width);
+ if (firstVisibleComponent) {
+ firstVisibleComponent = false;
+ } else {
+ dim.height += vgap;
+ }
+ dim.height += d.height;
+ }
+ }
+
+ Insets insets = target.getInsets();
+ dim.width += insets.left + insets.right + hgap * 2;
+ dim.height += insets.top + insets.bottom + vgap * 2;
+ return dim;
+ }
+ }
+
+ /**
+ * Returns the minimum dimensions needed to layout the visible
+ * components contained in the specified target container.
+ *
+ * @param target the container that needs to be laid out
+ * @return the minimum dimensions to lay out the
+ * subcomponents of the specified container
+ * @see #preferredLayoutSize
+ * @see java.awt.Container
+ * @see java.awt.Container#doLayout
+ */
+ public Dimension minimumLayoutSize(Container target) {
+ synchronized (target.getTreeLock()) {
+ Dimension dim = new Dimension(0, 0);
+ int nmembers = target.getComponentCount();
+
+ for (int i = 0; i < nmembers; i++) {
+ Component m = target.getComponent(i);
+ if (m.isVisible()) {
+ Dimension d = m.getMinimumSize();
+ dim.width = Math.max(dim.width, d.width);
+ if (i > 0) {
+ dim.height += vgap;
+ }
+ dim.height += d.height;
+ }
+ }
+ Insets insets = target.getInsets();
+ dim.width += insets.left + insets.right + hgap * 2;
+ dim.height += insets.top + insets.bottom + vgap * 2;
+ return dim;
+ }
+ }
+
+ /**
+ * Centers the elements in the specified row, if there is any slack.
+ *
+ * @param target the component which needs to be moved
+ * @param x the x coordinate
+ * @param y the y coordinate
+ * @param width the width dimensions
+ * @param height the height dimensions
+ * @param colStart the beginning of the row
+ * @param colEnd the the ending of the row
+ */
+ private void moveComponents(Container target, int x, int y, int width, int height,
+ int colStart, int colEnd, boolean ltr) {
+ synchronized (target.getTreeLock()) {
+ switch (newAlign) {
+ case TOP:
+ y += ltr ? 0 : height;
+ break;
+ case CENTER:
+ y += height / 2;
+ break;
+ case BOTTOM:
+ y += ltr ? height : 0;
+ break;
+ case LEADING:
+ break;
+ case TRAILING:
+ y += height;
+ break;
+ }
+ for (int i = colStart; i < colEnd; i++) {
+ Component m = target.getComponent(i);
+ if (m.isVisible()) {
+ if (ltr) {
+ m.setLocation(x + (width - m.getWidth()) / 2, y);
+ } else {
+ m.setLocation(x + (width - m.getWidth()) / 2, target.getHeight() - y - m.getHeight());
+ }
+ y += m.getHeight() + vgap;
+ }
+ }
+ }
+ }
+
+ /**
+ * Lays out the container. This method lets each
+ * visible component take
+ * its preferred size by reshaping the components in the
+ * target container in order to satisfy the alignment of
+ * this VerticalFlowLayout
object.
+ *
+ * @param target the specified component being laid out
+ * @see Container
+ * @see java.awt.Container#doLayout
+ */
+ public void layoutContainer(Container target) {
+ synchronized (target.getTreeLock()) {
+ Insets insets = target.getInsets();
+ int maxwidth = target.getWidth() - (insets.left + insets.right + hgap * 2);
+ int maxheight = target.getHeight() - (insets.top + insets.bottom + vgap * 2);
+ int nmembers = target.getComponentCount();
+ int x = insets.left + hgap, y = 0;
+ int colw = 0, start = 0;
+
+ boolean ltr = target.getComponentOrientation().isLeftToRight();
+
+ for (int i = 0; i < nmembers; i++) {
+ Component m = target.getComponent(i);
+ if (m.isVisible()) {
+ Dimension d = m.getPreferredSize();
+ if (maximizeOtherDimension) {
+ d.width = maxwidth;
+ }
+ m.setSize(d.width, d.height);
+
+ if ((y == 0) || ((y + d.height) <= maxheight)) {
+ if (y > 0) {
+ y += vgap;
+ }
+ y += d.height;
+ colw = Math.max(colw, d.width);
+ } else {
+ moveComponents(target, insets.left + hgap, y, maxheight - x, colw, start, i, ltr);
+ moveComponents(target, x, insets.top + vgap, colw, maxheight - y, start, i, ltr);
+ y = d.height;
+ x += hgap + colw;
+ colw = d.width;
+ start = i;
+ }
+ }
+ }
+ moveComponents(target, x, insets.top + vgap, colw, maxheight - y, start, nmembers, ltr);
+ }
+ }
+
+ //
+ // the internal serial version which says which version was written
+ // - 0 (default) for versions before the Java 2 platform, v1.2
+ // - 1 for version >= Java 2 platform v1.2, which includes "newAlign" field
+ //
+ private static final int currentSerialVersion = 1;
+ /**
+ * This represent the currentSerialVersion
+ * which is bein used. It will be one of two values :
+ * 0
versions before Java 2 platform v1.2..
+ * 1
versions after Java 2 platform v1.2..
+ *
+ * @serial
+ * @since 1.2
+ */
+ private int serialVersionOnStream = currentSerialVersion;
+
+ /**
+ * Reads this object out of a serialization stream, handling
+ * objects written by older versions of the class that didn't contain all
+ * of the fields we use now..
+ */
+ private void readObject(ObjectInputStream stream)
+ throws IOException, ClassNotFoundException {
+ stream.defaultReadObject();
+
+ if (serialVersionOnStream < 1) {
+ // "newAlign" field wasn't present, so use the old "align" field.
+ setAlignment(this.align);
+ }
+ serialVersionOnStream = currentSerialVersion;
+ }
+
+ /**
+ * Returns a string representation of this VerticalFlowLayout
+ * object and its values.
+ *
+ * @return a string representation of this layout
+ */
+ public String toString() {
+ String str = "";
+ switch (align) {
+ case TOP:
+ str = ",align=top";
+ break;
+ case CENTER:
+ str = ",align=center";
+ break;
+ case BOTTOM:
+ str = ",align=bottom";
+ break;
+ case LEADING:
+ str = ",align=leading";
+ break;
+ case TRAILING:
+ str = ",align=trailing";
+ break;
+ }
+ return getClass().getName() + "[hgap=" + hgap + ",vgap=" + vgap + str + "]";
+ }
+
+
+}
\ No newline at end of file
diff --git a/java_tools/ts_plugin_launcher/ts_plugin_launcher.iml b/java_tools/ts_plugin_launcher/ts_plugin_launcher.iml
index a6d1bc0c72..a3a4e1a20b 100644
--- a/java_tools/ts_plugin_launcher/ts_plugin_launcher.iml
+++ b/java_tools/ts_plugin_launcher/ts_plugin_launcher.iml
@@ -8,9 +8,5 @@