org.kahina.core.gui
Class KahinaWindow

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by org.kahina.core.gui.KahinaWindow
All Implemented Interfaces:
ComponentListener, WindowListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants
Direct Known Subclasses:
KahinaControlButtonWindow, KahinaDefaultWindow, KahinaHorizontallySplitWindow, KahinaListWindow, KahinaMainWindow, KahinaTabbedWindow, KahinaVerticallySplitWindow

public class KahinaWindow
extends JFrame
implements WindowListener, ComponentListener

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JFrame
JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  boolean cloned
           
protected  KahinaTransferablePanel mainPanel
           
protected  int windowID
           
protected  KahinaWindowManager wm
           
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
KahinaWindow(KahinaWindowManager wm)
          Constructs a KahinaWindow with a new unique window ID.
KahinaWindow(KahinaWindowManager wm, int id)
          Constructs a KahinaWindow with a specified window ID.
 
Method Summary
 boolean addSubwindow(KahinaWindow subwindow)
          Adds a subwindow if there is space for it; generic handle for configuring windows.
 void componentHidden(ComponentEvent arg0)
           
 void componentMoved(ComponentEvent arg0)
           
 void componentResized(ComponentEvent arg0)
           
 void componentShown(ComponentEvent arg0)
           
 KahinaWindow createDynamicClone()
          Creates an exact copy of this window, with identical update behavior.
 KahinaWindow createSnapshotClone()
          Creates an exact copy of this window, but with immutable content.
 void flipSubwindows()
           
 KahinaWindow getEmbeddingWindow()
          Retrieves the direct ancestor of this window in the embedding tree.
 int getID()
           
 KahinaWindow getReplacementAfterRelease(KahinaWindow subwindow)
           
 int getWindowType()
          Returns the type of the current window.
 boolean isClone()
           
 boolean isContentWindow()
           
 boolean isDummyWindow()
           
 boolean isFlippableWindow()
           
 boolean isTopLevelWindow()
           
 void replaceSubwindow(KahinaWindow oldSubwindow, KahinaWindow newSubwindow)
           
 void setBorder(boolean border)
           
 void setSize(int width, int height)
           
 void setTitle(String title)
           
 String toString()
           
 void windowActivated(WindowEvent e)
           
 void windowClosed(WindowEvent e)
           
 void windowClosing(WindowEvent e)
           
 void windowDeactivated(WindowEvent e)
           
 void windowDeiconified(WindowEvent e)
           
 void windowIconified(WindowEvent e)
           
 void windowOpened(WindowEvent e)
           
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setVisible, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

wm

protected KahinaWindowManager wm

mainPanel

protected KahinaTransferablePanel mainPanel

windowID

protected final int windowID

cloned

protected boolean cloned
Constructor Detail

KahinaWindow

public KahinaWindow(KahinaWindowManager wm)
Constructs a KahinaWindow with a new unique window ID.

Parameters:
wm - the window manager that is to manage this window

KahinaWindow

public KahinaWindow(KahinaWindowManager wm,
                    int id)
Constructs a KahinaWindow with a specified window ID. Caution is advised with this constructor, as duplicate ID assignment can break the window system.

Parameters:
wm - the window manager that is to manage this window
id - the unique window ID that this window will be referred by (never use -1 or an ID that is already used!)
Method Detail

getID

public int getID()

isClone

public boolean isClone()

setBorder

public void setBorder(boolean border)

getWindowType

public int getWindowType()
Returns the type of the current window. Used in storing arrangements. Returns KahinaWindowType.DEFAULT_WINDOW by default, indicating no embedded windows. This is overridden by specializations that embed other windows.

Returns:
one of the constants defined in KahinaWindowType, representing the type of this window

setTitle

public void setTitle(String title)
Overrides:
setTitle in class Frame

isTopLevelWindow

public boolean isTopLevelWindow()

isContentWindow

public boolean isContentWindow()

isFlippableWindow

public boolean isFlippableWindow()

isDummyWindow

public boolean isDummyWindow()

flipSubwindows

public void flipSubwindows()

setSize

public void setSize(int width,
                    int height)
Overrides:
setSize in class Window

createDynamicClone

public KahinaWindow createDynamicClone()
Creates an exact copy of this window, with identical update behavior. Implementations must override this to provide the desired functionality.

Returns:
an exact copy of the current window, with identical behavior

createSnapshotClone

public KahinaWindow createSnapshotClone()
Creates an exact copy of this window, but with immutable content. Implementations must override this to provide the desired functionality.

Returns:
an copy of the current window at the current step, with immutable content

getEmbeddingWindow

public KahinaWindow getEmbeddingWindow()
Retrieves the direct ancestor of this window in the embedding tree.

Returns:
the embedding KahinaWindow; null if it this is a top-level window

addSubwindow

public boolean addSubwindow(KahinaWindow subwindow)
Adds a subwindow if there is space for it; generic handle for configuring windows.

Parameters:
subwindow - the subwindow to be added
Returns:
whether the subwindow was successfully added; false by default

getReplacementAfterRelease

public KahinaWindow getReplacementAfterRelease(KahinaWindow subwindow)

replaceSubwindow

public void replaceSubwindow(KahinaWindow oldSubwindow,
                             KahinaWindow newSubwindow)

windowActivated

public void windowActivated(WindowEvent e)
Specified by:
windowActivated in interface WindowListener

windowClosed

public void windowClosed(WindowEvent e)
Specified by:
windowClosed in interface WindowListener

windowClosing

public void windowClosing(WindowEvent e)
Specified by:
windowClosing in interface WindowListener

windowDeactivated

public void windowDeactivated(WindowEvent e)
Specified by:
windowDeactivated in interface WindowListener

windowDeiconified

public void windowDeiconified(WindowEvent e)
Specified by:
windowDeiconified in interface WindowListener

windowIconified

public void windowIconified(WindowEvent e)
Specified by:
windowIconified in interface WindowListener

windowOpened

public void windowOpened(WindowEvent e)
Specified by:
windowOpened in interface WindowListener

componentHidden

public void componentHidden(ComponentEvent arg0)
Specified by:
componentHidden in interface ComponentListener

componentMoved

public void componentMoved(ComponentEvent arg0)
Specified by:
componentMoved in interface ComponentListener

componentResized

public void componentResized(ComponentEvent arg0)
Specified by:
componentResized in interface ComponentListener

componentShown

public void componentShown(ComponentEvent arg0)
Specified by:
componentShown in interface ComponentListener

toString

public String toString()
Overrides:
toString in class Component