aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/ui/Window.java
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/com/vaadin/ui/Window.java')
-rw-r--r--server/src/com/vaadin/ui/Window.java78
1 files changed, 18 insertions, 60 deletions
diff --git a/server/src/com/vaadin/ui/Window.java b/server/src/com/vaadin/ui/Window.java
index d1d2c25d8b..6102350566 100644
--- a/server/src/com/vaadin/ui/Window.java
+++ b/server/src/com/vaadin/ui/Window.java
@@ -40,8 +40,8 @@ import com.vaadin.terminal.Vaadin6Component;
/**
* A component that represents a floating popup window that can be added to a
- * {@link Root}. A window is added to a {@code Root} using
- * {@link Root#addWindow(Window)}. </p>
+ * {@link UI}. A window is added to a {@code UI} using
+ * {@link UI#addWindow(Window)}. </p>
* <p>
* The contents of a window is set using {@link #setContent(ComponentContainer)}
* or by using the {@link #Window(String, ComponentContainer)} constructor. The
@@ -57,7 +57,7 @@ import com.vaadin.terminal.Vaadin6Component;
* </p>
* <p>
* In Vaadin versions prior to 7.0.0, Window was also used as application level
- * windows. This function is now covered by the {@link Root} class.
+ * windows. This function is now covered by the {@link UI} class.
* </p>
*
* @author Vaadin Ltd.
@@ -174,14 +174,14 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
final int x = positionx.intValue();
// This is information from the client so it is already using the
// position. No need to repaint.
- setPositionX(x < 0 ? -1 : x, false);
+ setPositionX(x < 0 ? -1 : x);
}
final Integer positiony = (Integer) variables.get("positiony");
if (positiony != null) {
final int y = positiony.intValue();
// This is information from the client so it is already using the
// position. No need to repaint.
- setPositionY(y < 0 ? -1 : y, false);
+ setPositionY(y < 0 ? -1 : y);
}
if (isClosable()) {
@@ -222,14 +222,14 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
* </p>
*/
public void close() {
- Root root = getRoot();
+ UI uI = getUI();
- // Don't do anything if not attached to a root
- if (root != null) {
+ // Don't do anything if not attached to a UI
+ if (uI != null) {
// focus is restored to the parent window
- root.focus();
- // subwindow is removed from the root
- root.removeWindow(this);
+ uI.focus();
+ // subwindow is removed from the UI
+ uI.removeWindow(this);
}
}
@@ -255,26 +255,8 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
* @since 4.0.0
*/
public void setPositionX(int positionX) {
- setPositionX(positionX, true);
- }
-
- /**
- * Sets the distance of Window left border in pixels from left border of the
- * containing (main window).
- *
- * @param positionX
- * the Distance of Window left border in pixels from left border
- * of the containing (main window). or -1 if unspecified.
- * @param repaintRequired
- * true if the window needs to be repainted, false otherwise
- * @since 6.3.4
- */
- private void setPositionX(int positionX, boolean repaintRequired) {
getState().setPositionX(positionX);
getState().setCentered(false);
- if (repaintRequired) {
- requestRepaint();
- }
}
/**
@@ -301,27 +283,8 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
* @since 4.0.0
*/
public void setPositionY(int positionY) {
- setPositionY(positionY, true);
- }
-
- /**
- * Sets the distance of Window top border in pixels from top border of the
- * containing (main window).
- *
- * @param positionY
- * the Distance of Window top border in pixels from top border of
- * the containing (main window). or -1 if unspecified
- * @param repaintRequired
- * true if the window needs to be repainted, false otherwise
- *
- * @since 6.3.4
- */
- private void setPositionY(int positionY, boolean repaintRequired) {
getState().setPositionY(positionY);
getState().setCentered(false);
- if (repaintRequired) {
- requestRepaint();
- }
}
private static final Method WINDOW_CLOSE_METHOD;
@@ -507,22 +470,22 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
* If there are currently several windows visible, calling this method makes
* this window topmost.
* <p>
- * This method can only be called if this window connected a root. Else an
+ * This method can only be called if this window connected a UI. Else an
* illegal state exception is thrown. Also if there are modal windows and
* this window is not modal, and illegal state exception is thrown.
* <p>
*/
public void bringToFront() {
- Root root = getRoot();
- if (root == null) {
+ UI uI = getUI();
+ if (uI == null) {
throw new IllegalStateException(
"Window must be attached to parent before calling bringToFront method.");
}
int maxBringToFront = -1;
- for (Window w : root.getWindows()) {
+ for (Window w : uI.getWindows()) {
if (!isModal() && w.isModal()) {
throw new IllegalStateException(
- "The root contains modal windows, non-modal window cannot be brought to front.");
+ "The UI contains modal windows, non-modal window cannot be brought to front.");
}
if (w.bringToFront != null) {
maxBringToFront = Math.max(maxBringToFront,
@@ -530,7 +493,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
}
}
bringToFront = Integer.valueOf(maxBringToFront + 1);
- requestRepaint();
+ markAsDirty();
}
/**
@@ -543,7 +506,6 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
public void setModal(boolean modal) {
getState().setModal(modal);
center();
- requestRepaint();
}
/**
@@ -561,7 +523,6 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
*/
public void setResizable(boolean resizable) {
getState().setResizable(resizable);
- requestRepaint();
}
/**
@@ -595,7 +556,6 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
*/
public void setResizeLazy(boolean resizeLazy) {
getState().setResizeLazy(resizeLazy);
- requestRepaint();
}
/**
@@ -609,7 +569,6 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
*/
public void center() {
getState().setCentered(true);
- requestRepaint();
}
/**
@@ -674,7 +633,6 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
*/
public void setDraggable(boolean draggable) {
getState().setDraggable(draggable);
- requestRepaint();
}
/*
@@ -838,7 +796,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
}
@Override
- public WindowState getState() {
+ protected WindowState getState() {
return (WindowState) super.getState();
}
}