本文整理匯總了Java中com.vaadin.v7.data.util.BeanItem類的典型用法代碼示例。如果您正苦於以下問題:Java BeanItem類的具體用法?Java BeanItem怎麽用?Java BeanItem使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
BeanItem類屬於com.vaadin.v7.data.util包,在下文中一共展示了BeanItem類的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: init
import com.vaadin.v7.data.util.BeanItem; //導入依賴的package包/類
@PostConstruct
public void init() {
addComponent(btnShowOpen);
addComponent(btnShowAll);
btnShowOpen.addClickListener((Button.ClickListener) clickEvent -> showOpenClicked());
btnShowAll.addClickListener((Button.ClickListener) clickEvent -> showAllClicked());
sessionTable.addItemClickListener((ItemClickEvent.ItemClickListener) itemClickEvent -> {
BeanItem b = (BeanItem)itemClickEvent.getItem();
sessionClicked((Session)b.getBean());
});
addComponent(sessionTable);
sessionTable.setWidth("90%");
sessionTable.setNullSelectionAllowed(false);
sessionTable.setImmediate(true);
sessionTable.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY);
sessionTable.addGeneratedColumn("manage", new CloseButtonColumnGenerator());
handler.showOpenTillSessionList(this);
}
示例2: show
import com.vaadin.v7.data.util.BeanItem; //導入依賴的package包/類
public void show(Attendee attendee) {
attendeeBean = new BeanItem<>(attendee);
fieldGroup.setItemDataSource(attendeeBean);
if (attendee.getPaidAmount() == null) {
try {
paidAmount.setValue(attendee.getBadge().getCostForAge(attendee.getAge()).toString());
} catch(ServiceException e) {
Notification.show(e.getMessage());
}
}
badge.select(attendee.getBadge());
setMinorFieldsEnabled(attendee.isMinor());
checkedIn.setVisible(attendee.getCheckedIn()); // Hide checked in checkbox if attendee is not checked in
parentFormReceived.setVisible(attendee.getCheckedIn()); // Hide parentFormReceived if attendee is not checked in
badgeNumber.setEnabled(false);
showHistory(attendee.getHistory());
firstName.focus();
}
示例3: createPremiumCheckbox
import com.vaadin.v7.data.util.BeanItem; //導入依賴的package包/類
public static Component createPremiumCheckbox(ComponentGridDecorator componentGridDecorator, Customer
customer) {
CheckBox premium = new CheckBox();
premium.setImmediate(true);
premium.setWidth(19, Sizeable.Unit.PIXELS);
premium.setHeight(19, Sizeable.Unit.PIXELS);
premium.setDescription("Premium Customer?");
Property property = new BeanItem<>(customer).getItemProperty(Customer.PREMIUM);
premium.setPropertyDataSource(property);
premium.addValueChangeListener(e -> {
Notification.show(String.valueOf(customer.getPremium()));
componentGridDecorator.refresh();
});
return premium;
}
示例4: createClassicFoodSelector
import com.vaadin.v7.data.util.BeanItem; //導入依賴的package包/類
public static Component createClassicFoodSelector(Grid grid, FocusPreserveExtension focusPreserveExtension, Customer
customer) {
ComboBox select = new ComboBox();
select.setWidth(200, Sizeable.Unit.PIXELS);
select.setHeight(ROW_HEIGHT, Sizeable.Unit.PIXELS);
select.addItems(Customer.Food.FISH, Customer.Food.HAMBURGER, Customer.Food.VEGETABLES);
select.setPropertyDataSource(new BeanItem<>(customer).getItemProperty(Customer.FOOD));
select.addValueChangeListener(e -> {
if (grid instanceof ComponentGrid) {
((ComponentGrid) grid).refresh();
} else {
// a hack to force rerendering of the grid
focusPreserveExtension.saveFocus();
grid.setCellStyleGenerator(grid.getCellStyleGenerator());
focusPreserveExtension.restoreFocus();
}
});
return select;
}
示例5: NativeSelectInForm
import com.vaadin.v7.data.util.BeanItem; //導入依賴的package包/類
public NativeSelectInForm() {
setDescription("NativeSelect in forms should work fine on Android");
BeanItem<Bean> bi = new BeanItem<Bean>(new Bean());
Form form = new Form();
form.setCaption("Old deprecated form");
form.setFormFieldFactory(new FormFieldFactory() {
@Override
public Field<?> createField(Item item, Object propertyId,
Component uiContext) {
return createNativeSelect();
}
});
form.setItemDataSource(bi);
form.setBuffered(false);
addComponent(form);
NativeSelect select = createNativeSelect();
FormLayout layout = new FormLayout();
layout.setCaption("New field group in a form layout");
layout.addComponent(select);
FieldGroup fg = new FieldGroup(bi);
fg.bind(select, "aString");
fg.setBuffered(false);
addComponent(layout);
}
示例6: RootView
import com.vaadin.v7.data.util.BeanItem; //導入依賴的package包/類
public RootView() {
setCaption("Form test");
VerticalComponentGroup verticalComponentGroup = new VerticalComponentGroup();
myRoom = new MeetingRoom("Grand A", "Ballroom");
Label myLabel = new Label();
myLabel.setValue("Very important info.");
myLabel.setCaption("Title:");
verticalComponentGroup.addComponent(myLabel);
myForm = new MeetingRoomForm();
myForm.setItemDataSource(new BeanItem<MeetingRoom>(myRoom));
myForm.setBuffered(true);
// myForm.setWriteThrough(true);
myForm.setImmediate(true);
verticalComponentGroup.addComponent(myForm);
setContent(verticalComponentGroup);
}
示例7: getRole
import com.vaadin.v7.data.util.BeanItem; //導入依賴的package包/類
private Role getRole() {
BeanItem<Role> roleBean = roleBeanFieldGroup.getItemDataSource();
Role role = roleBean.getBean();
role.clearRights();
role.addRights((Set<Right>)rightsList.getValue());
return role;
}
示例8: createFoodSelector
import com.vaadin.v7.data.util.BeanItem; //導入依賴的package包/類
public static Component createFoodSelector(ComponentGridDecorator componentGridDecorator, Customer
customer) {
ComboBox select = new ComboBox();
select.setWidth(200, Sizeable.Unit.PIXELS);
select.setHeight(ROW_HEIGHT, Sizeable.Unit.PIXELS);
select.addItems(Customer.Food.FISH, Customer.Food.HAMBURGER, Customer.Food.VEGETABLES);
select.setPropertyDataSource(new BeanItem<>(customer).getItemProperty(Customer.FOOD));
select.addValueChangeListener(e -> {
componentGridDecorator.refresh();
});
return select;
}
示例9: getUser
import com.vaadin.v7.data.util.BeanItem; //導入依賴的package包/類
private User getUser() {
BeanItem<User> userBean = userBeanFieldGroup.getItemDataSource();
return userBean.getBean();
}
示例10: init
import com.vaadin.v7.data.util.BeanItem; //導入依賴的package包/類
@PostConstruct
public void init() {
FormLayout orderInfo = new FormLayout();
orderId.setWidth(400, Unit.PIXELS);
orderInfo.addComponent(orderId);
addComponent(orderInfo);
attendeeBeanList = new BeanItemContainer<>(Attendee.class, new ArrayList<>());
attendeeList.setContainerDataSource(attendeeBeanList);
attendeeList.setPageLength(5);
attendeeList.setWidth(600, Unit.PIXELS);
attendeeList.addStyleName("kumoHandPointer");
paymentBeanList = new BeanItemContainer<>(Payment.class, new ArrayList<>());
paymentList.setContainerDataSource(paymentBeanList);
paymentList.setWidth(500, Unit.PIXELS);
paymentList.addStyleName("kumoHandPointer");
paymentList.setPageLength(3);
paymentList.addItemClickListener((ItemClickEvent.ItemClickListener) itemClickEvent -> {
BeanItem b = (BeanItem)itemClickEvent.getItem();
showPaymentWindow((Payment)b.getBean());
});
orderInfo.addComponent(attendeeList);
attendeeList.addItemClickListener((ItemClickEvent.ItemClickListener) itemClickEvent ->
handler.selectAttendee(this, (Attendee)itemClickEvent.getItemId()));
orderInfo.addComponent(addAttendee);
orderInfo.addComponent(orderTotal);
orderInfo.addComponent(paymentTotal);
HorizontalLayout buttonLayout = new HorizontalLayout();
buttonLayout.setSpacing(true);
buttonLayout.addComponent(addPayment);
buttonLayout.addComponent(orderComplete);
buttonLayout.addComponent(cancel);
orderInfo.addComponent(buttonLayout);
orderInfo.addComponent(paymentList);
orderInfo.addComponent(notes);
notes.setSizeFull();
addAttendee.addClickListener((Button.ClickListener) clickEvent -> handler.addNewAttendee(this));
addPayment.addClickListener((Button.ClickListener) clickEvent -> showPaymentWindow());
orderComplete.addClickListener((Button.ClickListener) clickEvent -> handler.takeMoney(this));
cancel.addClickListener((Button.ClickListener) clickEvent -> showConfirmCancelWindow());
addAttendee.focus();
}
示例11: Html5InputExtensionTest
import com.vaadin.v7.data.util.BeanItem; //導入依賴的package包/類
public Html5InputExtensionTest() {
setDescription("Test TextField extension that controls various html5 stuff.");
final TextField textField = new TextField("Field");
addComponent(textField);
VerticalComponentGroup verticalComponentGroup = new VerticalComponentGroup(
"Html5 settings");
final Html5InputSettings html5InputSettings = new Html5InputSettings(
textField);
html5InputSettings.setPlaceholder("this is test field");
BeanItem<Html5InputSettings> beanItem = new BeanItem<Html5InputSettings>(
html5InputSettings);
final FieldGroup fieldGroup = new FieldGroup(beanItem);
verticalComponentGroup.addComponent(fieldGroup
.buildAndBind("autoComplete"));
verticalComponentGroup.addComponent(fieldGroup
.buildAndBind("autoCorrect"));
verticalComponentGroup.addComponent(fieldGroup
.buildAndBind("autoCapitalize"));
verticalComponentGroup.addComponent(fieldGroup
.buildAndBind("placeholder"));
verticalComponentGroup.addComponent(fieldGroup
.buildAndBind("min"));
verticalComponentGroup.addComponent(fieldGroup
.buildAndBind("max"));
verticalComponentGroup.addComponent(fieldGroup
.buildAndBind("step"));
final TextField any = new TextField();
any.setNullRepresentation("");
any.setCaption("Custom property");
any.setInputPrompt("key:value");
verticalComponentGroup.addComponent(any);
Button button = new Button();
button.setCaption("Apply");
button.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
try {
fieldGroup.commit();
String value = any.getValue();
if (value != null) {
String[] split = value.split(":");
html5InputSettings.setProperty(split[0], split[1]);
any.setValue(null);
}
} catch (CommitException e) {
e.printStackTrace();
}
}
});
verticalComponentGroup.addComponent(button);
addComponent(verticalComponentGroup);
}