/**
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
public void actionPerformed(ActionEvent arg0) {
try {
PostShipment postShipment = (PostShipment) postShipmentSelectionList
.getElementAt(tablePostShipment
.convertRowIndexToModel(postShipmentSelectionList
.getSelectionIndex()));
if (postShipment != null) {
if (Util.showConfirmDialog(window.getComponent(),
"Slette?", "Vil du virkelig slette ettersending?")) {
managerRepository.getPostShipmentManager().lazyLoad(
postShipment,
new LazyLoadPostShipmentEnum[] {
LazyLoadPostShipmentEnum.ORDER_LINES,
LazyLoadPostShipmentEnum.COLLIES });
Set<OrderLine> orderLines = postShipment
.getOrderLines();
if (orderLines != null) {
for (OrderLine orderLine : orderLines) {
if (orderLine.getOrder().getSent() != null) {
if (!Util
.showConfirmDialog(
window.getComponent(),
"Slette?",
"Ordre som ordrelinjer h�rer til har blitt sendt, vil du allikevel slette ettersending?")) {
return;
}
}
orderLine.setPostShipment(null);
managerRepository.getOrderLineManager()
.saveOrderLine(orderLine);
}
}
Set<Colli> collies = postShipment.getCollies();
if (collies != null) {
ColliManager colliManager = (ColliManager) ModelUtil
.getBean("colliManager");
for (Colli colli : collies) {
colli.setPostShipment(null);
colli.setOrder(postShipment.getOrder());
colliManager.saveColli(colli);
/*
* colliManager .lazyLoadColli( colli, new
* LazyLoadColliEnum[]
* {LazyLoadColliEnum.ORDER_LINES});
*/
// orderLines = colli.getOrderLines();
/*
* for (OrderLine orderLine : orderLines) {
* orderLine.setColli(null);
* orderLineManager.saveOrderLine(orderLine); }
* colliManager.removeObject(colli);
*/
}
}
Deviation deviation = postShipment.getDeviation();
Order order = postShipment.getOrder();
if (deviation != null) {
if (Util
.showConfirmDialog(
window.getComponent(),