private void selectTestType(TestType testType) { TestTypeListItem testTypeListItem = myListItemByTestTypeMap.get(testType); ComboBoxModel comboBoxModel = myTestTypeComboBox.getModel(); if (comboBoxModel.getSelectedItem() != testTypeListItem) { comboBoxModel.setSelectedItem(testTypeListItem); } myTestTypeContentRunSettingsSection.select(testTypeListItem); }
@TestOnly public String[] getVisibleFiles() { final ComboBoxModel model = myFileChooser.getModel(); String[] result = new String[model.getSize()]; for (int i = 0; i < model.getSize(); i++) { FileDescriptor o = (FileDescriptor) model.getElementAt(i); result[i] = o.getPresentableName(o.myFile.getVirtualFile()); } return result; }
/** * Find the class for the projection * * @param proj projection * @return corresponding ProjectionClass (or null if not found) */ private ProjectionClass findProjectionClass(Projection proj) { Class want = proj.getClass(); ComboBoxModel projClassList = projClassCB.getModel(); for (int i = 0; i < projClassList.getSize(); i++) { ProjectionClass pc = (ProjectionClass) projClassList.getElementAt(i); if (want.equals(pc.projClass)) { return pc; } } return null; }
/* * (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(); } } }
public void updateSimulationPanel(PartitionDataList dataList) { setDataList(dataList); // TODO: DOES NOT WORK outputFormatModel.setSelectedItem(dataList.outputFormat); outputFormat.setSelectedItem(dataList.outputFormat); } // END: updateSimulationPanel
private void initUI() { SortedMap<String, SourceIdentifier> stats = mainFrame.getAvailableStatistics(); List<WrappedSourceIdentifier> wrappedSources = new ArrayList<WrappedSourceIdentifier>(stats.size() + 1); wrappedSources.add(new WrappedSourceIdentifier("Global", new SourceIdentifier("global"))); for (Map.Entry<String, SourceIdentifier> current : stats.entrySet()) { WrappedSourceIdentifier wrapped = new WrappedSourceIdentifier(current.getKey(), current.getValue()); wrappedSources.add(wrapped); } Object[] newSourcesArray = wrappedSources.toArray(); if (!Arrays.equals(previousSourcesArray, newSourcesArray)) { previousSourcesArray = newSourcesArray; DefaultComboBoxModel model = new DefaultComboBoxModel(newSourcesArray); sourcesComboBox.setModel(model); } int index = 0; if (sourceIdentifier != null) { ComboBoxModel model = sourcesComboBox.getModel(); for (int i = 0; i < model.getSize(); i++) { Object current = model.getElementAt(i); if (current instanceof WrappedSourceIdentifier) { WrappedSourceIdentifier wrapped = (WrappedSourceIdentifier) current; if (sourceIdentifier.getIdentifier().equals(wrapped.sourceIdentifier.getIdentifier())) { if (logger.isDebugEnabled()) logger.debug("Equal"); index = i; break; } else { if (logger.isDebugEnabled()) { logger.debug("Not equal: {} != {}", sourceIdentifier, wrapped.sourceIdentifier); } } } else { if (logger.isWarnEnabled()) logger.warn("Not instanceof WrappedSourceIdentifier"); } } } sourcesComboBox.setSelectedIndex(index); }
@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); }