# 4
Attached is the code. But please note that it requires a Database Connection and it has no main method since this class is called from another class. Please try and provide us a solution since we are in a critical condition
Thanks in advance
package com.epic.wfm.gui.workOrder;
import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JInternalFrame;
import javax.swing.JScrollPane;
import java.awt.FlowLayout;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Hashtable;
import java.util.Vector;
import com.epic.wfm.util.CommonInfo;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JComboBox;
import javax.swing.JTable;
import javax.swing.JScrollPane;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.JButton;
import javax.swing.ImageIcon;
import javax.swing.JTextArea;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import com.epic.wfm.businessLogic.SystemFault;//This is to check the assignbility
import com.epic.wfm.gui.workOrder.FaultAssign;
import com.epic.wfm.data.Fault;
import com.epic.wfm.data.WorkGroup;
import com.epic.wfm.data.master.CustomerObservation;
import com.epic.wfm.data.master.OPMC;
import com.epic.wfm.data.master.Status;
import com.epic.wfm.data.master.WGCategory;
import com.epic.wfm.gui.MainMDI;
import com.epic.wfm.gui.workOrder.CustomTableCellRenderer;
import com.epic.wfm.gui.workOrder.FaultDocket;
import com.epic.wfm.util.SystemMessage;
import com.epic.wfm.util.log.StackTraceUtil;
import com.epic.wfm.util.log.SysLogger;
import com.epic.wfm.util.ui.ETextField;
import com.epic.wfm.util.ui.JTextFieldFilter;
import com.epic.wfm.util.ui.calendar.JDateChooser;
import javax.swing.table.TableModel;
import java.awt.AWTEvent;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyVetoException;
public class FaultExplorer extends JInternalFrame implements KeyListener, TableModelListener {
private JPanel jContentPane = null;
private JPanel pnlSearch = null;
private JPanel pnlFaultTable = null;
private JPanel pnlBottom = null;
private JScrollPane scpSearchResult = null;
public JTable tblFault = null;
private JLabel lbl1 = null;
private JLabel lbl2 = null;
private JLabel lbl3l = null;
private JLabel lbl4 = null;
private JLabel lblTo = null;
private JLabel jLabel = null;
private JLabel jLabel1 = null;
private JLabel jLabel2 = null;
private JLabel jLabel3 = null;
private JTextField txtFaultid = null;
private JTextField txtExchangeArea= null;
private JTextField txtSubscriberNo = null;
private JTextField txtWorkOrderNo = null;
private JComboBox cmbOpmcCode= null;
private JComboBox cmbStatus = null;
private JTextField txtCabDp = null;
private JButton cmdSearch = null;
private JButton cmdExit = null;
JDateChooser calReportedFrom = null;
JDateChooser calReportedTo= null;
JDateChooser calModifiedTo= null;
JDateChooser calModifiedFrom= null;
//Declaration of user variables
OPMC opmc= null;
Vector tmpAllOpmcVec= null;
Hashtable tmpOpmcHashTable= null; // This Hash table for insert code and description
int counter;
Statusstate= null;
VectortmpAllStateVec= null;
Hashtable tmpStateHashTable= null;
String selectedOpmc = null;
Vector rows,columns= null;// used to set the rows and columns in the table tblFault
public final static long MILLLS_PER_DAY= 86400000;// milliseconds per day.
//Hashtables for the Customer Observations and Status
Hashtable hashCustomerObservation= new Hashtable();
Hashtable hashStatusCode= new Hashtable();
//Vectors for Customer Observations and Status
Vector vecCustomerObservation;
DefaultTableModel tabModel;
// Hash tables for worgroups and workgroupcategories
Hashtable hashWorkgroup= new Hashtable();
WorkGroup workGroup;
Vector vecWorkGroup= new Vector();
Hashtable hashWorkgroupCat= new Hashtable();
WGCategory workGroupCat;
Vector vecWGCategory= new Vector();
private JLabel lblReportedate = null;
private JLabel jLabel4 = null;
private JLabel jLabel5 = null;
private JLabel jLabel6 = null;
private JLabel lblStatusInfo = null;
private JTextField txtFaultType = null;
private JLabel lblFaultRefNo = null;
private ETextField txtfaultrefNo = null;
private JLabel lblcusRefNo = null;
private JTextField txtCusRefNo = null;
private JLabel lblLoop = null;
private JTextField txtLoop = null;
public static JButton cmdAssign = null;
public static JButton cmdView = null;
public static JButton cmdReAssign = null;
private JLabel lblWGCategory = null;
private JLabel lblWG = null;
private JComboBox cmbWGCategory = null;
private JComboBox cmbWG = null;
public FaultExplorer(){
super();
// TODO Auto-generated constructor stub
}
public FaultExplorer(String arg0) {
super(arg0);
// TODO Auto-generated constructor stub
initialize();
}
public FaultExplorer(String arg0, boolean arg1) {
super(arg0, arg1);
// TODO Auto-generated constructor stub
initialize();
}
public FaultExplorer(String arg0, boolean arg1, boolean arg2) {
super(arg0, arg1, arg2);
// TODO Auto-generated constructor stub
initialize();
}
public FaultExplorer(String arg0, boolean arg1, boolean arg2, boolean arg3) {
super(arg0, arg1, arg2, arg3);
// TODO Auto-generated constructor stub
initialize();
}
public FaultExplorer(String arg0, boolean arg1, boolean arg2, boolean arg3,
boolean arg4) {
super(arg0, arg1, arg2, arg3, arg4);
// TODO Auto-generated constructor stub
initialize();
opmc= new OPMC();
state= new Status();
workGroup= new WorkGroup();
workGroupCat= new WGCategory();
CustomerObservationtmpCusObser= new CustomerObservation();
try
{
tmpAllStateVec= state.getStatusByCategory("WKOD");
tmpAllOpmcVec= CommonInfo.getactOPMCVect();
vecCustomerObservation= tmpCusObser.getAllCustomerObservations();
}
catch (SQLException e)
{
SysLogger.logError(java.util.logging.Level.SEVERE, this.toString(), "FaultExplorer()", StackTraceUtil.getStackTrace(e));
e.printStackTrace();
}
catch (Exception e)
{
SysLogger.logError(java.util.logging.Level.SEVERE, this.toString(), "FaultExplorer()", StackTraceUtil.getStackTrace(e));
e.printStackTrace();
}
tmpOpmcHashTable= new Hashtable();
tmpStateHashTable= new Hashtable();
cmbOpmcCode.addItem("--Select OPMC--");
String tmpOpmc= null;
for(int i=0;i<tmpAllOpmcVec.size() ;i++)
{
OPMC currentOPMC= (OPMC) tmpAllOpmcVec.elementAt(i);
String tmpOPMCCode= currentOPMC.getOPMCCode();
String tmpDescription= currentOPMC.getDescription();
tmpOpmcHashTable.put(tmpDescription,tmpOPMCCode);
tmpOpmc = tmpOPMCCode;
cmbOpmcCode.addItem(tmpDescription);
}
cmbStatus.addItem("--Select Status--");
for(int i=0;i<tmpAllStateVec.size() ;i++)
{
Status currentState= (Status) tmpAllStateVec.elementAt(i);
String tmpStatusCode= currentState.getStatusCode();
String tmpDescription= currentState.getDescription();
tmpStateHashTable.put(tmpDescription,tmpStatusCode);
hashStatusCode.put(tmpStatusCode,tmpDescription);
cmbStatus.addItem(tmpDescription);
}
for(int i=0;i<vecCustomerObservation.size() ;i++)
{
CustomerObservation currentState= (CustomerObservation) vecCustomerObservation.elementAt(i);
String tmpStatusCode= currentState.getCustomerObservationCode();
String tmpDescription= currentState.getDescription();
hashCustomerObservation.put(tmpStatusCode,tmpDescription);
}
try
{
vecWorkGroup= workGroup.allWorkGroupByOPMCObj(tmpOpmc);
vecWGCategory= workGroupCat.getAllWGCategories();
cmbWGCategory.addItem("--Select WG Category--");
for(int i=0;i<vecWGCategory.size() ;i++)
{
WGCategory currentState= (WGCategory) vecWGCategory.elementAt(i);
String desc= currentState.getDescription();
String code= currentState.getWGCCode();
if(!desc.equals("DEFXXX"))
{
hashWorkgroupCat.put(desc,code);
cmbWGCategory.addItem(desc);
}
}
//If the user role is MDF get the mdf category and disable the combo box
if(CommonInfo.userLevel.equals("MD"))
{
cmbWGCategory.setSelectedItem("MDF Workgroup");
cmbWGCategory.setEnabled(false);
}
//If the user role is overHead get the mdf category and disable the combo box
if(CommonInfo.userLevel.equals("OH"))
{
cmbWGCategory.setSelectedItem("Overhead Workgroup");
cmbWGCategory.setEnabled(false);
}
if(CommonInfo.userLevel.equals("UG"))
{
cmbWGCategory.setSelectedItem("Undergroup Workgroup");
cmbWGCategory.setEnabled(false);
}
if(CommonInfo.userLevel.equals("EX"))
{
cmbWGCategory.setSelectedItem("Exchange Workgroup");
cmbWGCategory.setEnabled(false);
}
if(CommonInfo.userLevel.equals("CD"))
{
cmbWGCategory.setSelectedItem("CDMA Workgroup");
cmbWGCategory.setEnabled(false);
}
if(CommonInfo.userLevel.equals("IS"))
{
cmbWGCategory.setSelectedItem("ISDN Workgroup");
cmbWGCategory.setEnabled(false);
}
if(CommonInfo.userLevel.equals("AD"))
{
cmbWGCategory.setSelectedItem("ADSL Workgroup");
cmbWGCategory.setEnabled(false);
}
if(CommonInfo.userLevel.equals("PO"))
{
cmbWGCategory.setSelectedItem("Power Workgroup");
cmbWGCategory.setEnabled(false);
}
if(CommonInfo.userLevel.equals("TX"))
{
cmbWGCategory.setSelectedItem("Transmission Workgroup");
cmbWGCategory.setEnabled(false);
}
if(CommonInfo.userLevel.equals("RA"))
{
cmbWGCategory.setSelectedItem("Radio Workgroup");
cmbWGCategory.setEnabled(false);
}
if(CommonInfo.userLevel.equals("OT"))
{
cmbWGCategory.setSelectedItem("Other");
cmbWGCategory.setEnabled(false);
}
//
cmbWG.addItem("--Select WorkGroup--");
for(int i=0;i<vecWorkGroup.size() ;i++)
{
WorkGroup currentState= (WorkGroup) vecWorkGroup.elementAt(i);
String desc= currentState.getDescription();
String code= currentState.getWGCode();
if(!desc.equals("DEFXXX"))
{
hashWorkgroup.put(desc,code);
cmbWG.addItem(desc);
}
}
}
catch (SQLException e)
{
SysLogger.logError(java.util.logging.Level.SEVERE, this.toString(), "FaultExplorer()", StackTraceUtil.getStackTrace(e));
e.printStackTrace();
}
catch (Exception e)
{
SysLogger.logError(java.util.logging.Level.SEVERE, this.toString(), "FaultExplorer()", StackTraceUtil.getStackTrace(e));
e.printStackTrace();
}
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
++MainMDI.openFrameCount;
this.setBounds(new java.awt.Rectangle(0,0,599,608));
this.setContentPane(getJContentPane());
setLocation(MainMDI.X_OFFSET*MainMDI.openFrameCount, MainMDI.Y_OFFSET*MainMDI.openFrameCount+MainMDI.ADD_MARGIN);
this.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter() {
public void internalFrameClosed(javax.swing.event.InternalFrameEvent e) {
MainMDI.openFrameCount--;
MainMDI.cmdFaultExplorer.setEnabled(true);
MainMDI.mnuFaultExplorer.setEnabled(true);
}
});
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.add(getPnlSearch(), null);
jContentPane.add(getPnlFaultTable(), null);
jContentPane.add(getPnlBottom(), null);
}
return jContentPane;
}
/**
* This method initializes pnlSearch
*
* @return javax.swing.JPanel
*/
private JPanel getPnlSearch() {
if (pnlSearch == null) {
lblWG = new JLabel();
lblWG.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11));
lblWG.setLocation(new java.awt.Point(20,175));
lblWG.setSize(new java.awt.Dimension(100,22));
lblWG.setText("Work Group");
lblWGCategory = new JLabel();
lblWGCategory.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11));
lblWGCategory.setLocation(new java.awt.Point(20,149));
lblWGCategory.setSize(new java.awt.Dimension(100,22));
lblWGCategory.setText("Work Category");
lblLoop = new JLabel();
lblLoop.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11));
lblLoop.setSize(new java.awt.Dimension(100,22));
lblLoop.setLocation(new java.awt.Point(292,150));
lblLoop.setText("Loop");
lblcusRefNo = new JLabel();
lblcusRefNo.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11));
lblcusRefNo.setLocation(new java.awt.Point(20,95));
lblcusRefNo.setSize(new java.awt.Dimension(100,22));
lblcusRefNo.setText("Customer Ref No");
lblFaultRefNo = new JLabel();
lblFaultRefNo.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11));
lblFaultRefNo.setSize(new java.awt.Dimension(100,22));
lblFaultRefNo.setLocation(new java.awt.Point(20,41));
lblFaultRefNo.setText("Fault Ref No");
jLabel6 = new JLabel();
jLabel6.setMaximumSize(new Dimension(72, 14));
jLabel6.setMinimumSize(new Dimension(72, 14));
jLabel6.setText("To:");
jLabel6.setSize(new java.awt.Dimension(17,22));
jLabel6.setLocation(new java.awt.Point(291,234));
jLabel6.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11));
jLabel5 = new JLabel();
jLabel5.setMaximumSize(new java.awt.Dimension(72,14));
jLabel5.setMinimumSize(new java.awt.Dimension(72,14));
jLabel5.setText("To:");
jLabel5.setSize(new java.awt.Dimension(19,22));
jLabel5.setLocation(new java.awt.Point(291,207));
jLabel5.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11));
jLabel4 = new JLabel();
jLabel4.setMaximumSize(new java.awt.Dimension(72,14));
jLabel4.setMinimumSize(new java.awt.Dimension(72,14));
jLabel4.setText("Modifed Date From:");
jLabel4.setSize(new java.awt.Dimension(100,22));
jLabel4.setLocation(new java.awt.Point(19,233));
jLabel4.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11));
lblReportedate = new JLabel();
lblReportedate.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11));
lblReportedate.setMaximumSize(new java.awt.Dimension(72,14));
lblReportedate.setMinimumSize(new java.awt.Dimension(72,14));
lblReportedate.setSize(new java.awt.Dimension(100,22));
lblReportedate.setLocation(new java.awt.Point(19,206));
lblReportedate.setText("Reported From:");
jLabel3 = new JLabel();
jLabel3.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11));
jLabel3.setLocation(new java.awt.Point(292,123));
jLabel3.setSize(new java.awt.Dimension(100,22));
jLabel3.setText("CAB/ DP");
jLabel2 = new JLabel();
jLabel2.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11));
jLabel2.setSize(new java.awt.Dimension(100,22));
jLabel2.setLocation(new java.awt.Point(292,69));
jLabel2.setText("Status");
jLabel1 = new JLabel();
jLabel1.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11));
jLabel1.setSize(new java.awt.Dimension(100,22));
jLabel1.setLocation(new java.awt.Point(292,42));
jLabel1.setText("OPMC Code");
jLabel = new JLabel();
jLabel.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11));
jLabel.setLocation(new java.awt.Point(292,15));
jLabel.setSize(new java.awt.Dimension(114,22));
jLabel.setText("Customer Observation");
lbl4 = new JLabel();
lbl4.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11));
lbl4.setLocation(new java.awt.Point(20,68));
lbl4.setSize(new java.awt.Dimension(100,22));
lbl4.setText("Work Order No");
lbl3l = new JLabel();
lbl3l.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11));
lbl3l.setSize(new java.awt.Dimension(100,22));
lbl3l.setLocation(new java.awt.Point(20,122));
lbl3l.setForeground(new java.awt.Color(51,51,51));
lbl3l.setText("Subscriber No");
lbl2 = new JLabel();
lbl2.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11));
lbl2.setSize(new java.awt.Dimension(100,22));
lbl2.setLocation(new java.awt.Point(292,96));
lbl2.setText("Exchange Area");
lbl1 = new JLabel();
lbl1.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11));
lbl1.setLocation(new java.awt.Point(20,14));
lbl1.setSize(new java.awt.Dimension(100,22));
lbl1.setText("Fault Id");
pnlSearch = new JPanel();
pnlSearch.setLayout(null);
pnlSearch.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
pnlSearch.setSize(new java.awt.Dimension(582,299));
pnlSearch.setLocation(new java.awt.Point(4,5));
pnlSearch.add(lbl1, null);
pnlSearch.add(lbl2, null);
pnlSearch.add(lbl3l, null);
pnlSearch.add(lbl4, null);
pnlSearch.add(jLabel, null);
pnlSearch.add(jLabel1, null);
pnlSearch.add(jLabel2, null);
pnlSearch.add(jLabel3, null);
pnlSearch.add(getTxtFaultid(), null);
pnlSearch.add(getTxtExchangeArea(), null);
pnlSearch.add(getTxtSubscriberNo(), null);
pnlSearch.add(getTxtWorkOrderNo(), null);
pnlSearch.add(getCmbOpmcCode(), null);
pnlSearch.add(getCmbStatus(), null);
pnlSearch.add(getTxtCabDp(), null);
pnlSearch.add(getCmdSearch(), null);
calReportedFrom = new JDateChooser();
calReportedFrom.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11));
calReportedFrom.setLocation(new java.awt.Point(124,206));
calReportedFrom.setSize(new java.awt.Dimension(150,23));
pnlSearch.add(calReportedFrom);
calModifiedFrom = new JDateChooser();
calModifiedFrom.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11));
calModifiedFrom.setLocation(new java.awt.Point(124,233));
calModifiedFrom.setSize(new java.awt.Dimension(150,23));
pnlSearch.add(calModifiedFrom);
//pnlSearch.add(lblTo, null);
calReportedTo = new JDateChooser();
calReportedTo.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11));
calReportedTo.setSize(new java.awt.Dimension(150,22));
calReportedTo.setLocation(new java.awt.Point(406,207));
pnlSearch.add(calReportedTo);
calModifiedTo = new JDateChooser();
calModifiedTo.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11));
calModifiedTo.setSize(new java.awt.Dimension(150,22));
calModifiedTo.setLocation(new java.awt.Point(407,234));
pnlSearch.add(calModifiedTo);
pnlSearch.add(lblReportedate, null);
pnlSearch.add(jLabel4, null);
pnlSearch.add(jLabel5, null);
pnlSearch.add(jLabel6, null);
pnlSearch.add(getTxtFaultType(), null);
pnlSearch.add(lblFaultRefNo, null);
pnlSearch.add(getETextField(), null);
pnlSearch.add(lblcusRefNo, null);
pnlSearch.add(getTxtCusRefNo(), null);
pnlSearch.add(lblLoop, null);
pnlSearch.add(getTxtLoop(), null);
pnlSearch.add(lblWGCategory, null);
pnlSearch.add(lblWG, null);
pnlSearch.add(getCmbWGCategory(), null);
pnlSearch.add(getCmbWG(), null);
}
return pnlSearch;
}
/**
* This method initializes pnlFaultTable
*
* @return javax.swing.JPanel
*/
private JPanel getPnlFaultTable() {
if (pnlFaultTable == null) {
pnlFaultTable = new JPanel();
pnlFaultTable.setLayout(null);
pnlFaultTable.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
pnlFaultTable.setSize(new java.awt.Dimension(582,215));
pnlFaultTable.setLocation(new java.awt.Point(4,308));
pnlFaultTable.add(getScpSearchResult(), null);
}
return pnlFaultTable;
}
/**
* This method initializes pnlBottom
*
* @return javax.swing.JPanel
*/
private JPanel getPnlBottom() {
if (pnlBottom == null) {
lblStatusInfo = new JLabel();
lblStatusInfo.setBounds(new java.awt.Rectangle(8,10,130,19));
lblStatusInfo.setFont(new Font("Tahoma", Font.BOLD, 11));
lblStatusInfo.setForeground(new Color(21, 102, 150));
lblStatusInfo.setText("");
lblStatusInfo.setName("lblStatusInfo");
lblStatusInfo.setBackground(Color.white);
lblStatusInfo.setVisible(false);
pnlBottom = new JPanel();
pnlBottom.setLayout(null);
pnlBottom.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 12));
pnlBottom.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
pnlBottom.setSize(new java.awt.Dimension(582,41));
pnlBottom.setLocation(new java.awt.Point(4,527));
pnlBottom.add(getCmdExit(), null);
pnlBottom.add(lblStatusInfo, null);
pnlBottom.add(getCmdAssign(), null);
pnlBottom.add(getCmdView(), null);
pnlBottom.add(getCmdReAssign(), null);
}
return pnlBottom;
}
/**
* This method initializes scpSearchResult
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getScpSearchResult() {
if (scpSearchResult == null) {
scpSearchResult = new JScrollPane();
scpSearchResult.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11));
scpSearchResult.setSize(new java.awt.Dimension(574,208));
scpSearchResult.setLocation(new java.awt.Point(4,4));
scpSearchResult.setViewportView(getTblFault());
}
return scpSearchResult;
}
/**
* This method initializes tblFault
*
* @return javax.swing.JTable
*/
private JTable getTblFault()
{
if (tblFault == null)
{
rows= new Vector();
columns= new Vector();
// column names of the table
String[] columnNames = { "Fault ID",
"Customer Observation",
"Status",
"Subscriber No",
"Exchange Area",
"Reported Date" ,"OPMC"};
addColumns(columnNames);
// create a table model
tabModel=new DefaultTableModel(){
public boolean isCellEditable(int rowIndex, int mColIndex) {
return false;
}
};
tabModel.setDataVector(rows,columns);
// crate the table using the "tabModel"
tblFault = new JTable(tabModel);
tblFault.setAutoCreateColumnsFromModel(false);
tblFault.getModel().addTableModelListener(this);
tblFault.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
tblFault.setGridColor(new java.awt.Color(153,153,153));
tblFault.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11));
tblFault.setEnabled(true);
TableCellRenderer cell = new CustomTableCellRenderer();
tblFault.setDefaultRenderer( Object.class, cell );
tblFault.setRowSelectionAllowed(true);
tblFault.getTableHeader().setReorderingAllowed(false);
tblFault.addMouseListener(new java.awt.event.MouseAdapter()
{
public void mouseClicked(java.awt.event.MouseEvent e)
{
if (tblFault.getSelectedRowCount()> 0 )
{
int noOfSelected = tblFault.getSelectedRowCount();
if (noOfSelected == 1)
{
if(CommonInfo.getUserLevel().equals("ADM"))
{
cmdAssign.setEnabled(true);
cmdReAssign.setEnabled(true);
}
cmdView.setEnabled(true);
}
}
}
});
tblFault.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
public void mouseDragged(java.awt.event.MouseEvent e)
{
}
});
tblFault.addFocusListener(new java.awt.event.FocusAdapter()
{
public void focusLost(java.awt.event.FocusEvent e)
{
tblFault.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
}
});
JTableHeader header = tblFault.getTableHeader();
//final Font boldFont = header.getFont().deriveFont(Font.BOLD);
final TableCellRenderer headerRenderer = header.getDefaultRenderer();
header.setDefaultRenderer( new TableCellRenderer() {
public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column ) {
Component comp = headerRenderer.getTableCellRendererComponent( table, value, isSelected, hasFocus, row, column );
//if ( column == 2 )
comp.setFont(new java.awt.Font("Tahoma", java.awt.Font.BOLD, 11));
return comp;
}
});
// set column width
int vColIndexFid = 0;
TableColumn colFid = tblFault.getColumnModel().getColumn(vColIndexFid);
int widthFid = 75;
colFid.setPreferredWidth(widthFid);
int vColIndexFType = 1;
TableColumn colFType = tblFault.getColumnModel().getColumn(vColIndexFType);
int widthFType = 120;
colFType.setPreferredWidth(widthFType);
int vColIndexFStatus=2;
TableColumn colFStatus = tblFault.getColumnModel().getColumn(vColIndexFStatus);
int widthFStatus = 105;
colFStatus.setPreferredWidth(widthFStatus);
int vColIndexSubNo = 3;
TableColumn colSubNo = tblFault.getColumnModel().getColumn(vColIndexSubNo);
int widthSubNo = 105;
colSubNo.setPreferredWidth(widthSubNo);
int vColIndexEArea = 4;
TableColumn colEArea = tblFault.getColumnModel().getColumn(vColIndexEArea);
int widthEArea = 105;
colEArea.setPreferredWidth(widthEArea);
int vColIndexRDate = 5;
TableColumn colRDate = tblFault.getColumnModel().getColumn(vColIndexRDate);
int widthRDate = 132;
colRDate.setPreferredWidth(widthRDate);
}
return tblFault;
}
/**
* This method initializes txtFaultid
*
* @return javax.swing.JTextField
*/
private JTextField getTxtFaultid() {
if (txtFaultid == null) {
txtFaultid = new ETextField(9);
txtFaultid.setLocation(new java.awt.Point(125,14));
txtFaultid.setSize(new java.awt.Dimension(150,22));
txtFaultid.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11));
txtFaultid.setDocument(new JTextFieldFilter(JTextFieldFilter.NUMERIC));
}
return txtFaultid;
}
/**
* This method initializes txtExchangeArea
*
* @return javax.swing.JTextField
*/
private JTextField getTxtExchangeArea() {
if (txtExchangeArea == null) {
txtExchangeArea = new ETextField(6);
txtExchangeArea.setLocation(new java.awt.Point(407,96));
txtExchangeArea.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11));
txtExchangeArea.setSize(new java.awt.Dimension(150,22));
}
return txtExchangeArea;
}
/**
* This method initializes txtSubscriberNo
*
* @return javax.swing.JTextField
*/
private JTextField getTxtSubscriberNo() {
if (txtSubscriberNo == null) {
txtSubscriberNo = new ETextField(15);
txtSubscriberNo.setLocation(new java.awt.Point(125,122));
txtSubscriberNo.setSize(new java.awt.Dimension(150,22));
txtSubscriberNo.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11));
txtSubscriberNo.setDocument(new JTextFieldFilter(JTextFieldFilter.NUMERIC));
}
return txtSubscriberNo;
}
/**
* This method initializes txtWorkOrderNo
*
* @return javax.swing.JTextField
*/
private JTextField getTxtWorkOrderNo() {
if (txtWorkOrderNo == null) {
txtWorkOrderNo = new ETextField(40);
txtWorkOrderNo.setLocation(new java.awt.Point(125,68));
txtWorkOrderNo.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11));
txtWorkOrderNo.setSize(new java.awt.Dimension(150,22));
}
return txtWorkOrderNo;
}
/**
* This method initializes cmbOpmcCode
*
* @return javax.swing.JComboBox
*/
private JComboBox getCmbOpmcCode() {
if (cmbOpmcCode == null) {
cmbOpmcCode = new JComboBox();
cmbOpmcCode.setLocation(new java.awt.Point(407,42));
cmbOpmcCode.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11));
cmbOpmcCode.setSize(new java.awt.Dimension(150,22));
}
return cmbOpmcCode;
}
/**
* This method initializes cmbStatus
*
* @return javax.swing.JComboBox
*/
private JComboBox getCmbStatus() {
if (cmbStatus == null) {
cmbStatus = new JComboBox();
cmbStatus.setLocation(new java.awt.Point(407,69));
cmbStatus.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11));
cmbStatus.setSize(new java.awt.Dimension(150,22));
}
return cmbStatus;
}
/**
* This method initializes txtCabDp
*
* @return javax.swing.JTextField
*/
private JTextField getTxtCabDp() {
if (txtCabDp == null) {
txtCabDp = new ETextField(20);
txtCabDp.setLocation(new java.awt.Point(407,123));
txtCabDp.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11));
txtCabDp.setSize(new java.awt.Dimension(150,22));
}
return txtCabDp;
}
/**
* This method initializes cmdSearch
*
* @return javax.swing.JButton
*/
private JButton getCmdSearch() {
if (cmdSearch == null) {
cmdSearch = new JButton();
cmdSearch.setFont(new java.awt.Font("Tahoma", java.awt.Font.BOLD, 11));
cmdSearch.setLocation(new java.awt.Point(407,265));
cmdSearch.setSize(new java.awt.Dimension(150,22));
cmdSearch.setIcon(new ImageIcon(getClass().getResource("/images/search.gif")));
cmdSearch.setText("Search Faults");
cmdSearch.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent e)
{
tblFault.tableChanged(new TableModelEvent(tblFault.getModel()));
actionSearch(0);
}
});
}
return cmdSearch;
}
/**
* This method initializes cmdExit
*
* @return javax.swing.JButton
*/
private JButton getCmdExit() {
if (cmdExit == null) {
cmdExit = new JButton();
cmdExit.setText("Exit");
cmdExit.setSize(new java.awt.Dimension(100,22));
cmdExit.setFont(new java.awt.Font("Tahoma", java.awt.Font.BOLD, 11));
cmdExit.setLocation(new java.awt.Point(470,9));
cmdExit.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent e)
{
MainMDI.cmdFaultExplorer.setEnabled(true);
MainMDI.mnuFaultExplorer.setEnabled(true);
dispose();
System.gc();
}
});
}
return cmdExit;
}
public void actionSearch(int tmpstatus)
{
//Declaration of user variables for search operatrion
int faultId= -1;
String faultType= null;
String exchangeArea= null;
String oPMCCode= null;
String subNo= null;
String status= null;
String workOrderNo= null;
String cabDP= null;
String faultRefNo= null;
String cusRefNo= null;
String loop= null;
String workGroup= null;
String workGroupCat= null;
rows.removeAllElements();
tblFault.removeNotify();
try
{
if (txtFaultid.getText().length() != 0){
faultId= Integer.parseInt(txtFaultid.getText());
}
if (txtExchangeArea.getText().length() != 0){
exchangeArea= txtExchangeArea.getText();
}
if (cmbOpmcCode.getSelectedIndex() != 0){
oPMCCode= (String) tmpOpmcHashTable.get(cmbOpmcCode.getSelectedItem());
}
if (txtSubscriberNo.getText().length() != 0){
subNo= txtSubscriberNo.getText();
}
if (cmbStatus.getSelectedIndex() != 0){
status= (String) tmpStateHashTable.get(cmbStatus.getSelectedItem());;
}
if(txtWorkOrderNo.getText().length() != 0 )
{
workOrderNo=txtWorkOrderNo.getText();
}
if(txtCabDp.getText().length() != 0)
{
cabDP=txtCabDp.getText();
}
if(txtFaultType.getText().length() !=0)
{
faultType =txtFaultType.getText();
}
if(txtfaultrefNo.getText().length() != 0)
{
faultRefNo = txtfaultrefNo.getText();
}
if(txtCusRefNo.getText().length() !=0)
{
cusRefNo= txtCusRefNo.getText();
}
if(txtLoop.getText().length() !=0)
{
loop= txtLoop.getText();
}
if(cmbWG.getSelectedIndex() !=0)
{
workGroup=(String) hashWorkgroup.get(cmbWG.getSelectedItem());
}
if(cmbWGCategory.getSelectedIndex() !=0)
{
workGroupCat=(String) hashWorkgroupCat.get(cmbWGCategory.getSelectedItem());
}
// define the date format
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
// get the reported from date selected in the calendar
String dayReportedFrom = sdf.format(calReportedFrom.getDate());
// get the reported to date selected in the calendar and add a one day to that value.
Date to= calReportedTo.getDate();
long time= to.getTime()+MILLLS_PER_DAY;
Date newTo= new Date(time);
String dayReportedTo = sdf.format(newTo);
// get the modified from date selected in the calendar
String dayModifiedFrom = sdf.format(calModifiedFrom.getDate());
// get the modified to date selected in the calendar and add a one day to that value.
Date mto= calModifiedTo.getDate();
long mtime= mto.getTime()+MILLLS_PER_DAY;
Date newMTo= new Date(mtime);
String dayModifiedTo = sdf.format(newMTo);
addRow(faultId,faultRefNo,faultType,cusRefNo,exchangeArea,oPMCCode,subNo,status,loop,workOrderNo,cabDP,dayReportedFrom,dayReportedTo,dayModifiedFrom,dayModifiedTo,workGroup,workGroupCat,tmpstatus);
cmdView.setEnabled(false);
cmdAssign.setEnabled(false);
cmdReAssign.setEnabled(false);
}
catch (Exception ee)
{
SysLogger.logError(java.util.logging.Level.SEVERE, this.toString(), "actionSearch()", StackTraceUtil.getStackTrace(ee));
ee.printStackTrace();
JOptionPane.showMessageDialog(null,SystemMessage.DEFAULT_ERROR,"Error in loading table",JOptionPane.ERROR_MESSAGE);
}
}
public void addRow(int tmpFaultId,
String tmpFaultRefNo,
String tmpFaultType,
String tmpCusRefNo,
String tmpExchangeArea,
String tmpOPMCCode,
String tmpSubNo,
String tmpStatus,
String tmpLoop,
String tmpWorkOrderNo,
String tmpCabDP,
String tmpDayReportedFrom,
String tmpDayReportedTo,
String tmpDayModifiedFrom,
String tmpdayModifiedTo,
String tmpWorkGroup,
String tmpWGCategory,int tmpstatus
)
{
// remove the all current rows to add the new rows
rows.removeAllElements();
tblFault.removeNotify();
// initailize the variables
Fault fault= new Fault();
Vector r = new Vector();
Vectorv= new Vector();
Vector tmpWg= new Vector();
WorkGroup tmpWgObj= new WorkGroup();
try
{
tmpWg= tmpWgObj.getAllWorkGroupByCategory(tmpWGCategory);
v= fault.searchFault(tmpFaultId, tmpFaultRefNo, tmpFaultType, tmpCusRefNo, tmpSubNo,tmpExchangeArea,tmpOPMCCode,tmpStatus,tmpCabDP,null,tmpLoop,tmpWorkOrderNo,tmpDayReportedFrom,tmpDayReportedTo,tmpDayModifiedFrom,tmpdayModifiedTo,tmpWorkGroup,tmpWg);
if( v.size() ==0 )
{
if(tmpstatus == 0)
{
JOptionPane.showMessageDialog(this,SystemMessage.NO_REC_FOUND, "No Records",JOptionPane.INFORMATION_MESSAGE);
}
}
for(int i=0; i < v.size(); i++)
{
Fault f= (Fault) v.elementAt(i);
Vector tempVec= new Vector();
// define the date format "yyyy-MM-dd 'at' HH-mm"
SimpleDateFormat sdf1 = new SimpleDateFormat(
"yyyy-MM-dd 'at' HH:mm");
// get the from date selected in the calendar
String dateTime = sdf1.format(f.getReportedDateTime());
tempVec.addElement(f.getFaultId());
tempVec.addElement((String)hashCustomerObservation.get(f.getFaultType()));
tempVec.addElement((String)hashStatusCode.get(f.getStatusCode()));
tempVec.addElement(f.getSubscriberNum());
tempVec.addElement(f.getExchangeArea());
tempVec.addElement(dateTime);
tempVec.addElement(f.getOpmcCode());
r.addElement(tempVec);
}
// add the fault information to the row vector
for (int j = 0; j < r.size(); j++)
{
rows.addElement((Vector)r.elementAt(j));
}
lblStatusInfo.setVisible(true);
lblStatusInfo.setText("Found"+String.valueOf(r.size())+" Record(s)");
counter++;
// rearrange the new table
tblFault.addNotify();
}
catch (SQLException e)
{
SysLogger.logError(java.util.logging.Level.SEVERE, this.toString(), "addRow()", StackTraceUtil.getStackTrace(e));
JOptionPane.showMessageDialog(this,SystemMessage.NO_LOCAL_CONNECTION,"Error Searching",JOptionPane.ERROR_MESSAGE);
e.printStackTrace();
}
catch (Exception e)
{
SysLogger.logError(java.util.logging.Level.SEVERE, this.toString(), "addRow()", StackTraceUtil.getStackTrace(e));
JOptionPane.showMessageDialog(this,SystemMessage.NO_LOCAL_CONNECTION,"Error Searching",JOptionPane.ERROR_MESSAGE);
e.printStackTrace();
}
}
/** *
* @DescThis method used to add table colunms
* @return void
*
*/
public void addColumns(String[] colName)
{
for(int i=0;i<colName.length;i++)
columns.addElement((String) colName[i]);
}
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
}
public void tableChanged(TableModelEvent arg0) {
// TODO Auto-generated method stub
}
/**
* This method initializes txtFaultType
*
* @return javax.swing.JTextField
*/
private JTextField getTxtFaultType() {
if (txtFaultType == null) {
txtFaultType = new ETextField(50);
txtFaultType.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11));
txtFaultType.setLocation(new java.awt.Point(407,15));
txtFaultType.setSize(new java.awt.Dimension(150,22));
}
return txtFaultType;
}
/**
* This method initializes eTextField
*
* @return com.epic.wfm.util.ui.ETextField
*/
private ETextField getETextField() {
if (txtfaultrefNo == null) {
txtfaultrefNo = new ETextField(15);
txtfaultrefNo.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11));
txtfaultrefNo.setLocation(new java.awt.Point(125,41));
txtfaultrefNo.setSize(new java.awt.Dimension(150,22));
txtfaultrefNo.setDocument(new JTextFieldFilter(JTextFieldFilter.NUMERIC));
}
return txtfaultrefNo;
}
/**
* This method initializes txtCusRefNo
*
* @return javax.swing.JTextField
*/
private JTextField getTxtCusRefNo() {
if (txtCusRefNo == null) {
txtCusRefNo = new ETextField(20);
txtCusRefNo.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11));
txtCusRefNo.setSize(new java.awt.Dimension(150,22));
txtCusRefNo.setLocation(new java.awt.Point(125,95));
}
return txtCusRefNo;
}
/**
* This method initializes txtLoop
*
* @return javax.swing.JTextField
*/
private JTextField getTxtLoop() {
if (txtLoop == null) {
txtLoop = new ETextField(25);
txtLoop.setLocation(new java.awt.Point(407,150));
txtLoop.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11));
txtLoop.setSize(new java.awt.Dimension(150,22));
}
return txtLoop;
}
/**
* This method initializes cmdAssign
*
* @return javax.swing.JButton
*/
private JButton getCmdAssign() {
if (cmdAssign == null) {
cmdAssign = new JButton();
cmdAssign.setText("Assign");
cmdAssign.setSize(new java.awt.Dimension(100,22));
cmdAssign.setFont(new java.awt.Font("Tahoma", java.awt.Font.BOLD, 11));
cmdAssign.setEnabled(false);
cmdAssign.setLocation(new java.awt.Point(256,9));
cmdAssign.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent e)
{
try
{
SystemFault tmpSysfault= new SystemFault();
boolean assignable= tmpSysfault.checkAssignable(tblFault, tblFault.getSelectedRows());
assignFault(e,assignable);
}
catch(Exception exp)
{
SysLogger.logError(java.util.logging.Level.SEVERE, this.toString(), "actionReassign()", StackTraceUtil.getStackTrace(exp));
}
}
});
}
return cmdAssign;
}
/**
* @author Manjula Illangasekara
* @param Boolean
* @date 2006-11-06
* @Desc This is to redirect to the FaultAssign Frame with the selected Table value
*/
protected void assignFault(ActionEvent evt,boolean assignable)
{
if (assignable)
{
FaultAssign faultAssignObj = new FaultAssign(this,"Assign Fault",false,true,false,false);
faultAssignObj.setVisible(true);
MainMDI.dkpDesktop.add(faultAssignObj);
cmdAssign.setEnabled(false);
cmdReAssign.setEnabled(false);
try {
faultAssignObj.setSelected(true);
setEnabled(false);
int selecttedIndex[] = tblFault.getSelectedRows();
faultAssignObj.faultId= new int[selecttedIndex.length];
faultAssignObj.selectedOpmcCode= new String[selecttedIndex.length];
//faultAssignObj.selectedOpmcCode= new int[selecttedIndex.length];
for (int i = 0; i>< selecttedIndex.length ; i++)
{
Object tmpObj= tblFault.getValueAt(selecttedIndex[i], 0);
faultAssignObj.faultId[i]= Integer.parseInt(tmpObj.toString());
}
for (int i = 0; i< selecttedIndex.length ; i++)
{
System.out.println("This is OPMC " + tblFault.getValueAt(selecttedIndex[i], 6));
faultAssignObj.selectedOpmcCode[i]= (String)tblFault.getValueAt(selecttedIndex[i], 6);
}
tblFault.clearSelection();
}
catch (PropertyVetoException e1)
{
SysLogger.logError(java.util.logging.Level.SEVERE, this.toString(), "addRow()", StackTraceUtil.getStackTrace(e1));
e1.printStackTrace();
}
}
else
{
JOptionPane.showMessageDialog(null,SystemMessage.WRONG_FAULT_SELCTION,"Wrong Selection",JOptionPane.WARNING_MESSAGE);
}
}
/**
* @author Manjula Illangasekara
* @param Boolean
* @date 2006-11-06
* @Desc This is to redirect to the Re-FaultAssign Frame with the selected Table value
*/
protected void reAssignFault(ActionEvent evt,boolean assignable)
{
if (assignable)
{
int selecttedIndex1[] = tblFault.getSelectedRows();
//Limit the Reassign for only 10 faults
if(selecttedIndex1.length > 10)
{
JOptionPane.showMessageDialog(null,SystemMessage.WRONG_NO_FAULT_SELCTION,"Wrong Selection",JOptionPane.WARNING_MESSAGE);
}
else
{
//Confirmation
if(JOptionPane.showConfirmDialog(this, "Are you sure you want to re assign the fault?", "ReAssign...", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION)
{
FaultReAssign faultAssignObj = new FaultReAssign(this,"Assign Fault",false,true,false,false);
faultAssignObj.setVisible(true);
MainMDI.dkpDesktop.add(faultAssignObj);
cmdAssign.setEnabled(false);
cmdReAssign.setEnabled(false);
try
{
faultAssignObj.setSelected(true);
setEnabled(false);
int selecttedIndex[] = tblFault.getSelectedRows();
faultAssignObj.faultId= new int[selecttedIndex.length];
faultAssignObj.selectedOpmcCode= new String[selecttedIndex.length];
for (int i = 0; i< selecttedIndex.length ; i++)
{
Object tmpObj= tblFault.getValueAt(selecttedIndex[i], 0);
faultAssignObj.faultId[i]= Integer.parseInt(tmpObj.toString());
}
for (int i = 0; i< selecttedIndex.length ; i++)
{
System.out.println("This is OPMC " + tblFault.getValueAt(selecttedIndex[i], 6));
faultAssignObj.selectedOpmcCode[i]= (String)tblFault.getValueAt(selecttedIndex[i], 6);
}
tblFault.clearSelection();
}
catch (PropertyVetoException e1)
{
SysLogger.logError(java.util.logging.Level.SEVERE, this.toString(), "addRow()", StackTraceUtil.getStackTrace(e1));
e1.printStackTrace();
}
}
}
}
else
{
JOptionPane.showMessageDialog(null,SystemMessage.WRONG_FAULT_SELCTION1,"Wrong Selection",JOptionPane.WARNING_MESSAGE);
}
}
/**
* This method initializes cmdView
*
* @return javax.swing.JButton
*/
private JButton getCmdView() {
if (cmdView == null) {
cmdView = new JButton();
cmdView.setLocation(new java.awt.Point(363,9));
cmdView.setText("View");
cmdView.setFont(new java.awt.Font("Tahoma", java.awt.Font.BOLD, 11));
cmdView.setEnabled(false);
cmdView.setSize(new java.awt.Dimension(100,22));
cmdView.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
actionView(e);; // TODO Auto-generated Event stub actionPerformed()
}
});
}
return cmdView;
}
protected void actionView(ActionEvent evnt)
{
try
{
// TODO Auto-generated method stub
int selectedIndex= tblFault.getSelectedRow();
String selectedFault = tblFault.getModel().getValueAt(selectedIndex, 0).toString();
selectedOpmc = tblFault.getModel().getValueAt(selectedIndex, 6).toString();
int SelFaultId = Integer.parseInt(selectedFault);
FaultDocket fd = new FaultDocket(this,tblFault,"",false,true,false,false,SelFaultId,selectedOpmc);
fd.setVisible(true);
//fd.setValues(tbl);
MainMDI.dkpDesktop.add(fd);
fd.setSelected(true);
setEnabled(false);
tblFault.clearSelection();
}
catch (PropertyVetoException e)
{
SysLogger.logError(java.util.logging.Level.SEVERE, this.toString(), "actionView()", StackTraceUtil.getStackTrace(e));
e.printStackTrace();
}
//fd.setSelected(true);
}
public void keyTyped(KeyEvent arg0)
{
if (String.valueOf(arg0.getKeyChar()).equals("\n"))
{
actionSearch(0);
}
}
public void keyPressed(KeyEvent arg0) {
// TODO Auto-generated method stub
}
public void keyReleased(KeyEvent arg0) {
// TODO Auto-generated method stub
}
/**
* This method initializes cmdReAssign
*
* @return javax.swing.JButton
*/
private JButton getCmdReAssign() {
if (cmdReAssign == null) {
cmdReAssign = new JButton();
cmdReAssign.setBounds(new java.awt.Rectangle(156,8,93,22));
cmdReAssign.setEnabled(false);
cmdReAssign.setFont(new java.awt.Font("Tahoma", java.awt.Font.BOLD, 11));
cmdReAssign.setText("Re-Assign");
cmdReAssign.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent e)
{
try
{
SystemFault tmpSysfault= new SystemFault();
boolean assignable= tmpSysfault.checkReAssignable(tblFault, tblFault.getSelectedRows());
reAssignFault(e,assignable);
}
catch(Exception exp)
{
SysLogger.logError(java.util.logging.Level.SEVERE, this.toString(), "actionReassign()", StackTraceUtil.getStackTrace(exp));
}
}
});
}
return cmdReAssign;
}
/**
* This method initializes cmbWGCategory
*
* @return javax.swing.JComboBox
*/
private JComboBox getCmbWGCategory() {
if (cmbWGCategory == null) {
cmbWGCategory = new JComboBox();
cmbWGCategory.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11));
cmbWGCategory.setSize(new java.awt.Dimension(150,22));
cmbWGCategory.setLocation(new java.awt.Point(125,149));
}
return cmbWGCategory;
}
/**
* This method initializes cmbWG
*
* @return javax.swing.JComboBox
*/
private JComboBox getCmbWG() {
if (cmbWG == null) {
cmbWG = new JComboBox();
cmbWG.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11));
cmbWG.setSize(new java.awt.Dimension(150,22));
cmbWG.setLocation(new java.awt.Point(125,176));
}
return cmbWG;
}
} // @jve:decl-index=0:visual-constraint="10,10"
// @jve:decl-index=0:visual-constraint="10,10"
class CustomTableCellRenderer extends DefaultTableCellRenderer
{
public Component getTableCellRendererComponent( JTable jTable, Object value,boolean isSelected, boolean hasFocus, int row,int col)
{
super.getTableCellRendererComponent(jTable, value, false,true, row, col);
String s = jTable.getModel().getValueAt(row,2).toString();
if(s.equalsIgnoreCase("Not Assigned"))
{
setBackground(new Color(232,136,108));
}
else if(s.equalsIgnoreCase("Assigned"))
{
setBackground(new Color(242,191,176));
}
else if(s.equalsIgnoreCase("Completed"))
{
setBackground(new Color(215,237,183));
}
else if(s.equalsIgnoreCase("In-Progress") || s.equalsIgnoreCase("Received"))
{
setBackground(new Color(188,215,230));
}
else if(s.equalsIgnoreCase("Un-rectified") || s.equalsIgnoreCase("Rejected") )
{
setBackground(new Color(237,55,69));
}
else
{
setBackground(Color.white);
}
return super.getTableCellRendererComponent(jTable, value, isSelected, hasFocus, row, col);
}
}