@Override protected void doSetValue(Object value) { for (final RadioItem i : myRadioGroup.getItems()) { if (i.getText().equals(value)) { myRadioGroup.setSelection(i); return; } } }
@Override protected void firstListenerAdded() { if (mySelectionListener == null) { mySelectionListener = new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { /* * A RadioGroup issues two selection events when a new item is selected: * old->null and then null->new. * * We silently ignore events that switch to "null"... */ if (e.item == null) return; handleSelectionChanged(); } @Override public void widgetDefaultSelected(SelectionEvent e) {} }; } myRadioGroup.addSelectionListener(mySelectionListener); super.firstListenerAdded(); }
@Override protected Object doGetValue() { final RadioItem selection = myRadioGroup.getSelection(); if (selection == null) return null; return selection.getText(); }
@Override protected void lastListenerRemoved() { myRadioGroup.removeSelectionListener(mySelectionListener); super.lastListenerRemoved(); }