/*
(non-Javadoc)

@see qc.automation.framework.widget.ISelectList#getOptions()
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);
        }
    }
826722
@Override
    public String[] getOptionLabels() {
        String[] labels = new String[valueOptions.size()];
        for (int i = 0; i < labels.length; i++) {
            labels[i] = valueOptions.get(i)[1];
        }
        return labels;
    }
642634
public String[] getOptions() {
    Vector<String>	result;
    String[]      	options;
    int           	i;
    
    result = new Vector<String>();

    result.add("-B");
    result.add(MOAUtils.toCommandLine(m_ActualGenerator));
    
    options = super.getOptions();
    for (i = 0; i < options.length; i++)
      result.add(options[i]);
    
    return result.toArray(new String[result.size()]);
  }
  
  /**
   * Sets the MOA stream generator to use.
   * 
   * @param value the stream generator to use
   */
  public void setGenerator(ClassOption value) {
  	m_Generator       = value;
  	m_ActualGenerator = (InstanceStream) MOAUtils.fromOption(m_Generator);
  }
  
  /**
   * Returns the current MOA stream generator in use.
   * 
   * @return the stream generator in use
   */
  public ClassOption getGenerator() {
  	return m_Generator;
  }
  
  /**
   * Returns the tooltip displayed in the GUI.
   * 
   * @return the tooltip
   */
  public String generatorTipText() {
  	return "The MOA stream generator to use.";
  }

  /**
   * Return if single mode is set for the given data generator
   * mode depends on option setting and or generator type.
   * 
   * @return single mode flag, always true
   * @throws Exception if mode is not set yet
   */
  public boolean getSingleModeFlag() throws Exception {
    return true;
  }

  /**
   * Initializes the format for the dataset produced. 
   *
   * @return the format for the dataset 
   * @throws Exception if the generating of the format failed
   */
  public Instances defineDataFormat() throws Exception {
  	int		numExamples;
  	
  	m_ActualGenerator = (InstanceStream) MOAUtils.fromOption(m_Generator);
  	((AbstractOptionHandler) m_ActualGenerator).prepareForUse();
     this.instanceConverter = new SamoaToWekaInstanceConverter();   
    m_DatasetFormat = new Instances(instanceConverter.wekaInstances(m_ActualGenerator.getHeader()));

    // determine number of instances to generate
    numExamples = getNumExamples();
    if (m_ActualGenerator.estimatedRemainingInstances() != -1) {
    	if (m_ActualGenerator.estimatedRemainingInstances() < numExamples)
    		numExamples = (int) m_ActualGenerator.estimatedRemainingInstances();
    }
    setNumExamplesAct(numExamples);
    
    return m_DatasetFormat;
  }

  /**
   * Generates one example of the dataset. 
   *
   * @return the generated example, null if no further example available
   * @throws Exception if the format of the dataset is not yet defined
   * @throws Exception if the generator only works with generateExamples
   * which means in non single mode
   */
  public Instance generateExample() throws Exception {
  	if (m_ActualGenerator.hasMoreInstances()) {
  		return instanceConverter.wekaInstance(m_ActualGenerator.nextInstance().getData());
        } else {
  		return null;
  }
  }

  /**
   * Generates all examples of the dataset. Re-initializes the random number
   * generator with the given seed, before generating instances.
   *
   * @return the generated dataset
   * @throws Exception if the format of the dataset is not yet defined
   * @throws Exception if the generator only works with generateExample,
   * which means in single mode
   * @see   #getSeed()
   */
  public Instances generateExamples() throws Exception {
    Instances       result;
    Instance				inst;
    int             i;

    result   = new Instances(m_DatasetFormat, 0);
    m_Random = new Random(getSeed());

    for (i = 0; i < getNumExamplesAct(); i++) {
    	inst = generateExample();
    	if (inst != null)
    		result.add(inst);
    	else
    		break;
    }
    
    return result;
  }

  /**
   * Generates a comment string that documentates the data generator.
   * By default this string is added at the beginning of the produced output
   * as ARFF file type, next after the options.
   * 
   * @return string contains info about the generated rules
   */
  public String generateStart () {
    return "";
  }

  /**
   * Generates a comment string that documentats the data generator.
   * By default this string is added at the end of theproduces output
   * as ARFF file type.
   * 
   * @return string contains info about the generated rules
   * @throws Exception if the generating of the documentaion fails
   */
  public String generateFinished() throws Exception {
    return "";
  }
  
  /**
   * Returns the revision string.
   * 
   * @return		the revision
   */
  public String getRevision() {
    return RevisionUtils.extract("$Revision$");
  }

  /**
   * Main method for executing this class.
   *
   * @param args should contain arguments for the data producer: 
   */
  public static void main(String[] args) {
    runDataGenerator(new MOA(), args);
  }
}
100121
private List<CmsSelectWidgetOption> getLocaleWidgetConfiguration() {

        List<CmsSelectWidgetOption> result = new ArrayList<CmsSelectWidgetOption>();
        for (Locale locale : m_searchManager.getAnalyzers().keySet()) {
            CmsSelectWidgetOption option = new CmsSelectWidgetOption(
                locale.toString(),
                locale.equals(getSearchIndexIndex().getLocale()));
            result.add(option);
        }
        return result;
    }
1274292
@Override
	public List<CPSpecificationOption> findAll() {
		return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
	}
787744
public java.util.List<Option> getOptions() {
        if (options == null) {
            options = new com.amazonaws.internal.SdkInternalList<Option>();
        }
        return options;
    }
53231
public Set<String> getOptionsValues() {
        Set<String> result = new HashSet<>();
        for (OptionGroup group : optionGroups.values()) {
            result.addAll(group.getOptionValues());
        }

        return result;
    }
991909
@Override
    public Object getValue() throws WidgetException {
        List<String> selectedOptions = null;
        try {
            selectedOptions = getSelectedItems_internal();

        } catch (Exception e) {
            throw new WidgetException("Error while fetching selected value on select",
                    getByLocator(), e);
        }

        if (selectedOptions.size() == 0) {
            return null;
        } else if (selectedOptions.size() == 1) {
            return selectedOptions.get(0);
        } else {
            return selectedOptions;
        }
    }
144499
public List getTemplateConfigOptions() {

        List result = new ArrayList();
        result.add(new CmsSelectWidgetOption("", true, key(Messages.GUI_CHANGEELEMENTLOCALE_DIALOG_TEMPLATE_ALL_0)));

        TreeMap templates = null;
        try {
            // get all available templates
            templates = CmsNewResourceXmlPage.getTemplates(getCms(), null);
        } catch (CmsException e) {
            // can usually be ignored
            if (LOG.isInfoEnabled()) {
                LOG.info(e);
            }
        }
        if (templates != null) {
            // templates found, create option and value lists
            Iterator i = templates.entrySet().iterator();
            while (i.hasNext()) {
                Map.Entry entry = (Map.Entry)i.next();
                String key = (String)entry.getKey();
                String path = (String)entry.getValue();
                result.add(new CmsSelectWidgetOption(path, false, key));
            }
        }
        return result;
    }
130575
private List<CmsSelectWidgetOption> getProjects() {

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

        try {
            String defProject = null;
            if ((m_user != null) && CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_user.getName())) {
                defProject = new CmsUserSettings(m_user).getStartProject();
            }
            if (CmsStringUtil.isEmptyOrWhitespaceOnly(defProject)) {
                defProject = getParamOufqn() + OpenCms.getWorkplaceManager().getDefaultUserSettings().getStartProject();
            }
            if (CmsStringUtil.isEmptyOrWhitespaceOnly(defProject)) {
                defProject = getCms().getRequestContext().getCurrentProject().getName();
            }

            List<CmsProject> projectsList;
            projectsList = OpenCms.getOrgUnitManager().getAllAccessibleProjects(getCms(), getParamOufqn(), false);

            Iterator<CmsProject> itProjects = projectsList.iterator();

            while (itProjects.hasNext()) {
                boolean selected = false;
                CmsProject project = itProjects.next();

                String projectName = project.getName();
                if (projectName.equals(defProject)) {
                    selected = true;
                }
                if (isNewUser()) {
                    projects.add(
                        new CmsSelectWidgetOption(project.getSimpleName(), selected, project.getSimpleName(), null));
                } else {
                    projects.add(new CmsSelectWidgetOption(project.getName(), selected, project.getSimpleName(), null));
                }
            }

        } catch (CmsException e) {
            if (LOG.isErrorEnabled()) {
                LOG.error(e.getLocalizedMessage(), e);
            }
        }

        return projects;
    }
470435
String getOption(String[] options, int index) {
        if ((options != null) && (options.length > index)) {
            return options[index];
        }
        return null;
    }
53450
@Override
    public void selectMultipleOptions(List<String> options) throws WidgetException {
        try {
            setValue(options);
        } catch (Exception e) {
            throw new WidgetException("Error while selecting multiple options", getByLocator(), e);
        }
    }
829770
public alluxio.grpc.CheckConsistencyPOptions getOptions() {
    return options_ == null ? alluxio.grpc.CheckConsistencyPOptions.getDefaultInstance() : options_;
  }
746720
protected Options getOptions() throws MojoExecutionException {
        File persistence = ensurePersistenceXml();

        Options opts = new Options();
        if (toolProperties != null) {
            opts.putAll(toolProperties);
        }
        opts.put(OPTION_PROPERTIES_FILE, persistence.getAbsolutePath());

        if (connectionDriverName != null) {
            opts.put(OPTION_CONNECTION_DRIVER_NAME, connectionDriverName);
        }

        if (connectionProperties != null) {
            opts.put(OPTION_CONNECTION_PROPERTIES, connectionProperties);
        }

        // put the standard options into the list also
        opts.put(OPTION_ADD_DEFAULT_CONSTRUCTOR, Boolean.toString(addDefaultConstructor));
        opts.put(OPTION_ENFORCE_PROPERTY_RESTRICTION, Boolean.toString(enforcePropertyRestrictions));
        opts.put(OPTION_USE_TEMP_CLASSLOADER, Boolean.toString(tmpClassLoader));

        return opts;
    }
91586
public List<Option> getOptions(boolean includeDisabled) {
        List< Option> result = new ArrayList<>();

        for (OptionGroup group : optionGroups.values()) {
            result.addAll(group.getOptions(includeDisabled));
        }

        return result;
    }
728543
private List<CmsSelectWidgetOption> getViews() {

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

        // determine the default view
        String defaultView = null;
        if ((m_user != null) && CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_user.getName())) {
            defaultView = new CmsUserSettings(m_user).getStartView();
        }
        if (CmsStringUtil.isEmptyOrWhitespaceOnly(defaultView)) {
            defaultView = VIEW_WORKPLACE;
        }

        // get the workplace views
        List<CmsWorkplaceView> list = new ArrayList<CmsWorkplaceView>(OpenCms.getWorkplaceManager().getViews());

        // add the direct edit view to the list
        String displayName = getMessages().key(org.opencms.workplace.commons.Messages.GUI_LABEL_DIRECT_EDIT_VIEW_0);
        list.add(new CmsWorkplaceView(displayName, VIEW_DIRECT_EDIT, Float.valueOf(100)));

        // loop over the views and create a CmsSelectWidgetOption for each readable view
        for (CmsWorkplaceView view : list) {
            boolean visible = true;
            try {
                getCms().readResource(view.getUri());
            } catch (CmsException e) {
                // should usually never happen
                if (LOG.isInfoEnabled()) {
                    LOG.info(e.getLocalizedMessage());
                }
                visible = false;
            }
            if (visible) {
                boolean selected = view.getUri().equals(defaultView);
                views.add(new CmsSelectWidgetOption(view.getUri(), selected, resolveMacros(view.getKey()), null));
            }
        }
        return views;
    }
800089
public List<String> getOptionNames(Class<?> optionsHolderClass) {
        EdenPair<Field, Set<Field>> fields = findOptionFields(optionsHolderClass);

        List<String> optionNames = new ArrayList<>();

        for (Field field : fields.second) {
            String key = (!EdenUtils.isEmpty(field.getAnnotation(Option.class).value()))
                    ? field.getAnnotation(Option.class).value()
                    : field.getName();

            optionNames.add(key);
        }

        return optionNames;
    }