query.clear();
query.addText(JUtility.substSchemaName(schemaName, "select * from {schema}APP_PALLET where 1=2"));
query.bindParams();
listStatement = query.getPreparedStatement();
list_despatch = new JList4j();
list_despatch.addListSelectionListener(new ListSelectionListener()
{
public void valueChanged(ListSelectionEvent e)
{
if (list_despatch.getModel().getSize() > 0)
{
if (list_despatch.getSelectedIndex() >= 0)
{
JDBDespatch d = (JDBDespatch) list_despatch.getSelectedValue();
currentdespatchno = d.getDespatchNo();
if (currentdespatchno.equals(previousdespatchno) == false)
{
previousdespatchno = currentdespatchno;
textFieldDespatchLocationFrom.setText(d.getLocationIDFrom());
textFieldDespatchLocationTo.setText(d.getLocationIDTo());
textFieldDespatchStatus.setText(d.getStatus());
if (d.getStatus().equals("Confirmed"))
{
deleteButton.setEnabled(false);
jButtonLookupLocationTo.setEnabled(false);
jButtonLookupLocationFrom.setEnabled(false);
buttonSetUserID.setEnabled(false);
jButtonLookupLoadNo.setEnabled(false);
jButtonLookupTrailer.setEnabled(false);
jButtonLookupHaulier.setEnabled(false);
buttonUnAssign.setEnabled(false);
buttonAssign.setEnabled(false);
newButton.setEnabled(false);
}
else
{
deleteButton.setEnabled(true);
jButtonLookupLocationFrom.setEnabled(true);
buttonSetUserID.setEnabled(true);
jButtonLookupLocationTo.setEnabled(true);
jButtonLookupLoadNo.setEnabled(true);
jButtonLookupTrailer.setEnabled(true);
jButtonLookupHaulier.setEnabled(true);
buttonUnAssign.setEnabled(true);
buttonAssign.setEnabled(true);
newButton.setEnabled(true);
}
try
{
jTextFieldDespatchDate.setText(d.getDespatchDate().toString().substring(0, 19));
}
catch (Exception ee)
{
jTextFieldDespatchDate.setText("N/A");
}
textFieldHaulier.setText(d.getHaulier());
textFieldTrailer.setText(d.getTrailer());
textFieldLoadNo.setText(d.getLoadNo());
textFieldUserID.setText(d.getUserID());
textFieldNoOfPallets.setText(Integer.toString(d.getTotalPallets()));
setConfirmButtonStatus();
setFindButtonStatus(d.getLocationIDFrom());
populateAssignedList(d.getDespatchNo(), "");
clearUnAssignedList();
}
}
else
{
blankDespatchFields();
}
}
else
{
jButtonLookupLocationFrom.setEnabled(false);
buttonSetUserID.setEnabled(false);
jButtonLookupLocationTo.setEnabled(false);
jButtonLookupTrailer.setEnabled(false);
jButtonLookupHaulier.setEnabled(false);
buttonUnAssign.setEnabled(false);
buttonAssign.setEnabled(false);
populateAssignedList("", "");
}
}
});
list_despatch.setCellRenderer(Common.renderer_list);
list_despatch.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
scrollPane.setViewportView(list_despatch);
final JScrollPane scrollPane_1 = new JScrollPane();
scrollPane_1.setBounds(510, 30, 150, 345);
desktopPane.add(scrollPane_1);
list_unassigned = new JList4j();
list_unassigned.setLocation(0, -3);
list_unassigned.setCellRenderer(Common.renderer_list_unassigned);
list_unassigned.setBackground(Common.color_list_unassigned);
scrollPane_1.setViewportView(list_unassigned);
final JScrollPane scrollPane_2 = new JScrollPane();
scrollPane_2.setBounds(310, 30, 150, 345);
desktopPane.add(scrollPane_2);
list_assigned = new JList4j();
list_assigned.setCellRenderer(Common.renderer_list_assigned);
list_assigned.setBackground(Common.color_list_assigned);
scrollPane_2.setViewportView(list_assigned);
comboBoxPalletStatus = new JComboBox();