Package com.google.gwt.dom.client

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


    String currentLocale = LocaleInfo.getCurrentLocale().getLocaleName();
    String[] localeNames = LocaleInfo.getAvailableLocaleNames();
    for (String locale : localeNames) {
      if (!DEFAULT_LOCALE.equals(locale)) {
        String displayName = LocaleInfo.getLocaleNativeDisplayName(locale);
        OptionElement option = Document.get().createOptionElement();
        option.setValue(locale);
        option.setText(displayName);
        select.add(option, null);
        if (locale.equals(currentLocale)) {
          select.setSelectedIndex(select.getLength() - 1);
        }
      }
View Full Code Here


   *
   * @param index
   * @return the String corresponding to the page URL
   */
  public String getPageUrlForIndex(int index) {
    OptionElement option = getOptionAtIndex((SelectElement) pages.getElement(),
        index);
    return option.getInnerText();
  }
View Full Code Here

    }
    setIsRecordingTitle(isRecording);
  }

  public void setSelectedPage(int indexToSelect) {
    OptionElement option = getOptionAtIndex((SelectElement) pages.getElement(),
        indexToSelect);
    option.setSelected(true);
  }
View Full Code Here

  public static void insertListItem(Element selectElem, String item,
      String value, int index) {
    assert !isPotential(selectElem) : "Cannot insert into a PotentialElement";

    SelectElement select = selectElem.<SelectElement> cast();
    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

   * @param index the index at which to insert the child
   */
  public static void insertListItem(Element selectElem, String item,
      String value, int index) {
    SelectElement select = selectElem.<SelectElement> cast();
    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

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

    int itemCount = select.getLength();
    if (index < 0 || index > itemCount) {
      index = itemCount;
    }
    if (index == itemCount) {
      select.add(option, null);
    } else {
      OptionElement before = select.getOptions().getItem(index);
      select.add(option, before);
    }
  }
View Full Code Here

   *
   * @return the value of the selected option
   */
  public String getSelectedValue() {
    SelectElement elem = getSelectElement();
    OptionElement option = elem.getOptions().getItem(elem.getSelectedIndex());
    return option.getValue();
  }
View Full Code Here

  private OptionElement createOption(String text) {
    return createOption(text, null);
  }

  private OptionElement createOption(String text, String value) {
    OptionElement opt = getElement().getOwnerDocument().createOptionElement();
    opt.setText(text);
    if (value != null) {
      opt.setValue(value);
    }
    return opt;
  }
View Full Code Here

            groupElement.setLabel(groupName);

            final String[] tokens = items.split(";");

            for (final String token : tokens) {
                final OptionElement optElement = Document.get().createOptionElement();
                optElement.setInnerText(token);
                groupElement.appendChild(optElement);
            }
            select.appendChild(groupElement);
        } else if (update.containsKey(PROPERTY.ITEM_UPDATED)) {
            final int index = update.getInt(PROPERTY.INDEX);
View Full Code Here

   * @param index the index at which to insert the child
   */
  public static void insertListItem(Element selectElem, String item, String value,
      int index) {
    SelectElement select = selectElem.<SelectElement> cast();
    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

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.