diff options
author | Marc Englund <marc.englund@itmill.com> | 2007-11-19 14:03:05 +0000 |
---|---|---|
committer | Marc Englund <marc.englund@itmill.com> | 2007-11-19 14:03:05 +0000 |
commit | f2e3722df9676436680afc0f1991e91e1696fb99 (patch) | |
tree | 6f255ff78abaf96f1e71a1f2c9ecd3b66647f4a2 /src/com/itmill/toolkit/ui/AbstractLayout.java | |
parent | 93291f532db9d545cf2a8dd98e2671f27cd197b0 (diff) | |
download | vaadin-framework-f2e3722df9676436680afc0f1991e91e1696fb99.tar.gz vaadin-framework-f2e3722df9676436680afc0f1991e91e1696fb99.zip |
MASS REFORMAT.
According to http://toolkit.intra.itmill.com/trac/itmilltoolkit/wiki/CodingConventions
svn changeset:2864/svn branch:trunk
Diffstat (limited to 'src/com/itmill/toolkit/ui/AbstractLayout.java')
-rw-r--r-- | src/com/itmill/toolkit/ui/AbstractLayout.java | 358 |
1 files changed, 181 insertions, 177 deletions
diff --git a/src/com/itmill/toolkit/ui/AbstractLayout.java b/src/com/itmill/toolkit/ui/AbstractLayout.java index 6e7049bacc..c862c0a48b 100644 --- a/src/com/itmill/toolkit/ui/AbstractLayout.java +++ b/src/com/itmill/toolkit/ui/AbstractLayout.java @@ -15,182 +15,186 @@ import com.itmill.toolkit.terminal.gwt.client.ui.MarginInfo; * @since 5.0 */ public abstract class AbstractLayout extends AbstractComponentContainer - implements Layout { - - protected MarginInfo margins = new MarginInfo(false,false,false,false); - - /** - * Height of the layout. Set to -1 for undefined height. - */ - private int height = -1; - - /** - * Height unit. - * - * @see com.itmill.toolkit.terminal.Sizeable.UNIT_SYMBOLS; - */ - private int heightUnit = UNITS_PIXELS; - - /** - * Width of the layout. Set to -1 for undefined width. - */ - private int width = -1; - - /** - * Width unit. - * - * @see com.itmill.toolkit.terminal.Sizeable.UNIT_SYMBOLS; - */ - private int widthUnit = UNITS_PIXELS; - - /* - * (non-Javadoc) - * - * @see com.itmill.toolkit.ui.AbstractComponent#getTag() - */ - public abstract String getTag(); - - /* - * (non-Javadoc) - * - * @see com.itmill.toolkit.ui.Layout#setMargin(boolean) - */ - public void setMargin(boolean enabled) { - margins.setMargins(enabled); - requestRepaint(); - } - - /* - * (non-Javadoc) - * - * @see com.itmill.toolkit.ui.Layout#setMargin(boolean, boolean, boolean, - * boolean) - */ - public void setMargin(boolean topEnabled, boolean rightEnabled, - boolean bottomEnabled, boolean leftEnabled) { - margins.setMargins(topEnabled, rightEnabled, bottomEnabled, leftEnabled); - requestRepaint(); - } - - /* - * (non-Javadoc) - * - * @see com.itmill.toolkit.terminal.Sizeable#getHeight() - */ - public int getHeight() { - return height; - } - - /* - * (non-Javadoc) - * - * @see com.itmill.toolkit.terminal.Sizeable#getHeightUnits() - */ - public int getHeightUnits() { - return heightUnit; - } - - /* - * (non-Javadoc) - * - * @see com.itmill.toolkit.terminal.Sizeable#getWidth() - */ - public int getWidth() { - return width; - } - - /* - * (non-Javadoc) - * - * @see com.itmill.toolkit.terminal.Sizeable#getWidthUnits() - */ - public int getWidthUnits() { - return widthUnit; - } - - /* - * (non-Javadoc) - * - * @see com.itmill.toolkit.terminal.Sizeable#setHeight(int) - */ - public void setHeight(int height) { - this.height = height; - requestRepaint(); - } - - /* - * (non-Javadoc) - * - * @see com.itmill.toolkit.terminal.Sizeable#setHeightUnits(int) - */ - public void setHeightUnits(int units) { - this.heightUnit = units; - requestRepaint(); - } - - /* - * (non-Javadoc) - * - * @see com.itmill.toolkit.terminal.Sizeable#setSizeFull() - */ - public void setSizeFull() { - height = 100; - width = 100; - heightUnit = UNITS_PERCENTAGE; - widthUnit = UNITS_PERCENTAGE; - requestRepaint(); - } - - /* - * (non-Javadoc) - * - * @see com.itmill.toolkit.terminal.Sizeable#setSizeUndefined() - */ - public void setSizeUndefined() { - height = -1; - width = -1; - heightUnit = UNITS_PIXELS; - widthUnit = UNITS_PIXELS; - requestRepaint(); - } - - /* - * (non-Javadoc) - * - * @see com.itmill.toolkit.terminal.Sizeable#setWidth(int) - */ - public void setWidth(int width) { - this.width = width; - requestRepaint(); - } - - /* - * (non-Javadoc) - * - * @see com.itmill.toolkit.terminal.Sizeable#setWidthUnits(int) - */ - public void setWidthUnits(int units) { - this.widthUnit = units; - requestRepaint(); - } - - /* - * (non-Javadoc) - * - * @see com.itmill.toolkit.ui.AbstractComponent#paintContent(com.itmill.toolkit.terminal.PaintTarget) - */ - public void paintContent(PaintTarget target) throws PaintException { - - // Add margin info. Defaults to false. - target.addAttribute("margins", margins.getBitMask()); - - // Size - if (getHeight() >= 0) - target.addAttribute("height", "" + getHeight() - + Sizeable.UNIT_SYMBOLS[getHeightUnits()]); - if (getWidth() >= 0) - target.addAttribute("width", "" + getWidth() - + Sizeable.UNIT_SYMBOLS[getWidthUnits()]); - } + implements Layout { + + protected MarginInfo margins = new MarginInfo(false, false, false, false); + + /** + * Height of the layout. Set to -1 for undefined height. + */ + private int height = -1; + + /** + * Height unit. + * + * @see com.itmill.toolkit.terminal.Sizeable.UNIT_SYMBOLS; + */ + private int heightUnit = UNITS_PIXELS; + + /** + * Width of the layout. Set to -1 for undefined width. + */ + private int width = -1; + + /** + * Width unit. + * + * @see com.itmill.toolkit.terminal.Sizeable.UNIT_SYMBOLS; + */ + private int widthUnit = UNITS_PIXELS; + + /* + * (non-Javadoc) + * + * @see com.itmill.toolkit.ui.AbstractComponent#getTag() + */ + public abstract String getTag(); + + /* + * (non-Javadoc) + * + * @see com.itmill.toolkit.ui.Layout#setMargin(boolean) + */ + public void setMargin(boolean enabled) { + margins.setMargins(enabled); + requestRepaint(); + } + + /* + * (non-Javadoc) + * + * @see com.itmill.toolkit.ui.Layout#setMargin(boolean, boolean, boolean, + * boolean) + */ + public void setMargin(boolean topEnabled, boolean rightEnabled, + boolean bottomEnabled, boolean leftEnabled) { + margins + .setMargins(topEnabled, rightEnabled, bottomEnabled, + leftEnabled); + requestRepaint(); + } + + /* + * (non-Javadoc) + * + * @see com.itmill.toolkit.terminal.Sizeable#getHeight() + */ + public int getHeight() { + return height; + } + + /* + * (non-Javadoc) + * + * @see com.itmill.toolkit.terminal.Sizeable#getHeightUnits() + */ + public int getHeightUnits() { + return heightUnit; + } + + /* + * (non-Javadoc) + * + * @see com.itmill.toolkit.terminal.Sizeable#getWidth() + */ + public int getWidth() { + return width; + } + + /* + * (non-Javadoc) + * + * @see com.itmill.toolkit.terminal.Sizeable#getWidthUnits() + */ + public int getWidthUnits() { + return widthUnit; + } + + /* + * (non-Javadoc) + * + * @see com.itmill.toolkit.terminal.Sizeable#setHeight(int) + */ + public void setHeight(int height) { + this.height = height; + requestRepaint(); + } + + /* + * (non-Javadoc) + * + * @see com.itmill.toolkit.terminal.Sizeable#setHeightUnits(int) + */ + public void setHeightUnits(int units) { + heightUnit = units; + requestRepaint(); + } + + /* + * (non-Javadoc) + * + * @see com.itmill.toolkit.terminal.Sizeable#setSizeFull() + */ + public void setSizeFull() { + height = 100; + width = 100; + heightUnit = UNITS_PERCENTAGE; + widthUnit = UNITS_PERCENTAGE; + requestRepaint(); + } + + /* + * (non-Javadoc) + * + * @see com.itmill.toolkit.terminal.Sizeable#setSizeUndefined() + */ + public void setSizeUndefined() { + height = -1; + width = -1; + heightUnit = UNITS_PIXELS; + widthUnit = UNITS_PIXELS; + requestRepaint(); + } + + /* + * (non-Javadoc) + * + * @see com.itmill.toolkit.terminal.Sizeable#setWidth(int) + */ + public void setWidth(int width) { + this.width = width; + requestRepaint(); + } + + /* + * (non-Javadoc) + * + * @see com.itmill.toolkit.terminal.Sizeable#setWidthUnits(int) + */ + public void setWidthUnits(int units) { + widthUnit = units; + requestRepaint(); + } + + /* + * (non-Javadoc) + * + * @see com.itmill.toolkit.ui.AbstractComponent#paintContent(com.itmill.toolkit.terminal.PaintTarget) + */ + public void paintContent(PaintTarget target) throws PaintException { + + // Add margin info. Defaults to false. + target.addAttribute("margins", margins.getBitMask()); + + // Size + if (getHeight() >= 0) { + target.addAttribute("height", "" + getHeight() + + Sizeable.UNIT_SYMBOLS[getHeightUnits()]); + } + if (getWidth() >= 0) { + target.addAttribute("width", "" + getWidth() + + Sizeable.UNIT_SYMBOLS[getWidthUnits()]); + } + } } |