public void setSelectedSheet(Sheet sheet) { for (int i = 0; i < tabbedPane.getTabCount(); i++) { SheetPanel sheetPanel = (SheetPanel) tabbedPane.getComponentAt(i); if (sheetPanel.getSheet().getName().equals(sheet.getName())) { tabbedPane.setSelectedIndex(i); break; } } }
public void workbookChanged(WorkbookChangeEvent event) { if (event.getChange() instanceof SetCellValue) { SetCellValue scv = (SetCellValue) event.getChange(); scv.getSheet().getName(); SheetPanel sheetPanel = (SheetPanel) tabbedPane.getSelectedComponent(); SheetTableModel model = (SheetTableModel) sheetPanel.getSheetTable().getModel(); model.fireTableCellUpdated(scv.getRow(), scv.getCol()); } manager.getWorkbookState().changesUnsaved(); }
private void rebuildTabs() { rebuildingTabs = true; for (int i = 0; i < tabbedPane.getTabCount(); i++) { SheetPanel sheetPanel = (SheetPanel) tabbedPane.getComponentAt(i); sheetPanel.dispose(); } tabbedPane.removeAll(); Workbook workbook = manager.getWorkbook(); for (Sheet sheet : workbook.getSheets()) { if (!sheet.isHidden()) { SheetPanel sheetPanel = new SheetPanel(manager, sheet); tabbedPane.add(sheet.getName(), sheetPanel); } } rebuildingTabs = false; }
public Sheet getSelectedSheet() { SheetPanel sheetPanel = (SheetPanel) tabbedPane.getSelectedComponent(); return sheetPanel.getSheet(); }