/** * @see #RadioButtonToggle(String, SafeHtml) * * @param name * the group name with which to associate the radio button * @param label * this radio button's label * @param dir * the text's direction. Note that {@code DEFAULT} means * direction should be inherited from the widget's parent * element. */ public RadioButton(String name, String label, Direction dir) { this(name); setText(label, dir); }
/** * @see #RadioButtonToggle(String, SafeHtml) * * @param name * the group name with which to associate the radio button * @param label * this radio button's label * @param dir * the text's direction. Note that {@code DEFAULT} means * direction should be inherited from the widget's parent * element. */ public RadioButton(String name, String label, Direction dir) { this(name); setText(label, dir); }
/** * Creates a new radio associated with a particular group, and initialized * with the given HTML label. All radio buttons associated with the same * group name belong to a mutually-exclusive set. * * Radio buttons are grouped by their name attribute, so changing their name * using the setName() method will also change their associated group. * * @param name * the group name with which to associate the radio button * @param label * this radio button's label */ public RadioButton(String name, String label) { this(name); setText(label); }
/** * Creates a new radio associated with a particular group, and initialized * with the given HTML label. All radio buttons associated with the same * group name belong to a mutually-exclusive set. * * Radio buttons are grouped by their name attribute, so changing their name * using the setName() method will also change their associated group. * * @param name * the group name with which to associate the radio button * @param label * this radio button's label */ public RadioButton(String name, String label) { this(name); setText(label); }
/** * @see #RadioButtonToggle(String, SafeHtml) * * @param name * the group name with which to associate the radio button * @param label * this radio button's label * @param directionEstimator * A DirectionEstimator object used for automatic direction * adjustment. For convenience, * {@link #DEFAULT_DIRECTION_ESTIMATOR} can be used. */ public RadioButton(String name, String label, DirectionEstimator directionEstimator) { this(name); setDirectionEstimator(directionEstimator); setText(label); }
/** * @see #RadioButtonToggle(String, SafeHtml) * * @param name * the group name with which to associate the radio button * @param label * this radio button's label * @param directionEstimator * A DirectionEstimator object used for automatic direction * adjustment. For convenience, * {@link #DEFAULT_DIRECTION_ESTIMATOR} can be used. */ public RadioButton(String name, String label, DirectionEstimator directionEstimator) { this(name); setDirectionEstimator(directionEstimator); setText(label); }
void localize() { buttonToType.entrySet().stream().filter(e -> e.getValue() != null) .forEach(e -> e.getKey().setText(EnumTranslator.getInstance().translate(e.getValue()))); }
/** * Creates a new radio button associated with a particular group, and * initialized with the given label (optionally treated as HTML). All radio * buttons associated with the same group name belong to a * mutually-exclusive set. * * Radio buttons are grouped by their name attribute, so changing their name * using the setName() method will also change their associated group. * * @param name * name the group with which to associate the radio button * @param label * this radio button's label * @param asHTML * <code>true</code> to treat the specified label as HTML */ public RadioButton(String name, String label, boolean asHTML) { this(name); if (asHTML) { setHTML(label); } else { setText(label); } }
/** * Creates a new radio button associated with a particular group, and * initialized with the given label (optionally treated as HTML). All radio * buttons associated with the same group name belong to a * mutually-exclusive set. * * Radio buttons are grouped by their name attribute, so changing their name * using the setName() method will also change their associated group. * * @param name * name the group with which to associate the radio button * @param label * this radio button's label * @param asHTML * <code>true</code> to treat the specified label as HTML */ public RadioButton(String name, String label, boolean asHTML) { this(name); if (asHTML) { setHTML(label); } else { setText(label); } }
private Widget getRadioGroupPanel() { buttonToType = new LinkedHashMap<>(); RadioButton allButton = new RadioButton(BUTTON_GROUP_NAME); //$NON-NLS-1$ buttonToType.put(allButton, null); allButton.setText(constants.allDisksLabel()); allButton.setActive(true); for (DiskContentType contentType : DiskContentType.values()) { RadioButton button = new RadioButton(BUTTON_GROUP_NAME); //$NON-NLS-1$ buttonToType.put(button, contentType); } ButtonGroup buttonGroup = new ButtonGroup(); buttonGroup.setDataToggle(Toggle.BUTTONS); buttonToType.entrySet().forEach(e -> { buttonGroup.add(e.getKey()); e.getKey().addClickHandler(event -> fireChangeHandlers(e.getValue())); }); setDiskContentType(null); localize(); buttonGroup.addStyleName("disk-type-buttons-group"); //$NON-NLS-1$ return buttonGroup; }
private Widget getRadioGroupPanel() { ButtonGroup buttonGroup = new ButtonGroup(); buttonGroup.setDataToggle(Toggle.BUTTONS); for (ViewFilter<K> item : items) { RadioButton radioButton = new RadioButton(GROUP_NAME); radioButton.setText(item.getText()); radioButton.addClickHandler(event -> fireChangeHandlers(item.getValue())); buttons.put(item.getValue(), radioButton); buttonGroup.add(radioButton); } setSelectedValue(items.get(0).getValue()); return buttonGroup; }
private Widget getRadioGroupPanel() { allButton = new RadioButton(GROUP_NAME); allButton.setText(constants.allDisksLabel()); allButton.setActive(true); allButton.addClickHandler(event -> fireChangeHandlers(null)); imagesButton = new RadioButton(GROUP_NAME); imagesButton.setText(constants.imageDisksLabel()); imagesButton.addClickHandler(event -> fireChangeHandlers(DiskStorageType.IMAGE)); lunsButton = new RadioButton(GROUP_NAME); lunsButton.setText(constants.lunDisksLabel()); lunsButton.addClickHandler(event -> fireChangeHandlers(DiskStorageType.LUN)); cinderButton = new RadioButton(GROUP_NAME); cinderButton.setText(constants.cinderDisksLabel()); cinderButton.addClickHandler(event -> fireChangeHandlers(DiskStorageType.CINDER)); managedBlockButton = new RadioButton(GROUP_NAME); managedBlockButton.setText(constants.managedBlockDisksLabel()); managedBlockButton.addClickHandler(event -> fireChangeHandlers(DiskStorageType.MANAGED_BLOCK_STORAGE)); ButtonGroup buttonGroup = new ButtonGroup(); buttonGroup.setDataToggle(Toggle.BUTTONS); buttonGroup.add(allButton); buttonGroup.add(imagesButton); buttonGroup.add(lunsButton); buttonGroup.add(cinderButton); buttonGroup.add(managedBlockButton); buttonGroup.addStyleName("disk-type-buttons-group"); //$NON-NLS-1$ return buttonGroup; }