jhomenet.gui
Class AbstractWindow

java.lang.Object
  extended by jhomenet.gui.AbstractWindow
Direct Known Subclasses:
AbstractEditor, ExecuterWindow, PollingStatusWindow, ProgressWindow, RegisteredWindow, ResponsiveEditor, ResponsiveStatusWindow, ServicesWindow

public abstract class AbstractWindow
extends java.lang.Object

Id: $Id$
The AbstractWindow is the base class for all sensor responsive related windows. The window is an internal frame with a main panel which in turn holds a status bar (Borderlayout.SOUTH) and the built GUI elements (Borderlayout.CENTER).
By default, the status bar is set to null and if required the concrete class should override the buildStatusBar method.


Field Summary
protected  javax.swing.JInternalFrame internalFrame
          Internal frame
 
Constructor Summary
AbstractWindow()
          Constructor.
 
Method Summary
protected  void addChildWindow(AbstractWindow childWindow)
          Add a child frame.
protected abstract  javax.swing.JPanel buildGUI()
          Build the GUI.
protected  WindowStatusBar buildStatusBar()
          Build the status bar.
protected  void closeWindow()
          Try to close the internal frame.
 javax.swing.JInternalFrame createAsInternalFrame()
          Create the window as an internal frame.
 javax.swing.JInternalFrame createAsInternalFrame(boolean resizable)
          Create an internal frame.
protected  java.awt.Point getDesiredLocation()
          Get the desired internal frame position.
abstract  java.lang.String getIdentifier()
          Get the window identifier.
protected  javax.swing.JPanel getPanel()
          Get the window's main panel.
protected abstract  java.lang.String getTitle()
          Get the frame title.
protected  java.awt.Dimension getWindowDimension()
          Get the desired window dimension.
protected abstract  void resetGUI()
          Reset the GUI.
protected  void setPanel(javax.swing.JPanel p)
          Set the window's main panel.
 void startWork()
          Indicate that work has started.
 void startWork(java.lang.String text)
           
 void stopWork()
          Indicate that work has stopped.
 void stopWork(java.lang.String text)
           
protected  void windowClosing()
          If required, classes may override this method in order to perform any functions necessary before the window is closed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

internalFrame

protected javax.swing.JInternalFrame internalFrame
Internal frame

Constructor Detail

AbstractWindow

public AbstractWindow()
Constructor.

Method Detail

buildGUI

protected abstract javax.swing.JPanel buildGUI()
                                        throws java.lang.Exception
Build the GUI. The GUI layout defaults to a Border layout, however if other layout managers are required, simply add another JPanel to this panel (ie add(somePanel, BorderLayout.CENTER)). This method is called when the window's createAsInternalFrame method is called. Simply instantiating the window does not build it.

Throws:
java.lang.Exception

resetGUI

protected abstract void resetGUI()
Reset the GUI.


getIdentifier

public abstract java.lang.String getIdentifier()
Get the window identifier. This identifier is used as the control in not allowing multiple windows of the same type to be opened. For example, two services status window should not allowed to be opened. In general, the system will not create another window if the identifier is already in the current list.

Returns:
The window's identifier

createAsInternalFrame

public javax.swing.JInternalFrame createAsInternalFrame()
                                                 throws java.lang.Exception
Create the window as an internal frame.

Returns:
A reference to the newly created internal frame
Throws:
java.lang.Exception

createAsInternalFrame

public javax.swing.JInternalFrame createAsInternalFrame(boolean resizable)
                                                 throws java.lang.Exception
Create an internal frame.

Parameters:
resizable -
Returns:
A reference to a newly created internal frame
Throws:
java.lang.Exception

setPanel

protected void setPanel(javax.swing.JPanel p)
Set the window's main panel.

Parameters:
p - Main panel

getPanel

protected javax.swing.JPanel getPanel()
Get the window's main panel.

Returns:
Window's main panel

addChildWindow

protected void addChildWindow(AbstractWindow childWindow)
Add a child frame.

Parameters:
childWindow -

getWindowDimension

protected java.awt.Dimension getWindowDimension()
Get the desired window dimension.

Returns:
The desired window dimension

getDesiredLocation

protected java.awt.Point getDesiredLocation()
Get the desired internal frame position.

Returns:
Desired frame position

buildStatusBar

protected WindowStatusBar buildStatusBar()
Build the status bar.
By default, the operation doesn't build anything. Classes that extend this class and want a status bar should override this method and create the desired status bar.

Returns:
A status bar panel

startWork

public final void startWork()
Indicate that work has started.


startWork

public final void startWork(java.lang.String text)

stopWork

public final void stopWork()
Indicate that work has stopped.


stopWork

public final void stopWork(java.lang.String text)

getTitle

protected abstract java.lang.String getTitle()
Get the frame title.

Returns:
The frame title

closeWindow

protected final void closeWindow()
Try to close the internal frame. The method is available to classes that extend this base class, but it may not be overriden.


windowClosing

protected void windowClosing()
If required, classes may override this method in order to perform any functions necessary before the window is closed.



Copyright © 2004-2005 David Irwin. All Rights Reserved.