/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package edu.bellevue.its.migration.gui.frames.security;
import edu.bellevue.its.migration.entities.Generalinfo;
import edu.bellevue.its.migration.entities.Request;
import edu.bellevue.its.migration.global.AppGlobals;
import edu.bellevue.its.migration.global.AppHelper;
import edu.bellevue.its.migration.gui.ButtonColumn;
import edu.bellevue.its.migration.gui.MainApp;
import edu.bellevue.its.migration.gui.frames.UpdateableFrame;
import edu.bellevue.its.migration.gui.frames.developer.EditRequestFrame;
import edu.bellevue.its.migration.gui.frames.developer.EditSecurityOverviewFrame;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.JOptionPane;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
/**
*
* @author tslater
*/
public class SecurityOverviewFrame extends javax.swing.JInternalFrame implements UpdateableFrame{
/**
* Creates new form SecurityOverviewFrame
*/
public SecurityOverviewFrame() {
initComponents();
tblRequests.setRowHeight(25);
ButtonColumn buttonCol = new ButtonColumn(tblRequests, new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
int rowNum = Integer.parseInt(e.getActionCommand());
int requestId = (Integer)tblRequests.getModel().getValueAt(rowNum, 0);
Session session = AppGlobals.getInstance().hibernateSession;
Request r = (Request) session.createCriteria(Request.class).add(Restrictions.eq("idRequest",requestId)).uniqueResult();
EditSecurityOverviewFrame esof = new EditSecurityOverviewFrame(SecurityOverviewFrame.this, r.getSecurityoverview(), true);
MainApp.getDesktop().add(esof);
AppHelper.placeRightOfParent(esof, SecurityOverviewFrame.this);
esof.setVisible(true);
}
}, 6);
}
/**
* 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() {
jScrollPane2 = new javax.swing.JScrollPane();
tblRequests = new javax.swing.JTable();
setClosable(true);
setResizable(true);
setTitle("Requests with Security Required");
tblRequests.setModel(new SecurityRequestTableModel());
jScrollPane2.setViewportView(tblRequests);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 810, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 176, Short.MAX_VALUE)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JTable tblRequests;
// End of variables declaration//GEN-END:variables
@Override
public void updateView() {
throw new UnsupportedOperationException("Not supported yet.");
}
}