Example #1
0
 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;
     }
   }
 }
Example #2
0
 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();
 }
Example #3
0
  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;
  }
Example #4
0
 public Sheet getSelectedSheet() {
   SheetPanel sheetPanel = (SheetPanel) tabbedPane.getSelectedComponent();
   return sheetPanel.getSheet();
 }