Alters option selected state.

@param boolean|null $select_or_deselect Tells, how option state should be altered.

@return self
553205
public function toggle($select_or_deselect = null)
	{
		if ( !isset($select_or_deselect) ) {
			$select_or_deselect = !$this->isSelected();
		}

		return $select_or_deselect ? $this->select() : $this->deselect();
	}
1146504
function setSelection(from, to, oldFrom, oldTo) {
      goalColumn = null;
      if (oldFrom == null) {oldFrom = sel.from.line; oldTo = sel.to.line;}
      if (posEq(sel.from, from) && posEq(sel.to, to)) return;
      if (posLess(to, from)) {var tmp = to; to = from; from = tmp;}

      // Skip over hidden lines.
      if (from.line != oldFrom) {
        var from1 = skipHidden(from, oldFrom, sel.from.ch);
        // If there is no non-hidden line left, force visibility on current line
        if (!from1) setLineHidden(from.line, false);
        else from = from1;
      }
      if (to.line != oldTo) to = skipHidden(to, oldTo, sel.to.ch);

      if (posEq(from, to)) sel.inverted = false;
      else if (posEq(from, sel.to)) sel.inverted = false;
      else if (posEq(to, sel.from)) sel.inverted = true;

      if (options.autoClearEmptyLines && posEq(sel.from, sel.to)) {
        var head = sel.inverted ? from : to;
        if (head.line != sel.from.line && sel.from.line < doc.size) {
          var oldLine = getLine(sel.from.line);
          if (/^\s+$/.test(oldLine.text))
            setTimeout(operation(function() {
              if (oldLine.parent && /^\s+$/.test(oldLine.text)) {
                var no = lineNo(oldLine);
                replaceRange("", {line: no, ch: 0}, {line: no, ch: oldLine.text.length});
              }
            }, 10));
        }
      }

      sel.from = from; sel.to = to;
      selectionChanged = true;
    }
1004390
public function amend($data = null, $options = [])
    {
        if ($data !== null) {
            $count = $this->count();
            foreach ($data as $i => $value) {
                if (!isset($this[$i])) {
                    $this->setAt($i, $value, $options);
                } else {
                    $this[$i]->amend($value, $options);
                }
            }
            for ($i = count($data); $i < $count; $i++) {
                unset($this[$i]);
            }
        }
        $this->_original = $this->_data;
        $this->_modified = false;
        return $this;
    }
84785
public static function elementSelectionStateToBe($element_or_by, $selected)
    {
        if ($element_or_by instanceof WebDriverElement) {
            return new static(
                function () use ($element_or_by, $selected) {
                    return $element_or_by->isSelected() === $selected;
                }
            );
        } else {
            if ($element_or_by instanceof WebDriverBy) {
                return new static(
                    function (WebDriver $driver) use ($element_or_by, $selected) {
                        try {
                            $element = $driver->findElement($element_or_by);

                            return $element->isSelected() === $selected;
                        } catch (StaleElementReferenceException $e) {
                            return null;
                        }
                    }
                );
            }
        }
    }
396542
function select(choice)
        {
            newSelection = false;
            if ($scope.multiple)
            {
                if (arrayObjectIndexOf($scope.data.selected, choice) === -1)
                {
                    $scope.data.selected.push(choice);
                }
            }
            else
            {
                $scope.data.selected = [choice];
            }
        }
1232647
@When("^I de-select every item on the element on index '(\\d+?)'$")
    public void elementDeSelect(Integer index) {
        Select sel = null;
        sel = new Select(commonspec.getPreviousWebElements().getPreviousWebElements().get(index));

        if (sel.isMultiple()) {
            sel.deselectAll();
        }
    }
1258674
public function toggle($check_or_uncheck = null)
	{
		if ( !isset($check_or_uncheck) ) {
			$check_or_uncheck = !$this->isChecked();
		}

		return $check_or_uncheck ? $this->check() : $this->uncheck();
	}
138029
public function setSelected(bool $selected) : Option
    {
        if ($selected) {
            $this->tag->setAttribute('selected', 'selected');
        } else {
            $this->tag->removeAttribute('selected');
        }

        return $this;
    }
200898
function(state) {
			var changed = false,
				opts = this.tree.options,
				unselectable = FT.evalOption(
					"unselectable",
					this,
					this,
					opts,
					false
				),
				unselectableStatus = FT.evalOption(
					"unselectableStatus",
					this,
					this,
					opts,
					undefined
				);

			if (unselectable && unselectableStatus != null) {
				state = unselectableStatus;
			}
			switch (state) {
				case false:
					changed = this.selected || this.partsel;
					this.selected = false;
					this.partsel = false;
					break;
				case true:
					changed = !this.selected || !this.partsel;
					this.selected = true;
					this.partsel = true;
					break;
				case undefined:
					changed = this.selected || !this.partsel;
					this.selected = false;
					this.partsel = true;
					break;
				default:
					_assert(false, "invalid state: " + state);
			}
			// this.debug("fixSelection3AfterLoad() _changeSelectStatusAttrs()", state, changed);
			if (changed) {
				this.renderStatus();
			}
			return changed;
		}
817664
public function updateSelectQuery($select)
    {
        $p = null;
        if (!empty($this->owner->relations)) {
            $p = $this->owner->table_alias ?: $this->owner->table;
        }

        if ($this->relation) {
            $select->field($this->actual_field ?: $this->short_name, $this->relation->short_name, $this->short_name);
        } elseif (!(is_null($this->actual_field)) && $this->actual_field != $this->short_name) {
            $select->field($this->actual_field, $p, $this->short_name);

            return $this;
        } else {
            $select->field($this->short_name, $p);
        }

        return $this;
    }
389832
public function setSelect() {
        $select = $this->_options['select'];
        if (!$select) {
            $select = $this->getModel()->select();
        }
        if ($this->_options['conditions']) {
            $select->where($this->_options['conditions']);
        }       
        if ($this->_options['order']) {
            $select->order($this->_options['order']);
        }
        $this->_select = $select;
        return $this;
    }
361358
public function modifySelect(Zend_Db_Select &$select) {
        foreach ($this->_config as $i => $condition) {
            $select->where($condition, $this->_values[$i]);
        }
    }
604048
public void select(String optionLocator) {
        getDispatcher().beforeSelect(this, optionLocator);
        
        if (StringUtils.isBlank(optionLocator)) {
            throw new IllegalArgumentException("Locator cannot be null or empty.");
        }
        if (optionLocator.split("=").length != 2) {
            StringBuilder errMsg = new StringBuilder("Invalid locator specified :");
            errMsg.append(optionLocator);
            errMsg.append(". Locator should be of the form label=<value> (or) ");
            errMsg.append("value=<value> (or) ");
            errMsg.append("index=<value> (or) ");
            errMsg.append("id=<value>.");
            throw new IllegalArgumentException(errMsg.toString());
        }
        String locatorToUse = optionLocator.split("=")[1].trim();
        String tLocator = optionLocator.toLowerCase().split("=")[0].trim();
        if (tLocator.indexOf("label") >= 0) {
            // label was given
            new Select(getElement()).selectByVisibleText(locatorToUse);
        } else if (tLocator.indexOf("value") >= 0) {
            // value was given
            new Select(getElement()).selectByValue(locatorToUse);
        } else if (tLocator.indexOf("index") >= 0) {
            // index was given
            new Select(getElement()).selectByIndex(Integer.parseInt(locatorToUse));
        } else if (tLocator.indexOf("id") >= 0) {
            // id was given
            getElement().findElementById(locatorToUse).click();
        } else {
            throw new NoSuchElementException("Unable to find " + optionLocator);
        }
        
        getDispatcher().afterSelect(this, optionLocator);
    }
825191
void toggleSelectOU() {

        boolean create = m_fieldCreateOU.getValue().booleanValue();

        m_fieldSelectOU.setEnabled(!create);
        m_fieldSelectParentOU.setEnabled(create);
        m_fieldSelectOU.select("/");
    }
216325
protected static function makeSelect()
    {
        $self   = self::getInstance();
        $select = (!empty($self->optionSelect)) ? $self->optionSelect : "*";

        return "SELECT {$select} FROM {$self->table_name} ";
    }
47235
@Override
	public void setSelected(boolean selected) {
		if (selected) {
			((ToolbarModalAction) toolbarAction).onSelect(null);
		} else {
			((ToolbarModalAction) toolbarAction).onDeselect(null);
		}
	}
1127728
function(callOpts) {
			var opts = this.tree.options;

			//		this.debug("fixSelection3FromEndNodes()");
			_assert(opts.selectMode === 3, "expected selectMode 3");

			// Visit all end nodes and adjust their parent's `selected` and `partsel`
			// attributes. Return selection state true, false, or undefined.
			function _walk(node) {
				var i,
					l,
					child,
					s,
					state,
					allSelected,
					someSelected,
					unselIgnore,
					unselState,
					children = node.children;

				if (children && children.length) {
					// check all children recursively
					allSelected = true;
					someSelected = false;

					for (i = 0, l = children.length; i < l; i++) {
						child = children[i];
						// the selection state of a node is not relevant; we need the end-nodes
						s = _walk(child);
						// if( !child.unselectableIgnore ) {
						unselIgnore = FT.evalOption(
							"unselectableIgnore",
							child,
							child,
							opts,
							false
						);
						if (!unselIgnore) {
							if (s !== false) {
								someSelected = true;
							}
							if (s !== true) {
								allSelected = false;
							}
						}
					}
					state = allSelected
						? true
						: someSelected
							? undefined
							: false;
				} else {
					// This is an end-node: simply report the status
					unselState = FT.evalOption(
						"unselectableStatus",
						node,
						node,
						opts,
						undefined
					);
					state = unselState == null ? !!node.selected : !!unselState;
				}
				node._changeSelectStatusAttrs(state);
				return state;
			}
			_walk(this);

			// Update parent's state
			this.visitParents(function(node) {
				var i,
					l,
					child,
					state,
					unselIgnore,
					unselState,
					children = node.children,
					allSelected = true,
					someSelected = false;

				for (i = 0, l = children.length; i < l; i++) {
					child = children[i];
					unselIgnore = FT.evalOption(
						"unselectableIgnore",
						child,
						child,
						opts,
						false
					);
					if (!unselIgnore) {
						unselState = FT.evalOption(
							"unselectableStatus",
							child,
							child,
							opts,
							undefined
						);
						state =
							unselState == null
								? !!child.selected
								: !!unselState;
						// When fixing the parents, we trust the sibling status (i.e.
						// we don't recurse)
						if (state || child.partsel) {
							someSelected = true;
						}
						if (!state) {
							allSelected = false;
						}
					}
				}
				state = allSelected ? true : someSelected ? undefined : false;
				node._changeSelectStatusAttrs(state);
			});
		}