本文整理了Java中com.vaadin.ui.Grid.getSelectedRow()
方法的一些代码示例,展示了Grid.getSelectedRow()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Grid.getSelectedRow()
方法的具体详情如下:
包路径:com.vaadin.ui.Grid
类名称:Grid
方法名:getSelectedRow
暂无
代码示例来源:origin: org.eclipse.hawkbit/hawkbit-ui
private void onAdd() {
metaDataGrid.deselect(metaDataGrid.getSelectedRow());
clearFields();
enableEditing();
addIcon.setEnabled(true);
}
代码示例来源:origin: eclipse/hawkbit
private void onAdd() {
metaDataGrid.deselect(metaDataGrid.getSelectedRow());
clearFields();
enableEditing();
addIcon.setEnabled(true);
}
代码示例来源:origin: stackoverflow.com
TextField text = new TextField("Edit");
Grid grid;
BeanItemContainer<Customer> container;
@Override
protected void init(VaadinRequest request) {
final VerticalLayout layout = new VerticalLayout();
container = new BeanItemContainer<>(Customer.class, Arrays.asList(new Customer("1"), new Customer("2")));
grid = new Grid(container);
Button open = new Button("open");
open.addClickListener(this :: openListener);
Button save = new Button("save");
save.addClickListener(this :: saveListener);
layout.addComponents(grid, open, save, text);
setContent(layout);
}
private void openListener(Button.ClickEvent clickEvent){
text.setValue(((Customer) (grid.getSelectedRow())).getName());
}
private void saveListener(Button.ClickEvent clickEvent){
Customer c = (Customer) grid.getSelectedRow();
c.setName(text.getValue());
grid.clearSortOrder();
}
代码示例来源:origin: eclipse/hawkbit
private void handleOkDeleteMetadata(final RendererClickEvent event, final String key) {
deleteMetadata(getSelectedEntity(), key);
uiNotification.displaySuccess(i18n.getMessage("message.metadata.deleted.successfully", key));
final Object selectedRow = metaDataGrid.getSelectedRow();
metaDataGrid.getContainerDataSource().removeItem(event.getItemId());
// force grid to refresh
metaDataGrid.clearSortOrder();
if (!metaDataGrid.getContainerDataSource().getItemIds().isEmpty()) {
if (selectedRow != null) {
if (selectedRow.equals(event.getItemId())) {
metaDataGrid.select(metaDataGrid.getContainerDataSource().getIdByIndex(0));
} else {
metaDataGrid.select(selectedRow);
}
}
} else {
resetFields();
}
}
代码示例来源:origin: org.eclipse.hawkbit/hawkbit-ui
private void handleOkDeleteMetadata(final RendererClickEvent event, final String key) {
deleteMetadata(getSelectedEntity(), key);
uiNotification.displaySuccess(i18n.getMessage("message.metadata.deleted.successfully", key));
final Object selectedRow = metaDataGrid.getSelectedRow();
metaDataGrid.getContainerDataSource().removeItem(event.getItemId());
// force grid to refresh
metaDataGrid.clearSortOrder();
if (!metaDataGrid.getContainerDataSource().getItemIds().isEmpty()) {
if (selectedRow != null) {
if (selectedRow.equals(event.getItemId())) {
metaDataGrid.select(metaDataGrid.getContainerDataSource().getIdByIndex(0));
} else {
metaDataGrid.select(selectedRow);
}
}
} else {
resetFields();
}
}
代码示例来源:origin: org.eclipse.hawkbit/hawkbit-ui
protected void onSave() {
final String key = keyTextField.getValue();
final String value = valueTextArea.getValue();
if (mandatoryCheck()) {
final E entity = selectedEntity;
if (metaDataGrid.getSelectedRow() == null) {
if (!duplicateCheck(entity)) {
final M metadata = createMetadata(entity, key, value);
uiNotification.displaySuccess(i18n.getMessage("message.metadata.saved", metadata.getKey()));
addItemToGrid(metadata);
metaDataGrid.scrollToEnd();
metaDataGrid.select(metadata.getKey());
addIcon.setEnabled(true);
metadataWindow.setSaveButtonEnabled(false);
if (!hasUpdatePermission()) {
valueTextArea.setEnabled(false);
}
}
} else {
final M metadata = updateMetadata(entity, key, value);
uiNotification.displaySuccess(i18n.getMessage("message.metadata.updated", metadata.getKey()));
updateItemInGrid(metadata.getKey());
metaDataGrid.select(metadata.getKey());
addIcon.setEnabled(true);
metadataWindow.setSaveButtonEnabled(false);
}
}
}
代码示例来源:origin: eclipse/hawkbit
protected void onSave() {
final String key = keyTextField.getValue();
final String value = valueTextArea.getValue();
if (mandatoryCheck()) {
final E entity = selectedEntity;
if (metaDataGrid.getSelectedRow() == null) {
if (!duplicateCheck(entity)) {
final M metadata = createMetadata(entity, key, value);
uiNotification.displaySuccess(i18n.getMessage("message.metadata.saved", metadata.getKey()));
addItemToGrid(metadata);
metaDataGrid.scrollToEnd();
metaDataGrid.select(metadata.getKey());
addIcon.setEnabled(true);
metadataWindow.setSaveButtonEnabled(false);
if (!hasUpdatePermission()) {
valueTextArea.setEnabled(false);
}
}
} else {
final M metadata = updateMetadata(entity, key, value);
uiNotification.displaySuccess(i18n.getMessage("message.metadata.updated", metadata.getKey()));
updateItemInGrid(metadata.getKey());
metaDataGrid.select(metadata.getKey());
addIcon.setEnabled(true);
metadataWindow.setSaveButtonEnabled(false);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!