@Override
 public void drawCase() {
   time = selectedTime;
   velocity = Utils.SPEED_LIMITS[speedIndex] / 3.6;
   distance = time * velocity;
   super.drawCase();
 }
 @Override
 public void simEndStatus(SimulationEndData simEndData) {
   // TODO Auto-generated method stub
   if (controller.btnRun != null) {
     controller.btnRun.setEnabled(true);
   }
   controller.endAction(simEndData);
 }
  public QuestionsPanel(DrivingSimulator simulator, DSTChart chart, ArrayList<QBaseTemplate> list) {
    super();
    this.simulator = simulator;
    this.chart = chart;
    questionList = list;
    controller = questionList.get(0);

    initQuestionButtonPanel();
    base.add(questionButtonPanel);
    panel = controller.getQuestionPanel();
    base.add(panel);
    initWidget(base);
  }
  public void initQuestionButtonPanel() {
    questionButtonPanel.setWidth("435px");
    questionButtonPanel.setHeight("30px");

    btnPrev = new Button("Prev");
    btnPrev.setHTML("<img src='images/icon16/back.png' />Prev");
    btnPrev.setSize("75px", "28px");
    btnPrev.setEnabled(false);

    btnNext = new Button("Next");
    btnNext.setHTML("<img src='images/icon16/right.png' />Next");
    btnNext.setSize("75px", "28px");

    html = new HTML("<center><span class='app-title3'>" + controller.getTitle() + "</></center>");
    html.setWidth("285px");

    questionButtonPanel.add(btnPrev, 0, 2);
    questionButtonPanel.add(html, 75, 0);
    questionButtonPanel.add(btnNext, 360, 2);

    btnPrev.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            if (questionIndex > 0) {
              questionIndex--;
              controller = questionList.get(questionIndex);

              String str =
                  "<center><span class='app-title3'>" + controller.getTitle() + "</span></center>";
              html.setHTML(str);

              if (questionIndex == 0) btnPrev.setEnabled(false);
              else btnPrev.setEnabled(true);
              if (questionIndex == questionList.size() - 1) btnNext.setEnabled(false);
              else btnNext.setEnabled(true);
              base.remove(panel);
              panel = controller.getQuestionPanel();
              base.add(panel);
              controller.syncDiagram();
            }
          }
        });

    btnNext.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            if (questionIndex < questionList.size() - 1) {
              questionIndex++;
              controller = questionList.get(questionIndex);

              String str =
                  "<center><span class='app-title3'>" + controller.getTitle() + "</span></center>";
              html.setHTML(str);

              if (questionIndex == questionList.size() - 1) btnNext.setEnabled(false);
              else btnNext.setEnabled(true);
              if (questionIndex == 0) btnPrev.setEnabled(false);
              else btnPrev.setEnabled(true);
              base.remove(panel);
              panel = controller.getQuestionPanel();
              base.add(panel);
              controller.syncDiagram();
            }
          }
        });
  }
 public void syncDiagram() {
   controller.syncDiagram();
 }