OverviewSingleDeprecated

jsx3.gui

class Window

Object
->jsx3.lang.Object
  ->jsx3.app.Model
    ->jsx3.gui.Window

All Implemented Interfaces:

jsx3.util.EventDispatcher

class Window
extends jsx3.app.Model
Allows for rendering a branch of the DOM of an application in a separate browser window.

Access instances of this class with the following methods in the jsx3.app.Server class:

Since:

3.2

See Also:

jsx3.app.Server.createAppWindow(), jsx3.app.Server.getAppWindow(), jsx3.app.Server.loadAppWindow()

Field Summary
static String
DID_FOCUS
Event subject: published after this window has received focus.
static String
DID_OPEN
Event subject: published after this window has successfully opened.
static String
DID_RESIZE
Event subject: published after this window has been resized via user interaction.
static String
PARENT_DID_CLOSE
Event subject: published after this window's parent has closed.
static String
WILL_CLOSE
Event subject: published just before this window will close.
Constructor Summary
void
init(strName : String)
The instance initializer.
Method Summary
boolean
Closes the browser window of this window instance.
void
Ensures that this window is at least partially visible on the computer screen.
void
Focuses the browser window of this window instance.
int
Returns the inner (visible) height of this window.
int
Returns the current x-coordinate screen position of this browser window relative to the parent application window.
int
Returns the current y-coordinate screen position of this browser window relative to the parent application window.
jsx3.gui.Block
Returns the first DOM child of this window object.
String
Returns the title of this window.
int
Returns the inner (visible) width of this window.
int
Returns whether this window is "dependent.
boolean
Returns whether the browser window of this window instance is open.
boolean
Returns whether the parent application window of this window instance is open.
int
Returns whether this window is resizable via user interaction.
int
Returns whether this window will show scroll bars if the content outgrows the window.
void
moveTo(intOffsetLeft : int, intOffsetTop : int)
Moves the browser window of this window instance to a position on the screen.
boolean
Opens the browser window of this window instance.
String
Repaints the root block of this window.
void
setDependent(bDependent : boolean)
Sets whether this window is "dependent.
void
setHeight(intHeight : int)
Sets the inner (visible) height of this window.
void
setResizable(bResizable : boolean)
Sets whether this window is resizable via user interaction.
void
setScrollable(bScrollable : boolean)
Sets whether this window will show scroll bars if the content outgrows the window.
void
setTitle(strTitle : String)
Sets the title of the window.
void
setWidth(intWidth : int)
Sets the inner (visible) width of this window.
String
toString(strTitle : ?)
Methods Inherited From jsx3.app.Model
adoptChild, doClone, findAncestor, findDescendants, getAncestorOfName, getAncestorOfType, getChild, getChildIndex, getChildren, getDescendantOfName, getDescendantsOfType, getFirstChild, getFirstChildOfType, getHelpId, getId, getLastChild, getLoadType, getMetaValue, getNS, getName, getNextSibling, getParent, getPersistence, getPreviousSibling, getServer, getUriResolver, insertBefore, load, loadAndCache, loadXML, onAfterAssemble, onAfterAttach, onBeforeAssemble, onChangeServer, onDestroy, onRemoveChild, onSetChild, onSetParent, removeChild, removeChildren, setChild, setHelpId, setLoadType, setMetaValue, setName, setPersistence, toXML, toXMLDoc
Methods Inherited From jsx3.util.EventDispatcher
publish, subscribe, unsubscribe, unsubscribeAll
Methods Inherited From jsx3.lang.Object
clone, equals, eval, getClass, getInstanceOf, getInstanceOfClass, getInstanceOfPackage, instanceOf, isInstanceOf, isSubclassOf, jsxmix, jsxsuper, jsxsupermix, setInstanceOf
Field Detail

DID_FOCUS

static final String DID_FOCUS
Event subject: published after this window has received focus.

DID_OPEN

static final String DID_OPEN
Event subject: published after this window has successfully opened.

DID_RESIZE

static final String DID_RESIZE
Event subject: published after this window has been resized via user interaction.

PARENT_DID_CLOSE

static final String PARENT_DID_CLOSE
Event subject: published after this window's parent has closed.

WILL_CLOSE

static final String WILL_CLOSE
Event subject: published just before this window will close.
Constructor Detail

init

void init(strName : String)
The instance initializer.

Parameters:

strNamea unique name for this window.
Method Detail

close

boolean close()
Closes the browser window of this window instance.

Throws:

{jsx3.lang.Exception}if the window is already closed.

Returns:

true if the window successfully closed or false if it didn't close because of JavaScript security constraints or user interaction. 

constrainToScreen

void constrainToScreen()
Ensures that this window is at least partially visible on the computer screen.

focus

void focus()
Focuses the browser window of this window instance.

Throws:

{jsx3.lang.Exception}if the window is not open.

getHeight

int getHeight()
Returns the inner (visible) height of this window. This does not include the border and padding that the browser may render around the window content.

Returns:

 

getOffsetLeft

int getOffsetLeft()
Returns the current x-coordinate screen position of this browser window relative to the parent application window. If the parent window is no longer open, this method returns the position relative to the upper-left corner of the screen.

Throws:

{jsx3.lang.Exception}if the window is not open.

Returns:

 

getOffsetTop

int getOffsetTop()
Returns the current y-coordinate screen position of this browser window relative to the parent application window. If the parent window is no longer open, this method returns the position relative to the upper-left corner of the screen.

Throws:

{jsx3.lang.Exception}if the window is not open.

Returns:

 

getRootBlock

jsx3.gui.Block getRootBlock()
Returns the first DOM child of this window object. If no child exists, this method creates a root block, adds it to the DOM, and returns it. A window will only render its first DOM child.

Returns:

 

getTitle

String getTitle()
Returns the title of this window.

Returns:

 

getWidth

int getWidth()
Returns the inner (visible) width of this window. This does not include the border and padding that the browser may render around the window content.

Returns:

 

isDependent

int isDependent()
Returns whether this window is "dependent." Dependent windows close automatically when their parents close. If a window is not dependent, it will stay open after the parent window closes. Note that the parent window contains all the JavaScript code and so it is very likely that interacting with a window after the parent has closed will raise errors.

Returns:

jsx3.Boolean.TRUE or jsx3.Boolean.FALSE.  

isOpen

boolean isOpen()
Returns whether the browser window of this window instance is open.

Returns:

true if the window is open.  

isParentOpen

boolean isParentOpen()
Returns whether the parent application window of this window instance is open.

Returns:

true if the parent window is open.  

isResizable

int isResizable()
Returns whether this window is resizable via user interaction. The value returned by this method will reflect the last value passed to setResizable() and therefore may not truly reflect the current state of the browser window.

Returns:

jsx3.Boolean.TRUE or jsx3.Boolean.FALSE.  

isScrollable

int isScrollable()
Returns whether this window will show scroll bars if the content outgrows the window. The value returned by this method will reflect the last value passed to setScrollable() and therefore may not truly reflect the current state of the browser window.

Returns:

jsx3.Boolean.TRUE or jsx3.Boolean.FALSE.  

moveTo

void moveTo(intOffsetLeft : int, intOffsetTop : int)
Moves the browser window of this window instance to a position on the screen. The arguments specify the offset from the parent application window. If the parent window is no longer open, this window will be moved relative to the upper-left corner of the screen.

Parameters:

intOffsetLeftthe left offset from the parent window.
intOffsetTopthe top offset from the parent window.

Throws:

{jsx3.lang.Exception}if the window is not open.

open

boolean open()
Opens the browser window of this window instance. Depending on security settings and popup blockers, this method may or may not actually open a window. The only safe way to determine whether the window successfully opened is to register for the DID_OPEN event.

Throws:

{jsx3.lang.Exception}if the window is already open.

Returns:

true if the window successfully opened (probably). 

repaint

String repaint()
Repaints the root block of this window.

Returns:

 

setDependent

void setDependent(bDependent : boolean)
Sets whether this window is "dependent." This method not affect a currently-open window.

Parameters:

bDependent

See Also:

isDependent()

setHeight

void setHeight(intHeight : int)
Sets the inner (visible) height of this window. If the window is currently open, the window will be resized immediately.

Parameters:

intHeightthe inner height of the window in pixels.

setResizable

void setResizable(bResizable : boolean)
Sets whether this window is resizable via user interaction. This method will not affect a currently-open window.

Parameters:

bResizable

setScrollable

void setScrollable(bScrollable : boolean)
Sets whether this window will show scroll bars if the content outgrows the window. This method will not affect a currently-open window.

Parameters:

bScrollable

setTitle

void setTitle(strTitle : String)
Sets the title of the window. The title is displayed in the title bar of the browser window. If the window is currently open, the title will be updated immediately.

Parameters:

strTitlethe title of the window.

setWidth

void setWidth(intWidth : int)
Sets the inner (visible) width of this window. If the window is currently open, the window will be resized immediately.

Parameters:

intWidththe inner width of the window in pixels.

toString

String toString(strTitle : ?)

Parameters:

strTitle

Returns:

 

Overrides:

toString in jsx3.app.Model