aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/itmill/toolkit/ui/GridLayout.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/itmill/toolkit/ui/GridLayout.java')
-rw-r--r--src/com/itmill/toolkit/ui/GridLayout.java115
1 files changed, 61 insertions, 54 deletions
diff --git a/src/com/itmill/toolkit/ui/GridLayout.java b/src/com/itmill/toolkit/ui/GridLayout.java
index 88dfb5d5cb..4d313721e2 100644
--- a/src/com/itmill/toolkit/ui/GridLayout.java
+++ b/src/com/itmill/toolkit/ui/GridLayout.java
@@ -97,9 +97,9 @@ public class GridLayout extends AbstractLayout implements
* 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);
@@ -127,24 +127,24 @@ public class GridLayout extends AbstractLayout implements
* </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,
@@ -220,9 +220,9 @@ public class GridLayout extends AbstractLayout implements
* 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();) {
@@ -240,11 +240,11 @@ public class GridLayout extends AbstractLayout implements
* 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);
@@ -283,8 +283,9 @@ public class GridLayout extends AbstractLayout implements
* 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
@@ -311,8 +312,9 @@ public class GridLayout extends AbstractLayout implements
* 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
@@ -344,9 +346,9 @@ public class GridLayout extends AbstractLayout implements
* 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) {
@@ -374,10 +376,11 @@ public class GridLayout extends AbstractLayout implements
* 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);
@@ -454,7 +457,7 @@ public class GridLayout extends AbstractLayout implements
if (!equallyDividedRows) {
int myRatio = Math
.round((getRowExpandRatio(cury) / rowSum) * 1000);
- rowExpandRatioArray[index] = myRatio;
+ rowExpandRatioArray[cury] = myRatio;
realRowExpandRatioSum += myRatio;
}
@@ -611,9 +614,8 @@ public class GridLayout extends AbstractLayout implements
/*
* (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
@@ -631,6 +633,7 @@ public class GridLayout extends AbstractLayout implements
* @return the Component UIDL tag as string.
* @see com.itmill.toolkit.ui.AbstractComponent#getTag()
*/
+ @Override
public String getTag() {
return "gridlayout";
}
@@ -678,22 +681,22 @@ public class GridLayout extends AbstractLayout implements
* </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) {
@@ -708,10 +711,10 @@ public class GridLayout extends AbstractLayout implements
* 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()
@@ -737,7 +740,7 @@ public class GridLayout extends AbstractLayout implements
* </p>
*
* @param newComponent
- * the new connected overriding the existing one.
+ * the new connected overriding the existing one.
*/
protected void setComponent(Component newComponent) {
component = newComponent;
@@ -748,6 +751,7 @@ public class GridLayout extends AbstractLayout implements
*
* @see com.itmill.toolkit.ui.GridLayout#getColumn1()
*/
+ @Deprecated
public int getX1() {
return getColumn1();
}
@@ -766,6 +770,7 @@ public class GridLayout extends AbstractLayout implements
*
* @see com.itmill.toolkit.ui.GridLayout#getColumn2()
*/
+ @Deprecated
public int getX2() {
return getColumn2();
}
@@ -784,6 +789,7 @@ public class GridLayout extends AbstractLayout implements
*
* @see com.itmill.toolkit.ui.GridLayout#getRow1()
*/
+ @Deprecated
public int getY1() {
return getRow1();
}
@@ -802,6 +808,7 @@ public class GridLayout extends AbstractLayout implements
*
* @see com.itmill.toolkit.ui.GridLayout#getRow2()
*/
+ @Deprecated
public int getY2() {
return getRow2();
}
@@ -855,8 +862,8 @@ public class GridLayout extends AbstractLayout implements
}
/**
- * 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
@@ -897,7 +904,7 @@ public class GridLayout extends AbstractLayout implements
* 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) {
@@ -941,7 +948,7 @@ public class GridLayout extends AbstractLayout implements
* 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) {
@@ -1039,6 +1046,7 @@ public class GridLayout extends AbstractLayout implements
*
* @see com.itmill.toolkit.ui.ComponentContainer#removeAllComponents()
*/
+ @Override
public void removeAllComponents() {
super.removeAllComponents();
componentToAlignment = new HashMap();
@@ -1049,9 +1057,8 @@ public class GridLayout extends AbstractLayout implements
/*
* (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) {
@@ -1083,7 +1090,7 @@ public class GridLayout extends AbstractLayout implements
* 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) {
@@ -1120,7 +1127,7 @@ public class GridLayout extends AbstractLayout implements
* row.
*
* @param row
- * The row number to remove
+ * The row number to remove
*/
public void removeRow(int row) {
if (row >= rows) {