public class Window extends Object
Modifier | Constructor and Description |
---|---|
protected |
Window(Application application)
Window constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addEventListener(String type,
EventListener listener,
AckListener callback)
Registers an event listener on the specified event
|
void |
animate(AnimationTransitions transitions,
AnimationOptions options,
AckListener callback)
Performs the specified window transitions
|
void |
blur()
Removes focus to the window
|
void |
blur(AckListener listener)
Removes focus to the window
|
void |
bringToFront()
Brings the window to the front of the window stack
|
void |
bringToFront(AckListener listener)
Brings the window to the front of the window stack
|
void |
close()
Closes the window
|
void |
close(AckListener listener)
Closes the window
|
void |
disableFrame(AckListener callback)
Prevents a user from changing a window's size/position when using the window's frame
|
void |
embedComponentSizeChange(int width,
int height)
Update width and height of parent window for embedded window
|
void |
embedInto(long parentHwndId,
int width,
int height,
AckListener callback)
Embeds a window in a target window
|
void |
enableFrame(AckListener callback)
Allows a user from changing a window's size/position when using the window's frame
|
void |
flash(AckListener callback)
Draws attention to the window by flashing the taskbar and window caption.
|
void |
focus()
Gives focus to the window
|
void |
focus(AckListener listener)
Gives focus to the window
|
void |
getBounds(AsyncCallback<WindowBounds> callback,
AckListener listener)
Gets the current bounds (top, left, width, height) of the window
|
void |
getGroup(AsyncCallback<List<Window>> groupHandler,
AckListener callback)
Passes a list of wrapped windows in the same group
An empty list is returned if the window is not in a group.
|
String |
getName()
Gets name
|
void |
getNativeId(AckListener listener)
Gets HWND of the current window
|
void |
getOptions(AsyncCallback<WindowOptions> callback,
AckListener listener)
Returns the current options as stored in the desktop
|
Application |
getParentApplication()
Returns the wrapped application that this window belongs to
|
Window |
getParentWindow()
Get parent window
|
void |
getSnapshot(AckListener callback)
Gets a base64 encoded PN snapshot of the window
|
void |
getState(AckListener listener)
Gets the current state ("minimized", "maximized", or "restored") of the window
|
String |
getUuid()
Gets UUID
|
void |
hide()
Hides the window if it is shown
|
void |
hide(AckListener listener)
Hides the window if it is shown
|
void |
isShowing(AckListener listener)
Determines if the window is currently showing
|
void |
joinGroup(Window window)
Joins the same window group as the specified window
When windows are joined, if the user moves one of the windows,
all other windows in the same group move too.
|
void |
joinGroup(Window window,
AckListener callback)
Joins the same window group as the specified window
|
void |
leaveGroup()
Leaves the current window group so that the window
can be move independently of those in the group.
|
void |
leaveGroup(AckListener callback)
Leaves the current window group so that the window
can be move independently of those in the group.
|
void |
maximize()
Maximizes the window
|
void |
maximize(AckListener listener)
Maximizes the window
|
void |
mergeGroups(Window window)
Merges the instance's window group with the same window group as the specified window.
|
void |
mergeGroups(Window window,
AckListener callback)
Merges the instance's window group with the same window group as the specified window.
|
void |
minimize()
Minimizes the window
|
void |
minimize(AckListener listener)
Minimizes the window
|
void |
moveBy(int deltaLeft,
int deltaTop)
Moves the window by a specified amount
|
void |
moveBy(int deltaLeft,
int deltaTop,
AckListener listener)
Moves the window by a specified amount
|
void |
moveTo(int left,
int top)
Moves the window to a specified location
|
void |
moveTo(int left,
int top,
AckListener listener)
Moves the window to a specified location
|
void |
removeEventListener(String type,
EventListener listener,
AckListener callback)
Removes a previously registered event listener from the specified event
|
void |
resizeBy(int deltaWidth,
int deltaHeight,
String anchor)
Resizes the window by the specified amount
|
void |
resizeBy(int deltaWidth,
int deltaHeight,
String anchor,
AckListener listener)
Resizes the window by the specified amount
|
void |
resizeTo(int width,
int height,
AckListener listener)
Resizes the window to the specified dimensions
|
void |
resizeTo(int width,
int height,
String anchor)
Resizes the window to the specified dimensions
|
void |
resizeTo(int width,
int height,
String anchor,
AckListener listener)
Resizes the window to the specified dimensions
|
void |
restore()
Restores the window
|
void |
restore(AckListener listener)
Restores the window
|
void |
setAsForeground(AckListener callback)
Set's the window as the foreground window
The window is activated(focused) and brought to front
|
void |
setBounds(int left,
int top,
int width,
int height,
AckListener listener)
Sets the current bounds (top, left, width, height) of the window
|
void |
show()
Shows the window if it is hidden
|
void |
show(AckListener listener)
Shows the window if it is hidden
|
void |
showAt(int left,
int top,
boolean toggle)
Shows the window if it is hidden at the specified location
|
void |
showAt(int left,
int top,
boolean toggle,
AckListener listener)
Shows the window if it is hidden at the specified location
|
void |
stopFlashing(AckListener callback)
Stops flashing of taskbar and window caption
|
void |
updateOptions(org.json.JSONObject options)
Changes a window's options that were defined upon creation
|
void |
updateOptions(WindowOptions options,
AckListener listener)
Changes a window's options that were defined upon creation
|
static Window |
wrap(String applicationUuid,
String windowName,
DesktopConnection connection)
Attaches a Window object to an application Window that already exists
|
protected Window(Application application)
application
- Parent Applicationpublic String getUuid()
public String getName()
public Application getParentApplication()
public Window getParentWindow()
public void getSnapshot(AckListener callback)
callback
- AckListener for the requestAckListener
public void show() throws DesktopException
DesktopException
- if the window fails to showDesktopException
public void show(AckListener listener)
listener
- AckListener for the requestAckListener
public void hide() throws DesktopException
DesktopException
- if the window fails to hideDesktopException
public void hide(AckListener listener)
listener
- AckListener for the requestAckListener
public void close() throws DesktopException
DesktopException
- if the window fails to closeDesktopException
public void close(AckListener listener)
listener
- AckListener for the requestAckListener
public void minimize() throws DesktopException
DesktopException
- if the window fails to minimizeDesktopException
public void minimize(AckListener listener)
listener
- AckListener for the requestAckListener
public void maximize() throws DesktopException
DesktopException
- if the window fails to maximizeDesktopException
public void maximize(AckListener listener)
listener
- AckListener for the requestAckListener
public void restore() throws DesktopException
DesktopException
- if the window fails to restoreDesktopException
public void restore(AckListener listener)
listener
- AckListener for the requestAckListener
public void focus() throws DesktopException
DesktopException
- if the windw fails to gain focusDesktopException
public void focus(AckListener listener)
listener
- AckListener for the requestAckListener
public void blur() throws DesktopException
DesktopException
- if the window fails to lose focusDesktopException
public void blur(AckListener listener)
listener
- AckListener for the requestAckListener
public void flash(AckListener callback)
callback
- AckListener for the requestAckListener
public void stopFlashing(AckListener callback)
callback
- AckListener for the requestAckListener
public void showAt(int left, int top, boolean toggle) throws DesktopException
left
- The left position of the windowtop
- The right position of the windowtoggle
- If true, the window will alternate between showing and hiding in subsequent callsDesktopException
- if the window fails to showDesktopException
public void showAt(int left, int top, boolean toggle, AckListener listener) throws DesktopException
left
- The left position of the windowtop
- The right position of the windowtoggle
- If true, the window will alternate between showing and hiding in subsequent callslistener
- AckListener for the requestDesktopException
- if the window fails to showAckListener
,
DesktopException
public void moveTo(int left, int top) throws DesktopException
left
- The left position of the windowtop
- The right position of the windowDesktopException
- if the window fails to moveDesktopException
public void moveTo(int left, int top, AckListener listener) throws DesktopException
left
- The left position of the windowtop
- The right position of the windowlistener
- AckListener for the requestDesktopException
- if the window fails to moveAckListener
,
DesktopException
public void moveBy(int deltaLeft, int deltaTop) throws DesktopException
deltaLeft
- The change in the left position of the windowdeltaTop
- The change in the top position of the windowDesktopException
- if the window fails to moveDesktopException
public void moveBy(int deltaLeft, int deltaTop, AckListener listener) throws DesktopException
deltaLeft
- The change in the left position of the windowdeltaTop
- The change in the top position of the windowlistener
- AckListener for the requestDesktopException
- if the window fails to moveAckListener
,
DesktopException
public void resizeTo(int width, int height, String anchor) throws DesktopException
width
- Width of the windowheight
- Height of the windowanchor
- Specifies a corner to remain fixed during the resize.
Can take the values:
"top-left"
"top-right"
"bottom-left"
"bottom-right"
If undefined, the default is "top-left".DesktopException
- if the windw fails to resizeDesktopException
public void resizeTo(int width, int height, String anchor, AckListener listener) throws DesktopException
width
- Width of the windowheight
- Height of the windowanchor
- Specifies a corner to remain fixed during the resize.
Can take the values:
"top-left"
"top-right"
"bottom-left"
"bottom-right"
If undefined, the default is "top-left".listener
- AckListener for the requestDesktopException
- if the window fails to resizeAckListener
,
DesktopException
public void resizeTo(int width, int height, AckListener listener) throws DesktopException
width
- Width of the windowheight
- Height of the windowlistener
- AckListener for the requestDesktopException
- if the window fails to resizeAckListener
,
DesktopException
public void resizeBy(int deltaWidth, int deltaHeight, String anchor) throws DesktopException
deltaWidth
- Width delta of the windowdeltaHeight
- Height delta of the windowanchor
- Specifies a corner to remain fixed during the resize. Please check resizeTo method for more informationDesktopException
- if the window fails to resizeDesktopException
public void resizeBy(int deltaWidth, int deltaHeight, String anchor, AckListener listener) throws DesktopException
deltaWidth
- Width delta of the windowdeltaHeight
- Height delta of the windowanchor
- Specifies a corner to remain fixed during the resize. Please check resizeTo method for more informationlistener
- AckListener for the requestDesktopException
- if the window fails to resizeAckListener
,
DesktopException
public void getState(AckListener listener)
listener
- AckListener for the requestAckListener
public void bringToFront(AckListener listener)
listener
- AckListener for the requestAckListener
public void isShowing(AckListener listener)
listener
- AckListener for the requestAckListener
public void getBounds(AsyncCallback<WindowBounds> callback, AckListener listener)
callback
- A function that is called if the method succeedslistener
- A function that is called if the method failsAsyncCallback
,
AckListener
public void setBounds(int left, int top, int width, int height, AckListener listener)
left
- The left position of the window.top
- The top position of the window.width
- The width position of the window.height
- The height position of the window.listener
- AckListener for the requestAckListener
public void bringToFront() throws DesktopException
DesktopException
- if the window fails to be brought to frontDesktopException
public void updateOptions(WindowOptions options, AckListener listener)
options
- The window options to changelistener
- AckListener for the requestWindowOptions
,
AckListener
public void getOptions(AsyncCallback<WindowOptions> callback, AckListener listener)
callback
- A function that is called if the method succeedslistener
- A function that is called if the method failsAsyncCallback
,
AckListener
public void setAsForeground(AckListener callback)
callback
- AckListener for the requestAckListener
public void enableFrame(AckListener callback)
callback
- AckListener for the requestAckListener
public void disableFrame(AckListener callback)
callback
- AckListener for the requestAckListener
public void updateOptions(org.json.JSONObject options) throws DesktopException
options
- The window options to changeDesktopException
- if this method fails to update window optionspublic void getNativeId(AckListener listener)
listener
- A function that is called if the method failsAsyncCallback
,
AckListener
public static Window wrap(String applicationUuid, String windowName, DesktopConnection connection)
applicationUuid
- UUID of the parent ApplicationwindowName
- name of the Windowconnection
- Connection object to the AppDesktoppublic void joinGroup(Window window) throws DesktopException
window
- The window whose group is to be joinedDesktopException
- if this window fails to join a grouppublic void joinGroup(Window window, AckListener callback)
window
- The window whose group is to be joinedcallback
- AckListener for the requestAckListener
public void mergeGroups(Window window) throws DesktopException
window
- The window whose group is to be mergedDesktopException
- if this window fails to merge into a groupDesktopException
public void mergeGroups(Window window, AckListener callback)
window
- The window whose group is to be mergedcallback
- AckListener for the requestAckListener
public void leaveGroup() throws DesktopException
DesktopException
- if this window fails to leave a grouppublic void leaveGroup(AckListener callback)
callback
- AckListener for the requestAckListener
public void animate(AnimationTransitions transitions, AnimationOptions options, AckListener callback)
transitions
- Describes the animations to preformoptions
- Options for the animationcallback
- AckListener for the requestAnimationTransitions
,
AnimationOptions
,
AckListener
public void getGroup(AsyncCallback<List<Window>> groupHandler, AckListener callback)
groupHandler
- A class that receives a list of wrapped windows in the same group.callback
- AckListener for the requestAsyncCallback
,
AckListener
public void addEventListener(String type, EventListener listener, AckListener callback)
Supported window event types are: app-connected same as connected. @Deprecated app-loaded same as connected. @Deprecated blurred bounds-changed bounds-changing closed close-requested disabled-frame-bounds-changed disabled-frame-bounds-changing focused frame-disabled frame-enabled group-changed hidden maximized minimized connected (this window is connected to Runtime with javascript API) restored shown
type
- Event typelistener
- Listener for the eventcallback
- AckListener for the requestEventListener
,
AckListener
public void removeEventListener(String type, EventListener listener, AckListener callback)
type
- Event typelistener
- Listener for the eventcallback
- AckListener for the requestEventListener
,
AckListener
public void embedInto(long parentHwndId, int width, int height, AckListener callback)
parentHwndId
- This will be the parent window handlewidth
- width of parent windowheight
- height of parent windowcallback
- AckListener for the requestAckListener
public void embedComponentSizeChange(int width, int height)
width
- width of parent windowheight
- height of parent windowCopyright © 2017. All rights reserved.