Package com.google.gwt.dom.client

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


   * @param value the item's value, to be submitted if it is part of a
   *          {@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


   *          <code>&lt;option&gt;</code>; cannot be <code>null</code>
   * @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

   * @param value the item's value, to be submitted if it is part of a
   *          {@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

   * @param value the item's value, to be submitted if it is part of a
   *          {@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

   }

   @Test
   public void createSelect() {
      // Act
      SelectElement elem = SelectElement.as(DOM.createSelect());

      // Assert
      assertEquals("select", elem.getTagName());
      assertFalse("Simple SelectElement should not be multiple", elem.isMultiple());
   }
View Full Code Here

   }

   @Test
   public void createSelectMultiple() {
      // Act
      SelectElement elem = SelectElement.as(DOM.createSelect(true));

      // Assert
      assertEquals("select", elem.getTagName());
      assertTrue("SelectElement should be multiple", elem.isMultiple());
   }
View Full Code Here

                event,
                valueUpdater);
        final String type = event.getType();
        if ("change".equals(type)) {
            final Object key = context.getKey();
            final SelectElement select = parent.getFirstChild().cast();
            final String newValue = options.get(select.getSelectedIndex());
            setViewData(key, newValue);
            finishEditing(parent,
                    newValue,
                    key,
                    valueUpdater);
View Full Code Here

   *          <code>&lt;option&gt;</code>; cannot be <code>null</code>
   * @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

   * @param value the item's value, to be submitted if it is part of a
   *          {@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

    protected void populateSelector() {
        listBox.clear();
        final String firstColumnId = getColumnId(dataSet, 0);
        final String firstColumnName = getColumnName(dataSet, 0);
        listBox.addItem("- Select " + firstColumnName + " -");
        SelectElement selectElement = SelectElement.as(listBox.getElement());
        NodeList<OptionElement> options = selectElement.getOptions();

        // Generate the list entries from the current data set
        List<String> currentFilter = filterValues(firstColumnId);
        for (int i = 0; i < dataSet.getRowCount(); i++) {
            String value = dataSet.getValueAt(i, firstColumnId).toString();
View Full Code Here

TOP

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

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.