aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/itmill/toolkit/ui/Window.java
diff options
context:
space:
mode:
authorJoonas Lehtinen <joonas.lehtinen@itmill.com>2007-03-12 08:36:04 +0000
committerJoonas Lehtinen <joonas.lehtinen@itmill.com>2007-03-12 08:36:04 +0000
commit22d3109b724e249edb8ef4abf09171d1ff80003a (patch)
tree600016e8388705b5144850a5c61d3de8e49e0f78 /src/com/itmill/toolkit/ui/Window.java
parentbe376e9d33384042daa4192712563eae603de6c2 (diff)
downloadvaadin-framework-22d3109b724e249edb8ef4abf09171d1ff80003a.tar.gz
vaadin-framework-22d3109b724e249edb8ef4abf09171d1ff80003a.zip
Window close and position management
svn changeset:843/svn branch:trunk
Diffstat (limited to 'src/com/itmill/toolkit/ui/Window.java')
-rw-r--r--src/com/itmill/toolkit/ui/Window.java69
1 files changed, 68 insertions, 1 deletions
diff --git a/src/com/itmill/toolkit/ui/Window.java b/src/com/itmill/toolkit/ui/Window.java
index 974990f48c..5a3f09a163 100644
--- a/src/com/itmill/toolkit/ui/Window.java
+++ b/src/com/itmill/toolkit/ui/Window.java
@@ -94,6 +94,13 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
/** Focused component */
private Focusable focusedComponent;
+
+ /** Distance of Window top border in pixels from top border of the containing (main window) or -1 if unspecified */
+ private int positionY = -1;
+
+ /** Distance of Window left border in pixels from left border of the containing (main window) or -1 if unspecified */
+ private int positionX = -1;
+
/* ********************************************************************* */
@@ -370,6 +377,13 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
// Contents of the window panel is painted
super.paintContent(target);
+ // Window position
+ target.addVariable(this, "positionx", getPositionX());
+ target.addVariable(this, "positiony", getPositionY());
+
+ // Window closing
+ target.addVariable(this, "close", false);
+
// Set focused component
if (this.focusedComponent != null)
target.addVariable(this, "focused", ""
@@ -644,7 +658,26 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
// We ignore invalid focusable ids
}
}
-
+
+ // Positioning
+ Integer positionx = (Integer) variables.get("positionx");
+ if (positionx != null) {
+ int x = positionx.intValue();
+ setPositionX(x<0?-1:x);
+ }
+ Integer positiony = (Integer) variables.get("positiony");
+ if (positiony != null) {
+ int y = positiony.intValue();
+ setPositionY(y<0?-1:y);
+ }
+
+ // Closing
+ Boolean close = (Boolean) variables.get("close");
+ if (close != null && close.booleanValue()) {
+
+ // TODO We should also throw an event to listeners
+ this.setVisible(false);
+ }
}
/**
@@ -700,4 +733,38 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
ref.clear();
focusableComponents.remove(id);
}
+
+ /** Get the distance of Window left border in pixels from left border of the containing (main window).
+ * @return Distance of Window left border in pixels from left border of the containing (main window). or -1 if unspecified.
+ * @since 4.0.0
+ */
+ public int getPositionX() {
+ return positionX;
+ }
+
+ /** Set the distance of Window left border in pixels from left border of the containing (main window).
+ * @param positionX Distance of Window left border in pixels from left border of the containing (main window). or -1 if unspecified
+ * @since 4.0.0
+ */
+ public void setPositionX(int positionX) {
+ this.positionX = positionX;
+ }
+
+ /** Get the distance of Window top border in pixels from top border of the containing (main window).
+ * @return Distance of Window top border in pixels from top border of the containing (main window). or -1 if unspecified
+ *
+ * @since 4.0.0
+ */
+ public int getPositionY() {
+ return positionY;
+ }
+
+ /** Set the distance of Window top border in pixels from top border of the containing (main window).
+ * @param positionY of Window top border in pixels from top border of the containing (main window). or -1 if unspecified
+ *
+ * @since 4.0.0
+ */
+ public void setPositionY(int positionY) {
+ this.positionY = positionY;
+ }
}