本文整理汇总了Java中com.vaadin.ui.OptionGroup.addItem方法的典型用法代码示例。如果您正苦于以下问题:Java OptionGroup.addItem方法的具体用法?Java OptionGroup.addItem怎么用?Java OptionGroup.addItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.ui.OptionGroup
的用法示例。
在下文中一共展示了OptionGroup.addItem方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createOptionGroup
import com.vaadin.ui.OptionGroup; //导入方法依赖的package包/类
/**
* create option group with Create tag/Update tag based on permissions.
*/
protected void createOptionGroup(final boolean hasCreatePermission, final boolean hasUpdatePermission) {
optiongroup = new OptionGroup("Select Action");
optiongroup.setId(UIComponentIdProvider.OPTION_GROUP);
optiongroup.addStyleName(ValoTheme.OPTIONGROUP_SMALL);
optiongroup.addStyleName("custom-option-group");
optiongroup.setNullSelectionAllowed(false);
if (hasCreatePermission) {
optiongroup.addItem(createTagStr);
}
if (hasUpdatePermission) {
optiongroup.addItem(updateTagStr);
}
setOptionGroupDefaultValue(hasCreatePermission, hasUpdatePermission);
}
示例2: buildDialogLayout
import com.vaadin.ui.OptionGroup; //导入方法依赖的package包/类
@Override
protected void buildDialogLayout() {
final VerticalLayout mainLayout = new VerticalLayout();
mainLayout.setSizeFull();
mainLayout.setSpacing(true);
mainLayout.setMargin(true);
optMessageType = new OptionGroup(ctx.tr("rdfvalidation.dialog.optMessageType.caption"));
optMessageType.addItem(DPUContext.MessageType.ERROR);
optMessageType.addItem(DPUContext.MessageType.WARNING);
optMessageType.setValue(optMessageType.getItem(0));
mainLayout.addComponent(optMessageType);
txtAskQuery = new TextArea(ctx.tr("rdfvalidation.dialog.txtAskQuery.caption"));
txtAskQuery.setSizeFull();
txtAskQuery.setNullRepresentation("");
txtAskQuery.setNullSettingAllowed(true);
mainLayout.addComponent(txtAskQuery);
mainLayout.setExpandRatio(txtAskQuery, 1.0f);
setCompositionRoot(mainLayout);
}
示例3: createErrorThresholdOptionGroup
import com.vaadin.ui.OptionGroup; //导入方法依赖的package包/类
private OptionGroup createErrorThresholdOptionGroup() {
final OptionGroup errorThresoldOptions = new OptionGroup();
for (final ERRORTHRESOLDOPTIONS option : ERRORTHRESOLDOPTIONS.values()) {
errorThresoldOptions.addItem(option.getValue());
}
errorThresoldOptions.setId(UIComponentIdProvider.ROLLOUT_ERROR_THRESOLD_OPTION_ID);
errorThresoldOptions.addStyleName(ValoTheme.OPTIONGROUP_HORIZONTAL);
errorThresoldOptions.addStyleName(SPUIStyleDefinitions.ROLLOUT_OPTION_GROUP);
errorThresoldOptions.setSizeUndefined();
errorThresoldOptions.addValueChangeListener(this::listenerOnErrorThresoldOptionChange);
return errorThresoldOptions;
}
示例4: buildOptionGroup
import com.vaadin.ui.OptionGroup; //导入方法依赖的package包/类
protected OptionGroup buildOptionGroup(String caption, String name, List<Component> components) {
OptionGroup optionGroup = new OptionGroup(caption);
optionGroup.addStyleName(ValoTheme.OPTIONGROUP_HORIZONTAL);
optionGroup.setImmediate(true);
optionGroup.addItem("ON");
optionGroup.addItem("OFF");
optionGroup.addValueChangeListener((event) -> saveSetting(name, optionGroup, components));
return optionGroup;
}
示例5: buildProjectsAndVersions
import com.vaadin.ui.OptionGroup; //导入方法依赖的package包/类
protected Panel buildProjectsAndVersions(String releasePackageId) {
Panel projectsAndVersionsPanel = new Panel("Projects and Branches");
projectsAndVersionsPanel.addStyleName(ValoTheme.PANEL_SCROLL_INDICATOR);
projectsAndVersionsPanel.setSizeFull();
VerticalLayout projectLayout = new VerticalLayout();
projectLayout.setMargin(true);
projectCheckboxes.clear();
projectVersionOptionGroups.clear();
List<Project> projects = configurationService.findProjects();
for (Project project : projects) {
//first allow the user to select or unselect a project
CheckBox checkBox = new CheckBox(project.getName());
checkBox.setData(project.getId());
if (releasePackage.isReleased()) {
checkBox.setEnabled(false);
}
projectLayout.addComponent(checkBox);
//now put the project version options for each project
OptionGroup optionGroup = new OptionGroup();
optionGroup.addStyleName("indent");
List<Rppv> rppvs = configurationService.findReleasePackageProjectVersions(releasePackageId);
Set<String> projectVersionsInReleasePackage = getListOfProjectVersionsInReleasePackages(rppvs);
for (ProjectVersion projectVersion : project.getProjectVersions()) {
optionGroup.addStyleName(ValoTheme.OPTIONGROUP_SMALL);
optionGroup.addItem(projectVersion.getId());
optionGroup.setEnabled(false);
optionGroup.setItemCaption(projectVersion.getId(),projectVersion.getName());
if (projectVersionsInReleasePackage.contains(projectVersion.getId())) {
checkBox.setValue(true);
optionGroup.select(projectVersion.getId());
if (!releasePackage.isReleased()) {
optionGroup.setEnabled(true);
}
}
projectVersionOptionGroups.put(project.getId(), optionGroup);
projectLayout.addComponent(optionGroup);
}
projectCheckboxes.add(checkBox);
checkBox.addValueChangeListener(e -> projectSelectionListener(e));
}
projectsAndVersionsPanel.setContent(projectLayout);
return projectsAndVersionsPanel;
}
示例6: DeployDialog
import com.vaadin.ui.OptionGroup; //导入方法依赖的package包/类
public DeployDialog(ApplicationContext context, EditAgentPanel parentPanel) {
super("Deploy");
this.context = context;
this.configurationService = context.getConfigurationService();
this.operationsService = context.getOperationsSerivce();
this.parentPanel = parentPanel;
this.context = context;
final float DESIRED_WIDTH = 1000;
float width = DESIRED_WIDTH;
float maxWidth = (float) (Page.getCurrent().getBrowserWindowWidth() * .8);
if (maxWidth < DESIRED_WIDTH) {
width = maxWidth;
}
setWidth(width, Unit.PIXELS);
setHeight(600.0f, Unit.PIXELS);
VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
layout.setSizeFull();
addComponent(layout, 1);
deployByOptionGroup = new OptionGroup("Deployment Type:");
deployByOptionGroup.addStyleName(ValoTheme.OPTIONGROUP_HORIZONTAL);
deployByOptionGroup.addItem(DEPLOY_BY_PACKAGE);
deployByOptionGroup.addItem(DEPLOY_BY_FLOW);
layout.addComponent(deployByOptionGroup);
selectDeploymentLayout = new VerticalLayout();
selectDeploymentLayout.setSizeFull();
selectDeploymentLayout.setMargin(new MarginInfo(true, false));
layout.addComponent(selectDeploymentLayout);
layout.setExpandRatio(selectDeploymentLayout, 1);
backButton = new Button("Cancel", e -> back());
actionButton = new Button("Deploy", e -> takeAction());
actionButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
actionButton.setClickShortcut(KeyCode.ENTER);
addComponent(buildButtonFooter(backButton, actionButton));
deployByOptionGroup.addValueChangeListener(e -> deployByChanged());
deployByOptionGroup.setValue(DEPLOY_BY_PACKAGE);
}
示例7: ImportXmlTemplateWindow
import com.vaadin.ui.OptionGroup; //导入方法依赖的package包/类
public ImportXmlTemplateWindow(ImportXmlListener listener, Component component, ApplicationContext context) {
this.listener = listener;
this.component = component;
this.context = context;
setCaption("Import XML Template");
setWidth(600.0f, Unit.PIXELS);
setHeight(500.0f, Unit.PIXELS);
VerticalLayout layout = new VerticalLayout();
layout.setSizeFull();
layout.setSpacing(true);
layout.setMargin(true);
layout.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
layout.addComponent(new Label("Import XML from either an XSD or WSDL source."));
optionGroup = new OptionGroup("Select the location of the XSD or WSDL.");
optionGroup.addItem(OPTION_TEXT);
optionGroup.addItem(OPTION_FILE);
optionGroup.addItem(OPTION_URL);
optionGroup.addItem(OPTION_RESOURCE);
optionGroup.setNullSelectionAllowed(false);
optionGroup.setImmediate(true);
optionGroup.select(OPTION_TEXT);
optionGroup.addValueChangeListener(this);
layout.addComponent(optionGroup);
optionLayout = new VerticalLayout();
optionLayout.setSizeFull();
editor = new AceEditor();
editor.setCaption("Enter the XML text:");
editor.setMode(AceMode.xml);
editor.setSizeFull();
editor.setHighlightActiveLine(true);
editor.setShowPrintMargin(false);
Button importButton = new Button("Import");
importButton.addClickListener(this);
upload = new Upload(null, this);
upload.addSucceededListener(this);
upload.setButtonCaption(null);
urlTextField = new TextField("Enter the URL:");
urlTextField.setWidth(100.0f, Unit.PERCENTAGE);
resourceComboBox = createResourceCB();
layout.addComponent(optionLayout);
layout.setExpandRatio(optionLayout, 1.0f);
rebuildOptionLayout();
addComponent(layout, 1);
addComponent(buildButtonFooter(importButton, buildCloseButton()));
}
示例8: UserWardView
import com.vaadin.ui.OptionGroup; //导入方法依赖的package包/类
public UserWardView() {
setClosable(true);
setModal(true);
setCaption(MessageResources.getString("changeWard"));
final Employee user = getEnvironment().getCurrentEmployee();
VerticalLayout layout = new VerticalLayout();
final OptionGroup wardGroup = new OptionGroup();
List<Ward> wards = wardProvider.getAllItems();
for (Ward ward : wards) {
wardGroup.addItem(ward.getId());
wardGroup.setItemCaption(ward.getId(), ward.getCharacterisation());
}
wardGroup.addItem(-1);
wardGroup.setItemCaption(-1, MessageResources.getString("allPatients"));
wardGroup.select(user.getCurrentWard().getId());
Button changeWardButton = new Button(MessageResources.getString("changeWard"));
changeWardButton.addClickListener(new ClickListener(){
@Override
public void buttonClick(ClickEvent event) {
Ward newWard;
if ((int)wardGroup.getValue() == -1)
newWard = null;
else
newWard = wardProvider.getByID(wardGroup.getValue());
if (newWard != null) {
user.setCurrentWard(newWard);
employeeProvider.update(user);
fireWardChangeEvent(newWard);
}
else
fireWardChangeEvent();
UserWardView.this.close();
}
});
layout.addComponent(wardGroup);
layout.addComponent(changeWardButton);
setContent(layout);
}
示例9: attach
import com.vaadin.ui.OptionGroup; //导入方法依赖的package包/类
@Override
public void attach() {
setHeight(TAB_HEIGHT);
setMargin(false, true, false, true);
setSpacing(false);
// IPアドレス設定
ipOptionGroup = new OptionGroup(ViewProperties.getCaption("field.optionIp"));
ipOptionGroup.setNullSelectionAllowed(false);
ipOptionGroup.setImmediate(true);
ipOptionGroup.addContainerProperty(IP_OPTION_CAPTION_ID, String.class, null);
ipOptionGroup.setItemCaptionPropertyId(IP_OPTION_CAPTION_ID);
ipOptionGroup.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY);
Item ipOptionItem = ipOptionGroup.addItem(IP_OPTION_DHCP);
ipOptionItem.getItemProperty(IP_OPTION_CAPTION_ID).setValue(ViewProperties.getCaption("field.dhcpIp"));
Item ipOptionItem2 = ipOptionGroup.addItem(IP_OPTION_STATIC);
ipOptionItem2.getItemProperty(IP_OPTION_CAPTION_ID).setValue(ViewProperties.getCaption("field.staticIp"));
ipOptionGroup.addListener(new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
String value = (String) event.getProperty().getValue();
if (IP_OPTION_DHCP.equals(value)) {
ipAddressField.setEnabled(false);
subnetMaskField.setEnabled(false);
defaultGatewayField.setEnabled(false);
} else {
ipAddressField.setEnabled(true);
subnetMaskField.setEnabled(true);
defaultGatewayField.setEnabled(true);
}
}
});
form.getLayout().addComponent(ipOptionGroup);
// IPアドレス
ipAddressField = new TextField(ViewProperties.getCaption("field.ipAddress"));
ipAddressField.setWidth("100%");
form.getLayout().addComponent(ipAddressField);
// サブネットマスク
subnetMaskField = new TextField(ViewProperties.getCaption("field.subnetMask"));
subnetMaskField.setWidth("100%");
form.getLayout().addComponent(subnetMaskField);
// デフォルトゲートウェイ
defaultGatewayField = new TextField(ViewProperties.getCaption("field.defaultGateway"));
defaultGatewayField.setWidth("100%");
form.getLayout().addComponent(defaultGatewayField);
addComponent(form);
}
示例10: ProjectNotificationSettingViewComponent
import com.vaadin.ui.OptionGroup; //导入方法依赖的package包/类
public ProjectNotificationSettingViewComponent(final ProjectNotificationSetting bean) {
super(UserUIContext.getMessage(ProjectSettingI18nEnum.VIEW_TITLE));
MVerticalLayout body = new MVerticalLayout().withMargin(new MarginInfo(true, false, false, false));
body.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
final OptionGroup optionGroup = new OptionGroup(null);
optionGroup.setItemCaptionMode(ItemCaptionMode.EXPLICIT);
optionGroup.addItem(NotificationType.Default.name());
optionGroup.setItemCaption(NotificationType.Default.name(), UserUIContext
.getMessage(ProjectSettingI18nEnum.OPT_DEFAULT_SETTING));
optionGroup.addItem(NotificationType.None.name());
optionGroup.setItemCaption(NotificationType.None.name(),
UserUIContext.getMessage(ProjectSettingI18nEnum.OPT_NONE_SETTING));
optionGroup.addItem(NotificationType.Minimal.name());
optionGroup.setItemCaption(NotificationType.Minimal.name(), UserUIContext
.getMessage(ProjectSettingI18nEnum.OPT_MINIMUM_SETTING));
optionGroup.addItem(NotificationType.Full.name());
optionGroup.setItemCaption(NotificationType.Full.name(), UserUIContext
.getMessage(ProjectSettingI18nEnum.OPT_MAXIMUM_SETTING));
optionGroup.setWidth("100%");
body.with(optionGroup);
String levelVal = bean.getLevel();
if (levelVal == null) {
optionGroup.select(NotificationType.Default.name());
} else {
optionGroup.select(levelVal);
}
MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> {
try {
bean.setLevel((String) optionGroup.getValue());
ProjectNotificationSettingService projectNotificationSettingService = AppContextUtil.getSpringBean(ProjectNotificationSettingService.class);
if (bean.getId() == null) {
projectNotificationSettingService.saveWithSession(bean, UserUIContext.getUsername());
} else {
projectNotificationSettingService.updateWithSession(bean, UserUIContext.getUsername());
}
NotificationUtil.showNotification(UserUIContext.getMessage(GenericI18Enum.OPT_CONGRATS),
UserUIContext.getMessage(ProjectSettingI18nEnum.DIALOG_UPDATE_SUCCESS));
} catch (Exception e) {
throw new MyCollabException(e);
}
}).withIcon(FontAwesome.SAVE).withStyleName(WebThemes.BUTTON_ACTION);
body.addComponent(saveBtn);
this.addComponent(body);
}
示例11: NotificationSettingWindow
import com.vaadin.ui.OptionGroup; //导入方法依赖的package包/类
public NotificationSettingWindow(SimpleProjectMember projectMember) {
super(UserUIContext.getMessage(ProjectCommonI18nEnum.ACTION_EDIT_NOTIFICATION));
withModal(true).withResizable(false).withWidth("600px").withCenter();
ProjectNotificationSettingService prjNotificationSettingService = AppContextUtil.getSpringBean(ProjectNotificationSettingService.class);
ProjectNotificationSetting notification = prjNotificationSettingService.findNotification(projectMember.getUsername(), projectMember.getProjectid(),
projectMember.getSaccountid());
MVerticalLayout body = new MVerticalLayout();
final OptionGroup optionGroup = new OptionGroup(null);
optionGroup.setItemCaptionMode(AbstractSelect.ItemCaptionMode.EXPLICIT);
optionGroup.addItem(NotificationType.Default.name());
optionGroup.setItemCaption(NotificationType.Default.name(), UserUIContext
.getMessage(ProjectSettingI18nEnum.OPT_DEFAULT_SETTING));
optionGroup.addItem(NotificationType.None.name());
optionGroup.setItemCaption(NotificationType.None.name(),
UserUIContext.getMessage(ProjectSettingI18nEnum.OPT_NONE_SETTING));
optionGroup.addItem(NotificationType.Minimal.name());
optionGroup.setItemCaption(NotificationType.Minimal.name(), UserUIContext
.getMessage(ProjectSettingI18nEnum.OPT_MINIMUM_SETTING));
optionGroup.addItem(NotificationType.Full.name());
optionGroup.setItemCaption(NotificationType.Full.name(), UserUIContext
.getMessage(ProjectSettingI18nEnum.OPT_MAXIMUM_SETTING));
optionGroup.setWidth("100%");
body.with(optionGroup).withAlign(optionGroup, Alignment.MIDDLE_LEFT);
String levelVal = notification.getLevel();
if (levelVal == null) {
optionGroup.select(NotificationType.Default.name());
} else {
optionGroup.select(levelVal);
}
MButton closeBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CLOSE), clickEvent -> close())
.withStyleName(WebThemes.BUTTON_OPTION);
MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> {
try {
notification.setLevel((String) optionGroup.getValue());
ProjectNotificationSettingService projectNotificationSettingService = AppContextUtil.getSpringBean(ProjectNotificationSettingService.class);
if (notification.getId() == null) {
projectNotificationSettingService.saveWithSession(notification, UserUIContext.getUsername());
} else {
projectNotificationSettingService.updateWithSession(notification, UserUIContext.getUsername());
}
NotificationUtil.showNotification(UserUIContext.getMessage(GenericI18Enum.OPT_CONGRATS),
UserUIContext.getMessage(ProjectSettingI18nEnum.DIALOG_UPDATE_SUCCESS));
close();
} catch (Exception e) {
throw new MyCollabException(e);
}
}).withStyleName(WebThemes.BUTTON_ACTION).withIcon(FontAwesome.SAVE);
MHorizontalLayout btnControls = new MHorizontalLayout(closeBtn, saveBtn);
body.with(btnControls).withAlign(btnControls, Alignment.TOP_RIGHT);
withContent(body);
}
示例12: showNotificationSettings
import com.vaadin.ui.OptionGroup; //导入方法依赖的package包/类
@Override
public void showNotificationSettings(final CrmNotificationSetting notification) {
this.removeAllComponents();
MVerticalLayout bodyWrapper = new MVerticalLayout();
bodyWrapper.setSizeFull();
MVerticalLayout body = new MVerticalLayout().withMargin(new MarginInfo(true, false, false, false));
final OptionGroup optionGroup = new OptionGroup(null);
optionGroup.setItemCaptionMode(ItemCaptionMode.EXPLICIT);
optionGroup.addItem(NotificationType.Default.name());
optionGroup.setItemCaption(NotificationType.Default.name(),
UserUIContext.getMessage(ProjectSettingI18nEnum.OPT_DEFAULT_SETTING));
optionGroup.addItem(NotificationType.None.name());
optionGroup.setItemCaption(NotificationType.None.name(), UserUIContext
.getMessage(ProjectSettingI18nEnum.OPT_NONE_SETTING));
optionGroup.addItem(NotificationType.Minimal.name());
optionGroup.setItemCaption(NotificationType.Minimal.name(),
UserUIContext.getMessage(ProjectSettingI18nEnum.OPT_MINIMUM_SETTING));
optionGroup.addItem(NotificationType.Full.name());
optionGroup.setItemCaption(NotificationType.Full.name(), UserUIContext
.getMessage(ProjectSettingI18nEnum.OPT_MAXIMUM_SETTING));
optionGroup.setHeight("100%");
body.with(optionGroup).withAlign(optionGroup, Alignment.MIDDLE_LEFT).expand(optionGroup);
String levelVal = notification.getLevel();
if (levelVal == null) {
optionGroup.select(NotificationType.Default.name());
} else {
optionGroup.select(levelVal);
}
Button updateBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_UPDATE_LABEL), clickEvent -> {
try {
notification.setLevel((String) optionGroup.getValue());
CrmNotificationSettingService crmNotificationSettingService = AppContextUtil
.getSpringBean(CrmNotificationSettingService.class);
if (notification.getId() == null) {
crmNotificationSettingService.saveWithSession(notification, UserUIContext.getUsername());
} else {
crmNotificationSettingService.updateWithSession(notification, UserUIContext.getUsername());
}
NotificationUtil.showNotification(UserUIContext.getMessage(GenericI18Enum.OPT_CONGRATS),
UserUIContext.getMessage(ProjectSettingI18nEnum.DIALOG_UPDATE_SUCCESS));
} catch (Exception e) {
throw new MyCollabException(e);
}
}).withIcon(FontAwesome.REFRESH).withStyleName(WebThemes.BUTTON_ACTION);
body.with(updateBtn).withAlign(updateBtn, Alignment.BOTTOM_LEFT);
bodyWrapper.addComponent(body);
this.addComponent(bodyWrapper);
}