Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
setEnabled(false) on SpreadSheet
Every component in Vaadin has the setEnabled(...)-method inherited. But what I haven't understand yet is why setEnabled(false) seems to behave unexpected on some components.
My concrete problem is to disable a spreadsheet component. Calling the method setEnabled(false) causes the Spreadsheet to be not disabled in the sense of "user cannot interact with component". The only side effect I recognized is that a programatically change to the spreadsheet cell value leads to "#Value!".
Here is my code:
public class ApplicationUI extends UI {
private static final long serialVersionUID = 7177458298849973108L;
private Window window;
private Spreadsheet spreadsheet;
@Override
public void init(VaadinRequest request) {
this.setSizeFull();
addWindow(getWindow());
getWindow().center();
getSpreadSheet().setEnabled(false);
}
private void writeHelloToSpreadSheet() {
Workbook workbook = getSpreadSheet().getWorkbook();
final Sheet activeSheet = workbook.getSheetAt(workbook.getActiveSheetIndex());
Cell createCell = activeSheet.createRow(0).createCell(0);
createCell.setCellValue("Hello");
getSpreadSheet().refreshCells(createCell);
}
private Window getWindow() {
if (window == null) {
window = new Window();
window.setCaption("Title");
window.setWidth("500px");
window.setHeight("400px");
window.setContent(createWindowLayout());
}
return window;
}
private VerticalLayout createWindowLayout() {
VerticalLayout verticalLayout = new VerticalLayout(getSpreadSheet(), createButtonWriteHelloToSpreadSheet());
verticalLayout.setSpacing(true);
verticalLayout.setMargin(true);
verticalLayout.setSizeFull();
return verticalLayout;
}
private Button createButtonWriteHelloToSpreadSheet() {
Button buttonHello = new Button("Hello");
buttonHello.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
@Override
public void buttonClick(ClickEvent event) {
writeHelloToSpreadSheet();
}
});
return buttonHello;
}
private Spreadsheet getSpreadSheet() {
if (spreadsheet == null) {
spreadsheet = new Spreadsheet();
spreadsheet.setHeight("100%");
spreadsheet.setSheetSelectionBarVisible(false);
spreadsheet.setFunctionBarVisible(false);
}
return spreadsheet;
}
}
I ran into the same issue today.
Did you find a workaround to disable the component?
I know I can lock the spreadsheet with
spreadsheet.setActiveSheetProtected("");
but that's not a good option for me (because our sheet is protected already, and has some editable regions that are not protected).