/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ims.GUIInterface;
import ims.service.ServiceInsertEquipment;
import ims.sqlClasses.*;
import java.util.HashMap;
import java.util.Map;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.WindowConstants;
/**
*
* @author deleepa
*/
public class GUIInsertNew extends javax.swing.JFrame {
//private TAsset asset;
private TCpu cpu;
private TGpu gpu;
private THdd hdd;
private TMaintenance maintenance;
private TMonitor monitor;
private TOs os;
private TPcClass pcClass;
//private TPcMain pcMain;
private TPurchase purchase;
private TRam ram;
private TUser user;
private TVendor vendor;
private TPeripherals peripheral;
public GUIInsertNew() {
initComponents();
initBeans();
}
private void initBeans(){
//asset = new TAsset();
//TBody body = new TBody();
cpu = new TCpu();
//TDept department = new TDept();
gpu = new TGpu();
hdd = new THdd();
maintenance = new TMaintenance();
//TMboard motherboard = new TMboard();
//TModel model = new TModel();
monitor = new TMonitor();
os = new TOs();
pcClass = new TPcClass();
//pcMain = new TPcMain();
peripheral = new TPeripherals();
purchase = new TPurchase();
ram = new TRam();
user = new TUser();
vendor = new TVendor();
}
/**
* 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")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
mainPanel = new javax.swing.JPanel();
typeOfEquipmentLabel = new javax.swing.JLabel();
typeOfEquipmentInput = new javax.swing.JComboBox();
userNameLabel = new javax.swing.JLabel();
userNameInput = new javax.swing.JTextField();
staffIDLabel = new javax.swing.JLabel();
staffIDInput = new javax.swing.JTextField();
jSeparator1 = new javax.swing.JSeparator();
jSeparator2 = new javax.swing.JSeparator();
jTabbedPane1 = new javax.swing.JTabbedPane();
jScrollPane1 = new javax.swing.JScrollPane();
jPanel2 = new javax.swing.JPanel();
cpuBrandLabel = new javax.swing.JLabel();
cpuBrandInput = new javax.swing.JTextField();
cpuSpeedLabel = new javax.swing.JLabel();
cpuSpeedInput = new javax.swing.JTextField();
ramLabel = new javax.swing.JLabel();
ramBrandInput = new javax.swing.JTextField();
gpuLabel = new javax.swing.JLabel();
gpuBrandInput = new javax.swing.JTextField();
hddLabel = new javax.swing.JLabel();
hddBrandInput = new javax.swing.JTextField();
ramCapacityCombo = new javax.swing.JComboBox();
ramTypeCombo = new javax.swing.JComboBox();
ramCountCombo = new javax.swing.JComboBox();
gpuCapacity = new javax.swing.JComboBox();
gpuTypeCombo = new javax.swing.JComboBox();
hddCapacityCombo = new javax.swing.JComboBox();
jScrollPane2 = new javax.swing.JScrollPane();
jPanel3 = new javax.swing.JPanel();
monitorLabel = new javax.swing.JLabel();
monitorBrandInput = new javax.swing.JTextField();
monitorSizeCombo = new javax.swing.JComboBox();
peripheralSerialNumberInput = new javax.swing.JTextField();
peripheralsLabel = new javax.swing.JLabel();
peripheralsType = new javax.swing.JComboBox();
jScrollPane7 = new javax.swing.JScrollPane();
peripheralDescriptionInput = new javax.swing.JTextArea();
peripheralDescriptionLabel = new javax.swing.JLabel();
monitorSerialNumberInput1 = new javax.swing.JTextField();
jScrollPane3 = new javax.swing.JScrollPane();
jPanel4 = new javax.swing.JPanel();
technicianLabel = new javax.swing.JLabel();
maintainenceLogDateLabel = new javax.swing.JLabel();
logDetailsLabel = new javax.swing.JLabel();
jScrollPane4 = new javax.swing.JScrollPane();
logDetailsInput = new javax.swing.JTextArea();
technicianNameInput = new javax.swing.JTextField();
maintainenceLogDateInput = new javax.swing.JTextField();
jScrollPane5 = new javax.swing.JScrollPane();
jPanel5 = new javax.swing.JPanel();
vendorNameLabel = new javax.swing.JLabel();
vendorPhoneLabel = new javax.swing.JLabel();
vendorAddressLabel = new javax.swing.JLabel();
vendorNameInput = new javax.swing.JTextField();
vendorPhoneInput = new javax.swing.JTextField();
jScrollPane6 = new javax.swing.JScrollPane();
vendorAddressInput = new javax.swing.JTextArea();
invoiceNumberLabel = new javax.swing.JLabel();
invoiceNumberInput = new javax.swing.JTextField();
jScrollPane8 = new javax.swing.JScrollPane();
jPanel6 = new javax.swing.JPanel();
osNameLabel = new javax.swing.JLabel();
osVersionInput = new javax.swing.JTextField();
osVersionLabel = new javax.swing.JLabel();
osNameInput = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jLabel7 = new javax.swing.JLabel();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
jMenuItem1 = new javax.swing.JMenuItem();
jMenu2 = new javax.swing.JMenu();
updateItem = new javax.swing.JMenuItem();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
mainPanel.setPreferredSize(new java.awt.Dimension(600, 600));
typeOfEquipmentLabel.setText("Type of Equipment");
typeOfEquipmentInput.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Server", "Laptop", "Desktop PC" }));
userNameLabel.setText("User");
staffIDLabel.setText("Staff ID");
cpuBrandLabel.setText("CPU Brand");
cpuBrandInput.setPreferredSize(new java.awt.Dimension(90, 28));
cpuSpeedLabel.setText("CPU Speed");
cpuSpeedInput.setPreferredSize(new java.awt.Dimension(90, 28));
cpuSpeedInput.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cpuSpeedInputActionPerformed(evt);
}
});
ramLabel.setText("R.A.M.");
ramBrandInput.setPreferredSize(new java.awt.Dimension(90, 28));
gpuLabel.setText("G.P.U.");
gpuBrandInput.setPreferredSize(new java.awt.Dimension(90, 28));
hddLabel.setText("H.D.D.");
hddBrandInput.setPreferredSize(new java.awt.Dimension(90, 28));
ramCapacityCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Capacity:", "< 1GB", "1 GB", "2 GB", "3 GB", "4 GB", "6 GB" }));
ramTypeCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Type:", "DDR2", "DDR3" }));
ramCountCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Count:", "1", "2", "3", "4" }));
gpuCapacity.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Capacity:", "< 1GB", "1 GB", "2 GB", "3 GB", "4 GB" }));
gpuTypeCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Type:", "On-board", "Dedicated", "External" }));
hddCapacityCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Capacity:", "< 120 GB", "320 GB", "500 GB", "1 TB", "1.5 TB", "2 TB" }));
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(cpuBrandLabel)
.addComponent(cpuSpeedLabel)
.addComponent(ramLabel)
.addComponent(gpuLabel)
.addComponent(hddLabel))
.addGap(31, 31, 31)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(hddBrandInput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(hddCapacityCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(gpuBrandInput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(gpuCapacity, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(gpuTypeCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(cpuSpeedInput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cpuBrandInput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(ramBrandInput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(ramCapacityCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(ramTypeCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(ramCountCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(0, 0, 0))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(16, 16, 16)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cpuBrandLabel)
.addComponent(cpuBrandInput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(11, 11, 11)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cpuSpeedLabel)
.addComponent(cpuSpeedInput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(6, 6, 6)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(ramLabel)
.addComponent(ramBrandInput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(ramCapacityCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(ramTypeCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(ramCountCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(gpuBrandInput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(gpuLabel)
.addComponent(gpuCapacity, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(gpuTypeCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(11, 11, 11)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(hddLabel)
.addComponent(hddBrandInput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(hddCapacityCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(17, 17, 17))
);
jScrollPane1.setViewportView(jPanel2);
jTabbedPane1.addTab("Internal", jScrollPane1);
monitorLabel.setText("Monitor");
monitorBrandInput.setPreferredSize(new java.awt.Dimension(90, 28));
monitorSizeCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Size:", "11 inch", "14 inch", "17 inch", "21 inch" }));
peripheralsLabel.setText("Other peripherals:");
peripheralsType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Type:", "Keyboard", "Mouse", "Other" }));
peripheralDescriptionInput.setColumns(20);
peripheralDescriptionInput.setRows(5);
jScrollPane7.setViewportView(peripheralDescriptionInput);
peripheralDescriptionLabel.setText("Description");
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane7, javax.swing.GroupLayout.DEFAULT_SIZE, 557, Short.MAX_VALUE)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(monitorLabel)
.addGap(49, 49, 49)
.addComponent(monitorBrandInput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(peripheralsLabel)
.addGap(18, 18, 18)
.addComponent(peripheralsType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(monitorSerialNumberInput1, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(peripheralSerialNumberInput, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGap(18, 18, 18)
.addComponent(monitorSizeCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE)))
.addComponent(peripheralDescriptionLabel)))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(18, 18, 18)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(monitorLabel)
.addComponent(monitorBrandInput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(22, 22, 22)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(peripheralsLabel)
.addComponent(peripheralsType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(peripheralSerialNumberInput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(monitorSerialNumberInput1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(monitorSizeCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(18, 18, 18)
.addComponent(peripheralDescriptionLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
jScrollPane2.setViewportView(jPanel3);
jTabbedPane1.addTab("External", jScrollPane2);
technicianLabel.setText("Technician");
maintainenceLogDateLabel.setText("Date");
logDetailsLabel.setText("Log Details");
logDetailsInput.setColumns(20);
logDetailsInput.setRows(5);
jScrollPane4.setViewportView(logDetailsInput);
technicianNameInput.setPreferredSize(new java.awt.Dimension(90, 28));
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 330, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(logDetailsLabel)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(technicianLabel)
.addComponent(maintainenceLogDateLabel))
.addGap(32, 32, 32)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(maintainenceLogDateInput)
.addComponent(technicianNameInput, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addGap(0, 0, 0))
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(5, 5, 5)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(technicianNameInput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(technicianLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(maintainenceLogDateLabel)
.addComponent(maintainenceLogDateInput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(logDetailsLabel)
.addGap(18, 18, 18)
.addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
jScrollPane3.setViewportView(jPanel4);
jTabbedPane1.addTab("Maintainence", jScrollPane3);
vendorNameLabel.setText("Name");
vendorPhoneLabel.setText("Phone");
vendorAddressLabel.setText("Address");
vendorAddressInput.setColumns(20);
vendorAddressInput.setRows(5);
jScrollPane6.setViewportView(vendorAddressInput);
invoiceNumberLabel.setText("Invoice Number");
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(vendorAddressLabel)
.addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 322, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel5Layout.createSequentialGroup()
.addComponent(vendorPhoneLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 63, Short.MAX_VALUE)
.addComponent(vendorPhoneInput, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel5Layout.createSequentialGroup()
.addComponent(vendorNameLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(vendorNameInput, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel5Layout.createSequentialGroup()
.addComponent(invoiceNumberLabel)
.addGap(18, 18, 18)
.addComponent(invoiceNumberInput, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE))))
);
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(10, 10, 10)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(invoiceNumberInput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(invoiceNumberLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(vendorNameInput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(vendorNameLabel))
.addGap(18, 18, 18)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(vendorPhoneInput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(vendorPhoneLabel))
.addGap(26, 26, 26)
.addComponent(vendorAddressLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(27, 27, 27))
);
jScrollPane5.setViewportView(jPanel5);
jTabbedPane1.addTab("Vendor", jScrollPane5);
osNameLabel.setText("OS Name");
osVersionLabel.setText("OS Version");
osNameInput.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
osNameInputActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
jPanel6.setLayout(jPanel6Layout);
jPanel6Layout.setHorizontalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(osNameLabel)
.addComponent(osVersionLabel))
.addGap(34, 34, 34)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(osNameInput, javax.swing.GroupLayout.DEFAULT_SIZE, 90, Short.MAX_VALUE)
.addComponent(osVersionInput))
.addGap(0, 0, 0))
);
jPanel6Layout.setVerticalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addGap(21, 21, 21)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(osNameLabel)
.addComponent(osVersionInput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(osVersionLabel)
.addComponent(osNameInput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 0, 0))
);
jScrollPane8.setViewportView(jPanel6);
jTabbedPane1.addTab("Software", jScrollPane8);
jButton1.setText("Submit");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
submitButtonClicked(evt);
}
});
jButton2.setText("Cancel");
jLabel7.setText("Status: ");
javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
mainPanel.setLayout(mainPanelLayout);
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(mainPanelLayout.createSequentialGroup()
.addComponent(jLabel7)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(mainPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSeparator2, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(mainPanelLayout.createSequentialGroup()
.addGap(6, 6, 6)
.addComponent(jTabbedPane1))
.addGroup(mainPanelLayout.createSequentialGroup()
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(mainPanelLayout.createSequentialGroup()
.addComponent(jButton1)
.addGap(39, 39, 39)
.addComponent(jButton2))
.addGroup(mainPanelLayout.createSequentialGroup()
.addComponent(typeOfEquipmentLabel)
.addGap(18, 18, 18)
.addComponent(typeOfEquipmentInput, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(mainPanelLayout.createSequentialGroup()
.addComponent(userNameLabel)
.addGap(45, 45, 45)
.addComponent(userNameInput, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(mainPanelLayout.createSequentialGroup()
.addComponent(staffIDLabel)
.addGap(26, 26, 26)
.addComponent(staffIDInput, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(mainPanelLayout.createSequentialGroup()
.addGap(18, 18, 18)
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(typeOfEquipmentLabel)
.addComponent(typeOfEquipmentInput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(userNameLabel)
.addComponent(userNameInput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(staffIDLabel)
.addComponent(staffIDInput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 312, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1)
.addComponent(jButton2))
.addGap(18, 18, 18)
.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(58, Short.MAX_VALUE))
);
jMenu1.setText("File");
jMenuItem1.setText("Exit");
jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem1ActionPerformed(evt);
}
});
jMenu1.add(jMenuItem1);
jMenuBar1.add(jMenu1);
jMenu2.setText("Edit");
updateItem.setText("Update/Delete Record");
updateItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
updateItemActionPerformed(evt);
}
});
jMenu2.add(updateItem);
jMenuBar1.add(jMenu2);
setJMenuBar(jMenuBar1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(mainPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(mainPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 570, javax.swing.GroupLayout.PREFERRED_SIZE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void submitButtonClicked(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_submitButtonClicked
user.setUserName(userNameInput.getText());
user.setStaffId(staffIDInput.getText());
if("".equals(userNameInput.getText()) && "".equals(staffIDInput.getText()) ){
JOptionPane.showMessageDialog(null,"Fill up some important fields!");
}
else{
pcClass.setClassName(typeOfEquipmentInput.getSelectedItem().toString());
cpu.setCpuBrand(cpuBrandInput.getText());
cpu.setSpeed(cpuSpeedInput.getText());
ram.setBrand(ramBrandInput.getText());
ram.setRamCapacity(ramCapacityCombo.getSelectedItem().toString());
ram.setRamType(ramTypeCombo.getSelectedItem().toString());
ram.setCount(ramCountCombo.getSelectedItem().toString());
gpu.setGpuBrand(gpuBrandInput.getText());
gpu.setGpuRam(gpuCapacity.getSelectedItem().toString());
gpu.setGpuType(gpuTypeCombo.getSelectedItem().toString());
hdd.setHddBrand(hddBrandInput.getText());
hdd.setHddCapacity(hddCapacityCombo.getSelectedItem().toString());
monitor.setBrandName(monitorBrandInput.getText());
monitor.setMonSerialNo(peripheralSerialNumberInput.getText());
monitor.setSize(monitorSizeCombo.getSelectedItem().toString());
peripheral.setType(peripheralsType.getSelectedItem().toString());
peripheral.setPerSerialNo(peripheralSerialNumberInput.getText());
peripheral.setDesc(peripheralDescriptionInput.getText());
maintenance.setTechnician(technicianNameInput.getText());
maintenance.setDate(maintainenceLogDateInput.getText());
maintenance.setDescription(logDetailsInput.getText());
vendor.setVendorName(vendorNameInput.getText());
vendor.setInvoiceNo(invoiceNumberInput.getText());
vendor.setContactNo(vendorPhoneInput.getText());
vendor.setAddress(vendorAddressInput.getText());
os.setOsName(osNameInput.getText());
os.setOsVersion(osVersionInput.getText());
Map beansMap = new HashMap<String, Object>();
beansMap.put("cpu", cpu);
beansMap.put("gpu", gpu);
beansMap.put("hdd", hdd);
beansMap.put("maintenance", maintenance);
beansMap.put("monitor", monitor);
beansMap.put("os", os);
beansMap.put("pcClass", pcClass);
//beansMap.put("pcMain", pcMain);
beansMap.put("peripheral", peripheral);
beansMap.put("purchase", purchase);
beansMap.put("ram", ram);
beansMap.put("user", user);
beansMap.put("vendor", vendor);
ServiceInsertEquipment service = new ServiceInsertEquipment();
service.insertEquipment(beansMap);
}
}//GEN-LAST:event_submitButtonClicked
private void updateItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updateItemActionPerformed
GUIUpdate updateRec = new GUIUpdate();
updateRec.setVisible(true);
updateRec.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}//GEN-LAST:event_updateItemActionPerformed
private void cpuSpeedInputActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cpuSpeedInputActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_cpuSpeedInputActionPerformed
private void osNameInputActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_osNameInputActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_osNameInputActionPerformed
private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
System.exit(0);
}//GEN-LAST:event_jMenuItem1ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(GUIInsertNew.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(GUIInsertNew.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(GUIInsertNew.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(GUIInsertNew.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new GUIInsertNew().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTextField cpuBrandInput;
private javax.swing.JLabel cpuBrandLabel;
private javax.swing.JTextField cpuSpeedInput;
private javax.swing.JLabel cpuSpeedLabel;
private javax.swing.JTextField gpuBrandInput;
private javax.swing.JComboBox gpuCapacity;
private javax.swing.JLabel gpuLabel;
private javax.swing.JComboBox gpuTypeCombo;
private javax.swing.JTextField hddBrandInput;
private javax.swing.JComboBox hddCapacityCombo;
private javax.swing.JLabel hddLabel;
private javax.swing.JTextField invoiceNumberInput;
private javax.swing.JLabel invoiceNumberLabel;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel7;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JMenuItem jMenuItem1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel6;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JScrollPane jScrollPane4;
private javax.swing.JScrollPane jScrollPane5;
private javax.swing.JScrollPane jScrollPane6;
private javax.swing.JScrollPane jScrollPane7;
private javax.swing.JScrollPane jScrollPane8;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JSeparator jSeparator2;
private javax.swing.JTabbedPane jTabbedPane1;
private javax.swing.JTextArea logDetailsInput;
private javax.swing.JLabel logDetailsLabel;
private javax.swing.JPanel mainPanel;
private javax.swing.JTextField maintainenceLogDateInput;
private javax.swing.JLabel maintainenceLogDateLabel;
private javax.swing.JTextField monitorBrandInput;
private javax.swing.JLabel monitorLabel;
private javax.swing.JTextField monitorSerialNumberInput1;
private javax.swing.JComboBox monitorSizeCombo;
private javax.swing.JTextField osNameInput;
private javax.swing.JLabel osNameLabel;
private javax.swing.JTextField osVersionInput;
private javax.swing.JLabel osVersionLabel;
private javax.swing.JTextArea peripheralDescriptionInput;
private javax.swing.JLabel peripheralDescriptionLabel;
private javax.swing.JTextField peripheralSerialNumberInput;
private javax.swing.JLabel peripheralsLabel;
private javax.swing.JComboBox peripheralsType;
private javax.swing.JTextField ramBrandInput;
private javax.swing.JComboBox ramCapacityCombo;
private javax.swing.JComboBox ramCountCombo;
private javax.swing.JLabel ramLabel;
private javax.swing.JComboBox ramTypeCombo;
private javax.swing.JTextField staffIDInput;
private javax.swing.JLabel staffIDLabel;
private javax.swing.JLabel technicianLabel;
private javax.swing.JTextField technicianNameInput;
private javax.swing.JComboBox typeOfEquipmentInput;
private javax.swing.JLabel typeOfEquipmentLabel;
private javax.swing.JMenuItem updateItem;
private javax.swing.JTextField userNameInput;
private javax.swing.JLabel userNameLabel;
private javax.swing.JTextArea vendorAddressInput;
private javax.swing.JLabel vendorAddressLabel;
private javax.swing.JTextField vendorNameInput;
private javax.swing.JLabel vendorNameLabel;
private javax.swing.JTextField vendorPhoneInput;
private javax.swing.JLabel vendorPhoneLabel;
// End of variables declaration//GEN-END:variables
}