Add Undo/Redo functionality to a Java app

Add Undo/Redo functionality to a Java app

Recently I had to figure out a way to add undo/redo functionality to an existing Java application. Searching the web for some guidance I got a bit scared by finding posts that gave the impression that undo in Java is an overly complex thing that requires 10+ mysterious classes, best combined with reflection and modified GoF patterns.

I write this post to show you how simple undo in Java is and how it can be easily added to an existing application. You do not need to study Command patterns or rebuild half of your app, just follow the pragmatic approach described below and add a few simple classes to your application!

In our concrete case the requirement was to add undo functionality to an existing Excel-like spreadsheet application that had a horrible menu management and no patterns in it at all. Continue reading “Add Undo/Redo functionality to a Java app” »

Install VirtualBox Guest Additions in CentOS (RedHat) Linux Guest

When you try to install the VirtualBox Guest Additions for a Linux guest system, this will fail due to some wired ‘features’ in the installation. This post is based on my experience with VirtualBox 3.0.6 but conceptually it is valid also with current 4.3.x releases.

To perform the installation do the following:
Choose Install Guest Additions... from the VirtualBox menu. Open a terminal window in your guest system. Do a

cd /media/VBOXADDITIONS_3.0.6_52128/
(the foldername will change depending on the VBox version). Proceed as described below.
Continue reading “Install VirtualBox Guest Additions in CentOS (RedHat) Linux Guest” »

Export from Displaytag inside a Portlet

The Problem:
When using Displaytag inside a Prortlet, the export functionality will not work because the portlet has no way to produce other than it’s portlet content for display (see http://jira.codehaus.org/browse/DISPL-344).
Since Displaytag export functionality produces downloadable content that the portlet container will interpret as a portlet render result, you will see the Displaytag output as HTML-rubbish. Continue reading “Export from Displaytag inside a Portlet” »