本文整理汇总了Java中org.bubblecloud.ilves.util.ContainerUtil类的典型用法代码示例。如果您正苦于以下问题:Java ContainerUtil类的具体用法?Java ContainerUtil怎么用?Java ContainerUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ContainerUtil类属于org.bubblecloud.ilves.util包,在下文中一共展示了ContainerUtil类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import org.bubblecloud.ilves.util.ContainerUtil; //导入依赖的package包/类
@Override
public void initialize() {
// Get entity manager from site context and prepare container.
final EntityManager entityManager = getSite().getSiteContext().getObject(EntityManager.class);
entityContainer = new EntityContainer<AuditLogEntry>(entityManager, true, false, false, AuditLogEntry.class, 1000,
new String[] { "created" }, new boolean[] { false }, "auditLogEntryId");
// Get descriptors and set container properties.
final List<FilterDescriptor> filterDescriptors = new ArrayList<FilterDescriptor>();
filterDescriptors.add(new FilterDescriptor("startTime", "created", getSite().localize("filter-start-time"),
new TimestampField(),
200, ">=", Date.class, new DateTime().withTimeAtStartOfDay().toDate()));
filterDescriptors.add(new FilterDescriptor("endTime", "created", getSite().localize("filter-end-time"),
new TimestampField(),
200, "<=", Date.class, new DateTime().withTimeAtStartOfDay().plusDays(1).toDate()));
final List<FieldDescriptor> fieldDescriptors = FieldSetDescriptorRegister.getFieldSetDescriptor(
AuditLogEntry.class).getFieldDescriptors();
ContainerUtil.addContainerProperties(entityContainer, fieldDescriptors);
// Initialize layout
final GridLayout gridLayout = new GridLayout(1, 2);
gridLayout.setSizeFull();
gridLayout.setMargin(false);
gridLayout.setSpacing(true);
gridLayout.setRowExpandRatio(1, 1f);
setViewContent(gridLayout);
final HorizontalLayout buttonLayout = new HorizontalLayout();
buttonLayout.setSpacing(true);
buttonLayout.setSizeUndefined();
gridLayout.addComponent(buttonLayout, 0, 0);
final Table table = new FormattingTable();
table.setPageLength(13);
// Initialize grid
entityGrid = new Grid(table, entityContainer);
entityGrid.setFields(fieldDescriptors);
entityGrid.setFilters(filterDescriptors);
gridLayout.addComponent(entityGrid, 0, 1);
final Button viewButton = getSite().getButton("view");
buttonLayout.addComponent(viewButton);
viewButton.addClickListener(new ClickListener() {
/** Serial version UID. */
private static final long serialVersionUID = 1L;
@Override
public void buttonClick(final ClickEvent event) {
if (entityGrid.getSelectedItemId() == null) {
return;
}
final AuditLogEntry entity = entityContainer.getEntity(entityGrid.getSelectedItemId());
final AuditLogEntryFlowlet contentView = getFlow().forward(AuditLogEntryFlowlet.class);
contentView.edit(entity, false);
}
});
}