private class MouseAction extends MouseAdapter {
public void mouseClicked(MouseEvent e) {
if (myLocomotive == null)
return;
LocomotiveControlface locomotiveControl = AdHocRailway
.getInstance().getLocomotiveControl();
if (e.getClickCount() == 1 && e.getButton() == MouseEvent.BUTTON3) {
LocomotivePersistenceIface locomotivePersistence = AdHocRailway
.getInstance().getLocomotivePersistence();
LocomotiveConfig locomotiveConfig = new LocomotiveConfig(frame,
myLocomotive);
if (locomotiveConfig.isOkPressed()) {
locomotivePersistence.updateLocomotive(myLocomotive);
}
locomotiveChanged(myLocomotive);
locomotiveControl.update();
} else if (e.getButton() == MouseEvent.BUTTON2) {
ToggleDirectionAction a = new ToggleDirectionAction();
a.actionPerformed(null);
}
updateWidget();