com.yospace.yae.yogi
Class YogiRootWindow

java.lang.Object
  |
  +--com.yospace.yae.yogi.YogiComponent
        |
        +--com.yospace.yae.yogi.YogiRootWindow
All Implemented Interfaces:
PopupModalRoot, java.lang.Runnable

public class YogiRootWindow
extends YogiComponent
implements PopupModalRoot, java.lang.Runnable

The root window is the root component in the tree of components currently being displayed. It is a focus domain root and always maintains that it is valid and has focus. Its graphics object is obtained from the NativeResources. The root window is also the repaint manager (and thus implements Runnable).
The root window has a root content pane, which is the layered pane that panelet displays and popups are added to. It might also have a dash bar, which acts as an application manager level menu bar.


Field Summary
static int PROPERTY_DASH_BAR
          Constant for the dash bar property
 
Fields inherited from class com.yospace.yae.yogi.YogiComponent
ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT, BORDER_DOTTED, BORDER_NONE, BORDER_PLAIN, BORDER_ROUNDED, BORDER_SOLID, COLOR_BACKGROUND, COLOR_BORDER, COLOR_FOREGROUND, FOCUS_DEFAULT, FOCUS_OFF, FOCUS_ON, PROPERTY_ALIGN, PROPERTY_BORDER_STYLE, PROPERTY_BOUNDS, PROPERTY_COLOR, PROPERTY_CONTEXT_ENABLED, PROPERTY_ENABLED, PROPERTY_FOCUS, PROPERTY_FOCUS_INDEX, PROPERTY_FOCUS_TRAVERSABLE, PROPERTY_FONT, PROPERTY_HOTKEY, PROPERTY_LOCATION, PROPERTY_OPAQUE, PROPERTY_SIZE, PROPERTY_VISIBLE, PROPERTY_X_INSET, PROPERTY_Y_INSET
 
Method Summary
 void add(YogiComponent c)
          Overrides the YogiComponent.add() method, to add any objects to the root content pane rather than the root window.
static YogiRootWindow create(java.lang.Object keyCandidate)
          Creates and returns a new YogiRootWindow Object if a valid key is used.
 YogiDashBar getDashBar()
          Accessor method for the dash bar, if one currently exists.
 Graphics getGraphics()
          Returns an encapsulation of the native graphics of the device.
 YogiLayeredPane getRootContentPane()
          Accessor method for the (layered) root content pane.
 boolean hasFocus(boolean global)
          This overrides the hasFocus method to force the root window to always be focussed.
 void init()
          Sets up a new root window as a focus domain root.
 void remove(YogiComponent c)
          Overrides the YogiComponent.remove() method, to remove the given component from the root content pane rather than the root window.
 boolean requestFocus(boolean global)
          This override method maintains that the root window has always acquired the focus successfully.
 void run()
          When notified calls paint() on this (the root window), sending itself its current dirty region information.
 void scheduleRepaint()
          Calls notify() to wake the repaint thread if it is currently waiting for a notification from this repaint manager.
 void setDashBar(YogiDashBar dashBar)
          Sets the dash bar to be the given component.
static void setKey(java.lang.Object theKey)
          Sets up the key to validate root window creation requests against.
 void start()
          Creates a new Thread and calls start on it.
 void stop()
          Stops the Thread created through a call to start().
 
Methods inherited from class com.yospace.yae.yogi.YogiComponent
_debugPrintComponents, addPropertyChangeListener, bringForwards, bringInFrontOf, bringToFront, contains, containsComponent, ensureVisible, ensureVisible, findComponentAt, findCurrentFocus, findFirstFocus, findFocusDomainRoot, findFocusDomainRootImpl, findHotkeyComponent, findNextFocus, fireActionPerformedEvent, firePropertyChangeEvent, getAlign, getBorderStyle, getBounds, getColor, getColors, getComponent, getComponent, getComponentCount, getComponentIndex, getComponents, getFocusBounds, getFocusIndex, getFont, getGlobalLocation, getHeight, getHotkey, getId, getParent, getParent, getTreeLock, getUI, getWidth, getX, getXInset, getY, getYInset, isActive, isContextEnabled, isEnabled, isFocusDomainRoot, isFocusTraversable, isOpaque, isVisible, keyPressed, keyReleased, keyRepeated, paint, paintBackground, paintBorder, paintForeground, pointerDragged, pointerPressed, pointerReleased, remove, removeAll, removePropertyChangeListener, repaint, repaint, repaintAfterRebounding, requestFocus, sendBackwards, sendBehind, sendToBack, setActionListener, setActive, setAlign, setBorderStyle, setBounds, setColor, setColors, setContextEnabled, setDefaultColor, setEnabled, setFocusDomainRoot, setFocusIndex, setFocusTraversable, setFont, setHotkey, setId, setLocation, setNoFocus, setOpaque, setProperty, setSize, setUI, setVisible, setXInset, setYInset, updateUI
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_DASH_BAR

public static final int PROPERTY_DASH_BAR
Constant for the dash bar property
Method Detail

create

public static final YogiRootWindow create(java.lang.Object keyCandidate)
Creates and returns a new YogiRootWindow Object if a valid key is used.
Parameters:
keyCandidate - the key to compare against the actual key.
Returns:
a new YogiRootWindow Object if the key is valid, null otherwise.

setKey

public static final void setKey(java.lang.Object theKey)
Sets up the key to validate root window creation requests against. Can only be performed once per 'run' of the VM.
Parameters:
theKey - the key to use.

init

public void init()
Sets up a new root window as a focus domain root. Creates a root window content pane and adds it as its only child.

add

public void add(YogiComponent c)
Overrides the YogiComponent.add() method, to add any objects to the root content pane rather than the root window.
Overrides:
add in class YogiComponent
Parameters:
c - the component to add.

remove

public void remove(YogiComponent c)
Overrides the YogiComponent.remove() method, to remove the given component from the root content pane rather than the root window.
Overrides:
remove in class YogiComponent
Parameters:
c - the component to remove.

getRootContentPane

public YogiLayeredPane getRootContentPane()
Accessor method for the (layered) root content pane.
Returns:
a YogiLayeredPane which is the root content pane.

getDashBar

public YogiDashBar getDashBar()
Accessor method for the dash bar, if one currently exists.
Returns:
the dashbar, or null if no dash bar currently exists.

setDashBar

public void setDashBar(YogiDashBar dashBar)
Sets the dash bar to be the given component. Causes this root window to re-lay itself out and to fire a property change event (PROPERTY_DASH_BAR).
Parameters:
dashBar - the dash bar to set for this YogiRootWindow.

getGraphics

public Graphics getGraphics()
Returns an encapsulation of the native graphics of the device.
Returns:
the Graphics object from NativeResources.

hasFocus

public boolean hasFocus(boolean global)
This overrides the hasFocus method to force the root window to always be focussed.
Overrides:
hasFocus in class YogiComponent
Parameters:
global - ignored here.
Returns:
true.

requestFocus

public boolean requestFocus(boolean global)
This override method maintains that the root window has always acquired the focus successfully.
Overrides:
requestFocus in class YogiComponent
Parameters:
global - ignored here.
Returns:
true.

start

public void start()
Creates a new Thread and calls start on it. After the first call to this method subsequent calls have no effect unless stop() has been called.

stop

public void stop()
Stops the Thread created through a call to start().

scheduleRepaint

public void scheduleRepaint()
Calls notify() to wake the repaint thread if it is currently waiting for a notification from this repaint manager.

run

public void run()
When notified calls paint() on this (the root window), sending itself its current dirty region information. This will cause paints to filter down to dirty child components. These paints are done onto an off-screen buffer. Once this repaint cycle has terminated, a call to repaint the off-screen buffer onto the screen is made.
Specified by:
run in interface java.lang.Runnable

Copyright 2002 Yospace Holdings Ltd. All Rights Reserved.