Package Models

Examples of Models.AuthorModel


        initComponents();
        fillTable();
    }
   
    private void fillTable(){
        AuthorModel authorModel = new AuthorModel();
      
        List<Author> authors = authorModel.all();
       
        AuthorTableModel authorTableModel = new AuthorTableModel(authors);
        jTable1.setModel(authorTableModel);
    }
View Full Code Here


        AuthorTableModel authorTableModel = new AuthorTableModel(authors);
        jTable1.setModel(authorTableModel);
    }
   
    private void fillTableSearch(String author_name){
        AuthorModel authorModel = new AuthorModel();
      
        List<Author> authors = authorModel.whereFullName(author_name);
       
        AuthorTableModel authorTableModel = new AuthorTableModel(authors);
        jTable1.setModel(authorTableModel);       
    }
View Full Code Here

        author.setAge(age);
      
        author.setLocation(txtAuthorLocation.getText());
        author.setDetails(txtAuthorDetails.getText());
       
        AuthorModel authorModel = new AuthorModel();
        int update_flag = authorModel.update(author);
        if(update_flag == 1){
            //tableModel.fireTableRowsUpdated(row-1, row+1);
            tableModel.fireTableDataChanged();
            jDialog1.dispose();
            JOptionPane.showMessageDialog(this, "Author "+author.getFull_name()+" updated!", "Success!", JOptionPane.INFORMATION_MESSAGE);
View Full Code Here

        fillComboBox();
    }
   
    private void fillComboBox(){
        ArrayList arrayList = new ArrayList();   // vector is Obsolete. Hence ArrayList
        AuthorModel authorModel = new AuthorModel();
      
        List<Author> authors = authorModel.all(); // This should be query based (Type text to fetch).
                                                  // Loading everything at once is just unnecessary.
        for (Author author : authors) {
           arrayList.add(author);
        }
        cmboxAuthor.setModel(new javax.swing.DefaultComboBoxModel(arrayList.toArray()));
View Full Code Here

        String location     = txtAuthorLocation.getText();
        int age             = Integer.parseInt(txtAuthorAge.getText());
        String details      = txtAuthorDetails.getText();

        Author author = new Author();
        AuthorModel authorModel = new AuthorModel();

        author.setFull_name(full_name);
        author.setLocation(location);
        author.setAge(age);
        author.setDetails(details);
       
        int flag = authorModel.save(author);
        if(flag == 1)
        {
            JOptionPane.showMessageDialog(null, "Author added !", "Message", JOptionPane.INFORMATION_MESSAGE);
            clearAllTextFields();
        }
View Full Code Here

TOP

Related Classes of Models.AuthorModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.