Merged gcj-eclipse branch to trunk.

From-SVN: r120621
This commit is contained in:
Tom Tromey 2007-01-09 19:58:05 +00:00
parent c648dedbde
commit 97b8365caf
17478 changed files with 606493 additions and 100744 deletions

View file

@ -46,6 +46,7 @@ import java.util.Hashtable;
/**
* @author Michael Koch (konqueror@gmx.de)
* @author Jeroen Frijters (jeroen@frijters.net)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
*/
public class GridBagLayout
implements Serializable, LayoutManager2
@ -62,8 +63,8 @@ public class GridBagLayout
// REMAINDER constraints.
// Constraints kept in comptable are never modified, and constraints
// kept in internalcomptable can be modified internally only.
protected Hashtable comptable;
private Hashtable internalcomptable;
protected Hashtable<Component,GridBagConstraints> comptable;
private Hashtable<Component,GridBagConstraints> internalcomptable;
protected GridBagLayoutInfo layoutInfo;
protected GridBagConstraints defaultConstraints;
@ -74,8 +75,8 @@ public class GridBagLayout
public GridBagLayout ()
{
this.comptable = new Hashtable();
this.internalcomptable = new Hashtable();
this.comptable = new Hashtable<Component,GridBagConstraints>();
this.internalcomptable = new Hashtable<Component,GridBagConstraints>();
this.defaultConstraints= new GridBagConstraints();
}
@ -319,6 +320,16 @@ public class GridBagLayout
return new Point (col, row);
}
/**
* Return a string representation of this GridBagLayout.
*
* @return a string representation
*/
public String toString()
{
return getClass().getName();
}
/**
* Move and resize a rectangle according to a set of grid bag
* constraints. The x, y, width and height fields of the
@ -489,16 +500,18 @@ public class GridBagLayout
// Guaranteed to contain the last component added to the given row
// or column, whose gridwidth/height is not REMAINDER.
HashMap lastInRow = new HashMap();
HashMap lastInCol = new HashMap();
HashMap<Integer,Component> lastInRow = new HashMap<Integer,Component>();
HashMap<Integer,Component> lastInCol = new HashMap<Integer,Component>();
Component[] components = parent.getComponents();
// Components sorted by gridwidths/heights,
// smallest to largest, with REMAINDER and RELATIVE at the end.
// These are useful when determining sizes and weights.
ArrayList sortedByWidth = new ArrayList(components.length);
ArrayList sortedByHeight = new ArrayList(components.length);
ArrayList<Component> sortedByWidth =
new ArrayList<Component>(components.length);
ArrayList<Component> sortedByHeight =
new ArrayList<Component>(components.length);
// STEP 1: first we figure out how many rows/columns
for (int i = 0; i < components.length; i++)
@ -763,7 +776,7 @@ public class GridBagLayout
// STEP 3: Determine sizes and weights for columns.
for (int i = 0; i < sortedByWidth.size(); i++)
{
Component component = (Component) sortedByWidth.get(i);
Component component = sortedByWidth.get(i);
// If component is not visible we dont have to care about it.
if (!component.isVisible())
@ -877,7 +890,8 @@ public class GridBagLayout
* width. Otherwise, sort by height.
* FIXME: Use a better sorting algorithm.
*/
private void sortBySpan (Component component, int span, ArrayList list, boolean sortByWidth)
private void sortBySpan (Component component, int span,
ArrayList<Component> list, boolean sortByWidth)
{
if (span == GridBagConstraints.REMAINDER
|| span == GridBagConstraints.RELATIVE)