com.vaadin.server
Class Page

java.lang.Object
  extended by com.vaadin.server.Page
All Implemented Interfaces:
java.io.Serializable

public class Page
extends java.lang.Object
implements java.io.Serializable

See Also:
Serialized Form

Nested Class Summary
static class Page.BrowserWindowResizeEvent
          Event that is fired when a browser window containing a uI is resized.
static interface Page.BrowserWindowResizeListener
          Listener that gets notified when the size of the browser window containing the uI has changed.
static class Page.UriFragmentChangedEvent
          Event fired when uri fragment changes.
static interface Page.UriFragmentChangedListener
          Listener that listens to changes in URI fragment.
 
Field Summary
static BorderStyle BORDER_DEFAULT
          Deprecated. As of 7.0, use BorderStyle.DEFAULT instead.
static BorderStyle BORDER_MINIMAL
          Deprecated. As of 7.0, use BorderStyle.MINIMAL instead.
static BorderStyle BORDER_NONE
          Deprecated. As of 7.0, use BorderStyle.NONE instead.
 
Constructor Summary
Page(UI uI)
           
 
Method Summary
 void addBrowserWindowResizeListener(Page.BrowserWindowResizeListener resizeListener)
          Adds a new Page.BrowserWindowResizeListener to this uI.
 void addListener(Page.BrowserWindowResizeListener resizeListener)
          Deprecated. As of 7.0, replaced by addBrowserWindowResizeListener(BrowserWindowResizeListener)
 void addListener(Page.UriFragmentChangedListener listener)
          Deprecated. As of 7.0, replaced by addUriFragmentChangedListener(UriFragmentChangedListener)
 void addUriFragmentChangedListener(Page.UriFragmentChangedListener listener)
           
 int getBrowserWindowHeight()
          Gets the last known height of the browser window in which this UI resides.
 int getBrowserWindowWidth()
          Gets the last known width of the browser window in which this uI resides.
static Page getCurrent()
          Gets the Page to which the current uI belongs.
 JavaScript getJavaScript()
           
 java.net.URI getLocation()
          Returns the location URI of this page, as reported by the browser.
 java.lang.String getUriFragment()
          Gets the currently set URI fragment.
 WebBrowser getWebBrowser()
           
 void init(VaadinRequest request)
           
 void open(Resource resource, java.lang.String windowName, boolean tryToOpenAsPopup)
          Deprecated. As of 7.0, only retained to maintain compatibility with LegacyWindow.open methods. See documentation for LegacyWindow.open(Resource, String, boolean) for discussion about replacing API.
 void open(Resource resource, java.lang.String windowName, int width, int height, BorderStyle border)
          Deprecated. As of 7.0, only retained to maintain compatibility with LegacyWindow.open methods. See documentation for LegacyWindow.open(Resource, String, int, int, BorderStyle) for discussion about replacing API.
 void open(java.lang.String url, java.lang.String windowName)
          Opens the given url in a window with the given name.
 void open(java.lang.String url, java.lang.String windowName, boolean tryToOpenAsPopup)
          Opens the given url in a window with the given name.
 void open(java.lang.String url, java.lang.String windowName, int width, int height, BorderStyle border)
          Opens the given URL in a window with the given size, border and name.
 void paintContent(PaintTarget target)
           
 void removeBrowserWindowResizeListener(Page.BrowserWindowResizeListener resizeListener)
          Removes a Page.BrowserWindowResizeListener from this UI.
 void removeListener(Page.BrowserWindowResizeListener resizeListener)
          Deprecated. As of 7.0, replaced by removeBrowserWindowResizeListener(BrowserWindowResizeListener)
 void removeListener(Page.UriFragmentChangedListener listener)
          Deprecated. As of 7.0, replaced by removeUriFragmentChangedListener(UriFragmentChangedListener)
 void removeUriFragmentChangedListener(Page.UriFragmentChangedListener listener)
           
 void setLocation(java.lang.String uri)
          Navigates this page to the given URI.
 void setLocation(java.net.URI uri)
          Navigates this page to the given URI.
 void setTitle(java.lang.String title)
          Sets the page title.
 void setUriFragment(java.lang.String newUriFragment)
          Sets URI fragment.
 void setUriFragment(java.lang.String newUriFragment, boolean fireEvents)
          Sets the fragment part in the current location URI.
 void showNotification(Notification notification)
          Deprecated. As of 7.0, use Notification.show(Page) instead.
 void updateBrowserWindowSize(int width, int height)
          Updates the internal state with the given values.
 void updateLocation(java.lang.String location)
          For internal use only.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, toString
 

Field Detail

BORDER_NONE

@Deprecated
public static final BorderStyle BORDER_NONE
Deprecated. As of 7.0, use BorderStyle.NONE instead.

BORDER_MINIMAL

@Deprecated
public static final BorderStyle BORDER_MINIMAL
Deprecated. As of 7.0, use BorderStyle.MINIMAL instead.

BORDER_DEFAULT

@Deprecated
public static final BorderStyle BORDER_DEFAULT
Deprecated. As of 7.0, use BorderStyle.DEFAULT instead.
Constructor Detail

Page

public Page(UI uI)
Method Detail

addUriFragmentChangedListener

public void addUriFragmentChangedListener(Page.UriFragmentChangedListener listener)

addListener

@Deprecated
public void addListener(Page.UriFragmentChangedListener listener)
Deprecated. As of 7.0, replaced by addUriFragmentChangedListener(UriFragmentChangedListener)


removeUriFragmentChangedListener

public void removeUriFragmentChangedListener(Page.UriFragmentChangedListener listener)

removeListener

@Deprecated
public void removeListener(Page.UriFragmentChangedListener listener)
Deprecated. As of 7.0, replaced by removeUriFragmentChangedListener(UriFragmentChangedListener)


setUriFragment

public void setUriFragment(java.lang.String newUriFragment,
                           boolean fireEvents)
Sets the fragment part in the current location URI. Optionally fires a Page.UriFragmentChangedEvent.

The fragment is the optional last component of a URI, prefixed with a hash sign ("#").

Passing null as newFragment clears the fragment (no "#" in the URI); passing an empty string sets an empty fragment (a trailing "#" in the URI.) This is consistent with the semantics of URI.

Parameters:
newUriFragment - The new fragment.
fireEvent - true to fire event
See Also:
getUriFragment(), setLocation(URI), Page.UriFragmentChangedEvent, Page.UriFragmentChangedListener

setUriFragment

public void setUriFragment(java.lang.String newUriFragment)
Sets URI fragment. This method fires a Page.UriFragmentChangedEvent

Parameters:
newUriFragment - id of the new fragment
See Also:
Page.UriFragmentChangedEvent, Page.UriFragmentChangedListener

getUriFragment

public java.lang.String getUriFragment()
Gets the currently set URI fragment.

Returns null if there is no fragment and an empty string if there is an empty fragment.

To listen to changes in fragment, hook a Page.UriFragmentChangedListener.

Returns:
the current fragment in browser location URI.
See Also:
getLocation(), setUriFragment(String), addUriFragmentChangedListener(UriFragmentChangedListener)

init

public void init(VaadinRequest request)

getWebBrowser

public WebBrowser getWebBrowser()

updateBrowserWindowSize

public void updateBrowserWindowSize(int width,
                                    int height)
Updates the internal state with the given values. Does not resize the Page or browser window.

Parameters:
width - The new width
height - The new height

addBrowserWindowResizeListener

public void addBrowserWindowResizeListener(Page.BrowserWindowResizeListener resizeListener)
Adds a new Page.BrowserWindowResizeListener to this uI. The listener will be notified whenever the browser window within which this uI resides is resized.

Parameters:
resizeListener - the listener to add
See Also:
BrowserWindowResizeListener#browserWindowResized(BrowserWindowResizeEvent), #setResizeLazy(boolean)

addListener

@Deprecated
public void addListener(Page.BrowserWindowResizeListener resizeListener)
Deprecated. As of 7.0, replaced by addBrowserWindowResizeListener(BrowserWindowResizeListener)


removeBrowserWindowResizeListener

public void removeBrowserWindowResizeListener(Page.BrowserWindowResizeListener resizeListener)
Removes a Page.BrowserWindowResizeListener from this UI. The listener will no longer be notified when the browser window is resized.

Parameters:
resizeListener - the listener to remove

removeListener

@Deprecated
public void removeListener(Page.BrowserWindowResizeListener resizeListener)
Deprecated. As of 7.0, replaced by removeBrowserWindowResizeListener(BrowserWindowResizeListener)


getBrowserWindowHeight

public int getBrowserWindowHeight()
Gets the last known height of the browser window in which this UI resides.

Returns:
the browser window height in pixels

getBrowserWindowWidth

public int getBrowserWindowWidth()
Gets the last known width of the browser window in which this uI resides.

Returns:
the browser window width in pixels

getJavaScript

public JavaScript getJavaScript()

paintContent

public void paintContent(PaintTarget target)
                  throws PaintException
Throws:
PaintException

setLocation

public void setLocation(java.lang.String uri)
Navigates this page to the given URI. The contents of this page in the browser is replaced with whatever is returned for the given URI.

Parameters:
uri - the URI to show

setLocation

public void setLocation(java.net.URI uri)
Navigates this page to the given URI. The contents of this page in the browser is replaced with whatever is returned for the given URI.

Parameters:
uri - the URI to show

getLocation

public java.net.URI getLocation()
Returns the location URI of this page, as reported by the browser. Note that this may not be consistent with the server URI the application is deployed in due to potential proxies, redirections and similar.

Returns:
The browser location URI.

updateLocation

public void updateLocation(java.lang.String location)
For internal use only. Used to update the server-side location when the client-side location changes.


open

public void open(java.lang.String url,
                 java.lang.String windowName)
Opens the given url in a window with the given name. Equivalent to open (url, windowName, true) .

The supplied windowName is used as the target name in a window.open call in the client. This means that special values such as "_blank", "_self", "_top", "_parent" have special meaning. An empty or null window name is also a special case.

"", null and "_self" as windowName all causes the URL to be opened in the current window, replacing any old contents. For downloadable content you should avoid "_self" as "_self" causes the client to skip rendering of any other changes as it considers them irrelevant (the page will be replaced by the response from the URL). This can speed up the opening of a URL, but it might also put the client side into an inconsistent state if the window content is not completely replaced e.g., if the URL is downloaded instead of displayed in the browser.

"_blank" as windowName causes the URL to always be opened in a new window or tab (depends on the browser and browser settings).

"_top" and "_parent" as windowName works as specified by the HTML standard.

Any other windowName will open the URL in a window with that name, either by opening a new window/tab in the browser or by replacing the contents of an existing window with that name.

Please note that opening a popup window in this way may be blocked by the browser's popup-blocker because the new browser window is opened when processing a response from the server. To avoid this, you should instead use Link for opening the window because browsers are more forgiving when the window is opened directly from a client-side click event.

Parameters:
url - the URL to open.
windowName - the name of the window.

open

public void open(java.lang.String url,
                 java.lang.String windowName,
                 boolean tryToOpenAsPopup)
Opens the given url in a window with the given name. Equivalent to open (url, windowName, true) .

The supplied windowName is used as the target name in a window.open call in the client. This means that special values such as "_blank", "_self", "_top", "_parent" have special meaning. An empty or null window name is also a special case.

"", null and "_self" as windowName all causes the URL to be opened in the current window, replacing any old contents. For downloadable content you should avoid "_self" as "_self" causes the client to skip rendering of any other changes as it considers them irrelevant (the page will be replaced by the response from the URL). This can speed up the opening of a URL, but it might also put the client side into an inconsistent state if the window content is not completely replaced e.g., if the URL is downloaded instead of displayed in the browser.

"_blank" as windowName causes the URL to always be opened in a new window or tab (depends on the browser and browser settings).

"_top" and "_parent" as windowName works as specified by the HTML standard.

Any other windowName will open the URL in a window with that name, either by opening a new window/tab in the browser or by replacing the contents of an existing window with that name.

Please note that opening a popup window in this way may be blocked by the browser's popup-blocker because the new browser window is opened when processing a response from the server. To avoid this, you should instead use Link for opening the window because browsers are more forgiving when the window is opened directly from a client-side click event.

Parameters:
url - the URL to open.
windowName - the name of the window.
tryToOpenAsPopup - Whether to try to force the resource to be opened in a new window

open

public void open(java.lang.String url,
                 java.lang.String windowName,
                 int width,
                 int height,
                 BorderStyle border)
Opens the given URL in a window with the given size, border and name. For more information on the meaning of windowName, see open(String, String).

Please note that opening a popup window in this way may be blocked by the browser's popup-blocker because the new browser window is opened when processing a response from the server. To avoid this, you should instead use Link for opening the window because browsers are more forgiving when the window is opened directly from a client-side click event.

Parameters:
url - the URL to open.
windowName - the name of the window.
width - the width of the window in pixels
height - the height of the window in pixels
border - the border style of the window.

open

@Deprecated
public void open(Resource resource,
                            java.lang.String windowName,
                            int width,
                            int height,
                            BorderStyle border)
Deprecated. As of 7.0, only retained to maintain compatibility with LegacyWindow.open methods. See documentation for LegacyWindow.open(Resource, String, int, int, BorderStyle) for discussion about replacing API.


open

@Deprecated
public void open(Resource resource,
                            java.lang.String windowName,
                            boolean tryToOpenAsPopup)
Deprecated. As of 7.0, only retained to maintain compatibility with LegacyWindow.open methods. See documentation for LegacyWindow.open(Resource, String, boolean) for discussion about replacing API.


showNotification

@Deprecated
public void showNotification(Notification notification)
Deprecated. As of 7.0, use Notification.show(Page) instead.

Shows a notification message.

Parameters:
notification - The notification message to show
See Also:
Notification

getCurrent

public static Page getCurrent()
Gets the Page to which the current uI belongs. This is automatically defined when processing requests to the server. In other cases, (e.g. from background threads), the current uI is not automatically defined.

Returns:
the current page instance if available, otherwise null
See Also:
UI.getCurrent()

setTitle

public void setTitle(java.lang.String title)
Sets the page title. The page title is displayed by the browser e.g. as the title of the browser window or as the title of the tab.

Parameters:
title - the new page title to set


Copyright © 2000-2011 Vaadin Ltd. All Rights Reserved.