/** * If we were given an invalid <tt>size</tt> attribute, normalize it. * Then set a default selected option if none was specified and the size is 1 or less * and this isn't a multiple selection input. * @param postponed whether to use {@link com.gargoylesoftware.htmlunit.javascript.PostponedAction} or no */ @Override protected void onAllChildrenAddedToPage(final boolean postponed) { // Fix the size if necessary. int size; try { size = Integer.parseInt(getSizeAttribute()); if (size < 0) { removeAttribute("size"); size = 0; } } catch (final NumberFormatException e) { removeAttribute("size"); size = 0; } // Set a default selected option if necessary. if (getSelectedOptions().isEmpty() && size <= 1 && !isMultipleSelectEnabled()) { final List<HtmlOption> options = getOptions(); if (!options.isEmpty()) { final HtmlOption first = options.get(0); first.setSelectedInternal(true); } } }
/** * If we were given an invalid <tt>size</tt> attribute, normalize it. * Then set a default selected option if none was specified and the size is 1 or less * and this isn't a multiple selection input. * @param postponed whether to use {@link com.gargoylesoftware.htmlunit.javascript.PostponedAction} or no */ @Override protected void onAllChildrenAddedToPage(final boolean postponed) { // Fix the size if necessary. int size; try { size = Integer.parseInt(getSizeAttribute()); if (size < 0) { removeAttribute("size"); size = 0; } } catch (final NumberFormatException e) { removeAttribute("size"); size = 0; } // Set a default selected option if necessary. if (getSelectedOptions().isEmpty() && size <= 1 && !isMultipleSelectEnabled()) { final List<HtmlOption> options = getOptions(); if (!options.isEmpty()) { final HtmlOption first = options.get(0); first.setSelectedInternal(true); } } }
/** * If we were given an invalid <tt>size</tt> attribute, normalize it. * Then set a default selected option if none was specified and the size is 1 or less * and this isn't a multiple selection input. * @param postponed whether to use {@link com.gargoylesoftware.htmlunit.javascript.PostponedAction} or no */ @Override protected void onAllChildrenAddedToPage(final boolean postponed) { // Fix the size if necessary. int size; try { size = Integer.parseInt(getSizeAttribute()); if (size < 0) { removeAttribute("size"); size = 0; } } catch (final NumberFormatException e) { removeAttribute("size"); size = 0; } // Set a default selected option if necessary. if (getSelectedOptions().isEmpty() && size <= 1 && !isMultipleSelectEnabled()) { final List<HtmlOption> options = getOptions(); if (!options.isEmpty()) { final HtmlOption first = options.get(0); first.setSelectedInternal(true); } } }
/** * If we were given an invalid <tt>size</tt> attribute, normalize it. * Then set a default selected option if none was specified and the size is 1 or less * and this isn't a multiple selection input. * @param postponed whether to use {@link com.gargoylesoftware.htmlunit.javascript.PostponedAction} or no */ @Override protected void onAllChildrenAddedToPage(final boolean postponed) { // Fix the size if necessary. int size; try { size = Integer.parseInt(getSizeAttribute()); if (size < 0) { removeAttribute("size"); size = 0; } } catch (final NumberFormatException e) { removeAttribute("size"); size = 0; } // Set a default selected option if necessary. if (getSelectedOptions().isEmpty() && size <= 1 && !isMultipleSelectEnabled()) { final List<HtmlOption> options = getOptions(); if (!options.isEmpty()) { final HtmlOption first = options.get(0); first.setSelectedInternal(true); } } }
/** * If we were given an invalid <tt>size</tt> attribute, normalize it. * Then set a default selected option if none was specified and the size is 1 or less * and this isn't a multiple selection input. * @param postponed whether to use {@link com.gargoylesoftware.htmlunit.javascript.PostponedAction} or no */ @Override protected void onAllChildrenAddedToPage(final boolean postponed) { // Fix the size if necessary. int size; try { size = Integer.parseInt(getSizeAttribute()); if (size < 0) { removeAttribute("size"); size = 0; } } catch (final NumberFormatException e) { removeAttribute("size"); size = 0; } // Set a default selected option if necessary. if (getSelectedOptions().isEmpty() && size <= 1 && !isMultipleSelectEnabled()) { final List<HtmlOption> options = getOptions(); if (!options.isEmpty()) { final HtmlOption first = options.get(0); first.setSelectedInternal(true); } } }