com.jmex.bui
Class BWindow

java.lang.Object
  extended by com.jmex.bui.BComponent
      extended by com.jmex.bui.BContainer
          extended by com.jmex.bui.BWindow
All Implemented Interfaces:
Comparable<BWindow>
Direct Known Subclasses:
BDecoratedWindow, BPopupWindow

public class BWindow
extends BContainer
implements Comparable<BWindow>

A window defines the top-level of a component hierarchy. It must be created with a stylesheet and layout manager.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.jmex.bui.BContainer
BContainer.ChildOp
 
Field Summary
protected  int _layer
          The "layer" in the window stack occupied by this window.
protected  boolean _modal
          Whether or not this window steals input from other windows further down the hierarchy.
protected  BWindow _parentWindow
          Used to associate this window with a parent window.
protected  BRootNode _root
          The root node that connects us into the JME system.
protected  BComponent _savedFocus
          Stores a reference to our focus when this window is no longer the top-most window.
protected  BStyleSheet _style
          The stylesheet used to configure components in this window.
 
Fields inherited from class com.jmex.bui.BContainer
_children, _layout
 
Fields inherited from class com.jmex.bui.BComponent
_alpha, _backgrounds, _bbuf, _borders, _colors, _cursor, _enabled, _height, _hover, _insets, _listeners, _parent, _preferredSize, _properties, _styleClass, _tipmouse, _tipStyle, _tiptext, _valid, _visible, _width, _x, _y, DEFAULT, DISABLED, HOVER, STATE_COUNT, STATE_PCLASSES
 
Constructor Summary
BWindow(BStyleSheet style, BLayoutManager layout)
           
 
Method Summary
 void center()
          Positions this window in the center of the display.
 int compareTo(BWindow other)
           
 void dismiss()
          Detaches this window from the root node and removes it from the display.
protected  String getDefaultStyleClass()
          Returns the default stylesheet class to be used for all instances of this component.
 int getLayer()
          Returns the layer occupied by this window.
 BWindow getParentWindow()
          Returne the parent window.
 BRootNode getRootNode()
          Returns the root node that manages this window.
 BStyleSheet getStyleSheet()
          Returns the stylesheet in effect for this window.
protected  void gotFocus()
          Called when this window gets the focus after a window on the hierarchy has been removed.
 void invalidate()
          Marks this component as invalid and needing a relayout.
 boolean isAdded()
          Returns true if this component is added to a hierarchy of components that culminates in a top-level window.
 boolean isModal()
          Returns whether or not this window is modal.
 boolean isOverlay()
          Returns whether or not this window is an overlay, in which case its children will not receive input focus by default.
 void pack()
          Sizes this window to its preferred size.
 void pack(int whint, int hhint)
          Sizes this window to its preferred size, accounting for the specified width or height hints.
protected  void requestFocus(BComponent component)
          Requests that the specified component be given the input focus.
 void setBounds(int x, int y, int width, int height)
          Sets the bounds of this component in screen coordinates.
 void setLayer(int layer)
          Configures the "layer" occupied by this window.
 void setModal(boolean modal)
          Configures this window to be modal which causes it to "steal" all mouse and keyboard input while it is added to the interface hierarchy.
 void setParent(BContainer parent)
          Informs this component of its parent in the interface heirarchy.
 void setParentWindow(BWindow parentWindow)
          Set the parent window.
protected  void setRootNode(BRootNode root)
          Configures this window with its root node.
 boolean shouldShadeBehind()
          Returns whether this window should have shading applied beneath it.
 
Methods inherited from class com.jmex.bui.BContainer
add, add, add, add, applyOperation, computePreferredSize, getComponent, getComponentCount, getComponentIndex, getHitComponent, getLayoutManager, getNextFocus, getPreviousFocus, layout, remove, remove, removeAll, renderComponent, replace, setAlpha, setEnabled, setLayoutManager, setVisible, validate, wasAdded, wasRemoved
 
Methods inherited from class com.jmex.bui.BComponent
acceptsFocus, addListener, applyDefaultStates, boundsToString, changeCursor, configureStyle, createTooltipComponent, dispatchEvent, emitEvent, getAbsoluteX, getAbsoluteY, getAlpha, getBackground, getBorder, getBounds, getColor, getCursor, getFocusTarget, getHeight, getInsets, getNextFocus, getParent, getPreferredSize, getPreviousFocus, getProperty, getState, getStateCount, getStatePseudoClass, getStyleClass, getTooltipText, getWidth, getWindow, getX, getY, hasFocus, intersectScissorBox, isEnabled, isShowing, isTooltipRelativeToMouse, isValid, isVisible, removeAllListeners, removeListener, render, renderBackground, renderBorder, requestFocus, restoreScissorState, setBackground, setCursor, setLocation, setPreferredSize, setPreferredSize, setProperty, setSize, setStyleClass, setTooltipRelativeToMouse, setTooltipText, stateDidChange, updateCursor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_style

protected BStyleSheet _style
The stylesheet used to configure components in this window.


_root

protected BRootNode _root
The root node that connects us into the JME system.


_modal

protected boolean _modal
Whether or not this window steals input from other windows further down the hierarchy.


_layer

protected int _layer
The "layer" in the window stack occupied by this window.


_savedFocus

protected BComponent _savedFocus
Stores a reference to our focus when this window is no longer the top-most window.


_parentWindow

protected BWindow _parentWindow
Used to associate this window with a parent window.

Constructor Detail

BWindow

public BWindow(BStyleSheet style,
               BLayoutManager layout)
Method Detail

getStyleSheet

public BStyleSheet getStyleSheet()
Returns the stylesheet in effect for this window.


pack

public void pack()
Sizes this window to its preferred size. This method does not change the window's coordinates.


pack

public void pack(int whint,
                 int hhint)
Sizes this window to its preferred size, accounting for the specified width or height hints. Specify -1 for a dimension to indicate that it is freely resizable and a non-negative hint for a dimension that should be no larger than a particular size. This method does not change the window's coordinates.


center

public void center()
Positions this window in the center of the display. This should be called after configuring the size of the window (using, for example, a call to pack()).


setModal

public void setModal(boolean modal)
Configures this window to be modal which causes it to "steal" all mouse and keyboard input while it is added to the interface hierarchy. Mouse movement and button press events that would normally go to other windows or to the default mouse target will instead be sent to the top-most modal window. Other events destined for other windows (key events and mouse entry and exit events) will not be dispatched.


isModal

public boolean isModal()
Returns whether or not this window is modal. See setModal(boolean) for more information on modality.


shouldShadeBehind

public boolean shouldShadeBehind()
Returns whether this window should have shading applied beneath it.


isOverlay

public boolean isOverlay()
Returns whether or not this window is an overlay, in which case its children will not receive input focus by default.


getRootNode

public BRootNode getRootNode()
Returns the root node that manages this window.


getLayer

public int getLayer()
Returns the layer occupied by this window. See setLayer(int) for more details.


setLayer

public void setLayer(int layer)
Configures the "layer" occupied by this window. Windows normally stack one atop another with the most recently added window being highest in the stack. The layer configuration allows a window to be added above windows in a lower layer regardless of when it or other windows are added. All windows default to a layer of zero, windows with a higher layer will be "above" those with a lower layer. Windows in the same layer stack according to the order in which they are added.


dismiss

public void dismiss()
Detaches this window from the root node and removes it from the display.


compareTo

public int compareTo(BWindow other)
Specified by:
compareTo in interface Comparable<BWindow>

setParent

public void setParent(BContainer parent)
Description copied from class: BComponent
Informs this component of its parent in the interface heirarchy.

Overrides:
setParent in class BComponent

invalidate

public void invalidate()
Description copied from class: BComponent
Marks this component as invalid and needing a relayout. If the component is valid, its parent will also be marked as invalid.

Overrides:
invalidate in class BComponent

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
Description copied from class: BComponent
Sets the bounds of this component in screen coordinates.

Overrides:
setBounds in class BComponent
See Also:
BComponent.setLocation(int, int), BComponent.setSize(int, int)

isAdded

public boolean isAdded()
Description copied from class: BComponent
Returns true if this component is added to a hierarchy of components that culminates in a top-level window.

Overrides:
isAdded in class BComponent

setParentWindow

public void setParentWindow(BWindow parentWindow)
Set the parent window. If the parent window is removed from its root node, this window will also be removed.


getParentWindow

public BWindow getParentWindow()
Returne the parent window.


getDefaultStyleClass

protected String getDefaultStyleClass()
Description copied from class: BComponent
Returns the default stylesheet class to be used for all instances of this component. Derived classes will likely want to override this method and set up a default class for their type of component.

Overrides:
getDefaultStyleClass in class BContainer

setRootNode

protected void setRootNode(BRootNode root)
Configures this window with its root node. Do not call this method, it is called automatically when a window is added to the root node via a call to BRootNode.addWindow(com.jmex.bui.BWindow).


requestFocus

protected void requestFocus(BComponent component)
Requests that the specified component be given the input focus.


gotFocus

protected void gotFocus()
Called when this window gets the focus after a window on the hierarchy has been removed.



Copyright © 2008 Michael Bayne. All Rights Reserved.