Exemplo n.º 1
0
  public ExecutionWidget(final ExecutionTrace executionTrace, boolean showResults) {

    this.executionTrace = executionTrace;

    final HorizontalPanel simulDatePanel = simulDate();
    simulDatePanel.setVisible(isScenarioSimulatedDateSet());

    final ListBox choice = new ListBox();

    choice.addItem(TestScenarioConstants.INSTANCE.UseRealDateAndTime());
    choice.addItem(TestScenarioConstants.INSTANCE.UseASimulatedDateAndTime());
    choice.setSelectedIndex((executionTrace.getScenarioSimulatedDate() == null) ? 0 : 1);
    choice.addChangeHandler(
        new ChangeHandler() {

          public void onChange(ChangeEvent event) {
            if (choice.getSelectedIndex() == 0) {
              simulDatePanel.setVisible(false);
              executionTrace.setScenarioSimulatedDate(null);
            } else {
              simulDatePanel.setVisible(true);
            }
          }
        });

    HorizontalPanel layout = new HorizontalPanel();
    layout.add(new Image(TestScenarioImages.INSTANCE.executionTrace()));
    layout.add(choice);
    layout.add(simulDatePanel);

    if (showResults && isResultNotNullAndHaveRulesFired()) {
      VerticalPanel replacingLayout = new VerticalPanel();

      replacingLayout.add(new FiredRulesPanel(executionTrace));
      replacingLayout.add(layout);
      initWidget(replacingLayout);
    } else {
      initWidget(layout);
    }
  }