/** * Removes the given {@link JQMRadio} from this radioset * * @param radio - the radio to remove */ public void removeRadio(JQMRadio radio) { if (radio == null) return; TextBox inp = radio.getInput(); if (inp != null) { radios.remove(radio); fieldset.remove(inp); } if (radio.getLabel() != null) fieldset.remove(radio.getLabel()); }
@Override public String getTheme() { if (radios.isEmpty()) return theme; return radios.get(0).getTheme(); }
/** * If set to true then renders a smaller version of the standard-sized element. */ @Override public JQMRadio withMini(boolean mini) { setMini(mini); return this; }
JQMRadio() { Element element = input.getElement(); element.setId(Document.get().createUniqueId()); element.setAttribute("type", "radio"); setElement(element); setLabel(new FormLabel()); }
private void addRadiosBlurHandler(final BlurHandler handler) { for (JQMRadio r : radios) { TextBox radio = r.getInput(); blurHandlers.add(radio.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { handler.onBlur(null); } })); } }
/** * Returns the value of the radio option at the given index. * * @return the value of the k'th radio option */ public String getValue(int k) { return radios.get(k).getElement().getAttribute("value"); }
@Override public JQMRadio withText(String text) { setText(text); return this; } }
/** * Adds a new radio button to this radioset using the given value and text. * Returns a JQMRadio instance which can be used to change the value and * label of the radio button. * * @param value * the value to associate with this radio option. This will be * the value returned by methods that query the selected value. * * @param text * the label to show for this radio option. * * @return a JQMRadio instance to adjust the added radio button */ public JQMRadio addRadio(String value, String text) { JQMRadio radio = new JQMRadio(value, text); addRadio(radio); return radio; }
JQMRadio() { Element element = input.getElement(); element.setId(Document.get().createUniqueId()); element.setAttribute("type", "radio"); setElement(element); setLabel(new FormLabel()); }
private void addRadiosBlurHandler(final BlurHandler handler) { for (JQMRadio r : radios) { TextBox radio = r.getInput(); blurHandlers.add(radio.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { handler.onBlur(null); } })); } }
/** * Returns the value of the radio option at the given index. * * @return the value of the k'th radio option */ public String getValue(int k) { return radios.get(k).getElement().getAttribute("value"); }
@Override public JQMRadio withText(String text) { setText(text); return this; } }
/** * Adds a new radio button to this radioset using the given value and text. * Returns a JQMRadio instance which can be used to change the value and * label of the radio button. * * @param value * the value to associate with this radio option. This will be * the value returned by methods that query the selected value. * * @param text * the label to show for this radio option. * * @return a JQMRadio instance to adjust the added radio button */ public JQMRadio addRadio(String value, String text) { JQMRadio radio = new JQMRadio(value, text); addRadio(radio); return radio; }
JQMRadio() { Element element = input.getElement(); element.setId(Document.get().createUniqueId()); element.setAttribute("type", "radio"); setElement(element); setLabel(new FormLabel()); }