public void postSetDefaultListSelectionModel() { ItsNatHTMLSelectMultImpl comp = getItsNatHTMLSelectMult(); HTMLSelectElement select = comp.getHTMLSelectElement(); // El uso de HTMLSelectElement.getOptions() es terriblemente ineficiente. // No toleramos <optgroup> int i = 0; HTMLOptionElement option = (HTMLOptionElement) ItsNatTreeWalker.getFirstChildElement(select); while (option != null) { boolean selected = option.getSelected(); selectItem(i, selected); i++; option = (HTMLOptionElement) ItsNatTreeWalker.getNextSiblingElement(option); } }
public void handleEvent(Event evt) { super.handleEvent(evt); ItsNatHTMLSelectMultImpl comp = getItsNatHTMLSelectMult(); // if (comp.isServerUpdatingFromClient()) // return; String type = evt.getType(); if (type.equals("DOMCharacterDataModified")) { MutationEvent mutEvent = (MutationEvent) evt; CharacterData charDataNode = (CharacterData) mutEvent.getTarget(); HTMLOptionElement option = (HTMLOptionElement) charDataNode.getParentNode(); int index = option.getIndex(); String value = charDataNode.getData(); DefaultListModel dataModel = (DefaultListModel) comp.getListModel(); if (!value.equals(dataModel.get(index))) dataModel.set(index, value); } }