|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.uiuc.cs.net.DPRPManager.GUI_DPRPClient
A GUI version of the ubiquituous DPRP client. I'm going to need to keep some sort of list of DPRPClient object instances, so that when I have the JTable setup, and users' mess with individual leases, we can get back with the client that has that lease outstanding, and make the change. Actually, it's going to need to be a list of DPRPClients, and their ThreadID's (so that they can be interrupted while they are sleeping).
Explore JOptionPane, for simple dialogs (errors and such).
For the JTable button thing, I'm going to have to setup a mouse listener, that pokes a bunch of variables with the current data that is highlighted. Also, it will make the button.setEnabled(true) whenever something is highlighted. At start, this will be false, and if we can ever de-select entirely, then it must be false (dunno if I have to worry about that).
Field Summary | |
private javax.swing.JTextField |
cliIPField
The text field that holds the client IP address. |
private java.lang.String |
curProtocolSelected
A reference to the current protocol selected in the list box. |
private DPRPLease |
curSelectedLease
A reference to the DPRPLease object that is in the current, user-selected row in the table. |
private javax.swing.JFrame |
frame
The main frame for the entire application. |
private java.lang.String |
frameTitle
The name of the main GUI window. |
private static java.lang.String |
HELP_PATH
The default path for help files. |
private java.util.HashMap |
lease2ClientMap
A map of leases that this client has outstanding. |
private javax.swing.JTextField |
reqDurationField
The text field for the requested lease duration, in seconds. |
private javax.swing.JTextField |
reqPortField
The text field for the requested port. |
private javax.swing.JComboBox |
reqProtocolList
The list box, where the protocol is selected. |
private javax.swing.JTextField |
srvIPField
The text field that holds the DPRP-enabled gateway's IP address. |
private javax.swing.JTextField |
srvPortField
The text field that holds the port on the DPRP-enabled gateway. |
private javax.swing.JTable |
table
The table itself is now a global reference, so that the buttons can be grey'd out upon lease termination. |
private DPRPLeaseTableModel |
tableModel
My localized model for the JTable of outstanding DPRP leases. |
private javax.swing.JButton |
terminateButton
Terminate lease button; Global for table-grey-out purposes. |
private javax.swing.JButton |
updateButton
Update lease button; Global for table-grey-out purposes. |
Fields inherited from interface edu.uiuc.cs.net.DPRPManager.DPRPLeaseListenerConstants |
NEW_LEASE_EVENT, REMOVE_LEASE_EVENT, UPDATE_LEASE_EVENT |
Fields inherited from interface edu.uiuc.cs.net.DPRPManager.DPRPClientConstants |
CLI_COMMAND, CLI_FORCE_LEASE_TERMINATE, CLI_FORCE_LEASE_UPDATE, CLI_TERMINATE_THREAD, cliIPFieldString, HALT, HALT_ACQUIRE_LEASE, HALT_INTERRUPTED, HALT_INVALID_SLEEP_TIMER, HALT_NO_RESPONSE, HALT_SERVER_NACK, HALT_T2_EXPIRED, NUM_RETRIES, okButtonString, reqDurationFieldString, reqPortFieldString, reqProtocolFieldString, resetButtonString, srvIPFieldString, srvPortFieldString, terminateButtonString, updateButtonString |
Constructor Summary | |
GUI_DPRPClient()
Constructor. |
Method Summary | |
void |
acquireNewLease()
Attempts to get a new DPRPLease, based upon the current form information. |
void |
actionPerformed(java.awt.event.ActionEvent e)
This will be called whenever the "get lease" button is smacked, or the "reset to defaults" button. |
private javax.swing.JEditorPane |
createHelpPane(java.lang.String fname)
Loads an HTML document into a JEditorPane instance, and returns said instance. |
private void |
createMainWindowLayout()
Creates the main window layout, which consists of a top and bottom half. |
private javax.swing.JPanel |
createManageLeasesPanel()
Paints the JTabel that displays currently outstanding leases. |
void |
createMenuBar()
Create (and populate) the menubar. |
void |
createNewHelpDialog(java.lang.String labelText,
java.lang.String fname)
Throws up a help dialog, showing the given filename inside. |
private javax.swing.JPanel |
createNewLeasePanel()
Creates the panel that accepts user-input and control of requesting new leases. |
private void |
launchGUI()
Handles all drawing on the main frame, and display of said frame. |
void |
loadLeases(java.io.File inpFile)
Loads in a set of leases from disk, replacing any currently held leases with the from-disk set. |
static void |
main(java.lang.String[] args)
The main() method: the action starts here. |
private void |
makeLabelTextLayout(javax.swing.JComponent[][] parts,
java.awt.GridBagLayout gridbag,
java.awt.Container container)
Drops the labels and text fields into the grid bag layout. |
void |
receiveLease(DPRPLeaseEvent ple)
This gets called whenever a DPRPClient object instance decides that it has a lease that we need to see. |
private void |
resetTextFieldsToDefaults()
Reset all of the text input fields for establishing a new lease to their default values. |
void |
saveLeases(java.io.File outFile)
Writes out the currently held leases to disk. |
Methods inherited from class java.lang.Object |
|
Field Detail |
private java.lang.String frameTitle
private javax.swing.JFrame frame
private java.lang.String curProtocolSelected
private java.util.HashMap lease2ClientMap
private DPRPLeaseTableModel tableModel
private final javax.swing.JTable table
private final javax.swing.JButton updateButton
private final javax.swing.JButton terminateButton
private DPRPLease curSelectedLease
private javax.swing.JTextField cliIPField
private javax.swing.JTextField srvIPField
private javax.swing.JTextField srvPortField
private javax.swing.JComboBox reqProtocolList
private javax.swing.JTextField reqPortField
private javax.swing.JTextField reqDurationField
private static final java.lang.String HELP_PATH
Constructor Detail |
public GUI_DPRPClient()
Method Detail |
public static void main(java.lang.String[] args)
private void launchGUI()
private void createMainWindowLayout()
private javax.swing.JPanel createNewLeasePanel()
private javax.swing.JPanel createManageLeasesPanel()
public void acquireNewLease()
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
public void receiveLease(DPRPLeaseEvent ple)
receiveLease
in interface DPRPLeaseListener
private void makeLabelTextLayout(javax.swing.JComponent[][] parts, java.awt.GridBagLayout gridbag, java.awt.Container container)
private void resetTextFieldsToDefaults()
public void createMenuBar()
public void saveLeases(java.io.File outFile)
outFile
- The output file for the leases.public void loadLeases(java.io.File inpFile)
:)
inpFile
- The file name, from which we cull the leases.public void createNewHelpDialog(java.lang.String labelText, java.lang.String fname)
private javax.swing.JEditorPane createHelpPane(java.lang.String fname)
fname
- The name of the help file to be opened, relative to
the cwd.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |