Пример #1
0
  public void init(InteractionState interactionState, IForm form, FormTable table) {
    Transaction tr = RegaDBMain.getApp().createTransaction();

    for (UITestItem ti : testItems) {
      Test t = getTest(tr, ti);
      if (t != null) {
        Label l = new Label(TestComboBox.getLabel(t));
        FormField testResultField;
        if (ValueTypes.getValueType(t.getTestType().getValueType()) == ValueTypes.NOMINAL_VALUE) {
          testResultField = new ComboBox(interactionState, form);
          for (TestNominalValue tnv : t.getTestType().getTestNominalValues()) {
            ((ComboBox) testResultField)
                .addItem(new DataComboMessage<TestNominalValue>(tnv, tnv.getValue()));
          }
          ((ComboBox) testResultField).sort();

          if (ti.noValueSelected) ((ComboBox) testResultField).addNoSelectionItem();

          ((ComboBox) testResultField).selectIndex(0);

          if (ti.defaultValue != null && interactionState.isEditable())
            ((ComboBox) testResultField).selectItem(ti.defaultValue);
        } else {
          testResultField =
              FormField.getTextField(
                  ValueTypes.getValueType(t.getTestType().getValueType()), interactionState, form);
        }

        table.addLineToTable(l, testResultField);
        testFormFields.add(testResultField);
      } else {
        System.err.println("ViralIsolateForm: test does not exist: '" + ti.description + '\'');
      }
    }
  }
Пример #2
0
 public void changeData(TestNominalValue type, WWidget[] widgets) {
   for (TestNominalValue anv : testType_.getTestNominalValues()) {
     if (type.getNominalValueIi().equals(anv.getNominalValueIi())) {
       anv.setValue(((TextField) widgets[0]).text());
       break;
     }
   }
 }
Пример #3
0
  public WWidget[] getWidgets(TestNominalValue type) {
    TextField tf = new TextField(form_.getInteractionState(), form_);

    WWidget[] widgets = new WWidget[1];
    widgets[0] = tf;

    tf.setText(type.getValue());

    return widgets;
  }