/** * Sets the index property. * @param index the index * @param start the scriptable object that was originally invoked for this property * @param newValue the new value */ @Override public void put(final int index, final Scriptable start, final Object newValue) { if (newValue == null) { // Remove the indexed option. htmlSelect_.removeOption(index); } else { final HTMLOptionElement option = (HTMLOptionElement) newValue; final HtmlOption htmlOption = (HtmlOption) option.getDomNodeOrNull(); if (index >= getLength()) { setLength(index); // Add a new option at the end. htmlSelect_.appendOption(htmlOption); } else { // Replace the indexed option. htmlSelect_.replaceOption(index, htmlOption); } } }
/** * Sets the index property. * @param index the index * @param start the scriptable object that was originally invoked for this property * @param newValue the new value */ @Override public void put(final int index, final Scriptable start, final Object newValue) { if (newValue == null) { // Remove the indexed option. htmlSelect_.removeOption(index); } else { final HTMLOptionElement option = (HTMLOptionElement) newValue; final HtmlOption htmlOption = (HtmlOption) option.getDomNodeOrNull(); if (index >= getLength()) { setLength(index); // Add a new option at the end. htmlSelect_.appendOption(htmlOption); } else { // Replace the indexed option. htmlSelect_.replaceOption(index, htmlOption); } } }
/** * Sets the index property. * @param index the index * @param start the scriptable object that was originally invoked for this property * @param newValue the new value */ @Override public void put(final int index, final Scriptable start, final Object newValue) { if (newValue == null) { // Remove the indexed option. htmlSelect_.removeOption(index); } else { final HTMLOptionElement option = (HTMLOptionElement) newValue; final HtmlOption htmlOption = option.getDomNodeOrNull(); if (index >= jsxGet_length()) { // Add a new option at the end. htmlSelect_.appendOption(htmlOption); } else { // Replace the indexed option. htmlSelect_.replaceOption(index, htmlOption); } } if (jsxGet_length() == 1 && !htmlSelect_.isMultipleSelectEnabled()) { ((HTMLSelectElement) htmlSelect_.getScriptObject()).jsxSet_selectedIndex(0); } }
/** * Sets the index property. * @param index the index * @param start the scriptable object that was originally invoked for this property * @param newValue the new value */ @Override public void put(final int index, final Scriptable start, final Object newValue) { if (newValue == null) { // Remove the indexed option. htmlSelect_.removeOption(index); } else { final HTMLOptionElement option = (HTMLOptionElement) newValue; final HtmlOption htmlOption = option.getDomNodeOrNull(); if (index >= jsxGet_length()) { // Add a new option at the end. htmlSelect_.appendOption(htmlOption); } else { // Replace the indexed option. htmlSelect_.replaceOption(index, htmlOption); } } if (jsxGet_length() == 1 && !htmlSelect_.isMultipleSelectEnabled()) { ((HTMLSelectElement) htmlSelect_.getScriptObject()).jsxSet_selectedIndex(0); } }
/** * Sets the index property. * @param index the index * @param start the scriptable object that was originally invoked for this property * @param newValue the new value */ @Override public void put(final int index, final Scriptable start, final Object newValue) { if (newValue == null) { // Remove the indexed option. htmlSelect_.removeOption(index); } else { final HTMLOptionElement option = (HTMLOptionElement) newValue; final HtmlOption htmlOption = option.getDomNodeOrNull(); if (index >= jsxGet_length()) { // Add a new option at the end. htmlSelect_.appendOption(htmlOption); } else { // Replace the indexed option. htmlSelect_.replaceOption(index, htmlOption); } } if (jsxGet_length() == 1 && !htmlSelect_.isMultipleSelectEnabled()) { ((HTMLSelectElement) htmlSelect_.getScriptObject()).jsxSet_selectedIndex(0); } }