Package com.google.gwt.dom.client

Examples of com.google.gwt.dom.client.OptionElement


   *          {@link FormPanel}.
   * @param index the index at which to insert it
   */
  public void insertItem(String item, String value, int index) {
    SelectElement select = getSelectElement();
    OptionElement option = Document.get().createOptionElement();
    option.setText(item);
    option.setValue(value);

    if ((index == -1) || (index == select.getLength())) {
      select.add(option, null);
    } else {
      OptionElement before = select.getOptions().getItem(index);
      select.add(option, before);
    }
  }
View Full Code Here


        return ret;
    }
   
    @Override
    public String getItemText(int index) {
        OptionElement opt = getOption(index);
        return opt.getInnerText();
    }
View Full Code Here

        return -1;
    }

    @Override
    public String getValue(int index) {
        OptionElement option = getOption(index);
        return option.getValue();
    }
View Full Code Here

            parent = optgroup.getInsertParent();
            before = null;
        }
        optgroup.increment();
               
        OptionElement option = createOption(item, value);
        parent.insertBefore(option, before);
    }
View Full Code Here

        parent.insertBefore(option, before);
    }

    @Override
    public boolean isItemSelected(int index) {
        OptionElement option = getOption(index);
        return (option != null) ? option.isSelected() : false;
    }
View Full Code Here

            OptGroup group = groups.get(i);           
            int count = group.getCount();
            if (childIndex < count) {
               
                // do the remove
                OptionElement element = group.getChildOption(childIndex);
                element.removeFromParent();
               
                group.decrement();
               
                // remove empty groups
                if (group.getCount() <= 0) {
View Full Code Here

        throw new IndexOutOfBoundsException("problem in removeItem: index="+index+" range=[0-"+(getItemCount()-1)+"]");               
    }

    @Override
    public void setItemSelected(int index, boolean selected) {
        OptionElement option = getOption(index);
        option.setSelected(selected);
    }
View Full Code Here

    @Override
    public void setItemText(int index, String text) {
        if (text == null) {
            throw new NullPointerException("Cannot set an option to have null text");
        }
        OptionElement option = getOption(index);
        option.setText(text);
    }
View Full Code Here

        if (index < 0) getSelectElement().setSelectedIndex(index);
    }

    @Override
    public void setValue(int index, String value) {
        OptionElement option = getOption(index);
        option.setValue(value);
    }
View Full Code Here

        }
        return adjusted;
    }
   
    protected OptionElement createOption(String item, String value) {
        OptionElement option = Document.get().createOptionElement();
        option.setText(item);
        option.setInnerText(item);
        option.setValue(value);
        return option;
    }
View Full Code Here

TOP

Related Classes of com.google.gwt.dom.client.OptionElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.