Set the selected option of this group to <code>name</code>.

@param option the option that is selected
@throws AlreadySelectedException if an option from this group has
already been selected.
169119
public void setSelected(Option option) throws AlreadySelectedException
    {
        if (option == null)
        {
            // reset the option previously selected
            selected = null;
            return;
        }
        
        // if no option has already been selected or the 
        // same option is being reselected then set the
        // selected member variable
        if (selected == null || selected.equals(option.getKey()))
        {
            selected = option.getKey();
        }
        else
        {
            throw new AlreadySelectedException(this, option);
        }
    }
902859
public OptionGroup addOption(Option option) {
        if (option == null) {
            throw new IllegalArgumentException("Option cannot be null");
        }

        String value = option.getValue();

        if (options.containsKey(value)) {
            throw new IllegalArgumentException("An option with value '" + value + "' already exists in this group");
        }

        options.put(value, option);
        return this;
    }
1047620
public function setOption($optionName, $value)
    {
        $this->options[$optionName] = $value;
        if (ObjectAccess::isPropertySettable($this, $optionName)) {
            ObjectAccess::setProperty($this, $optionName, $value);
        }
    }
1300646
public ElementWithOptions removeOption(Option option) {
        if (option == null) {
            throw new IllegalArgumentException("Option cannot be null");
        }

        for (OptionGroup group : optionGroups.values()) {
            group.removeOption(option);
        }
        return this;
    }
247034
public final <T> void addOption(Class<T> cls, String name, String description, String exclusiveGroup)
    {
        addOption(cls, name, description, exclusiveGroup, true);
    }
1094876
public void addOption(@NonNull NamedOption namedOption) {
      options.put(namedOption.getName(), namedOption);
      optionSet.add(namedOption);
      if (namedOption.getAliases() != null) {
         for (String alias : namedOption.getAliases()) {
            options.put(alias, namedOption);
         }
      }
   }
372296
public void setOnselect(java.lang.String onselect) {
        getStateHelper().put(PropertyKeys.onselect, onselect);
        handleAttribute("onselect", onselect);
    }
616108
public function selectOption($select, $option)
    {
        $select = $this->fixStepArgument($select);
        $option = $this->fixStepArgument($option);
        $this->getSession()->getPage()->selectFieldOption($select, $option);
    }
464360
function (options) {
		
			inputEx.DSSelectField.superclass.setOptions.call(this, options);
		
			this.options.valueKey = options.valueKey || "value";
			this.options.labelKey = options.labelKey || "label";
		
			this.options.datasource = options.datasource;
		
		}
985868
public void setSelectionModeEnabled(boolean selectionModeEnabled) {
        if (!selectionModeEnabled) {
            // TODO fix double iteration over tree
            deselectAll();
        }
        mSelectionModeEnabled = selectionModeEnabled;

        for (TreeNode node : mRoot.getChildren()) {
            toggleSelectionMode(node, selectionModeEnabled);
        }

    }
151559
public void setName(String fieldName) {
        if (m_name != null) {
            throw new IllegalArgumentException("Field name is already set: " + m_name);
        }
        if (!isValidFieldName(fieldName)) {
            throw new IllegalArgumentException("Invalid field name: " + fieldName);
        }
        m_name = fieldName;
    }
937347
public T select(T option)
	{
		int index = options().indexOf(option);
		if (index == -1 || index == selectedIndex)
			return selected();

		if (fireEvent(new SelectEvent<>(this, option)))
			setSelected(option);

		return selected();
	}
182461
public void setOptions(
			String[] labels, String[] descriptions, int defaultIndex) 
	{
		if (labels.length != descriptions.length) {
            throw new IllegalArgumentException("Labels/descriptions mismatch.");
        }
		
		if (labels.length > 0) {
			this.optionLabels = labels.clone();
			this.optionDescriptions = descriptions.clone();
			this.defaultOptionIndex = defaultIndex;
		}
		else {
			// use placeholders for empty list of choices
			this.optionLabels = new String[]{NO_CHOICES};
			this.optionDescriptions = new String[]{NO_CHOICES_DESCRIPTION};
			this.defaultOptionIndex = 0;
		}
		
		// reset to default value
        resetToDefault();
        
        // refresh the edit component
        if (this.editComponent != null) {
        	this.editComponent.refresh();
        }
	}
670384
public void setName(String name)
    {
        super.setName(name);
        m_tf.setName(name);
        if (m_button != null)
            m_button.setName(name);
        if (m_buttonTime != null)
            m_buttonTime.setName(name);
    }
1206108
public function addOption($option)
    {
        if (in_array($option, Generator::$tagOptionKeys)
            && !$this->hasOption($option)
        ) {
            $this->options[] = $option;
        }
    }
167029
public void setSelection(int position) {
        DropDownListView list = mDropDownList;
        if (isShowing() && list != null) {
            list.mListSelectionHidden = false;
            list.setSelection(position);

            if (Build.VERSION.SDK_INT >= 11) {
                if (list.getChoiceMode() != ListView.CHOICE_MODE_NONE) {
                    list.setItemChecked(position, true);
                }
            }
        }
    }
1036260
public <T> Option<T> findOption(Option<T> option) {
        for (Option candidateOption : options) {
            if (candidateOption.hasSameNameAs(option)) {
                return candidateOption;
            }
        }
        throw new RuntimeException("You tried to set an unexpected option");
    }