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

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

Introduction

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

Prototype

@Override
    public void setText(String text) 

Source Link

Usage

From source file:com.wfairclough.foundation4gwt.client.ui.widget.RadioButtonGroup.java

License:Apache License

/**
 * {@inheritDoc}//w  w w  .  j ava2  s. c  om
 */
public <W extends WidgetValues> List<RadioButton> setWidgetValues(W[] widgetValuesEnums) {
    List<RadioButton> list = new ArrayList<RadioButton>();

    for (WidgetValues wv : widgetValuesEnums) {
        RadioButton rb = new RadioButton();
        rb.setText(wv.getValue());
        list.add(rb);
        add(rb);
    }

    return list;
}

From source file:de.swm.commons.mobile.client.widgets.GenericRadioButtonGroup.java

License:Apache License

@Override
public void add(Widget w) {
    assert w instanceof RadioButton : "Can only contain RadioButton widgets in RadioButtonGroup";
    RadioButton radio = (RadioButton) w;

    if (keyValueProvider != null) {
        if (this.keyValueProvider.getValue(radio.getFormValue()) != null) {
            T enumValue = this.keyValueProvider.getValue(radio.getFormValue());
            this.keyIndexMap.put(radio.getFormValue(), lastIndex);
            this.indexKeyMap.put(lastIndex, radio.getFormValue());
            radio.setText(renderer.render(enumValue));
            myFlowPanel.add(radio);/*from   w w  w.  ja v a2s  .  co  m*/
            lastIndex++;
        }
    } else {
        myFlowPanel.add(radio);
    }
    if (myName != null) {
        radio.setName(myName);
    }
    radio.addValueChangeHandler(this);
}

From source file:gwtquery.plugins.enhance.client.gwt.RadioButtonWidgetFactory.java

License:Apache License

public RadioButton create(Element e) {
    resolveName(e);//from   w  w w  . j a v a 2 s.  c o  m

    RadioButton radioButton = new RadioButton(radioName);
    if ("input".equalsIgnoreCase(e.getTagName())) {
        copyAttributes((InputElement) e, (InputElement) radioButton.getElement().cast());
    } else {
        radioButton.setText(e.getInnerText());
    }

    WidgetsUtils.replaceOrAppend(e, radioButton);

    return radioButton;

}

From source file:it.fub.jardin.client.widget.UploadDialog.java

License:Open Source License

/**
 * Costruisce una finestra per l'upload di file. E' possibile definire il tipo
 * di azioni da eseguire una volta che il file  caricato sul server
 * (impostare la variabile type per questo).
 * //from w w w  .j a v  a 2 s. c o  m
 * @param type
 *          Usato per definire l'azione che il serer deve compiere una volta
 *          caricato il file. Le azioni possibili sono definite nelle
 *          propriet statiche della classe e sono precedute dalla stringa
 *          "TYPE_"
 * @param resultset
 *          Il resulset in cui avviene l'upload del file
 */
public UploadDialog(final User user, final String type, final int resultset) {
    final FormPanel panel = new FormPanel();
    panel.setFrame(true);

    panel.setAction(ACTION);
    panel.setEncoding(Encoding.MULTIPART);
    panel.setMethod(Method.POST);

    panel.setLabelAlign(LabelAlign.LEFT);
    panel.setHeaderVisible(false);
    panel.setBorders(false);
    panel.setBodyBorder(false);
    panel.setFrame(false);

    panel.setButtonAlign(HorizontalAlignment.CENTER);
    panel.setScrollMode(Scroll.AUTO);

    panel.setLabelWidth(150);
    panel.setFieldWidth(280);

    if ((type.compareTo(TYPE_IMPORT) == 0) || (type.compareTo(TYPE_INSERT) == 0)) {

        panel.addText("Scegliere il tipo di import:");

        final RadioButton limit = new RadioButton("limit");
        limit.setText("Delimitati da separatori");
        limit.setValue(true);
        panel.add(limit);

        panel.addText("");

        final RadioButton fix = new RadioButton("fix");
        fix.setText("Lunghezza fissa");
        fix.setEnabled(false);
        panel.add(fix);

        final TextField<String> fieldSeparator = new TextField<String>();
        fieldSeparator.setName("fieldSep");
        fieldSeparator.setWidth(20);
        fieldSeparator.setMaxLength(1);
        fieldSeparator.setFieldLabel("Separatore di campo");
        fieldSeparator.setValue(";");
        panel.add(fieldSeparator);

        final SimpleComboBox<String> textSeparator = new SimpleComboBox<String>();
        textSeparator.setName("textSep");
        textSeparator.setWidth(20);
        textSeparator.setMaxLength(1);
        textSeparator.setFieldLabel("Separatore di testo");
        List<String> values = new ArrayList<String>();
        values.add("\"");
        values.add("'");
        textSeparator.add(values);
        textSeparator.setEditable(false);
        textSeparator.setTriggerAction(TriggerAction.ALL);
        textSeparator.setForceSelection(true);
        textSeparator.setSimpleValue("\"");
        panel.add(textSeparator);

        limit.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(final ClickEvent arg0) {
                fieldSeparator.show();
                textSeparator.show();
                fix.setValue(false);
            }
        });

        fix.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(final ClickEvent arg0) {
                fieldSeparator.hide();
                textSeparator.hide();
                limit.setValue(false);
            }
        });

        // group.addListener(Events.Change, new Listener<ComponentEvent>() {
        //
        // public void handleEvent(ComponentEvent be) {
        // Radio selected = group.getValue();
        // // MessageBox.alert("selezione", "selezionato: "
        // // + selected.getData("valore"), null);
        //
        // if (((String) selected.getData("tipologia")).compareToIgnoreCase("fix")
        // == 0) {
        // fieldSeparator.hide();
        // textSeparator.hide();
        // } else {
        // fieldSeparator.show();
        // textSeparator.show();
        // }
        // }
        //
        // });

    }

    if (type.compareTo(TYPE_IMPORT) == 0) {
        SimpleComboBox<String> conditions = new SimpleComboBox<String>();
        ResultsetImproved rsi = user.getResultsetImprovedFromId(resultset);
        List<ResultsetField> fields = rsi.getFields();
        for (ResultsetField field : fields) {
            if (field.getIsPK() || field.isUnique()) {
                conditions.add(field.getName());
            }
        }
        conditions.setFieldLabel("Colonna di riferimento");
        conditions.setName("condition");
        conditions.setEditable(false);
        conditions.setTriggerAction(TriggerAction.ALL);
        conditions.setForceSelection(true);
        conditions.setAllowBlank(false);
        panel.add(conditions);
    }

    HiddenField<String> importType = new HiddenField<String>();
    importType.setName(FIELD_TYPE);
    importType.setValue(type);
    panel.add(importType);

    HiddenField<Integer> uploadResultset = new HiddenField<Integer>();
    uploadResultset.setName(FIELD_RESULTSET);
    uploadResultset.setValue(resultset);
    panel.add(uploadResultset);

    HiddenField<String> uploadCredentials = new HiddenField<String>();
    uploadCredentials.setName(FIELD_CREDENTIALS);
    uploadCredentials.setValue(user.getCredentials().encode());
    panel.add(uploadCredentials);

    FileUploadField file = new FileUploadField();
    file.setAllowBlank(false);
    file.setFieldLabel("File");
    file.setName("file");
    panel.add(file);

    Button btn = new Button("Invia");
    btn.addSelectionListener(new SelectionListener<ButtonEvent>() {
        @Override
        public void componentSelected(final ButtonEvent ce) {
            if (!panel.isValid()) {
                return;
            }
            UploadDialog.this.waitBox = MessageBox.wait("Caricamento dati", "Attendere prego...", "Loading...");
            panel.submit();
        }
    });
    panel.addButton(btn);

    panel.addListener(Events.Submit, new Listener<FormEvent>() {

        public void handleEvent(final FormEvent fe) {
            UploadDialog.this.hide();
            String message = fe.getResultHtml();
            message = message.replaceAll("<(.)?pre>", "");
            if (message.contains(SUCCESS)) {
                message = message.replaceAll(SUCCESS, "");
                if ((type.compareTo(TYPE_IMPORT) == 0) || (type.compareTo(TYPE_INSERT) == 0)) {
                    Dispatcher.forwardEvent(EventList.UpdateStore, resultset);
                    UploadDialog.this.waitBox.close();
                } else if (type.compareTo(TYPE_TEMPLATE) == 0) {
                    Dispatcher.forwardEvent(EventList.UpdateTemplates, resultset);
                }
                Info.display("Informazione", message);
            } else {
                Dispatcher.forwardEvent(EventList.Error, message);
            }
            UploadDialog.this.waitBox.close();
        }

    });

    // this.setLayout(new FitLayout());
    this.setIconStyle("icon-upload-file");
    this.setTitle("File upload");
    this.setModal(true);
    this.setBodyStyle("padding: 8px 4px;");
    this.setWidth(500);
    this.setMinHeight(300);

    this.setResizable(false);

    if (type.compareTo(TYPE_IMPORT) == 0) {
        this.addText(
                "<b><u>Attenzione: la prima riga del file da importare deve contenere i nomi delle colonne!</u></b>");
    }
    this.add(panel);
    this.setFocusWidget(file);
}

From source file:me.springframework.gwtsample.client.widgets.VerticalRadioGroup.java

License:Open Source License

public void addItem(final String item) {
    final RadioButton radioButton = new RadioButton(groupName);
    verticalPanel.add(radioButton);/*from ww w .  j  a  v  a  2  s . co m*/
    radioButton.setText(item);
    radioButton.addClickListener(new ClickListener() {
        public void onClick(final Widget arg0) {
            setSelectedItemIdx(verticalPanel.getWidgetIndex(arg0));
        }
    });
}

From source file:org.thechiselgroup.biomixer.client.workbench.workspace.command.LoadWorkspaceDialog.java

License:Apache License

@Override
public Widget getContent() {
    // TODO extract radio group widget
    // TODO autogenerate group id
    String groupId = "group";

    VerticalPanel content = new VerticalPanel();
    for (WorkspacePreview workspace : workspacePreviews) {
        RadioButton radioButton = new RadioButton(groupId, workspace.getName());
        radioButton.setValue(Boolean.FALSE);
        buttonsToWorkspaces.put(radioButton, workspace);

        // highlight + select current workspace
        if (workspace.isCurrentWorkspace()) {
            radioButton.setText(workspace.getName() + " (current)");
            radioButton.setValue(Boolean.TRUE);

            setSelectedButton(radioButton);
        }//from   w  ww.  j  av a 2s  .com

        radioButton.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
            @Override
            public void onValueChange(ValueChangeEvent<Boolean> event) {
                if (event.getValue() == Boolean.TRUE) {
                    setSelectedButton((RadioButton) event.getSource());
                }
            }
        });

        content.add(radioButton);
    }

    return content;
}

From source file:us.asciiroth.editor.client.ui.BrushPalette.java

License:Apache License

private void createBrushOption(HorizontalPanel hp, final String size) {
    final int s = Integer.parseInt(size);
    RadioButton radio = new RadioButton("brushSize");
    radio.setText(size);
    radio.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            brushSize = s;/*  w w  w .  j  a  v a 2 s.  com*/
        }
    });
    if ("1".equals(size)) {
        radio.setValue(Boolean.TRUE);
        brushSize = 1;
    }
    hp.add(radio);
}