Package com.google.gwt.user.client.ui

Examples of com.google.gwt.user.client.ui.RadioButton


      SafeHtmlBuilder sb = new SafeHtmlBuilder();
      sb.appendHtmlConstant("<span class=\"" + style.outputFormatName() +
                            "\">");
      sb.appendEscaped(name);
      sb.appendHtmlConstant("</span>");
      RadioButton button = new RadioButton("DefaultOutputFormat",
                                           sb.toSafeHtml().asString(), true);
      button.setStyleName(style.outputFormatChoice());
      formatOptions_.add(button);
      formatWrapper.add(button);
      Label label = new Label(description);
      label.setStyleName(style.outputFormatDetails());
      formatWrapper.add(label);
View Full Code Here


                    || (isMultiselect() != wasMultiselect)) {
                // Create a new element
                if (isMultiselect()) {
                    op = new VCheckBox();
                } else {
                    op = new RadioButton(paintableId);
                    op.setStyleName("v-radiobutton");
                }
                if (iconUrl != null && iconUrl.length() != 0) {
                    Util.sinkOnloadForImages(op.getElement());
                    op.addHandler(iconLoadHandler, LoadEvent.getType());
View Full Code Here

        if (!matches.isEmpty()) {
            for (int i = 0;  i < matches.size(); i++) {
                Match match = matches.get(i);
                Tradable t2 = ask ? match.getBid() : match.getAsk();
                Trader cpty = ask ? match.getBid().getBuyer() : match.getAsk().getSeller();
                buttons[i] = new RadioButton("matches");
                buttons[i].setValue(i == 0);
                body.setWidget(i, 0, buttons[i]);
                body.setWidget(i, 1, FormatUtil.formatPrice(t2.getPrice()));
                body.setWidget(i, 2, FormatUtil.formatVolume(t2.getVolume()));
                body.setText(i, 3, " by " + cpty.getName());
View Full Code Here

    fp.clear();
    fp.add(renderer.render(radioButtons));
  }

  private RadioButton create(String name) {
    final RadioButton rb = new RadioButton("rg_" + getDomId(), name);
    rb.setFormValue(name);
    rb.addStyleName(Styles.CBRB);
    rb.addClickHandler(new ClickHandler() {

      @SuppressWarnings("synthetic-access")
      @Override
      public void onClick(ClickEvent event) {
        assert event.getSource() instanceof RadioButton;
        final RadioButton radio = (RadioButton) event.getSource();
        // fire a value change event..
        ValueChangeEvent.fire(fp, getDataValue(radio.getFormValue()));
      }
    });
    rb.addBlurHandler(this);
    return rb;
  }
View Full Code Here

public class RadioCellEditorTest extends InlineCellEditorTest {
  @Override
  public InlineCellEditor<String> createCellEditor() {
    RadioCellEditor<String> radioEditor = new RadioCellEditor<String>();
    for (int i = 0; i < 3; i++) {
      radioEditor.addRadioButton(new RadioButton("testgroup", "label" + i),
          "value" + i);
    }
    return radioEditor;
  }
View Full Code Here

    }

    // Add a button and set the value
    {
      Integer cellValue = new Integer(0);
      RadioButton radio = new RadioButton("testgroup", "radio0");
      editor.addRadioButton(radio, cellValue);
      assertNull(editor.getValue());
      editor.setValue(cellValue);
      assertEquals(cellValue, editor.getValue());
      assertTrue(radio.getValue());
    }

    // Add another button
    {
      Integer cellValue = new Integer(1);
      RadioButton radio = new RadioButton("testgroup", "radio1");
      editor.addRadioButton(radio, cellValue);
      editor.setValue(cellValue);
      assertEquals(cellValue, editor.getValue());
      assertTrue(radio.getValue());

      // Remove the new button
      editor.removeRadioButton(radio);
      editor.setValue(cellValue);
      assertNull(editor.getValue());
View Full Code Here

   *
   * @return a radio cell editor
   */
  public RadioCellEditor<Object> getRadioCellEditor() {
    RadioCellEditor<Object> radioEditor = new RadioCellEditor<Object>();
    radioEditor.addRadioButton(new RadioButton("testgroup", "test"));
    radioEditor.addRadioButton(new RadioButton("testgroup", "value"));
    radioEditor.addRadioButton(new RadioButton("testgroup", "test2"));
    return radioEditor;
  }
View Full Code Here

    // We cannot set the value if we have no radio buttons
    editor.setValue("test");
    assertNull(editor.getValue());

    // Add a button and set the value
    RadioButton r1 = new RadioButton("testgroup", "radio1");
    editor.addRadioButton(r1);
    editor.setValue("radio1");
    assertEquals("radio1", editor.getValue());

    // Add another button
    RadioButton r2 = new RadioButton("testgroup", "radio2");
    editor.addRadioButton(r2);
    editor.setValue("radio2");
    assertEquals("radio2", editor.getValue());

    // Remove a button
View Full Code Here

      tableDefinition.addColumnDefinition(columnDef);

      // Setup the cellEditor
      RadioCellEditor<Boolean> cellEditor = new RadioCellEditor<Boolean>();
      cellEditor.setLabel("Select a gender:");
      cellEditor.addRadioButton(new RadioButton("editorGender", "male"), true);
      cellEditor.addRadioButton(new RadioButton("editorGender", "female"),
          false);
      columnDef.setCellEditor(cellEditor);
    }

    // Race
    {
      StudentColumnDefinition<String> columnDef = new StudentColumnDefinition<String>(
          "Race", Group.GENERAL) {
        @Override
        public String getCellValue(Student rowValue) {
          return rowValue.getRace();
        }

        @Override
        public void setCellValue(Student rowValue, String cellValue) {
          rowValue.setRace(cellValue);
        }
      };
      columnDef.setMinimumColumnWidth(45);
      columnDef.setPreferredColumnWidth(55);
      columnDef.setMaximumColumnWidth(70);
      columnDef.setColumnSortable(true);
      tableDefinition.addColumnDefinition(columnDef);

      // Setup the cell editor
      ListCellEditor<String> cellEditor = new ListCellEditor<String>();
      for (int i = 0; i < StudentGenerator.races.length; i++) {
        String race = StudentGenerator.races[i];
        cellEditor.addItem(race, race);
      }
      columnDef.setCellEditor(cellEditor);
    }

    // Favorite color
    {
      StudentColumnDefinition<String> columnDef = new StudentColumnDefinition<String>(
          "Favorite Color", null) {
        @Override
        public String getCellValue(Student rowValue) {
          return rowValue.getFavoriteColor();
        }

        @Override
        public void setCellValue(Student rowValue, String cellValue) {
          rowValue.setFavoriteColor(cellValue);
        }
      };
      columnDef.setCellRenderer(new CellRenderer<Student, String>() {
        public void renderRowValue(Student rowValue,
            ColumnDefinition<Student, String> columnDef,
            AbstractCellView<Student> view) {
          String color = rowValue.getFavoriteColor();
          view.setStyleAttribute("color", color);
          view.setHTML(color);
        }
      });
      columnDef.setPreferredColumnWidth(80);
      columnDef.setColumnSortable(true);
      columnDef.setHeaderTruncatable(false);
      tableDefinition.addColumnDefinition(columnDef);

      // Setup the cell editor
      RadioCellEditor<String> cellEditor = new RadioCellEditor<String>();
      cellEditor.setLabel("Select a color:");
      for (int i = 0; i < StudentGenerator.colors.length; i++) {
        String color = StudentGenerator.colors[i];
        String text = "<FONT color=\"" + color + "\">" + color + "</FONT>";
        cellEditor.addRadioButton(new RadioButton("editorColor", text, true),
            color);
      }
      columnDef.setCellEditor(cellEditor);
    }
View Full Code Here

    fp.clear();
    fp.add(renderer.render(radioButtons));
  }

  private RadioButton create(final String name) {
    final RadioButton rb = new RadioButton("rg_" + getDomId(), name);
    rb.setFormValue(name);
    rb.addStyleName(Styles.CBRB);
    rb.addClickHandler(new ClickHandler() {

      @SuppressWarnings("synthetic-access")
      @Override
      public void onClick(final ClickEvent event) {
        assert event.getSource() instanceof RadioButton;
        final RadioButton radio = (RadioButton) event.getSource();
        // fire a value change event..
        ValueChangeEvent.fire(fp, getDataValue(radio.getFormValue()));
      }
    });
    rb.addBlurHandler(this);
    return rb;
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.user.client.ui.RadioButton

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.