Parts of this class are an adapted version of InputRenderer#getSelectItems()
of PrimeFaces 5.1.

@param rw
@throws IOException
320588
protected void renderOptions(FacesContext context, ResponseWriter rw, SelectOneMenu menu) throws IOException {
		Converter converter = menu.getConverter();
		List<SelectItemAndComponent> items = SelectItemUtils.collectOptions(context, menu, converter);
		
		SelectItemAndComponent selection = determineSelectedItem(context, menu, items, converter);

		for (int index = 0; index < items.size(); index++) {
			SelectItemAndComponent option = items.get(index);

			if (option.getSelectItem().isNoSelectionOption() && 
					menu.isHideNoSelectionOption() && selection != null)
				continue;
			
			renderOption(context, menu, rw, (option.getSelectItem()), index, option.getComponent(), 
					option == selection || (selection == null && option.getSelectItem().isNoSelectionOption()));
		}
	}
151277
public static int poll(Selector selector, PollItem[] items, int count, long timeout)
    {
        Utils.checkArgument(items != null, "items have to be supplied for polling");
        if (count == 0) {
            if (timeout <= 0) {
                return 0;
            }
            LockSupport.parkNanos(TimeUnit.NANOSECONDS.convert(timeout, TimeUnit.MILLISECONDS));
            return 0;
        }
        long now = 0L;
        long end = 0L;

        HashMap<SelectableChannel, SelectionKey> saved = new HashMap<SelectableChannel, SelectionKey>();
        for (SelectionKey key : selector.keys()) {
            if (key.isValid()) {
                saved.put(key.channel(), key);
            }
        }

        for (int i = 0; i < count; i++) {
            PollItem item = items[i];
            if (item == null) {
                continue;
            }

            SelectableChannel ch = item.getChannel(); // mailbox channel if ZMQ socket
            SelectionKey key = saved.remove(ch);

            if (key != null) {
                if (key.interestOps() != item.interestOps()) {
                    key.interestOps(item.interestOps());
                }
                key.attach(item);
            }
            else {
                try {
                    ch.register(selector, item.interestOps(), item);
                }
                catch (ClosedSelectorException e) {
                    // context was closed asynchronously, exit gracefully
                    return -1;
                }
                catch (ClosedChannelException e) {
                    throw new ZError.IOException(e);
                }
            }
        }

        if (!saved.isEmpty()) {
            for (SelectionKey deprecated : saved.values()) {
                deprecated.cancel();
            }
        }

        boolean firstPass = true;
        int nevents = 0;
        int ready;

        while (true) {
            //  Compute the timeout for the subsequent poll.
            long waitMillis;
            if (firstPass) {
                waitMillis = 0L;
            }
            else if (timeout < 0L) {
                waitMillis = -1L;
            }
            else {
                waitMillis = TimeUnit.NANOSECONDS.toMillis(end - now);
                if (waitMillis == 0) {
                    waitMillis = 1L;
                }
            }

            //  Wait for events.
            try {
                int rc;
                if (waitMillis < 0) {
                    rc = selector.select(0);
                }
                else if (waitMillis == 0) {
                    rc = selector.selectNow();
                }
                else {
                    rc = selector.select(waitMillis);
                }

                for (SelectionKey key : selector.keys()) {
                    PollItem item = (PollItem) key.attachment();
                    ready = item.readyOps(key, rc);
                    if (ready < 0) {
                        return -1;
                    }

                    if (ready > 0) {
                        nevents++;
                    }
                }
                selector.selectedKeys().clear();

            }
            catch (ClosedSelectorException e) {
                // context was closed asynchronously, exit gracefully
                return -1;
            }
            catch (IOException e) {
                throw new ZError.IOException(e);
            }
            //  If timeout is zero, exit immediately whether there are events or not.
            if (timeout == 0) {
                break;
            }

            if (nevents > 0) {
                break;
            }

            //  At this point we are meant to wait for events but there are none.
            //  If timeout is infinite we can just loop until we get some events.
            if (timeout < 0) {
                if (firstPass) {
                    firstPass = false;
                }
                continue;
            }

            //  The timeout is finite and there are no events. In the first pass
            //  we get a timestamp of when the polling have begun. (We assume that
            //  first pass have taken negligible time). We also compute the time
            //  when the polling should time out.
            if (firstPass) {
                now = Clock.nowNS();
                end = now + TimeUnit.MILLISECONDS.toNanos(timeout);
                if (now == end) {
                    break;
                }
                firstPass = false;
                continue;
            }

            //  Find out whether timeout have expired.
            now = Clock.nowNS();
            if (now >= end) {
                break;
            }
        }
        return nevents;
    }
278029
private InputStream getStream(List<FileItem> items) throws IOException {
        for (FileItem i : items) {
            if (!i.isFormField() && i.getFieldName().equals(CONTENT_PARAMETER)) {
                return i.getInputStream();
            }
        }
        return null;
    }
1358226
@Nonnull
    public static List<SCMDecisionHandler> listShouldPollVetos(@Nonnull Item item) {
        List<SCMDecisionHandler> result = new ArrayList<>();
        for (SCMDecisionHandler handler : all()) {
            if (!handler.shouldPoll(item)) {
                result.add(handler);
            }
        }
        return result;
    }
926430
@Override
    public void readFragmentFrom(MwsReader r) {
        listOrderItemsByNextTokenResult = r.read("ListOrderItemsByNextTokenResult", ListOrderItemsByNextTokenResult.class);
        responseMetadata = r.read("ResponseMetadata", ResponseMetadata.class);
    }
309952
public Collection<ItemT> getSelectedItems() {
        if (availableItems == null || selectedIndices == null || selectedIndices.length == 0) {
            return new ArrayList<ItemT>(0);
        }

        ArrayList<ItemT> items = new ArrayList<ItemT>(selectedIndices.length);
        for (int index : selectedIndices) {
            items.add(availableItems.get(index));
        }
        return items;
    }
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();
        }
    }
79025
public T itemSelected(AdapterView.OnItemSelectedListener listener) {

        if (view instanceof AdapterView) {
            AdapterView<?> alv = (AdapterView<?>) view;
            alv.setOnItemSelectedListener(listener);
        }

        return self();

    }
852424
public static int[] getColorsFromArrayRes(Resources resources, int resId) {
        try {
            @SuppressLint("Recycle")
            TypedArray array = resources.obtainTypedArray(resId);
            if (array.length() > 0) {
                final int len = array.length();
                final int[] colors = new int[len];
                for (int i = 0; i < len; i++) {
                    colors[i] = array.getColor(i, 0);
                }
                return colors;
            }
        } catch (Resources.NotFoundException ignored) {
        }
        return null;
    }
1183046
@Override
    public void readFragmentFrom(MwsReader r) {
        getServiceStatusResult = r.read("GetServiceStatusResult", GetServiceStatusResult.class);
        responseMetadata = r.read("ResponseMetadata", ResponseMetadata.class);
    }
877690
private void fillWizardPageWithSelectedTypes() {
		final StructuredSelection selection = getSelectedItems();
		if (selection == null) {
			return;
		}
		for (final Iterator<?> iter = selection.iterator(); iter.hasNext();) {
			final Object obj = iter.next();
			if (obj instanceof TypeNameMatch) {
				accessedHistoryItem(obj);
				final TypeNameMatch type = (TypeNameMatch) obj;
				final String qualifiedName = Utilities.getNameWithTypeParameters(type.getType());
				final String message;

				if (addTypeToWizardPage(this.typeWizardPage, qualifiedName)) {
					message = MessageFormat.format(Messages.AbstractSuperTypeSelectionDialog_2,
							TextProcessor.process(qualifiedName, JAVA_ELEMENT_DELIMITERS));
				} else {
					message = MessageFormat.format(Messages.AbstractSuperTypeSelectionDialog_3,
							TextProcessor.process(qualifiedName, JAVA_ELEMENT_DELIMITERS));
				}
				updateStatus(new StatusInfo(IStatus.INFO, message));
			}
		}
	}
811186
protected void renderSelectTag(FacesContext context, ResponseWriter rw, String clientId, String name,
			SelectMultiMenu menu) throws IOException {
		renderSelectTag(rw, menu);
		renderSelectTagAttributes(rw, clientId, name, menu);
        AJAXRenderer.generateBootsFacesAJAXAndJavaScript(FacesContext.getCurrentInstance(), menu, rw, false);
		Object selectedOption = getValue2Render(context, menu);
		String[] optionList;
		if (selectedOption == null) {
			optionList = new String[0];
		} else if (!(selectedOption instanceof String)) {
			throw new FacesException("SelectMultiMenu only works with Strings!");
		} else {
			optionList = ((String) selectedOption).split(",");
		}
		renderOptions(context, rw, optionList, menu);

		renderInputTagEnd(rw);
	}
1205301
@Override
    public void readFragmentFrom(MwsReader r) {
        invoiceRequirement = r.read("InvoiceRequirement", String.class);
        buyerSelectedInvoiceCategory = r.read("BuyerSelectedInvoiceCategory", String.class);
        invoiceTitle = r.read("InvoiceTitle", String.class);
        invoiceInformation = r.read("InvoiceInformation", String.class);
    }
1334741
@UiHandler("navTree")
  final void menuItemSelected(final SelectionEvent<TreeItem> pselectionEvent) {
    if (selectedItem != null && !selectedItem.equals(pselectionEvent.getSelectedItem())) {
      // workaround, revert selection, it's triggered by the selected page
      pselectionEvent.getSelectedItem().setSelected(false);
      selectedItem.setSelected(true);
    }
  }
1189896
public static streamselector[] get(nitro_service service) throws Exception{
		streamselector obj = new streamselector();
		streamselector[] response = (streamselector[])obj.get_resources(service);
		return response;
	}
745406
@SideOnly(Side.CLIENT)
	public static void registerItemRenderer(Item item, IItemRenderer renderer)
	{
		clientRegistry.itemRenderers.put(checkNotNull(item), checkNotNull(renderer));
	}
1266535
public void setSelectedMenuItems(final List<? extends MenuItemSelectable> selectedItems) {
		MenuModel model = getOrCreateComponentModel();
		if (selectedItems == null || selectedItems.isEmpty()) {
			model.selectedMenuItems = null;
		} else {
			List<MenuItemSelectable> items = new ArrayList<>();
			for (MenuItemSelectable item : selectedItems) {
				if (item.isSelectAllowed()) {
					items.add(item);
				}
			}
			if (items.isEmpty()) {
				model.selectedMenuItems = null;
			} else {
				model.selectedMenuItems = items;
			}
		}
	}