com.itmill.toolkit.ui
Class GridLayout.Area

java.lang.Object
  extended by com.itmill.toolkit.ui.GridLayout.Area
Enclosing class:
GridLayout

public class GridLayout.Area
extends Object

This class defines an area on a grid. An Area is defined by the coordinates of its upper left corner (x1,y1) and lower right corner (x2,y2).

Since:
3.0
Version:
4.1.4
Author:
IT Mill Ltd.

Constructor Summary
GridLayout.Area(Component component, int x1, int y1, int x2, int y2)
           Construct a new area on a grid.
 
Method Summary
 Component getComponent()
          Gets the component connected to the area.
 int getX1()
          Gets the top-left corner x-coordinate.
 int getX2()
          Gets the bottom-right corner x-coordinate.
 int getY1()
          Gets the top-left corner y-coordinate.
 int getY2()
          Returns the bottom-right corner y-coordinate.
 boolean overlaps(GridLayout.Area other)
          Tests if the given Area overlaps with an another Area.
protected  void setComponent(Component newComponent)
          Sets the component connected to the area.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GridLayout.Area

public GridLayout.Area(Component component,
                       int x1,
                       int y1,
                       int x2,
                       int y2)

Construct a new area on a grid.

Parameters:
component - the component connected to the area.
x1 - the X-coordinate of the upper left corner of the area c is supposed to occupy.
y1 - the Y-coordinate of the upper left corner of the area c is supposed to occupy.
x2 - the X-coordinate of the lower right corner of the area c is supposed to occupy.
y2 - the Y-coordinate of the lower right corner of the area c is supposed to occupy.
Throws:
GridLayout.OverlapsException - if the new component overlaps with any of the components already in the grid
Method Detail

overlaps

public boolean overlaps(GridLayout.Area other)
Tests if the given Area overlaps with an another Area.

Parameters:
other - the Another Area that's to be tested for overlap with this area.
Returns:
true if other overlaps with this area, false if it doesn't.

getComponent

public Component getComponent()
Gets the component connected to the area.

Returns:
the Component.

setComponent

protected void setComponent(Component newComponent)
Sets the component connected to the area.

This function only sets the value in the datastructure and does not send any events or set parents.

Parameters:
newComponent - the new connected overriding the existing one.

getX1

public int getX1()
Gets the top-left corner x-coordinate.

Returns:
the top-left corner of x-coordinate.

getX2

public int getX2()
Gets the bottom-right corner x-coordinate.

Returns:
the x-coordinate.

getY1

public int getY1()
Gets the top-left corner y-coordinate.

Returns:
the y-coordinate.

getY2

public int getY2()
Returns the bottom-right corner y-coordinate.

Returns:
the y-coordinate.


Copyright © 2000-2008 IT Mill Ltd. All Rights Reserved.