本文整理匯總了Java中com.vaadin.data.util.BeanItemContainer.addItem方法的典型用法代碼示例。如果您正苦於以下問題:Java BeanItemContainer.addItem方法的具體用法?Java BeanItemContainer.addItem怎麽用?Java BeanItemContainer.addItem使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.vaadin.data.util.BeanItemContainer
的用法示例。
在下文中一共展示了BeanItemContainer.addItem方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: populateIdName
import com.vaadin.data.util.BeanItemContainer; //導入方法依賴的package包/類
/**
* Populate the AbstractSelect component with strings.<br>
* Creates new datasource.<br>
* Each entry is of type {@link IdName } .
*
* @param component
* the component
* @param s
* the comma separated string list or array of strings
*/
static public void populateIdName(AbstractSelect component, String... s) {
BeanItemContainer<IdName> bic = new BeanItemContainer<IdName>(
IdName.class);
int i = 0;
for (String sp : s)
bic.addItem(new IdName(i++, sp));
component.setContainerDataSource(bic);
component.setItemCaptionPropertyId("name");
}
示例2: CtrCandOdfCandidatureWindow
import com.vaadin.data.util.BeanItemContainer; //導入方法依賴的package包/類
/**
* Crée une fenêtre de choix pour le gestionnaire : proposition ou candidature simple
* @param message
*/
public CtrCandOdfCandidatureWindow(String message) {
/* Style */
setWidth(630, Unit.PIXELS);
setModal(true);
setResizable(false);
setClosable(false);
/* Layout */
VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
layout.setSpacing(true);
setContent(layout);
/* Titre */
setCaption(applicationContext.getMessage("candidature.gest.window", null, UI.getCurrent().getLocale()));
/* Texte */
layout.addComponent(new Label(message));
layout.addComponent(new Label(applicationContext.getMessage("candidature.gest.window.choice", null, UI.getCurrent().getLocale())));
/*Le container d'options*/
BeanItemContainer<SimpleTablePresentation> optContainer = new BeanItemContainer<SimpleTablePresentation>(SimpleTablePresentation.class);
SimpleTablePresentation optionClassique = new SimpleTablePresentation(ConstanteUtils.OPTION_CLASSIQUE,applicationContext.getMessage("candidature.gest.window.choice.classique", null, UI.getCurrent().getLocale()),null);
SimpleTablePresentation optionProposition = new SimpleTablePresentation(ConstanteUtils.OPTION_PROP,applicationContext.getMessage("candidature.gest.window.choice.proposition", null, UI.getCurrent().getLocale()),null);
optContainer.addItem(optionClassique);
optContainer.addItem(optionProposition);
optionGroupAction.setContainerDataSource(optContainer);
optionGroupAction.addStyleName(StyleConstants.OPTION_GROUP_HORIZONTAL);
optionGroupAction.setItemCaptionPropertyId(SimpleTablePresentation.CHAMPS_TITLE);
optionGroupAction.setItemCaptionMode(ItemCaptionMode.PROPERTY);
optionGroupAction.setValue(optionClassique);
layout.addComponent(optionGroupAction);
layout.setComponentAlignment(optionGroupAction, Alignment.MIDDLE_CENTER);
/* Boutons */
HorizontalLayout buttonsLayout = new HorizontalLayout();
buttonsLayout.setWidth(100, Unit.PERCENTAGE);
buttonsLayout.setSpacing(true);
layout.addComponent(buttonsLayout);
OneClickButton btnNon = new OneClickButton(applicationContext.getMessage("confirmWindow.btnNon", null, UI.getCurrent().getLocale()),FontAwesome.TIMES);
btnNon.addClickListener(e -> close());
buttonsLayout.addComponent(btnNon);
buttonsLayout.setComponentAlignment(btnNon, Alignment.MIDDLE_LEFT);
OneClickButton btnOui = new OneClickButton(applicationContext.getMessage("confirmWindow.btnOui", null, UI.getCurrent().getLocale()),FontAwesome.CHECK);
btnOui.setIcon(FontAwesome.CHECK);
btnOui.addStyleName(ValoTheme.BUTTON_PRIMARY);
btnOui.addClickListener(e -> {
SimpleTablePresentation option = (SimpleTablePresentation)optionGroupAction.getValue();
odfCandidatureListener.btnOkClick(option.getCode());
close();
});
buttonsLayout.addComponent(btnOui);
buttonsLayout.setComponentAlignment(btnOui, Alignment.MIDDLE_RIGHT);
/* Centre la fenêtre */
center();
}