本文整理汇总了Java中com.vaadin.data.util.GeneratedPropertyContainer类的典型用法代码示例。如果您正苦于以下问题:Java GeneratedPropertyContainer类的具体用法?Java GeneratedPropertyContainer怎么用?Java GeneratedPropertyContainer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GeneratedPropertyContainer类属于com.vaadin.data.util包,在下文中一共展示了GeneratedPropertyContainer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: listEntities
import com.vaadin.data.util.GeneratedPropertyContainer; //导入依赖的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);
});
}
示例2: handleEvent
import com.vaadin.data.util.GeneratedPropertyContainer; //导入依赖的package包/类
private void handleEvent(final RolloutChangedEvent rolloutChangeEvent) {
if (!rolloutUIState.isShowRollOuts() || rolloutChangeEvent.getRolloutId() == null) {
return;
}
final Optional<Rollout> rollout = rolloutManagement
.getWithDetailedStatus(rolloutChangeEvent.getRolloutId());
if (!rollout.isPresent()) {
return;
}
final GeneratedPropertyContainer rolloutContainer = (GeneratedPropertyContainer) getContainerDataSource();
final Item item = rolloutContainer.getItem(rolloutChangeEvent.getRolloutId());
if (item == null) {
refreshContainer();
return;
}
updateItem(rollout.get(), item);
}
示例3: init
import com.vaadin.data.util.GeneratedPropertyContainer; //导入依赖的package包/类
public void init(String uniqueId, Class<E> entityClazz)
{
if (!getSecurityManager().canUserView())
{
this.setSizeFull();
this.setCompositionRoot(new Label("Sorry, you do not have permission to access " + getTitle()));
return;
}
container = getContainer();
grid = new Grid(new GeneratedPropertyContainer(container));
grid.setSizeFull();
searchBar = buildSearchBar();
mainLayout = new VerticalLayout();
mainLayout.setSizeFull();
addTitle(mainLayout);
mainLayout.addComponent(searchBar);
mainLayout.addComponent(grid);
mainLayout.setExpandRatio(grid, 1);
this.setCompositionRoot(mainLayout);
headingPropertySet = getHeadingPropertySet();
headingPropertySet.setDeferLoadSettings(true);
headingPropertySet.applyToGrid(entityClazz, grid, uniqueId);
}
示例4: initGpc
import com.vaadin.data.util.GeneratedPropertyContainer; //导入依赖的package包/类
/**
* Replaces the current grid container with a {@link GeneratedPropertyContainer}
* while preserving the {@link Grid.DetailsGenerator}.
*/
private void initGpc() {
gpc = new GeneratedPropertyContainer(grid.getContainerDataSource());
Grid.DetailsGenerator details = grid.getDetailsGenerator();
grid.setContainerDataSource(gpc);
grid.setDetailsGenerator(details);
}
示例5: createGrid
import com.vaadin.data.util.GeneratedPropertyContainer; //导入依赖的package包/类
private Grid createGrid(SparklineRenderer sparkline) {
BeanItemContainer<MyPojo> container = new BeanItemContainer<MyPojo>(MyPojo.class);
for (int i = 0; i < 1000; ++i) {
container.addBean(new MyPojo(i));
}
Grid grid = new Grid();
grid.setSizeFull();
RowIndexRenderer rowIndex = new RowIndexRenderer();
GeneratedPropertyContainer gpc = rowIndex.addGeneratedProperty("index", container);
grid.setContainerDataSource(gpc);
grid.getColumn("index").setRenderer(rowIndex);
grid.getColumn("numbers").setRenderer(sparkline);
grid.getColumn("stars").setRenderer(new RatingStarsRenderer(5));
grid.getColumn("stars").setEditable(false);
HtmlButtonRenderer htmlButtonRenderer = new HtmlButtonRenderer(new HtmlButtonRendererClickListener() {
@Override
public void click(HtmlButtonRendererClickEvent event) {
Notification.show("Java button was clicked");
}
});
htmlButtonRenderer.setHtmlContentAllowed(true);
grid.getColumn("foo").setRenderer(htmlButtonRenderer);
grid.getColumn("foo").setEditable(false);
grid.setColumns("index", "id", "foo", "bar", "stars", "numbers");
return grid;
}
示例6: addGeneratedProperty
import com.vaadin.data.util.GeneratedPropertyContainer; //导入依赖的package包/类
/**
* Helper method to add suitable dummy generated property for the row index
*
* @param property The property name
*/
public GeneratedPropertyContainer addGeneratedProperty(String property, Container.Indexed container) {
GeneratedPropertyContainer dummy = new GeneratedPropertyContainer(container);
dummy.addGeneratedProperty(property,new PropertyValueGenerator<String>() {
@Override
public String getValue(Item item, Object itemId, Object propertyId) {
return "";
}
@Override
public Class<String> getType() {
return String.class;
}
});
return dummy;
}
示例7: addGeneratedContainerProperties
import com.vaadin.data.util.GeneratedPropertyContainer; //导入依赖的package包/类
@Override
protected GeneratedPropertyContainer addGeneratedContainerProperties() {
final GeneratedPropertyContainer decoratedContainer = getDecoratedContainer();
decoratedContainer.addGeneratedProperty(VIRT_PROP_RUN, new GenericPropertyValueGenerator());
decoratedContainer.addGeneratedProperty(VIRT_PROP_PAUSE, new GenericPropertyValueGenerator());
decoratedContainer.addGeneratedProperty(VIRT_PROP_UPDATE, new GenericPropertyValueGenerator());
decoratedContainer.addGeneratedProperty(VIRT_PROP_COPY, new GenericPropertyValueGenerator());
decoratedContainer.addGeneratedProperty(VIRT_PROP_DELETE, new GenericPropertyValueGenerator());
return decoratedContainer;
}
示例8: addGeneratedContainerProperties
import com.vaadin.data.util.GeneratedPropertyContainer; //导入依赖的package包/类
@Override
protected GeneratedPropertyContainer addGeneratedContainerProperties() {
final GeneratedPropertyContainer decoratedContainer = getDecoratedContainer();
decoratedContainer.addGeneratedProperty(VIRT_PROP_FORCED, new GenericPropertyValueGenerator());
decoratedContainer.addGeneratedProperty(VIRT_PROP_TIMEFORCED, new GenericPropertyValueGenerator());
decoratedContainer.addGeneratedProperty(VIRT_PROP_ACTION_CANCEL, new GenericPropertyValueGenerator());
decoratedContainer.addGeneratedProperty(VIRT_PROP_ACTION_FORCE, new GenericPropertyValueGenerator());
decoratedContainer.addGeneratedProperty(VIRT_PROP_ACTION_FORCE_QUIT, new GenericPropertyValueGenerator());
return decoratedContainer;
}
示例9: wrapGridContainer
import com.vaadin.data.util.GeneratedPropertyContainer; //导入依赖的package包/类
private GeneratedPropertyContainer wrapGridContainer(final Grid grid)
{
Indexed gridContainer = grid.getContainerDataSource();
if (!(gridContainer instanceof GeneratedPropertyContainer))
{
final GeneratedPropertyContainer gpc = new GeneratedPropertyContainer(gridContainer);
grid.setContainerDataSource(gpc);
gridContainer = gpc;
}
return (GeneratedPropertyContainer) gridContainer;
}
示例10: getContainerDataSource
import com.vaadin.data.util.GeneratedPropertyContainer; //导入依赖的package包/类
protected com.vaadin.data.Container.Indexed getContainerDataSource() {
com.vaadin.data.Container.Indexed containerDataSource = component.getContainerDataSource();
return (containerDataSource instanceof GeneratedPropertyContainer)
? ((GeneratedPropertyContainer) containerDataSource).getWrappedContainer()
: containerDataSource;
}
示例11: getDecoratedContainer
import com.vaadin.data.util.GeneratedPropertyContainer; //导入依赖的package包/类
@Override
public GeneratedPropertyContainer getDecoratedContainer() {
return (GeneratedPropertyContainer) getContainerDataSource();
}
示例12: addGeneratedColumn
import com.vaadin.data.util.GeneratedPropertyContainer; //导入依赖的package包/类
/**
*
*/
private void addGeneratedColumn() {
// Get the container if you have already set it to grid and wrap it in
// GeneratedPropertyContainer
GeneratedPropertyContainer container = new GeneratedPropertyContainer(
grid.getContainerDataSource());
grid.setContainerDataSource(container);
// Add a generated Column to the table
container.addGeneratedProperty("totalSalesTillDate",
new PropertyValueGenerator<Double>() {
/**
*
*/
private static final long serialVersionUID = -7625273505835964597L;
@Override
public Double getValue(Item item, Object itemId,
Object propertyId) {
return getSalesPercentage((VehicleInfo) itemId);
}
@Override
public Class<Double> getType() {
return Double.class;
}
});
grid.getColumn("totalSalesTillDate").setRenderer(
new ProgressBarRenderer());
grid.getColumn("totalSalesTillDate")
.setHeaderCaption("Sales Till Date");
/*
* Remove the properties you wish to hide. Have done it already in
* native container? even then you have do it as this is a new container
*/
container.removeContainerProperty("id");
// A new getter called Total Sales was added for YearlySales
container.removeContainerProperty("sales2012.totalSales");
container.removeContainerProperty("sales2013.totalSales");
container.removeContainerProperty("sales2014.totalSales");
}
示例13: getDecoratedContainer
import com.vaadin.data.util.GeneratedPropertyContainer; //导入依赖的package包/类
/**
* Gives type-save access to the wrapper container the grid works on.
* This wrapper container attaches generated properties that are not
* part of the raw container that encapsulates the database access.
*
* @return decorated container that includes the generated properties as
* well as the native properties.
*/
public abstract GeneratedPropertyContainer getDecoratedContainer();
示例14: addGeneratedContainerProperties
import com.vaadin.data.util.GeneratedPropertyContainer; //导入依赖的package包/类
/**
* Adds the generated properties to the decorated container. Each
* generated property has to be associated with a property generator
* that is capable to calculate the value of the generated (aka virtual)
* property.
*
* @return decorated container that includes the generated properties
*/
protected abstract GeneratedPropertyContainer addGeneratedContainerProperties();
示例15: decorate
import com.vaadin.data.util.GeneratedPropertyContainer; //导入依赖的package包/类
/**
* Decorates the raw-container by wrapping it.
*
* @param container
* raw-container to be wrapped.
* @return decorated container.
*/
protected GeneratedPropertyContainer decorate(final T container) {
return new GeneratedPropertyContainer(container);
}