List of usage examples for com.google.gwt.user.client.ui RadioButton setFormValue
public void setFormValue(String value)
From source file:com.edgenius.wiki.gwt.client.space.SpaceLinkedBlogForm.java
License:Open Source License
public void onSuccess(BlogMetaList blogs) { bloglist.clear();//from ww w . ja v a 2s . c om bloglistDeck.showWidget(0); if (!GwtClientUtils.preSuccessCheck(blogs, message)) { return; } if (blogs.blogList == null || blogs.blogList.size() == 0) { bloglist.add(new Label(Msg.consts.none())); return; } this.blogMetas = blogs.blogList; for (BlogMeta meta : blogs.blogList) { RadioButton radio = new RadioButton("blog", meta.getName(), false); radio.setFormValue(meta.getId()); bloglist.add(radio); } }
From source file:com.jwh.gwt.fasttable.sample.client.FastTableSample.java
License:Open Source License
private void buildRowCountButtons(FlexTable flexTable) { flexTable.setWidget(0, 0, new Label()); flexTable.getFlexCellFormatter().setColSpan(0, 0, 2); final String rows10 = "10 sample rows"; final String rows100 = "100 sample rows"; final String rows500 = "500 sample rows"; final String rows1000 = "1000 sample rows"; final String rowsToBuild = "rowsToBuild"; final ValueChangeHandler<Boolean> handler = new ValueChangeHandler<Boolean>() { @Override// ww w .j a va 2 s .com public void onValueChange(ValueChangeEvent<Boolean> event) { RadioButton selected = (RadioButton) event.getSource(); if (rows10.equals(selected.getFormValue())) { sampleRowCount = 10; } else if (rows100.equals(selected.getFormValue())) { sampleRowCount = 100; } else if (rows500.equals(selected.getFormValue())) { sampleRowCount = 500; } else { sampleRowCount = 1000; } } }; { final RadioButton radio = new RadioButton(rowsToBuild); radio.setHTML(rows10); radio.setValue(false, false); radio.setFormValue(rows10); radio.addValueChangeHandler(handler); flexTable.setWidget(1, 0, radio); flexTable.getFlexCellFormatter().setColSpan(1, 0, 2); radio.getElement().getParentElement().addClassName(BORDER_NONE); } { final RadioButton radio = new RadioButton(rowsToBuild); radio.setHTML(rows100); radio.setValue(true, false); radio.setFormValue(rows100); radio.addValueChangeHandler(handler); flexTable.setWidget(2, 0, radio); flexTable.getFlexCellFormatter().setColSpan(2, 0, 2); radio.getElement().getParentElement().addClassName(BORDER_NONE); } { final RadioButton radio = new RadioButton(rowsToBuild); radio.setHTML(rows500); radio.setValue(false, false); radio.setFormValue(rows500); radio.addValueChangeHandler(handler); flexTable.setWidget(3, 0, radio); flexTable.getFlexCellFormatter().setColSpan(3, 0, 2); radio.getElement().getParentElement().addClassName(BORDER_NONE); } { final RadioButton radio = new RadioButton(rowsToBuild); radio.setHTML(rows1000); radio.setValue(false, false); radio.setFormValue(rows1000); radio.addValueChangeHandler(handler); flexTable.setWidget(4, 0, radio); flexTable.getFlexCellFormatter().setColSpan(4, 0, 2); radio.getElement().getParentElement().addClassName(BORDER_NONE); } }
From source file:com.square.composant.ged.square.client.composant.tagcloud.SelecteurTagCloud.java
License:Open Source License
/** * Remplissage des catgories.//from w w w . jav a2 s . c o m */ private void initCategories() { for (final TypeDocumentModel typeDoc : listeTypesDocumentsDisponibles) { final RadioButton rb = new RadioButton(constants.rbCategories(), typeDoc.getDescription() != null && !"".equals(typeDoc.getDescription().trim()) ? typeDoc.getDescription() : typeDoc.getNom()); rb.setFormValue(typeDoc.getCode()); rb.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { tbRecherche.setValue(""); remplirNuageTags(typeDoc); } }); panelCbCategories.add(rb); listeRb.add(rb); } }
From source file:de.schott.gae.football.client.DatabasePage.java
License:Apache License
/** * Create page with possible solutions. async. * // w w w. ja v a 2 s . com * @param implementations */ private void createPage(List<TransferObject> implementations) { Panel root = RootPanel.get(FootballEntry.CONTENT_ID); root.clear(); VerticalPanel panel = new VerticalPanel(); Label lblHeader = new Label("Choose Database implementation"); lblHeader.setStyleName("h1"); // Make some radio buttons, all in one group. VerticalPanel radioPanel = new VerticalPanel(); final List<RadioButton> radioButtons = new ArrayList<RadioButton>(); for (TransferObject to : implementations) { RadioButton radio = new RadioButton("radiogroup", (String) to.get("name")); radio.setValue((Boolean) to.get("selected")); Integer id = (Integer) to.get("id"); radio.setFormValue(id.toString()); radioButtons.add(radio); radioPanel.add(radio); } Button btnOk = new Button("Save"); btnOk.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { TransferObject to = new TransferObject(); for (RadioButton radio : radioButtons) { if (radio.getValue()) { Integer id = Integer.parseInt(radio.getFormValue()); to.put("id", id); mDatabaseService.setDatastoreImplementation(to, new AbstractAsyncCallback<Void>() { @Override public void onSuccess(Void result) { Window.alert("New Implementation saved."); createView(); } }); break; } } } }); panel.add(lblHeader); panel.add(radioPanel); panel.add(btnOk); root.add(panel); }
From source file:mcamara.client.PPregunta.java
License:Open Source License
private void actualizarRespuestas(int idPregunta) { ClickHandler handlerRespuesta = new ClickHandler() { public void onClick(ClickEvent event) { respuestaElegida = Integer.parseInt("" + ((RadioButton) event.getSource()).getFormValue()); }//from w ww . ja v a 2s . c om }; VerticalPanel vpr = pc.getVerticalPanelRespuestas(); vpr.clear(); numRespuestas = cuestionario.getPregunta(idPregunta).getNumeroDeRespuestas(); respuestas = new ArrayList<RadioButton>(); for (int i = 0; i < numRespuestas; i++) { String textoRespuesta = cuestionario.getPregunta(idPregunta).getRespuesta(i).getTextoRespuesta(); RadioButton respuesta = new RadioButton("grupoRespuestas", textoRespuesta); respuesta.setFormValue("" + i); respuesta.addClickHandler(handlerRespuesta); respuestas.add(respuesta); vpr.add(respuestas.get(i)); } }
From source file:net.scran24.admin.client.UserManager.java
public UserManager() { FlowPanel contents = new FlowPanel(); final FormPanel form = new FormPanel(); form.setAction(GWT.getModuleBaseURL() + "uploadUserInfo"); form.setEncoding(FormPanel.ENCODING_MULTIPART); form.setMethod(FormPanel.METHOD_POST); VerticalPanel panel = new VerticalPanel(); form.setWidget(panel);/*from w w w . ja v a 2 s . com*/ final FileUpload upload = new FileUpload(); upload.setName("file"); panel.add(upload); RadioButton append = new RadioButton("mode", "Append to existing user list"); append.setFormValue("append"); final RadioButton replace = new RadioButton("mode", "Replace existing user list"); replace.setFormValue("replace"); replace.setValue(true); panel.add(append); panel.add(replace); panel.add(WidgetFactory.createButton("Upload", new ClickHandler() { @Override public void onClick(ClickEvent event) { form.submit(); } })); form.addSubmitHandler(new SubmitHandler() { @Override public void onSubmit(SubmitEvent event) { if (upload.getFilename().isEmpty()) { Window.alert("Please choose a .csv file containing user information to upload"); event.cancel(); } else if (replace.getValue()) if (!Window.confirm( "Doing this will delete all user information from the database and replace it with the list you are submitting. Proceed?")) event.cancel(); } }); form.addSubmitCompleteHandler(new SubmitCompleteHandler() { @Override public void onSubmitComplete(SubmitCompleteEvent event) { // This is not a very robust way of detecting the status code, // but unfortunately there does not seem to be a better way of doing // this // that supports IE8 -- Ivan. // https://code.google.com/p/google-web-toolkit/issues/detail?id=7365 String result = event.getResults(); if (result.equals("OK")) Window.alert("User information uploaded."); else if (result.startsWith("ERR:")) { Window.alert("There was a problem uploading the user information: " + result.substring(4)); } else if (result.contains("401")) { LoginForm.showPopup(new Callback1<UserInfo>() { @Override public void call(UserInfo info) { form.submit(); } }); } else if (result.contains("403")) { // User is not authorised, e.g. someone has logged on as admin, // opened the user upload tab and timed out, then someone else // logged on as someone who does not have the right to // upload users. In this case, let them know and refresh the page // to either show the UI that corresponds to their set of permissions // or redirect them to another page. Window.alert("You are not authorised to upload user information."); Location.reload(); } } }); contents.add(new HTMLPanel("<h2>Staff user accounts</h2>")); contents.add(new Button("Add")); contents.add(new HTMLPanel("<h2>Respondent user accounts</h2>")); contents.add(form); initWidget(contents); }
From source file:org.bonitasoft.forms.client.view.widget.RadioButtonGroupWidget.java
License:Open Source License
private RadioButton createRadioButton(final String groupName, final ReducedFormFieldAvailableValue availableValue, final boolean allowHTML) { final RadioButton radioButton = new RadioButton(radioButtonGroupName, availableValue.getLabel(), allowHTML); radioButton.addClickHandler(this); radioButton.addValueChangeHandler(this); radioButton.setFormValue(availableValue.getValue()); radioButton.setStyleName("bonita_form_radio"); return radioButton; }
From source file:org.jbpm.form.builder.ng.model.client.form.items.RadioButtonFormItem.java
License:Apache License
private void populate(RadioButton button) { if (this.name != null) { button.setName(this.name); }//from ww w .j av a2s . c o m if (this.value != null) { button.setFormValue(this.value); } if (this.selected != null) { button.setValue(this.selected); } if (this.getWidth() != null) { button.setWidth(this.getWidth()); } if (this.getHeight() != null) { button.setHeight(this.getHeight()); } }
From source file:org.xwiki.gwt.wysiwyg.client.plugin.image.ui.ImageConfigWizardStep.java
License:Open Source License
/** * @param alignRadioGroup the name of the alignment radio group. * @return the panel holding the horizontal alignment settings for the image *///from w ww .j a v a 2s. c om private Panel getHorizontalAlignmentPanel(String alignRadioGroup) { FlowPanel hAlignPanel = new FlowPanel(); Label hAlignLabel = new Label(Strings.INSTANCE.imageHorizontalAlignmentLabel()); hAlignLabel.setStyleName(INFO_LABEL_STYLE); Label hAlignHelpLabel = new Label(Strings.INSTANCE.imageHorizontalAlignmentHelpLabel()); hAlignHelpLabel.setStyleName(HELP_LABEL_STYLE); hAlignPanel.addStyleName("xHAlignPanel"); hAlignPanel.add(hAlignLabel); hAlignPanel.add(hAlignHelpLabel); alignmentOptions = new ArrayList<RadioButton>(); RadioButton leftRadio = new RadioButton(alignRadioGroup, Strings.INSTANCE.imageAlignLeftLabel()); leftRadio.setFormValue(ImageConfig.ImageAlignment.LEFT.toString()); leftRadio.addKeyPressHandler(this); RadioButton centerRadio = new RadioButton(alignRadioGroup, Strings.INSTANCE.imageAlignCenterLabel()); centerRadio.setFormValue(ImageConfig.ImageAlignment.CENTER.toString()); centerRadio.addKeyPressHandler(this); RadioButton rightRadio = new RadioButton(alignRadioGroup, Strings.INSTANCE.imageAlignRightLabel()); rightRadio.setFormValue(ImageConfig.ImageAlignment.RIGHT.toString()); rightRadio.addKeyPressHandler(this); alignmentOptions.add(leftRadio); alignmentOptions.add(centerRadio); alignmentOptions.add(rightRadio); hAlignPanel.add(leftRadio); hAlignPanel.add(centerRadio); hAlignPanel.add(rightRadio); return hAlignPanel; }
From source file:org.xwiki.gwt.wysiwyg.client.plugin.image.ui.ImageConfigWizardStep.java
License:Open Source License
/** * @param alignRadioGroup the name of the alignment radio group. * @return the panel holding the vertical alignment settings for the image *//*from w ww . j a v a 2 s. co m*/ private Panel getVerticalAlignmentPanel(String alignRadioGroup) { FlowPanel vAlignPanel = new FlowPanel(); Label vAlignLabel = new Label(Strings.INSTANCE.imageVerticalAlignmentLabel()); vAlignLabel.setStyleName(INFO_LABEL_STYLE); Label vAlignHelpLabel = new Label(Strings.INSTANCE.imageVerticalAlignmentHelpLabel()); vAlignHelpLabel.setStyleName(HELP_LABEL_STYLE); vAlignPanel.addStyleName("xVAlignPanel"); vAlignPanel.add(vAlignLabel); vAlignPanel.add(vAlignHelpLabel); RadioButton topRadio = new RadioButton(alignRadioGroup, Strings.INSTANCE.imageAlignTopLabel()); topRadio.setFormValue(ImageConfig.ImageAlignment.TOP.toString()); topRadio.addKeyPressHandler(this); RadioButton middleRadio = new RadioButton(alignRadioGroup, Strings.INSTANCE.imageAlignMiddleLabel()); middleRadio.setFormValue(ImageConfig.ImageAlignment.MIDDLE.toString()); middleRadio.addKeyPressHandler(this); RadioButton bottomRadio = new RadioButton(alignRadioGroup, Strings.INSTANCE.imageAlignBottomLabel()); bottomRadio.setFormValue(ImageConfig.ImageAlignment.BOTTOM.toString()); bottomRadio.addKeyPressHandler(this); alignmentOptions.add(topRadio); alignmentOptions.add(middleRadio); alignmentOptions.add(bottomRadio); vAlignPanel.add(topRadio); vAlignPanel.add(middleRadio); vAlignPanel.add(bottomRadio); return vAlignPanel; }