/*
(non-Javadoc)

@see qc.automation.framework.widget.ISelectList#getSelectedOption()
512957
@Override
    public String getSelectedOption() throws WidgetException {
        Object value = getValue();
        if (value != null) {
            if (value instanceof String) {
                return (String) value;
            } else {
                throw new WidgetException("More than one option selected", getByLocator());
            }
        } else {
            return null;
        }
    }
420199
public int getCurrentSelectedPosition() {
        return mDrawerBuilder.mAdapter.getSelections().size() == 0 ? -1 : mDrawerBuilder.mAdapter.getSelections().iterator().next();
    }
215870
public static <T> T getRandomSelection(T... options) {
        if (options == null || options.length == 0) {
            if (tc.isDebugEnabled()) {
                Tr.debug(tc, "No options provided to random selection, returning null");
            }
            return null;
        }
        if (options.length == 1) {
            if (tc.isDebugEnabled()) {
                Tr.debug(tc, "Only one option provided to random selection, returning it: [" + options[0] + "]");
            }
            return options[0];
        }

        Random rand = new Random();
        Integer index = rand.nextInt(options.length);

        T entry = options[index];
        if (tc.isDebugEnabled()) {
            Tr.debug(tc, "Chose random selection: [" + ((entry == null) ? null : entry) + "]");
        }
        return entry;
    }
1030517
public synchronized SelectionCriteria getSelectionCriteria()
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getSelectionCriteria"); //469395

      checkReleased();

      SelectorDomain selectorDomain = SelectorDomain.getSelectorDomain(getShort());
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Selector domain", selectorDomain);

      /**************************************************************/
      /* Destination                                                */
      /**************************************************************/
      String discriminator = getString();
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Discriminator:", discriminator);

      /**************************************************************/
      /* Destination                                                */
      /**************************************************************/
      String selector = getString();
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Selector:", selector);

      SelectionCriteria selectionCriteria =
    		  CommsClientServiceFacade.getSelectionCriteriaFactory().createSelectionCriteria(discriminator,
                                                                        selector,
                                                                        selectorDomain);



      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getSelectionCriteria"); //469395
      return selectionCriteria;
   }
690359
public java.lang.String getOnselect() {
        return (java.lang.String) getStateHelper().eval(PropertyKeys.onselect);

    }
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();
	}
915794
public GraphPlace getSelection() {
        Collection<GraphPlace> selection = getSelectedGraphObjects();
        return (selection != null && !selection.isEmpty()) ? selection.iterator().next() : null;
    }
1027499
@Override
    public String getValue() throws WidgetException {
        try {
            return getSelectedOption();
        } catch (Exception e) {
            throw new WidgetException("Error while getting dropdown value", getByLocator(), e);
        }
    }
543843
@Override
    public List<String> getOptions() throws WidgetException {
        try {
            org.openqa.selenium.support.ui.Select selectBox = new org.openqa.selenium.support.ui.Select(
                    findElement());
            List<WebElement> options = selectBox.getOptions();

            List<String> optionsTextValues = new ArrayList<String>();
            for (WebElement e : options) {
                optionsTextValues.add(e.getText());
            }

            return optionsTextValues;
        } catch (Exception e) {
            throw new WidgetException("Error while fetching select options", getByLocator(), e);
        }
    }
425889
function getSelected() {
  var selected = [];
  $('.selectItem').each(function() {
    if ($(this).is(':checked')) {
      selected.push(utils.deEncID($(this).attr('name').replace('cb_', '')));
    }
  });
  return selected;
}
904478
@Override
    public List<String> getOptions() throws WidgetException {
        try {
            Select select = new Select(getByLocator());
            return select.getOptions();
        } catch (Exception e) {
            throw new WidgetException("Error while fetching drop down options", getByLocator(), e);
        }
    }
849790
public function getSelectedOptions()
	{
		$ret = array();

		foreach ( $this->getOptions() as $option ) {
			if ( $option->isSelected() ) {
				$ret[] = $option;
			}
		}

		return $ret;
	}
602762
public String selectedValue() {
        if (isNotPresentSelect()) {
            return null;
        }
        WebElement webElement = element.getWebElement();
        Select dropdown = new Select(webElement);
        WebElement option = dropdown.getFirstSelectedOption();
        return option.getAttribute(VALUE);
    }
1008312
public Category getSelectedCategory() {
    TreeItem<Category> selectedTreeItem =
        navigationView.treeView.getSelectionModel().getSelectedItem();
    if (selectedTreeItem != null) {
      return navigationView.treeView.getSelectionModel().getSelectedItem().getValue();
    }
    return null;
  }
577752
protected List<CmsSelectWidgetOption> getSelectRoles() {

        List<CmsSelectWidgetOption> retVal = new ArrayList<CmsSelectWidgetOption>();

        try {
            boolean inRootOu = CmsStringUtil.isEmptyOrWhitespaceOnly(getParamOufqn())
                || CmsOrganizationalUnit.SEPARATOR.equals(getParamOufqn());
            List<CmsRole> roles = OpenCms.getRoleManager().getRolesOfUser(
                getCms(),
                getCms().getRequestContext().getCurrentUser().getName(),
                getParamOufqn(),
                false,
                false,
                false);
            Iterator<CmsRole> itRoles = roles.iterator();
            while (itRoles.hasNext()) {
                CmsRole role = itRoles.next();
                if (role.isOrganizationalUnitIndependent() && !inRootOu) {
                    continue;
                }
                retVal.add(new CmsSelectWidgetOption(role.getGroupName(), false, role.getName(getLocale())));
            }
        } catch (CmsException e) {
            // noop
        }
        Collections.sort(retVal, new Comparator<CmsSelectWidgetOption>() {

            public int compare(CmsSelectWidgetOption arg0, CmsSelectWidgetOption arg1) {

                return arg0.getOption().compareTo(arg1.getOption());
            }

        });
        return retVal;
    }
234060
public CmsListItem getSelectedItem() {

        try {
            return getList().getItem(
                CmsStringUtil.splitAsArray(getParamSelItems(), CmsHtmlList.ITEM_SEPARATOR)[0].trim());
        } catch (Exception e) {
            try {
                return getList().getItem("");
            } catch (Exception e1) {
                return null;
            }
        }
    }
739765
public List<I_CmsDataViewItem> getSelection() {

        List<I_CmsDataViewItem> result = Lists.newArrayList();
        Object val = m_table.get().getValue();
        if (val == null) {
            return result;
        }
        if (val instanceof Collection) {
            Collection<?> results = (Collection<?>)val;
            for (Object obj : results) {
                result.add(m_dataView.getItemById((String)obj));
            }
        } else {
            result.add(m_dataView.getItemById((String)val));
        }
        return result;

    }