selectCommand = new ActionCommand("${select}", Command.SCREEN, 1) {
public Navigation execute(Displayable d) throws Exception {
GraphView view = (GraphView) d;
Observation observation = view.getSelectedObservation();
return new Navigation("input", period, observation);
}
};
view.addCommand(selectCommand);
view.addCommand(new ActionCommand("${enter.new}", Command.SCREEN, 2) {
public Navigation execute(Displayable d) throws Exception {
return new Navigation("input", period, new Observation());
}
});
view.addCommand(new ActionCommand("${history}", Command.SCREEN, 5) {
public Navigation execute(Displayable d) throws Exception {
return new Navigation("history", period);
}
});
view.addCommand(new ActionCommand("${delete}", Command.SCREEN, 3){
public Navigation execute(Displayable d) throws Exception {
Observation observation = view.getSelectedObservation();
if(observation != null) {
LogicDAO.removeObservation(controler, observation, period);
return new Navigation("graph", period, observation);
}else return null;
}
});
view.setKeyListener(this);
view.setExceptionListener(controler);