org.eclipse.swt.widgets.Combo Java Examples

The following examples show how to use org.eclipse.swt.widgets.Combo. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OptionsConfigurationBlock.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
protected Combo newComboControl(Composite composite, String key, String[] values, String[] valueLabels) {
	ControlData data = new ControlData(key, values);

	Combo comboBox = new Combo(composite, SWT.READ_ONLY);
	comboBox.setItems(valueLabels);
	comboBox.setData(data);
	comboBox.addSelectionListener(getSelectionListener());
	comboBox.setFont(JFaceResources.getDialogFont());
	comboBox.setVisibleItemCount(30);

	makeScrollableCompositeAware(comboBox);

	updateCombo(comboBox);

	comboBoxes.add(comboBox);
	return comboBox;
}
 
Example #2
Source File: ItemView.java    From http4e with Apache License 2.0 6 votes vote down vote up
private void initHttpCombo( Composite top){
   httpCombo = new Combo(top, SWT.READ_ONLY);
   httpCombo.setItems(CoreConstants.HTTP11_METHODS);
   httpCombo.setText(model.getHttpMethod());
   httpCombo.addSelectionListener(new SelectionAdapter() {

      private String prevMethod = model.getHttpMethod();


      public void widgetSelected( SelectionEvent e){
         // becomes GET, HEAD, PUT, etc
         if (CoreConstants.HTTP_POST.equals(prevMethod) && !CoreConstants.HTTP_POST.equals(httpCombo.getText())) {
            state.setState(ItemState.POST_DISABLED);
            // becomes POST
         } else if (!CoreConstants.HTTP_POST.equals(prevMethod) && CoreConstants.HTTP_POST.equals(httpCombo.getText())) {
            state.setState(ItemState.POST_ENABLED);
            // no update
         } else {
            state.setState(ItemState.POST_NO_UPDATE);
         }
         prevMethod = httpCombo.getText();
         model.fireExecute(new ModelEvent(ModelEvent.HTTP_METHOD_CHANGE, model));
      }
   });
}
 
Example #3
Source File: InputParameterDialog.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 
 * set the default selected item in combo
 * 
 * @param selectIndex
 *            :indicate which item will be selected
 * @param combo
 *            : Combo
 * 
 */
protected void setSelectValueAfterInitCombo( int selectIndex, Combo combo )
{
	boolean found = dealWithValueInComboList( selectIndex,
			defaultValue,
			combo,
			parameter );
	if ( !found )
	{
		dealWithValueNotInComboList( defaultValue,
				combo,
				parameter,
				isCascade,
				valueList );
	}
}
 
Example #4
Source File: OptionsConfigurationBlock.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected Control findControl( Key key )
{
	Combo comboBox = getComboBox( key );
	if ( comboBox != null )
	{
		return comboBox;
	}
	Button checkBox = getCheckBox( key );
	if ( checkBox != null )
	{
		return checkBox;
	}
	Text text = getTextControl( key );
	if ( text != null )
	{
		return text;
	}
	return null;
}
 
Example #5
Source File: CrosstabBindingDialogHelper.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
private void initCalculationDataFields( Combo cmbDataField, String name,
		List<Period_Type> list )
{
	String[] strs = new String[list.size( )];
	for ( int i = 0; i < list.size( ); i++ )
	{
		strs[i] = list.get( i ).displayName( );
	}
	cmbDataField.setItems( strs );
	if ( calculationParamsValueMap.containsKey( name ) )
	{
		cmbDataField.setText( calculationParamsValueMap.get( name ) );
		return;
	}
	cmbDataField.select( 0 );
}
 
Example #6
Source File: HopGitPerspective.java    From hop with Apache License 2.0 6 votes vote down vote up
@GuiToolbarElement(
  root = GUI_PLUGIN_TOOLBAR_PARENT_ID,
  id = TOOLBAR_ITEM_REPOSITORY_LABEL,
  type = GuiToolbarElementType.LABEL,
  label = "Git repository ",
  toolTip = "Click here to edit the active git repository",
  separator = true
)
public void editGitRepository() {
  HopGui hopGui = HopGui.getInstance();
  Combo combo = getRepositoryCombo();
  if ( combo == null ) {
    return;
  }
  String repositoryName = combo.getText();
  try {
    MetadataManager<GitRepository> manager = new MetadataManager<>( hopGui.getVariables(), hopGui.getMetadataProvider(), GitRepository.class );
    if ( manager.editMetadata( repositoryName ) ) {
      refreshGitRepositoriesList();
      selectRepositoryInList( repositoryName );
    }
  } catch ( Exception e ) {
    new ErrorDialog( hopGui.getShell(), "Error", "Error editing environment '" + repositoryName, e );
  }
}
 
Example #7
Source File: NewProjectWizardProjInfoPage.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 获取项目属性字段集合
 * @return key 为属性名称,value 中第一个值为选中的属性值,第二个值为该属性对应的所有属性值集合
 */
public LinkedHashMap<String, Object[]> getAttributeMap() {
	LinkedHashMap<String, Object[]> mapAttr = new LinkedHashMap<String, Object[]>();
	if (lstCombo != null) {
		for (Combo cmb : lstCombo) {
			if (!cmb.isDisposed()) {
				ArrayList<String> lstAttrValue = new ArrayList<String>();
				for (String attrVal : cmb.getItems()) {
					lstAttrValue.add(TextUtil.stringToXML(attrVal));
				}
				mapAttr.put(TextUtil.stringToXML((String) cmb.getData()),
						new Object[] { TextUtil.stringToXML(cmb.getText()), lstAttrValue });
			}
		}
	}
	return mapAttr;
}
 
Example #8
Source File: RelationshipDialog.java    From erflute with Apache License 2.0 6 votes vote down vote up
private void createChildMandatoryGroup(Group parent) {
    final GridLayout gridLayout = new GridLayout();
    gridLayout.marginHeight = 10;
    final GridData gridData = new GridData();
    gridData.grabExcessHorizontalSpace = true;
    gridData.horizontalAlignment = GridData.FILL;
    final Group group = new Group(parent, SWT.NONE);
    group.setLayout(gridLayout);
    group.setLayoutData(gridData);
    group.setText(DisplayMessages.getMessage("label.mandatory"));
    childCardinalityCombo = new Combo(group, SWT.NONE);
    childCardinalityCombo.setLayoutData(gridData);
    childCardinalityCombo.setVisibleItemCount(5);
    childCardinalityCombo.add("1..n");
    childCardinalityCombo.add("0..n");
    childCardinalityCombo.add("1");
    childCardinalityCombo.add("0..1");
}
 
Example #9
Source File: TypeCombo.java    From uima-uimaj with Apache License 2.0 6 votes vote down vote up
/**
 * Instantiates a new type combo.
 *
 * @param parent the parent
 */
public TypeCombo(Composite parent) {
  super(parent, SWT.NONE);

  setLayout(new FillLayout());

  typeCombo = new Combo(this, SWT.READ_ONLY | SWT.DROP_DOWN | SWT.BORDER);
  
  typeCombo.addModifyListener(new ModifyListener() {
    @Override
    public void modifyText(ModifyEvent e) {
      Type newType = getType();

      for (ITypePaneListener listener : listeners) {
        listener.typeChanged(newType);
      }
    }
  });
}
 
Example #10
Source File: TSLintWizardPage.java    From typescript.java with MIT License 6 votes vote down vote up
private void createEmbeddedTslintPluginField(Composite parent) {
	useEmbeddedTslintPluginButton = new Button(parent, SWT.RADIO);
	useEmbeddedTslintPluginButton.setText(TypeScriptUIMessages.TSLintWizardPage_useEmbeddedTslintPlugin_label);
	useEmbeddedTslintPluginButton.addListener(SWT.Selection, this);
	useEmbeddedTslintPluginButton.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			updateTslintPluginMode();
		}
	});

	embeddedTslintPlugin = new Combo(parent, SWT.READ_ONLY);
	embeddedTslintPlugin.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	ComboViewer viewer = new ComboViewer(embeddedTslintPlugin);
	viewer.setContentProvider(ArrayContentProvider.getInstance());
	viewer.setLabelProvider(new TypeScriptRepositoryLabelProvider(false, true));
	List<ITypeScriptRepository> repositories = Arrays
			.stream(TypeScriptCorePlugin.getTypeScriptRepositoryManager().getRepositories())
			.filter(r -> r.getTslintLanguageServiceName() != null).collect(Collectors.toList());
	viewer.setInput(repositories);
}
 
Example #11
Source File: CostDialog.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
private void createCurrencyRow(Composite body, FormToolkit tk) {
	Combo widget = UI.formCombo(body, tk, M.Currency);
	currencyCombo = new ComboViewer(widget);
	currencyCombo.setLabelProvider(new LabelProvider() {
		@Override
		public String getText(Object obj) {
			if (!(obj instanceof Currency))
				return super.getText(obj);
			return ((Currency) obj).name;
		}
	});
	setCurrencyContent(currencyCombo);
	currencyCombo.addSelectionChangedListener(e -> {
		currency = Viewers.getFirst(e.getSelection());
		exchange.currency = currency;
		updateCurrencyLabels();
	});
	UI.filler(body, tk);
}
 
Example #12
Source File: AccountSelector.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
public AccountSelector(Composite parent, IGoogleLoginService loginService) {
  super(parent, SWT.NONE);
  this.loginService = loginService;
  loginMessage = Messages.getString("ACCOUNT_SELECTOR_LOGIN");

  combo = new Combo(this, SWT.READ_ONLY);

  List<Account> sortedAccounts = new ArrayList<>(loginService.getAccounts());
  Collections.sort(sortedAccounts, new Comparator<Account>() {
    @Override
    public int compare(Account o1, Account o2) {
      return o1.getEmail().compareTo(o2.getEmail());
    }
  });
  for (Account account : sortedAccounts) {
    combo.add(account.getEmail());
    combo.setData(account.getEmail(), account);
  }
  combo.add(loginMessage);
  combo.addSelectionListener(logInOnSelect);

  GridDataFactory.fillDefaults().grab(true, false).applyTo(combo);
  GridLayoutFactory.fillDefaults().generateLayout(this);
}
 
Example #13
Source File: PipelineArgumentsTabTest.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
@Test
public void testValidatePage_doesNotClearErrorSetByChildren() {
  String errorMessage;
  Combo emailKey =
      CompositeUtil.findControlAfterLabel(shellResource.getShell(), Combo.class, "&Account:");
  if (emailKey.getText().isEmpty()) {
    errorMessage = "No Google account selected for this launch.";
  } else {
    Text serviceAccountKey = CompositeUtil.findControlAfterLabel(shellResource.getShell(),
        Text.class, "Service account key:");
    serviceAccountKey.setText("/non/existing/file");
    errorMessage = "/non/existing/file does not exist.";
  }
  assertEquals(errorMessage, pipelineArgumentsTab.getErrorMessage());

  pipelineArgumentsTab.isValid(configuration1);
  assertEquals(errorMessage, pipelineArgumentsTab.getErrorMessage());
}
 
Example #14
Source File: FilterAdvancedComposite.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
private Combo createAttributeCombo ()
{
    final Combo c = new Combo ( this, SWT.NONE );
    c.add ( "sourceTimestamp" ); //$NON-NLS-1$
    c.add ( "entryTimestamp" ); //$NON-NLS-1$
    for ( final Event.Fields field : Event.Fields.values () )
    {
        c.add ( field.getName () );
    }
    c.add ( Messages.custom_field );
    c.select ( 0 );
    return c;
}
 
Example #15
Source File: OptionsConfigurationBlock.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected Combo addInversedComboBox( Composite parent, String label,
		Key key, String[] values, String[] valueLabels, int indent )
{
	GridData gd = new GridData( GridData.HORIZONTAL_ALIGN_BEGINNING );
	gd.horizontalIndent = indent;
	gd.horizontalSpan = 3;

	Composite composite = new Composite( parent, SWT.NONE );
	GridLayout layout = new GridLayout( );
	layout.marginHeight = 0;
	layout.marginWidth = 0;
	layout.numColumns = 2;
	composite.setLayout( layout );
	composite.setLayoutData( gd );

	Combo comboBox = newComboControl( composite, key, values, valueLabels );
	comboBox.setFont( JFaceResources.getDialogFont( ) );
	comboBox.setLayoutData( new GridData( GridData.HORIZONTAL_ALIGN_FILL ) );

	Label labelControl = new Label( composite, SWT.LEFT | SWT.WRAP );
	labelControl.setText( label );
	labelControl.setLayoutData( new GridData( ) );

	fLabels.put( comboBox, labelControl );

	updateCombo( comboBox );

	return comboBox;
}
 
Example #16
Source File: SearchAdvancedQueryBuilder.java    From Rel with Apache License 2.0 5 votes vote down vote up
private void preserveState() {
	if (finderSavedState == null)
		return;
	finderSavedState.clear();
	for (Control[] controlArray: controls) {
		String[] savedText = new String[4];
		savedText[0] = ((Combo)controlArray[0]).getText();
		savedText[1] = ((Combo)controlArray[1]).getText();
		savedText[2] = ((Text)controlArray[2]).getText();
		savedText[3] = ((Combo)controlArray[3]).getText();
		finderSavedState.add(savedText);
	}
}
 
Example #17
Source File: AbstractDominoWizardPanel.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
protected void createDSNameArea(){
    createLabel("Da&ta source name:", createSpanGD(getNumRightColumns() - 2)); // $NLX-AbstractDominoWizardPanel.Datasourcename-1$

    _nameText = createDCTextComputed(XSPAttributeNames.XSP_ATTR_VAR, createControlGDBigWidth(getNumRightColumns() - 2));
    _nameText.setIsComputable(false);
    _nameText.setValidator(new UniqueXmlNameValidator(_data.getNode(), XSPAttributeNames.XSP_ATTR_VAR, "Data source name", !isPropsPanel() && !isNewDesignElementDialog()));  // $NLX-AbstractDominoWizardPanel.Datasourcename.1-1$
    final Combo viewCombo = getDesignElementPicker();
    if (viewCombo != null) {
        _lastViewName = viewCombo.getText();
        viewCombo.addModifyListener(new ModifyListener() {
            public void modifyText(ModifyEvent e) {
                // delay a second before setting input to make sure the user
                // is done typing.
                _currentTime = System.currentTimeMillis();
                Display.getCurrent().timerExec(1500, new Runnable() {
                    public void run() {
                        if (!isDisposed() && (System.currentTimeMillis() - _currentTime >= 1400)) { // more robust with -100ms from delay
                            if (_lastViewName != null && !_lastViewName.equals(viewCombo.getText())) {
                                _lastViewName = viewCombo.getText();
                                if (!ComputedValueUtils.isStringComputed(_lastViewName)) {
                                    // _responsesViewer.setInput(getViewAttrInput());
                                }
                            }
                        }
                    }
                });
            }
        });
    }
    String tip = "Use the data source name when referring to this data source\nprogrammatically. Use caution when changing this name.";   // $NLX-AbstractDominoWizardPanel.Usethedatasourcenamewhenreferring-1$
    _nameText.setToolTipText(tip); 
    _nameText.getEditorControl().setToolTipText(tip);
    if(isPropsPanel()) {
        Label separator = new Label(getCurrentParent(), SWT.SEPARATOR | SWT.HORIZONTAL);
        GridData sep = SWTLayoutUtils.createGDFillHorizontal();
        sep.horizontalSpan = 2;
        sep.verticalIndent = 7;
        separator.setLayoutData(sep);
    }
}
 
Example #18
Source File: MechanicDialog.java    From workspacemechanic with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates a new combo box, initilizes the enty values, and configures
 * it with a listener capable of updating the right entry in our
 * map of item->decision.
 */
private Combo createDecisionCombo(Composite parent, Task item) {
  Combo combo = new Combo(parent, SWT.READ_ONLY);
  combo.add(YES);
  combo.add(NO);
  combo.add(NEVER);
  combo.select(0);

  combo.addSelectionListener(new ComboListener(item));
  return combo;
}
 
Example #19
Source File: TermBaseSearchDialog.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Updates the combo with the history.
 * @param combo
 *            to be updated
 * @param history
 *            to be put into the combo
 */
private void updateHistory(Combo combo, List<String> history) {
	String findString = combo.getText();
	int index = history.indexOf(findString);
	if (index != 0) {
		if (index != -1) {
			history.remove(index);
		}
		history.add(0, findString);
		Point selection = combo.getSelection();
		updateCombo(combo, history);
		combo.setText(findString);
		combo.setSelection(selection);
	}
}
 
Example #20
Source File: RelationshipByExistingColumnsDialog.java    From erflute with Apache License 2.0 5 votes vote down vote up
private void createReferredColumnSelector(Composite composite) {
    final Label label = new Label(composite, SWT.NONE);
    label.setText("Referred Column");
    final GridData gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    referredColumnSelector = new Combo(composite, SWT.READ_ONLY);
    referredColumnSelector.setLayoutData(gridData);
    referredColumnSelector.setVisibleItemCount(20);
}
 
Example #21
Source File: FontSizeContributionItem.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
@Override
protected void setData(Combo combo) {
	int minimumSize = 5;
	for (int i = minimumSize; i < 17; i++) {
		combo.add(String.valueOf(i));
	}
}
 
Example #22
Source File: HopGuiPipelineGraph.java    From hop with Apache License 2.0 5 votes vote down vote up
/**
 * Allows for magnifying to any percentage entered by the user...
 */
private void readMagnification() {
  float oldMagnification = magnification;
  Combo zoomLabel = (Combo) toolBarWidgets.getWidgetsMap().get( TOOLBAR_ITEM_ZOOM_LEVEL );
  if ( zoomLabel == null ) {
    return;
  }
  String possibleText = zoomLabel.getText().replace( "%", "" );

  float possibleFloatMagnification;
  try {
    possibleFloatMagnification = Float.parseFloat( possibleText ) / 100;
    magnification = possibleFloatMagnification;
    if ( zoomLabel.getText().indexOf( '%' ) < 0 ) {
      zoomLabel.setText( zoomLabel.getText().concat( "%" ) );
    }
  } catch ( Exception e ) {
    modalMessageDialog( BaseMessages.getString( PKG, "PipelineGraph.Dialog.InvalidZoomMeasurement.Title" ),
      BaseMessages.getString( PKG, "PipelineGraph.Dialog.InvalidZoomMeasurement.Message", zoomLabel.getText() ),
      SWT.YES | SWT.ICON_ERROR );
  }

  // When zooming out we want to correct the scroll bars.
  //
  float factor = magnification / oldMagnification;
  int newHThumb = Math.min( (int) ( horizontalScrollBar.getThumb() / factor ), 100 );
  horizontalScrollBar.setThumb( newHThumb );
  horizontalScrollBar.setSelection( (int) ( horizontalScrollBar.getSelection() * factor ) );
  int newVThumb = Math.min( (int) ( verticalScrollBar.getThumb() / factor ), 100 );
  verticalScrollBar.setThumb( newVThumb );
  verticalScrollBar.setSelection( (int) ( verticalScrollBar.getSelection() * factor ) );

  canvas.setFocus();
  redraw();
}
 
Example #23
Source File: LineStylePicker.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
public LineStylePicker(Composite parent) {
    super(parent, NONE);
    setLayout(new RowLayout());
    
    combo = new Combo(this, SWT.READ_ONLY | SWT.DROP_DOWN);
    combo.setItems(new String[] { "Solid", "Dashed", "Dotted", "Dashdot", "Dashdotdot" });
    combo.select(0);
}
 
Example #24
Source File: FormatterControlManager.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public Combo createCombo(Composite parent, Object key, String label, String[] items)
{
	final Label labelControl = SWTFactory.createLabel(parent, label);
	Combo combo = SWTFactory.createCombo(parent, SWT.READ_ONLY | SWT.BORDER, 1, items);
	bindingManager.bindControl(combo, key);
	registerAssociatedLabel(combo, labelControl);
	return combo;
}
 
Example #25
Source File: ComputedFieldVetoHandler.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
public ComputedFieldVetoHandler(Control control) {
    if (control instanceof CompositeEditor) {
        control = ((CompositeEditor)control).getRealControl();
    }
    
    if (control instanceof Button) {
        ((Button)control).addSelectionListener(listener);
    }
    else if (control instanceof Combo) {
        ((Combo)control).addSelectionListener(listener);
    }
}
 
Example #26
Source File: RelationDialog.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
private void createColumnCombo(final Composite parent) {
    final GridData gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;

    columnCombo = new Combo(parent, SWT.READ_ONLY);
    columnCombo.setLayoutData(gridData);

    columnCombo.setVisibleItemCount(20);

    columnComboInfo = setReferencedColumnComboData(columnCombo, (ERTable) relation.getSourceTableView());
}
 
Example #27
Source File: JSFormatterIndentationTabPage.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Constructor.
 * 
 * @param controlManager
 * @param tabSize
 */
public TabOptionHandler(IFormatterControlManager controlManager, Combo tabOptions, Text indentationSize,
		Text tabSize)
{
	this.manager = controlManager;
	this.tabOptions = tabOptions;
	this.indentationSize = indentationSize;
	this.tabSize = tabSize;
	tabOptions.addSelectionListener(this);
	manager.addInitializeListener(this);
}
 
Example #28
Source File: OptionsConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
protected void controlChanged(Widget widget) {
	ControlData data= (ControlData) widget.getData();
	String newValue= null;
	if (widget instanceof Button) {
		newValue= data.getValue(((Button)widget).getSelection());
	} else if (widget instanceof Combo) {
		newValue= data.getValue(((Combo)widget).getSelectionIndex());
	} else {
		return;
	}
	String oldValue= setValue(data.getKey(), newValue);
	validateSettings(data.getKey(), oldValue, newValue);
}
 
Example #29
Source File: DataDefinitionSelector.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected Combo createSeriesSelectCombo( Composite cmpTop,
		ChartWizardContext wizardContext )
{
	Combo combo = new Combo( cmpTop, SWT.DROP_DOWN | SWT.READ_ONLY );
	{
		combo.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
		combo.addSelectionListener( this );
		refreshSeriesCombo( combo );
		combo.select( 0 );
	}
	return combo;
}
 
Example #30
Source File: EditorSelection.java    From arx with Apache License 2.0 5 votes vote down vote up
@Override
public void createControl(final Composite parent) {
    combo = new Combo(parent, SWT.READ_ONLY);
    combo.setItems(elems);
    combo.select(indexOf(getValue()));
    combo.setLayoutData(SWTUtil.createFillHorizontallyGridData());
    combo.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent arg0) {
            if (combo.getSelectionIndex() >= 0) {
                setValue(elems[combo.getSelectionIndex()]);
            }
        }
    });
}