dLife Home Page

dlife.gui.connectiondialog
Class Connection

java.lang.Object
  extended by java.util.Observable
      extended by dlife.gui.connectiondialog.Connection
Direct Known Subclasses:
BluetoothConnection, SerialPortConnection, SocketConnection

public abstract class Connection
extends Observable

A Connection is a model (in MVC sense) of a connection. It holds the connection information necessary for making a particular type of connection (e.g. serial / bluetooth / socket / etc...). Each Connection also returns a GUI panel that allows the user to enter connection information. Connections are Observable so that the ConnectionDialog can check if the "Connect" button should be enabled any time a change is made.

Version:
Nov 1, 2010
Author:
Grant Braught, Dickinson College

Constructor Summary
Connection()
           
 
Method Summary
abstract  boolean canConnect()
          Return's true if this Connection .
abstract  boolean connectNow()
          Return's true if the user has made a final selection (e.g.
protected abstract  GUIPanel createGUIPanel()
          Every concrete implementation must implement this method that crates the GUI view (in MVC sense) for the Connection.
 GUIPanel getGUIPanel()
          Return a JPanel containing the GUI components for this ConnectionDialogPanel.
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Connection

public Connection()
Method Detail

canConnect

public abstract boolean canConnect()
Return's true if this Connection .

Returns:
true if "Connect" should be enabled.

connectNow

public abstract boolean connectNow()
Return's true if the user has made a final selection (e.g. double clicking in a file chooser) and the connection should be made immediately without the need to click the "Connect" button.

Returns:
true if the connection should be established immediately.

createGUIPanel

protected abstract GUIPanel createGUIPanel()
Every concrete implementation must implement this method that crates the GUI view (in MVC sense) for the Connection.

Returns:
the GUI.

getGUIPanel

public GUIPanel getGUIPanel()
Return a JPanel containing the GUI components for this ConnectionDialogPanel. The JPanel will contain all of the GUI components needed to obtain the connection information.

Returns:
the GUI for this ConnectionDialogPanel.

dLife Home Page