Class MultiWindow
Experimental Features for more information.Provides tracking of other Smart GWT browser windows opened by the original window, as
RemoteWindows. Includes APIs for:
- Registering event listeners for events on other windows
- Opening a new window and finding a window by name
- Moving, activating, or deactiving a window by name
- Sharing DataSources and their caches between Smart GWT windows
- Sharing
Messagingchannels between Smart GWT windows
Within the OpenFin environment, the underlying implementation is actually via the OpenFin class.
Reloading of child windows is in general supported (but see autoCopyDataSources), while reloading the main window currently is not.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidActivates (focuses) the existing window with the specified name,static voidactivate(String name, RemoteWindowCallback callback) Activates (focuses) the existing window with the specified name,static voidbringToFront(String name) Brings the existing window with the specified name to the top of the window stack.static voidbringToFront(String name, RemoteWindowCallback callback) Brings the existing window with the specified name to the top of the window stack.static voidclearEvent(MultiWindowEvent eventType) Unregisters a previously registered window event listener.static voidclearEvent(MultiWindowEvent eventType, int ID) Unregisters a previously registered window event listener.static voidCloses the existing window with the specified name,static voidstatic voidclose(String name, boolean force, RemoteWindowCallback callback) Closes the existing window with the specified name,static voiddeactivate(String name) Deactivates (blurs) the existing window with the specified name,static voiddeactivate(String name, RemoteWindowCallback callback) Deactivates (blurs) the existing window with the specified name,static RemoteWindowReturns window with the specified name, if it exists in the application.static BooleanShouldDataSourcesfrom other OpenFin windows with Smart GWT loaded be copied by reference into this window? Such DataSources will be copied: when a page in another window is loaded (potentially several DataSources at once) at the moment DataSources are created in a page loaded in another window (just that DataSource)static DataContextReturns theDataContextprovided by theopen()call that opened this window, or a newly created (on demand)DataContextif this is the main application window, or no DataContext was provided.static RemoteWindowReturns theRemoteWindowinstance for the current window (where the method was called).static RemoteWindow[]Returns a list ofRemoteWindowfor the other currently known windows (excluding thelocal window).static RemoteWindowReturns the parentRemoteWindowinstance that opened this window.static BooleanShould this window shareRealtime Messagingchannels with other windows?static voidHides the existing window with the specified name,static voidhide(String name, RemoteWindowCallback callback) Hides the existing window with the specified name,static booleanReturns whether thisRemoteWindowwraps the main application window.static voidisShowing(String name, RemoteWindowBooleanCallback callback) Checks whether a window with the specified name is showing.static voidMaximizes the existing window with the specified name,static voidmaximize(String name, RemoteWindowCallback callback) Maximizes the existing window with the specified name,static voidMinimizes the existing window with the specified name,static voidminimize(String name, RemoteWindowCallback callback) Minimizes the existing window with the specified name,static voidMoves the existing window with the specified name,static voidmove(String name, int x, int y, RemoteWindowCallback callback) Moves the existing window with the specified name,static voidOpens a new window with the specified URL, name, andDataContext.static voidopen(String url, String name, DataContext dataContext) static voidopen(String url, String name, DataContext dataContext, RemoteWindowBooleanCallback callback) static voidopen(String url, String name, DataContext dataContext, RemoteWindowBooleanCallback callback, BrowserWindowSettings windowSettings) static voidopen(String url, String name, DataContext dataContext, RemoteWindowBooleanCallback callback, BrowserWindowSettings windowSettings, MultiWindowSettings classSettings) Opens a new window with the specified URL, name, andDataContext.static voidResizes e existing window with the specified name,static voidresize(String name, int width, int height, RemoteWindowCallback callback) Resizes e existing window with the specified name,static voidRestores the existing window with the specified name,static voidrestore(String name, RemoteWindowCallback callback) Restores the existing window with the specified name,static voidsetAutoCopyDataSources(Boolean autoCopyDataSources) ShouldDataSourcesfrom other OpenFin windows with Smart GWT loaded be copied by reference into this window? Such DataSources will be copied: when a page in another window is loaded (potentially several DataSources at once) at the moment DataSources are created in a page loaded in another window (just that DataSource)static intsetEvent(MultiWindowEvent eventType, MultiWindowEventCallback listener) Registers a window event listener to be called whenever the event type occurs for any window in the application.static voidsetShareMessageChannels(Boolean shareMessageChannels) Should this window shareRealtime Messagingchannels with other windows?static voidShows the existing window with the specified name,static voidshow(String name, RemoteWindowCallback callback) Shows the existing window with the specified name,
-
Constructor Details
-
MultiWindow
public MultiWindow()
-
-
Method Details
-
setAutoCopyDataSources
ShouldDataSourcesfrom other OpenFin windows with Smart GWT loaded be copied by reference into this window? Such DataSources will be copied:- when a page in another window is loaded (potentially several DataSources at once)
- at the moment DataSources are created in a page loaded in another window (just that DataSource)
This property will default to true if OpenFin is present; otherwise, false.
Note that reloading a page that created DataSources copied by reference into other windows (via this property) is not supported.
- Parameters:
autoCopyDataSources- new autoCopyDataSources. Default value is varies.
-
getAutoCopyDataSources
ShouldDataSourcesfrom other OpenFin windows with Smart GWT loaded be copied by reference into this window? Such DataSources will be copied:- when a page in another window is loaded (potentially several DataSources at once)
- at the moment DataSources are created in a page loaded in another window (just that DataSource)
This property will default to true if OpenFin is present; otherwise, false.
Note that reloading a page that created DataSources copied by reference into other windows (via this property) is not supported.
- Returns:
- current value of autoCopyDataSources
-
activate
Activates (focuses) the existing window with the specified name,- Parameters:
name- unique window name
-
activate
Activates (focuses) the existing window with the specified name,- Parameters:
name- unique window namecallback- callback run afterRemoteWindowactivated
-
bringToFront
Brings the existing window with the specified name to the top of the window stack.- Parameters:
name- unique window name
-
bringToFront
Brings the existing window with the specified name to the top of the window stack.- Parameters:
name- unique window namecallback- callback run afterRemoteWindowis brought to the front
-
clearEvent
Unregisters a previously registered window event listener. The event type and ID returned by the originalsetEvent()call should be passed.- Parameters:
eventType- event type to register- See Also:
-
clearEvent
Unregisters a previously registered window event listener. The event type and ID returned by the originalsetEvent()call should be passed.- Parameters:
eventType- event type to registerID- ID of the event to clear. If not specified, all events of eventType will be cleared.- See Also:
-
close
Closes the existing window with the specified name,- Parameters:
name- unique window name
-
close
- See Also:
-
close
Closes the existing window with the specified name,- Parameters:
name- unique window nameforce- whether to force it closedcallback- callback run afterRemoteWindowclosed
-
deactivate
Deactivates (blurs) the existing window with the specified name,- Parameters:
name- unique window name
-
deactivate
Deactivates (blurs) the existing window with the specified name,- Parameters:
name- unique window namecallback- callback run afterRemoteWindowdeactivated
-
find
Returns window with the specified name, if it exists in the application. Note that, without OpenFin, only windows created withopen()(and the base window) can be found with this method.- Parameters:
name- unique window name- Returns:
- requested window
-
getDataContext
Returns theDataContextprovided by theopen()call that opened this window, or a newly created (on demand)DataContextif this is the main application window, or no DataContext was provided.- Returns:
DataContextfor this window
-
getLocalWindow
Returns theRemoteWindowinstance for the current window (where the method was called).- Returns:
- instance wrapping the current window
-
getOtherWindows
Returns a list ofRemoteWindowfor the other currently known windows (excluding thelocal window). This would typically only be used to initialize logic dependent on other windows. You'd want to add a handler for the {@link package com.smartgwt.client.browser.window.events.OtherWindowsChangedEvent}. to ensure you keep things updated as windows are opened or closed.- Returns:
- current set of other RemoteWindows.
-
getParentWindow
Returns the parentRemoteWindowinstance that opened this window.- Returns:
- instance wrapping the parent window or null
-
hide
Hides the existing window with the specified name,- Parameters:
name- unique window name
-
hide
Hides the existing window with the specified name,- Parameters:
name- unique window namecallback- callback run afterRemoteWindowhidden
-
isMainWindow
public static boolean isMainWindow()Returns whether thisRemoteWindowwraps the main application window.- Returns:
- whether this instance wraps the main application window
-
isShowing
Checks whether a window with the specified name is showing. Callback returns null if the window cannot be found; otherwise returns true or false according as it's showing.- Parameters:
name- unique window namecallback- callback to receive output
-
maximize
Maximizes the existing window with the specified name,- Parameters:
name- unique window name
-
maximize
Maximizes the existing window with the specified name,- Parameters:
name- unique window namecallback- callback run afterRemoteWindowmaximized
-
minimize
Minimizes the existing window with the specified name,- Parameters:
name- unique window name
-
minimize
Minimizes the existing window with the specified name,- Parameters:
name- unique window namecallback- callback run afterRemoteWindowminimized
-
move
Moves the existing window with the specified name,- Parameters:
name- unique window namex- desired x-offset of left edgey- desired y-offset of top edge
-
move
Moves the existing window with the specified name,- Parameters:
name- unique window namex- desired x-offset of left edgey- desired y-offset of top edgecallback- callback run afterRemoteWindowmoved
-
open
Opens a new window with the specified URL, name, andDataContext.Note that if the provided window name already exists, that window will just be
activated, and though the callback will be run, the supplied url, dataContext, windowSettings, and classSettings will be ignored.Support for passing POJOs (Java Object references) to the child window in the
DataContextvia APIs such asDataContext.setSharedJavaObject()is "super experimental" (beyond the feature itself, which is experimental).- Parameters:
url- url to open in the window or null to reuse the current url. SeeURLname- unique window name to open as a new window
-
open
- See Also:
-
open
public static void open(String url, String name, DataContext dataContext, RemoteWindowBooleanCallback callback) - See Also:
-
open
public static void open(String url, String name, DataContext dataContext, RemoteWindowBooleanCallback callback, BrowserWindowSettings windowSettings) - See Also:
-
open
public static void open(String url, String name, DataContext dataContext, RemoteWindowBooleanCallback callback, BrowserWindowSettings windowSettings, MultiWindowSettings classSettings) Opens a new window with the specified URL, name, andDataContext.Note that if the provided window name already exists, that window will just be
activated, and though the callback will be run, the supplied url, dataContext, windowSettings, and classSettings will be ignored.Support for passing POJOs (Java Object references) to the child window in the
DataContextvia APIs such asDataContext.setSharedJavaObject()is "super experimental" (beyond the feature itself, which is experimental).- Parameters:
url- url to open in the window or null to reuse the current url. SeeURLname- unique window name to open as a new windowdataContext- dataContext to apply to windowcallback- callback run afterRemoteWindowcreated or activated (parameter true if created)windowSettings- settings applied to child browser windowclassSettings- settings for childMultiWindowclass
-
resize
Resizes e existing window with the specified name,- Parameters:
name- unique window namewidth- desired new widthheight- desired new height
-
resize
Resizes e existing window with the specified name,- Parameters:
name- unique window namewidth- desired new widthheight- desired new heightcallback- callback run afterRemoteWindowmoved
-
restore
Restores the existing window with the specified name,- Parameters:
name- unique window name
-
restore
Restores the existing window with the specified name,- Parameters:
name- unique window namecallback- callback run afterRemoteWindowrestored
-
setEvent
Registers a window event listener to be called whenever the event type occurs for any window in the application.- Parameters:
eventType- event type to registerlistener- function to be called when event fires- Returns:
- ID number of this event, may be used to remove the event
- See Also:
-
show
Shows the existing window with the specified name,- Parameters:
name- unique window name
-
show
Shows the existing window with the specified name,- Parameters:
name- unique window namecallback- callback run afterRemoteWindowshown
-