本文整理汇总了Java中com.vaadin.data.Item类的典型用法代码示例。如果您正苦于以下问题:Java Item类的具体用法?Java Item怎么用?Java Item使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Item类属于com.vaadin.data包,在下文中一共展示了Item类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateData
import com.vaadin.data.Item; //导入依赖的package包/类
@Override
public void generateData(Object itemId, Item item, JsonObject jsonRow) {
JsonObject jsonData = jsonRow.getObject("d");
for (String key : jsonData.keys()) {
if (getColumn(key).getRenderer() == this) {
// 2: VERY IMPORTANT get the component from the connector tracker !!!
// if you use a GeneratedPropertyContainer and call get Value you will
// get a different component
if (jsonData.get(key) != Json.createNull()) {
Component current = lookupComponent(jsonData, key);
trackComponent(itemId, current);
}
}
}
}
示例2: ItemPropertyValueChangeListener
import com.vaadin.data.Item; //导入依赖的package包/类
/**
* Constructor
* @param item Item
* @param itemStore Item store
*/
public ItemPropertyValueChangeListener(Item item, ItemStore<Item> itemStore) {
super();
this.item = new WeakReference<>(item);
this.itemStore = itemStore;
if (item != null) {
// add value change listener to track property modifications
Collection<?> itemPropertyIds = item.getItemPropertyIds();
if (itemPropertyIds != null) {
trackedItemProperties = new HashSet<>(itemPropertyIds.size());
for (Object itemPropertyId : itemPropertyIds) {
Property<?> itemProperty = item.getItemProperty(itemPropertyId);
if (itemProperty instanceof ValueChangeNotifier) {
((ValueChangeNotifier) itemProperty).addValueChangeListener(this);
trackedItemProperties.add(new WeakReference<>(itemProperty));
}
}
}
}
}
示例3: testItemQueryContainerId
import com.vaadin.data.Item; //导入依赖的package包/类
@Test
public void testItemQueryContainerId() {
ItemDataSourceContainer<TestDataDomain, String> container = ItemDataSourceContainer
.<TestDataDomain, String>builder().dataSource(new TestItemDataProvider()).itemAdapter(ADAPTER)
.batchSize(10).withSortableProperty("code", String.class)
.withSortableProperty("description", String.class).withSortableProperty("sequence", Integer.class)
.withSortableProperty("obsolete", int.class).itemIdentifier(i -> i.getCode()).build();
int size = container.size();
assertEquals(23, size);
Item itm = container.getItem("c2");
assertNotNull(itm);
assertEquals("c2", itm.getItemProperty("code").getValue());
container.sort(new String[] { "sequence" }, new boolean[] { true });
int idx = container.indexOfId("c20");
assertEquals(19, idx);
}
示例4: confirmRemoveLock
import com.vaadin.data.Item; //导入依赖的package包/类
/** Supprime un verrou
* @param lockItem le verrou a supprimer
*/
public void confirmRemoveLock(SessionPresentation lockItem) {
Item item = uisContainer.getItem(lockItem);
String textLock = lockItem.getId();
if (item!=null && lockItem.getInfo()!=null){
textLock = lockItem.getInfo();
}
ConfirmWindow confirmWindow = new ConfirmWindow(applicationContext.getMessage("admin.uiList.confirmRemoveLock", new Object[]{textLock}, UI.getCurrent().getLocale()));
confirmWindow.addBtnOuiListener(e -> {
Object lock = lockController.getLockBySessionItem(lockItem);
if (lock != null){
lockController.removeLock(lock);
}else{
Notification.show(applicationContext.getMessage("admin.uiList.confirmKillUI.error", null, UI.getCurrent().getLocale()), Type.WARNING_MESSAGE);
}
majContainer();
});
UI.getCurrent().addWindow(confirmWindow);
}
示例5: passesFilter
import com.vaadin.data.Item; //导入依赖的package包/类
/**
* Pass le filtre
*
* @param itemId
* @param item
* @return true si filtre ok
*/
@Override
public boolean passesFilter(Object itemId, Item item) {
final Property<?> p = item.getItemProperty(propertyId);
if (p == null) {
return false;
}
Object propertyValue = p.getValue();
if (propertyValue == null) {
return false;
}
final String value = stripAccents(propertyValue.toString());
if (!value.contains(filterString)) {
return false;
}
return true;
}
示例6: colorizeValidUntilRows
import com.vaadin.data.Item; //导入依赖的package包/类
private void colorizeValidUntilRows() {
final Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.MONTH, this.CERT_MONTHLY_THRESHOLD);
this.sslConfigTable.setCellStyleGenerator((Table.CellStyleGenerator) (table, itemId, propertyId) -> {
if (propertyId != null) {
return null;
}
Item item = this.sslConfigTable.getItem(itemId);
Date validUntil = (Date) item.getItemProperty("Valid until").getValue();
if (validUntil.before(calendar.getTime())) {
return "highlight-warning";
} else {
return null;
}
});
}
示例7: updateItem
import com.vaadin.data.Item; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void updateItem(Item item, PluginApi plugin) {
item.getItemProperty(PROP_PLUGIN_STATE).setValue(plugin.getState().toString());
item.getItemProperty(PROP_PLUGIN_NAME).setValue(plugin.getSymbolicName());
item.getItemProperty(PROP_PLUGIN_VERSION).setValue(plugin.getVersion());
item.getItemProperty(PROP_PLUGIN_SERVICES).setValue(plugin.getServiceCount());
String info;
if (plugin.getState() == State.ERROR) {
info = plugin.getError();
} else {
info = "";
}
item.getItemProperty(PROP_PLUGIN_INFO).setValue(info);
Button deleteButton = new Button("Delete");
deleteButton.addClickListener(event -> deletePlugin(plugin));
item.getItemProperty(PROP_PLUGIN_DELETE).setValue(deleteButton);
}
示例8: createDeleteButton
import com.vaadin.data.Item; //导入依赖的package包/类
/**
* 创建删除按钮
* @return
*/
private Button createDeleteButton() {
Button deleteButton = new Button("删除",FontAwesome.CLOSE);
deleteButton.addStyleName(ValoTheme.BUTTON_DANGER);
deleteButton.addClickListener((Button.ClickListener) clickEvent -> {
//validate
Collection<Object> items = grid.getSelectedRows();
if(items.size() == 0){
Notification.show("请选中要删除的行!", Notification.Type.ERROR_MESSAGE);
return;
}
//batch delete
for (Object object : items) {
Item item = grid.getContainerDataSource().getItem(object);
if (item != null) {
Long id = (Long) item.getItemProperty("序号").getValue();
zookeeperConsumerRepository.delete(id);
}
}
search();
});
return deleteButton;
}
示例9: addTestColumnButton
import com.vaadin.data.Item; //导入依赖的package包/类
/**
* 添加按钮列
* @param pId
*/
private void addTestColumnButton(String pId) {
Grid.Column column = grid.addColumn(pId,String.class);
column.setWidth(100d);
column.setRenderer(new ButtonRenderer((ClickableRenderer.RendererClickListener) rendererClickEvent -> {
Object itemId = rendererClickEvent.getItemId();
Item item = grid.getContainerDataSource().getItem(itemId);
String ip = (String) item.getItemProperty("IP").getValue();
String port = (String) item.getItemProperty("端口").getValue();
boolean isConnected = DubboSwitchTool.isConnected(ip + ":" + port);
if (isConnected) {
Notification.show("连接成功!",Notification.Type.HUMANIZED_MESSAGE);
return;
}
Notification.show("连接失败!",Notification.Type.ERROR_MESSAGE);
}));
}
示例10: createDeleteButton
import com.vaadin.data.Item; //导入依赖的package包/类
/**
* 创建删除按钮
* @return
*/
private Button createDeleteButton() {
Button deleteButton = new Button("删除",FontAwesome.CLOSE);
deleteButton.addStyleName(ValoTheme.BUTTON_DANGER);
deleteButton.addClickListener((Button.ClickListener) clickEvent -> {
//validate
Collection<Object> items = grid.getSelectedRows();
if(items.size() == 0){
Notification.show("请选中要删除的行!", Notification.Type.ERROR_MESSAGE);
return;
}
//batch delete
for (Object object : items) {
Item item = grid.getContainerDataSource().getItem(object);
if(item != null){
Long id = (Long) item.getItemProperty("序号").getValue();
zookeeperAppRepository.delete(id);
}
}
search();
});
return deleteButton;
}
示例11: addColumnButton
import com.vaadin.data.Item; //导入依赖的package包/类
/**
* 添加按钮列
* @param pId
*/
private void addColumnButton(String pId) {
Grid.Column column = grid.addColumn(pId,String.class);
column.setWidth(100d);
column.setRenderer(new ButtonRenderer((ClickableRenderer.RendererClickListener) rendererClickEvent -> {
Object itemId = rendererClickEvent.getItemId();
Item item = grid.getContainerDataSource().getItem(itemId);
Long appId = (Long) item.getItemProperty("序号").getValue();
String appName = (String) item.getItemProperty("应用名称").getValue();
if ("清理".equals(pId)) {
zookeeperAppClearUI.show(appId,appName);
UI.getCurrent().addWindow(zookeeperAppClearUI);
} else if ("切换".equals(pId)) {
zookeeperAppSwitchUI.show(appId,appName);
UI.getCurrent().addWindow(zookeeperAppSwitchUI);
}
}));
}
示例12: createDeleteButton
import com.vaadin.data.Item; //导入依赖的package包/类
/**
* 创建删除按钮
* @return
*/
private Button createDeleteButton() {
Button deleteButton = new Button("删除",FontAwesome.CLOSE);
deleteButton.addStyleName(ValoTheme.BUTTON_DANGER);
deleteButton.addClickListener((Button.ClickListener) clickEvent -> {
//validate
Collection<Object> items = grid.getSelectedRows();
if(items.size() == 0){
Notification.show("请选中要删除的行!", Notification.Type.ERROR_MESSAGE);
return;
}
//batch delete
for (Object object : items) {
Item item = grid.getContainerDataSource().getItem(object);
if (item != null) {
Long id = (Long) item.getItemProperty("序号").getValue();
zookeeperProviderRepository.delete(id);
}
}
search();
});
return deleteButton;
}
示例13: handleAction
import com.vaadin.data.Item; //导入依赖的package包/类
@Override
public void handleAction(final Action action, final Object sender,
final Object target) {
if (action == report) {
// createNewReportFromSelection();
} else if (action == discard) {
Notification.show("Not implemented in this demo");
} else if (action == details) {
Item item = ((Table) sender).getItem(target);
if (item != null) {
Long movieId = (Long) item.getItemProperty("movieId")
.getValue();
MovieDetailsWindow.open(DashboardUI.getDataProvider()
.getMovie(movieId), null, null);
}
}
}
示例14: getPerfiles
import com.vaadin.data.Item; //导入依赖的package包/类
private IndexedContainer getPerfiles() {
// TODO Auto-generated method stub
IndexedContainer container = new IndexedContainer();
container.addContainerProperty("descripcion", String.class, null);
container.addContainerProperty("id", String.class, null);
List list = new ArrayList();
Perfil bean = new Perfil();
Item item = null;
CorePerfil perfilCore = new CorePerfil();
list = perfilCore.getPerfilesHabilitados();
for (int i=0;i<list.size();i++){
bean = (Perfil) list.get(i);
item = container.addItem(bean.getId());
item.getItemProperty("descripcion").setValue(bean.getNombre());
item.getItemProperty("id").setValue(Integer.valueOf(bean.getId()).toString());
}
return container;
}
示例15: getAreas
import com.vaadin.data.Item; //导入依赖的package包/类
private IndexedContainer getAreas() {
// TODO Auto-generated method stub
IndexedContainer container = new IndexedContainer();
container.addContainerProperty("descripcion", String.class, null);
container.addContainerProperty("id", String.class, null);
CoreArea areaCore = new CoreArea();
List list = new ArrayList();
Area bean = new Area();
Item item = null;
list = areaCore.getAreasHabilitadas();
for (int i=0;i<list.size();i++){
bean = (Area) list.get(i);
item = container.addItem(bean.getId());
item.getItemProperty("descripcion").setValue(bean.getNombre());
item.getItemProperty("id").setValue(Integer.valueOf(bean.getId()).toString());
}
return container;
}