com.yospace.yae.yogi
Class YogiWindow

java.lang.Object
  |
  +--com.yospace.yae.yogi.YogiComponent
        |
        +--com.yospace.yae.yogi.YogiWindow
Direct Known Subclasses:
YogiPaneletDisplay

public class YogiWindow
extends YogiComponent

A component which can have only three children: a content pane, a menu bar and a title bar. It always has a content pane, but the title bar and menu bar are optional. Adding a YogiMenu directly to a YogiWindow causes that menu to be added to the menu bar, if one exists. Attempting to add any other type of YogiComponent other than YogiContentPane, YogiMenuBar, YogiTitleBar or YogiMenu to a YogiWindow results in that component being added not as a direct child of the window, but as a child of the content pane.


Field Summary
static int PROPERTY_CONTENT_PANE
          Constant for the content pane property
static int PROPERTY_MENU_BAR
          Constant for the menu bar property
static int PROPERTY_TITLE_BAR
          Constant for the title 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
 
Constructor Summary
YogiWindow()
          Sets the new YogiWindow to have a content pane (but, by default, no title or menu bars).
 
Method Summary
 void add(YogiComponent yc)
          Adding a YogiContentPane to this component results in the current content pane being replaced with this new one.
 void addMenu(YogiMenu menu)
          Adds the given menu to the current menu bar, if a current menu bar exists.
 YogiContentPane getContentPane()
          Accessor method for the content pane.
 YogiMenu getMenu(int index)
          Gets the menu at the given index from the current menu bar.
 YogiMenu getMenu(java.lang.String menuId)
          Gets the menu with the id String from the current menu bar.
 YogiMenuBar getMenuBar()
          Accessor method for the window's menu bar.
 YogiTitleBar getTitleBar()
          Accessor method for the title bar.
 void remove(int index)
          Delegates the removal of the component at the specified index to the YogiContentPane.
 void remove(YogiComponent yc)
          YogiTitleBars, YogiMenuBars and YogiMenus can be directly removed from a YogiWindow.
 void removeMenu(YogiMenu menu)
          Removes the given menu from the menu bar.
 void removeMenus()
          Convenience method to remove all menus.
 void setContentPane(YogiContentPane contentPane)
          Sets the content pane to be the given YogiContentPane.
 void setMenuBar(YogiMenuBar menuBar)
          Sets the menu bar.
 void setTitleBar(YogiTitleBar titleBar)
          Sets the title bar, removing the old one if one existed.
 
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, hasFocus, isActive, isContextEnabled, isEnabled, isFocusDomainRoot, isFocusTraversable, isOpaque, isVisible, keyPressed, keyReleased, keyRepeated, paint, paintBackground, paintBorder, paintForeground, pointerDragged, pointerPressed, pointerReleased, removeAll, removePropertyChangeListener, repaint, repaint, repaintAfterRebounding, requestFocus, 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_MENU_BAR

public static final int PROPERTY_MENU_BAR
Constant for the menu bar property

PROPERTY_TITLE_BAR

public static final int PROPERTY_TITLE_BAR
Constant for the title bar property

PROPERTY_CONTENT_PANE

public static final int PROPERTY_CONTENT_PANE
Constant for the content pane property
Constructor Detail

YogiWindow

public YogiWindow()
Sets the new YogiWindow to have a content pane (but, by default, no title or menu bars).
Method Detail

add

public void add(YogiComponent yc)
Adding a YogiContentPane to this component results in the current content pane being replaced with this new one. Similarly, adding a YogiTitleBar or a YogiMenuBar directly to this window leads to the replacement of any pre-existing title or menu bars being replaced accordingly. Adding a YogiMenu causes the component to be added to the current menu bar. Adding any other type of component to this window results in it being added to the content pane. This has the same effect as calling,
YogiWindow.getContentPane().add();
Overrides:
add in class YogiComponent
Parameters:
yc - the component to add.

remove

public void remove(YogiComponent yc)
YogiTitleBars, YogiMenuBars and YogiMenus can be directly removed from a YogiWindow. All other removals are delegated to the YogiContentPane, which itself cannot be removed. For these latter cases, call this method has the same effect as calling,
YogiWindow.getContentPane().remove();
Overrides:
remove in class YogiComponent
Parameters:
yc - the component to add.

remove

public void remove(int index)
Delegates the removal of the component at the specified index to the YogiContentPane.
Overrides:
remove in class YogiComponent
Parameters:
index - The index of the component to be removed.

getContentPane

public YogiContentPane getContentPane()
Accessor method for the content pane. The content pane should be added to when inserting components which are to be displayed in the main body of the YogiWindow.
Returns:
the current content pane of this window.

setContentPane

public void setContentPane(YogiContentPane contentPane)
Sets the content pane to be the given YogiContentPane. Fires a property changed event to indicate to listeners that the content pane has been changed.
Parameters:
contentPane - the content pane to replace the current one with.

getMenuBar

public YogiMenuBar getMenuBar()
Accessor method for the window's menu bar.
Returns:
the menu bar if one exists, null otherwise.

setMenuBar

public void setMenuBar(YogiMenuBar menuBar)
Sets the menu bar. Fires a property changed event to indicate to listeners that the menu bar has been changed.
Parameters:
menuBar - the new menu bar.

addMenu

public void addMenu(YogiMenu menu)
Adds the given menu to the current menu bar, if a current menu bar exists.
Parameters:
menu - the menu to add.

getMenu

public YogiMenu getMenu(int index)
Gets the menu at the given index from the current menu bar.
Parameters:
index - the index of the menu to get from the menu bar.
Returns:
the menu at the given index, or null if there is no menu bar, or if there is no menu at the given index.

getMenu

public YogiMenu getMenu(java.lang.String menuId)
Gets the menu with the id String from the current menu bar.
Parameters:
menuId - the String identifier of the menu to get from the menu bar.
Returns:
the menu at the given index, or null if there is no menu bar, or if there is no menu with the given id String.

removeMenu

public void removeMenu(YogiMenu menu)
Removes the given menu from the menu bar.
Parameters:
the - menu to remove from the menu bar. Does nothing if there is no menu bar set up or the menu is not on the menu bar.

removeMenus

public void removeMenus()
Convenience method to remove all menus. Delegates removal to the menu bar.

getTitleBar

public YogiTitleBar getTitleBar()
Accessor method for the title bar.
Returns:
the current title bar, or null if there is no title bar.

setTitleBar

public void setTitleBar(YogiTitleBar titleBar)
Sets the title bar, removing the old one if one existed. Fires a property changed event to indicate to listeners that the title bar has been changed.
Parameters:
titleBar - the new title bar.

Copyright 2002 Yospace Holdings Ltd. All Rights Reserved.