* if you add components outside the grid's area.
*
* @param columns
- * Number of columns in the grid.
+ * Number of columns in the grid.
* @param rows
- * Number of rows in the grid.
+ * Number of rows in the grid.
*/
public GridLayout(int columns, int rows) {
setColumns(columns);
* </p>
*
* @param c
- * the component to be added.
+ * the component to be added.
* @param column1
- * the column of the upper left corner of the area <code>c</code>
- * is supposed to occupy.
+ * the column of the upper left corner of the area
+ * <code>c</code> is supposed to occupy.
* @param row1
- * the row of the upper left corner of the area <code>c</code> is
- * supposed to occupy.
+ * the row of the upper left corner of the area
+ * <code>c</code> is supposed to occupy.
* @param column2
- * the column of the lower right corner of the area
- * <code>c</code> is supposed to occupy.
+ * the column of the lower right corner of the area
+ * <code>c</code> is supposed to occupy.
* @param row2
- * the row of the lower right corner of the area <code>c</code>
- * is supposed to occupy.
+ * the row of the lower right corner of the area
+ * <code>c</code> is supposed to occupy.
* @throws OverlapsException
- * if the new component overlaps with any of the components
- * already in the grid.
+ * if the new component overlaps with any of the components
+ * already in the grid.
* @throws OutOfBoundsException
- * if the cells are outside of the grid area.
+ * if the cells are outside of the grid area.
*/
public void addComponent(Component component, int column1, int row1,
int column2, int row2) throws OverlapsException,
* grid.
*
* @param area
- * the Area to be checked for overlapping.
+ * the Area to be checked for overlapping.
* @throws OverlapsException
- * if <code>area</code> overlaps with any existing area.
+ * if <code>area</code> overlaps with any existing area.
*/
private void checkExistingOverlaps(Area area) throws OverlapsException {
for (final Iterator i = areas.iterator(); i.hasNext();) {
* the same as column1,row1. Component width and height is 1.
*
* @param c
- * the component to be added.
+ * the component to be added.
* @param column
- * the column index.
+ * the column index.
* @param row
- * the row index.
+ * the row index.
*/
public void addComponent(Component c, int column, int row) {
this.addComponent(c, column, row, column, row);
* grid is automatically extended.
*
* @param c
- * the component to be added.
+ * the component to be added.
*/
+ @Override
public void addComponent(Component component) {
// Finds first available place from the grid
* Removes the given component from this container.
*
* @param c
- * the component to be removed.
+ * the component to be removed.
*/
+ @Override
public void removeComponent(Component component) {
// Check that the component is contained in the container
* Removes the component specified with it's cell index.
*
* @param column
- * the Component's column.
+ * the Component's column.
* @param row
- * the Component's row.
+ * the Component's row.
*/
public void removeComponent(int column, int row) {
* Paints the contents of this component.
*
* @param target
- * the Paint Event.
+ * the Paint Event.
* @throws PaintException
- * if the paint operation failed.
+ * if the paint operation failed.
*/
+ @Override
public void paintContent(PaintTarget target) throws PaintException {
super.paintContent(target);
if (!equallyDividedRows) {
int myRatio = Math
.round((getRowExpandRatio(cury) / rowSum) * 1000);
- rowExpandRatioArray[index] = myRatio;
+ rowExpandRatioArray[cury] = myRatio;
realRowExpandRatioSum += myRatio;
}
/*
* (non-Javadoc)
*
- * @see
- * com.itmill.toolkit.ui.Layout.AlignmentHandler#getComponentAlignment(com
- * .itmill.toolkit.ui.Component)
+ * @see com.itmill.toolkit.ui.Layout.AlignmentHandler#getComponentAlignment(com
+ * .itmill.toolkit.ui.Component)
*/
public int getComponentAlignment(Component childComponent) {
final Integer bitMask = (Integer) componentToAlignment
* @return the Component UIDL tag as string.
* @see com.itmill.toolkit.ui.AbstractComponent#getTag()
*/
+ @Override
public String getTag() {
return "gridlayout";
}
* </p>
*
* @param component
- * the component connected to the area.
+ * the component connected to the area.
* @param column1
- * The column of the upper left corner cell of the area
- * <code>c</code> is supposed to occupy.
+ * The column of the upper left corner cell of the area
+ * <code>c</code> is supposed to occupy.
* @param row1
- * The row of the upper left corner cell of the area
- * <code>c</code> is supposed to occupy.
+ * The row of the upper left corner cell of the area
+ * <code>c</code> is supposed to occupy.
* @param column2
- * The column of the lower right corner cell of the area
- * <code>c</code> is supposed to occupy.
+ * The column of the lower right corner cell of the area
+ * <code>c</code> is supposed to occupy.
* @param row2
- * The row of the lower right corner cell of the area
- * <code>c</code> is supposed to occupy.
+ * The row of the lower right corner cell of the area
+ * <code>c</code> is supposed to occupy.
* @throws OverlapsException
- * if the new component overlaps with any of the components
- * already in the grid
+ * if the new component overlaps with any of the
+ * components already in the grid
*/
public Area(Component component, int column1, int row1, int column2,
int row2) {
* Tests if the given Area overlaps with an another Area.
*
* @param other
- * the Another Area that's to be tested for overlap with this
- * area.
- * @return <code>true</code> if <code>other</code> overlaps with this
- * area, <code>false</code> if it doesn't.
+ * the Another Area that's to be tested for overlap with
+ * this area.
+ * @return <code>true</code> if <code>other</code> overlaps with
+ * this area, <code>false</code> if it doesn't.
*/
public boolean overlaps(Area other) {
return column1 <= other.getColumn2() && row1 <= other.getRow2()
* </p>
*
* @param newComponent
- * the new connected overriding the existing one.
+ * the new connected overriding the existing one.
*/
protected void setComponent(Component newComponent) {
component = newComponent;
*
* @see com.itmill.toolkit.ui.GridLayout#getColumn1()
*/
+ @Deprecated
public int getX1() {
return getColumn1();
}
*
* @see com.itmill.toolkit.ui.GridLayout#getColumn2()
*/
+ @Deprecated
public int getX2() {
return getColumn2();
}
*
* @see com.itmill.toolkit.ui.GridLayout#getRow1()
*/
+ @Deprecated
public int getY1() {
return getRow1();
}
*
* @see com.itmill.toolkit.ui.GridLayout#getRow2()
*/
+ @Deprecated
public int getY2() {
return getRow2();
}
}
/**
- * An <code>Exception</code> object which is thrown when an area exceeds the
- * bounds of the grid.
+ * An <code>Exception</code> object which is thrown when an area exceeds
+ * the bounds of the grid.
*
* @author IT Mill Ltd.
* @version
* reduced if there are any areas that would be outside of the shrunk grid.
*
* @param columns
- * the new number of columns in the grid.
+ * the new number of columns in the grid.
*/
public void setColumns(int columns) {
* reduced if there are any areas that would be outside of the shrunk grid.
*
* @param rows
- * the new number of rows in the grid.
+ * the new number of rows in the grid.
*/
public void setRows(int rows) {
*
* @see com.itmill.toolkit.ui.ComponentContainer#removeAllComponents()
*/
+ @Override
public void removeAllComponents() {
super.removeAllComponents();
componentToAlignment = new HashMap();
/*
* (non-Javadoc)
*
- * @see
- * com.itmill.toolkit.ui.Layout.AlignmentHandler#setComponentAlignment(com
- * .itmill.toolkit.ui.Component, int, int)
+ * @see com.itmill.toolkit.ui.Layout.AlignmentHandler#setComponentAlignment(com
+ * .itmill.toolkit.ui.Component, int, int)
*/
public void setComponentAlignment(Component childComponent,
int horizontalAlignment, int verticalAlignment) {
* Inserts an empty row at the chosen position in the grid.
*
* @param row
- * Number of the row the new row will be inserted before
+ * Number of the row the new row will be inserted before
*/
public void insertRow(int row) {
if (row > rows) {
* row.
*
* @param row
- * The row number to remove
+ * The row number to remove
*/
public void removeRow(int row) {
if (row >= rows) {