Esempio n. 1
0
  private int createArmSelect(
      PanelBuilder builder,
      int row,
      final Study curStudy,
      TreatmentDefinition def,
      CellConstraints cc) {
    builder.addLabel(def.getLabel(), cc.xy(2, row));

    ListModel arms = d_pm.getArmsPerStudyPerDefinition(curStudy, def);

    final JComboBox drugBox =
        AuxComponentFactory.createBoundComboBox(
            arms, d_pm.getSelectedArmModel(curStudy, def), true);
    if (arms.getSize() == 1) drugBox.setEnabled(false);
    final JPanel drugAndDosePanel = new JPanel(new BorderLayout());

    builder.add(drugBox, cc.xy(4, row));
    drugBox.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            updateDrugAndDoseLabel(curStudy, drugBox, drugAndDosePanel);
          }
        });
    row = LayoutUtil.addRow(builder.getLayout(), row);
    updateDrugAndDoseLabel(curStudy, drugBox, drugAndDosePanel);
    builder.add(drugAndDosePanel, cc.xy(4, row));

    return LayoutUtil.addRow(builder.getLayout(), row);
  }
Esempio n. 2
0
  @Override
  public void prepare() {
    d_pm.rebuildArmSelection();

    removeAll();

    FormLayout layout = new FormLayout("3dlu, left:pref, 3dlu, pref:grow", "p");
    PanelBuilder builder = new PanelBuilder(layout);
    builder.setDefaultDialogBorder();
    CellConstraints cc = new CellConstraints();

    int row = 1;
    for (Study curStudy : d_pm.getSelectableStudyListPM().getSelectedStudiesModel()) {
      builder.addSeparator(curStudy.toString(), cc.xyw(1, row, 4));
      row = LayoutUtil.addRow(layout, row);

      for (TreatmentDefinition def : d_pm.getSelectedRefinedTreatmentDefinitions()) {
        if (!d_pm.getArmsPerStudyPerDefinition(curStudy, def).isEmpty()) {
          row = createArmSelect(builder, row, curStudy, def, cc);
        }
      }
    }

    JScrollPane sp = new JScrollPane(builder.getPanel());
    add(sp, BorderLayout.CENTER);
    sp.getVerticalScrollBar().setUnitIncrement(16);

    setComplete(true);
  }