@Override
public void update(final Observable o, final Object arg) {
if (arg instanceof ObserverNotification) {
final ObserverNotification notification = (ObserverNotification) arg;
final NotificationType type = notification.getType();
try {
if (!(notification.getObj1() instanceof GraphicsView<?>))
return;
if (type.equals(NotificationType.itemClicked)) {
timeline.onViewItemClicked((GraphicsView<?>) notification.getObj1());
} else if (type.equals(NotificationType.itemMousePressed)) {
timeline.onMousePressed((GraphicsView<?>) notification.getObj1());
} else if (type.equals(NotificationType.freeSpaceClicked)) {
timeline.onFreeSpaceClicked();
}
} catch (final ClassCastException e) {
throw new IllegalArgumentException("ObserverNotification holds objects of unexpected type '"
+ arg.getClass().getSimpleName() + "'.", e);