当前位置: 首页>>代码示例>>Java>>正文


Java RadioButtonGroup类代码示例

本文整理汇总了Java中com.vaadin.ui.RadioButtonGroup的典型用法代码示例。如果您正苦于以下问题:Java RadioButtonGroup类的具体用法?Java RadioButtonGroup怎么用?Java RadioButtonGroup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RadioButtonGroup类属于com.vaadin.ui包,在下文中一共展示了RadioButtonGroup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testGetFieldTypeForAnonymousInstanceOfGenericField

import com.vaadin.ui.RadioButtonGroup; //导入依赖的package包/类
@Test
public void testGetFieldTypeForAnonymousInstanceOfGenericField() {
	@SuppressWarnings("serial")
	RadioButtonGroup<TestEnum> r = new RadioButtonGroup<TestEnum>() {};
	assertTrue(binder.getPresentationTypeForField(r).isPresent());
	assertEquals(TestEnum.class, binder.getPresentationTypeForField(r).get());
}
 
开发者ID:ljessendk,项目名称:easybinder,代码行数:8,代码来源:ReflectionBinderTest.java

示例2: testGetFieldTypeForGenericFieldWithValue

import com.vaadin.ui.RadioButtonGroup; //导入依赖的package包/类
@Test
public void testGetFieldTypeForGenericFieldWithValue() {
	RadioButtonGroup<TestEnum> r = new RadioButtonGroup<TestEnum>();
	r.setValue(TestEnum.Test1);
	assertTrue(binder.getPresentationTypeForField(r).isPresent());
	assertEquals(TestEnum.class, binder.getPresentationTypeForField(r).get());
}
 
开发者ID:ljessendk,项目名称:easybinder,代码行数:8,代码来源:ReflectionBinderTest.java

示例3: testGetFieldTypeForGenericFieldWithItems

import com.vaadin.ui.RadioButtonGroup; //导入依赖的package包/类
@Test
public void testGetFieldTypeForGenericFieldWithItems() {
	EnumSet<TestEnum> set = EnumSet.allOf(TestEnum.class);
	RadioButtonGroup<TestEnum> r = new RadioButtonGroup<TestEnum>("", set);
	assertTrue(binder.getPresentationTypeForField(r).isPresent());
	assertEquals(TestEnum.class, binder.getPresentationTypeForField(r).get());
}
 
开发者ID:ljessendk,项目名称:easybinder,代码行数:8,代码来源:ReflectionBinderTest.java

示例4: testGetFieldTypeForGenericFieldWithNoItems

import com.vaadin.ui.RadioButtonGroup; //导入依赖的package包/类
@Test
public void testGetFieldTypeForGenericFieldWithNoItems() {
	EnumSet<TestEnum> set = EnumSet.noneOf(TestEnum.class);
	RadioButtonGroup<TestEnum> r = new RadioButtonGroup<TestEnum>("", set);
	// We don't expect any more than an empty optional
	assertNotNull(binder.getPresentationTypeForField(r));
}
 
开发者ID:ljessendk,项目名称:easybinder,代码行数:8,代码来源:ReflectionBinderTest.java

示例5: testBindTypeErasure

import com.vaadin.ui.RadioButtonGroup; //导入依赖的package包/类
@Test
public void testBindTypeErasure() {
	when(converterRegistry.getConverter(String.class, String.class)).thenReturn(null);
	EasyBinding<TestEntity, String, String> binding = binder.bind(new RadioButtonGroup<String>(), "testString");
	assertNotNull(binding);
	verify(converterRegistry, never()).getConverter(any(), any());

	Result<String> res = binding.converterValidatorChain.convertToModel("giraf", null);
	assertFalse(res.isError());
	res.ifOk(e -> assertEquals("giraf", e));
	assertEquals("bird", binding.converterValidatorChain.convertToPresentation("bird", null));
}
 
开发者ID:ljessendk,项目名称:easybinder,代码行数:13,代码来源:ReflectionBinderTest.java

示例6: testBindTypeErasureUnrelatedTypes

import com.vaadin.ui.RadioButtonGroup; //导入依赖的package包/类
@Test(expected = RuntimeException.class)
public void testBindTypeErasureUnrelatedTypes() {
	when(converterRegistry.getConverter(Double.class, Integer.class)).thenReturn(null);
	EasyBinding<TestEntity, Double, Integer> binding = binder.bind(new RadioButtonGroup<Double>(), "testInt");
	assertNotNull(binding);
	verify(converterRegistry, never()).getConverter(any(), any());

	binding.converterValidatorChain.convertToModel(new Double(10.0), null);
}
 
开发者ID:ljessendk,项目名称:easybinder,代码行数:10,代码来源:ReflectionBinderTest.java

示例7: createContent

import com.vaadin.ui.RadioButtonGroup; //导入依赖的package包/类
@Override
protected Component createContent() {

    Messages messages = Messages.getInstance();

    layout = new FormLayout();
    layout.setMargin(new MarginInfo(true, true));

    name = new FTextField(messages.getMessage("informationStep.name.label")).withWidth("250px");
    gender = new RadioButtonGroup<Gender>(messages.getMessage("informationStep.sex.label"), EnumSet.allOf(Gender.class));
    age = new DSIntegerField(messages.getMessage("informationStep.age.label"));
    weight = new DSIntegerField(messages.getMessage("informationStep.weight.label"));
    height = new TextField(messages.getMessage("informationStep.height.label"));
    alignment = new ComboBox<>(messages.getMessage("informationStep.alignment.label"), alignmentService.findAllPlayable());
    region = new ComboBox<>(messages.getMessage("informationStep.region.label"), regionService.findAllOrderBy("name", "ASC"));
    
    getBinder().forMemberField(age).withValidator((value, context) -> {
        int minAge = getEntity().getRace().getMinAge();
        int maxAge = getEntity().getRace().getMaxAge();
        if (value.intValue() < minAge || value.intValue() > maxAge) {
            return ValidationResult.error(messages.getMessage("informationStep.age.validator", minAge, maxAge, getEntity().getRace().getName()));
        }
        return ValidationResult.ok();
    });

    gender.addValueChangeListener(event -> initImageSelector(event.getValue()));

    layout.addComponents(name, gender, age, weight, height, alignment, region);

    initImageSelector(null);

    return layout;
}
 
开发者ID:viydaag,项目名称:dungeonstory-java,代码行数:34,代码来源:InformationForm.java

示例8: testGetFieldTypeForGenericFieldWithNoInfo

import com.vaadin.ui.RadioButtonGroup; //导入依赖的package包/类
@Test
public void testGetFieldTypeForGenericFieldWithNoInfo() {
	RadioButtonGroup<TestEnum> r = new RadioButtonGroup<TestEnum>("");
	// We don't expect any more than an empty optional
	assertNotNull(binder.getPresentationTypeForField(r));
}
 
开发者ID:ljessendk,项目名称:easybinder,代码行数:7,代码来源:ReflectionBinderTest.java

示例9: SelectionControlsView

import com.vaadin.ui.RadioButtonGroup; //导入依赖的package包/类
public SelectionControlsView() {
    setAlignItems(FlexLayout.AlignItems.FLEX_START);
    setAlignSelf(AlignSelf.BASELINE);
    setFlexWrap(FlexLayout.FlexWrap.WRAP);
    setJustifyContent(JustifyContent.CENTER);
    addStyleName(Spacings.All.LARGE);

    // Checkboxes
    MDCheckbox cb1 = new MDCheckbox("Light On");
    MDCheckbox cb2 = new MDCheckbox("Light Off");
    MDCheckbox cb3 = new MDCheckbox("Light Disabled");
    cb3.setEnabled(false);

    FlexLayout light1 = new FlexLayout(cb1, cb2, cb3);
    light1.setFlexDirection(FlexLayout.FlexDirection.COLUMN);
    light1.addStyleName("card " + Paddings.All.LARGE);


    MDCheckbox cb4 = new MDCheckbox("Dark On", false);
    MDCheckbox cb5 = new MDCheckbox("Dark Off", false);
    MDCheckbox cb6 = new MDCheckbox("Dark Disabled", false);
    cb6.setEnabled(false);

    FlexLayout dark1 = new FlexLayout(cb4, cb5, cb6);
    dark1.setFlexDirection(FlexLayout.FlexDirection.COLUMN);
    dark1.addStyleName("card " + MaterialColor.GREY_900.getBackgroundColorStyle() + " " + Paddings.All.LARGE);


    // Radio buttons
    RadioButtonGroup<String> rbg1 = new RadioButtonGroup();
    rbg1.setItems("One", "Two");
    rbg1.setPrimaryStyleName(Styles.OptionGroups.LIGHT);

    RadioButtonGroup<String> rbg2 = new RadioButtonGroup();
    rbg2.setItems("Disabled One", "Disabled Two");
    rbg2.setPrimaryStyleName(Styles.OptionGroups.LIGHT);
    rbg2.setEnabled(false);

    FlexLayout light2 = new FlexLayout(rbg1, rbg2);
    light2.setFlexDirection(FlexLayout.FlexDirection.COLUMN);
    light2.addStyleName("card " + Paddings.All.LARGE);

    RadioButtonGroup<String> rbg3 = new RadioButtonGroup();
    rbg3.setItems("One", "Two");
    rbg3.setPrimaryStyleName(Styles.OptionGroups.DARK);

    RadioButtonGroup<String> rbg4 = new RadioButtonGroup();
    rbg4.setItems("Disabled One", "Disabled Two");
    rbg4.setPrimaryStyleName(Styles.OptionGroups.DARK);
    rbg4.setEnabled(false);

    FlexLayout dark2 = new FlexLayout(rbg3, rbg4);
    dark2.setFlexDirection(FlexLayout.FlexDirection.COLUMN);
    dark2.addStyleName("card " + MaterialColor.GREY_900.getBackgroundColorStyle() + " " + Paddings.All.LARGE);


    // Switches
    MDSwitch sw1 = new MDSwitch("Light On");
    MDSwitch sw2 = new MDSwitch("Light Off");
    MDSwitch sw3 = new MDSwitch("Light Disabled");
    sw3.setEnabled(false);

    FlexLayout light3 = new FlexLayout(sw1, sw2, sw3);
    light3.setFlexDirection(FlexLayout.FlexDirection.COLUMN);
    light3.addStyleName("card " + Paddings.All.LARGE);


    MDSwitch sw4 = new MDSwitch("Dark On", false);
    MDSwitch sw5 = new MDSwitch("Dark Off", false);
    MDSwitch sw6 = new MDSwitch("Dark Disabled", false);
    sw6.setEnabled(false);

    FlexLayout dark3 = new FlexLayout(sw4, sw5, sw6);
    dark3.setFlexDirection(FlexLayout.FlexDirection.COLUMN);
    dark3.addStyleName("card " + MaterialColor.GREY_900.getBackgroundColorStyle() + " " + Paddings.All.LARGE);


    addComponents(light1, dark1, light2, dark2, light3, dark3);

}
 
开发者ID:vaadin,项目名称:material-theme-fw8,代码行数:81,代码来源:SelectionControlsView.java

示例10: setHtmlContentAllowed

import com.vaadin.ui.RadioButtonGroup; //导入依赖的package包/类
public void setHtmlContentAllowed(boolean htmlContentAllowed) {
	if (getInternalField() instanceof RadioButtonGroup) {
		((RadioButtonGroup<?>) getInternalField()).setHtmlContentAllowed(htmlContentAllowed);
	}
}
 
开发者ID:holon-platform,项目名称:holon-vaadin,代码行数:6,代码来源:SingleSelectField.java

示例11: setItemEnabledProvider

import com.vaadin.ui.RadioButtonGroup; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void setItemEnabledProvider(SerializablePredicate<T> itemEnabledProvider) {
	if (getInternalField() instanceof RadioButtonGroup) {
		((RadioButtonGroup<T>) getInternalField()).setItemEnabledProvider(itemEnabledProvider);
	}
}
 
开发者ID:holon-platform,项目名称:holon-vaadin,代码行数:7,代码来源:SingleSelectField.java

示例12: createContent

import com.vaadin.ui.RadioButtonGroup; //导入依赖的package包/类
@Override
protected Component createContent() {
    Messages messages = Messages.getInstance();
    Component content = super.createContent();
    featLayout = new FHorizontalLayout().withFullWidth();

    updateType = new RadioButtonGroup<UpdateType>(messages.getMessage("abilityScoreStep.updateType.label"));
    updateType.setItems(Arrays.asList(UpdateType.values()));
    updateType.addValueChangeListener(event -> {
        if (event.getValue() != null) {
            abilityLayout.setVisible(event.getValue() == UpdateType.ABILITY);
            featLayout.setVisible(event.getValue() == UpdateType.FEAT);

            if (event.getValue() == UpdateType.ABILITY) {
                featChoice.setValue(null);
            } else {
                resetPointToSpend();

                strength.setValue(backupEntity.getStrength());
                dexterity.setValue(backupEntity.getDexterity());
                constitution.setValue(backupEntity.getConstitution());
                intelligence.setValue(backupEntity.getIntelligence());
                wisdom.setValue(backupEntity.getWisdom());
                charisma.setValue(backupEntity.getCharisma());
            }
            adjustButtons();
        }
    });

    getLayout().addComponentAsFirst(updateType);

    resetPointToSpend();

    featChoice = new FComboBox<Feat>(messages.getMessage("abilityScoreStep.feat.label")).withFullWidth();
    featDescription = new DSLabel();
    featLayout.addComponents(featChoice, featDescription);

    getLayout().addComponent(featLayout);

    return content;
}
 
开发者ID:viydaag,项目名称:dungeonstory-java,代码行数:42,代码来源:AbilityScoreUpdateForm.java

示例13: createExportLayout

import com.vaadin.ui.RadioButtonGroup; //导入依赖的package包/类
protected void createExportLayout() {
    exportLayout = new VerticalLayout();
    exportLayout.setSizeFull();
    exportLayout.setMargin(true);
    exportLayout.setSpacing(true);

    HorizontalLayout exportOptionsLayout = new HorizontalLayout();
    exportOptionsLayout.setSpacing(true);
    Label optionGroupLabel = new Label("Export Format <span style='padding-left:0px; color: red'>*</span>", ContentMode.HTML);
    exportOptionsLayout.addComponent(optionGroupLabel);

    oGroup = new RadioButtonGroup<String>();
    List<String> options = Arrays.asList("CSV", "Excel");
    oGroup.setItems(options);
    oGroup.setValue("CSV");

    exportOptionsLayout.addComponent(oGroup);
    exportLayout.addComponent(exportOptionsLayout);
    exportLayout.setExpandRatio(exportOptionsLayout, 1);

    cancelButton = new Button("Cancel", new Button.ClickListener() {
        static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            UI.getCurrent().removeWindow(ExportDialog.this);
        }
    });

    exportButton = CommonUiUtils.createPrimaryButton("Export", new Button.ClickListener() {
        static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            if (oGroup.getValue().toString().equals("CSV")) {
                csvExport();
            } else {
                excelExport();
            }
            UI.getCurrent().removeWindow(ExportDialog.this);
        }
    });
    exportButton.setClickShortcut(KeyCode.ENTER);

    exportLayout.addComponent(buildButtonFooter(cancelButton, exportButton));

}
 
开发者ID:JumpMind,项目名称:sqlexplorer-vaadin,代码行数:46,代码来源:ExportDialog.java

示例14: withHtmlContentAllowed

import com.vaadin.ui.RadioButtonGroup; //导入依赖的package包/类
/**
 * Sets whether html is allowed in the item captions. If set to true, the
 * captions are passed to the browser as html and the developer is
 * responsible for ensuring no harmful html is used. If set to false, the
 * content is passed to the browser as plain text.
 *
 * @param htmlContentAllowed
 *            true if the captions are used as html, false if used as plain text
 * @return this for method chaining
 * @see RadioButtonGroup#setHtmlContentAllowed(boolean)
 */
@SuppressWarnings("unchecked")
public default THIS withHtmlContentAllowed(boolean htmlContentAllowed) {
    ((RadioButtonGroup<ITEM>) this).setHtmlContentAllowed(htmlContentAllowed);
    return (THIS) this;
}
 
开发者ID:viydaag,项目名称:vaadin-fluent-api,代码行数:17,代码来源:FluentRadioButtonGroup.java

示例15: withItemCaptionGenerator

import com.vaadin.ui.RadioButtonGroup; //导入依赖的package包/类
/**
 * Sets the item caption generator that is used to produce the strings shown
 * in the radio button group for each item. By default,
 * {@link String#valueOf(Object)} is used.
 *
 * @param itemCaptionGenerator
 *            the item caption provider to use, not null
 * @return this for method chaining
 * @see RadioButtonGroup#setItemCaptionGenerator(ItemCaptionGenerator)
 */
@SuppressWarnings("unchecked")
public default THIS withItemCaptionGenerator(ItemCaptionGenerator<ITEM> itemCaptionGenerator) {
    ((RadioButtonGroup<ITEM>) this).setItemCaptionGenerator(itemCaptionGenerator);
    return (THIS) this;
}
 
开发者ID:viydaag,项目名称:vaadin-fluent-api,代码行数:16,代码来源:FluentRadioButtonGroup.java


注:本文中的com.vaadin.ui.RadioButtonGroup类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。