summaryrefslogtreecommitdiffstats
path: root/src/com/itmill/toolkit/ui/Panel.java
diff options
context:
space:
mode:
authorMatti Tahvonen <matti.tahvonen@itmill.com>2008-01-28 10:22:16 +0000
committerMatti Tahvonen <matti.tahvonen@itmill.com>2008-01-28 10:22:16 +0000
commitd48f8a80f403e0ebb21cf6fa7aafde091e43d35b (patch)
tree67646c1518ea2a92a3e5df50c4d9ba07e9c39d8c /src/com/itmill/toolkit/ui/Panel.java
parentafc95e6c9482fc0611449d3d0be7c33ac7daa82b (diff)
downloadvaadin-framework-d48f8a80f403e0ebb21cf6fa7aafde091e43d35b.tar.gz
vaadin-framework-d48f8a80f403e0ebb21cf6fa7aafde091e43d35b.zip
component implements sizeable and simple general terminal implementation
svn changeset:3662/svn branch:trunk
Diffstat (limited to 'src/com/itmill/toolkit/ui/Panel.java')
-rw-r--r--src/com/itmill/toolkit/ui/Panel.java99
1 files changed, 14 insertions, 85 deletions
diff --git a/src/com/itmill/toolkit/ui/Panel.java b/src/com/itmill/toolkit/ui/Panel.java
index 22f87ac220..a155759761 100644
--- a/src/com/itmill/toolkit/ui/Panel.java
+++ b/src/com/itmill/toolkit/ui/Panel.java
@@ -11,12 +11,10 @@ import java.util.Map;
import com.itmill.toolkit.event.Action;
import com.itmill.toolkit.event.ShortcutAction;
import com.itmill.toolkit.event.Action.Handler;
-import com.itmill.toolkit.terminal.HasSize;
import com.itmill.toolkit.terminal.KeyMapper;
import com.itmill.toolkit.terminal.PaintException;
import com.itmill.toolkit.terminal.PaintTarget;
import com.itmill.toolkit.terminal.Scrollable;
-import com.itmill.toolkit.terminal.Size;
/**
* Panel - a simple single component container.
@@ -26,15 +24,13 @@ import com.itmill.toolkit.terminal.Size;
* @VERSION@
* @since 3.0
*/
-public class Panel extends AbstractComponentContainer implements HasSize,
- Scrollable, ComponentContainer.ComponentAttachListener,
+public class Panel extends AbstractComponentContainer implements Scrollable,
+ ComponentContainer.ComponentAttachListener,
ComponentContainer.ComponentDetachListener, Action.Container {
public static final String STYLE_LIGHT = "light";
public static final String STYLE_EMPHASIZE = "emphasize";
-
- private Size size;
/**
* Layout of the panel.
@@ -67,7 +63,6 @@ public class Panel extends AbstractComponentContainer implements HasSize,
*/
public Panel() {
setLayout(null);
- size = new Size(this);
}
/**
@@ -78,7 +73,6 @@ public class Panel extends AbstractComponentContainer implements HasSize,
*/
public Panel(Layout layout) {
setLayout(layout);
- size = new Size(this);
}
/**
@@ -102,7 +96,6 @@ public class Panel extends AbstractComponentContainer implements HasSize,
public Panel(String caption, Layout layout) {
this(layout);
setCaption(caption);
- size = new Size(this);
}
/**
@@ -169,13 +162,13 @@ public class Panel extends AbstractComponentContainer implements HasSize,
layout.paint(target);
// Add size info as variables
- if (size.getHeight() > -1) {
- target.addVariable(this, "height", size.getHeight()
- + Size.UNIT_SYMBOLS[size.getHeightUnits()]);
+ if (getHeight() > -1) {
+ target.addVariable(this, "height", getHeight()
+ + UNIT_SYMBOLS[getHeightUnits()]);
}
- if (size.getWidth() > -1) {
- target.addVariable(this, "width", size.getWidth()
- + Size.UNIT_SYMBOLS[size.getWidthUnits()]);
+ if (getWidth() > -1) {
+ target.addVariable(this, "width", getWidth()
+ + UNIT_SYMBOLS[getWidthUnits()]);
}
if (isScrollable()) {
@@ -282,16 +275,16 @@ public class Panel extends AbstractComponentContainer implements HasSize,
// Get new size
final Integer newWidth = (Integer) variables.get("width");
final Integer newHeight = (Integer) variables.get("height");
- if (newWidth != null && newWidth.intValue() != size.getWidth()) {
- size.setWidth(newWidth.intValue());
+ if (newWidth != null && newWidth.intValue() != getWidth()) {
+ setWidth(newWidth.intValue());
// ensure units, as we are reading pixels
- size.setWidthUnits(Size.UNITS_PIXELS);
+ setWidthUnits(UNITS_PIXELS);
}
- if (newHeight != null && newHeight.intValue() != size.getHeight()) {
- size.setHeight(newHeight.intValue());
+ if (newHeight != null && newHeight.intValue() != getHeight()) {
+ setHeight(newHeight.intValue());
// ensure units, as we are reading pixels
- size.setHeightUnits(Size.UNITS_PIXELS);
+ setHeightUnits(UNITS_PIXELS);
}
// Scrolling
@@ -462,68 +455,4 @@ public class Panel extends AbstractComponentContainer implements HasSize,
requestRepaint();
}
}
-
- public Size getSize() {
- return size;
- }
-
-
- /* Compatibility methods */
-
- /**
- * @deprecated use Size object instead (getSize().setWidth()).
- */
- public void setWidth(int width) {
- size.setWidth(width);
- }
-
- /**
- * @deprecated use Size object instead (getSize().setWidthUnits()).
- */
- public void setWidthUnits(int unit) {
- size.setWidthUnits(unit);
- }
-
- /**
- * @deprecated use Size object instead (getSize().setHeight()).
- */
- public void setHeight(int height) {
- size.setHeight(height);
- }
-
- /**
- * @deprecated use Size object instead (getSize().setHeightUnits()).
- */
- public void setHeightUnits(int unit) {
- size.setHeightUnits(unit);
- }
-
- /**
- * @deprecated use Size object instead (getSize().getWidth()).
- */
- public int getWidth() {
- return size.getWidth();
- }
-
- /**
- * @deprecated use Size object instead (getSize().getWidthUnits()).
- */
- public int getWidthUnits() {
- return size.getWidthUnits();
- }
-
- /**
- * @deprecated use Size object instead (getSize().getHeight()).
- */
- public int getHeight() {
- return size.getHeight();
- }
-
- /**
- * @deprecated use Size object instead (getSize().getHeightUnits()).
- */
- public int getHeightUnits() {
- return size.getHeightUnits();
- }
-
}