}
@SuppressWarnings("unchecked")
public void actionPerformed(ActionEvent e) {
OrderComment orderComment = new OrderComment();
orderComment.setUserName(login.getApplicationUser().getUserName());
orderComment.setCommentDate(Util.getCurrentDate());
orderComment.addCommentType(CommentTypeUtil
.getCommentType("Montering"));
CommentViewHandler orderCommentViewHandler = new CommentViewHandler(
login, managerRepository.getOrderManager());
EditCommentView editDeviationCommentView = new EditCommentView(
new OrderCommentModel(orderComment),
orderCommentViewHandler);
JDialog dialog = Util.getDialog(window, "Legg til kommentar", true);
dialog.setName("EditDeviationCommentView");
WindowInterface dialogWindow = new JDialogAdapter(dialog);
dialogWindow.add(editDeviationCommentView.buildPanel(dialogWindow));
dialog.pack();
Util.locateOnScreenCenter(dialog);
dialogWindow.setVisible(true);
if (!orderCommentViewHandler.isCanceled()) {
List<OrderComment> comments = new ArrayList<OrderComment>(
(List<OrderComment>) presentationModel
.getBufferedValue(AssemblyModel.PROPERTY_COMMENT_LIST));
Order order = ((AssemblyModel) presentationModel.getBean())
.getObject().getOrder();
order.setCachedComment(null);
orderComment.setOrder(order);
comments.add(0, orderComment);
presentationModel.setBufferedValue(
AssemblyModel.PROPERTY_COMMENT_LIST, comments);
}