/Users/johnr/Desktop/IA pdf Downloads/Criteria__P__-_Coding_Project_Upload_all_2022-05-03/SPVCPortal_Panpan/src/main/java/com/mycompany/spvcportal/MainGUIPortal.java
   1 /*
   2  * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
   3  * Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/Application.java to edit this template
   4  */
   5 package com.mycompany.spvcportal;
   6 
   7 import com.itextpdf.text.DocumentException;
   8 import java.io.BufferedReader;
   9 import java.io.FileReader;
  10 import java.io.FileWriter;
  11 import java.io.IOException;
  12 import java.util.LinkedList;
  13 import java.util.StringTokenizer;
  14 import java.util.logging.Level;
  15 import java.util.logging.Logger;
  16 import javax.crypto.spec.OAEPParameterSpec;
  17 import javax.swing.table.DefaultTableModel;
  18 
  19 /**
  20  *
  21  * @author 18916
  22  */
  23 public class MainGUIPortal extends javax.swing.JFrame {
  24 
  25     /**
  26      * Creates new form MainGUIPortal
  27      */
  28     
  29 
  30     
  31     public MainGUIPortal() {
  32         initComponents();
  33         
  34     }
  35     
  36     // initializes a linked list to store orders
  37     public LinkedList<Order> ordersList = new LinkedList<Order>();
  38     
  39     // initializes an int to be used as the order IDs
  40     private int orderIDCounter = 10000;
  41 
  42     /**
  43      * This method is called from within the constructor to initialize the form.
  44      * WARNING: Do NOT modify this code. The content of this method is always
  45      * regenerated by the Form Editor.
  46      */
  47     @SuppressWarnings("unchecked")
  48     // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
  49     private void initComponents() {
  50 
  51         jTabbedPane1 = new javax.swing.JTabbedPane();
  52         jPanel1 = new javax.swing.JPanel();
  53         jScrollPane2 = new javax.swing.JScrollPane();
  54         ordersTable = new javax.swing.JTable();
  55         refreshButton = new javax.swing.JButton();
  56         jLabel11 = new javax.swing.JLabel();
  57         jLabel12 = new javax.swing.JLabel();
  58         jLabel13 = new javax.swing.JLabel();
  59         jPanel3 = new javax.swing.JPanel();
  60         buyerNameTF = new javax.swing.JTextField();
  61         jLabel1 = new javax.swing.JLabel();
  62         dateFTF = new javax.swing.JFormattedTextField();
  63         jLabel2 = new javax.swing.JLabel();
  64         jLabel3 = new javax.swing.JLabel();
  65         orderChannelCB = new javax.swing.JComboBox<>();
  66         jLabel4 = new javax.swing.JLabel();
  67         productNameTF = new javax.swing.JTextField();
  68         jLabel5 = new javax.swing.JLabel();
  69         jLabel6 = new javax.swing.JLabel();
  70         quantityTF = new javax.swing.JTextField();
  71         addOrderButton = new javax.swing.JButton();
  72         ppuTF = new javax.swing.JTextField();
  73         jLabel7 = new javax.swing.JLabel();
  74         jLabel8 = new javax.swing.JLabel();
  75         trackingNumTF = new javax.swing.JTextField();
  76         onlineLabel = new javax.swing.JLabel();
  77         phoneNumTF = new javax.swing.JTextField();
  78         telephoneLabel = new javax.swing.JLabel();
  79         deliveryDateLabel = new javax.swing.JLabel();
  80         deliverByDateFTF = new javax.swing.JFormattedTextField();
  81         addressTF = new javax.swing.JTextField();
  82         jPanel4 = new javax.swing.JPanel();
  83         jScrollPane3 = new javax.swing.JScrollPane();
  84         viewPageTable = new javax.swing.JTable();
  85         jLabel9 = new javax.swing.JLabel();
  86         searchTF = new javax.swing.JTextField();
  87         jScrollPane4 = new javax.swing.JScrollPane();
  88         searchDisplayTextArea = new javax.swing.JTextArea();
  89         jLabel10 = new javax.swing.JLabel();
  90         searchButton = new javax.swing.JButton();
  91         pdfCreateButton = new javax.swing.JButton();
  92         deleteButton = new javax.swing.JButton();
  93         sortNameButton = new javax.swing.JButton();
  94         menuBar = new javax.swing.JMenuBar();
  95         fileMenu = new javax.swing.JMenu();
  96         openMenuItem = new javax.swing.JMenuItem();
  97         saveMenuItem = new javax.swing.JMenuItem();
  98         exitMenuItem = new javax.swing.JMenuItem();
  99         editMenu = new javax.swing.JMenu();
 100         cutMenuItem = new javax.swing.JMenuItem();
 101         copyMenuItem = new javax.swing.JMenuItem();
 102         pasteMenuItem = new javax.swing.JMenuItem();
 103         deleteMenuItem = new javax.swing.JMenuItem();
 104         helpMenu = new javax.swing.JMenu();
 105         contentsMenuItem = new javax.swing.JMenuItem();
 106         aboutMenuItem = new javax.swing.JMenuItem();
 107 
 108         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
 109 
 110         jTabbedPane1.addMouseListener(new java.awt.event.MouseAdapter() {
 111             public void mouseReleased(java.awt.event.MouseEvent evt) {
 112                 jTabbedPane1MouseReleased(evt);
 113             }
 114         });
 115 
 116         ordersTable.setModel(new javax.swing.table.DefaultTableModel(
 117             new Object [][] {
 118                 {null, null, null},
 119                 {null, null, null},
 120                 {null, null, null},
 121                 {null, null, null},
 122                 {null, null, null},
 123                 {null, null, null},
 124                 {null, null, null},
 125                 {null, null, null},
 126                 {null, null, null},
 127                 {null, null, null},
 128                 {null, null, null},
 129                 {null, null, null},
 130                 {null, null, null},
 131                 {null, null, null},
 132                 {null, null, null},
 133                 {null, null, null},
 134                 {null, null, null},
 135                 {null, null, null},
 136                 {null, null, null},
 137                 {null, null, null},
 138                 {null, null, null},
 139                 {null, null, null},
 140                 {null, null, null},
 141                 {null, null, null},
 142                 {null, null, null},
 143                 {null, null, null},
 144                 {null, null, null},
 145                 {null, null, null},
 146                 {null, null, null},
 147                 {null, null, null},
 148                 {null, null, null},
 149                 {null, null, null},
 150                 {null, null, null},
 151                 {null, null, null},
 152                 {null, null, null},
 153                 {null, null, null},
 154                 {null, null, null},
 155                 {null, null, null},
 156                 {null, null, null},
 157                 {null, null, null}
 158             },
 159             new String [] {
 160                 "Order ID", "Buyer Name", "Order Date"
 161             }
 162         ) {
 163             Class[] types = new Class [] {
 164                 java.lang.String.class, java.lang.Object.class, java.lang.Object.class
 165             };
 166 
 167             public Class getColumnClass(int columnIndex) {
 168                 return types [columnIndex];
 169             }
 170         });
 171         ordersTable.setGridColor(new java.awt.Color(0, 0, 0));
 172         jScrollPane2.setViewportView(ordersTable);
 173 
 174         refreshButton.setText("Refresh Table");
 175         refreshButton.addMouseListener(new java.awt.event.MouseAdapter() {
 176             public void mouseReleased(java.awt.event.MouseEvent evt) {
 177                 refreshButtonMouseReleased(evt);
 178             }
 179         });
 180         refreshButton.addActionListener(new java.awt.event.ActionListener() {
 181             public void actionPerformed(java.awt.event.ActionEvent evt) {
 182                 refreshButtonActionPerformed(evt);
 183             }
 184         });
 185 
 186         jLabel11.setFont(new java.awt.Font("Helvetica Neue", 0, 18)); // NOI18N
 187         jLabel11.setText("<html><b>SPVC Order Log and <br> PDF Generator</b>");
 188 
 189         jLabel12.setFont(new java.awt.Font("Helvetica Neue", 0, 14)); // NOI18N
 190         jLabel12.setText("<html><i>Description of Program:</i>");
 191         jLabel12.setVerticalAlignment(javax.swing.SwingConstants.TOP);
 192 
 193         jLabel13.setText("<html>This program is used to store orders for products at the company. The data log allows users to keep track of orders, \nmanually inputting information such as buyer names, date placed, addresses, products, quantity, etc. Use the <i>Home</i>\n tab to view all orders, sorted by time of entry. Use the <i>Add</i> tab to add new orders, making sure to input all required information. Finally, use the <i>View</i> tab to look up information for specific orders by searching with their order ID, delete them, or create a PDF order summary.");
 194         jLabel13.setVerticalAlignment(javax.swing.SwingConstants.TOP);
 195 
 196         javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
 197         jPanel1.setLayout(jPanel1Layout);
 198         jPanel1Layout.setHorizontalGroup(
 199             jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 200             .addGroup(jPanel1Layout.createSequentialGroup()
 201                 .addContainerGap()
 202                 .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 518, javax.swing.GroupLayout.PREFERRED_SIZE)
 203                 .addGap(18, 18, 18)
 204                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 205                     .addComponent(jLabel11, javax.swing.GroupLayout.DEFAULT_SIZE, 258, Short.MAX_VALUE)
 206                     .addComponent(jLabel12)
 207                     .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
 208                     .addGroup(jPanel1Layout.createSequentialGroup()
 209                         .addComponent(refreshButton, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE)
 210                         .addGap(0, 0, Short.MAX_VALUE)))
 211                 .addContainerGap())
 212         );
 213         jPanel1Layout.setVerticalGroup(
 214             jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 215             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
 216                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
 217                     .addGroup(jPanel1Layout.createSequentialGroup()
 218                         .addContainerGap()
 219                         .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 373, Short.MAX_VALUE))
 220                     .addGroup(jPanel1Layout.createSequentialGroup()
 221                         .addGap(16, 16, 16)
 222                         .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 223                         .addGap(18, 18, 18)
 224                         .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 225                         .addGap(18, 18, 18)
 226                         .addComponent(jLabel13)
 227                         .addGap(18, 18, 18)
 228                         .addComponent(refreshButton)))
 229                 .addContainerGap())
 230         );
 231 
 232         jTabbedPane1.addTab("Home", jPanel1);
 233 
 234         buyerNameTF.addActionListener(new java.awt.event.ActionListener() {
 235             public void actionPerformed(java.awt.event.ActionEvent evt) {
 236                 buyerNameTFActionPerformed(evt);
 237             }
 238         });
 239 
 240         jLabel1.setText("Buyer Name:");
 241 
 242         dateFTF.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.DateFormatter(java.text.DateFormat.getDateInstance(java.text.DateFormat.SHORT))));
 243         dateFTF.setText("MM/dd/yy");
 244         dateFTF.addActionListener(new java.awt.event.ActionListener() {
 245             public void actionPerformed(java.awt.event.ActionEvent evt) {
 246                 dateFTFActionPerformed(evt);
 247             }
 248         });
 249 
 250         jLabel2.setText("Date:");
 251 
 252         jLabel3.setText("Address:");
 253 
 254         orderChannelCB.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Channel", "Online", "Storefront", "Telephone" }));
 255         orderChannelCB.addActionListener(new java.awt.event.ActionListener() {
 256             public void actionPerformed(java.awt.event.ActionEvent evt) {
 257                 orderChannelCBActionPerformed(evt);
 258             }
 259         });
 260         orderChannelCB.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
 261             public void propertyChange(java.beans.PropertyChangeEvent evt) {
 262                 orderChannelCBPropertyChange(evt);
 263             }
 264         });
 265 
 266         jLabel4.setText("Order Channel:");
 267 
 268         productNameTF.addActionListener(new java.awt.event.ActionListener() {
 269             public void actionPerformed(java.awt.event.ActionEvent evt) {
 270                 productNameTFActionPerformed(evt);
 271             }
 272         });
 273 
 274         jLabel5.setText("Product:");
 275 
 276         jLabel6.setText("Quantity:");
 277 
 278         addOrderButton.setText("Add Order");
 279         addOrderButton.addMouseListener(new java.awt.event.MouseAdapter() {
 280             public void mouseReleased(java.awt.event.MouseEvent evt) {
 281                 addOrderButtonMouseReleased(evt);
 282             }
 283         });
 284 
 285         ppuTF.addActionListener(new java.awt.event.ActionListener() {
 286             public void actionPerformed(java.awt.event.ActionEvent evt) {
 287                 ppuTFActionPerformed(evt);
 288             }
 289         });
 290 
 291         jLabel7.setText("Price Per Unit:");
 292 
 293         jLabel8.setFont(new java.awt.Font("Helvetica Neue", 0, 24)); // NOI18N
 294         jLabel8.setText("Add an Order");
 295 
 296         onlineLabel.setText("Tracking no.:");
 297 
 298         telephoneLabel.setText("Telephone no.:");
 299 
 300         deliveryDateLabel.setText("Delivery date:");
 301 
 302         deliverByDateFTF.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.DateFormatter(java.text.DateFormat.getDateInstance(java.text.DateFormat.SHORT))));
 303         deliverByDateFTF.setText("MM/dd/yy");
 304         deliverByDateFTF.addActionListener(new java.awt.event.ActionListener() {
 305             public void actionPerformed(java.awt.event.ActionEvent evt) {
 306                 deliverByDateFTFActionPerformed(evt);
 307             }
 308         });
 309 
 310         javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
 311         jPanel3.setLayout(jPanel3Layout);
 312         jPanel3Layout.setHorizontalGroup(
 313             jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 314             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
 315                 .addContainerGap(36, Short.MAX_VALUE)
 316                 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
 317                     .addGroup(jPanel3Layout.createSequentialGroup()
 318                         .addComponent(jLabel8)
 319                         .addGap(304, 304, 304))
 320                     .addGroup(jPanel3Layout.createSequentialGroup()
 321                         .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 322                             .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING)
 323                             .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING)
 324                             .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING)
 325                             .addComponent(jLabel5, javax.swing.GroupLayout.Alignment.TRAILING)
 326                             .addComponent(jLabel7, javax.swing.GroupLayout.Alignment.TRAILING))
 327                         .addGap(18, 18, 18)
 328                         .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
 329                             .addComponent(buyerNameTF)
 330                             .addGroup(jPanel3Layout.createSequentialGroup()
 331                                 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 332                                     .addGroup(jPanel3Layout.createSequentialGroup()
 333                                         .addComponent(productNameTF, javax.swing.GroupLayout.PREFERRED_SIZE, 165, javax.swing.GroupLayout.PREFERRED_SIZE)
 334                                         .addGap(18, 18, 18)
 335                                         .addComponent(jLabel6))
 336                                     .addComponent(ppuTF, javax.swing.GroupLayout.PREFERRED_SIZE, 165, javax.swing.GroupLayout.PREFERRED_SIZE))
 337                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 338                                 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 339                                     .addComponent(quantityTF)
 340                                     .addComponent(addOrderButton, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE)))
 341                             .addGroup(jPanel3Layout.createSequentialGroup()
 342                                 .addComponent(dateFTF, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
 343                                 .addGap(238, 238, 238))
 344                             .addComponent(addressTF, javax.swing.GroupLayout.PREFERRED_SIZE, 358, javax.swing.GroupLayout.PREFERRED_SIZE))
 345                         .addGap(47, 47, 47)
 346                         .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
 347                             .addComponent(jLabel4)
 348                             .addComponent(onlineLabel)
 349                             .addComponent(deliveryDateLabel)
 350                             .addComponent(telephoneLabel))
 351                         .addGap(18, 18, 18)
 352                         .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
 353                             .addComponent(phoneNumTF)
 354                             .addComponent(trackingNumTF)
 355                             .addComponent(orderChannelCB, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
 356                             .addComponent(deliverByDateFTF, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
 357                         .addGap(38, 38, 38))))
 358         );
 359         jPanel3Layout.setVerticalGroup(
 360             jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 361             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
 362                 .addGap(30, 30, 30)
 363                 .addComponent(jLabel8)
 364                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 27, Short.MAX_VALUE)
 365                 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 366                     .addGroup(jPanel3Layout.createSequentialGroup()
 367                         .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 368                             .addComponent(buyerNameTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 369                             .addComponent(jLabel1))
 370                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
 371                         .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 372                             .addComponent(dateFTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 373                             .addComponent(jLabel2))
 374                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
 375                         .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 376                             .addComponent(jLabel3)
 377                             .addComponent(addressTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
 378                     .addGroup(jPanel3Layout.createSequentialGroup()
 379                         .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 380                             .addComponent(orderChannelCB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 381                             .addComponent(jLabel4))
 382                         .addGap(29, 29, 29)
 383                         .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 384                             .addComponent(trackingNumTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 385                             .addComponent(onlineLabel))
 386                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
 387                         .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 388                             .addComponent(deliveryDateLabel)
 389                             .addComponent(deliverByDateFTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
 390                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
 391                         .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 392                             .addComponent(phoneNumTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 393                             .addComponent(telephoneLabel))))
 394                 .addGap(51, 51, 51)
 395                 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 396                     .addComponent(productNameTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 397                     .addComponent(jLabel5)
 398                     .addComponent(jLabel6)
 399                     .addComponent(quantityTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
 400                 .addGap(18, 18, 18)
 401                 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 402                     .addComponent(ppuTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 403                     .addComponent(jLabel7)
 404                     .addComponent(addOrderButton))
 405                 .addGap(39, 39, 39))
 406         );
 407 
 408         jTabbedPane1.addTab("Add", jPanel3);
 409 
 410         viewPageTable.setModel(new javax.swing.table.DefaultTableModel(
 411             new Object [][] {
 412                 {null, null, null, null},
 413                 {null, null, null, null},
 414                 {null, null, null, null},
 415                 {null, null, null, null},
 416                 {null, null, null, null},
 417                 {null, null, null, null},
 418                 {null, null, null, null},
 419                 {null, null, null, null},
 420                 {null, null, null, null},
 421                 {null, null, null, null},
 422                 {null, null, null, null},
 423                 {null, null, null, null},
 424                 {null, null, null, null},
 425                 {null, null, null, null},
 426                 {null, null, null, null},
 427                 {null, null, null, null},
 428                 {null, null, null, null},
 429                 {null, null, null, null},
 430                 {null, null, null, null},
 431                 {null, null, null, null}
 432             },
 433             new String [] {
 434                 "Order ID", "Buyer Name", "Order Date", "Channel"
 435             }
 436         ) {
 437             Class[] types = new Class [] {
 438                 java.lang.Integer.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
 439             };
 440 
 441             public Class getColumnClass(int columnIndex) {
 442                 return types [columnIndex];
 443             }
 444         });
 445         jScrollPane3.setViewportView(viewPageTable);
 446 
 447         jLabel9.setText("Display order details for ID:");
 448 
 449         searchTF.addActionListener(new java.awt.event.ActionListener() {
 450             public void actionPerformed(java.awt.event.ActionEvent evt) {
 451                 searchTFActionPerformed(evt);
 452             }
 453         });
 454 
 455         searchDisplayTextArea.setColumns(20);
 456         searchDisplayTextArea.setRows(5);
 457         jScrollPane4.setViewportView(searchDisplayTextArea);
 458 
 459         jLabel10.setText("Order details:");
 460 
 461         searchButton.setText("Search");
 462         searchButton.addMouseListener(new java.awt.event.MouseAdapter() {
 463             public void mouseReleased(java.awt.event.MouseEvent evt) {
 464                 searchButtonMouseReleased(evt);
 465             }
 466         });
 467 
 468         pdfCreateButton.setText("Generate Order Summary");
 469         pdfCreateButton.addMouseListener(new java.awt.event.MouseAdapter() {
 470             public void mouseReleased(java.awt.event.MouseEvent evt) {
 471                 pdfCreateButtonMouseReleased(evt);
 472             }
 473         });
 474 
 475         deleteButton.setText("Delete Order");
 476         deleteButton.addMouseListener(new java.awt.event.MouseAdapter() {
 477             public void mouseReleased(java.awt.event.MouseEvent evt) {
 478                 deleteButtonMouseReleased(evt);
 479             }
 480         });
 481 
 482         sortNameButton.setText("Sort by Buyer Name");
 483         sortNameButton.addMouseListener(new java.awt.event.MouseAdapter() {
 484             public void mouseReleased(java.awt.event.MouseEvent evt) {
 485                 sortNameButtonMouseReleased(evt);
 486             }
 487         });
 488         sortNameButton.addActionListener(new java.awt.event.ActionListener() {
 489             public void actionPerformed(java.awt.event.ActionEvent evt) {
 490                 sortNameButtonActionPerformed(evt);
 491             }
 492         });
 493 
 494         javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
 495         jPanel4.setLayout(jPanel4Layout);
 496         jPanel4Layout.setHorizontalGroup(
 497             jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 498             .addGroup(jPanel4Layout.createSequentialGroup()
 499                 .addContainerGap()
 500                 .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 501                     .addComponent(sortNameButton)
 502                     .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 420, javax.swing.GroupLayout.PREFERRED_SIZE))
 503                 .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 504                     .addGroup(jPanel4Layout.createSequentialGroup()
 505                         .addGap(27, 27, 27)
 506                         .addComponent(deleteButton)
 507                         .addGap(40, 40, 40)
 508                         .addComponent(pdfCreateButton))
 509                     .addGroup(jPanel4Layout.createSequentialGroup()
 510                         .addGap(25, 25, 25)
 511                         .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 512                             .addComponent(jLabel10)
 513                             .addComponent(jLabel9)
 514                             .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
 515                                 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
 516                                     .addComponent(searchTF, javax.swing.GroupLayout.PREFERRED_SIZE, 149, javax.swing.GroupLayout.PREFERRED_SIZE)
 517                                     .addGap(85, 85, 85))
 518                                 .addComponent(searchButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE))
 519                             .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 325, javax.swing.GroupLayout.PREFERRED_SIZE))))
 520                 .addContainerGap(30, Short.MAX_VALUE))
 521         );
 522         jPanel4Layout.setVerticalGroup(
 523             jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 524             .addGroup(jPanel4Layout.createSequentialGroup()
 525                 .addGap(12, 12, 12)
 526                 .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
 527                     .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 334, javax.swing.GroupLayout.PREFERRED_SIZE)
 528                     .addGroup(jPanel4Layout.createSequentialGroup()
 529                         .addComponent(jLabel9)
 530                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 531                         .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 532                             .addComponent(searchTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 533                             .addComponent(searchButton))
 534                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
 535                         .addComponent(jLabel10)
 536                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 537                         .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 257, javax.swing.GroupLayout.PREFERRED_SIZE)))
 538                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
 539                 .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 540                     .addComponent(pdfCreateButton)
 541                     .addComponent(deleteButton)
 542                     .addComponent(sortNameButton)))
 543         );
 544 
 545         jTabbedPane1.addTab("View", jPanel4);
 546 
 547         fileMenu.setMnemonic('f');
 548         fileMenu.setText("File");
 549 
 550         openMenuItem.setMnemonic('o');
 551         openMenuItem.setText("Open");
 552         openMenuItem.addMouseListener(new java.awt.event.MouseAdapter() {
 553             public void mouseReleased(java.awt.event.MouseEvent evt) {
 554                 openMenuItemMouseReleased(evt);
 555             }
 556         });
 557         fileMenu.add(openMenuItem);
 558 
 559         saveMenuItem.setMnemonic('s');
 560         saveMenuItem.setText("Save");
 561         saveMenuItem.addMouseListener(new java.awt.event.MouseAdapter() {
 562             public void mouseReleased(java.awt.event.MouseEvent evt) {
 563                 saveMenuItemMouseReleased(evt);
 564             }
 565         });
 566         fileMenu.add(saveMenuItem);
 567 
 568         exitMenuItem.setMnemonic('x');
 569         exitMenuItem.setText("Exit");
 570         exitMenuItem.addActionListener(new java.awt.event.ActionListener() {
 571             public void actionPerformed(java.awt.event.ActionEvent evt) {
 572                 exitMenuItemActionPerformed(evt);
 573             }
 574         });
 575         fileMenu.add(exitMenuItem);
 576 
 577         menuBar.add(fileMenu);
 578 
 579         editMenu.setMnemonic('e');
 580         editMenu.setText("Edit");
 581 
 582         cutMenuItem.setMnemonic('t');
 583         cutMenuItem.setText("Cut");
 584         editMenu.add(cutMenuItem);
 585 
 586         copyMenuItem.setMnemonic('y');
 587         copyMenuItem.setText("Copy");
 588         editMenu.add(copyMenuItem);
 589 
 590         pasteMenuItem.setMnemonic('p');
 591         pasteMenuItem.setText("Paste");
 592         editMenu.add(pasteMenuItem);
 593 
 594         deleteMenuItem.setMnemonic('d');
 595         deleteMenuItem.setText("Delete");
 596         editMenu.add(deleteMenuItem);
 597 
 598         menuBar.add(editMenu);
 599 
 600         helpMenu.setMnemonic('h');
 601         helpMenu.setText("Help");
 602 
 603         contentsMenuItem.setMnemonic('c');
 604         contentsMenuItem.setText("Contents");
 605         helpMenu.add(contentsMenuItem);
 606 
 607         aboutMenuItem.setMnemonic('a');
 608         aboutMenuItem.setText("About");
 609         helpMenu.add(aboutMenuItem);
 610 
 611         menuBar.add(helpMenu);
 612 
 613         setJMenuBar(menuBar);
 614 
 615         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
 616         getContentPane().setLayout(layout);
 617         layout.setHorizontalGroup(
 618             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 619             .addGroup(layout.createSequentialGroup()
 620                 .addGap(35, 35, 35)
 621                 .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 806, javax.swing.GroupLayout.PREFERRED_SIZE)
 622                 .addContainerGap(46, Short.MAX_VALUE))
 623         );
 624         layout.setVerticalGroup(
 625             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 626             .addGroup(layout.createSequentialGroup()
 627                 .addGap(26, 26, 26)
 628                 .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 418, javax.swing.GroupLayout.PREFERRED_SIZE)
 629                 .addContainerGap(57, Short.MAX_VALUE))
 630         );
 631 
 632         pack();
 633     }// </editor-fold>                        
 634 
 635     private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {                                             
 636         System.exit(0);
 637     }                                            
 638 
 639     private void refreshButtonActionPerformed(java.awt.event.ActionEvent evt) {                                              
 640         
 641     }                                             
 642 
 643     private void buyerNameTFActionPerformed(java.awt.event.ActionEvent evt) {                                            
 644         
 645     }                                           
 646 
 647     private void dateFTFActionPerformed(java.awt.event.ActionEvent evt) {                                        
 648        
 649     }                                       
 650 
 651     private void productNameTFActionPerformed(java.awt.event.ActionEvent evt) {                                              
 652         
 653     }                                             
 654 
 655     private void ppuTFActionPerformed(java.awt.event.ActionEvent evt) {                                      
 656         
 657     }                                     
 658 
 659     private void addOrderButtonMouseReleased(java.awt.event.MouseEvent evt) {                                             
 660         
 661         
 662         // increases the orderIDCounter by 1 each time the Add Order button is pressed
 663         // to give each order a unique identification number.
 664         orderIDCounter = orderIDCounter + 1;
 665        
 666         
 667         if(orderChannelCB.getSelectedItem() == "Online"){
 668             /* if the order channel is equal to "Online", a new instance of 
 669             the class OnlineOrder, which is a subclass of Order, will be initialized.
 670             Preconditions: all jTextFields on the Add page must be filled in with appropriate
 671             values.
 672             Postconditions: an instance of OnlineOrder is created using the data from the 
 673             Add page as parameters.
 674             */
 675             OnlineOrder tempOnline = new OnlineOrder(orderIDCounter, buyerNameTF.getText(), dateFTF.getText(), 
 676                     (String) orderChannelCB.getSelectedItem(), addressTF.getText(), productNameTF.getText(), 
 677                     Double.parseDouble(quantityTF.getText()), Double.parseDouble(ppuTF.getText()), 
 678                     trackingNumTF.getText(), deliverByDateFTF.getText());
 679             ordersList.add(tempOnline);
 680         }else if(orderChannelCB.getSelectedItem() == "Telephone"){
 681             /* if the order channel is equal to "Telephone", a new instance of 
 682             the class PhoneOrder, which is a subclass of Order, will be initialized.
 683             Preconditions: all input components on the Add page must be filled in with appropriate
 684             values.
 685             Postconditions: an instance of PhoneOrder is created using the data from the Add 
 686             page as parameters.
 687             */
 688             PhoneOrder tempPhone = new PhoneOrder(orderIDCounter, buyerNameTF.getText(), dateFTF.getText(), 
 689                     (String) orderChannelCB.getSelectedItem(), addressTF.getText(), productNameTF.getText(), 
 690                     Double.parseDouble(quantityTF.getText()), Double.parseDouble(ppuTF.getText()), phoneNumTF.getText());
 691             ordersList.add(tempPhone);
 692         }else{
 693             /* if the order channel is equal to "Storefront", the order will be
 694             categorized as an ordinary order as that is the standard order channel. The program
 695             will initialize a new object which is an instance of the class Order.
 696             Precondition: all input components on the Add page must be filled in with appropriate values.
 697             Postcondition:an instance of Order is created.
 698             */
 699             Order tempStorefrontOrder = new Order(orderIDCounter, buyerNameTF.getText(), dateFTF.getText(), 
 700                     (String) orderChannelCB.getSelectedItem(), addressTF.getText(), productNameTF.getText(), 
 701                     Double.parseDouble(quantityTF.getText()), Double.parseDouble(ppuTF.getText()));
 702             ordersList.add(tempStorefrontOrder);
 703         }
 704         
 705         // resets all the input components on the Add page.
 706         buyerNameTF.setText("");
 707         dateFTF.setText("MM/dd/yy");
 708         orderChannelCB.setSelectedIndex(0);
 709         addressTF.setText("");
 710         productNameTF.setText("");
 711         quantityTF.setText("");
 712         ppuTF.setText("");
 713         trackingNumTF.setText("");
 714         deliverByDateFTF.setText("MM/dd/yy");
 715         phoneNumTF.setText("");
 716         
 717     }                                            
 718 
 719     private void refreshButtonMouseReleased(java.awt.event.MouseEvent evt) {                                            
 720         
 721         // clears the table 
 722         for (int i = 0; i < ordersTable.getRowCount(); i++) {
 723             ordersTable.setValueAt(null, i, 0);
 724             ordersTable.setValueAt("", i, 1);
 725             ordersTable.setValueAt("", i, 2);
 726         }        
 727         
 728         // populates the table with the orderID, buyerName, and date of
 729         // all orders in ordersList.
 730         for (int row = 0; row < ordersList.size(); row++) {
 731             ordersTable.setValueAt(ordersList.get(row).getOrderID(), row, 0);
 732             ordersTable.setValueAt(ordersList.get(row).getBuyerName(), row, 1);
 733             ordersTable.setValueAt(ordersList.get(row).getDate(), row, 2);
 734         }
 735         
 736         
 737         
 738         
 739     }                                           
 740 
 741     private void orderChannelCBActionPerformed(java.awt.event.ActionEvent evt) {                                               
 742         
 743         /* allows only the relevant jTextFields under the jComboBox
 744         that is used to select the orderChannel to be visible.
 745         */
 746         if(orderChannelCB.getSelectedItem() == "Online") {
 747             trackingNumTF.setVisible(true);
 748             onlineLabel.setVisible(true);
 749             deliveryDateLabel.setVisible(true);
 750             deliverByDateFTF.setVisible(true);
 751             phoneNumTF.setVisible(false);
 752             telephoneLabel.setVisible(false);
 753         }else if(orderChannelCB.getSelectedItem() == "Telephone"){
 754             trackingNumTF.setVisible(false);
 755             onlineLabel.setVisible(false);
 756             deliveryDateLabel.setVisible(false);
 757             deliverByDateFTF.setVisible(false);
 758             phoneNumTF.setVisible(true);
 759             telephoneLabel.setVisible(true);
 760         }else{
 761             trackingNumTF.setVisible(false);
 762             onlineLabel.setVisible(false);
 763             deliveryDateLabel.setVisible(false);
 764             deliverByDateFTF.setVisible(false);
 765             phoneNumTF.setVisible(false);
 766             telephoneLabel.setVisible(false);
 767         }
 768         
 769        
 770         
 771     }                                              
 772 
 773     private void orderChannelCBPropertyChange(java.beans.PropertyChangeEvent evt) {                                              
 774         // TODO add your handling code here:
 775 
 776     }                                             
 777 
 778     private void searchTFActionPerformed(java.awt.event.ActionEvent evt) {                                         
 779         // TODO add your handling code here:
 780     }                                        
 781 
 782     private void sortNameButtonActionPerformed(java.awt.event.ActionEvent evt) {                                               
 783         // TODO add your handling code here:
 784     }                                              
 785 
 786     private void searchButtonMouseReleased(java.awt.event.MouseEvent evt) {                                           
 787         
 788         // creates an array of orderIDs of all orders in ordersList to be sent
 789         // as a parameter to the search() method.
 790         int[] orderIDArray = new int[ordersList.size()];
 791         for(int i = 0; i < ordersList.size(); i++) {
 792             orderIDArray[i] = ordersList.get(i).getOrderID();
 793         }
 794         
 795         /* uses an instance of the SortAndSearch class along with parameters orderIDArray and
 796         the orderID key inputted in the searchTF jTextField to return the index of the order
 797         in ordersList with orderID equal to the desired key. The index is found using Binary Search.
 798         Preconditions: the method search() is called with parameters of an array of all orderIDs
 799         in ordersList and an int of the orderID key.
 800         Postconditions: returns the index of the order with orderID equal to the key in ordersList.
 801         If no order with that ID has been found, method returns -1.
 802         */
 803         SortAndSearch sortAndSearch = new SortAndSearch();
 804         int orderIndexToDisplay = sortAndSearch.search(orderIDArray, Integer.parseInt(searchTF.getText()));
 805         
 806         
 807         if(orderIndexToDisplay == -1){
 808             // if the return value of search() is -1, display this message in
 809             // the jTextArea.
 810             searchDisplayTextArea.setText("Order not found.");
 811         } else {
 812             // if the return value of search() is not -1 and is a valid index in
 813             // ordersList, display the details of the order at that index in the
 814             // jTextArea.
 815             searchDisplayTextArea.setText("");
 816             searchDisplayTextArea.append("Order ID:" + String.valueOf(ordersList.get(orderIndexToDisplay).getOrderID()));
 817             searchDisplayTextArea.append("\n\nBuyer name: " + ordersList.get(orderIndexToDisplay).getBuyerName());
 818             searchDisplayTextArea.append("\n\nDate received (dd/mm/yy): " + ordersList.get(orderIndexToDisplay).getDate());
 819             searchDisplayTextArea.append("\n\nChannel: " + ordersList.get(orderIndexToDisplay).getOrderChannel());
 820             searchDisplayTextArea.append("\n\nAddress: " + ordersList.get(orderIndexToDisplay).getAddress());
 821             searchDisplayTextArea.append("\n\nProduct name: " + ordersList.get(orderIndexToDisplay).getProductName());
 822             searchDisplayTextArea.append("\n\nQuantity: " + ordersList.get(orderIndexToDisplay).getQuantityOfProduct());
 823             searchDisplayTextArea.append("\n\nTotal amount due: " + (ordersList.get(orderIndexToDisplay).getQuantityOfProduct() * ordersList.get(orderIndexToDisplay).getPricePerUnit()));
 824             
 825             
 826             if(ordersList.get(orderIndexToDisplay).getOrderChannel() == "Online") {
 827                 // if the order is an OnlineOrder, also display the tracking number and delivery date.
 828                 OnlineOrder onlineOrderTemp = (OnlineOrder)(ordersList.get(orderIndexToDisplay));
 829                 searchDisplayTextArea.append("\n\nTracking no.: " + onlineOrderTemp.getTrackingNumber());
 830                 searchDisplayTextArea.append("\n\nDeliver by (dd/mm/yy): " + onlineOrderTemp.getDeliverByDate());
 831 
 832             }else if (ordersList.get(orderIndexToDisplay).getOrderChannel() == "Telephone"){
 833                 // if the order is a PhoneOrder, also display the phone number.
 834                 PhoneOrder phoneOrderTemp = (PhoneOrder)(ordersList.get(orderIndexToDisplay));
 835                 searchDisplayTextArea.append("\n\nContact number: " + phoneOrderTemp.getPhoneNum());
 836             }
 837         }
 838         
 839     }                                          
 840 
 841     private void deleteButtonMouseReleased(java.awt.event.MouseEvent evt) {                                           
 842         
 843         // uses Binary Search to find the index of the order with the desired ID.
 844         SortAndSearch sortAndSearch = new SortAndSearch();
 845         int[] orderIDArray = new int[ordersList.size()];
 846         for(int i = 0; i < ordersList.size(); i++) {
 847             orderIDArray[i] = ordersList.get(i).getOrderID();
 848         }
 849         int orderIndexToDelete = sortAndSearch.search(orderIDArray, Integer.parseInt(searchTF.getText()));
 850         
 851         // removes the desired order from ordersList.
 852         ordersList.remove(orderIndexToDelete);
 853         searchDisplayTextArea.setText("Order deleted.");
 854     }                                          
 855 
 856     private void deliverByDateFTFActionPerformed(java.awt.event.ActionEvent evt) {                                                 
 857         // TODO add your handling code here:
 858     }                                                
 859 
 860     private void jTabbedPane1MouseReleased(java.awt.event.MouseEvent evt) {                                           
 861         // TODO add your handling code here:
 862         
 863     }                                          
 864 
 865     private void pdfCreateButtonMouseReleased(java.awt.event.MouseEvent evt) {                                              
 866         
 867         
 868         int[] orderIDArray = new int[ordersList.size()];
 869         for(int i = 0; i < ordersList.size(); i++) {
 870             orderIDArray[i] = ordersList.get(i).getOrderID();
 871         }
 872         
 873         SortAndSearch sortAndSearch = new SortAndSearch();
 874         int orderIndexToSummarize = sortAndSearch.search(orderIDArray, Integer.parseInt(searchTF.getText()));
 875         
 876         CreatePDF pdfCreator = new CreatePDF();
 877         try {
 878             pdfCreator.create(orderIndexToSummarize, ordersList);
 879             //Error Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException:
 880             // Uncompilable code - unreported exception java.io.IOException; must be caught or declared to be thrown
 881         } catch (IOException ex) {
 882             Logger.getLogger(MainGUIPortal.class.getName()).log(Level.SEVERE, null, ex);
 883         } catch (DocumentException ex) {
 884             Logger.getLogger(MainGUIPortal.class.getName()).log(Level.SEVERE, null, ex);
 885         }
 886     }                                             
 887 
 888     private void sortNameButtonMouseReleased(java.awt.event.MouseEvent evt) {                                             
 889         
 890         
 891         SortAndSearch sortAndSearch = new SortAndSearch();
 892         Order[] nameSortedOrdersList = sortAndSearch.sortByBuyerName(ordersList);
 893         
 894         for (int i = 0; i < viewPageTable.getRowCount(); i++) {
 895             viewPageTable.setValueAt(null, i, 0);
 896             viewPageTable.setValueAt("", i, 1);
 897             viewPageTable.setValueAt("", i, 2);
 898             viewPageTable.setValueAt("", i, 3);
 899         }
 900         
 901         for(int i = 0; i < nameSortedOrdersList.length; i++){
 902             viewPageTable.setValueAt(nameSortedOrdersList[i].getOrderID(), i, 0);
 903             viewPageTable.setValueAt(nameSortedOrdersList[i].getBuyerName(), i, 1);
 904             viewPageTable.setValueAt(nameSortedOrdersList[i].getDate(), i, 2);
 905             viewPageTable.setValueAt(nameSortedOrdersList[i].getOrderChannel(), i, 3);
 906             
 907         }
 908         
 909     }                                            
 910 
 911     private void saveMenuItemMouseReleased(java.awt.event.MouseEvent evt) {                                           
 912         // TODO add your handling code here:
 913         
 914         
 915         
 916     }                                          
 917 
 918     private void openMenuItemMouseReleased(java.awt.event.MouseEvent evt) {                                           
 919         
 920     }                                          
 921 
 922     
 923     /**
 924      * @param args the command line arguments
 925      */
 926     public static void main(String args[]) {
 927         /* Set the Nimbus look and feel */
 928         //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
 929         /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
 930          * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
 931          */
 932         try {
 933             for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
 934                 if ("Nimbus".equals(info.getName())) {
 935                     javax.swing.UIManager.setLookAndFeel(info.getClassName());
 936                     break;
 937                 }
 938             }
 939         } catch (ClassNotFoundException ex) {
 940             java.util.logging.Logger.getLogger(MainGUIPortal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
 941         } catch (InstantiationException ex) {
 942             java.util.logging.Logger.getLogger(MainGUIPortal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
 943         } catch (IllegalAccessException ex) {
 944             java.util.logging.Logger.getLogger(MainGUIPortal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
 945         } catch (javax.swing.UnsupportedLookAndFeelException ex) {
 946             java.util.logging.Logger.getLogger(MainGUIPortal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
 947         }
 948         //</editor-fold>
 949 
 950         
 951         
 952         
 953         
 954         
 955         /* Create and display the form */
 956         java.awt.EventQueue.invokeLater(new Runnable() {
 957             public void run() {
 958                 new MainGUIPortal().setVisible(true);
 959             }
 960         });
 961     }
 962 
 963     // Variables declaration - do not modify                     
 964     private javax.swing.JMenuItem aboutMenuItem;
 965     private javax.swing.JButton addOrderButton;
 966     private javax.swing.JTextField addressTF;
 967     private javax.swing.JTextField buyerNameTF;
 968     private javax.swing.JMenuItem contentsMenuItem;
 969     private javax.swing.JMenuItem copyMenuItem;
 970     private javax.swing.JMenuItem cutMenuItem;
 971     private javax.swing.JFormattedTextField dateFTF;
 972     private javax.swing.JButton deleteButton;
 973     private javax.swing.JMenuItem deleteMenuItem;
 974     private javax.swing.JFormattedTextField deliverByDateFTF;
 975     private javax.swing.JLabel deliveryDateLabel;
 976     private javax.swing.JMenu editMenu;
 977     private javax.swing.JMenuItem exitMenuItem;
 978     private javax.swing.JMenu fileMenu;
 979     private javax.swing.JMenu helpMenu;
 980     private javax.swing.JLabel jLabel1;
 981     private javax.swing.JLabel jLabel10;
 982     private javax.swing.JLabel jLabel11;
 983     private javax.swing.JLabel jLabel12;
 984     private javax.swing.JLabel jLabel13;
 985     private javax.swing.JLabel jLabel2;
 986     private javax.swing.JLabel jLabel3;
 987     private javax.swing.JLabel jLabel4;
 988     private javax.swing.JLabel jLabel5;
 989     private javax.swing.JLabel jLabel6;
 990     private javax.swing.JLabel jLabel7;
 991     private javax.swing.JLabel jLabel8;
 992     private javax.swing.JLabel jLabel9;
 993     private javax.swing.JPanel jPanel1;
 994     private javax.swing.JPanel jPanel3;
 995     private javax.swing.JPanel jPanel4;
 996     private javax.swing.JScrollPane jScrollPane2;
 997     private javax.swing.JScrollPane jScrollPane3;
 998     private javax.swing.JScrollPane jScrollPane4;
 999     private javax.swing.JTabbedPane jTabbedPane1;
1000     private javax.swing.JMenuBar menuBar;
1001     private javax.swing.JLabel onlineLabel;
1002     private javax.swing.JMenuItem openMenuItem;
1003     private javax.swing.JComboBox<String> orderChannelCB;
1004     private javax.swing.JTable ordersTable;
1005     private javax.swing.JMenuItem pasteMenuItem;
1006     private javax.swing.JButton pdfCreateButton;
1007     private javax.swing.JTextField phoneNumTF;
1008     private javax.swing.JTextField ppuTF;
1009     private javax.swing.JTextField productNameTF;
1010     private javax.swing.JTextField quantityTF;
1011     private javax.swing.JButton refreshButton;
1012     private javax.swing.JMenuItem saveMenuItem;
1013     private javax.swing.JButton searchButton;
1014     private javax.swing.JTextArea searchDisplayTextArea;
1015     private javax.swing.JTextField searchTF;
1016     private javax.swing.JButton sortNameButton;
1017     private javax.swing.JLabel telephoneLabel;
1018     private javax.swing.JTextField trackingNumTF;
1019     private javax.swing.JTable viewPageTable;
1020     // End of variables declaration                   
1021 
1022 }
1023