Example usage for com.google.gwt.user.client.ui RadioButton RadioButton

List of usage examples for com.google.gwt.user.client.ui RadioButton RadioButton

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui RadioButton RadioButton.

Prototype

public RadioButton(String name, String label) 

Source Link

Document

Creates a new radio associated with a particular group, and initialized with the given HTML label.

Usage

From source file:asquare.gwt.tests.focus.client.Demo.java

License:Apache License

private Widget createFocusPanel() {
    Table outer = new Table();

    outer.add(new FocusPanel(new Label("Label in a FocusPanel")));
    outer.add(new Button("Button"));
    outer.add(new CheckBox("CheckBox"));
    outer.add(new TextBox());
    outer.add(new PasswordTextBox());
    outer.add(new TextArea());
    outer.add(new RadioButton("group1", "RadioButton1"));
    outer.add(new RadioButton("group1", "RadioButton2"));
    ListBox listBox1 = new ListBox();
    listBox1.addItem("ListBox1");
    listBox1.addItem("item2");
    listBox1.addItem("item3");
    outer.add(listBox1);//  w w  w .  j  a  v a2s .com
    ListBox listBox2 = new ListBox(true);
    listBox2.setVisibleItemCount(3);
    listBox2.addItem("ListBox2");
    listBox2.addItem("item2");
    listBox2.addItem("item3");
    outer.add(listBox2);
    Tree tree = new Tree();
    tree.addItem("Tree");
    tree.addItem("item2");
    tree.addItem("item3");
    outer.add(tree);

    return outer;
}

From source file:asquare.gwt.tests.focusevent.client.Demo.java

License:Apache License

private Widget createDemoPanel() {
    TestPanel outer = new TestPanel();

    outer.add(new Label("GWT onfocus Event Handler"));
    outer.add(new Button("Button"), "Button");
    outer.add(new CheckBox("CheckBox"), "CheckBox");
    outer.add(new RadioButton("group1", "RadioButton1"), "RadioButton1");
    TextBox textBox = new TextBox();
    textBox.setText("TextBox");
    outer.add(textBox, "TextBox");
    PasswordTextBox passwordTextBox = new PasswordTextBox();
    passwordTextBox.setText("PasswordTextBox");
    outer.add(passwordTextBox, "PasswordTextBox");
    TextArea textArea = new TextArea();
    textArea.setText("TextArea");
    outer.add(textArea, "TextArea");
    ListBox listBox = new ListBox();
    listBox.addItem("ListBox");
    listBox.addItem("item2");
    listBox.addItem("item3");
    outer.add(listBox, "ListBox");
    outer.add(new FocusPanel(new Label("Label in a FocusPanel")), "FocusPanel");
    Tree tree = new Tree();
    tree.addItem("item1");
    tree.addItem("item2");
    tree.addItem("item3");
    outer.add(tree, "Tree");

    return outer;
}

From source file:asquare.gwt.tk.uitest.popuppanel.client.Demo.java

License:Apache License

private Widget createTransparencyTest() {
    RowPanel outer = new RowPanel();
    BasicToolTip toolTip = new BasicToolTip();
    Controller ttController = new BasicToolTipController(toolTip);

    outer.add(new HTML("<h3>Popup transparency</h3><p>Hover over a widget</p>"));

    ListBox list = new ListBox(true);
    list.setVisibleItemCount(4);/* w w w  .  jav  a2 s .  c o m*/
    list.addItem("ListBox");
    list.addItem("1");
    list.addItem("2");
    list.addItem("3");
    list.addItem("4");
    list.addItem("5");
    outer.add(new ToolTipWrapper(list, "Popup transparency over a ListBox").addController(ttController));

    outer.add(new ToolTipWrapper(new Frame("FrameContents.html"), "Popup transparency over a Frame")
            .addController(ttController));

    outer.add(new ToolTipWrapper(new RadioButton("radioGroup", "RadioButton a"), "Choice a")
            .addController(ttController));
    outer.add(new ToolTipWrapper(new RadioButton("radioGroup", "RadioButton b"), "Choice b")
            .addController(ttController));
    outer.add(new ToolTipWrapper(new RadioButton("radioGroup", "RadioButton c"), "Choice c")
            .addController(ttController));
    return outer;
}

From source file:asquare.gwt.tkdemo.client.demos.EventsPanel.java

License:Apache License

private static Collection<Widget> createSomeWidgets() {
    ArrayList<Widget> result = new ArrayList<Widget>();
    result.add(new HTML("<b>Double-click a widget to select it</b>"));
    result.add(new Button("Button"));
    result.add(new CheckBox("CheckBox"));
    result.add(new RadioButton("group", "RadioButton"));
    result.add(new SimpleHyperLink("SimpleHyperLink"));
    TextBox tb = new TextBox();
    tb.setText("TextBox");
    result.add(tb);/*from   w  w  w .j av a  2 s  .com*/
    PasswordTextBox ptb = new PasswordTextBox();
    ptb.setText("PasswordTextBox");
    result.add(ptb);
    return result;
}

From source file:at.ait.dme.yuma.client.colorpicker.ColorPicker.java

License:Artistic License

public ColorPicker() {
    // UI Drawing
    //------------------

    hue = 0;/*from   w  w  w. j a v a 2  s  .  c  o m*/
    saturation = 100;
    brightness = 100;
    red = 255;
    green = 0;
    blue = 0;

    HorizontalPanel panel = new HorizontalPanel();
    FlexTable table = new FlexTable();

    // Add the large slider map
    slidermap = new SliderMap(this);
    panel.add(slidermap);
    panel.setCellWidth(slidermap, "258px");
    panel.setCellHeight(slidermap, "258px");

    // Add the small slider bar
    sliderbar = new SliderBar(this);
    panel.add(sliderbar);
    panel.setCellWidth(sliderbar, "40px");
    panel.setCellHeight(sliderbar, "258px");

    // Define the Flextable's content
    // Color preview at the top
    colorpreview = new HTML("");
    colorpreview.setWidth("50px");
    colorpreview.setHeight("50px");
    DOM.setStyleAttribute(colorpreview.getElement(), "border", "1px solid black");

    // Radio buttons
    rbHue = new RadioButton("color", "H:");
    rbHue.addClickHandler(this);
    rbSaturation = new RadioButton("color", "S:");
    rbSaturation.addClickHandler(this);
    rbBrightness = new RadioButton("color", "V:");
    rbBrightness.addClickHandler(this);
    rbRed = new RadioButton("color", "R:");
    rbRed.addClickHandler(this);
    rbGreen = new RadioButton("color", "G:");
    rbGreen.addClickHandler(this);
    rbBlue = new RadioButton("color", "B:");
    rbBlue.addClickHandler(this);

    // Textboxes
    tbHue = new TextBox();
    tbHue.setText(new Integer(hue).toString());
    tbHue.setMaxLength(3);
    tbHue.setVisibleLength(4);
    tbHue.addKeyPressHandler(this);
    tbHue.addChangeHandler(this);
    tbSaturation = new TextBox();
    tbSaturation.setText(new Integer(saturation).toString());
    tbSaturation.setMaxLength(3);
    tbSaturation.setVisibleLength(4);
    tbSaturation.addKeyPressHandler(this);
    tbSaturation.addChangeHandler(this);
    tbBrightness = new TextBox();
    tbBrightness.setText(new Integer(brightness).toString());
    tbBrightness.setMaxLength(3);
    tbBrightness.setVisibleLength(4);
    tbBrightness.addKeyPressHandler(this);
    tbBrightness.addChangeHandler(this);
    tbRed = new TextBox();
    tbRed.setText(new Integer(red).toString());
    tbRed.setMaxLength(3);
    tbRed.setVisibleLength(4);
    tbRed.addKeyPressHandler(this);
    tbRed.addChangeHandler(this);
    tbGreen = new TextBox();
    tbGreen.setText(new Integer(green).toString());
    tbGreen.setMaxLength(3);
    tbGreen.setVisibleLength(4);
    tbGreen.addKeyPressHandler(this);
    tbGreen.addChangeHandler(this);
    tbBlue = new TextBox();
    tbBlue.setText(new Integer(blue).toString());
    tbBlue.setMaxLength(3);
    tbBlue.setVisibleLength(4);
    tbBlue.addKeyPressHandler(this);
    tbBlue.addChangeHandler(this);
    tbHexColor = new TextBox();
    tbHexColor.setText("ff0000");
    tbHexColor.setMaxLength(6);
    tbHexColor.setVisibleLength(6);
    tbHexColor.addKeyPressHandler(this);
    tbHexColor.addChangeHandler(this);

    // Put together the FlexTable
    table.setWidget(0, 0, colorpreview);
    table.getFlexCellFormatter().setColSpan(0, 0, 3);
    table.setWidget(1, 0, rbHue);
    table.setWidget(1, 1, tbHue);
    table.setWidget(1, 2, new HTML("&deg;"));
    table.setWidget(2, 0, rbSaturation);
    table.setWidget(2, 1, tbSaturation);
    table.setText(2, 2, "%");
    table.setWidget(3, 0, rbBrightness);
    table.setWidget(3, 1, tbBrightness);
    table.setText(3, 2, "%");
    table.setWidget(4, 0, rbRed);
    table.setWidget(4, 1, tbRed);
    table.setWidget(5, 0, rbGreen);
    table.setWidget(5, 1, tbGreen);
    table.setWidget(6, 0, rbBlue);
    table.setWidget(6, 1, tbBlue);
    table.setText(7, 0, "#:");
    table.setWidget(7, 1, tbHexColor);
    table.getFlexCellFormatter().setColSpan(7, 1, 2);

    // Final setup
    panel.add(table);
    rbSaturation.setValue(true);
    setPreview("ff0000");
    DOM.setStyleAttribute(colorpreview.getElement(), "cursor", "default");

    // First event
    onClick(rbSaturation);

    initWidget(panel);
}

From source file:at.ait.dme.yuma.client.image.annotation.StandardImageAnnotationForm.java

License:EUPL

private HorizontalPanel createRadioPanel(boolean update, ImageAnnotationTreeNode annotationTreeNode) {

    Label scopeLabel = new Label();
    scopeLabel.setStyleName("imageAnnotation-form-label");

    HorizontalPanel radioPanel = new HorizontalPanel();
    radioPanel.add(scopeLabel);//from  w  w w.  j ava2s .co m
    radioPanel.add(
            rdPublic = new RadioButton(SCOPE_RADIO_GROUP_NAME, " " + Application.getConstants().publicScope()));
    radioPanel.add(rdPrivate = new RadioButton(SCOPE_RADIO_GROUP_NAME,
            " " + Application.getConstants().privateScope()));
    rdPublic.setStyleName("imageAnnotation-form-radiobutton");
    rdPrivate.setStyleName("imageAnnotation-form-radiobutton");

    if (update && annotationTreeNode.getAnnotation().getScope() == ImageAnnotation.Scope.PRIVATE)
        rdPrivate.setValue(true, true);
    else
        rdPublic.setValue(true, true);

    return radioPanel;
}

From source file:at.ait.dme.yuma.client.image.shape.ShapeControlPanel.java

License:EUPL

/**
 * creates the radio buttons to choose the shape
 *//*from   www.j a  v  a2s. co m*/
private void createShapeRadioButtons() {
    Label shapeLabel = new Label(shapeConstants.shape());
    shapeLabel.setStyleName("imageFragment-controlpanel-label");

    RadioButton rectangle = new RadioButton(SHAPE_RADIO_GROUP_NAME, shapeConstants.rectangle());
    rectangle.setStyleName("imageFragment-controlpanel-radio-button");
    rectangle.setValue(shape instanceof Rectangle);
    rectangle.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            shape = new Rectangle(shape);
            redrawShape();
        }
    });

    RadioButton ellipse = new RadioButton(SHAPE_RADIO_GROUP_NAME, shapeConstants.ellipse());
    ellipse.setStyleName("imageFragment-controlpanel-radio-button");
    ellipse.setValue(shape instanceof Ellipse);
    ellipse.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            shape = new Ellipse(shape);
            redrawShape();
        }
    });

    RadioButton cross = new RadioButton(SHAPE_RADIO_GROUP_NAME, shapeConstants.cross());
    cross.setStyleName("imageFragment-controlpanel-radio-button");
    cross.setValue(shape instanceof Cross);
    cross.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            shape = new Cross(shape);
            redrawShape();
        }
    });

    RadioButton polygon = new RadioButton(SHAPE_RADIO_GROUP_NAME, shapeConstants.polygon());
    polygon.setStyleName("imageFragment-controlpanel-radio-button");
    polygon.setValue(shape instanceof Polygon);
    polygon.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            shape = new Polygon(shape);
            redrawShape();
            shapePanel.startDrawPolygon((Polygon) shape);

        }
    });

    RadioButton freehand = new RadioButton(SHAPE_RADIO_GROUP_NAME, shapeConstants.freehand());
    freehand.setStyleName("imageFragment-controlpanel-radio-button");
    freehand.setValue(shape instanceof Polyline);
    freehand.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            shape = new Polyline(shape);
            redrawShape();
            shapePanel.startDrawPolyline((Polyline) shape);
        }
    });

    contentTable.setWidget(0, 0, shapeLabel);
    contentTable.setWidget(0, 1, rectangle);
    contentTable.setWidget(0, 2, ellipse);
    contentTable.setWidget(0, 3, cross);
    contentTable.setWidget(0, 4, polygon);
    contentTable.setWidget(0, 5, freehand);
}

From source file:at.ait.dme.yuma.client.image.shape.ShapeControlPanel.java

License:EUPL

/**
 * creates radio buttons to change the stroke width of the shape
 *//*  w  ww.  j  av a  2s . co  m*/
private void createStrokeWidthRadioButtons() {
    Label strokeLabel = new Label(shapeConstants.strokeWidth());
    strokeLabel.setStyleName("imageFragment-controlpanel-label");

    RadioButton thin = new RadioButton(STROKEWIDTH_RADIO_GROUP_NAME, shapeConstants.thin());
    thin.setStyleName("imageFragment-controlpanel-radio-button");
    thin.setValue(shape.getStrokeWidth() == 1);
    thin.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            shape.setStrokeWidth(1);
            redrawShape();
        }
    });

    RadioButton medium = new RadioButton(STROKEWIDTH_RADIO_GROUP_NAME, shapeConstants.medium());
    medium.setStyleName("imageFragment-controlpanel-radio-button");
    medium.setValue(shape.getStrokeWidth() == 2);
    medium.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            shape.setStrokeWidth(2);
            redrawShape();
        }
    });

    RadioButton thick = new RadioButton(STROKEWIDTH_RADIO_GROUP_NAME, shapeConstants.thick());
    thick.setStyleName("imageFragment-controlpanel-radio-button");
    thick.setValue(shape.getStrokeWidth() == 3);
    thick.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            shape.setStrokeWidth(3);
            redrawShape();
        }
    });

    contentTable.setWidget(1, 0, strokeLabel);
    contentTable.setWidget(1, 1, thin);
    contentTable.setWidget(1, 2, medium);
    contentTable.setWidget(1, 3, thick);
}

From source file:at.ait.dme.yuma.suite.apps.image.core.client.treeview.ImageAnnotationEditForm.java

License:EUPL

protected HorizontalPanel createScopePanel() {
    HorizontalPanel radioPanel = new HorizontalPanel();

    Label scopeLabel = new Label();
    scopeLabel.setStyleName("imageAnnotation-form-label");

    rdPublic = new RadioButton(SCOPE_RADIO_GROUP_NAME, " " + i18n.publicScope());
    rdPublic.setStyleName("imageAnnotation-form-radiobutton");

    rdPrivate = new RadioButton(SCOPE_RADIO_GROUP_NAME, " " + i18n.privateScope());
    rdPrivate.setStyleName("imageAnnotation-form-radiobutton");

    if (annotation != null && annotation.getAnnotation().getScope() == Scope.PRIVATE) {
        rdPrivate.setValue(true, true);//from  www.  j  av  a 2  s  . c om
    } else {
        rdPublic.setValue(true, true);
    }

    radioPanel.add(scopeLabel);
    radioPanel.add(rdPublic);
    radioPanel.add(rdPrivate);

    return radioPanel;
}

From source file:client.tools.page.ConsoleSettingsPage.java

License:Open Source License

/**
 * /*ww w .j av a  2 s . co m*/
 */
public ConsoleSettingsPage() {
    final VerticalPanel panel = new VerticalPanel();

    final int cookie = this.getValue();

    final Label label = new Label("Console LogLevel");
    panel.add(label);

    // Make some radio buttons, all in one group.
    this.rb0 = new RadioButton("logLevelGrp", "Trace");
    this.rb1 = new RadioButton("logLevelGrp", "Debug");
    this.rb2 = new RadioButton("logLevelGrp", "Warn");
    this.rb4 = new RadioButton("logLevelGrp", "Error");
    this.rb3 = new RadioButton("logLevelGrp", "Fatal");

    this.button = new Button("Save");
    this.button.addClickListener(this);

    if (GuiLogger.DEBUG == cookie) {
        this.rb1.setChecked(true);
    } else if (GuiLogger.WARN == cookie) {
        this.rb2.setChecked(true);
    } else if (GuiLogger.ERROR == cookie) {
        this.rb3.setChecked(true);
    } else if (GuiLogger.FATAL == cookie) {
        this.rb4.setChecked(true);
    } else {
        this.rb0.setChecked(true);
    }

    panel.add(this.rb0);
    panel.add(this.rb1);
    panel.add(this.rb2);
    panel.add(this.rb3);
    panel.add(this.rb4);
    panel.add(this.button);

    this.initWidget(panel);
}