/*
  * (non-Javadoc)
  *
  * @see java.util.Observer#update(java.util.Observable, java.lang.Object)
  */
 @Override
 public void update(Observable o, Object arg) {
   if (o instanceof qcevolutionbackend) {
     if (null != backend.getCurrentse()) {
       backend.getCurrentse().addObserver(this);
     }
   } else if (o instanceof ProblemManager) {
     Set<String> probs = backend.getProbmanager().getAvailableProblems();
     String[] options = new String[probs.size() + 1];
     options[0] = "Please Select Problem";
     int index = 1;
     Iterator<String> iter = probs.iterator();
     while (iter.hasNext()) {
       options[index++] = iter.next();
     }
     selection_model = new DefaultComboBoxModel(options);
     if (backend.getQproblem() != null) {
       String key = backend.getQproblem().getName();
       selection_model.setSelectedItem(key);
       description.setText(backend.getProbmanager().getSearchEngineDesc(key));
     }
     selection.setModel(selection_model);
   } else {
     if (backend.getCurrentse() != null) {
       if (backend.getCurrentse().getState() == SearchEngineState.Searching) {
         selection.setEnabled(false);
       } else {
         selection.setEnabled(true);
       }
       validate();
     }
   }
 }
 private void selectTestType(TestType testType) {
   TestTypeListItem testTypeListItem = myListItemByTestTypeMap.get(testType);
   ComboBoxModel comboBoxModel = myTestTypeComboBox.getModel();
   if (comboBoxModel.getSelectedItem() != testTypeListItem) {
     comboBoxModel.setSelectedItem(testTypeListItem);
   }
   myTestTypeContentRunSettingsSection.select(testTypeListItem);
 }
예제 #3
0
  public void updateSimulationPanel(PartitionDataList dataList) {

    setDataList(dataList);

    // TODO: DOES NOT WORK
    outputFormatModel.setSelectedItem(dataList.outputFormat);
    outputFormat.setSelectedItem(dataList.outputFormat);
  } // END: updateSimulationPanel
  @Inject
  public ProblemSelectionPanel(qcevolutionbackend be) {
    this.setLayout(new BorderLayout());
    backend = be;
    Set<String> probs = backend.getProbmanager().getAvailableProblems();
    String[] options = new String[probs.size() + 1];
    options[0] = "Please Select Problem";
    int index = 1;
    Iterator<String> iter = probs.iterator();
    while (iter.hasNext()) {
      options[index++] = iter.next();
    }
    selection_model = new DefaultComboBoxModel(options);

    description = new JTextPane();
    description.setEditable(false);
    description_scroller = new JScrollPane(description);
    description_scroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    description_scroller.setPreferredSize(new Dimension(250, 155));
    description_scroller.setMinimumSize(new Dimension(10, 10));

    if (backend.getCurrentse() != null) {
      String key = backend.getQproblem().getName();
      selection_model.setSelectedItem(key);
      description.setText(backend.getProbmanager().getSearchEngineDesc(key));
    }

    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    selection = new JComboBox(selection_model);
    selection.addActionListener(this);
    selection.setPreferredSize(new Dimension((int) (screenSize.width * MainPanel.right_perc), 30));
    selection.setMaximumSize(new Dimension((int) (screenSize.width * MainPanel.right_perc), 30));

    be.addObserver(this);
    be.getProbmanager().addObserver(this);
    if (null != backend.getCurrentse()) {
      backend.getCurrentse().addObserver(this);
    }

    this.add(selection, BorderLayout.NORTH);
    this.add(description_scroller, BorderLayout.CENTER);
  }