Package com.vaadin.server

Examples of com.vaadin.server.Page$BrowserWindowResizeEvent


    @Override
    protected void setup(VaadinRequest request) {
        UI someUI = this;

        Page page = someUI.getPage();
        page.addBrowserWindowResizeListener(new BrowserWindowResizeListener() {
            @Override
            public void browserWindowResized(BrowserWindowResizeEvent event) {
                Notification.show("Window width=" + event.getWidth()
                        + ", height=" + event.getHeight());
            }
        });

        page.setUriFragment(page.getUriFragment() + "foo");
        page.addUriFragmentChangedListener(new UriFragmentChangedListener() {
            @Override
            public void uriFragmentChanged(UriFragmentChangedEvent event) {
                Notification.show("Fragment=" + event.getUriFragment());
            }
        });
View Full Code Here


    final String url = "http://www.google.com";

    @Override
    protected void setup(VaadinRequest request) {
        final Page page = getPage();

        addComponent(new TestForWindowOpen());

        addComponent(new Button("Page.open _blank always as popup",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        page.open(url, "_blank", true);
                    }
                }));

        addComponent(new Button("Page.open _blank NOT always as popup",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        page.open(url, "_blank", false);
                    }
                }));

        addComponent(new Button("Page.open _new always as popup",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        page.open(url, "_new", true);
                    }
                }));

        addComponent(new Button("Page.open _new NOT always as popup",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        page.open(url, "_new", false);
                    }
                }));
        addComponent(new Button(
                "Execute Javascript window.open(www.google.com, _blank)",
                new Button.ClickListener() {
View Full Code Here

import com.vaadin.server.Page.UriFragmentChangedEvent;

public class UriFragmentManagerTest extends TestCase {

    public void testGetSetUriFragment() {
        Page page = EasyMock.createMock(Page.class);
        UriFragmentManager manager = new UriFragmentManager(page);

        // prepare mock
        EasyMock.expect(page.getUriFragment()).andReturn("");
        page.setUriFragment("!test", false);
        EasyMock.expect(page.getUriFragment()).andReturn("!test");
        EasyMock.replay(page);

        // test manager using the mock
        assertEquals("Incorrect fragment value", "", manager.getState());
        manager.setState("test");
View Full Code Here

    public void testListener() {
        // create mocks
        IMocksControl control = EasyMock.createControl();
        Navigator navigator = control.createMock(Navigator.class);
        Page page = control.createMock(Page.class);

        UriFragmentManager manager = new UriFragmentManager(page);
        manager.setNavigator(navigator);

        EasyMock.expect(page.getUriFragment()).andReturn("!test");
        navigator.navigateTo("test");
        control.replay();

        UriFragmentChangedEvent event = new UriFragmentChangedEvent(page,
                "oldtest");
View Full Code Here

    protected void setup(VaadinRequest request) {
        r = request;
        l.setWidth("100%");
        addComponent(l);

        Page p = getPage();
        WebBrowser wb = p.getWebBrowser();

        addDetail("location", "v-loc", p.getLocation());

        addDetail("browser window width", "v-cw", p.getBrowserWindowWidth());
        addDetail("browser window height", "v-ch", p.getBrowserWindowHeight());
        addDetail("screen width", "v-sw", wb.getScreenWidth());
        addDetail("screen height", "v-sh", wb.getScreenHeight());

        addDetail("timezone offset", "v-tzo", wb.getTimezoneOffset());
        addDetail("raw timezone offset", "v-rtzo", wb.getRawTimezoneOffset());
View Full Code Here

        // browser window size available in refresh(), but we want to call
        // listeners, if any, only after refresh(). So we momentarily assign the
        // old values back before setting the new values again to ensure the
        // events are properly fired.

        Page page = getPage();

        URI oldLocation = page.getLocation();
        int oldWidth = page.getBrowserWindowWidth();
        int oldHeight = page.getBrowserWindowHeight();

        page.init(request);

        refresh(request);

        URI newLocation = page.getLocation();
        int newWidth = page.getBrowserWindowWidth();
        int newHeight = page.getBrowserWindowHeight();

        page.updateLocation(oldLocation.toString(), false);
        page.updateBrowserWindowSize(oldWidth, oldHeight, false);

        page.updateLocation(newLocation.toString(), true);
        page.updateBrowserWindowSize(newWidth, newHeight, true);
    }
View Full Code Here

     *
     * @return the JavaScript object corresponding to the current Page, or
     *         <code>null</code> if there is no current page.
     */
    public static JavaScript getCurrent() {
        Page page = Page.getCurrent();
        if (page == null) {
            return null;
        }
        return page.getJavaScript();
    }
View Full Code Here

     *
     * @return the JavaScript object corresponding to the current Page, or
     *         <code>null</code> if there is no current page.
     */
    public static JavaScript getCurrent() {
        Page page = Page.getCurrent();
        if (page == null) {
            return null;
        }
        return page.getJavaScript();
    }
View Full Code Here

TOP

Related Classes of com.vaadin.server.Page$BrowserWindowResizeEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.