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

The following examples show how to use com.google.gwt.user.client.ui.RadioButton. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DebugDialog.java    From swellrt with Apache License 2.0 6 votes vote down vote up
private void setChecked(RadioButton button) {
  button.setValue(true);
  if (button == domButton) {
    setNewSelection(Selection.DOM);
  } else if (button == localXmlButton) {
    setNewSelection(Selection.LOCAL_XML);
  } else if (button == persistenDocumentButton){
    setNewSelection(Selection.PERSISTENT_DOCUMENT);
  } else if (button == annotationButton){
    setNewSelection(Selection.ANNOTATIONS);
  } else if (button == logButton){
    setNewSelection(Selection.LOG);
  } else if (button == optionsButton) {
    setNewSelection(Selection.OPTIONS);
  }
}
 
Example #2
Source File: DebugDialog.java    From incubator-retired-wave with Apache License 2.0 6 votes vote down vote up
private void setChecked(RadioButton button) {
  button.setValue(true);
  if (button == domButton) {
    setNewSelection(Selection.DOM);
  } else if (button == localXmlButton) {
    setNewSelection(Selection.LOCAL_XML);
  } else if (button == persistenDocumentButton){
    setNewSelection(Selection.PERSISTENT_DOCUMENT);
  } else if (button == annotationButton){
    setNewSelection(Selection.ANNOTATIONS);
  } else if (button == logButton){
    setNewSelection(Selection.LOG);
  } else if (button == optionsButton) {
    setNewSelection(Selection.OPTIONS);
  }
}
 
Example #3
Source File: NewPolicyWizard.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
protected Widget asWidget(Context context) {
    VerticalPanel body = new VerticalPanel();
    RadioButton customButton = new RadioButton("policy", "Custom Policy");
    customButton.getElement().setId("custom");
    customButton.setStyleName("choose_template");
    customButton.setValue(true);
    customButton.addClickHandler(event -> context.customPolicy = true);
    customButton.setFocus(true);
    body.add(customButton);

    RadioButton jaccButton = new RadioButton("policy", "JACC Policy");
    jaccButton.getElement().setId("jacc");
    jaccButton.setStyleName("choose_template");
    jaccButton.addClickHandler(event -> context.customPolicy = false);
    body.add(jaccButton);

    return body;
}
 
Example #4
Source File: MockRadioButton.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new MockRadioButton component.
 *
 * @param editor  editor of source file the component belongs to
 */
public MockRadioButton(SimpleEditor editor) {
  super(editor, TYPE, images.radiobutton());

  // Initialize mock radioButton UI
  radioButtonWidget = new RadioButton("dummy-group");
  radioButtonWidget.setStylePrimaryName("ode-SimpleMockComponent");
  initComponent(radioButtonWidget);
}
 
Example #5
Source File: CubaRadioButtonGroupWidget.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
public void buildOptions(List<JsonObject> items) {
    super.buildOptions(items);

    for (Widget widget : getWidget()) {
        if (widget instanceof RadioButton) {
            ((RadioButton) widget).addKeyDownHandler(this);
            ((RadioButton) widget).addValueChangeHandler(this);
        }
    }
}
 
Example #6
Source File: CubaRadioButtonGroupWidget.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
protected void updateItemEnabled(RadioButton radioButton, boolean value) {
    boolean enabled = isEnabled();
    radioButton.setEnabled(enabled);
    radioButton.setStyleName(StyleConstants.DISABLED, !enabled);

    radioButton.setStyleName("v-readonly", isReadonly());
}
 
Example #7
Source File: CubaRadioButtonGroupWidget.java    From cuba with Apache License 2.0 5 votes vote down vote up
protected void updateItemsSelection() {
    for (Widget widget : getWidget()) {
        if (widget instanceof RadioButton) {
            boolean checked = widget.getElement().hasClassName(CLASSNAME_OPTION_SELECTED);
            updateItemSelection((RadioButton) widget, checked);
        }
    }
}
 
Example #8
Source File: CubaOptionGroupWidget.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
public void buildOptions(UIDL uidl) {
    super.buildOptions(uidl);

    for (Widget widget : panel) {
        if (widget instanceof RadioButton) {
            ((RadioButton) widget).addKeyDownHandler(this);
            ((RadioButton) widget).addValueChangeHandler(this);
        }
    }

    updateEnabledState();
}
 
Example #9
Source File: CubaOptionGroupWidget.java    From cuba with Apache License 2.0 5 votes vote down vote up
protected void updateItemsSelection() {
    for (Widget w : panel) {
        if (w instanceof RadioButton) {
            Element input = w.getElement().getFirstChildElement();
            if (input instanceof InputElement) {
                boolean checked = ((InputElement) input).isDefaultChecked();
                ((InputElement) input).setChecked(checked);
            }
        }
    }
}
 
Example #10
Source File: ChooseStep.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
protected Widget asWidget(final Context context) {
    FlowPanel body = new FlowPanel();

    deployNew = new RadioButton("deployment_kind", Console.CONSTANTS.uploadNewDeployment());
    deployNew.addStyleName("radio-block");
    IdHelper.setId(deployNew, id(), "deployNew");
    addDescription(deployNew, Console.CONSTANTS.uploadNewDeploymentDescription());

    deployExisting = new RadioButton("deployment_kind", Console.CONSTANTS.chooseFromContentRepository());
    deployExisting.addStyleName("radio-block");
    IdHelper.setId(deployExisting, id(), "deployExisting");
    addDescription(deployExisting,Console.CONSTANTS.chooseFromContentRepositoryDescription());

    deployUnmanaged = new RadioButton("deployment_kind", Console.CONSTANTS.createUnmanaged());
    deployUnmanaged.addStyleName("radio-block");
    IdHelper.setId(deployUnmanaged, id(), "deployUnmanaged");
    addDescription(deployUnmanaged, Console.CONSTANTS.createUnmanagedDescription());

    if (showDeployNew) {
        body.add(deployNew);
    }
    if (showDeployExisting) {
        body.add(deployExisting);
    }
    if (showDeployUnmanaged) {
        body.add(deployUnmanaged);
    }
    return body;
}
 
Example #11
Source File: ChooseStep.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void addDescription(final RadioButton radioButton, final String description) {
    LabelElement label = Browser.getDocument().createLabelElement();
    label.setHtmlFor(radioButton.getElement().getFirstChildElement().getId());
    label.getClassList().add("label-desc");
    label.setTextContent(description);
    radioButton.getElement().appendChild((Node)label);
}
 
Example #12
Source File: GwtMockitoTest.java    From gwtmockito with Apache License 2.0 4 votes vote down vote up
@Test
@SuppressWarnings("unused")
public void shouldBeAbleToInstantiateRadioAndCheckBoxes() {
  new RadioButton("foo");
  new CheckBox();
}