diff options
author | Johannes Dahlström <johannesd@vaadin.com> | 2012-06-13 18:17:45 +0300 |
---|---|---|
committer | Johannes Dahlström <johannesd@vaadin.com> | 2012-06-13 18:17:45 +0300 |
commit | 024b0a0043748d77e73a06cd7743d58d5412c5b0 (patch) | |
tree | 17b8f34782354bd735b3299de2ef9727ad941e32 | |
parent | 52d06a13b9e20cb752a21413e15adc250daa5e1c (diff) | |
download | vaadin-framework-024b0a0043748d77e73a06cd7743d58d5412c5b0.tar.gz vaadin-framework-024b0a0043748d77e73a06cd7743d58d5412c5b0.zip |
Fixed some errors caused by 6.8 merge; updated tests to use LegacyWindow/Application
7 files changed, 42 insertions, 21 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/window/VWindow.java b/src/com/vaadin/terminal/gwt/client/ui/window/VWindow.java index aa93195cb9..294240b069 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/window/VWindow.java +++ b/src/com/vaadin/terminal/gwt/client/ui/window/VWindow.java @@ -40,6 +40,7 @@ import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler; import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler.ShortcutActionHandlerOwner; import com.vaadin.terminal.gwt.client.ui.VLazyExecutor; import com.vaadin.terminal.gwt.client.ui.VOverlay; +import com.vaadin.terminal.gwt.client.ui.notification.VNotification; /** * "Sub window" component. @@ -145,6 +146,7 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, private VLazyExecutor delayedContentsSizeUpdater = new VLazyExecutor(200, new ScheduledCommand() { + @Override public void execute() { updateContentsSize(); } @@ -264,6 +266,7 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, if (!orderingDefered) { orderingDefered = true; Scheduler.get().scheduleFinally(new Command() { + @Override public void execute() { doServerSideOrdering(); VNotification.bringNotificationsToFront(); @@ -276,6 +279,7 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, orderingDefered = false; VWindow[] array = windowOrder.toArray(new VWindow[windowOrder.size()]); Arrays.sort(array, new Comparator<VWindow>() { + @Override public int compare(VWindow o1, VWindow o2) { /* * Order by modality, then by bringtofront sequence. @@ -853,10 +857,12 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, true); } + @Override public ShortcutActionHandler getShortcutActionHandler() { return shortcutHandler; } + @Override public void onScroll(ScrollEvent event) { client.updateVariable(id, "scrollTop", contentPanel.getScrollPosition(), false); @@ -865,6 +871,7 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, } + @Override public void onKeyDown(KeyDownEvent event) { if (shortcutHandler != null) { shortcutHandler @@ -873,18 +880,21 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, } } + @Override public void onBlur(BlurEvent event) { if (client.hasEventListeners(this, EventId.BLUR)) { client.updateVariable(id, EventId.BLUR, "", true); } } + @Override public void onFocus(FocusEvent event) { if (client.hasEventListeners(this, EventId.FOCUS)) { client.updateVariable(id, EventId.FOCUS, "", true); } } + @Override public void focus() { contentPanel.focus(); } diff --git a/src/com/vaadin/terminal/gwt/server/WebBrowser.java b/src/com/vaadin/terminal/gwt/server/WebBrowser.java index 8e07ff4fe5..b87fea4233 100644 --- a/src/com/vaadin/terminal/gwt/server/WebBrowser.java +++ b/src/com/vaadin/terminal/gwt/server/WebBrowser.java @@ -41,6 +41,7 @@ public class WebBrowser implements Terminal { * * @return Always returns null. */ + @Override public String getDefaultTheme() { return null; } @@ -50,6 +51,7 @@ public class WebBrowser implements Terminal { * * @see com.vaadin.terminal.Terminal#getScreenHeight() */ + @Override public int getScreenHeight() { return screenHeight; } @@ -59,6 +61,7 @@ public class WebBrowser implements Terminal { * * @see com.vaadin.terminal.Terminal#getScreenWidth() */ + @Override public int getScreenWidth() { return screenWidth; } @@ -424,8 +427,7 @@ public class WebBrowser implements Terminal { if (request.getParameter("sw") != null) { updateClientSideDetails(request.getParameter("sw"), - request.getParameter("sh"), request.getParameter("cw"), - request.getParameter("ch"), request.getParameter("tzo"), + request.getParameter("sh"), request.getParameter("tzo"), request.getParameter("rtzo"), request.getParameter("dstd"), request.getParameter("dston"), request.getParameter("curdate"), diff --git a/src/com/vaadin/ui/Window.java b/src/com/vaadin/ui/Window.java index 807b801155..889afb7e93 100644 --- a/src/com/vaadin/ui/Window.java +++ b/src/com/vaadin/ui/Window.java @@ -24,6 +24,7 @@ import com.vaadin.terminal.PaintException; import com.vaadin.terminal.PaintTarget; import com.vaadin.terminal.Vaadin6Component; import com.vaadin.terminal.gwt.client.MouseEventDetails; +import com.vaadin.terminal.gwt.client.ui.root.VRoot; import com.vaadin.terminal.gwt.client.ui.window.WindowServerRpc; import com.vaadin.terminal.gwt.client.ui.window.WindowState; @@ -78,6 +79,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, private WindowServerRpc rpc = new WindowServerRpc() { + @Override public void click(MouseEventDetails mouseDetails) { fireEvent(new ClickEvent(Window.this, mouseDetails)); } @@ -165,24 +167,24 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, // size is handled in super class, but resize events only in windows -> // so detect if size change occurs before super.changeVariables() if (variables.containsKey("height") - && (getHeightUnits() != UNITS_PIXELS || (Integer) variables + && (getHeightUnits() != Unit.PIXELS || (Integer) variables .get("height") != getHeight())) { sizeHasChanged = true; } if (variables.containsKey("width") - && (getWidthUnits() != UNITS_PIXELS || (Integer) variables + && (getWidthUnits() != Unit.PIXELS || (Integer) variables .get("width") != getWidth())) { sizeHasChanged = true; } Integer browserHeightVar = (Integer) variables - .get(VView.BROWSER_HEIGHT_VAR); + .get(VRoot.BROWSER_HEIGHT_VAR); if (browserHeightVar != null && browserHeightVar.intValue() != browserWindowHeight) { browserWindowHeight = browserHeightVar.intValue(); sizeHasChanged = true; } Integer browserWidthVar = (Integer) variables - .get(VView.BROWSER_WIDTH_VAR); + .get(VRoot.BROWSER_WIDTH_VAR); if (browserWidthVar != null && browserWidthVar.intValue() != browserWindowWidth) { browserWindowWidth = browserWidthVar.intValue(); @@ -806,11 +808,13 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * * @see com.vaadin.event.FieldEvents.FocusNotifier#addListener(com.vaadin.event.FieldEvents.FocusListener) */ + @Override public void addListener(FocusListener listener) { addListener(FocusEvent.EVENT_ID, FocusEvent.class, listener, FocusListener.focusMethod); } + @Override public void removeListener(FocusListener listener) { removeListener(FocusEvent.EVENT_ID, FocusEvent.class, listener); } @@ -822,11 +826,13 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * * @see com.vaadin.event.FieldEvents.BlurNotifier#addListener(com.vaadin.event.FieldEvents.BlurListener) */ + @Override public void addListener(BlurListener listener) { addListener(BlurEvent.EVENT_ID, BlurEvent.class, listener, BlurListener.blurMethod); } + @Override public void removeListener(BlurListener listener) { removeListener(BlurEvent.EVENT_ID, BlurEvent.class, listener); } @@ -863,7 +869,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, // Size only reported by VView -> data only available from application // level window if (getParent() != null) { - return (getParent()).getBrowserWindowHeight(); + return ((Root) getParent()).getBrowserWindowHeight(); } return browserWindowHeight; @@ -879,7 +885,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, // Size only reported by VView -> data only available from application // level window if (getParent() != null) { - return (getParent()).getBrowserWindowWidth(); + return ((Root) getParent()).getBrowserWindowWidth(); } return browserWindowWidth; diff --git a/tests/testbench/com/vaadin/tests/application/TerminalErrorNotification.java b/tests/testbench/com/vaadin/tests/application/TerminalErrorNotification.java index 93e38bac5b..b0f401598b 100644 --- a/tests/testbench/com/vaadin/tests/application/TerminalErrorNotification.java +++ b/tests/testbench/com/vaadin/tests/application/TerminalErrorNotification.java @@ -6,8 +6,8 @@ package com.vaadin.tests.application; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Window; -import com.vaadin.ui.Window.Notification; +import com.vaadin.ui.Notification; +import com.vaadin.ui.Root; public class TerminalErrorNotification extends TestBase { @@ -15,6 +15,7 @@ public class TerminalErrorNotification extends TestBase { protected void setup() { Button button = new Button("Throw exception", new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { throw new RuntimeException("You asked for it"); } @@ -27,7 +28,7 @@ public class TerminalErrorNotification extends TestBase { public void terminalError(com.vaadin.terminal.Terminal.ErrorEvent event) { event.getThrowable().printStackTrace(); - Window mainWindow = getMainWindow(); + Root mainWindow = getMainWindow(); if (mainWindow != null) { Throwable throwable = event.getThrowable(); diff --git a/tests/testbench/com/vaadin/tests/components/notification/NotificationsAndModalWindow.java b/tests/testbench/com/vaadin/tests/components/notification/NotificationsAndModalWindow.java index 562e8095f2..9c8b43ac53 100644 --- a/tests/testbench/com/vaadin/tests/components/notification/NotificationsAndModalWindow.java +++ b/tests/testbench/com/vaadin/tests/components/notification/NotificationsAndModalWindow.java @@ -3,8 +3,8 @@ package com.vaadin.tests.components.notification; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Notification; import com.vaadin.ui.Window; -import com.vaadin.ui.Window.Notification; public class NotificationsAndModalWindow extends TestBase { @@ -18,6 +18,7 @@ public class NotificationsAndModalWindow extends TestBase { Button b = new Button("Button"); b.addListener(new Button.ClickListener() { + @Override public void buttonClick(ClickEvent event) { Window w = new Window("This is a window"); diff --git a/tests/testbench/com/vaadin/tests/components/table/TableFirstRowFlicker.java b/tests/testbench/com/vaadin/tests/components/table/TableFirstRowFlicker.java index 776e7956bf..3101615cfd 100644 --- a/tests/testbench/com/vaadin/tests/components/table/TableFirstRowFlicker.java +++ b/tests/testbench/com/vaadin/tests/components/table/TableFirstRowFlicker.java @@ -1,23 +1,23 @@ package com.vaadin.tests.components.table; -import com.vaadin.Application; +import com.vaadin.Application.LegacyApplication; import com.vaadin.data.Container; import com.vaadin.data.util.IndexedContainer; import com.vaadin.ui.Label; import com.vaadin.ui.ProgressIndicator; +import com.vaadin.ui.Root.LegacyWindow; import com.vaadin.ui.Table; import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.Window; -public class TableFirstRowFlicker extends Application { +public class TableFirstRowFlicker extends LegacyApplication { Table t; @Override public void init() { - Window mainWindow = new Window("Table Row Flicker"); - mainWindow.getContent().setSizeFull(); + LegacyWindow mainWindow = new LegacyWindow(getClass().getName()); setMainWindow(mainWindow); + mainWindow.getContent().setSizeFull(); t = new Table(); t.setSizeFull(); diff --git a/tests/testbench/com/vaadin/tests/integration/PortletSizeInLiferayFreeformLayoutApplication.java b/tests/testbench/com/vaadin/tests/integration/PortletSizeInLiferayFreeformLayoutApplication.java index 1687bd588a..20967203bc 100644 --- a/tests/testbench/com/vaadin/tests/integration/PortletSizeInLiferayFreeformLayoutApplication.java +++ b/tests/testbench/com/vaadin/tests/integration/PortletSizeInLiferayFreeformLayoutApplication.java @@ -1,9 +1,9 @@ package com.vaadin.tests.integration; -import com.vaadin.Application; +import com.vaadin.Application.LegacyApplication; import com.vaadin.ui.Label; +import com.vaadin.ui.Root.LegacyWindow; import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.Window; /** * On Liferay in a freeform layout, this application should get its height from @@ -11,10 +11,11 @@ import com.vaadin.ui.Window; * * See ticket #5521. */ -public class PortletSizeInLiferayFreeformLayoutApplication extends Application { +public class PortletSizeInLiferayFreeformLayoutApplication extends + LegacyApplication { @Override public void init() { - Window mainWindow = new Window("Portlet5521 Application"); + LegacyWindow mainWindow = new LegacyWindow("Portlet5521 Application"); ((VerticalLayout) mainWindow.getContent()).setMargin(false); ((VerticalLayout) mainWindow.getContent()).setSizeFull(); // ((VerticalLayout) mainWindow.getContent()).setHeight("200px"); |