本文整理汇总了Java中com.vaadin.ui.OptionGroup.setItemCaptionMode方法的典型用法代码示例。如果您正苦于以下问题:Java OptionGroup.setItemCaptionMode方法的具体用法?Java OptionGroup.setItemCaptionMode怎么用?Java OptionGroup.setItemCaptionMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.ui.OptionGroup
的用法示例。
在下文中一共展示了OptionGroup.setItemCaptionMode方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildPossibleTargetVersions
import com.vaadin.ui.OptionGroup; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
protected Panel buildPossibleTargetVersions(ProjectVersion targetProjectVersion) {
Panel possibleTargetVersionsPanel = new Panel("Available Target Versions");
possibleTargetVersionsPanel.addStyleName(ValoTheme.PANEL_SCROLL_INDICATOR);
possibleTargetVersionsPanel.setSizeFull();
IndexedContainer container = new IndexedContainer();
optionGroup = new OptionGroup("Project Version", container);
optionGroup.addStyleName(ValoTheme.OPTIONGROUP_SMALL);
optionGroup.setItemCaptionMode(ItemCaptionMode.PROPERTY);
optionGroup.setItemCaptionPropertyId("versionLabel");
optionGroup.addStyleName("indent");
List<ProjectVersion> projectVersions = configService.findProjectVersionsByProject(targetProjectVersion.getProject());
container.addContainerProperty("versionLabel", String.class, null);
for (ProjectVersion version : projectVersions) {
Item item = container.addItem(version.getId());
item.getItemProperty("versionLabel").setValue(version.getVersionLabel());
if (targetProjectVersion.getId().equalsIgnoreCase(version.getId())) {
optionGroup.setItemEnabled(version.getId(), false);
}
}
possibleTargetVersionsPanel.setContent(optionGroup);
return possibleTargetVersionsPanel;
}
示例2: 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);
}
示例3: 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);
}
示例4: 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);
}
示例5: 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);
}