本文整理匯總了Java中com.vaadin.data.util.BeanItemContainer類的典型用法代碼示例。如果您正苦於以下問題:Java BeanItemContainer類的具體用法?Java BeanItemContainer怎麽用?Java BeanItemContainer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
BeanItemContainer類屬於com.vaadin.data.util包,在下文中一共展示了BeanItemContainer類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getManufacturingFilterListener
import com.vaadin.data.util.BeanItemContainer; //導入依賴的package包/類
/**
* Returns the TextChangeListener that gets triggered
*
* @return
*/
private TextChangeListener getManufacturingFilterListener() {
return new TextChangeListener() {
/**
*
*/
private static final long serialVersionUID = -2368474286053602744L;
@Override
public void textChange(TextChangeEvent event) {
String newValue = (String) event.getText();
@SuppressWarnings("unchecked")
BeanItemContainer<VehicleInfo> container = ((BeanItemContainer<VehicleInfo>) grid
.getContainerDataSource());
// This is important, this removes the previous filter that was
// used to filter the container
container.removeContainerFilters(MANUFACTURER);
if (null != newValue && !newValue.isEmpty()) {
container.addContainerFilter(new SimpleStringFilter(
MANUFACTURER, newValue, true, false));
}
grid.recalculateColumnWidths();
}
};
}
示例2: ReleasesView
import com.vaadin.data.util.BeanItemContainer; //導入依賴的package包/類
public ReleasesView() {
setSizeFull();
setMargin(false);
ButtonBar buttonBar = new ButtonBar();
addButton = buttonBar.addButton("Add", FontAwesome.PLUS, e -> add());
editButton = buttonBar.addButton("Edit", FontAwesome.EDIT, e -> edit());
exportButton = buttonBar.addButton("Export", FontAwesome.DOWNLOAD, e -> export());
archiveButton = buttonBar.addButton("Archive", FontAwesome.ARCHIVE, e -> archive());
// TODO add support for the archive button
archiveButton.setVisible(false);
finalizeButton = buttonBar.addButton("Finalize", FontAwesome.CUBE, e -> finalize());
addComponent(buttonBar);
enableDisableButtonsForSelectionSize(0);
grid = new Grid();
grid.setSizeFull();
grid.setSelectionMode(SelectionMode.MULTI);
grid.addItemClickListener(e->rowClicked(e));
grid.addSelectionListener((e) -> rowSelected(e));
container = new BeanItemContainer<>(ReleasePackage.class);
grid.setContainerDataSource(container);
grid.setColumns("name", "versionLabel", "releaseDate", "released");
grid.sort("releaseDate", SortDirection.DESCENDING);
addComponent(grid);
setExpandRatio(grid, 1);
progressBar = new ProgressBar(0.0f);
}
示例3: configureComponents
import com.vaadin.data.util.BeanItemContainer; //導入依賴的package包/類
private void configureComponents() {
/* Synchronous event handling.
*
* Receive user interaction events on the server-side. This allows you
* to synchronously handle those events. Vaadin automatically sends
* only the needed changes to the web page without loading a new page.
*/
newContact.addClickListener(e -> contactForm.edit(new User()));
filter.setInputPrompt("Filter contacts...");
filter.addTextChangeListener(e -> refreshContacts(e.getText()));
contactList.setContainerDataSource(new BeanItemContainer<>(User.class));
contactList.setColumnOrder("id", "firstName", "lastName", "email");
contactList.removeColumn("birthDate");
contactList.setSelectionMode(Grid.SelectionMode.SINGLE);
contactList.addSelectionListener(e
-> contactForm.edit((User) contactList.getSelectedRow()));
refreshContacts();
}
示例4: getTable
import com.vaadin.data.util.BeanItemContainer; //導入依賴的package包/類
/**
* @param container
* @param size
* @return une table pour formatter les données
*/
private TableFormating getTable(BeanItemContainer<SimpleTablePresentation> container, Integer size){
TableFormating table = new TableFormating(null, container);
table.addBooleanColumn(SimpleTablePresentation.CHAMPS_VALUE,false);
table.setVisibleColumns((Object[]) FIELDS_ORDER);
table.setColumnCollapsingAllowed(false);
table.setColumnReorderingAllowed(false);
table.setColumnHeaderMode(ColumnHeaderMode.HIDDEN);
table.setSelectable(false);
table.setImmediate(true);
table.setPageLength(size);
table.setWidth(100, Unit.PERCENTAGE);
table.setColumnWidth(SimpleTablePresentation.CHAMPS_TITLE, 300);
table.setCellStyleGenerator((components, itemId, columnId)->{
if (columnId!=null && columnId.equals(SimpleTablePresentation.CHAMPS_TITLE)){
return (ValoTheme.LABEL_BOLD);
}
return null;
});
return table;
}
示例5: generateComboBox
import com.vaadin.data.util.BeanItemContainer; //導入依賴的package包/類
/**
* @param liste
* @param libNull
* @return une combo grace a la liste
*/
private ComboBox generateComboBox(final List<String> liste, final String libNull) {
ComboBox sampleIdCB = new ComboBox();
sampleIdCB.setPageLength(20);
sampleIdCB.setTextInputAllowed(false);
BeanItemContainer<String> dataList = new BeanItemContainer<>(String.class);
dataList.addBean(applicationContext.getMessage("filter.all", null, UI.getCurrent().getLocale()));
if (libNull != null) {
dataList.addBean(libNull);
}
dataList.addAll(liste);
sampleIdCB
.setNullSelectionItemId(applicationContext.getMessage("filter.all", null, UI.getCurrent().getLocale()));
sampleIdCB.setContainerDataSource(dataList);
sampleIdCB.setImmediate(true);
return sampleIdCB;
}
示例6: GridFormatting
import com.vaadin.data.util.BeanItemContainer; //導入依賴的package包/類
/**
* Constructeur
*/
public GridFormatting(Class<T> clazz) {
super();
setSizeFull();
setImmediate(true);
setResponsive(true);
setColumnReorderingAllowed(true);
addStyleName(StyleConstants.GRID_POINTER);
setSelectionMode(SelectionMode.SINGLE);
container = new BeanItemContainer<T>(clazz);
setContainerDataSource(container);
addSortListener(e -> {
if (e.getSortOrder().size() > 0) {
listSortOrder.clear();
listSortOrder.addAll(e.getSortOrder());
}
});
}
示例7: populateNetworks
import com.vaadin.data.util.BeanItemContainer; //導入依賴的package包/類
private void populateNetworks(ComboBox networkComboBox, List<OsNetworkDto> networkList) {
try {
networkComboBox.removeAllItems();
if (networkList != null) {
// Calling List Network Service
BeanItemContainer<OsNetworkDto> networkListContainer = new BeanItemContainer<>(OsNetworkDto.class,
networkList);
networkComboBox.setContainerDataSource(networkListContainer);
networkComboBox.setItemCaptionPropertyId("name");
if (networkList.size() > 0) {
networkComboBox.select(networkListContainer.getIdByIndex(0));
}
}
} catch (Exception e) {
ViewUtil.iscNotification(e.getMessage(), Notification.Type.ERROR_MESSAGE);
log.error("Error getting Network List", e);
}
}
示例8: populateProjects
import com.vaadin.data.util.BeanItemContainer; //導入依賴的package包/類
private void populateProjects(boolean autoSelect) {
try {
// Calling List Service
BaseIdRequest req = new BaseIdRequest();
req.setId(this.vsId);
List<OsProjectDto> projectList = this.listProjectService.dispatch(req).getList();
this.project.removeValueChangeListener(this.projectChangedListener);
this.project.removeAllItems();
BeanItemContainer<OsProjectDto> projectListContainer = new BeanItemContainer<>(OsProjectDto.class, projectList);
this.project.setContainerDataSource(projectListContainer);
this.project.setItemCaptionPropertyId("name");
this.project.addValueChangeListener(this.projectChangedListener);
if (autoSelect && projectListContainer.size() > 0) {
this.project.select(projectListContainer.getIdByIndex(0));
}
} catch (Exception e) {
ViewUtil.iscNotification(e.getMessage(), Notification.Type.ERROR_MESSAGE);
log.error("Error getting project List", e);
}
}
示例9: populatePolicy
import com.vaadin.data.util.BeanItemContainer; //導入依賴的package包/類
private void populatePolicy() {
try {
// Calling List Service
BaseIdRequest req = new BaseIdRequest();
req.setId(this.vsId);
List<PolicyDto> vsPolicyDto = this.listVirtualSystemPolicyService.dispatch(req).getList();
BeanItemContainer<PolicyDto> vsPolicyListContainer = new BeanItemContainer<PolicyDto>(PolicyDto.class,
vsPolicyDto);
this.policy.setContainerDataSource(vsPolicyListContainer);
this.policy.setItemCaptionPropertyId("policyName");
if (vsPolicyListContainer.size() > 0) {
this.policy.select(vsPolicyListContainer.getIdByIndex(0));
}
} catch (Exception e) {
ViewUtil.iscNotification(e.getMessage(), Notification.Type.ERROR_MESSAGE);
log.error("Error getting Virtual System Policy List", e);
}
}
示例10: getPolicyComboBox
import com.vaadin.data.util.BeanItemContainer; //導入依賴的package包/類
private ComboBox getPolicyComboBox(List<PolicyDto> policyDtoList) {
ComboBox policy = new ComboBox("Select Policy");
policy.setTextInputAllowed(false);
policy.setNullSelectionAllowed(false);
policy.setImmediate(true);
policy.setRequired(true);
policy.setRequiredError("Policy cannot be empty");
BeanItemContainer<PolicyDto> policyListContainer = new BeanItemContainer<>(PolicyDto.class,
policyDtoList);
policy.setContainerDataSource(policyListContainer);
policy.setItemCaptionPropertyId("policyName");
if (policyListContainer.size() > 0) {
policy.select(policyListContainer.getIdByIndex(0));
}
policy.setEnabled(false);
return policy;
}
示例11: createDomainComboBox
import com.vaadin.data.util.BeanItemContainer; //導入依賴的package包/類
private ComboBox createDomainComboBox(List<DomainDto> dl) {
ComboBox domainComboBox = new ComboBox();
BeanItemContainer<DomainDto> domainContainer = new BeanItemContainer<DomainDto>(DomainDto.class, dl);
ApplianceManagerConnectorDto mc = (ApplianceManagerConnectorDto) this.managerConnector.getValue();
domainComboBox.setContainerDataSource(domainContainer);
domainComboBox.setTextInputAllowed(false);
domainComboBox.setNullSelectionAllowed(false);
domainComboBox.setItemCaptionPropertyId("name");
domainComboBox.setEnabled(mc.isPolicyMappingSupported());
if (domainComboBox.getItemIds().size() > 0) {
domainComboBox.select(domainContainer.getIdByIndex(0));
}
return domainComboBox;
}
示例12: createEncapsulationTypeComboBox
import com.vaadin.data.util.BeanItemContainer; //導入依賴的package包/類
private ComboBox createEncapsulationTypeComboBox(VirtualizationType virtualizationType,
List<TagEncapsulationType> types) {
ComboBox encapsulationType = new ComboBox();
encapsulationType.setTextInputAllowed(false);
encapsulationType.setNullSelectionAllowed(true);
BeanItemContainer<TagEncapsulationType> encapsulationTypeContainer = new BeanItemContainer<TagEncapsulationType>(
TagEncapsulationType.class, types);
encapsulationType.setContainerDataSource(encapsulationTypeContainer);
ApplianceManagerConnectorDto currentMc = (ApplianceManagerConnectorDto) this.managerConnector.getValue();
if (!virtualizationType.isOpenstack() || (currentMc != null && !currentMc.isPolicyMappingSupported())) {
encapsulationType.setEnabled(false);
}
return encapsulationType;
}
示例13: setContainerDataSource
import com.vaadin.data.util.BeanItemContainer; //導入依賴的package包/類
public final void setContainerDataSource(final BeanItemContainer<BT> containerNew)
{
if (Objects.equal(this.container, containerNew))
{
return;
}
if (this.container != null)
{
this.container.removeItemSetChangeListener(listener);
}
this.container = containerNew;
if (this.container != null)
{
this.container.addItemSetChangeListener(listener);
}
updateAll();
}
示例14: listEntities
import com.vaadin.data.util.BeanItemContainer; //導入依賴的package包/類
private void listEntities(String filter) {
listeners.forEach(listener -> {
BeanItemContainer<T> items = listener.listEntities(filter);
GeneratedPropertyContainer gpc = new GeneratedPropertyContainer(items);
gpc.addGeneratedProperty(EDIT_PROPERTY_ID, new PropertyValueGenerator<String>() {
@Override
public String getValue(Item item, Object itemId, Object propertyId) {
return messages.get("editButtonLabel");
}
@Override
public Class<String> getType() {
return String.class;
}
});
grid.setContainerDataSource(gpc);
});
}
示例15: setSearchResult
import com.vaadin.data.util.BeanItemContainer; //導入依賴的package包/類
@Override
public void setSearchResult(List<NeuralNetMetaData> neuralNetMetaDatas) {
BeanItemContainer<NeuralNetMetaData> resultAsContainer = new BeanItemContainer<>(NeuralNetMetaData.class, neuralNetMetaDatas);
searchResultTable = new Table();
searchResultTable.setContainerDataSource(resultAsContainer);
searchResultTable.setVisibleColumns("name");
searchResultTable.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN);
searchResultTable.setSelectable(true);
searchResultTable.setImmediate(true);
searchResultTable.setSizeFull();
searchResultTable.addStyleName(ValoTheme.TABLE_BORDERLESS);
searchResultTable.addValueChangeListener(e -> presenter.handleSelection((NeuralNetMetaData) searchResultTable.getValue()));
searchResultPanel.setContent(searchResultTable);
}