// Hide\display the additional CEP widget is appropriate
  private void operatorChanged(OperatorSelection selection) {
    parametersContainer.clear();
    String operator = selection.getValue();

    if (CEPOracle.isCEPWindowOperatorTime(operator)) {
      AbstractRestrictedEntryTextBox txt = new CEPTimeParameterTextBox(hcw.getWindow(), 1);
      initialiseTextBox(txt);
    } else if (CEPOracle.isCEPWindowOperatorLength(operator)) {
      AbstractRestrictedEntryTextBox txt = new CEPLengthParameterTextBox(hcw.getWindow(), 1);
      initialiseTextBox(txt);
    } else {
      parametersContainer.setVisible(false);
      hcw.getWindow().clearParameters();
    }
  }
  // Actual drop-down
  private Widget getDropDown() {

    String selected = "";
    String selectedText = "";

    box = new ListBox();
    box.setEnabled(!isReadOnly);
    box.addItem(HumanReadableConstants.INSTANCE.noCEPWindow(), "");

    for (int i = 0; i < operators.size(); i++) {
      String op = operators.get(i);
      box.addItem(HumanReadable.getOperatorDisplayName(op), op);
      if (op.equals(hcw.getWindow().getOperator())) {
        selected = op;
        selectedText = HumanReadable.getOperatorDisplayName(op);
        box.setSelectedIndex(i + 1);
      }
    }
    selectItem(hcw.getWindow().getOperator());

    // Fire event to ensure parent Widgets correct their state depending on selection
    final HasValueChangeHandlers<OperatorSelection> source = this;
    final OperatorSelection selection = new OperatorSelection(selected, selectedText);
    Scheduler.get()
        .scheduleFinally(
            new Command() {

              public void execute() {
                operatorChanged(selection);
                ValueChangeEvent.fire(source, selection);
              }
            });

    // Signal parent Widget whenever a change happens
    box.addChangeHandler(
        new ChangeHandler() {

          public void onChange(ChangeEvent event) {
            String selected = box.getValue(box.getSelectedIndex());
            String selectedText = box.getItemText(box.getSelectedIndex());
            OperatorSelection selection = new OperatorSelection(selected, selectedText);
            operatorChanged(selection);
            ValueChangeEvent.fire(source, selection);
          }
        });

    return box;
  }
 private void initialiseTextBox(AbstractRestrictedEntryTextBox txt) {
   String key = String.valueOf(1);
   String value = hcw.getWindow().getParameter(key);
   if (value == null) {
     value = "";
     hcw.getWindow().setParameter(key, value);
   }
   if (!txt.isValidValue(value, false)) {
     value = "";
     hcw.getWindow().setParameter(key, value);
   }
   txt.setText(value);
   txt.setEnabled(!isReadOnly);
   parametersContainer.add(txt);
   parametersContainer.setVisible(true);
   hcw.getWindow()
       .setParameter(
           SharedConstants.OPERATOR_PARAMETER_GENERATOR, CEP_OPERATOR_PARAMETER_GENERATOR);
 }