List of usage examples for com.google.gwt.user.client.ui RadioButton setEnabled
@Override
public void setEnabled(boolean enabled)
From source file:com.dingziran.effective.client.content.widgets.CwRadioButton.java
License:Apache License
/** * Constructor.//from w ww . ja v a 2s . c om * * @param constants the constants */ public CwRadioButton(CwConstants constants) { super(constants.cwRadioButtonName(), constants.cwRadioButtonDescription()); this.constants = constants; view = new ContentWidgetView(hasMargins(), hasScrollableContent()); view.setName(getName()); view.setDescription(getDescription()); setWidget(view); // Create a vertical panel to align the radio buttons VerticalPanel vPanel = new VerticalPanel(); vPanel.add(new HTML(constants.cwRadioButtonSelectColor())); // Add some radio buttons to a group called 'color' String[] colors = constants.cwRadioButtonColors(); for (int i = 0; i < colors.length; i++) { String color = colors[i]; RadioButton radioButton = new RadioButton("color", color); radioButton.ensureDebugId("cwRadioButton-color-" + color); if (i == 2) { radioButton.setEnabled(false); } vPanel.add(radioButton); } // Add a new header to select your favorite sport vPanel.add(new HTML("<br>" + constants.cwRadioButtonSelectSport())); // Add some radio buttons to a group called 'sport' String[] sports = constants.cwRadioButtonSports(); for (int i = 0; i < sports.length; i++) { String sport = sports[i]; RadioButton radioButton = new RadioButton("sport", sport); radioButton.ensureDebugId("cwRadioButton-sport-" + sport.replaceAll(" ", "")); if (i == 2) { radioButton.setValue(true); } vPanel.add(radioButton); } view.setExample(vPanel); }
From source file:com.google.gerrit.client.account.NewAgreementScreen.java
License:Apache License
private void renderSelf() { current = null;// ww w . ja va 2 s . c o m agreementGroup.setVisible(false); contactGroup.setVisible(false); finalGroup.setVisible(false); radios.clear(); final SmallHeading hdr = new SmallHeading(); if (available.isEmpty()) { hdr.setText(Util.C.newAgreementNoneAvailable()); } else { hdr.setText(Util.C.newAgreementSelectTypeHeading()); } radios.add(hdr); for (final ContributorAgreement cla : available) { final RadioButton r = new RadioButton("cla_id", cla.getName()); r.addStyleName(Gerrit.RESOURCES.css().contributorAgreementButton()); radios.add(r); if (mySigned.contains(cla.getName())) { r.setEnabled(false); final Label l = new Label(Util.C.newAgreementAlreadySubmitted()); l.setStyleName(Gerrit.RESOURCES.css().contributorAgreementAlreadySubmitted()); radios.add(l); } else { r.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { showCLA(cla); } }); } if (cla.getDescription() != null && !cla.getDescription().equals("")) { final Label l = new Label(cla.getDescription()); l.setStyleName(Gerrit.RESOURCES.css().contributorAgreementShortDescription()); radios.add(l); } } }
From source file:com.google.gwt.sample.showcase.client.content.widgets.CwRadioButton.java
License:Apache License
/** * Initialize this example./* w ww . j a v a 2s. c o m*/ */ @ShowcaseSource @Override public Widget onInitialize() { // Create a vertical panel to align the radio buttons VerticalPanel vPanel = new VerticalPanel(); vPanel.add(new HTML(constants.cwRadioButtonSelectColor())); // Add some radio buttons to a group called 'color' String[] colors = constants.cwRadioButtonColors(); for (int i = 0; i < colors.length; i++) { String color = colors[i]; RadioButton radioButton = new RadioButton("color", color); radioButton.ensureDebugId("cwRadioButton-color-" + color); if (i == 2) { radioButton.setEnabled(false); } vPanel.add(radioButton); } // Add a new header to select your favorite sport vPanel.add(new HTML("<br>" + constants.cwRadioButtonSelectSport())); // Add some radio buttons to a group called 'sport' String[] sports = constants.cwRadioButtonSports(); for (int i = 0; i < sports.length; i++) { String sport = sports[i]; RadioButton radioButton = new RadioButton("sport", sport); radioButton.ensureDebugId("cwRadioButton-sport-" + sport.replaceAll(" ", "")); if (i == 2) { radioButton.setValue(true); } vPanel.add(radioButton); } return vPanel; }
From source file:com.google.testing.testify.risk.frontend.client.view.widgets.EditCapabilityWidget.java
License:Apache License
private void enableOrDisableAllRadioButtons(Panel panel, boolean enable) { for (Widget w : panel) { if (w instanceof RadioButton) { RadioButton b = (RadioButton) w; b.setEnabled(enable); }/*from ww w.j av a 2s . c o m*/ } }
From source file:com.gwtmodel.table.view.ewidget.gwt.RadioBoxField.java
License:Apache License
@Override public void setReadOnly(boolean readOnly) { for (RadioButton r : ra) { r.setEnabled(!readOnly); }/* www . j av a 2 s . c o m*/ }
From source file:com.murrayc.murraycgwtpexample.client.application.thing.ThingView.java
License:Open Source License
/** Disable all radio buttons in the the choicesPanel. * We need this helper method because there is no general Panel.setEnabled() method. * * @param enabled/*w ww . j av a2 s .c o m*/ */ private void enableChoices(boolean enabled) { for (Widget widget : choicesPanel) { if (widget instanceof RadioButton) { final RadioButton radioButton = (RadioButton) widget; radioButton.setEnabled(enabled); } } }
From source file:com.qualogy.qafe.gwt.client.ui.renderer.ChoiceRenderer.java
License:Apache License
public UIObject render(ComponentGVO component, String uuid, String parent, String context) { Panel uiObject = null;//from www.j a v a 2 s .co m if (component != null) { if (component instanceof ChoiceGVO) { ChoiceGVO gvo = (ChoiceGVO) component; final ComponentGVO finalComponentGVO = component; final String finalUuid = uuid; final String finalParent = parent; if (gvo.getHorizontalOrientation() != null && gvo.getHorizontalOrientation().booleanValue()) { if (gvo.getMenu() != null) { uiObject = new QChoiceHorizontal() { @Override public void onBrowserEvent(Event event) { if (event.getTypeInt() == Event.ONCONTEXTMENU) { DOM.eventPreventDefault(event); applyContextMenu(event, finalComponentGVO, finalUuid, finalParent); } super.onBrowserEvent(event); } @Override protected void setElement(Element elem) { super.setElement(elem); sinkEvents(Event.ONCONTEXTMENU); } }; } else { uiObject = new QChoiceHorizontal(); } } else { if (gvo.getMenu() != null) { uiObject = new QChoiceVertical() { @Override public void onBrowserEvent(Event event) { if (event.getTypeInt() == Event.ONCONTEXTMENU) { DOM.eventPreventDefault(event); applyContextMenu(event, finalComponentGVO, finalUuid, finalParent); } super.onBrowserEvent(event); } @Override protected void setElement(Element elem) { super.setElement(elem); sinkEvents(Event.ONCONTEXTMENU); } }; } else { uiObject = new QChoiceVertical(); } } RendererHelper.fillIn(component, uiObject, uuid, parent, context); registerDataChange(gvo, uiObject); if (uiObject != null) { ChoiceItemGVO[] items = gvo.getChoiceItems(); if (items != null) { for (int i = 0; i < items.length; i++) { if (items[i] != null) { RadioButton radio = new QRadioButton(gvo.getId(), items[i].getDisplayname(), items[i].getValue()); //radio.setStylePrimaryName(gvo.getStyleClassName()); uiObject.add(radio); RendererHelper.fillIn(items[i], radio, uuid, parent, context); RendererHelper.addEvents(component, radio, uuid); RendererHelper.addId(component, radio, uuid, parent, context, true); // If parent is disabled all its children should be also disabled if (gvo.isDisabled()) { radio.setEnabled(false); } if (items[i].getSelected() != null) { if (items[i].getSelected().booleanValue()) { radio.setChecked(items[i].getSelected()); // Don't want to fire events from here hence using the setChecked(). DOM.setElementAttribute(radio.getElement(), "isSelected", "true"); } } } } } } RendererHelper.handleRequiredAttribute(component, uiObject); } } return uiObject; }
From source file:com.square.composant.ged.square.client.composant.tagcloud.SelecteurTagCloud.java
License:Open Source License
/** * Passe le composant en lecture seule./*from w w w. j ava 2s .c o m*/ * @param newLectureSeule vrai ou faux */ public void lectureSeule(boolean newLectureSeule) { tbRecherche.setEnabled(!newLectureSeule); for (RadioButton rb : listeRb) { rb.setEnabled(!newLectureSeule); } this.lectureSeule = newLectureSeule; }
From source file:com.square.composant.tarificateur.square.client.view.ligne.devis.LigneDevisViewImpl.java
License:Open Source License
/** * Affiche les informations d'une ligne de devis. *//*from w w w . ja va 2 s . c o m*/ private void afficherInfosLigneDevis(LigneDevisModel ligneDevis, final boolean ligneLiee, boolean isLectureSeule, int numLigne) { // on rcupre la finalit final Long idFinalite = ligneDevis.getFinalite().getIdentifiant() != null ? ligneDevis.getFinalite().getIdentifiant() : constantesApp.getIdFinaliteEnCours(); // on rcupre le critre optionnel ou pas du produit boolean isProduitOptionnel = true; if (ligneLiee && ligneDevis.getProduitOptionnel() != null) { isProduitOptionnel = ligneDevis.getProduitOptionnel().booleanValue(); } // calcul du montant mensuel final float montantLigneMensuel = calculMontantMensuelLigne(ligneDevis.getMontantTtc().floatValue(), ligneDevis.getIdentifiantModePaiement()); float montantLigneMensuelRemise = 0f; if (ligneDevis.getMontantRemise() != null) { montantLigneMensuelRemise = calculMontantMensuelLigne(ligneDevis.getMontantRemise().floatValue(), ligneDevis.getIdentifiantModePaiement()); } // ajout du montant de la ligne au total sauf si ligne lie obligatoire if ((!ligneLiee || isProduitOptionnel) && montantLigneMensuelRemise != montantLigneMensuel) { montantTotalLignesGroupees += montantLigneMensuel; montantTotalLignesGroupeesRemise += montantLigneMensuelRemise; } final RadioButton rbLigneAdhesion = new RadioButton(ligneDevis.getIdentifiant() + "-" + numLigne); final RadioButton rbLigneRefus = new RadioButton(ligneDevis.getIdentifiant() + "-" + numLigne); final RadioButton rbLigneEnCours = new RadioButton(ligneDevis.getIdentifiant() + "-" + numLigne); final RadioButton rbLigneCorbeille = new RadioButton(ligneDevis.getIdentifiant() + "-" + numLigne); rbLigneAdhesion.setTitle(viewConstants.titreRadioAccepte()); rbLigneRefus.setTitle(viewConstants.titreRadioRefuse()); rbLigneEnCours.setTitle(viewConstants.titreRadioEnCours()); rbLigneCorbeille.setTitle(viewConstants.titreRadioCorbeille()); rbLigneAdhesion.setEnabled(!isLectureSeule); rbLigneRefus.setEnabled(!isLectureSeule); rbLigneEnCours.setEnabled(!isLectureSeule); rbLigneCorbeille.setEnabled(!isLectureSeule); // on coche la finalite suivant le cas if (idFinalite.equals(constantesApp.getIdFinaliteAcceptee())) { rbLigneAdhesion.setValue(Boolean.TRUE); } else if (idFinalite.equals(constantesApp.getIdFinaliteRefusee())) { rbLigneRefus.setValue(Boolean.TRUE); } else if (idFinalite.equals(constantesApp.getIdFinaliteEnCours())) { rbLigneEnCours.setValue(Boolean.TRUE); } else if (idFinalite.equals(constantesApp.getIdFinaliteCorbeille())) { rbLigneCorbeille.setValue(Boolean.TRUE); } final CheckBox cbImprimerLigne = new CheckBox(); cbImprimerLigne.setTitle(viewConstants.titreCheckboxSelection()); mapRbLigneAdhesion.put(ligneDevis.getIdentifiant(), rbLigneAdhesion); mapRbLigneRefus.put(ligneDevis.getIdentifiant(), rbLigneRefus); mapRbLigneEnAttente.put(ligneDevis.getIdentifiant(), rbLigneEnCours); mapRbLigneCorbeille.put(ligneDevis.getIdentifiant(), rbLigneCorbeille); mapCbImprimerLigne.put(ligneDevis.getIdentifiant(), cbImprimerLigne); if (ligneLiee && !isProduitOptionnel) { // produit obligatoire non coch et non dcochable (non affich de toute faon) cbImprimerLigne.setValue(Boolean.FALSE); cbImprimerLigne.setEnabled(Boolean.FALSE); } else if (ligneLiee && isProduitOptionnel) { // On slectionne pour impression les produits bonus if (ligneDevis.getIdentifiantFamille().equals(constantesApp.getIdentifiantFamilleBonus1()) || ligneDevis.getIdentifiantFamille().equals(constantesApp.getIdentifiantFamilleBonus2())) { cbImprimerLigne.setValue(Boolean.TRUE); } else { // produit optionnel dcochable cbImprimerLigne.setValue(ligneDevis.getSelectionnePourImpression() != null ? ligneDevis.getSelectionnePourImpression() : Boolean.FALSE); } cbImprimerLigne.setEnabled(Boolean.TRUE); } else if (!ligneLiee) { // produit principal dcochable cbImprimerLigne.setValue(ligneDevis.getSelectionnePourImpression() != null && ligneDevis.getSelectionnePourImpression().booleanValue()); cbImprimerLigne.setEnabled(Boolean.TRUE); } String libelleMontant = ""; if (montantLigneMensuelRemise != montantLigneMensuel) { libelleMontant = numberFormat.format((double) montantLigneMensuel) + ComposantTarificateurConstants.ESPACE + viewConstants.symboleMonnaie(); } else if (montantLigneMensuel != 0f && (ligneDevis.getNAAucunTarif() == null || !ligneDevis.getNAAucunTarif())) { libelleMontant = viewConstants.libelleOffert(); } final Label lProduit = new Label(); final Label lPrenomNomBeneficiaire = new Label(); final HTML lCriteresProduit = new HTML(); final Label lDateEffet = new Label(); final Label lMontant = new Label(); lDateEffet.setWordWrap(false); lMontant.setWordWrap(false); final String libelleProduit = ligneDevis.getLibelleProduit(); lProduit.setText(libelleProduit); //limite le nombre de caractres final String nomPrenom = ligneDevis.getPrenomNomBeneficiaire(); String nomPrenomLimite = nomPrenom; if (nomPrenom.length() > viewConstants.nbMaxCaracteresNomPrenom()) { //limite si superieur a la constante nomPrenomLimite = nomPrenomLimite.substring(0, viewConstants.nbMaxCaracteresNomPrenom()) + "..."; } lPrenomNomBeneficiaire.setText(nomPrenomLimite); lPrenomNomBeneficiaire.setTitle(nomPrenom); lCriteresProduit.setHTML(getLibelleCriteresProduit(ligneDevis)); lDateEffet.setText(ligneDevis.getDateEffet()); lMontant.setText(libelleMontant); tableauLignesDevis.setWidget(numLigne, 0, lProduit); tableauLignesDevis.setWidget(numLigne, 1, lPrenomNomBeneficiaire); tableauLignesDevis.setWidget(numLigne, 2, lCriteresProduit); tableauLignesDevis.setWidget(numLigne, 3, lDateEffet); tableauLignesDevis.setWidget(numLigne, 4, lMontant); tableauLignesDevis.setWidget(numLigne, 5, rbLigneAdhesion); tableauLignesDevis.setWidget(numLigne, 6, rbLigneRefus); tableauLignesDevis.setWidget(numLigne, 7, rbLigneCorbeille); tableauLignesDevis.setWidget(numLigne, 8, rbLigneEnCours); tableauLignesDevis.setWidget(numLigne, 9, cbImprimerLigne); // mise en forme du tableau tableauLignesDevis.getCellFormatter().setHorizontalAlignment(numLigne, 0, HasAlignment.ALIGN_LEFT); tableauLignesDevis.getCellFormatter().setHorizontalAlignment(numLigne, 1, HasAlignment.ALIGN_LEFT); tableauLignesDevis.getCellFormatter().setHorizontalAlignment(numLigne, 2, HasAlignment.ALIGN_LEFT); tableauLignesDevis.getCellFormatter().setHorizontalAlignment(numLigne, 3, HasAlignment.ALIGN_LEFT); tableauLignesDevis.getCellFormatter().setHorizontalAlignment(numLigne, 4, HasAlignment.ALIGN_RIGHT); tableauLignesDevis.getCellFormatter().setHorizontalAlignment(numLigne, 5, HasAlignment.ALIGN_CENTER); tableauLignesDevis.getCellFormatter().setHorizontalAlignment(numLigne, 6, HasAlignment.ALIGN_CENTER); tableauLignesDevis.getCellFormatter().setHorizontalAlignment(numLigne, 7, HasAlignment.ALIGN_CENTER); tableauLignesDevis.getCellFormatter().setHorizontalAlignment(numLigne, 8, HasAlignment.ALIGN_CENTER); tableauLignesDevis.getCellFormatter().setHorizontalAlignment(numLigne, 9, HasAlignment.ALIGN_CENTER); tableauLignesDevis.getRowFormatter().setVerticalAlign(numLigne, HasAlignment.ALIGN_TOP); tableauLignesDevis.getCellFormatter().addStyleName(numLigne, 0, ComposantTarificateur.RESOURCES.css().important()); tableauLignesDevis.getCellFormatter().addStyleName(numLigne, 1, ComposantTarificateur.RESOURCES.css().important()); tableauLignesDevis.getCellFormatter().addStyleName(numLigne, 3, ComposantTarificateur.RESOURCES.css().important()); tableauLignesDevis.getCellFormatter().addStyleName(numLigne, 4, ComposantTarificateur.RESOURCES.css().important()); // Mise en forme spciale pour les lignes associes des produits sans tarifs if (ligneDevis.getNAAucunTarif() != null && ligneDevis.getNAAucunTarif().booleanValue()) { tableauLignesDevis.getRowFormatter().addStyleName(numLigne, ComposantTarificateur.RESOURCES.css().produitSansTarif()); } // si c'est une ligne liee dont le produit est obligatoire, ou si il s'agit d'un produit bonus if ((ligneLiee && !isProduitOptionnel) || ligneDevis.getIdentifiantFamille().equals(constantesApp.getIdentifiantFamilleBonus1()) || ligneDevis.getIdentifiantFamille().equals(constantesApp.getIdentifiantFamilleBonus2())) { rbLigneAdhesion.setEnabled(false); rbLigneRefus.setEnabled(false); rbLigneEnCours.setEnabled(false); rbLigneCorbeille.setEnabled(false); // on cache la ligne tableauLignesDevis.getRowFormatter().setVisible(numLigne, false); } }
From source file:com.vaadin.client.ui.VRadioButtonGroup.java
License:Apache License
private void updateItem(RadioButton button, JsonObject item, boolean requireInitialization) { String itemHtml = item.getString(ListingJsonConstants.JSONKEY_ITEM_VALUE); if (!isHtmlContentAllowed()) { itemHtml = WidgetUtil.escapeHTML(itemHtml); }/*from w ww . j a va2s.co m*/ String iconUrl = item.getString(ListingJsonConstants.JSONKEY_ITEM_ICON); if (iconUrl != null && iconUrl.length() != 0) { Icon icon = client.getIcon(iconUrl); itemHtml = icon.getElement().getString() + itemHtml; } button.setHTML(itemHtml); button.setValue(item.getBoolean(ListingJsonConstants.JSONKEY_ITEM_SELECTED)); boolean optionEnabled = !item.getBoolean(ListingJsonConstants.JSONKEY_ITEM_DISABLED); boolean enabled = optionEnabled && !isReadonly() && isEnabled(); button.setEnabled(enabled); String key = item.getString(DataCommunicatorConstants.KEY); if (requireInitialization) { getWidget().add(button); button.setStyleName("v-radiobutton"); button.addStyleName(CLASSNAME_OPTION); button.addClickHandler(this); } optionsToItems.put(button, item); keyToOptions.put(key, button); }