本文整理汇总了Java中com.vaadin.ui.OptionGroup.select方法的典型用法代码示例。如果您正苦于以下问题:Java OptionGroup.select方法的具体用法?Java OptionGroup.select怎么用?Java OptionGroup.select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.ui.OptionGroup
的用法示例。
在下文中一共展示了OptionGroup.select方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SystemDefChoiceField
import com.vaadin.ui.OptionGroup; //导入方法依赖的package包/类
/**
* Instantiates a new system definition choice field.
*/
public SystemDefChoiceField() {
oidType = new OptionGroup("OID Type", OPTIONS);
oidType.setNullSelectionAllowed(false);
oidType.select("Single");
oidValue = new TextField("OID Value");
oidValue.setWidth("100%");
oidValue.setNullSettingAllowed(false);
oidValue.setRequired(true);
oidValue.setImmediate(true);
oidValue.addValidator(new RegexpValidator("^\\.[.\\d]+$", "Invalid OID {0}"));
HorizontalLayout layout = new HorizontalLayout();
layout.setSpacing(true);
layout.setWidth("100%");
layout.addComponent(oidType);
layout.addComponent(oidValue);
layout.setExpandRatio(oidValue, 1);
setWriteThrough(false);
setCompositionRoot(layout);
}
示例2: assignOptionGroupByValues
import com.vaadin.ui.OptionGroup; //导入方法依赖的package包/类
private void assignOptionGroupByValues(final List<String> tagOptions) {
assignOptiongroup = new OptionGroup("", tagOptions);
assignOptiongroup.setStyleName(ValoTheme.OPTIONGROUP_SMALL);
assignOptiongroup.addStyleName("custom-option-group");
assignOptiongroup.setNullSelectionAllowed(false);
assignOptiongroup.setId(SPUIDefinitions.ASSIGN_OPTION_GROUP_SOFTWARE_MODULE_TYPE_ID);
assignOptiongroup.select(tagOptions.get(0));
}
示例3: projectSelectionListener
import com.vaadin.ui.OptionGroup; //导入方法依赖的package包/类
protected void projectSelectionListener(ValueChangeEvent event) {
CheckBox checkbox = (CheckBox) event.getProperty();
String projectId = (String) checkbox.getData();
OptionGroup optionGroup = projectVersionOptionGroups.get(projectId);
if (checkbox.getValue() == false) {
optionGroup.clear();
optionGroup.setEnabled(false);
} else {
@SuppressWarnings("unchecked")
Collection<String> projectVersionIds = (Collection<String>) optionGroup.getItemIds();
Iterator<String> itr = projectVersionIds.iterator();
optionGroup.select(itr.next());
optionGroup.setEnabled(true);
}
}
示例4: 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;
}
示例5: 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()));
}
示例6: 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);
}
示例7: 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);
}
示例8: 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);
}
示例9: 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);
}