package tmcsim.client.cadclientgui.screens; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.rmi.RemoteException; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.LinkedList; import java.awt.List; import javax.swing.JOptionPane; import javax.swing.JScrollPane; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.table.DefaultTableModel; import tmcsim.client.cadclientgui.data.CardfileDataObject; import tmcsim.client.cadclientgui.data.CardfileList; import tmcsim.client.cadclientgui.data.ChangeLog; import tmcsim.client.cadclientgui.enums.CADDataEnums.EditCommand; import tmcsim.client.cadclientgui.enums.CADDataEnums.CARDFILE; /** * This class contains the view and controller for the Cardfile screen. The view is built using a GUI builder plug-in, and the controller * uses listeners to control how the view and data act. Upon closing this screen, it will ask if the user would like to save the changes * made. This requires a local copy of the data for the user to operate on, and only if the user commits to the changes do the change logs * make their way back to the database. * * @author Stuart */ public class Cardfile extends javax.swing.JFrame { private boolean saveFields; // local copies of the cardfile data private CardfileList coastalDivisionUnitsList; private CardfileList policeSheriffCoronerList; private CardfileList courtsList; private CardfileList publicTransportationList; private CardfileList ggOtherList; private CardfileList myMiscList; private CardfileList slMiscList; private CardfileList vtMiscList; private CardfileList chpOfficesList; private CardfileList stateAgenciesFacilitiesList; private CardfileList governmentOfficialsList; private CardfileList federalAgenciesList; private CardfileList ranchesLivestockList; private CardfileList fireEmsList; private CardfileList jailsList; private CardfileList hospitalsMedCentersList; private CardfileList towCompaniesList; private CardfileList calTransList; private CardfileList countyRoadsList; private CardfileList utilitiesList; private CardfileList animalControlList; private CardfileList airportsList; private CardfileList creditCardsList; private CardfileList ggCrisisSheltersList; private CardfileList rangesList; private CardfileList hotlinesList; private CardfileList hwyPatrolsOosList; private CardfileList parksRecreationList; private CardfileList sheltersList; private CardfileList slCountyServicesList; private CardfileList slResourcesList; private CardfileList truckTireRepairList; private CardfileList mccEmployeesList; private CardfileList gateAccessCodesList; private CardfileList vtCallSignsList; private CardfileList slccEmployeesList; private boolean changesMade = false; // list of change logs to be sent over to the server data if user chooses to // save changes upon close private LinkedList cardfileObjectEdits = new LinkedList(); private LinkedList cardfileObjectDeletes = new LinkedList(); private LinkedList cardfileObjectAdds = new LinkedList(); private LinkedList tableDeletes = new LinkedList(); private LinkedList tableAdds = new LinkedList(); // variables to keep track of current status of cardfile CardfileList selectedList; CardfileDataObject currObject; private int currId; private String currName; private String currAddress; private String currCity; private String currState; private String currZip; private String currPhone1; private String currPhone2; private String currFax; // listener for lists private MouseListener mouseListener; /** * Creates new form Cardfile */ public Cardfile() { declareComponents(); initControllers(); initView(); } /** local main for testing - just show the frame */ public static void main(String[] args) { new Cardfile().setVisible(true); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void declareComponents() { cardfileTabs = new javax.swing.JTabbedPane(); coastalDivisionUnitsPane = new javax.swing.JPanel(); policeSheriffCoronerPane = new javax.swing.JPanel(); courtsPane = new javax.swing.JPanel(); publicTransportationPane = new javax.swing.JPanel(); ggOtherPane = new javax.swing.JPanel(); myMiscPane = new javax.swing.JPanel(); slMiscPane = new javax.swing.JPanel(); vtMiscPane = new javax.swing.JPanel(); chpOfficesPane = new javax.swing.JPanel(); stateAgenciesFacilitiesPane = new javax.swing.JPanel(); governmentOfficialsPane = new javax.swing.JPanel(); federalAgenciesPane = new javax.swing.JPanel(); ranchesLivestockPane = new javax.swing.JPanel(); fireEmsPane = new javax.swing.JPanel(); jailsPane = new javax.swing.JPanel(); hospitalsMedCentersPane = new javax.swing.JPanel(); towCompaniesPane = new javax.swing.JPanel(); calTransPane = new javax.swing.JPanel(); countyRoadsPane = new javax.swing.JPanel(); utilitiesPane = new javax.swing.JPanel(); animalControlPane = new javax.swing.JPanel(); airportsPane = new javax.swing.JPanel(); creditCardsPane = new javax.swing.JPanel(); ggCrisisSheltersPane = new javax.swing.JPanel(); rangesPane = new javax.swing.JPanel(); hotlinesPane = new javax.swing.JPanel(); hwyPatrolsOosPane = new javax.swing.JPanel(); parksRecreationPane = new javax.swing.JPanel(); sheltersPane = new javax.swing.JPanel(); slCountyServicesPane = new javax.swing.JPanel(); slResourcesPane = new javax.swing.JPanel(); truckTireRepairPane = new javax.swing.JPanel(); mccEmployeesPane = new javax.swing.JPanel(); gateAccessCodesPane = new javax.swing.JPanel(); vtCallSignsPane = new javax.swing.JPanel(); slccEmployeesPane = new javax.swing.JPanel(); nameLabel = new javax.swing.JLabel(); nameField = new javax.swing.JTextField(); addressField = new javax.swing.JTextField(); addressLabel = new javax.swing.JLabel(); cityLabel = new javax.swing.JLabel(); cityField = new javax.swing.JTextField(); stateField = new javax.swing.JTextField(3); stateLabel = new javax.swing.JLabel(); zipLabel = new javax.swing.JLabel(); zipField = new javax.swing.JTextField(); phone1Field = new javax.swing.JTextField(); phone1Label = new javax.swing.JLabel(); phone2Field = new javax.swing.JTextField(); phone2Label = new javax.swing.JLabel(); faxField = new javax.swing.JTextField(); faxLabel = new javax.swing.JLabel(); commentsLabel = new javax.swing.JLabel(); jScrollPane1 = new javax.swing.JScrollPane(); commentsTable = new javax.swing.JTable(); jScrollPane2 = new javax.swing.JScrollPane(); commentsField = new javax.swing.JTextPane(); addCommentButton = new javax.swing.JButton(); cancelCommentButton = new javax.swing.JButton(); saveCommentButton = new javax.swing.JButton(); deleteCommentButton = new javax.swing.JButton(); exitButton = new javax.swing.JButton(); printButton = new javax.swing.JButton(); saveButton = new javax.swing.JButton(); cancelButton = new javax.swing.JButton(); deleteButton = new javax.swing.JButton(); addButton = new javax.swing.JButton(); } private ChangeListener newChangeListener() { return new ChangeListener() { public void stateChanged(ChangeEvent e) { if (cardfileTabs.getTitleAt(cardfileTabs.getSelectedIndex()) == CARDFILE.COASTAL_DIVISION_UNITS.tag) { selectedList = coastalDivisionUnitsList; } else if (cardfileTabs.getTitleAt(cardfileTabs .getSelectedIndex()) == CARDFILE.POLICE_SHERIFF_CORONER.tag) { selectedList = policeSheriffCoronerList; } else if (cardfileTabs.getTitleAt(cardfileTabs .getSelectedIndex()) == CARDFILE.COURTS.tag) { selectedList = courtsList; } else if (cardfileTabs.getTitleAt(cardfileTabs .getSelectedIndex()) == CARDFILE.PUBLIC_TRANSPORTATION.tag) { selectedList = publicTransportationList; } else if (cardfileTabs.getTitleAt(cardfileTabs .getSelectedIndex()) == CARDFILE.GG_OTHER.tag) { selectedList = ggOtherList; } else if (cardfileTabs.getTitleAt(cardfileTabs .getSelectedIndex()) == CARDFILE.MY_MISC.tag) { selectedList = myMiscList; } else if (cardfileTabs.getTitleAt(cardfileTabs .getSelectedIndex()) == CARDFILE.SL_MISC.tag) { selectedList = slMiscList; } else if (cardfileTabs.getTitleAt(cardfileTabs .getSelectedIndex()) == CARDFILE.VT_MISC.tag) { selectedList = vtMiscList; } else if (cardfileTabs.getTitleAt(cardfileTabs .getSelectedIndex()) == CARDFILE.CHP_OFFICES.tag) { selectedList = chpOfficesList; } else if (cardfileTabs.getTitleAt(cardfileTabs .getSelectedIndex()) == CARDFILE.STATE_AGENCIES_FACILITIES.tag) { selectedList = stateAgenciesFacilitiesList; } else if (cardfileTabs.getTitleAt(cardfileTabs .getSelectedIndex()) == CARDFILE.GOVERNMENT_OFFICIALS.tag) { selectedList = governmentOfficialsList; } else if (cardfileTabs.getTitleAt(cardfileTabs .getSelectedIndex()) == CARDFILE.FEDERAL_AGENCIES.tag) { selectedList = federalAgenciesList; } else if (cardfileTabs.getTitleAt(cardfileTabs .getSelectedIndex()) == CARDFILE.RANCHES_LIVESTOCK.tag) { selectedList = ranchesLivestockList; } else if (cardfileTabs.getTitleAt(cardfileTabs .getSelectedIndex()) == CARDFILE.FIRE_EMS.tag) { selectedList = fireEmsList; } else if (cardfileTabs.getTitleAt(cardfileTabs .getSelectedIndex()) == CARDFILE.JAILS.tag) { selectedList = jailsList; } else if (cardfileTabs.getTitleAt(cardfileTabs .getSelectedIndex()) == CARDFILE.HOSPITALS_MED_CENTERS.tag) { selectedList = hospitalsMedCentersList; } else if (cardfileTabs.getTitleAt(cardfileTabs .getSelectedIndex()) == CARDFILE.TOW_COMPANIES.tag) { selectedList = towCompaniesList; } else if (cardfileTabs.getTitleAt(cardfileTabs .getSelectedIndex()) == CARDFILE.CALTRANS.tag) { selectedList = calTransList; } else if (cardfileTabs.getTitleAt(cardfileTabs .getSelectedIndex()) == CARDFILE.COUNTY_ROADS.tag) { selectedList = countyRoadsList; } else if (cardfileTabs.getTitleAt(cardfileTabs .getSelectedIndex()) == CARDFILE.UTILITIES.tag) { selectedList = utilitiesList; } else if (cardfileTabs.getTitleAt(cardfileTabs .getSelectedIndex()) == CARDFILE.ANIMAL_CONTROL.tag) { selectedList = animalControlList; } else if (cardfileTabs.getTitleAt(cardfileTabs .getSelectedIndex()) == CARDFILE.AIRPORTS.tag) { selectedList = airportsList; } else if (cardfileTabs.getTitleAt(cardfileTabs .getSelectedIndex()) == CARDFILE.CREDIT_CARDS.tag) { selectedList = creditCardsList; } else if (cardfileTabs.getTitleAt(cardfileTabs .getSelectedIndex()) == CARDFILE.GG_CRISIS_SHELTERS.tag) { selectedList = ggCrisisSheltersList; } else if (cardfileTabs.getTitleAt(cardfileTabs .getSelectedIndex()) == CARDFILE.RANGES.tag) { selectedList = rangesList; } else if (cardfileTabs.getTitleAt(cardfileTabs .getSelectedIndex()) == CARDFILE.HOTLINES.tag) { selectedList = hotlinesList; } else if (cardfileTabs.getTitleAt(cardfileTabs .getSelectedIndex()) == CARDFILE.HWY_PATROLS_OOS.tag) { selectedList = hwyPatrolsOosList; } else if (cardfileTabs.getTitleAt(cardfileTabs .getSelectedIndex()) == CARDFILE.PARKS_RECREATION.tag) { selectedList = parksRecreationList; } else if (cardfileTabs.getTitleAt(cardfileTabs .getSelectedIndex()) == CARDFILE.SHELTERS.tag) { selectedList = sheltersList; } else if (cardfileTabs.getTitleAt(cardfileTabs .getSelectedIndex()) == CARDFILE.SL_COUNTY_SERVICES.tag) { selectedList = slCountyServicesList; } else if (cardfileTabs.getTitleAt(cardfileTabs .getSelectedIndex()) == CARDFILE.SL_RESOURCES.tag) { selectedList = slResourcesList; } else if (cardfileTabs.getTitleAt(cardfileTabs .getSelectedIndex()) == CARDFILE.TRUCK_TIRE_REPAIR.tag) { selectedList = truckTireRepairList; } else if (cardfileTabs.getTitleAt(cardfileTabs .getSelectedIndex()) == CARDFILE.MCC_EMPLOYEES.tag) { selectedList = mccEmployeesList; } else if (cardfileTabs.getTitleAt(cardfileTabs .getSelectedIndex()) == CARDFILE.GATE_ACCESS_CODES.tag) { selectedList = gateAccessCodesList; } else if (cardfileTabs.getTitleAt(cardfileTabs .getSelectedIndex()) == CARDFILE.VT_CALL_SIGNS.tag) { selectedList = vtCallSignsList; } else if (cardfileTabs.getTitleAt(cardfileTabs .getSelectedIndex()) == CARDFILE.SLCC_EMPLOYEES.tag) { selectedList = slccEmployeesList; } } }; } private WindowAdapter newWindowListener(){ return new WindowAdapter() { public void windowClosing(WindowEvent e) { close(); } }; } private void initMouseListener(){ mouseListener = new MouseListener() { public void mouseClicked(MouseEvent arg0) { saveInformation(); refreshInformation(); } public void mouseEntered(MouseEvent arg0) { } public void mouseExited(MouseEvent arg0) { } public void mousePressed(MouseEvent arg0) { saveInformation(); refreshInformation(); } public void mouseReleased(MouseEvent arg0) { } }; } private ListSelectionListener newCommentsListSelectionListener(){ return new ListSelectionListener() { public void valueChanged(ListSelectionEvent arg0) { if (commentsTable.getSelectedRow() >= 0) { cancelCommentButton.setEnabled(true); deleteCommentButton.setEnabled(true); } } }; } private DocumentListener newCommentsDocumentListener(){ return new DocumentListener(){ public void changedUpdate(DocumentEvent e) { } public void insertUpdate(DocumentEvent e) { saveCommentButton.setEnabled(true); } public void removeUpdate(DocumentEvent e) { } }; } private ActionListener newCommentsAddActionListener(){ return new ActionListener() { public void actionPerformed(ActionEvent evt) { commentsTable.clearSelection(); addCommentButton.setEnabled(false); deleteCommentButton.setEnabled(false); cancelCommentButton.setEnabled(true); commentsField.setEditable(true); commentsField.requestFocus(); } }; } private ActionListener newCommentsCancelActionListener(){ return new ActionListener() { public void actionPerformed(ActionEvent evt) { addCommentButton.setEnabled(true); cancelCommentButton.setEnabled(false); deleteCommentButton.setEnabled(false); saveCommentButton.setEnabled(false); commentsTable.clearSelection(); commentsField.setText(""); commentsField.setEditable(false); } }; } private ActionListener newCommentsSaveActionListener(){ return new ActionListener() { public void actionPerformed(ActionEvent evt) { DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy"); DateFormat timeFormat = new SimpleDateFormat("HH:mm:ss"); String[] tableFields = { dateFormat.format(new Date()), timeFormat.format(new Date()), "", commentsField.getText() }; currObject.addComment(tableFields); ((DefaultTableModel) commentsTable.getModel()) .addRow(tableFields); changesMade = true; tableAdds.add(new ChangeLog(EditCommand.TABLE_ADD, cardfileTabs .getTitleAt(cardfileTabs.getSelectedIndex()), currId, tableFields)); addCommentButton.setEnabled(true); cancelCommentButton.setEnabled(false); saveCommentButton.setEnabled(false); commentsField.setText(""); commentsField.setEditable(false); } }; } private ActionListener newCommentsDeleteActionListener(){ return new ActionListener() { public void actionPerformed(ActionEvent evt) { changesMade = true; tableDeletes.add(new ChangeLog( EditCommand.TABLE_DELETE, cardfileTabs.getTitleAt(cardfileTabs.getSelectedIndex()), (String) commentsTable.getValueAt( commentsTable.getSelectedRow(), 1), currId)); ((DefaultTableModel) commentsTable.getModel()) .removeRow(commentsTable.getSelectedRow()); deleteCommentButton.setEnabled(false); } }; } private ActionListener newExitActionListener(){ return new ActionListener() { public void actionPerformed(ActionEvent e) { close(); } }; } private ActionListener newSaveActionListener(){ return new ActionListener() { public void actionPerformed(ActionEvent arg0) { changesMade = true; saveFields = false; addButton.setEnabled(true); cancelButton.setEnabled(false); saveButton.setEnabled(false); CardfileDataObject cfdo = null; try { cfdo = new CardfileDataObject(cardfileTabs .getTitleAt(cardfileTabs.getSelectedIndex()), nameField.getText(), ScreenManager.theCoordinator .obtainNewUniqueId()); } catch (RemoteException e) { e.printStackTrace(); } cfdo.setAddress(addressField.getText()); cfdo.setCity(cityField.getText()); cfdo.setState(stateField.getText()); cfdo.setZip(zipField.getText()); cfdo.setPhone1(phone1Field.getText()); cfdo.setPhone2(phone2Field.getText()); cfdo.setFax(faxField.getText()); selectedList.select(selectedList.addDataObject(cfdo)); cardfileObjectAdds.add(new ChangeLog( EditCommand.OBJECT_ADD, cardfileTabs.getTitleAt(cardfileTabs.getSelectedIndex()), cfdo)); saveInformation(); refreshInformation(); } }; } private ActionListener newCancelActionListener(){ return new ActionListener() { public void actionPerformed(ActionEvent arg0) { selectedList.deselect(selectedList.getSelectedIndex()); saveFields = false; addButton.setEnabled(true); addCommentButton.setEnabled(false); cancelButton.setEnabled(false); deleteButton.setEnabled(false); saveButton.setEnabled(false); nameField.setText(""); nameField.requestFocus(); addressField.setText(""); cityField.setText(""); stateField.setText(""); zipField.setText(""); phone1Field.setText(""); phone2Field.setText(""); faxField.setText(""); } }; } private ActionListener newDeleteActionListener(){ return new ActionListener() { public void actionPerformed(ActionEvent arg0) { changesMade = true; saveFields = false; deleteButton.setEnabled(false); cancelButton.setEnabled(false); addCommentButton.setEnabled(false); nameField.setText(""); nameField.requestFocus(); addressField.setText(""); cityField.setText(""); stateField.setText(""); zipField.setText(""); phone1Field.setText(""); phone2Field.setText(""); faxField.setText(""); int index = selectedList.getSelectedIndex(); cardfileObjectAdds.add(new ChangeLog( EditCommand.OBJECT_DELETE, cardfileTabs.getTitleAt(cardfileTabs.getSelectedIndex()), selectedList.getCFDO(index).getId())); selectedList.removeDataObject(selectedList.getSelectedIndex()); } }; } private ActionListener newAddActionListener(){ return new ActionListener() { public void actionPerformed(ActionEvent arg0) { selectedList.deselect(selectedList.getSelectedIndex()); addCommentButton.setEnabled(false); addButton.setEnabled(false); deleteButton.setEnabled(false); cancelButton.setEnabled(true); saveButton.setEnabled(true); nameField.setText(""); nameField.requestFocus(); addressField.setText(""); cityField.setText(""); stateField.setText(""); zipField.setText(""); phone1Field.setText(""); phone2Field.setText(""); faxField.setText(""); } }; } private void initControllers() { cardfileTabs.addChangeListener(newChangeListener()); addWindowListener(newWindowListener()); initMouseListener(); commentsTable.getSelectionModel().addListSelectionListener(newCommentsListSelectionListener()); commentsField.getDocument().addDocumentListener(newCommentsDocumentListener()); addCommentButton.addActionListener(newCommentsAddActionListener()); cancelCommentButton.addActionListener(newCommentsCancelActionListener()); saveCommentButton.addActionListener(newCommentsSaveActionListener()); deleteCommentButton.addActionListener(newCommentsDeleteActionListener()); exitButton.addActionListener(newExitActionListener()); saveButton.addActionListener(newSaveActionListener()); cancelButton.addActionListener(newCancelActionListener()); deleteButton.addActionListener(newDeleteActionListener()); addButton.addActionListener(newAddActionListener()); } private void initView() { setTitle("Cardfile"); nameLabel.setText("Name:"); addressLabel.setText("Address:"); cityLabel.setText("City:"); stateLabel.setText("State:"); zipLabel.setText("Zip:"); phone1Label.setText("Phone #1:"); phone2Label.setText("Phone #2:"); faxLabel.setText("Fax Number:"); commentsLabel.setText("Comments"); javax.swing.GroupLayout coastalDivisionUnitsPaneLayout = new javax.swing.GroupLayout( coastalDivisionUnitsPane); coastalDivisionUnitsPaneLayout .setHorizontalGroup(coastalDivisionUnitsPaneLayout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 361, Short.MAX_VALUE)); coastalDivisionUnitsPaneLayout .setVerticalGroup(coastalDivisionUnitsPaneLayout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 317, Short.MAX_VALUE)); commentsTable.setModel(new DefaultTableModel() { public boolean isCellEditable(int row, int column) { return false; } }); ((DefaultTableModel) commentsTable.getModel()) .setColumnIdentifiers(new String[] { "Date", "Time", "Initials", "Comments" }); jScrollPane1.setViewportView(commentsTable); jScrollPane2.setViewportView(commentsField); commentsField.setEditable(false); addCommentButton.setText("Add"); cancelCommentButton.setText("Cancel"); saveCommentButton.setText("Save"); deleteCommentButton.setText("Delete"); exitButton.setText("Exit"); printButton.setText("Print"); printButton.setEnabled(false); saveButton.setText("Save"); cancelButton.setText("Cancel"); deleteButton.setText("Delete"); addButton.setText("Add"); cardfileTabs.addTab(CARDFILE.COASTAL_DIVISION_UNITS.tag, coastalDivisionUnitsPane); javax.swing.GroupLayout policeSheriffCoronerPaneLayout = new javax.swing.GroupLayout( policeSheriffCoronerPane); policeSheriffCoronerPaneLayout .setHorizontalGroup(policeSheriffCoronerPaneLayout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 361, Short.MAX_VALUE)); policeSheriffCoronerPaneLayout .setVerticalGroup(policeSheriffCoronerPaneLayout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 317, Short.MAX_VALUE)); cardfileTabs.addTab(CARDFILE.POLICE_SHERIFF_CORONER.tag, policeSheriffCoronerPane); javax.swing.GroupLayout courtsPaneLayout = new javax.swing.GroupLayout( courtsPane); courtsPaneLayout.setHorizontalGroup(courtsPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 361, Short.MAX_VALUE)); courtsPaneLayout.setVerticalGroup(courtsPaneLayout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 317, Short.MAX_VALUE)); cardfileTabs.addTab(CARDFILE.COURTS.tag, courtsPane); javax.swing.GroupLayout publicTransportationPaneLayout = new javax.swing.GroupLayout( publicTransportationPane); publicTransportationPaneLayout .setHorizontalGroup(publicTransportationPaneLayout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 361, Short.MAX_VALUE)); publicTransportationPaneLayout .setVerticalGroup(publicTransportationPaneLayout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 317, Short.MAX_VALUE)); cardfileTabs.addTab(CARDFILE.PUBLIC_TRANSPORTATION.tag, publicTransportationPane); javax.swing.GroupLayout ggOtherPaneLayout = new javax.swing.GroupLayout( ggOtherPane); ggOtherPaneLayout.setHorizontalGroup(ggOtherPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 361, Short.MAX_VALUE)); ggOtherPaneLayout.setVerticalGroup(ggOtherPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 317, Short.MAX_VALUE)); cardfileTabs.addTab(CARDFILE.GG_OTHER.tag, ggOtherPane); javax.swing.GroupLayout myMiscPaneLayout = new javax.swing.GroupLayout( myMiscPane); myMiscPaneLayout.setHorizontalGroup(myMiscPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 361, Short.MAX_VALUE)); myMiscPaneLayout.setVerticalGroup(myMiscPaneLayout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 317, Short.MAX_VALUE)); cardfileTabs.addTab(CARDFILE.MY_MISC.tag, myMiscPane); javax.swing.GroupLayout slMiscPaneLayout = new javax.swing.GroupLayout( slMiscPane); slMiscPaneLayout.setHorizontalGroup(slMiscPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 361, Short.MAX_VALUE)); slMiscPaneLayout.setVerticalGroup(slMiscPaneLayout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 317, Short.MAX_VALUE)); // cardfileTabs.addTab(CARDFILE.SL_MISC.tag, slMiscPane); javax.swing.GroupLayout vtMiscPaneLayout = new javax.swing.GroupLayout( vtMiscPane); vtMiscPaneLayout.setHorizontalGroup(vtMiscPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 361, Short.MAX_VALUE)); vtMiscPaneLayout.setVerticalGroup(vtMiscPaneLayout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 317, Short.MAX_VALUE)); // cardfileTabs.addTab(CARDFILE.VT_MISC.tag, vtMiscPane); javax.swing.GroupLayout chpOfficesPaneLayout = new javax.swing.GroupLayout( chpOfficesPane); chpOfficesPaneLayout.setHorizontalGroup(chpOfficesPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 361, Short.MAX_VALUE)); chpOfficesPaneLayout.setVerticalGroup(chpOfficesPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 317, Short.MAX_VALUE)); // cardfileTabs.addTab(CARDFILE.CHP_OFFICES.tag, chpOfficesPane); javax.swing.GroupLayout stateAgenciesFacilitiesPaneLayout = new javax.swing.GroupLayout( stateAgenciesFacilitiesPane); stateAgenciesFacilitiesPaneLayout .setHorizontalGroup(stateAgenciesFacilitiesPaneLayout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 361, Short.MAX_VALUE)); stateAgenciesFacilitiesPaneLayout .setVerticalGroup(stateAgenciesFacilitiesPaneLayout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 317, Short.MAX_VALUE)); // cardfileTabs.addTab(CARDFILE.STATE_AGENCIES_FACILITIES.tag, // stateAgenciesFacilitiesPane); javax.swing.GroupLayout governmentOfficialsPaneLayout = new javax.swing.GroupLayout( governmentOfficialsPane); governmentOfficialsPaneLayout .setHorizontalGroup(governmentOfficialsPaneLayout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 361, Short.MAX_VALUE)); governmentOfficialsPaneLayout .setVerticalGroup(governmentOfficialsPaneLayout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 317, Short.MAX_VALUE)); // cardfileTabs.addTab(CARDFILE.GOVERNMENT_OFFICIALS.tag, // governmentOfficialsPane); javax.swing.GroupLayout federalAgenciesPaneLayout = new javax.swing.GroupLayout( federalAgenciesPane); federalAgenciesPaneLayout.setHorizontalGroup(federalAgenciesPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 361, Short.MAX_VALUE)); federalAgenciesPaneLayout.setVerticalGroup(federalAgenciesPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 317, Short.MAX_VALUE)); // cardfileTabs.addTab(CARDFILE.FEDERAL_AGENCIES.tag, federalAgenciesPane); javax.swing.GroupLayout ranchesLivestockPaneLayout = new javax.swing.GroupLayout( ranchesLivestockPane); ranchesLivestockPaneLayout .setHorizontalGroup(ranchesLivestockPaneLayout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 361, Short.MAX_VALUE)); ranchesLivestockPaneLayout.setVerticalGroup(ranchesLivestockPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 317, Short.MAX_VALUE)); // cardfileTabs.addTab(CARDFILE.RANCHES_LIVESTOCK.tag, // ranchesLivestockPane); javax.swing.GroupLayout fireEmsPaneLayout = new javax.swing.GroupLayout( fireEmsPane); fireEmsPaneLayout.setHorizontalGroup(fireEmsPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 361, Short.MAX_VALUE)); fireEmsPaneLayout.setVerticalGroup(fireEmsPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 317, Short.MAX_VALUE)); // cardfileTabs.addTab(CARDFILE.FIRE_EMS.tag, fireEmsPane); javax.swing.GroupLayout jailsPaneLayout = new javax.swing.GroupLayout( jailsPane); jailsPaneLayout.setHorizontalGroup(jailsPaneLayout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 361, Short.MAX_VALUE)); jailsPaneLayout.setVerticalGroup(jailsPaneLayout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 317, Short.MAX_VALUE)); // cardfileTabs.addTab(CARDFILE.JAILS.tag, jailsPane); javax.swing.GroupLayout hospitalsMedCentersPaneLayout = new javax.swing.GroupLayout( hospitalsMedCentersPane); hospitalsMedCentersPaneLayout .setHorizontalGroup(hospitalsMedCentersPaneLayout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 361, Short.MAX_VALUE)); hospitalsMedCentersPaneLayout .setVerticalGroup(hospitalsMedCentersPaneLayout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 317, Short.MAX_VALUE)); // cardfileTabs.addTab(CARDFILE.HOSPITALS_MED_CENTERS.tag, // hospitalsMedCentersPane); javax.swing.GroupLayout towCompaniesPaneLayout = new javax.swing.GroupLayout( towCompaniesPane); towCompaniesPaneLayout.setHorizontalGroup(towCompaniesPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 361, Short.MAX_VALUE)); towCompaniesPaneLayout.setVerticalGroup(towCompaniesPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 317, Short.MAX_VALUE)); // cardfileTabs.addTab(CARDFILE.TOW_COMPANIES.tag, towCompaniesPane); javax.swing.GroupLayout calTransPaneLayout = new javax.swing.GroupLayout( calTransPane); calTransPaneLayout.setHorizontalGroup(calTransPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 361, Short.MAX_VALUE)); calTransPaneLayout.setVerticalGroup(calTransPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 317, Short.MAX_VALUE)); // cardfileTabs.addTab(CARDFILE.CALTRANS.tag, calTransPane); javax.swing.GroupLayout countyRoadsPaneLayout = new javax.swing.GroupLayout( countyRoadsPane); countyRoadsPaneLayout.setHorizontalGroup(countyRoadsPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 361, Short.MAX_VALUE)); countyRoadsPaneLayout.setVerticalGroup(countyRoadsPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 317, Short.MAX_VALUE)); // cardfileTabs.addTab(CARDFILE.COUNTY_ROADS.tag, countyRoadsPane); javax.swing.GroupLayout utilitiesPaneLayout = new javax.swing.GroupLayout( utilitiesPane); utilitiesPaneLayout.setHorizontalGroup(utilitiesPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 361, Short.MAX_VALUE)); utilitiesPaneLayout.setVerticalGroup(utilitiesPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 317, Short.MAX_VALUE)); // cardfileTabs.addTab(CARDFILE.UTILITIES.tag, utilitiesPane); javax.swing.GroupLayout animalControlPaneLayout = new javax.swing.GroupLayout( animalControlPane); animalControlPaneLayout.setHorizontalGroup(animalControlPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 361, Short.MAX_VALUE)); animalControlPaneLayout.setVerticalGroup(animalControlPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 317, Short.MAX_VALUE)); // cardfileTabs.addTab(CARDFILE.ANIMAL_CONTROL.tag, animalControlPane); javax.swing.GroupLayout airportsPaneLayout = new javax.swing.GroupLayout( airportsPane); airportsPaneLayout.setHorizontalGroup(airportsPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 361, Short.MAX_VALUE)); airportsPaneLayout.setVerticalGroup(airportsPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 317, Short.MAX_VALUE)); // cardfileTabs.addTab(CARDFILE.AIRPORTS.tag, airportsPane); javax.swing.GroupLayout creditCardsPaneLayout = new javax.swing.GroupLayout( creditCardsPane); creditCardsPaneLayout.setHorizontalGroup(creditCardsPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 361, Short.MAX_VALUE)); creditCardsPaneLayout.setVerticalGroup(creditCardsPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 317, Short.MAX_VALUE)); // cardfileTabs.addTab(CARDFILE.CREDIT_CARDS.tag, creditCardsPane); javax.swing.GroupLayout ggCrisisSheltersPaneLayout = new javax.swing.GroupLayout( ggCrisisSheltersPane); ggCrisisSheltersPaneLayout .setHorizontalGroup(ggCrisisSheltersPaneLayout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 361, Short.MAX_VALUE)); ggCrisisSheltersPaneLayout.setVerticalGroup(ggCrisisSheltersPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 317, Short.MAX_VALUE)); // cardfileTabs.addTab(CARDFILE.GG_CRISIS_SHELTERS.tag, // ggCrisisSheltersPane); javax.swing.GroupLayout rangesPaneLayout = new javax.swing.GroupLayout( rangesPane); rangesPaneLayout.setHorizontalGroup(rangesPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 361, Short.MAX_VALUE)); rangesPaneLayout.setVerticalGroup(rangesPaneLayout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 317, Short.MAX_VALUE)); // cardfileTabs.addTab(CARDFILE.RANGES.tag, rangesPane); javax.swing.GroupLayout hotlinesPaneLayout = new javax.swing.GroupLayout( hotlinesPane); hotlinesPaneLayout.setHorizontalGroup(hotlinesPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 361, Short.MAX_VALUE)); hotlinesPaneLayout.setVerticalGroup(hotlinesPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 317, Short.MAX_VALUE)); // cardfileTabs.addTab(CARDFILE.HOTLINES.tag, hotlinesPane); javax.swing.GroupLayout hwyPatrolsOosPaneLayout = new javax.swing.GroupLayout( hwyPatrolsOosPane); hwyPatrolsOosPaneLayout.setHorizontalGroup(hwyPatrolsOosPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 361, Short.MAX_VALUE)); hwyPatrolsOosPaneLayout.setVerticalGroup(hwyPatrolsOosPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 317, Short.MAX_VALUE)); // cardfileTabs.addTab(CARDFILE.HWY_PATROLS_OOS.tag, hwyPatrolsOosPane); javax.swing.GroupLayout parksRecreationPaneLayout = new javax.swing.GroupLayout( parksRecreationPane); parksRecreationPaneLayout.setHorizontalGroup(parksRecreationPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 361, Short.MAX_VALUE)); parksRecreationPaneLayout.setVerticalGroup(parksRecreationPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 317, Short.MAX_VALUE)); // cardfileTabs.addTab(CARDFILE.PARKS_RECREATION.tag, parksRecreationPane); javax.swing.GroupLayout sheltersPaneLayout = new javax.swing.GroupLayout( sheltersPane); sheltersPaneLayout.setHorizontalGroup(sheltersPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 361, Short.MAX_VALUE)); sheltersPaneLayout.setVerticalGroup(sheltersPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 317, Short.MAX_VALUE)); // cardfileTabs.addTab(CARDFILE.SHELTERS.tag, sheltersPane); javax.swing.GroupLayout slCountyServicesLayout = new javax.swing.GroupLayout( slCountyServicesPane); slCountyServicesLayout.setHorizontalGroup(slCountyServicesLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 361, Short.MAX_VALUE)); slCountyServicesLayout.setVerticalGroup(slCountyServicesLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 317, Short.MAX_VALUE)); // cardfileTabs.addTab(CARDFILE.SL_COUNTY_SERVICES.tag, // slCountyServicesPane); javax.swing.GroupLayout slResourcesPaneLayout = new javax.swing.GroupLayout( slResourcesPane); slResourcesPaneLayout.setHorizontalGroup(slResourcesPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 361, Short.MAX_VALUE)); slResourcesPaneLayout.setVerticalGroup(slResourcesPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 317, Short.MAX_VALUE)); // cardfileTabs.addTab(CARDFILE.SL_RESOURCES.tag, slResourcesPane); javax.swing.GroupLayout truckTireRepairPaneLayout = new javax.swing.GroupLayout( truckTireRepairPane); truckTireRepairPaneLayout.setHorizontalGroup(truckTireRepairPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 361, Short.MAX_VALUE)); truckTireRepairPaneLayout.setVerticalGroup(truckTireRepairPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 317, Short.MAX_VALUE)); // cardfileTabs // .addTab(CARDFILE.TRUCK_TIRE_REPAIR.tag, truckTireRepairPane); javax.swing.GroupLayout mccEmployeesPaneLayout = new javax.swing.GroupLayout( mccEmployeesPane); mccEmployeesPaneLayout.setHorizontalGroup(mccEmployeesPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 361, Short.MAX_VALUE)); mccEmployeesPaneLayout.setVerticalGroup(mccEmployeesPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 317, Short.MAX_VALUE)); // cardfileTabs.addTab(CARDFILE.MCC_EMPLOYEES.tag, mccEmployeesPane); javax.swing.GroupLayout gateAccessCodesPaneLayout = new javax.swing.GroupLayout( gateAccessCodesPane); gateAccessCodesPaneLayout.setHorizontalGroup(gateAccessCodesPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 361, Short.MAX_VALUE)); gateAccessCodesPaneLayout.setVerticalGroup(gateAccessCodesPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 317, Short.MAX_VALUE)); // cardfileTabs // .addTab(CARDFILE.GATE_ACCESS_CODES.tag, gateAccessCodesPane); javax.swing.GroupLayout vtCallSignsPaneLayout = new javax.swing.GroupLayout( vtCallSignsPane); vtCallSignsPaneLayout.setHorizontalGroup(vtCallSignsPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 361, Short.MAX_VALUE)); vtCallSignsPaneLayout.setVerticalGroup(vtCallSignsPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 317, Short.MAX_VALUE)); // cardfileTabs.addTab(CARDFILE.VT_CALL_SIGNS.tag, vtCallSignsPane); javax.swing.GroupLayout slccEmployeesPaneLayout = new javax.swing.GroupLayout( slccEmployeesPane); slccEmployeesPaneLayout.setHorizontalGroup(slccEmployeesPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 361, Short.MAX_VALUE)); slccEmployeesPaneLayout.setVerticalGroup(slccEmployeesPaneLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 317, Short.MAX_VALUE)); // cardfileTabs.addTab(CARDFILE.SLCC_EMPLOYEES.tag, slccEmployeesPane); javax.swing.GroupLayout layout = new javax.swing.GroupLayout( getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout.createSequentialGroup() .addContainerGap() .addGroup( layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout.createSequentialGroup() .addComponent( cardfileTabs, javax.swing.GroupLayout.PREFERRED_SIZE, 366, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout.createSequentialGroup() .addGap(72, 72, 72) .addGroup( layout.createParallelGroup( javax.swing.GroupLayout.Alignment.TRAILING) .addGroup( layout.createSequentialGroup() .addComponent( nameLabel) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent( nameField, javax.swing.GroupLayout.PREFERRED_SIZE, 205, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup( layout.createSequentialGroup() .addGroup( layout.createParallelGroup( javax.swing.GroupLayout.Alignment.TRAILING) .addComponent( cityLabel) .addComponent( addressLabel) .addComponent( stateLabel) .addComponent( phone1Label) .addComponent( phone2Label) .addComponent( faxLabel)) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent( addressField) .addComponent( cityField) .addGroup( layout.createSequentialGroup() .addComponent( stateField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(41, 41, 41) .addComponent( zipLabel) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent( zipField)) .addComponent( phone1Field) .addComponent( phone2Field) .addComponent( faxField, javax.swing.GroupLayout.PREFERRED_SIZE, 206, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, 42, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent( jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) .addGroup( layout.createSequentialGroup() .addComponent( commentsLabel) .addGap(0, 0, Short.MAX_VALUE)) .addGroup( layout.createSequentialGroup() .addComponent( jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addComponent( addCommentButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( cancelCommentButton, javax.swing.GroupLayout.DEFAULT_SIZE, 106, Short.MAX_VALUE) .addComponent( saveCommentButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( deleteCommentButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))) .addGroup( javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, 308, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent( addButton, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent( deleteButton, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent( cancelButton, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent( saveButton, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent( printButton, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent( exitButton, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap())); layout.setVerticalGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGap(12, 12, 12) .addGroup( layout.createParallelGroup( javax.swing.GroupLayout.Alignment.TRAILING) .addComponent( cardfileTabs, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) .addGroup( javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( layout.createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent( nameLabel) .addComponent( nameField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( layout.createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent( addressLabel) .addComponent( addressField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( layout.createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent( cityLabel) .addComponent( cityField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( layout.createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent( stateLabel) .addComponent( stateField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent( zipLabel) .addComponent( zipField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( layout.createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent( phone1Label) .addComponent( phone1Field, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( layout.createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent( phone2Label) .addComponent( phone2Field, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( layout.createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent( faxLabel) .addComponent( faxField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(5, 5, 5) .addComponent( commentsLabel) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent( jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout.createSequentialGroup() .addComponent( addCommentButton) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( cancelCommentButton) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent( saveCommentButton) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent( deleteCommentButton)) .addComponent( jScrollPane2)))) .addGap(18, 18, 18) .addGroup( layout.createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(deleteButton) .addComponent(cancelButton) .addComponent(saveButton) .addComponent(printButton) .addComponent(exitButton) .addComponent(addButton)) .addContainerGap())); pack(); }// //GEN-END:initComponents /* * Loads server data onto the client copy. */ public void loadData() { try { coastalDivisionUnitsList = ScreenManager.theCoordinator .getCardfileList(CARDFILE.COASTAL_DIVISION_UNITS); policeSheriffCoronerList = ScreenManager.theCoordinator .getCardfileList(CARDFILE.POLICE_SHERIFF_CORONER); courtsList = ScreenManager.theCoordinator .getCardfileList(CARDFILE.COURTS); publicTransportationList = ScreenManager.theCoordinator .getCardfileList(CARDFILE.PUBLIC_TRANSPORTATION); ggOtherList = ScreenManager.theCoordinator .getCardfileList(CARDFILE.GG_OTHER); myMiscList = ScreenManager.theCoordinator .getCardfileList(CARDFILE.MY_MISC); slMiscList = ScreenManager.theCoordinator .getCardfileList(CARDFILE.SL_MISC); vtMiscList = ScreenManager.theCoordinator .getCardfileList(CARDFILE.VT_MISC); chpOfficesList = ScreenManager.theCoordinator .getCardfileList(CARDFILE.CHP_OFFICES); stateAgenciesFacilitiesList = ScreenManager.theCoordinator .getCardfileList(CARDFILE.STATE_AGENCIES_FACILITIES); governmentOfficialsList = ScreenManager.theCoordinator .getCardfileList(CARDFILE.GOVERNMENT_OFFICIALS); federalAgenciesList = ScreenManager.theCoordinator .getCardfileList(CARDFILE.FEDERAL_AGENCIES); ranchesLivestockList = ScreenManager.theCoordinator .getCardfileList(CARDFILE.RANCHES_LIVESTOCK); fireEmsList = ScreenManager.theCoordinator .getCardfileList(CARDFILE.FIRE_EMS); jailsList = ScreenManager.theCoordinator .getCardfileList(CARDFILE.JAILS); hospitalsMedCentersList = ScreenManager.theCoordinator .getCardfileList(CARDFILE.HOSPITALS_MED_CENTERS); towCompaniesList = ScreenManager.theCoordinator .getCardfileList(CARDFILE.TOW_COMPANIES); calTransList = ScreenManager.theCoordinator .getCardfileList(CARDFILE.CALTRANS); countyRoadsList = ScreenManager.theCoordinator .getCardfileList(CARDFILE.COUNTY_ROADS); utilitiesList = ScreenManager.theCoordinator .getCardfileList(CARDFILE.UTILITIES); animalControlList = ScreenManager.theCoordinator .getCardfileList(CARDFILE.ANIMAL_CONTROL); airportsList = ScreenManager.theCoordinator .getCardfileList(CARDFILE.AIRPORTS); creditCardsList = ScreenManager.theCoordinator .getCardfileList(CARDFILE.CREDIT_CARDS); ggCrisisSheltersList = ScreenManager.theCoordinator .getCardfileList(CARDFILE.GG_CRISIS_SHELTERS); rangesList = ScreenManager.theCoordinator .getCardfileList(CARDFILE.RANGES); hotlinesList = ScreenManager.theCoordinator .getCardfileList(CARDFILE.HOTLINES); hwyPatrolsOosList = ScreenManager.theCoordinator .getCardfileList(CARDFILE.HWY_PATROLS_OOS); parksRecreationList = ScreenManager.theCoordinator .getCardfileList(CARDFILE.PARKS_RECREATION); sheltersList = ScreenManager.theCoordinator .getCardfileList(CARDFILE.SHELTERS); slCountyServicesList = ScreenManager.theCoordinator .getCardfileList(CARDFILE.SL_COUNTY_SERVICES); slResourcesList = ScreenManager.theCoordinator .getCardfileList(CARDFILE.SL_RESOURCES); truckTireRepairList = ScreenManager.theCoordinator .getCardfileList(CARDFILE.TRUCK_TIRE_REPAIR); mccEmployeesList = ScreenManager.theCoordinator .getCardfileList(CARDFILE.MCC_EMPLOYEES); gateAccessCodesList = ScreenManager.theCoordinator .getCardfileList(CARDFILE.GATE_ACCESS_CODES); vtCallSignsList = ScreenManager.theCoordinator .getCardfileList(CARDFILE.VT_CALL_SIGNS); slccEmployeesList = ScreenManager.theCoordinator .getCardfileList(CARDFILE.SLCC_EMPLOYEES); } catch (RemoteException e) { e.printStackTrace(); } } /* * Puts the lists into the scrollpanes into the tabbedpane screens. */ public void loadJLists() { coastalDivisionUnitsPane.removeAll(); coastalDivisionUnitsPane.add(createPane(coastalDivisionUnitsList)); policeSheriffCoronerPane.removeAll(); policeSheriffCoronerPane.add(createPane(policeSheriffCoronerList)); courtsPane.removeAll(); courtsPane.add(createPane(courtsList)); publicTransportationPane.removeAll(); publicTransportationPane.add(createPane(publicTransportationList)); ggOtherPane.removeAll(); ggOtherPane.add(createPane(ggOtherList)); myMiscPane.removeAll(); myMiscPane.add(createPane(myMiscList)); slMiscPane.removeAll(); slMiscPane.add(createPane(slMiscList)); vtMiscPane.removeAll(); vtMiscPane.add(createPane(vtMiscList)); chpOfficesPane.removeAll(); chpOfficesPane.add(createPane(chpOfficesList)); stateAgenciesFacilitiesPane.removeAll(); stateAgenciesFacilitiesPane .add(createPane(stateAgenciesFacilitiesList)); governmentOfficialsPane.removeAll(); governmentOfficialsPane.add(createPane(governmentOfficialsList)); federalAgenciesPane.removeAll(); federalAgenciesPane.add(createPane(federalAgenciesList)); ranchesLivestockPane.removeAll(); ranchesLivestockPane.add(createPane(ranchesLivestockList)); fireEmsPane.removeAll(); fireEmsPane.add(createPane(fireEmsList)); jailsPane.removeAll(); jailsPane.add(createPane(jailsList)); hospitalsMedCentersPane.removeAll(); hospitalsMedCentersPane.add(createPane(hospitalsMedCentersList)); towCompaniesPane.removeAll(); towCompaniesPane.add(createPane(towCompaniesList)); calTransPane.removeAll(); calTransPane.add(createPane(calTransList)); countyRoadsPane.removeAll(); countyRoadsPane.add(createPane(countyRoadsList)); utilitiesPane.removeAll(); utilitiesPane.add(createPane(utilitiesList)); animalControlPane.removeAll(); animalControlPane.add(createPane(animalControlList)); airportsPane.removeAll(); airportsPane.add(createPane(airportsList)); creditCardsPane.removeAll(); creditCardsPane.add(createPane(creditCardsList)); ggCrisisSheltersPane.removeAll(); ggCrisisSheltersPane.add(createPane(ggCrisisSheltersList)); rangesPane.removeAll(); rangesPane.add(createPane(rangesList)); hotlinesPane.removeAll(); hotlinesPane.add(createPane(hotlinesList)); hwyPatrolsOosPane.removeAll(); hwyPatrolsOosPane.add(createPane(hwyPatrolsOosList)); parksRecreationPane.removeAll(); parksRecreationPane.add(createPane(parksRecreationList)); sheltersPane.removeAll(); sheltersPane.add(createPane(sheltersList)); slCountyServicesPane.removeAll(); slCountyServicesPane.add(createPane(slCountyServicesList)); slResourcesPane.removeAll(); slResourcesPane.add(createPane(slResourcesList)); truckTireRepairPane.removeAll(); truckTireRepairPane.add(createPane(truckTireRepairList)); mccEmployeesPane.removeAll(); mccEmployeesPane.add(createPane(mccEmployeesList)); gateAccessCodesPane.removeAll(); gateAccessCodesPane.add(createPane(gateAccessCodesList)); vtCallSignsPane.removeAll(); vtCallSignsPane.add(createPane(vtCallSignsList)); slccEmployeesPane.removeAll(); slccEmployeesPane.add(createPane(slccEmployeesList)); } /* * Adds a list the scrollpane with mouse listeners. */ private JScrollPane createPane(List list) { list.addMouseListener(mouseListener); JScrollPane pane = new JScrollPane(list); pane.setPreferredSize(new Dimension(200, 250)); pane.setMaximumSize(new Dimension(200, 250)); pane.setMinimumSize(new Dimension(200, 250)); return pane; } /* * Checks which panel is currently in view based on the title, then gets the * corresponding list and selected index to obtain the last clicked object. */ public CardfileDataObject getSelectedCardfileDataObject(String title) { if (title == CARDFILE.COASTAL_DIVISION_UNITS.tag) { selectedList = coastalDivisionUnitsList; return coastalDivisionUnitsList.getCFDO(coastalDivisionUnitsList .getSelectedIndex()); } else if (title == CARDFILE.POLICE_SHERIFF_CORONER.tag) { selectedList = policeSheriffCoronerList; return policeSheriffCoronerList.getCFDO(policeSheriffCoronerList .getSelectedIndex()); } else if (title == CARDFILE.COURTS.tag) { selectedList = courtsList; return courtsList.getCFDO(courtsList.getSelectedIndex()); } else if (title == CARDFILE.PUBLIC_TRANSPORTATION.tag) { selectedList = publicTransportationList; return publicTransportationList.getCFDO(publicTransportationList .getSelectedIndex()); } else if (title == CARDFILE.GG_OTHER.tag) { selectedList = ggOtherList; return ggOtherList.getCFDO(ggOtherList.getSelectedIndex()); } else if (title == CARDFILE.MY_MISC.tag) { selectedList = myMiscList; return myMiscList.getCFDO(myMiscList.getSelectedIndex()); } else if (title == CARDFILE.SL_MISC.tag) { selectedList = slMiscList; return slMiscList.getCFDO(slMiscList.getSelectedIndex()); } else if (title == CARDFILE.VT_MISC.tag) { selectedList = vtMiscList; return vtMiscList.getCFDO(vtMiscList.getSelectedIndex()); } else if (title == CARDFILE.CHP_OFFICES.tag) { selectedList = chpOfficesList; return chpOfficesList.getCFDO(chpOfficesList.getSelectedIndex()); } else if (title == CARDFILE.STATE_AGENCIES_FACILITIES.tag) { selectedList = stateAgenciesFacilitiesList; return stateAgenciesFacilitiesList .getCFDO(stateAgenciesFacilitiesList.getSelectedIndex()); } else if (title == CARDFILE.GOVERNMENT_OFFICIALS.tag) { selectedList = governmentOfficialsList; return governmentOfficialsList.getCFDO(governmentOfficialsList .getSelectedIndex()); } else if (title == CARDFILE.FEDERAL_AGENCIES.tag) { selectedList = federalAgenciesList; return federalAgenciesList.getCFDO(federalAgenciesList .getSelectedIndex()); } else if (title == CARDFILE.RANCHES_LIVESTOCK.tag) { selectedList = ranchesLivestockList; return ranchesLivestockList.getCFDO(ranchesLivestockList .getSelectedIndex()); } else if (title == CARDFILE.FIRE_EMS.tag) { selectedList = fireEmsList; return fireEmsList.getCFDO(fireEmsList.getSelectedIndex()); } else if (title == CARDFILE.JAILS.tag) { selectedList = jailsList; return jailsList.getCFDO(jailsList.getSelectedIndex()); } else if (title == CARDFILE.HOSPITALS_MED_CENTERS.tag) { selectedList = hospitalsMedCentersList; return hospitalsMedCentersList.getCFDO(hospitalsMedCentersList .getSelectedIndex()); } else if (title == CARDFILE.TOW_COMPANIES.tag) { selectedList = towCompaniesList; return towCompaniesList .getCFDO(towCompaniesList.getSelectedIndex()); } else if (title == CARDFILE.CALTRANS.tag) { selectedList = calTransList; return calTransList.getCFDO(calTransList.getSelectedIndex()); } else if (title == CARDFILE.COUNTY_ROADS.tag) { selectedList = countyRoadsList; return countyRoadsList.getCFDO(countyRoadsList.getSelectedIndex()); } else if (title == CARDFILE.UTILITIES.tag) { selectedList = utilitiesList; return utilitiesList.getCFDO(utilitiesList.getSelectedIndex()); } else if (title == CARDFILE.ANIMAL_CONTROL.tag) { selectedList = animalControlList; return animalControlList.getCFDO(animalControlList .getSelectedIndex()); } else if (title == CARDFILE.AIRPORTS.tag) { selectedList = airportsList; return airportsList.getCFDO(airportsList.getSelectedIndex()); } else if (title == CARDFILE.CREDIT_CARDS.tag) { selectedList = creditCardsList; return creditCardsList.getCFDO(creditCardsList.getSelectedIndex()); } else if (title == CARDFILE.GG_CRISIS_SHELTERS.tag) { selectedList = ggCrisisSheltersList; return ggCrisisSheltersList.getCFDO(ggCrisisSheltersList .getSelectedIndex()); } else if (title == CARDFILE.RANGES.tag) { selectedList = rangesList; return rangesList.getCFDO(rangesList.getSelectedIndex()); } else if (title == CARDFILE.HOTLINES.tag) { selectedList = hotlinesList; return hotlinesList.getCFDO(hotlinesList.getSelectedIndex()); } else if (title == CARDFILE.HWY_PATROLS_OOS.tag) { selectedList = hwyPatrolsOosList; return hwyPatrolsOosList.getCFDO(hwyPatrolsOosList .getSelectedIndex()); } else if (title == CARDFILE.PARKS_RECREATION.tag) { selectedList = parksRecreationList; return parksRecreationList.getCFDO(parksRecreationList .getSelectedIndex()); } else if (title == CARDFILE.SHELTERS.tag) { selectedList = sheltersList; return sheltersList.getCFDO(sheltersList.getSelectedIndex()); } else if (title == CARDFILE.SL_COUNTY_SERVICES.tag) { selectedList = slCountyServicesList; return slCountyServicesList.getCFDO(slCountyServicesList .getSelectedIndex()); } else if (title == CARDFILE.SL_RESOURCES.tag) { selectedList = slResourcesList; return slResourcesList.getCFDO(slResourcesList.getSelectedIndex()); } else if (title == CARDFILE.TRUCK_TIRE_REPAIR.tag) { selectedList = truckTireRepairList; return truckTireRepairList.getCFDO(truckTireRepairList .getSelectedIndex()); } else if (title == CARDFILE.MCC_EMPLOYEES.tag) { selectedList = mccEmployeesList; return mccEmployeesList .getCFDO(mccEmployeesList.getSelectedIndex()); } else if (title == CARDFILE.GATE_ACCESS_CODES.tag) { selectedList = gateAccessCodesList; return gateAccessCodesList.getCFDO(gateAccessCodesList .getSelectedIndex()); } else if (title == CARDFILE.VT_CALL_SIGNS.tag) { selectedList = vtCallSignsList; return vtCallSignsList.getCFDO(vtCallSignsList.getSelectedIndex()); } else if (title == CARDFILE.SLCC_EMPLOYEES.tag) { selectedList = slccEmployeesList; return slccEmployeesList.getCFDO(slccEmployeesList .getSelectedIndex()); } try { throw new Exception(); } catch (Exception e) { e.printStackTrace(); } return null; } /* * Gets the last clicked object and loads its data. */ public void refreshInformation() { currObject = getSelectedCardfileDataObject(cardfileTabs .getTitleAt(cardfileTabs.getSelectedIndex())); if (currObject != null) { nameField.setText((currName = currObject.getName())); addressField.setText((currAddress = currObject.getAddress())); cityField.setText((currCity = currObject.getCity())); faxField.setText((currFax = currObject.getFax())); phone1Field.setText((currPhone1 = currObject.getPhone1())); phone2Field.setText((currPhone2 = currObject.getPhone2())); stateField.setText((currState = currObject.getState())); zipField.setText((currZip = currObject.getZip())); DefaultTableModel model = (DefaultTableModel) commentsTable .getModel(); int size = model.getRowCount(); for (int i = 0; i < size; i++) { model.removeRow(0); } LinkedList tableFields = currObject .getCommentsTableFields(); for (int i = 0; i < tableFields.size(); i++) { model.addRow(tableFields.get(i)); } currId = currObject.getId(); addCommentButton.setEnabled(true); cancelButton.setEnabled(true); deleteButton.setEnabled(true); } else { addCommentButton.setEnabled(false); cancelButton.setEnabled(true); deleteButton.setEnabled(false); } } /* * Checks to make sure that the textFields are not still blank and that an * object from the list has been selected already. Compares the last known * value of each field to the current value to see if any changes have been * made. If changes have been made, the change is applied to the local data * but is not sent over to the server until the user exits the screen and * commits the changes. */ public void saveInformation() { if (saveFields && currObject != null) { if (!currName.equals(nameField.getText())) { currObject.setName(nameField.getText()); selectedList.resort(selectedList.getSelectedIndex()); cardfileObjectEdits .add(new ChangeLog(EditCommand.NAME, cardfileTabs .getTitleAt(cardfileTabs.getSelectedIndex()), currId, nameField.getText())); changesMade = true; } if (!currAddress.equals(addressField.getText())) { currObject.setAddress(addressField.getText()); cardfileObjectEdits .add(new ChangeLog(EditCommand.ADDRESS, cardfileTabs .getTitleAt(cardfileTabs.getSelectedIndex()), currId, addressField.getText())); changesMade = true; } if (!currCity.equals(cityField.getText())) { currObject.setCity(cityField.getText()); cardfileObjectEdits .add(new ChangeLog(EditCommand.CITY, cardfileTabs .getTitleAt(cardfileTabs.getSelectedIndex()), currId, cityField.getText())); changesMade = true; } if (!currFax.equals(faxField.getText())) { currObject.setFax(faxField.getText()); cardfileObjectEdits .add(new ChangeLog(EditCommand.FAX, cardfileTabs .getTitleAt(cardfileTabs.getSelectedIndex()), currId, faxField.getText())); changesMade = true; } if (!currPhone1.equals(phone1Field.getText())) { currObject.setPhone1(phone1Field.getText()); cardfileObjectEdits .add(new ChangeLog(EditCommand.PHONE1, cardfileTabs .getTitleAt(cardfileTabs.getSelectedIndex()), currId, phone1Field.getText())); changesMade = true; } if (!currPhone2.equals(phone2Field.getText())) { currObject.setPhone2(phone2Field.getText()); cardfileObjectEdits .add(new ChangeLog(EditCommand.PHONE2, cardfileTabs .getTitleAt(cardfileTabs.getSelectedIndex()), currId, phone2Field.getText())); changesMade = true; } if (!currState.equals(stateField.getText())) { currObject.setState(stateField.getText()); cardfileObjectEdits .add(new ChangeLog(EditCommand.STATE, cardfileTabs .getTitleAt(cardfileTabs.getSelectedIndex()), currId, stateField.getText())); changesMade = true; } if (!currZip.equals(zipField.getText())) { currObject.setZip(zipField.getText()); cardfileObjectEdits .add(new ChangeLog(EditCommand.ZIP, cardfileTabs .getTitleAt(cardfileTabs.getSelectedIndex()), currId, zipField.getText())); changesMade = true; } } if (currObject != null) { saveFields = true; } } /* * Makes screen visible. Loads the server cardfile database into the local * database. Clears all editLogs and changes. Sets all text to empty values. * Greys out all buttons. */ public void open() { if (isVisible()) { requestFocus(); } else { loadData(); loadJLists(); cardfileTabs.setSelectedIndex(0); selectedList = coastalDivisionUnitsList; saveFields = false; changesMade = false; cardfileObjectEdits.clear(); cardfileObjectDeletes.clear(); cardfileObjectAdds.clear(); tableDeletes.clear(); tableAdds.clear(); nameField.setText(""); addressField.setText(""); cityField.setText(""); stateField.setText(""); zipField.setText(""); phone1Field.setText(""); phone2Field.setText(""); faxField.setText(""); commentsTable.setModel(new javax.swing.table.DefaultTableModel( null, new String[] { "Date", "Time", "Initials", "Comments" })); addButton.setEnabled(true); deleteButton.setEnabled(false); saveButton.setEnabled(false); cancelButton.setEnabled(false); addCommentButton.setEnabled(false); deleteCommentButton.setEnabled(false); saveCommentButton.setEnabled(false); cancelCommentButton.setEnabled(false); setVisible(true); } } /* * Hides screen. If changes have been made, prompt the user if (s)he wants * to commit changes to the server data. */ public void close() { saveInformation(); if (changesMade) { JOptionPane optionPane = new JOptionPane(); if (optionPane.showConfirmDialog(this, "Changes have been made. Do you want to save changes?", "Yes/No", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) { handleChangeLogEdits(tableAdds); handleChangeLogEdits(tableDeletes); handleChangeLogEdits(cardfileObjectAdds); handleChangeLogEdits(cardfileObjectEdits); handleChangeLogEdits(cardfileObjectDeletes); } } setVisible(false); } /* * Loops through the list and sends every ChangeLog to the server. */ private void handleChangeLogEdits(LinkedList list) { for (int i = 0; i < list.size(); i++) { try { ScreenManager.theCoordinator.editCardfile(list.get(i)); } catch (RemoteException e) { e.printStackTrace(); } } } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton addButton; private javax.swing.JButton addCommentButton; private javax.swing.JTextField addressField; private javax.swing.JLabel addressLabel; private javax.swing.JPanel airportsPane; private javax.swing.JPanel animalControlPane; private javax.swing.JPanel calTransPane; private javax.swing.JButton cancelButton; private javax.swing.JButton cancelCommentButton; private javax.swing.JTabbedPane cardfileTabs; private javax.swing.JPanel chpOfficesPane; private javax.swing.JTextField cityField; private javax.swing.JLabel cityLabel; private javax.swing.JPanel coastalDivisionUnitsPane; private javax.swing.JTextPane commentsField; private javax.swing.JLabel commentsLabel; private javax.swing.JTable commentsTable; private javax.swing.JPanel countyRoadsPane; private javax.swing.JPanel courtsPane; private javax.swing.JPanel creditCardsPane; private javax.swing.JButton deleteButton; private javax.swing.JButton deleteCommentButton; private javax.swing.JButton exitButton; private javax.swing.JTextField faxField; private javax.swing.JLabel faxLabel; private javax.swing.JPanel federalAgenciesPane; private javax.swing.JPanel fireEmsPane; private javax.swing.JPanel gateAccessCodesPane; private javax.swing.JPanel ggCrisisSheltersPane; private javax.swing.JPanel ggOtherPane; private javax.swing.JPanel governmentOfficialsPane; private javax.swing.JPanel hospitalsMedCentersPane; private javax.swing.JPanel hotlinesPane; private javax.swing.JPanel hwyPatrolsOosPane; private javax.swing.JPanel vtCallSignsPane; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JPanel jailsPane; private javax.swing.JPanel mccEmployeesPane; private javax.swing.JPanel myMiscPane; private javax.swing.JTextField nameField; private javax.swing.JLabel nameLabel; private javax.swing.JPanel parksRecreationPane; private javax.swing.JTextField phone1Field; private javax.swing.JLabel phone1Label; private javax.swing.JTextField phone2Field; private javax.swing.JLabel phone2Label; private javax.swing.JPanel policeSheriffCoronerPane; private javax.swing.JButton printButton; private javax.swing.JPanel publicTransportationPane; private javax.swing.JPanel ranchesLivestockPane; private javax.swing.JPanel rangesPane; private javax.swing.JButton saveButton; private javax.swing.JButton saveCommentButton; private javax.swing.JPanel sheltersPane; private javax.swing.JPanel slCountyServicesPane; private javax.swing.JPanel slMiscPane; private javax.swing.JPanel slResourcesPane; private javax.swing.JPanel slccEmployeesPane; private javax.swing.JPanel stateAgenciesFacilitiesPane; private javax.swing.JTextField stateField; private javax.swing.JLabel stateLabel; private javax.swing.JPanel towCompaniesPane; private javax.swing.JPanel truckTireRepairPane; private javax.swing.JPanel utilitiesPane; private javax.swing.JPanel vtMiscPane; private javax.swing.JTextField zipField; private javax.swing.JLabel zipLabel; // End of variables declaration//GEN-END:variables }