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
Messaging
channels 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
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Activates (focuses) the existing window with the specified name,static void
activate
(String name, RemoteWindowCallback callback) Activates (focuses) the existing window with the specified name,static void
bringToFront
(String name) Brings the existing window with the specified name to the top of the window stack.static void
bringToFront
(String name, RemoteWindowCallback callback) Brings the existing window with the specified name to the top of the window stack.static void
clearEvent
(MultiWindowEvent eventType) Unregisters a previously registered window event listener.static void
clearEvent
(MultiWindowEvent eventType, int ID) Unregisters a previously registered window event listener.static void
Closes the existing window with the specified name,static void
static void
close
(String name, boolean force, RemoteWindowCallback callback) Closes the existing window with the specified name,static void
deactivate
(String name) Deactivates (blurs) the existing window with the specified name,static void
deactivate
(String name, RemoteWindowCallback callback) Deactivates (blurs) the existing window with the specified name,static RemoteWindow
Returns window with the specified name, if it exists in the application.static Boolean
ShouldDataSources
from 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 DataContext
Returns theDataContext
provided by theopen()
call that opened this window, or a newly created (on demand)DataContext
if this is the main application window, or no DataContext was provided.static RemoteWindow
Returns theRemoteWindow
instance for the current window (where the method was called).static RemoteWindow[]
Returns a list ofRemoteWindow
for the other currently known windows (excluding thelocal window
).static RemoteWindow
Returns the parentRemoteWindow
instance that opened this window.static Boolean
Should this window shareRealtime Messaging
channels with other windows?static void
Hides the existing window with the specified name,static void
hide
(String name, RemoteWindowCallback callback) Hides the existing window with the specified name,static boolean
Returns whether thisRemoteWindow
wraps the main application window.static void
isShowing
(String name, RemoteWindowBooleanCallback callback) Checks whether a window with the specified name is showing.static void
Maximizes the existing window with the specified name,static void
maximize
(String name, RemoteWindowCallback callback) Maximizes the existing window with the specified name,static void
Minimizes the existing window with the specified name,static void
minimize
(String name, RemoteWindowCallback callback) Minimizes the existing window with the specified name,static void
Moves the existing window with the specified name,static void
move
(String name, int x, int y, RemoteWindowCallback callback) Moves the existing window with the specified name,static void
Opens a new window with the specified URL, name, andDataContext
.static void
open
(String url, String name, DataContext dataContext) static void
open
(String url, String name, DataContext dataContext, RemoteWindowBooleanCallback callback) static void
open
(String url, String name, DataContext dataContext, RemoteWindowBooleanCallback callback, BrowserWindowSettings windowSettings) 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
.static void
Resizes e existing window with the specified name,static void
resize
(String name, int width, int height, RemoteWindowCallback callback) Resizes e existing window with the specified name,static void
Restores the existing window with the specified name,static void
restore
(String name, RemoteWindowCallback callback) Restores the existing window with the specified name,static void
setAutoCopyDataSources
(Boolean autoCopyDataSources) ShouldDataSources
from 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 int
setEvent
(MultiWindowEvent eventType, MultiWindowEventCallback listener) Registers a window event listener to be called whenever the event type occurs for any window in the application.static void
setShareMessageChannels
(Boolean shareMessageChannels) Should this window shareRealtime Messaging
channels with other windows?static void
Shows the existing window with the specified name,static void
show
(String name, RemoteWindowCallback callback) Shows the existing window with the specified name,
-
Constructor Details
-
MultiWindow
public MultiWindow()
-
-
Method Details
-
setAutoCopyDataSources
ShouldDataSources
from 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
ShouldDataSources
from 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 afterRemoteWindow
activated
-
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 afterRemoteWindow
is 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 afterRemoteWindow
closed
-
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 afterRemoteWindow
deactivated
-
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 theDataContext
provided by theopen()
call that opened this window, or a newly created (on demand)DataContext
if this is the main application window, or no DataContext was provided.- Returns:
DataContext
for this window
-
getLocalWindow
Returns theRemoteWindow
instance for the current window (where the method was called).- Returns:
- instance wrapping the current window
-
getOtherWindows
Returns a list ofRemoteWindow
for 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 parentRemoteWindow
instance 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 afterRemoteWindow
hidden
-
isMainWindow
public static boolean isMainWindow()Returns whether thisRemoteWindow
wraps 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 afterRemoteWindow
maximized
-
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 afterRemoteWindow
minimized
-
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 afterRemoteWindow
moved
-
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
DataContext
via 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. SeeURL
name
- 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
DataContext
via 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. SeeURL
name
- unique window name to open as a new windowdataContext
- dataContext to apply to windowcallback
- callback run afterRemoteWindow
created or activated (parameter true if created)windowSettings
- settings applied to child browser windowclassSettings
- settings for childMultiWindow
class
-
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 afterRemoteWindow
moved
-
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 afterRemoteWindow
restored
-
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 afterRemoteWindow
shown
-